/* ============================================================
   playful.css — "Sunny Classroom" skin (loaded LAST)
   ------------------------------------------------------------
   Kid-friendly re-skin of Home, Quiz (config + play) and Result
   for elementary-school learners and the parents beside them:
   rounder, chunkier, bigger type, a rounded display face (Jua)
   and tactile "toy button" presses.

   Override layer only — layouts still live in screens.css; this
   file restyles them via tokens (variables.css) so the white,
   black and blue themes all follow. Other screens only inherit
   the global bits in §1 (focus ring, buttons, chips, header/nav).

   Chunky press pattern: a solid bottom edge drawn with
   `box-shadow: 0 var(--press-depth) 0 <edge>` that collapses on
   :active while the element drops by the same amount — so it
   feels pushed in, and nothing below it shifts.

   Every animation added here is switched off in §6 for
   prefers-reduced-motion (base.css also clamps durations).
   ============================================================ */

/* ════════════════════════════════════════════════════════════
   §1  GLOBAL — focus, header, nav, buttons, chips
   ════════════════════════════════════════════════════════════ */

/* Solid, thicker ring — the translucent --ring alone falls under 3:1
   against the cream background. */
:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

/* scrollIntoView (e.g. the quiz "Next" button) keeps targets clear of the
   fixed bottom nav, which overlays the scroller's bottom padding. */
#app-content { scroll-padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + var(--sp-2)); }

#header-title {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: var(--fs-lg);
  letter-spacing: 0.01em;
}

.nav-tab__label { font-size: 0.72rem; font-weight: var(--fw-bold); }

/* Mobile bottom nav: the active icon sits in a soft pill (clearer than
   the 3px top bar alone for kids scanning the tabs). */
@media (max-width: 1023px) {
  .nav-tab__icon {
    padding: 3px 14px;
    border-radius: var(--r-full);
    transition: background var(--dur-fast) var(--ease-out);
  }
  .nav-tab--active .nav-tab__icon { background: var(--primary-soft); }
  .nav-tab--active::before { display: none; }
}

/* ── Buttons: chunky with a pressable bottom edge ─────────────── */
.btn {
  min-height: 48px;
  border-radius: var(--r-lg);
  font-weight: var(--fw-bold);
}
.btn-sm { min-height: 44px; border-radius: var(--r-md); }
.btn-icon { min-height: 44px; }

.btn-primary,
.btn-secondary {
  box-shadow: 0 var(--press-depth) 0 var(--edge-color, var(--edge));
}
.btn-primary { --edge-color: var(--primary-edge); }
.btn-secondary {
  background: var(--surface);
  border: 2px solid var(--border-strong);
  --edge-color: var(--border-strong);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 var(--press-depth) 0 var(--primary-edge), var(--sh-primary);
}
.btn-secondary:hover:not(:disabled) { background: var(--surface-alt); }

/* Replaces fun.css's hover scale + jelly squash: the press-in IS the feedback */
.btn-primary:hover:not(:disabled),
.btn-lg:hover:not(:disabled),
.btn-secondary:hover:not(:disabled) { transform: translateY(-1px); }
.btn-primary:active:not(:disabled),
.btn-secondary:active:not(:disabled) {
  animation: none;
  transform: translateY(var(--press-depth));
  box-shadow: 0 0 0 var(--edge-color, var(--edge));
}

.btn-lg {
  min-height: 58px;
  border-radius: var(--r-xl);
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: var(--fs-lg);
  letter-spacing: 0.01em;
}
.btn-lg .material-symbols-rounded { font-size: 1.35em; }

/* ── Chips ─────────────────────────────────────────────────── */
.chip {
  min-height: 46px;
  padding: 6px 16px;
  border-width: 2px;
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
}
.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 3px 0 var(--primary-edge);
}
.chip.active .chip-ico { opacity: 1; }

/* ════════════════════════════════════════════════════════════
   §2  HOME
   ════════════════════════════════════════════════════════════ */

.home-screen { padding-bottom: var(--sp-8); }

/* ── Hero: 부기 on a sunny "nest" is the star of the screen ─── */
.home-hero {
  margin-top: var(--sp-4);
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  box-shadow: 0 6px 0 var(--primary-edge), var(--sh-md);
  margin-bottom: 6px; /* room for the edge */
}
/* Decorative bubbles, top-right */
.home-hero::after {
  content: '';
  position: absolute;
  top: -34px;
  right: -26px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 18px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.home-level { gap: var(--sp-4); }

.home-mascot-wrap,
.home-level-badge {
  width: 88px;
  height: 88px;
}
.home-mascot-wrap {
  border-radius: 50%;
  background: var(--hero-sun);
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.08), 0 0 0 5px rgba(255, 255, 255, 0.18);
}
.home-mascot { filter: drop-shadow(0 3px 2px rgba(43, 34, 64, 0.25)); }
.home-mascot-lv {
  bottom: -6px;
  right: auto;
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 9px;
  background: var(--surface);
  color: var(--primary-text);
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: var(--fs-xs);
  box-shadow: 0 2px 0 rgba(43, 34, 64, 0.18);
}
.home-level-badge {
  border-radius: 50%;
  background: var(--hero-sun);
  color: var(--on-accent);
}
.home-level-num { font-family: var(--font-display); font-weight: var(--fw-display); }

.home-level-title {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: var(--fs-xl);
  line-height: var(--lh-tight);
  margin-bottom: var(--sp-3);
}
.home-xp-bar {
  height: 14px;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.12);
}
.home-xp-fill {
  min-width: 14px; /* a dot, so a fresh bar still reads as "a bar" */
  background: var(--hero-sun);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12);
}
.home-xp-label {
  margin-top: 6px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: rgba(255, 255, 255, 0.94);
}

.home-hero-bottom {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
}

.home-streak-chip {
  min-height: 34px;
  padding: 4px 12px;
  font-size: var(--fs-base);
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.16);
}
.home-streak-chip .material-symbols-rounded { font-size: 1.2rem; }
.home-streak-chip.active { background: var(--hero-sun); color: var(--on-accent); }
.home-streak-chip.active .material-symbols-rounded { color: #d9480f; }

.home-hero-foot {
  min-height: 34px;
  margin: 0;
  padding: 4px 14px;
  border-top: 0;
  border-radius: var(--r-full);
  background: rgba(0, 0, 0, 0.14);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  text-align: center;
}

/* ── Primary "continue" CTA: a big chunky card in the mode color ── */
.home-continue-cta.home-primary-action {
  gap: var(--sp-4);
  min-height: 92px;
  margin-top: var(--sp-4);
  padding: var(--sp-4);
  border: 2px solid color-mix(in srgb, var(--m-color) 45%, var(--border));
  border-radius: var(--r-2xl);
  background: color-mix(in srgb, var(--m-color) 9%, var(--surface));
  box-shadow: 0 5px 0 color-mix(in srgb, var(--m-color) 40%, var(--edge));
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.home-continue-cta.home-primary-action:hover { transform: translateY(-1px); }
.home-continue-cta.home-primary-action:active {
  transform: translateY(5px);
  box-shadow: 0 0 0 transparent;
}
.home-primary-action .home-continue-icon {
  width: 58px;
  height: 58px;
  border-radius: var(--r-xl);
  background: var(--m-color-soft);
  font-size: 2rem;
  font-variation-settings: 'FILL' 1;
  transform: rotate(-6deg);
}
.home-continue-eyebrow {
  align-self: flex-start;
  margin-bottom: 2px;
  font-size: var(--fs-sm);
}
.home-primary-action .home-continue-copy strong {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: var(--fs-xl);
}
.home-continue-copy small { font-size: var(--fs-sm); color: var(--text-2); }
@media (max-width: 359px) {
  .home-continue-cta.home-primary-action { gap: var(--sp-3); padding: var(--sp-3); }
  .home-primary-action .home-continue-icon { width: 46px; height: 46px; font-size: 1.6rem; }
  .home-primary-action .home-continue-arrow { width: 40px; height: 40px; }
}
.home-primary-action .home-continue-arrow {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 3px 0 var(--primary-edge);
}

/* ── Daily mini quiz: lighter, dashed "ticket" ─────────────── */
.home-daily-cta.home-daily-cta--secondary {
  min-height: 64px;
  margin-top: var(--sp-3);
  padding: var(--sp-2) var(--sp-4);
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-xl);
}
.home-daily-cta--secondary .home-daily-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.5rem;
}
.home-daily-cta--secondary .home-daily-text strong {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: var(--fs-md);
}
.home-daily-cta--secondary .home-daily-text small { font-size: var(--fs-sm); }

/* Spaced-review call-out: features.css sizes it to 100% of the screen —
   align it with the other centered home rows. */
.home-review-cta {
  width: calc(100% - var(--sp-4) * 2);
  max-width: 680px;
  margin: var(--sp-3) auto 0;
  border-width: 2px;
  border-radius: var(--r-xl);
  box-shadow: 0 4px 0 var(--primary-border);
}
.home-review-cta strong { font-family: var(--font-display); font-weight: var(--fw-display); font-size: var(--fs-md); }

/* ── Quick actions: chunky tiles with a color per action ───── */
.quick-btn {
  min-height: 72px;
  border: 2px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: 0 var(--press-depth) 0 var(--edge);
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), background var(--dur-fast);
}
.quick-btn:hover { background: var(--surface-alt); }
.quick-btn:active { transform: translateY(var(--press-depth)); box-shadow: 0 0 0 var(--edge); }
.quick-btn > .material-symbols-rounded {
  font-size: 1.6rem;
  font-variation-settings: 'FILL' 1;
}
#qa-notes > .material-symbols-rounded   { color: var(--mode-quotes); }
#qa-premium > .material-symbols-rounded { color: var(--mode-people); }
#qa-install > .material-symbols-rounded { color: var(--mode-science); }
.quick-btn-lbl { font-size: var(--fs-sm); font-weight: var(--fw-bold); }
.quick-badge { top: 8px; right: 10px; }
.quick-lock { top: 8px; right: 10px; }

/* ── Section heading + filters ─────────────────────────────── */
.home-section-heading { margin-top: var(--sp-8); align-items: center; }
.home-section-kicker {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--r-full);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: var(--fs-xs);
  letter-spacing: 0;
}
.home-section-heading h2 {
  margin-top: var(--sp-2);
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: var(--fs-xl);
}
.home-section-count {
  padding: 4px 10px;
  border-radius: var(--r-full);
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--text-2);
  font-weight: var(--fw-semibold);
}

/* The filter row had no gutter on Home (it hugged the screen edges) */
.home-screen .topic-filters {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 var(--sp-4);
}
.home-screen .topic-search,
.home-screen .topic-filters select {
  min-height: 48px;
  border: 2px solid var(--border);
  border-radius: var(--r-full);
  background-color: var(--surface);
}
.home-screen .topic-search { padding: 0 var(--sp-4); }
.home-screen .topic-filters select { padding: 0 var(--sp-4); }
.home-screen .topic-search:focus-within { border-color: var(--primary); }
/* The input sits inside a pill that already shows focus via its border */
.home-screen .topic-search input:focus-visible { outline: none; }

/* ── Topic cards ───────────────────────────────────────────── */
.mode-grid { gap: var(--sp-3); }
.mode-card {
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-3) var(--sp-3);
  border: 2px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: 0 var(--press-depth) 0 var(--edge);
  /* Thin mode-colored lip along the top edge */
  background:
    linear-gradient(var(--m-color, var(--primary)) 0 0) top / 100% 6px no-repeat,
    var(--surface);
}
/* Icon + difficulty on the first row, then the title and stats get the
   card's full width (two-column cards are narrow on phones). The wrappers
   collapse with display:contents so their children join this grid. */
.mode-card-top {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "icon level" "title title" "stats stats";
  align-items: start;
  gap: var(--sp-2) var(--sp-2);
}
.mode-card-titlewrap,
.mode-card-stats { display: contents; }
.mode-card-icon { grid-area: icon; }
.mode-card-title { grid-area: title; margin-top: 2px; }
.mode-level { grid-area: level; justify-self: end; }
.mode-stat { grid-area: stats; }
.mode-stat-hs { grid-area: stats; justify-self: end; }
/* Single-column cards (≤340px, screens.css) are wide — go back to a row */
@media (max-width: 340px) {
  .mode-card-top {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "icon title level" "icon stats stats";
    column-gap: var(--sp-3);
  }
  .mode-card-title { align-self: center; }
}
.mode-card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--r-lg);
  transform: rotate(-6deg);
}
.mode-card-icon .material-symbols-rounded { font-size: 1.75rem; }
.mode-card-title {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: var(--fs-lg);
  line-height: var(--lh-tight);
}
.mode-level { font-size: var(--fs-xs); padding: 2px 8px; }
.mode-stat { font-size: var(--fs-xs); color: var(--text-2); }

.mode-progress-strip {
  height: 10px;
  background: var(--surface-sunken);
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.06);
}

.mode-btn {
  min-height: 46px;
  height: auto;
  border-radius: var(--r-lg);
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: var(--fs-base);
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), background var(--dur-fast);
}
.mode-btn .material-symbols-rounded { font-size: 1.2rem; }
.mode-btn:active { transform: translateY(3px); box-shadow: none; }
.mode-btn--learn {
  border-width: 2px;
  border-color: color-mix(in srgb, var(--m-color, var(--primary)) 40%, transparent);
  color: var(--text);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--m-color, var(--primary)) 30%, var(--edge));
}
.mode-btn--learn .material-symbols-rounded { color: var(--m-color, var(--primary)); }
/* Filled Quiz button: the raw mode colors fail AA with white text, so the
   fill is darkened 15% for white ink, and the four light modes keep their
   vivid fill with dark ink instead (all ≥4.6:1). */
.mode-btn--quiz {
  background: color-mix(in srgb, var(--m-color, var(--primary)) 85%, #000);
  color: #fff;
  box-shadow: 0 3px 0 color-mix(in srgb, var(--m-color, var(--primary)) 55%, #000);
}
.mode-card:is([data-topic="proverbs"], [data-topic="idioms"], [data-topic="animals"], [data-topic="science"]) .mode-btn--quiz {
  background: var(--m-color);
  color: #1d1530;
}
.mode-btn--quiz:hover { filter: brightness(1.06); }

/* ── Premium/support banner ────────────────────────────────── */
.home-premium-banner {
  margin-top: var(--sp-2);
  padding: var(--sp-4);
  border: 2px solid var(--primary-border);
  border-radius: var(--r-xl);
  box-shadow: 0 var(--press-depth) 0 var(--primary-border);
}
.hpb-icon { color: var(--accent-text); }
.hpb-text strong { font-family: var(--font-display); font-weight: var(--fw-display); }
.hpb-text small { font-size: var(--fs-sm); }

/* ════════════════════════════════════════════════════════════
   §3  QUIZ CONFIG
   ════════════════════════════════════════════════════════════ */

.config-title,
.challenge-intro .config-title {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: var(--fs-2xl);
}
.config-section--primary .config-label {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: var(--fs-lg);
}
.config-label { font-size: var(--fs-sm); letter-spacing: 0.02em; }

/* Quiz topic strip (modeTabs.js): 44px targets, and the active tab's icon
   was primary-on-primary (invisible) — let it follow the label ink. */
.content-tabs .content-tab {
  min-height: 44px;
  border-width: 2px;
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
}
.content-tabs .content-tab.active { box-shadow: 0 3px 0 var(--primary-edge); }
.content-tabs .content-tab.active .material-symbols-rounded { color: inherit; }
.chip-wrap { gap: var(--sp-2); }

.quiz-config-summary {
  padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-4);
  border: 2px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: 0 var(--press-depth) 0 var(--edge);
}
.quiz-config-summary-text { font-size: var(--fs-base); }

#btn-start { min-height: 64px; font-size: var(--fs-xl); }
/* fun.css heartbeat transform would fight the press-in — pause it */
#btn-start:active { animation: none; }

.quiz-resume {
  border-width: 2px;
  border-radius: var(--r-xl);
  box-shadow: 0 var(--press-depth) 0 var(--primary-border);
}

/* ════════════════════════════════════════════════════════════
   §4  QUIZ PLAY
   ════════════════════════════════════════════════════════════ */

/* Each topic tints its own quiz (progress fill + stage lip) */
.quiz-play-screen { --m-color: var(--primary); }
.quiz-play-screen[data-mode="flags"]     { --m-color: var(--mode-flags); }
.quiz-play-screen[data-mode="proverbs"]  { --m-color: var(--mode-proverbs); }
.quiz-play-screen[data-mode="idioms"]    { --m-color: var(--mode-idioms); }
.quiz-play-screen[data-mode="quotes"]    { --m-color: var(--mode-quotes); }
.quiz-play-screen[data-mode="people"]    { --m-color: var(--mode-people); }
.quiz-play-screen[data-mode="animals"]   { --m-color: var(--mode-animals); }
.quiz-play-screen[data-mode="science"]   { --m-color: var(--mode-science); }
.quiz-play-screen[data-mode="landmarks"] { --m-color: var(--mode-landmarks); }
.quiz-play-screen[data-mode="history"]   { --m-color: var(--mode-history); }
.quiz-play-screen[data-mode="gugudan"]   { --m-color: var(--mode-gugudan); }

/* ── Top bar: fat progress track + HUD pills ───────────────── */
.quiz-topbar { padding-top: var(--sp-3); }
.quiz-progress-bar {
  height: 12px;
  margin-bottom: var(--sp-2);
  background: var(--surface-sunken);
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.06);
}
.quiz-progress-fill {
  min-width: 12px;
  background: var(--m-color);
  /* Glossy highlight stripe, like a toy progress bar */
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.35);
  transition: width var(--dur-slow) var(--ease-spring);
}

.quiz-hud { gap: var(--sp-2); padding: 2px 0 var(--sp-2); }
.quiz-lives { gap: 1px; }
.heart { font-size: 1.6rem; }

.quiz-streak,
.quiz-score,
.quiz-qnum {
  min-height: 32px;
  padding: 2px 10px;
  border-radius: var(--r-full);
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: var(--fs-base);
}
.quiz-streak { background: var(--accent-soft); color: var(--accent-text); }
.quiz-streak .material-symbols-rounded { font-size: 1.15rem; color: #e8590c; }
.quiz-score { background: var(--accent-soft); color: var(--text); }
.quiz-score .material-symbols-rounded { font-size: 1.2rem; color: var(--accent-text); }
.quiz-qnum {
  display: inline-flex;
  align-items: center;
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--text-2);
}
.quiz-timer-num { height: 28px; line-height: 28px; min-width: 28px; font-size: var(--fs-base); }

.quiz-timer-bar {
  height: 8px;
  margin-top: 2px;
  background: var(--surface-sunken);
}

/* ── Question stage card ───────────────────────────────────── */
.quiz-body { gap: var(--sp-4); padding-top: var(--sp-3); }

.quiz-stage {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-4) var(--sp-4);
  border: 2px solid var(--border);
  border-radius: var(--r-2xl);
  background:
    linear-gradient(var(--m-color) 0 0) top / 100% 6px no-repeat,
    var(--surface);
  box-shadow: 0 var(--press-depth) 0 var(--edge);
}
[data-mode="flags"] .quiz-stage { gap: var(--sp-2); padding-block: var(--sp-4) var(--sp-3); }

.quiz-prompt {
  padding: 4px 12px;
  border-radius: var(--r-full);
  background: color-mix(in srgb, var(--m-color) 12%, var(--surface));
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
}
/* The O/X hint below the buttons stays plain text */
.quiz-prompt--footer { background: none; font-weight: var(--fw-medium); color: var(--text-3); }

.quiz-question-text {
  font-size: clamp(1.25rem, 5vw, 1.5rem);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
}
.quiz-question-text.text-emoji { font-size: clamp(3.5rem, 16vw, 5.5rem); }
.quiz-question-text.text-chosung { font-size: clamp(2rem, 10vw, 3rem); font-weight: 800; letter-spacing: .18em; word-break: keep-all; line-height: 1.25; }
.quiz-question-text.text-chosung--long { font-size: clamp(1.35rem, 6vw, 1.9rem); letter-spacing: .1em; }
.quiz-question-text.text-math { font-size: clamp(2rem, 10vw, 2.75rem); font-variant-numeric: tabular-nums; }
.quiz-hint { display: flex; gap: var(--sp-2); align-items: baseline; max-width: 100%; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-lg); background: color-mix(in srgb, var(--m-color) 10%, var(--surface)); color: var(--text-2); font-size: var(--fs-sm); text-align: left; overflow-wrap: anywhere; }
/* Label uses body text colour on a tinted pill (white on the lime gugudan
   accent measured < 4.5:1). */
.quiz-hint-label { flex: none; padding: 1px 8px; border-radius: var(--r-full); background: color-mix(in srgb, var(--m-color) 28%, var(--surface)); color: var(--text); font-weight: var(--fw-bold); font-size: var(--fs-xs); }

.quiz-flag-wrap {
  border: 4px solid var(--surface);
  border-radius: var(--r-lg);
  box-shadow: 0 0 0 2px var(--border), var(--sh-md);
}

.quiz-stage > .speak-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  margin-top: calc(var(--sp-1) * -1);
  border-width: 2px;
  background: var(--surface-alt);
}

/* O/X claim — a speech bubble inside the stage */
.ox-claim-card {
  position: relative;
  margin-top: var(--sp-2);
  padding: var(--sp-4);
  border: 0;
  border-radius: var(--r-xl);
  background: var(--surface-alt);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-base);
}
.ox-claim-card::before {
  content: '';
  position: absolute;
  top: -9px;
  left: 50%;
  margin-left: -10px;
  border: 10px solid transparent;
  border-top: 0;
  border-bottom-color: var(--surface-alt);
}

/* ── Text answers: big, numbered, pressable ────────────────── */
.answer-list { gap: var(--sp-3); counter-reset: answer; }

.answer-btn {
  min-height: 60px;
  padding: 10px 16px 10px 12px;
  border: 2px solid var(--border-strong);
  border-radius: var(--r-xl);
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  box-shadow: 0 var(--press-depth) 0 var(--edge);
  transition:
    border-color var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}
.answer-btn:hover:not(:disabled) { border-color: var(--primary); background: var(--surface); }
.answer-btn:active:not(:disabled) {
  transform: translateY(var(--press-depth));
  box-shadow: 0 0 0 var(--edge);
}

.answer-list .answer-btn::before {
  counter-increment: answer;
  content: counter(answer);
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-sunken);
  color: var(--text-2);
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: var(--fs-md);
}
.answer-list .answer-btn.correct::before { content: '✓'; background: var(--success-strong); color: var(--on-success); }
.answer-list .answer-btn.wrong::before   { content: '✕'; background: var(--danger-strong);  color: var(--on-danger); }
.answer-btn.wrong { color: var(--danger-text); }

[data-difficulty="easy"] .answer-btn { min-height: 66px; padding: 12px 16px 12px 12px; font-size: var(--fs-lg); }

/* ── O/X ───────────────────────────────────────────────────── */
.ox-answers { gap: var(--sp-4); }
.ox-btn.answer-btn {
  min-height: 128px;
  gap: 4px;
  border-width: 3px;
  border-radius: var(--r-2xl);
  padding: var(--sp-3);
}
.ox-btn--o.answer-btn { border-color: var(--success); background: var(--success-soft); color: var(--success-text); box-shadow: 0 5px 0 color-mix(in srgb, var(--success) 70%, #000); }
.ox-btn--x.answer-btn { border-color: var(--danger);  background: var(--danger-soft);  color: var(--danger-text);  box-shadow: 0 5px 0 color-mix(in srgb, var(--danger) 70%, #000); }
.ox-btn.answer-btn:hover:not(:disabled) { background: color-mix(in srgb, currentColor 8%, var(--surface)); }
.ox-btn.answer-btn:active:not(:disabled) { transform: translateY(5px); box-shadow: none; }
.ox-glyph {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: 3.75rem;
}
.ox-label {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: var(--fs-lg);
}
.ox-btn.correct { background: var(--success-strong) !important; color: var(--on-success) !important; border-color: var(--success-strong) !important; }
.ox-btn.wrong   { background: var(--danger-strong) !important;  color: var(--on-danger) !important;  border-color: var(--danger-strong) !important; }
[data-difficulty="easy"] .ox-btn.answer-btn { min-height: 140px; }

/* ── Flag grid ─────────────────────────────────────────────── */
.flag-grid-answers { gap: var(--sp-3); }
.flag-grid-btn {
  min-height: 56px;
  border: 3px solid var(--border-strong);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: 0 var(--press-depth) 0 var(--edge);
}
.flag-grid-btn:active:not(:disabled) { transform: translateY(var(--press-depth)); box-shadow: none; }
.flag-grid-btn.wrong { border-width: 4px; }
.flag-grid-btn.correct { border-width: 4px; }

/* ── Wrong/timeout: explanation + Next ─────────────────────── */
.quiz-explain { gap: var(--sp-3); }
.quiz-explain-text {
  padding: var(--sp-3) var(--sp-4);
  border-left: 0;
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--m-color) 9%, var(--surface));
  border: 2px dashed color-mix(in srgb, var(--m-color) 35%, var(--border));
  color: var(--text);
  font-size: var(--fs-base);
}
.quiz-next-btn {
  min-height: 56px;
  border-radius: var(--r-xl);
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: var(--fs-lg);
}
/* Mirror Next's edge in the margin so the press never clips */
.quiz-explain { padding-bottom: var(--press-depth); }

.quiz-skip-hint { font-size: var(--fs-sm); }

/* Short phones (≈iPhone SE): tighten the chunky spacing so the question,
   answers and Next button fit (or nearly fit) without scrolling. */
@media (max-height: 700px) {
  .quiz-topbar { padding-top: var(--sp-2); }
  .quiz-progress-bar { height: 10px; margin-bottom: 4px; }
  .heart { font-size: 1.4rem; }
  .quiz-body { gap: var(--sp-3); padding-top: var(--sp-2); }
  .quiz-stage { padding: var(--sp-3); gap: var(--sp-2); }
  .answer-list { gap: var(--sp-2); }
  .answer-btn { min-height: 54px; padding-block: 6px; }
  .answer-list .answer-btn::before { width: 30px; height: 30px; }
  .ox-btn.answer-btn { min-height: 112px; }
  .quiz-play-screen.has-next .answer-btn:not(.ox-btn) { min-height: 48px; }
}

/* ════════════════════════════════════════════════════════════
   §5  RESULT
   ════════════════════════════════════════════════════════════ */

.result-screen {
  gap: var(--sp-4);
  max-width: 480px;
  margin-inline: auto;
}

.result-banner {
  width: auto;
  align-self: center;
  padding: 10px 22px;
  border-radius: var(--r-full);
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: var(--fs-lg);
}
.banner-gold { background: var(--accent); color: var(--on-accent); border: 0; box-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 60%, #000); }
.banner-star { background: var(--primary); color: var(--on-primary); border: 0; box-shadow: 0 4px 0 var(--primary-edge); }

/* Mascot + score ring on one card */
.result-hero {
  position: relative;
  width: 100%;
  display: flex;
  flex-wrap: wrap; /* side by side on phones ≥360px, stacked below */
  justify-content: center;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-5) var(--sp-4);
  border: 2px solid var(--border);
  border-radius: var(--r-2xl);
  background: var(--surface);
  box-shadow: 0 var(--press-depth) 0 var(--edge);
  overflow: hidden;
  isolation: isolate;
}
.result-mascot {
  position: relative;
  width: 128px;
  height: 128px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--hero-sun);
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.08);
  z-index: 1;
}
/* Great run (S/A): sun rays spin slowly behind 부기 */
.result-hero[data-grade="S"] .result-mascot::before,
.result-hero[data-grade="A"] .result-mascot::before {
  content: '';
  position: absolute;
  inset: -46px;
  z-index: -1;
  border-radius: 50%;
  background: repeating-conic-gradient(var(--accent-soft) 0 12deg, transparent 12deg 24deg);
  -webkit-mask: radial-gradient(closest-side, #000 55%, transparent);
  mask: radial-gradient(closest-side, #000 55%, transparent);
  animation: playful-spin 24s linear infinite;
}
@keyframes playful-spin { to { transform: rotate(360deg); } }

.result-circle-wrap { width: 164px; height: 164px; }
.score-grade {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: var(--fs-xl);
}
.score-number {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: 2.75rem;
  font-variant-numeric: tabular-nums;
}
.score-unit { font-size: var(--fs-sm); color: var(--text-2); }

/* XP */
.result-xp-section { max-width: none; padding: 0 var(--sp-1); }
.result-xp-toprow { font-size: var(--fs-base); color: var(--text-2); margin-bottom: 6px; }
.result-xp-gained {
  padding: 2px 10px;
  border-radius: var(--r-full);
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-display);
  font-weight: var(--fw-display);
}
.result-xp-bar { height: 14px; box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.06); }
.result-xp-fill { background: linear-gradient(90deg, var(--primary), var(--mode-quotes)); box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.3); }
.result-xp-levelup {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: var(--fs-md);
}

/* Stat tiles — one color per stat */
.result-stats { gap: var(--sp-3); }
.stat-pill {
  max-width: none;
  gap: 4px;
  padding: var(--sp-3) var(--sp-2);
  border: 2px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: 0 var(--press-depth) 0 var(--edge);
}
.stat-pill .material-symbols-rounded {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 1.3rem;
  background: var(--primary-soft);
  color: var(--primary);
}
.stat-pill:nth-child(2) .material-symbols-rounded { background: var(--accent-soft); color: #e8590c; }
.stat-pill:nth-child(3) .material-symbols-rounded { background: var(--success-soft); color: var(--success-text); }
.stat-pill-val {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: var(--fs-xl);
  line-height: 1.1;
}
.stat-pill-lbl { font-size: var(--fs-sm); color: var(--text-2); }

/* Missed list */
.missed-title { font-family: var(--font-display); font-weight: var(--fw-display); font-size: var(--fs-lg); }
.missed-title .material-symbols-rounded { font-size: 1.4rem; }
.missed-list { gap: var(--sp-2); max-height: 300px; }
.missed-item {
  padding: var(--sp-3);
  border: 2px solid var(--border);
  border-radius: var(--r-lg);
}
.missed-flag { width: 54px; height: 36px; border-radius: var(--r-xs); }
.missed-q { font-size: var(--fs-sm); color: var(--text-2); }
.missed-a { font-size: var(--fs-base); }
.missed-note-upsell-row { min-height: 48px; border-width: 2px; border-radius: var(--r-lg); }

.perfect-msg p { font-family: var(--font-display); font-size: var(--fs-lg); color: var(--text); }

.result-actions { gap: var(--sp-3); padding-bottom: var(--press-depth); }
.result-actions .btn { min-height: 54px; border-radius: var(--r-xl); }
.result-actions .btn-primary {
  min-height: 60px;
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: var(--fs-lg);
}

/* ════════════════════════════════════════════════════════════
   §6  REDUCED MOTION
   ════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .result-hero .result-mascot::before { animation: none !important; }
  .btn-primary:hover:not(:disabled),
  .btn-lg:hover:not(:disabled),
  .btn-secondary:hover:not(:disabled),
  .home-continue-cta.home-primary-action:hover { transform: none; }
}
