/* ═══════════════════════════════════════════════════════════════
   shared.css — Math Study Hub
   Shared styles for all study tools at study.foiledbymath.com
   Each tool links to this file and keeps only tool-specific CSS
   in its own <style> block.
   ═══════════════════════════════════════════════════════════════ */

/* ── TOKENS ─────────────────────────────────────────────────── */
:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --primary: #1d4ed8;
  --primary-light: #eff6ff;
  --green: #15803d;
  --green-light: #dcfce7;
  --red: #b91c1c;
  --red-light: #fee2e2;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --r: 10px;
  --purple: #7c3aed;
  --purple-light: #f5f3ff;
  --orange: #c2410c;
  --orange-light: #fff7ed;
  --green-game: #059669;
}

/* ── RESET + BASE ────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}

/* ── SITE HEADER ─────────────────────────────────────────────── */
.site-header { background: #0f172a; color: white; padding: 1rem 1.5rem; display: flex; justify-content: space-between; align-items: center; }
.site-header h1 { font-size: 1.2rem; font-weight: 700; }
.site-header p { font-size: 0.78rem; color: #94a3b8; margin-top: 2px; }
.total-badge { font-size: 0.8rem; background: #1e3a5f; color: #93c5fd; padding: 0.35rem 0.8rem; border-radius: 99px; white-space: nowrap; }

/* ── NAV ─────────────────────────────────────────────────────── */
nav { background: white; border-bottom: 2px solid var(--border); overflow-x: auto; display: flex; scrollbar-width: none; }
nav::-webkit-scrollbar { display: none; }
nav button { background: none; border: none; padding: 0.8rem 1.1rem; cursor: pointer; font-size: 0.83rem; font-weight: 500; color: var(--muted); white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color 0.15s, border-color 0.15s; }
nav button:hover { color: var(--primary); }
nav button.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
nav button .nav-score { font-size: 0.7rem; margin-left: 4px; color: var(--green); display: none; }
nav button.has-score .nav-score { display: inline; }
nav button.nav-game { color: var(--purple) !important; font-weight: 700 !important; }
nav button.nav-game.active { border-bottom-color: var(--purple); color: var(--purple); }
nav button.nav-pr { color: var(--green-game) !important; }
nav button.nav-pr.active { border-bottom-color: var(--green-game); color: var(--green-game); }

/* ── LAYOUT ──────────────────────────────────────────────────── */
main { max-width: 860px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.panel { display: none; }
.panel.active { display: block; }

/* ── SECTION HEAD ────────────────────────────────────────────── */
.section-head { margin-bottom: 1.25rem; }
.section-head h2 { font-size: 1.25rem; font-weight: 700; }
.section-head p { color: var(--muted); font-size: 0.875rem; margin-top: 0.2rem; }
.section-head .rule { display: inline-block; background: #fef9c3; border: 1px solid #fde68a; color: #78350f; border-radius: 6px; padding: 0.4rem 0.75rem; font-size: 0.8rem; margin-top: 0.5rem; }
.anchor-badge { display: inline-block; background: #e0e7ff; color: #3730a3; border-radius: 5px; padding: 0.15rem 0.6rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; margin-top: 0.4rem; }
.rule-chip { display: inline-block; background: #fef9c3; border: 1px solid #fde68a; color: #78350f; border-radius: 6px; padding: 0.4rem 0.75rem; font-size: 0.8rem; margin-top: 0.5rem; }
.section-toolbar { display: flex; gap: 0.6rem; align-items: center; margin-bottom: 1.25rem; flex-wrap: wrap; }
.section-toolbar span { font-size: 0.8rem; color: var(--muted); }

/* ── PROGRESS ────────────────────────────────────────────────── */
.progress-wrap { margin-bottom: 1.5rem; }
.progress-bar { background: var(--border); border-radius: 99px; height: 7px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: var(--primary); transition: width 0.4s ease; }
.progress-meta { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); margin-top: 0.4rem; }
.progress-meta .got-count { color: var(--green); font-weight: 600; }

/* ── QUESTION CARD ───────────────────────────────────────────── */
.q-card { background: white; border-radius: var(--r); border: 1.5px solid var(--border); padding: 1.5rem; margin-bottom: 0.875rem; transition: border-color 0.2s; }
.q-card.state-got { border-color: #86efac; background: #f0fdf4; }
.q-card.state-review { border-color: #fca5a5; }
.q-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.q-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.tag { font-size: 0.67rem; padding: 0.15rem 0.5rem; border-radius: 4px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.tag-pssa    { background: #fef3c7; color: #78350f; }
.tag-exam    { background: #fef3c7; color: #78350f; }
.tag-practice { background: #e0e7ff; color: #3730a3; }
.tag-convert { background: #f0fdf4; color: #166534; }
.q-prompt { font-size: 0.82rem; font-weight: 600; color: var(--primary); margin-bottom: 0.4rem; }
.q-diagram { text-align: center; margin-bottom: 0.75rem; border-top: 1px solid var(--border); padding-top: 0.75rem; }
.q-problem { padding: 1.1rem 0.5rem; font-size: 1.05rem; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-bottom: 1rem; line-height: 1.8; }
.q-problem.center { text-align: center; font-size: 1.4rem; }
.q-problem .katex-display { margin: 0.25rem 0; }
.q-choices { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
.q-choices li { list-style: none; font-size: 0.9rem; padding: 0.35rem 0.6rem; border-radius: 6px; background: #f8fafc; }

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.5rem 1rem; border-radius: 7px; font-size: 0.845rem; font-weight: 600; cursor: pointer; border: 2px solid transparent; transition: all 0.15s; user-select: none; }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: #1e40af; }
.btn-reveal { background: var(--primary); color: white; }
.btn-reveal:hover { background: #1e40af; }
.btn-got { background: var(--green-light); color: var(--green); border-color: #86efac; }
.btn-got:hover { background: #bbf7d0; }
.btn-review { background: var(--red-light); color: var(--red); border-color: #fca5a5; }
.btn-review:hover { background: #fecaca; }
.btn-outline { background: white; color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--muted); }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.78rem; }
.btn-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }

/* ── ANSWER BOX ──────────────────────────────────────────────── */
.answer-box { display: none; margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed #cbd5e1; }
.answer-box.open { display: block; }
.ans-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--green); margin-bottom: 0.3rem; }
.ans-value { font-size: 1.2rem; font-weight: 700; margin-bottom: 1rem; }
.work-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 0.5rem; }
.work-steps { background: #f8fafc; border-radius: 7px; padding: 0.875rem 1rem; }
.step { display: flex; gap: 0.6rem; padding: 0.25rem 0; font-size: 0.9rem; line-height: 1.6; }
.step:not(:last-child) { border-bottom: 1px solid #f1f5f9; }
.step-num { color: var(--muted); font-size: 0.7rem; font-weight: 700; padding-top: 0.3rem; min-width: 16px; }
.step-content { flex: 1; }

/* ── REFERENCE BOX ───────────────────────────────────────────── */
.ref-box { background: white; border: 1.5px solid var(--border); border-radius: var(--r); padding: 1.25rem; margin-bottom: 1.5rem; }
.ref-box h3 { font-size: 0.82rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.75rem; }
.diagram-wrap { display: flex; justify-content: center; margin-bottom: 0.75rem; }
.angle-key { display: flex; flex-wrap: wrap; gap: 0.5rem; font-size: 0.8rem; }
.angle-key-item { background: #f8fafc; border-radius: 5px; padding: 0.25rem 0.6rem; border: 1px solid var(--border); }
.angle-key-item strong { color: var(--primary); }
.ref-toggle-btn { background: white; border: 2px solid var(--border); color: var(--muted); border-radius: 8px; padding: 0.5rem 1rem; cursor: pointer; font-size: 0.82rem; font-weight: 600; display: flex; align-items: center; gap: 0.4rem; transition: border-color 0.15s; }
.ref-toggle-btn:hover { border-color: var(--primary); color: var(--primary); }
.ref-section { margin-top: 1.5rem; }
.ref-section h3 { font-size: 0.9rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.75rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--border); }

/* ── FLASHCARD ───────────────────────────────────────────────── */
.fc-controls { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.25rem; align-items: center; }
.fc-deck-btn { padding: 0.4rem 0.9rem; border-radius: 7px; font-size: 0.82rem; font-weight: 600; cursor: pointer; border: 2px solid var(--border); background: white; color: var(--muted); transition: all 0.15s; }
.fc-deck-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.fc-deck-btn:hover:not(.active) { border-color: var(--muted); }
.fc-sep { width: 1px; height: 20px; background: var(--border); margin: 0 0.25rem; }
.flashcard { background: white; border-radius: 14px; border: 2px solid var(--border); min-height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem; text-align: center; cursor: pointer; user-select: none; position: relative; transition: box-shadow 0.2s, transform 0.15s; margin-bottom: 1rem; }
.flashcard:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.08); transform: translateY(-2px); }
.fc-meta { position: absolute; top: 0.85rem; left: 0; right: 0; display: flex; justify-content: space-between; padding: 0 1.1rem; }
.fc-category { font-size: 0.7rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.fc-counter-pos { font-size: 0.72rem; color: var(--muted); font-weight: 600; }
.fc-question { font-size: 1.5rem; font-weight: 700; line-height: 1.4; }
.fc-tap { font-size: 0.78rem; color: var(--muted); margin-top: 1rem; }
.fc-answer { display: none; font-size: 1.4rem; font-weight: 700; color: var(--primary); line-height: 1.5; }
.fc-sub { font-size: 0.85rem; color: var(--muted); margin-top: 0.5rem; font-weight: 400; }
.flashcard.revealed .fc-question { display: none; }
.flashcard.revealed .fc-tap { display: none; }
.flashcard.revealed .fc-answer { display: block; }
.flashcard.revealed .fc-sub { display: block; }
.fc-btn-row { display: flex; gap: 0.75rem; justify-content: center; margin-bottom: 1.5rem; }
.fc-dots { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-top: 0.5rem; margin-bottom: 1.5rem; }
.fc-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border); transition: background 0.2s; }
.fc-dot.known { background: var(--green); }
.fc-dot.current { background: var(--primary); outline: 2px solid var(--primary); outline-offset: 1px; }

/* ── FORMULA / DATA TABLE ────────────────────────────────────── */
.formula-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; background: white; border-radius: var(--r); overflow: hidden; }
.formula-table th { background: #1e293b; color: white; padding: 0.5rem 0.75rem; text-align: left; font-weight: 600; font-size: 0.75rem; }
.formula-table td { padding: 0.45rem 0.75rem; border-bottom: 1px solid var(--border); }
.formula-table tr:last-child td { border-bottom: none; }
.formula-table tr:hover td { background: #f8fafc; }
.formula-table .shape-col { font-weight: 700; color: var(--primary); }
.power-table { width: 100%; border-collapse: collapse; background: white; border-radius: var(--r); overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.06); font-size: 0.82rem; }
.power-table th { background: #1e293b; color: white; padding: 0.5rem 0.6rem; text-align: center; font-weight: 600; font-size: 0.75rem; }
.power-table td { padding: 0.45rem 0.6rem; text-align: center; border-bottom: 1px solid var(--border); }
.power-table tr:last-child td { border-bottom: none; }
.power-table tr:hover td { background: #f8fafc; }
.power-table .base-col { font-weight: 700; color: var(--primary); background: #eff6ff; }
.power-table .gray { color: #cbd5e1; }

/* ── GAME — SHARED SHELL ─────────────────────────────────────── */
.game-wrap { max-width: 520px; margin: 0 auto; padding: 1rem 0.5rem 3rem; }
.game-start { text-align: center; }
.game-logo { font-size: 2rem; font-weight: 900; color: var(--purple); letter-spacing: -0.02em; margin-bottom: 0.2rem; }
.game-logo span { color: var(--primary); }
.game-tagline { color: var(--muted); font-size: 0.875rem; margin-bottom: 2rem; }
.game-rule-chip { display: inline-block; background: #fef3c7; color: #78350f; border: 1px solid #fde68a; border-radius: 99px; padding: 0.3rem 0.9rem; font-size: 0.8rem; font-weight: 600; margin-bottom: 2rem; }
.game-field-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); text-align: left; margin-bottom: 0.4rem; display: block; }
.initials-input { width: 100%; padding: 0.875rem; font-size: 2rem; font-weight: 800; text-align: center; text-transform: uppercase; letter-spacing: 0.4em; border: 2px solid var(--border); border-radius: var(--r); outline: none; background: white; transition: border-color 0.15s; }
.initials-input:focus { border-color: var(--purple); }
.initials-err { font-size: 0.8rem; min-height: 1.3em; margin-top: 0.35rem; text-align: left; }
.btn-game-go { width: 100%; background: var(--purple); color: white; border: none; padding: 0.875rem; font-size: 1.05rem; font-weight: 700; border-radius: 9px; cursor: pointer; margin-top: 1.25rem; transition: background 0.15s; }
.btn-game-go:hover { background: #6d28d9; }
.btn-game-again { width: 100%; background: var(--purple); color: white; border: none; padding: 0.875rem; font-size: 1rem; font-weight: 700; border-radius: 9px; cursor: pointer; margin-top: 1.25rem; transition: background 0.15s; }
.btn-game-again:hover { background: #6d28d9; }

/* ── GAME HUD — SHARED ───────────────────────────────────────── */
.game-hud { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.hud-score { font-size: 1.5rem; font-weight: 800; color: var(--purple); }
.hud-label { font-size: 0.7rem; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.hud-streak { font-size: 1rem; font-weight: 700; color: var(--orange); }
.hud-qnum { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
/* Timer game HUD additions */
.hud-badge { background: var(--purple); color: white; font-weight: 800; letter-spacing: 0.12em; padding: 0.25rem 0.7rem; border-radius: 5px; font-size: 0.95rem; }
.hud-timer { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); }
.hud-timer.penalty-flash { color: var(--red); }
.hud-prog { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.game-pbar { background: var(--border); height: 5px; border-radius: 99px; overflow: hidden; margin-bottom: 1.5rem; }
.game-pbar-fill { height: 100%; background: var(--purple); border-radius: 99px; transition: width 0.3s ease; }

/* ── GAME — MULTIPLE CHOICE ──────────────────────────────────── */
.game-card { background: white; border-radius: 14px; border: 2px solid var(--border); padding: 1.75rem 1.5rem; margin-bottom: 1rem; }
.game-q { font-size: 1.05rem; font-weight: 700; line-height: 1.5; margin-bottom: 0.25rem; }
.game-anchor { font-size: 0.68rem; color: var(--muted); margin-bottom: 1.25rem; }
.game-choices { display: flex; flex-direction: column; gap: 0.5rem; }
.game-choice { background: #f8fafc; border: 2px solid var(--border); border-radius: 8px; padding: 0.7rem 1rem; font-size: 0.9rem; cursor: pointer; transition: all 0.15s; text-align: left; font-family: inherit; }
.game-choice:hover:not(:disabled) { background: var(--primary-light); border-color: #93c5fd; }
.game-choice.correct { background: var(--green-light); border-color: #86efac; color: var(--green); font-weight: 700; }
.game-choice.wrong { background: var(--red-light); border-color: #fca5a5; color: var(--red); }
.game-choice.reveal-correct { background: var(--green-light); border-color: #86efac; }
.game-feedback { font-size: 0.85rem; padding: 0.6rem 0.875rem; border-radius: 7px; margin-top: 0.75rem; font-weight: 600; }
.game-feedback.right { background: var(--green-light); color: var(--green); }
.game-feedback.wrong { background: var(--red-light); color: var(--red); }
.btn-next-q { margin-top: 0.75rem; width: 100%; background: var(--purple); color: white; border: none; padding: 0.75rem; border-radius: 9px; font-size: 0.95rem; font-weight: 700; cursor: pointer; display: none; font-family: inherit; }
.btn-next-q:hover { background: #6d28d9; }

/* ── GAME — FREE ANSWER (timer game) ─────────────────────────── */
.game-q-card { background: white; border-radius: 14px; border: 2px solid var(--border); min-height: 130px; display: flex; align-items: center; justify-content: center; padding: 1.5rem; margin-bottom: 1rem; transition: border-color 0.2s; }
.game-q-card.flash-correct { border-color: #86efac; background: #f0fdf4; }
.game-q-card.flash-wrong { border-color: #fca5a5; background: #fff5f5; animation: shake 0.4s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-8px)} 60%{transform:translateX(8px)} }
.game-q-math { font-size: 2rem; text-align: center; }
.game-q-math .katex-display { margin: 0; }
.game-penalty-banner { background: var(--red-light); color: var(--red); border-radius: 8px; padding: 0.5rem 1rem; font-size: 0.875rem; font-weight: 700; text-align: center; margin-bottom: 0.875rem; display: none; }
.game-penalty-banner.show { display: block; }
.game-input-row { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
.game-answer-input { flex: 1; padding: 0.85rem 1rem; font-size: 1.4rem; font-weight: 700; text-align: center; border: 2px solid var(--border); border-radius: 9px; outline: none; background: white; transition: border-color 0.15s; font-variant-numeric: tabular-nums; }
.game-answer-input:focus { border-color: var(--purple); }
.game-answer-input.correct { border-color: var(--green); background: #f0fdf4; }
.game-answer-input.wrong { border-color: var(--red); background: #fff5f5; }
.btn-game-submit { background: var(--purple); color: white; border: none; width: 56px; font-size: 1.3rem; font-weight: 700; border-radius: 9px; cursor: pointer; transition: background 0.15s; }
.btn-game-submit:hover { background: #6d28d9; }
.game-penalty-tally { text-align: center; font-size: 0.78rem; color: var(--muted); min-height: 1.3em; }
.game-penalty-tally strong { color: var(--red); }

/* ── GAME — END SCREENS ──────────────────────────────────────── */
.game-end { text-align: center; background: white; border-radius: 14px; padding: 2.5rem 2rem; border: 2px solid var(--border); }
.end-score-big { font-size: 3.5rem; font-weight: 900; color: var(--purple); }
.end-score-label { font-size: 0.85rem; color: var(--muted); margin-bottom: 1.5rem; }
.end-stats { display: flex; gap: 1.5rem; justify-content: center; margin-bottom: 1.75rem; }
.end-stat { text-align: center; }
.end-stat-val { font-size: 1.5rem; font-weight: 800; }
.end-stat-lbl { font-size: 0.75rem; color: var(--muted); font-weight: 600; }
/* Timer game end screen */
.game-result-initials { font-size: 1rem; font-weight: 700; letter-spacing: 0.2em; color: var(--muted); margin-top: 0.5rem; }
.game-result-time { font-size: 4rem; font-weight: 900; color: var(--purple); font-variant-numeric: tabular-nums; line-height: 1; margin: 0.3rem 0 0.2rem; }
.game-result-breakdown { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.75rem; }
.game-new-record { display: inline-block; background: #fef3c7; color: #92400e; padding: 0.2rem 0.75rem; border-radius: 99px; font-weight: 700; font-size: 0.82rem; margin-left: 0.4rem; }
.game-rank-pill { display: inline-block; background: #ede9fe; color: var(--purple); padding: 0.2rem 0.75rem; border-radius: 99px; font-weight: 700; font-size: 0.82rem; margin-left: 0.4rem; }

/* ── LEADERBOARD ─────────────────────────────────────────────── */
.lb-heading { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 1.5rem 0 0.6rem; }
.lb-table { width: 100%; border-collapse: collapse; background: white; border-radius: var(--r); overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.07); font-size: 0.875rem; }
.lb-table td { padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border); }
.lb-table tr:last-child td { border-bottom: none; }
.lb-table tr.lb-me { background: #ede9fe; }
.lb-table tr.lb-pr-me { background: #d1fae5; }
.lb-rank { width: 36px; text-align: center; }
.lb-init { font-weight: 800; letter-spacing: 0.12em; color: var(--purple); }
.lb-init-pr { font-weight: 800; letter-spacing: 0.12em; color: var(--green-game); }
.lb-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.lb-pts { font-weight: 700; color: var(--green-game); }
.lb-pen { color: var(--red); font-size: 0.78rem; }
.lb-note { font-size: 0.72rem; color: var(--muted); margin-top: 0.6rem; }
.lb-empty-note { color: var(--muted); font-size: 0.875rem; padding: 1rem; background: white; border-radius: var(--r); border: 1px solid var(--border); }

/* ── POINT RUSH ──────────────────────────────────────────────── */
.pr-logo { font-size: 2rem; font-weight: 900; color: var(--green-game); letter-spacing: -0.02em; margin-bottom: 0.2rem; }
.pr-logo span { color: var(--primary); }
.btn-pr-go { width: 100%; background: var(--green-game); color: white; border: none; padding: 0.875rem; font-size: 1.05rem; font-weight: 700; border-radius: 9px; cursor: pointer; margin-top: 1.25rem; transition: background 0.15s; }
.btn-pr-go:hover { background: #047857; }
.btn-pr-go:disabled { background: #9ca3af; cursor: not-allowed; }
.btn-pr-again { width: 100%; background: var(--green-game); color: white; border: none; padding: 0.875rem; font-size: 1rem; font-weight: 700; border-radius: 9px; cursor: pointer; margin-top: 1.25rem; transition: background 0.15s; }
.btn-pr-again:hover { background: #047857; }
.pr-hud { display: flex; justify-content: space-between; align-items: center; background: white; border-radius: var(--r); border: 1.5px solid var(--border); padding: 0.7rem 1rem; margin-bottom: 0.875rem; }
.pr-score-label { display: block; font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.hud-pts { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--green-game); line-height: 1; }
.pr-streak-bar { text-align: center; font-size: 0.82rem; font-weight: 700; color: #b45309; background: #fef3c7; border: 1px solid #fde68a; border-radius: 7px; padding: 0.35rem 0.75rem; margin-bottom: 0.875rem; display: none; }
.pr-streak-bar.show { display: block; }
.pr-pts-worth { text-align: center; font-size: 0.78rem; color: var(--muted); margin-bottom: 0.6rem; }
.pr-pts-worth strong { color: var(--green-game); }
.pr-feedback-banner { border-radius: 8px; padding: 0.5rem 1rem; font-size: 0.875rem; font-weight: 700; text-align: center; margin-bottom: 0.875rem; display: none; }
.pr-feedback-banner.show-correct { display: block; background: var(--green-light); color: var(--green); }
.pr-feedback-banner.show-wrong { display: block; background: var(--red-light); color: var(--red); }
.pr-finish-btn { width: 100%; background: white; color: var(--muted); border: 2px solid var(--border); padding: 0.75rem; font-size: 0.9rem; font-weight: 600; border-radius: 9px; cursor: pointer; margin-top: 0.5rem; transition: border-color 0.15s; }
.pr-finish-btn:hover { border-color: var(--muted); color: var(--text); }
.pr-result-score { font-size: 4rem; font-weight: 900; color: var(--green-game); font-variant-numeric: tabular-nums; line-height: 1; margin: 0.3rem 0 0.1rem; }
.pr-result-pts-label { font-size: 1rem; font-weight: 700; color: var(--muted); margin-bottom: 0.5rem; }
.pr-result-breakdown { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.75rem; }
.pr-rank-pill { display: inline-block; background: #d1fae5; color: var(--green-game); padding: 0.2rem 0.75rem; border-radius: 99px; font-weight: 700; font-size: 0.82rem; margin-left: 0.4rem; }
.pr-new-record { display: inline-block; background: #fef3c7; color: #92400e; padding: 0.2rem 0.75rem; border-radius: 99px; font-weight: 700; font-size: 0.82rem; margin-left: 0.4rem; }

/* ── MATH INPUT / PREVIEW ────────────────────────────────────── */
.math-pad { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.math-pad-btn { background: white; border: 2px solid var(--border); border-radius: 7px; padding: 0.45rem 0.7rem; font-size: 1rem; font-weight: 700; cursor: pointer; color: var(--text); transition: border-color 0.12s, background 0.12s; user-select: none; }
.math-pad-btn:hover { border-color: var(--green-game); background: #f0fdf4; }
.math-pad-btn:active { background: #dcfce7; }
.math-pad-special { background: #ede9fe !important; border-color: #c4b5fd !important; color: var(--purple) !important; font-size: 0.78rem !important; letter-spacing: 0.01em; }
.math-pad-special:hover { background: #ddd6fe !important; border-color: #a78bfa !important; }
.math-pad-back { background: #fff1f2 !important; border-color: #fecdd3 !important; color: #be123c !important; }
.math-pad-back:hover { background: #ffe4e6 !important; }
.math-preview { background: white; border: 2px solid var(--border); border-radius: 9px; padding: 0.6rem 1rem; min-height: 2.8rem; text-align: center; font-size: 1.4rem; margin-bottom: 0.5rem; transition: border-color 0.15s; color: var(--text); }
.math-preview.has-content { border-color: var(--purple); }

/* ── ACHIEVEMENTS ────────────────────────────────────────────── */
.ach-row { display: flex; gap: 1rem; justify-content: center; margin: 1rem 0; }
.ach-badge { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; opacity: 0.22; transition: opacity 0.3s, transform 0.3s; }
.ach-badge.earned { opacity: 1; }
.ach-badge.newly-unlocked { animation: achPop 0.5s ease; }
.ach-icon { width: 54px; height: 54px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: 900; border: 3px solid currentColor; }
.ach-bronze .ach-icon { background: #fef3c7; color: #b45309; border-color: #d97706; }
.ach-silver .ach-icon { background: #f1f5f9; color: #475569; border-color: #94a3b8; }
.ach-gold   .ach-icon { background: #fefce8; color: #ca8a04; border-color: #eab308; }
.ach-label { font-size: 0.68rem; font-weight: 700; color: var(--muted); text-align: center; max-width: 64px; line-height: 1.2; }
.ach-badge.earned .ach-label { color: var(--text); }
.ach-pts { font-size: 0.62rem; color: var(--muted); font-weight: 600; }
.ach-unlock-banner { background: linear-gradient(135deg,#fef9c3,#fef3c7); border: 2px solid #f59e0b; border-radius: 10px; padding: 0.75rem 1rem; margin: 0.75rem 0; text-align: center; }
.ach-unlock-banner h4 { font-size: 0.82rem; font-weight: 800; color: #92400e; margin-bottom: 0.25rem; text-transform: uppercase; letter-spacing: 0.05em; }
.ach-unlock-banner p { font-size: 0.8rem; color: #78350f; font-weight: 600; }
@keyframes achPop { 0%{transform:scale(0.6);} 60%{transform:scale(1.15);} 100%{transform:scale(1);} }

/* ── MINI-GAMES ──────────────────────────────────────────────── */
.mg-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.mg-tab { padding: 0.5rem 1rem; border-radius: 8px; font-size: 0.82rem; font-weight: 600; cursor: pointer; border: 2px solid var(--border); background: white; color: var(--muted); transition: all 0.15s; }
.mg-tab.active { background: var(--purple); color: white; border-color: var(--purple); }
.mg-tab:hover:not(.active) { border-color: var(--muted); }
.mg-sub { display: none; }
.mg-sub.active { display: block; }

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 600px) {
  .q-problem { font-size: 0.95rem; }
  .q-problem.center { font-size: 1.15rem; }
  .site-header h1 { font-size: 1rem; }
  .fc-question { font-size: 1.25rem; }
  .fc-controls { gap: 0.4rem; }
}
