/* Is-This photo quiz — shared by every page under /forayzu/quiz/ (engine: quiz.js).
   After changing this file, bump ?v= on the <link> in every quiz page — browsers and Cloudflare cache it. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Subset of css/tokens.css (Forayz design tokens) — kept here so the quiz needs no theme CSS. */
:root {
  --forest-900: #1b3a2d;
  --forest-800: #234b39;
  --forest-700: #2d5e47;
  --forest-600: #3a7a5c;
  --forest-200: #c2dfd0;
  --forest-100: #e4f0ea;
  --forest-50: #f2f8f5;
  --bark-700: #6b4a2e;
  --bark-200: #e8d5bf;
  --bark-100: #f4ebe0;
  --bark-50: #faf6f1;
  --chant-600: #c4762a;
  --chant-500: #d98b3a;
  --chant-100: #fcf0e2;
  --text-primary: #1b3a2d;
  --text-secondary: #5a6e63;
  --surface: #fdfbf8;
  --wrong: #b3412e;
  --wrong-100: #f8e6e2;
  --unsure: #6e6488;
  --unsure-100: #eeebf4;
  --radius: 14px;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'DM Serif Display', Georgia, serif;
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bark-50);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
button { font-family: inherit; touch-action: manipulation; }
a { color: var(--forest-700); }

/* ── Header ── */
#quiz-nav {
  background: var(--forest-900);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}
#quiz-nav .nav-brand {
  font-family: var(--font-display);
  font-size: 18px;
  color: #fff;
  text-decoration: none;
  margin-right: auto;
}
#quiz-nav .nav-links { display: flex; gap: 16px; }
#quiz-nav .nav-links a { color: var(--forest-200); text-decoration: none; font-size: 13px; font-weight: 500; }
#quiz-nav .nav-links a:hover { color: #fff; }
#class-badge {
  display: none;
  background: var(--chant-500);
  color: var(--forest-900);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 999px;
}
body.class-mode #class-badge { display: inline-block; }
body.class-mode #quiz-nav .nav-links { display: none; }

/* ── Progress / score bar ── */
#scorebar {
  background: var(--forest-700);
  color: #fff;
  padding: 8px 16px 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.score-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 64px;
  padding: 0 10px 6px;
  border-right: 1px solid rgba(255,255,255,0.18);
}
.score-block:last-of-type { border-right: none; }
.score-num { font-size: 20px; font-weight: 700; line-height: 1.1; }
.score-label { font-size: 10px; opacity: 0.75; text-transform: uppercase; letter-spacing: 0.06em; }
.score-block.correct .score-num { color: #a8f0c0; }
.score-block.wrong .score-num { color: #ffb8aa; }
.score-block.unsure .score-num { color: #ddd5f5; }
#class-progress-text { display: none; font-size: 14px; font-weight: 600; padding-bottom: 8px; }
body.class-mode .score-block { display: none; }
body.class-mode #class-progress-text { display: block; }
/* Stop at any point and see the score — shown once there is at least one answer. */
#finish-btn {
  margin-left: auto;
  margin-bottom: 6px;
  background: var(--chant-500);
  border: 1px solid var(--chant-500);
  color: var(--forest-900);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: none;
}
body.class-mode #progress { display: none; }
body.class-mode #scorebar { padding-bottom: 2px; }
#progress { flex-basis: calc(100% + 32px); height: 4px; background: rgba(255,255,255,0.18); margin: 0 -16px; }
#progress-bar { height: 100%; width: 0%; background: var(--chant-500); transition: width 0.3s; }

/* ── Screens ── */
.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 14px 16px 24px;
  gap: 12px;
}
.screen.show { display: flex; }
#loading { align-items: center; justify-content: center; color: var(--text-secondary); }

/* ── Join screen (class mode) ── */
#join { justify-content: center; text-align: center; gap: 16px; }
#join h1, #summary h1 { font-family: var(--font-display); font-weight: 400; font-size: 32px; line-height: 1.15; }
.join-code {
  display: inline-block;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--forest-700);
  background: var(--forest-100);
  border-radius: 12px;
  padding: 6px 18px 6px 24px;
}
.lede { color: var(--text-secondary); font-size: 16px; line-height: 1.5; }
#nickname {
  font: inherit;
  font-size: 18px;
  padding: 14px 16px;
  border: 2px solid var(--bark-200);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text-primary);
  width: 100%;
  text-align: center;
}
#nickname:focus { outline: none; border-color: var(--forest-600); }
.btn-primary {
  font-size: 18px;
  font-weight: 700;
  padding: 16px 24px;
  border: none;
  border-radius: var(--radius);
  background: var(--forest-700);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn-primary:active { transform: scale(0.98); }

/* ── Quiz ── */
#quiz-meta { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; color: var(--text-secondary); }
body.class-mode #card-counter { display: none; }
/* Which region the species and look-alikes come from — shown on every card and on the score. */
.region-tag {
  background: var(--forest-100);
  color: var(--forest-800);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
}
.region-note { font-size: 13px; line-height: 1.5; color: var(--text-secondary); max-width: 420px; }
#photo-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #14201a;
  aspect-ratio: 4 / 3;
  max-height: 52vh;
  max-height: 52dvh;
  width: 100%;
  flex-shrink: 0;
  cursor: zoom-in;
}
#quiz-photo { width: 100%; height: 100%; object-fit: contain; display: block; transition: opacity 0.2s; }
#zoom-hint {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(0,0,0,0.45);
  color: #fff;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  pointer-events: none;
}
#photo-attribution {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 16px 10px 6px;
  background: linear-gradient(transparent, rgba(0,0,0,0.55));
  color: rgba(255,255,255,0.75);
  font-size: 10px;
  text-align: right;
}
#photo-attribution a { color: inherit; }

#question-text { text-align: center; font-family: var(--font-display); font-size: 26px; line-height: 1.15; }
#question-subtitle { text-align: center; font-size: 13px; color: var(--text-secondary); margin-top: -6px; }

#answer-buttons { display: flex; gap: 10px; }
.answer-btn {
  flex: 1;
  padding: 18px 6px;
  font-size: 17px;
  font-weight: 700;
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s, box-shadow 0.15s;
}
.answer-btn:active { transform: scale(0.97); }
.btn-yes    { background: var(--forest-100); border-color: var(--forest-600); color: var(--forest-800); }
.btn-no     { background: var(--wrong-100);  border-color: var(--wrong);      color: #7a2a1c; }
.btn-unsure { background: var(--unsure-100); border-color: var(--unsure);     color: #423a5c; }
#answer-buttons.answered .answer-btn { opacity: 0.3; cursor: default; }
#answer-buttons.answered .answer-btn.selected { opacity: 1; box-shadow: 0 0 0 3px currentColor; }

/* Feedback (public mode reveals the answer; class mode only confirms it was saved) */
#feedback {
  display: none;
  border-radius: var(--radius);
  color: #fff;
  padding: 12px 14px;
  gap: 12px;
  align-items: center;
  cursor: pointer;
}
#feedback.show { display: flex; }
#feedback.correct { background: var(--forest-600); }
#feedback.incorrect { background: var(--wrong); }
#feedback.unsure { background: var(--unsure); }
#feedback.saved { background: var(--forest-800); justify-content: center; }
#feedback-body { flex: 1; min-width: 0; }
#feedback-verdict { font-size: 16px; font-weight: 700; }
#feedback-species { font-size: 14px; font-weight: 600; margin-top: 2px; }
#feedback-species em { font-weight: 400; opacity: 0.9; }
#feedback-explain { font-size: 13px; line-height: 1.4; margin-top: 4px; opacity: 0.92; }
#feedback-next {
  flex-shrink: 0;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
}

/* ── Done (class) + summary (public) ── */
#summary { justify-content: center; align-items: center; text-align: center; gap: 14px; }
#summary-class-note { display: none; }
body.class-mode #summary-class-note { display: block; }
body.class-mode #restart-btn, body.class-mode .engage { display: none; }
#sync-status { font-size: 13px; color: var(--text-secondary); }
#sync-status.pending { color: var(--chant-600); font-weight: 600; }
.summary-pct { font-family: var(--font-display); font-size: 64px; color: var(--forest-700); line-height: 1; }
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 420px; }
.summary-cell { background: #fff; border: 1px solid var(--bark-200); border-radius: var(--radius); padding: 14px; }
.summary-cell .cell-num { font-size: 26px; font-weight: 700; }
.summary-cell .cell-label { font-size: 12px; color: var(--text-secondary); }
.cell-num.good { color: var(--forest-600); }
.cell-num.bad { color: var(--wrong); }
.engage { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 420px; }
.engage a {
  background: var(--forest-800);
  color: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  text-align: left;
  text-decoration: none;
}
.engage .k { font-size: 11px; color: var(--chant-500); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.engage .t { font-size: 14px; font-weight: 600; margin-top: 2px; }
.engage .engage-wide { grid-column: 1 / -1; }

/* ── Photo zoom ── */
#zoom {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
#zoom.show { display: flex; }
#zoom img { max-width: 100%; max-height: 100%; object-fit: contain; }
#zoom .close { position: absolute; top: 12px; right: 12px; color: #fff; font-size: 14px; background: rgba(255,255,255,0.15); padding: 6px 12px; border-radius: 999px; }

@media (max-width: 480px) {
  #quiz-nav .nav-links { display: none; }
  .score-block { min-width: 46px; padding: 0 5px 6px; }
  .score-num { font-size: 17px; }
  #question-text { font-size: 22px; }
  .answer-btn { font-size: 15px; padding: 16px 4px; }
  .engage { grid-template-columns: 1fr; }
}
