:root {
  --bg: #0f1412;
  --panel: #18201c;
  --panel-2: #212b26;
  --line: #2e3a34;
  --text: #ecf1ee;
  --muted: #9aa8a0;
  --felt: #0f5132;
  --felt-dark: #0a3b24;
  --gold: #e6b84c;
  --ok: #4cc38a;
  --bad: #f0706a;
  --hint: #6aa9f0;
  --card: #fbfaf6;
  --card-red: #c62828;
  --card-black: #1b1b1b;
  --radius: 12px;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
button { font: inherit; color: inherit; }
kbd {
  font: 600 10px ui-monospace, monospace;
  padding: 1px 4px; border-radius: 4px;
  background: rgba(255,255,255,.12); margin-left: 4px; opacity: .8;
}
.muted { color: var(--muted); }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 20px; border-bottom: 1px solid var(--line); background: var(--panel);
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
}
.brand { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.logo { color: var(--gold); font-size: 20px; }
.logo-img { width: 28px; height: 28px; border-radius: 7px; flex: none; display: block; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav button {
  background: none; border: 0; padding: 7px 12px; border-radius: 8px; cursor: pointer; color: var(--muted);
}
.nav button:hover { background: var(--panel-2); color: var(--text); }
.nav button[aria-current="page"] { background: var(--panel-2); color: var(--text); font-weight: 600; }
.nav button.soon::after { content: "soon"; font-size: 9px; text-transform: uppercase; margin-left: 5px; color: var(--gold); opacity: .8; vertical-align: 1px; }
.bankroll { color: var(--muted); font-size: 14px; }
.bankroll strong { color: var(--gold); font-size: 16px; margin-left: 4px; }

main { padding: 20px; max-width: 1240px; margin: 0 auto; }

/* ---------- Practice layout ---------- */
.practice { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .practice { grid-template-columns: 1fr; } }

.table {
  background: radial-gradient(ellipse at 50% 0%, #17734a 0%, var(--felt) 45%, var(--felt-dark) 100%);
  border: 8px solid #3b2a1a; border-radius: 28px; padding: 16px 20px 20px;
  box-shadow: inset 0 0 60px rgba(0,0,0,.45), 0 10px 30px rgba(0,0,0,.4);
  min-height: 560px; display: flex; flex-direction: column;
}
.table-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 12px; color: rgba(255,255,255,.65); }
.area { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 0; }
.area-label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.55); }
.message {
  text-align: center; font-size: 18px; font-weight: 600; padding: 10px; min-height: 48px;
  color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5);
}
.notice { font-size: 13px; font-weight: 500; color: var(--gold); margin-top: 4px; }

.cards { display: flex; justify-content: center; min-height: 104px; }
.cards .card + .card { margin-left: -26px; }
.hands { display: flex; gap: 22px; justify-content: center; flex-wrap: wrap; }
.hand { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px; border-radius: 14px; border: 2px solid transparent; transition: border-color .2s, background .2s; }
.hand.active { border-color: var(--gold); background: rgba(0,0,0,.15); }
.hands.multi .hand:not(.active) { opacity: .85; }
.hand-total { font-weight: 600; font-size: 15px; display: flex; gap: 10px; align-items: center; min-height: 22px; }
.bet-tag { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: rgba(0,0,0,.35); color: var(--gold); }
.result { font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: rgba(0,0,0,.4); }
.r-win, .r-blackjack { color: var(--ok); }
.r-lose, .r-bust { color: var(--bad); }
.r-push, .r-surrender { color: #ddd; }

/* ---------- Cards ---------- */
.card {
  width: 72px; height: 104px; border-radius: 8px; background: var(--card); color: var(--card-black);
  position: relative; box-shadow: 0 2px 6px rgba(0,0,0,.45); flex: none;
}
.card.red { color: var(--card-red); }
.card .corner { position: absolute; top: 5px; left: 6px; font-weight: 700; font-size: 15px; line-height: 1; text-align: center; }
.card .corner.br { top: auto; left: auto; bottom: 5px; right: 6px; transform: rotate(180deg); }
.card .pip { position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; }
.card.back {
  background: repeating-linear-gradient(45deg, #8e1d2c 0 6px, #a7283a 6px 12px);
  border: 4px solid var(--card);
}
.card.slot { background: transparent; border: 2px dashed rgba(255,255,255,.18); box-shadow: none; }
.cards.empty .card + .card { margin-left: 10px; }
.deal-in { animation: deal .28s ease-out; }
@keyframes deal { from { transform: translateY(-30px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .deal-in { animation: none; } }

/* ---------- Controls ---------- */
.controls { margin-top: auto; padding-top: 14px; }
.actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; align-items: center; }
.btn {
  border: 0; border-radius: 10px; padding: 11px 16px; font-weight: 600; cursor: pointer;
  background: #f3f1ea; color: #1b1b1b; box-shadow: 0 2px 0 rgba(0,0,0,.35);
}
.btn:hover:not(:disabled) { filter: brightness(1.06); }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn kbd { background: rgba(0,0,0,.1); }
.btn.primary { background: var(--gold); color: #2a1e00; }
.btn.ghost { background: rgba(0,0,0,.25); color: #fff; box-shadow: none; border: 1px solid rgba(255,255,255,.2); }
.btn.ghost kbd { background: rgba(255,255,255,.15); }
.btn.small { padding: 7px 10px; font-size: 13px; }
.act-hit { background: #f5d5d2; }
.act-stand { background: #f5ecc4; }
.act-double { background: #cfeedd; }
.act-split { background: #d2e3f8; }
.act-surrender { background: #e3dcef; }

.betting { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.bet-display { font-size: 15px; color: rgba(255,255,255,.8); }
.bet-display strong { color: var(--gold); font-size: 22px; margin-left: 6px; }
.chips { display: flex; gap: 10px; align-items: center; }
.chip {
  width: 54px; height: 54px; border-radius: 50%; font-weight: 800; font-size: 14px; cursor: pointer;
  border: 4px dashed rgba(255,255,255,.75); color: #fff; box-shadow: 0 3px 6px rgba(0,0,0,.4);
}
.chip:disabled { opacity: .35; cursor: not-allowed; }
.chip-5 { background: #c0392b; }
.chip-25 { background: #1e8449; }
.chip-100 { background: #1c1c1c; }
.deal { min-width: 160px; font-size: 16px; }

/* ---------- Coach ---------- */
.coach { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; position: sticky; top: 74px; }
.coach h2 { margin: 0 0 12px; font-size: 15px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.coach-feedback { display: flex; flex-direction: column; gap: 10px; min-height: 120px; }
.coach-feedback p { margin: 0; }
.fb { border-radius: 10px; padding: 12px; background: var(--panel-2); border-left: 4px solid var(--line); font-size: 14px; line-height: 1.45; }
.fb-head { font-weight: 700; margin-bottom: 4px; }
.fb-sit { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.fb.ok { border-left-color: var(--ok); }
.fb.ok .fb-head { color: var(--ok); }
.fb.bad { border-left-color: var(--bad); }
.fb.bad .fb-head { color: var(--bad); }
.fb.bad .fb-head strong { color: var(--text); }
.fb.hint { border-left-color: var(--hint); }
.fb.hint .fb-head { color: var(--hint); }
.fb-sec { margin-top: 8px; }
.fb-k { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.fb-rule { margin-top: 10px; padding: 8px 10px; border-radius: 8px; background: rgba(230,184,76,.1); border: 1px solid rgba(230,184,76,.3); }
.fb-rule .fb-k { color: var(--gold); }
.m-lesson { font-size: 13px; }
.m-lesson .fb-sec:first-child { margin-top: 4px; }
.review-head { font-weight: 700; font-size: 14px; }

.session-stats, .big-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 16px 0; }
.session-stats > div, .big-stats > div { background: var(--panel-2); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; }
.stat-num { font-size: 22px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--muted); }

.settings { border-top: 1px solid var(--line); padding-top: 12px; font-size: 14px; }
.settings summary { cursor: pointer; color: var(--muted); }
.settings label { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; color: var(--muted); font-size: 13px; }
.settings label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.settings select { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px; font: inherit; }

/* ---------- Pages ---------- */
.page-head h2 { margin: 0 0 4px; }
.page-head p { margin: 0 0 16px; color: var(--muted); }
.soon-page { text-align: center; padding: 80px 20px; max-width: 520px; margin: 0 auto; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.legend span { display: inline-block; min-width: 28px; text-align: center; padding: 3px 6px; border-radius: 5px; font-weight: 700; margin-right: -8px; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }
.chart-block h3 { margin: 0 0 8px; font-size: 15px; }
.chart-scroll { overflow-x: auto; }
.chart { border-collapse: collapse; width: 100%; font-size: 13px; }
.chart th, .chart td { padding: 5px 4px; text-align: center; border: 1px solid var(--bg); }
.chart thead th { color: var(--muted); font-weight: 600; }
.chart .dealer-head { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.chart tbody th { background: var(--panel-2); white-space: nowrap; padding: 5px 8px; }
.chart td { font-weight: 700; color: #1b1b1b; }
.c-H { background: #ef8d86; color: #1b1b1b; }
.c-S { background: #f2d675; color: #1b1b1b; }
.c-D { background: #7fd3a3; color: #1b1b1b; }
.c-Ds { background: #b6e8c9; color: #1b1b1b; }
.c-P { background: #8cb8ef; color: #1b1b1b; }
.c-Rh { background: #c4b2e3; color: #1b1b1b; }

.big-stats { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 640px) { .big-stats { grid-template-columns: repeat(2, 1fr); } }
.cats { display: flex; flex-direction: column; gap: 10px; max-width: 640px; }
.cat-row { display: grid; grid-template-columns: 120px 1fr 90px; gap: 12px; align-items: center; font-size: 14px; }
.bar { height: 10px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
.cat-num { text-align: right; font-weight: 600; }
.cat-num small { color: var(--muted); font-weight: 400; }
.mistakes { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; max-width: 760px; }
.mistakes li { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.m-sit { font-weight: 700; }
.m-detail { margin: 2px 0; }
.m-reason { color: var(--muted); font-size: 13px; }
.danger-zone { display: flex; gap: 10px; margin-top: 24px; }
.danger-zone .btn.ghost { color: var(--muted); }

/* ---------- Phone ---------- */
@media (max-width: 600px) {
  main { padding: 12px 16px; }
  .topbar { padding: 8px 16px; gap: 8px; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .nav button { white-space: nowrap; }
  .bankroll { margin-left: auto; }
  .table { padding: 12px; border-width: 6px; border-radius: 20px; min-height: 0; }
  .card { width: 56px; height: 82px; }
  .card .pip { font-size: 26px; }
  .card .corner { font-size: 13px; }
  .cards { min-height: 82px; }
  .cards .card + .card { margin-left: -22px; }
  .btn { padding: 10px 12px; }
  .btn kbd { display: none; }
  .cat-row { grid-template-columns: 90px 1fr 70px; }
}

/* ---------- Level chip / nudges ---------- */
.level-chip {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.level-chip.unset { color: var(--gold); border-color: rgba(230,184,76,.5); }
/* Level chips follow the badge tiers: Beginner bronze → Expert diamond → Expert mastered ruby. */
.lvl-0 { color: #f0b98a; border-color: rgba(240,185,138,.5); }
.lvl-amateur { color: #e4e7eb; border-color: rgba(228,231,235,.45); }
.lvl-1 { color: #ffd966; border-color: rgba(255,217,102,.5); }
.lvl-2 { color: #9fe3d6; border-color: rgba(159,227,214,.5); }
.lvl-3 { color: #9fdcff; border-color: rgba(159,220,255,.55); box-shadow: 0 0 8px rgba(127,211,255,.25); }
.lvl-mastered { color: #ff7b93; border-color: rgba(255,90,120,.6); box-shadow: 0 0 8px rgba(224,17,63,.3); }
.nudge {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: rgba(230,184,76,.1); border: 1px solid rgba(230,184,76,.35); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 16px; font-size: 14px;
}
.level-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; font-size: 14px; }
.level-row .level-chip { cursor: default; font-size: 13px; }

/* ---------- Placement quiz ---------- */
.quiz-page { max-width: 720px; margin: 0 auto; }
.quiz-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.quiz-card h2 { margin: 0 0 8px; }
.quiz-card p { line-height: 1.5; }
.current-level { margin: 12px 0; font-size: 14px; color: var(--muted); }
.current-level strong { color: var(--gold); }
.tier-list { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 8px; }
.tier-list li { display: flex; gap: 12px; align-items: center; background: var(--panel-2); border-radius: 10px; padding: 10px 12px; }
.tier-list li div { display: flex; flex-direction: column; }
.tier-list li span:not(.tier-num) { color: var(--muted); font-size: 13px; }
.tier-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--felt); font-weight: 700; flex: none; }
.small-print { font-size: 13px; }
.quiz-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.quiz-actions .btn.ghost, .unsure, .override select { color: var(--text); }

.tier-track { list-style: none; padding: 0; margin: 0 0 18px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tier-track li { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); text-align: center; position: relative; }
.tt-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); border: 2px solid var(--line); font-weight: 700; font-size: 12px; }
.tier-track li.done .tt-dot { background: var(--ok); border-color: var(--ok); color: #0b2a1a; }
.tier-track li.current .tt-dot { border-color: var(--gold); color: var(--gold); }
.tier-track li.current { color: var(--text); font-weight: 600; }
.tier-up { background: rgba(76,195,138,.12); border: 1px solid rgba(76,195,138,.4); color: var(--ok); border-radius: 10px; padding: 8px 12px; font-weight: 600; font-size: 14px; margin-bottom: 14px; }
.q-meta { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.q-prompt { font-size: 20px; line-height: 1.35; margin: 6px 0 16px !important; }
.q-table { display: flex; justify-content: center; gap: 36px; flex-wrap: wrap; background: radial-gradient(ellipse at 50% 0%, #17734a 0%, var(--felt) 55%, var(--felt-dark) 100%); border-radius: 14px; padding: 16px; margin-bottom: 18px; }
.q-hand { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.q-options { display: grid; gap: 8px; }
.q-options.play { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.q-opt { text-align: left; padding: 13px 14px; line-height: 1.35; }
.q-options.play .q-opt { text-align: center; }
.q-opt kbd { margin: 0 6px 0 0; }
.unsure { margin-top: 10px; background: transparent; border: 1px solid var(--line); }

.level-badge-lg { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 16px 18px; border-radius: 14px; border: 1px solid; background: var(--panel-2); margin-bottom: 14px; }
.lvl-kicker { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.lvl-name { font-size: 28px; font-weight: 800; }
.lvl-focus, .lvl-next { margin: 6px 0; }
.lvl-next { color: var(--muted); }
.tier-scores { display: grid; gap: 8px; margin: 16px 0; }
.ts-row { display: grid; grid-template-columns: 120px 1fr 110px; gap: 12px; align-items: center; font-size: 14px; }
.ts-row.fail .bar span { background: var(--bad); }
.ts-row.na { color: var(--muted); }
.ts-num { text-align: right; font-size: 13px; }
.override { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 16px; font-size: 13px; color: var(--muted); }
.override select { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px; font: inherit; }
.review-list { list-style: none; padding: 0; display: grid; gap: 10px; }
.got-right summary { cursor: pointer; color: var(--muted); margin: 8px 0; }
.quiz-card h3 { margin-top: 24px; }

@media (max-width: 600px) {
  .quiz-card { padding: 16px; }
  .q-prompt { font-size: 18px; }
  .ts-row { grid-template-columns: 90px 1fr 80px; }
  .tier-track .tt-name { font-size: 10px; }
  .q-opt kbd { display: inline; }
}

/* ---------- Level-driven table ---------- */
.btn.suggested { outline: 3px solid var(--gold); outline-offset: 2px; animation: nudge 1.6s ease-in-out infinite; }
.btn.suggested::before { content: "★ "; color: #9a6b00; }
@keyframes nudge { 0%, 100% { box-shadow: 0 0 0 0 rgba(230,184,76,.0); } 50% { box-shadow: 0 0 0 6px rgba(230,184,76,.35); } }
@media (prefers-reduced-motion: reduce) { .btn.suggested { animation: none; } }

.table-mode { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: -4px 0 12px; }
.table-mode .level-chip { cursor: default; }
.reset-level { margin-top: 12px; color: var(--text) !important; }

.count-check { display: flex; flex-direction: column; align-items: center; gap: 6px; background: rgba(0,0,0,.3); border-radius: 14px; padding: 14px 16px; max-width: 420px; margin: 0 auto; }
.cc-title { font-weight: 800; font-size: 16px; color: var(--gold); text-transform: uppercase; letter-spacing: .1em; }
.cc-sub { font-size: 14px; color: rgba(255,255,255,.85); text-align: center; }
.cc-row { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; justify-content: center; }
.cc-row input { width: 130px; font: 700 18px ui-monospace, monospace; text-align: center; padding: 9px; border-radius: 10px; border: 2px solid rgba(255,255,255,.35); background: rgba(0,0,0,.35); color: #fff; }
.cc-row input:focus { outline: none; border-color: var(--gold); }

/* ---------- Account ---------- */
body { background: var(--bg); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--panel); }
.account-chip {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel-2);
  color: var(--muted); font-size: 12px; padding: 4px 10px; border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.ac-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.ac-synced .ac-dot { background: var(--ok); }
.ac-synced { color: var(--text); }
.ac-saving .ac-dot, .ac-connecting .ac-dot { background: var(--gold); animation: pulse 1s ease-in-out infinite; }
.ac-error .ac-dot { background: var(--bad); }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .ac-dot { animation: none !important; } }
.account-panel { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; font-size: 14px; line-height: 1.5; }
.account-panel.ok { border-left-color: var(--ok); }
.btn.ghost.danger { color: var(--bad) !important; border-color: var(--bad); }
@media (max-width: 600px) { .account-chip .ac-text { display: none; } .account-chip { padding: 6px; } }

/* ---------- Total badge beside each hand ---------- */
.hand-row { display: flex; align-items: center; gap: 14px; }
.total-badge {
  min-width: 48px; padding: 6px 12px; border-radius: 999px; text-align: center; white-space: nowrap;
  background: rgba(0,0,0,.45); border: 2px solid rgba(255,255,255,.25); color: #fff;
  font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums;
}
.total-badge.t21 { border-color: var(--ok); color: var(--ok); }
.total-badge.bj { border-color: var(--gold); color: var(--gold); }
.total-badge.bust { border-color: var(--bad); color: var(--bad); }
@media (max-width: 600px) { .hand-row { gap: 8px; } .total-badge { font-size: 15px; padding: 5px 9px; min-width: 40px; } }

/* ---------- Promotion ---------- */
.promo-line { font-size: 12px; color: var(--muted); margin: -6px 0 12px; }
.promo-nudge { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; background: rgba(76,195,138,.12); border: 1px solid rgba(76,195,138,.45); border-radius: 10px; padding: 8px 10px; margin: -4px 0 12px; }
.promo-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; max-width: 640px; }
.promo-card.eligible { border-color: rgba(76,195,138,.55); }
.promo-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.promo-meters { display: grid; gap: 8px; }
.pm-row { display: grid; grid-template-columns: 130px 1fr 120px; gap: 12px; align-items: center; font-size: 14px; }
.pm-num { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.pm-num small { color: var(--muted); font-weight: 400; }
.bar.warn span { background: var(--gold); }
.promo-card p { margin: 10px 0 0; font-size: 13px; }

/* ---------- Level-up test ---------- */
.lu-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.lu-progress { height: 6px; background: var(--panel-2); border-radius: 999px; overflow: hidden; margin: 8px 0 14px; }
.lu-progress span { display: block; height: 100%; background: var(--gold); }
.test-facts { padding-left: 18px; line-height: 1.7; }
.hilo-ref { display: grid; gap: 6px; max-width: 360px; background: var(--panel-2); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.hl-row { display: flex; justify-content: space-between; font-weight: 700; font-variant-numeric: tabular-nums; }
.hl-cards { letter-spacing: .12em; }
.hl-val.plus { color: var(--ok); }
.hl-val.minus { color: var(--bad); }
.hl-note { font-size: 12px; color: var(--muted); }
.speed-box { background: var(--panel-2); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.speed-box p { margin: 0; }
.speed-table { flex-direction: column; align-items: center; gap: 10px; min-height: 230px; justify-content: center; }
.speed-card .card { width: 110px; height: 158px; }
.speed-card .card .pip { font-size: 56px; }
.speed-card .card .corner { font-size: 20px; }
.speed-progress { font-size: 13px; color: rgba(255,255,255,.75); font-variant-numeric: tabular-nums; }
.speed-answer { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.speed-answer input { width: 140px; font: 700 20px ui-monospace, monospace; text-align: center; padding: 10px; border-radius: 10px; border: 2px solid var(--line); background: var(--panel-2); color: var(--text); }
.speed-answer input:focus { outline: none; border-color: var(--gold); }
@media (max-width: 600px) { .pm-row { grid-template-columns: 90px 1fr 90px; } }

/* ---------- Badges ---------- */
:root {
  --bronze-1: #e2a675; --bronze-2: #8a5530;
  --silver-1: #eef1f4; --silver-2: #8b96a3;
  --gold-1: #ffe08a; --gold-2: #b8862b;
  --plat-1: #d9f4ff; --plat-2: #5f8ea8;
}
.medal { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 12px 8px; border-radius: 12px; background: var(--panel-2); min-width: 0; }
.medal-disc {
  --m1: var(--silver-1); --m2: var(--silver-2);
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: radial-gradient(circle at 35% 30%, var(--m1), var(--m2) 75%);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.25), inset 0 0 0 4px rgba(255,255,255,.25), 0 3px 8px rgba(0,0,0,.4);
  color: #1b1b1b; font-weight: 800; font-size: 26px; line-height: 1;
}
.medal-disc::after { content: ""; position: absolute; inset: 7px; border-radius: 50%; border: 1.5px dashed rgba(0,0,0,.22); }
.medal-disc.g-md { font-size: 19px; }
.medal-disc.g-sm { font-size: 14px; letter-spacing: -.02em; }
.tone-bronze .medal-disc { --m1: var(--bronze-1); --m2: var(--bronze-2); }
.tone-silver .medal-disc { --m1: var(--silver-1); --m2: var(--silver-2); }
.tone-gold .medal-disc { --m1: var(--gold-1); --m2: var(--gold-2); }
.tone-platinum .medal-disc { --m1: var(--plat-1); --m2: var(--plat-2); }
.medal-name { font-weight: 700; font-size: 14px; margin-top: 4px; }
.medal-desc { font-size: 12px; color: var(--muted); line-height: 1.35; }
.medal-date { font-size: 11px; color: var(--ok); margin-top: 2px; }
.medal.locked .medal-disc { filter: grayscale(1) brightness(.5); box-shadow: inset 0 0 0 4px rgba(255,255,255,.08); }
.medal.locked .medal-name { color: var(--muted); }
.medal-progress { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; width: 100%; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 4px; }
.medal-progress .bar { height: 6px; }

.badge-wall { margin-top: 28px; }
.bw-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.bw-head h3 { margin: 0; }
.bw-count { color: var(--gold); font-weight: 700; font-variant-numeric: tabular-nums; }
.badge-group h4 { margin: 18px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }

.badge-backdrop {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: rgba(5,10,8,.72); backdrop-filter: blur(3px);
}
.badge-modal {
  width: min(560px, 100%); max-height: 100%; overflow-y: auto; text-align: center;
  background: var(--panel); border: 1px solid rgba(230,184,76,.45); border-radius: 18px; padding: 22px 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6); animation: pop .35s cubic-bezier(.2,1.4,.4,1);
}
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .badge-modal { animation: none; } }
.bm-kicker { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.badge-modal h2 { margin: 4px 0 8px; font-size: 24px; text-wrap: balance; }
.badge-modal p { color: var(--muted); margin: 0 0 12px; }
.bm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 14px 0 18px; }
.bm-grid.single { grid-template-columns: minmax(0, 240px); justify-content: center; }
.bm-grid.single .medal-disc { width: 92px; height: 92px; font-size: 36px; }
.bm-accept { min-width: 200px; font-size: 16px; }

/* ---------- Placement pop-up ---------- */
.badge-modal.placement-modal { width: min(760px, 100%); text-align: left; padding: 8px; border-color: var(--line); }
.placement-modal .quiz-page { max-width: none; }
.placement-modal .quiz-card { border: 0; background: transparent; }
.placement-modal .tier-up, .placement-modal .level-badge-lg { text-align: left; }
.welcome-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.welcome-brand img { width: 64px; height: 64px; border-radius: 14px; flex: none; box-shadow: 0 4px 14px rgba(0,0,0,.45); }
.welcome-name { font-size: 40px; font-weight: 800; line-height: 1.05; letter-spacing: -.01em; color: var(--gold); }
@media (max-width: 600px) { .welcome-name { font-size: 32px; } .welcome-brand img { width: 52px; height: 52px; } }

/* ---------- Tests page ---------- */
.tests-page { max-width: 760px; }
.test-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 0; position: relative; }
.test-row { display: grid; grid-template-columns: 40px 1fr; gap: 14px; position: relative; padding-bottom: 18px; }
.test-row:not(:last-child)::before { content: ""; position: absolute; left: 19px; top: 40px; bottom: 0; width: 2px; background: var(--line); }
.tr-step { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--panel-2); border: 2px solid var(--line); color: var(--muted); }
.test-row.done .tr-step, .test-row.passed .tr-step { background: var(--ok); border-color: var(--ok); color: #0b2a1a; }
.test-row.available .tr-step { border-color: var(--gold); color: var(--gold); }
.test-row.working .tr-step { border-color: var(--gold); color: var(--text); }
.test-row.skipped .tr-step { border-style: dashed; }
.tr-body { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.test-row.available .tr-body { border-color: rgba(230,184,76,.6); }
.test-row.locked .tr-body { opacity: .65; }
.tr-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.tr-head h3 { margin: 0; font-size: 17px; }
.tr-chip { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.tr-chip.done, .tr-chip.passed { color: var(--ok); border-color: rgba(76,195,138,.5); }
.tr-chip.available { color: #2a1e00; background: var(--gold); border-color: var(--gold); }
.tr-chip.working { color: var(--gold); border-color: rgba(230,184,76,.5); }
.tr-covers { margin: 6px 0 2px; font-size: 14px; }
.tr-meta { margin: 0; font-size: 12px; color: var(--muted); }
.tr-detail { margin: 8px 0 0; font-size: 14px; }
.tr-meters { margin-top: 10px; }
.test-row .btn.primary { margin-top: 10px; }

/* ---------- Amateur stage ---------- */

/* ---------- Tiers: bronze → silver → gold → platinum → diamond → ruby (Levels only) ---------- */
:root {
  --bronze-1: #f0b98a; --bronze-2: #8a5126;
  --silver-1: #f7f8fa; --silver-2: #9aa1aa;
  --gold-1: #ffe58f; --gold-2: #b8842a;
  --plat-1: #e3fbf6; --plat-2: #4f9a8f;
  --dia-1: #ffffff; --dia-2: #7fd3ff; --dia-3: #b69cff;
  --ruby-1: #ffc2cf; --ruby-2: #e0113f; --ruby-3: #7a0622;
}
.tone-silver .medal-disc, .medal-disc.tone-silver { --m1: var(--silver-1); --m2: var(--silver-2); }
.tone-platinum .medal-disc, .medal-disc.tone-platinum { --m1: var(--plat-1); --m2: var(--plat-2); }
.medal-disc.tone-bronze { --m1: var(--bronze-1); --m2: var(--bronze-2); }
.medal-disc.tone-gold { --m1: var(--gold-1); --m2: var(--gold-2); }
.tone-diamond .medal-disc, .medal-disc.tone-diamond {
  background:
    conic-gradient(from 20deg, rgba(255,255,255,.55), rgba(127,211,255,.15), rgba(255,255,255,.6), rgba(182,156,255,.2), rgba(255,255,255,.55), rgba(127,211,255,.2), rgba(255,255,255,.55)),
    radial-gradient(circle at 35% 30%, var(--dia-1), var(--dia-2) 55%, var(--dia-3) 100%);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.18), inset 0 0 0 4px rgba(255,255,255,.45), 0 0 14px rgba(127,211,255,.55), 0 3px 8px rgba(0,0,0,.4);
}
.tone-diamond:not(.locked) .medal-disc::before, .medal-disc.tone-diamond::before {
  content: "✦"; position: absolute; top: 2px; right: 4px; font-size: 13px; color: #fff; text-shadow: 0 0 6px #fff;
  animation: twinkle 2.4s ease-in-out infinite;
}
@keyframes twinkle { 50% { opacity: .2; transform: scale(.7); } }
@media (prefers-reduced-motion: reduce) { .medal-disc::before { animation: none !important; } }
.medal.locked .medal-disc.tone-diamond, .medal.locked.tone-diamond .medal-disc { box-shadow: inset 0 0 0 4px rgba(255,255,255,.08); }
.tone-ruby .medal-disc, .medal-disc.tone-ruby {
  background:
    conic-gradient(from 0deg, rgba(255,255,255,.35), rgba(122,6,34,.15), rgba(255,255,255,.4), rgba(255,90,120,.15), rgba(255,255,255,.35), rgba(122,6,34,.2), rgba(255,255,255,.35)),
    radial-gradient(circle at 35% 30%, var(--ruby-1), var(--ruby-2) 55%, var(--ruby-3) 100%);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.25), inset 0 0 0 4px rgba(255,255,255,.35), 0 0 16px rgba(224,17,63,.6), 0 3px 8px rgba(0,0,0,.4);
  color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.45);
}
.tone-ruby .medal-disc::after, .medal-disc.tone-ruby::after { border-color: rgba(255,255,255,.3); }
.tone-ruby:not(.locked) .medal-disc::before, .medal-disc.tone-ruby::before {
  content: "✦"; position: absolute; top: 2px; right: 4px; font-size: 13px; color: #fff; text-shadow: 0 0 6px #ff9fb2;
  animation: twinkle 2.4s ease-in-out infinite;
}
.medal.locked .medal-disc.tone-ruby, .medal.locked.tone-ruby .medal-disc { box-shadow: inset 0 0 0 4px rgba(255,255,255,.08); }

/* ---------- Area medals ---------- */
.area-head { display: flex; align-items: center; gap: 14px; margin: 22px 0 10px; }
.area-head h4 { margin: 0 0 2px; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.area-disc { width: 56px; height: 56px; font-size: 22px; flex: none; }
.area-disc.tone-none { filter: grayscale(1) brightness(.45); }
.area-disc.area-sm { width: 40px; height: 40px; font-size: 16px; }
.area-status { font-size: 15px; }
.area-status b { color: var(--text); }
.area-head.locked .area-status { color: var(--muted); }
.area-pips { display: flex; align-items: center; gap: 5px; margin-top: 5px; }
.tier-pip { width: 18px; height: 6px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); }
.tier-pip.on.tone-bronze { background: var(--bronze-1); border-color: var(--bronze-2); }
.tier-pip.on.tone-silver { background: var(--silver-1); border-color: var(--silver-2); }
.tier-pip.on.tone-gold { background: var(--gold-1); border-color: var(--gold-2); }
.tier-pip.on.tone-platinum { background: var(--plat-1); border-color: var(--plat-2); }
.tier-pip.on.tone-ruby { background: linear-gradient(90deg, var(--ruby-2), var(--ruby-1)); border-color: #fff; box-shadow: 0 0 6px rgba(224,17,63,.6); }
.tier-pip.on.tone-diamond { background: linear-gradient(90deg, var(--dia-2), var(--dia-3)); border-color: #fff; box-shadow: 0 0 6px rgba(127,211,255,.6); }
.area-next { font-size: 11px; color: var(--muted); margin-left: 6px; }
.badge-group > h4 { margin: 18px 0 8px; }
.bm-upgrade { display: flex; align-items: center; gap: 10px; justify-content: center; background: var(--panel-2); border-radius: 10px; padding: 8px 12px; margin: 8px 0; text-align: left; color: var(--text); }
.badge-modal .bm-upgrade span { color: var(--text); }

/* The placement pop-up re-renders on every question; don't replay its pop-in each time. */
.badge-modal.placement-modal { animation: none; }

/* ---------- Learn ---------- */
.learn-page { max-width: 980px; }
.ls-overview { display: grid; gap: 12px; margin-bottom: 8px; }
.ls-progress { display: grid; grid-template-columns: minmax(0, 360px) auto; gap: 12px; align-items: center; font-size: 14px; color: var(--muted); }
.ls-up-next { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: rgba(230,184,76,.1); border: 1px solid rgba(230,184,76,.35); border-radius: var(--radius); padding: 10px 14px; font-size: 14px; }
.ls-section { margin-top: 26px; }
.ls-section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ls-section-head h3 { margin: 0 0 2px; }
.ls-section-head p { margin: 0; color: var(--muted); font-size: 14px; }
.ls-section-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.ls-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.ls-card {
  display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: start; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; color: var(--text); font: inherit;
}
.ls-card:hover { border-color: rgba(230,184,76,.5); }
.ls-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.ls-card.rec { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(230,184,76,.35); }
.ls-num { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--panel-2); border: 2px solid var(--line); color: var(--muted); }
.ls-card.done .ls-num { background: var(--ok); border-color: var(--ok); color: #0b2a1a; }
.ls-card.rec .ls-num { border-color: var(--gold); color: var(--gold); }
.ls-card-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ls-card-title { font-weight: 700; }
.ls-card-sum { font-size: 13px; color: var(--muted); }
.ls-card-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ls-card-meta b { color: var(--gold); }

.quiz-card.lesson, .quiz-card.ls-done { max-width: 760px; margin: 0 auto; }
.ls-back { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; font: inherit; text-transform: none; letter-spacing: 0; }
.ls-back:hover { color: var(--text); }
.ls-title { margin: 6px 0 10px; font-size: 22px; text-wrap: balance; }
.ls-body { font-size: 16px; line-height: 1.6; max-width: 62ch; }
.ls-body p { margin: 0 0 10px; }
.ls-rules, .ls-steps { padding-left: 20px; margin: 6px 0 0; display: grid; gap: 6px; }
.ls-formula { font: 700 17px ui-monospace, monospace; background: var(--panel-2); border-radius: 8px; padding: 10px 12px; display: inline-block; }
.ls-hands { display: flex; gap: 24px; flex-wrap: wrap; justify-content: center; background: radial-gradient(ellipse at 50% 0%, #17734a 0%, var(--felt) 55%, var(--felt-dark) 100%); border-radius: 14px; padding: 16px; margin-top: 14px; }
.ls-hand { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ls-hand-label { font-weight: 700; font-size: 14px; color: #fff; }
.ls-table-wrap { overflow-x: auto; margin-top: 14px; }
.ls-table { border-collapse: collapse; font-size: 14px; min-width: 100%; }
.ls-table th, .ls-table td { padding: 7px 9px; border: 1px solid var(--line); text-align: center; }
.ls-table thead th { color: var(--muted); font-weight: 600; }
.ls-table tbody th { background: var(--panel-2); white-space: nowrap; }
.ls-table.left td { text-align: left; }
.ls-table td.hot { color: var(--ok); font-weight: 700; }
.ls-table td.plus { color: var(--ok); font-weight: 800; }
.ls-table td.minus { color: var(--bad); font-weight: 800; }
.q-opt.ls-right { outline: 3px solid var(--ok); outline-offset: 1px; opacity: 1; }
.q-opt.ls-wrong { outline: 3px solid var(--bad); outline-offset: 1px; opacity: 1; }
.q-options .q-opt:disabled:not(.ls-right):not(.ls-wrong) { opacity: .45; }
.ls-feedback { margin-top: 12px; }
.ls-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }
.ls-hint { text-align: right; margin: 6px 0 0; }
.ls-done h2 { margin-top: 4px; }
@media (max-width: 600px) { .ls-progress { grid-template-columns: 1fr; } .ls-title { font-size: 19px; } .ls-body { font-size: 15px; } }

/* ---------- Lesson locks and passing ---------- */
.ls-card.locked { cursor: not-allowed; opacity: .55; }
.ls-card.locked:hover { border-color: var(--line); }
.ls-card.locked .ls-num::after { content: ""; }
.ls-card.locked .ls-card-meta b { color: var(--text); }
.tr-chip.bad { color: var(--bad); border-color: rgba(240,112,106,.5); }
.ls-tag { display: inline-block; margin-left: 6px; font-size: 10px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.ls-tag.bad { color: var(--bad); border-color: rgba(240,112,106,.5); }
.ls-fail-note { margin-top: 8px; font-size: 13px; color: var(--bad); }
.ls-done.failed { border-color: rgba(240,112,106,.45); }

/* ---------- Drills ---------- */
.drills-page { max-width: 980px; }
.drill-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.drill-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.drill-card.rec { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(230,184,76,.3); }
.drill-card p { margin: 0; color: var(--muted); font-size: 14px; }
.drill-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.drill-head h3 { margin: 0; }
.drill-set { display: grid; gap: 6px; }
.drill-set-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.drill-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-opt { font: inherit; font-size: 13px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; }
.chip-opt.on { background: var(--gold); border-color: var(--gold); color: #2a1e00; font-weight: 700; }
.chip-opt:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.drill-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 6px; }
.drill-best-line { font-size: 13px; color: var(--muted); }
.drill-best-line b { color: var(--text); }
.quiz-card.drill-run, .quiz-card.drill-done { max-width: 760px; margin: 0 auto; }
.drill-ok { margin-top: 12px; text-align: center; font-weight: 800; font-size: 18px; color: var(--ok); }
.tc-box { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.tc-box > div { background: var(--panel-2); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tc-k { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.tc-v { font: 800 30px ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.drill-stats { grid-template-columns: repeat(3, 1fr); }
.drill-best { color: var(--gold); font-weight: 700; }

/* ---------- Reset buttons ---------- */
.danger-zone { flex-wrap: wrap; align-items: flex-start; gap: 16px; }
.dz-item { display: flex; flex-direction: column; gap: 6px; max-width: 340px; }
.dz-item .btn { align-self: flex-start; }
.dz-note { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.45; }

/* ---------- Recent mistakes folder ---------- */
.mistakes-fold { margin-top: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); max-width: 760px; }
.mistakes-fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.mistakes-fold > summary::-webkit-details-marker { display: none; }
.mistakes-fold > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
.mistakes-fold[open] > summary::before { transform: rotate(90deg); }
.mf-title { font-weight: 700; font-size: 17px; }
.mf-count { margin-left: auto; font-size: 13px; color: var(--muted); }
.mf-note { margin: 0 16px 10px; font-size: 13px; color: var(--muted); }
.mistakes.compact { margin: 0; padding: 0 10px 12px; gap: 6px; max-width: none; }
.mistakes.compact li { padding: 0; }
.m-row > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 9px 12px; font-size: 14px; }
.m-row > summary::-webkit-details-marker { display: none; }
.m-row > summary .m-sit { font-weight: 700; min-width: 0; }
.m-short { color: var(--muted); font-size: 13px; white-space: nowrap; }
.m-short b { color: var(--text); }
.m-times { font-size: 12px; font-weight: 800; color: var(--bad); background: rgba(240,112,106,.12); border: 1px solid rgba(240,112,106,.4); border-radius: 999px; padding: 1px 8px; }
.m-row[open] > summary { border-bottom: 1px solid var(--line); }
.m-row .m-lesson { padding: 6px 12px 12px; }
.m-times { justify-self: start; }
@media (max-width: 600px) { .m-row > summary { grid-template-columns: 1fr auto; } .m-times { grid-column: 2; grid-row: 1; justify-self: end; } .m-short { grid-column: 1 / -1; white-space: normal; } }

/* ---------- Practice-style action row in Learn, Drills and tests ---------- */
.play-actions { margin: 4px 0 8px; }
.play-actions .btn.ls-right { outline: 3px solid var(--ok); outline-offset: 2px; opacity: 1; }
.play-actions .btn.ls-wrong { outline: 3px solid var(--bad); outline-offset: 2px; opacity: 1; }

/* ---------- Running count panel (Table settings) ---------- */
.table { position: relative; }
.count-hud {
  position: absolute; right: 18px; top: 50%; transform: translateY(-50%); z-index: 2;
  display: grid; gap: 6px; min-width: 118px; padding: 10px 12px;
  background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.18); border-radius: 12px;
  color: #fff; font-variant-numeric: tabular-nums; pointer-events: none;
}
.ch-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.ch-k { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,.65); }
.ch-v { font: 800 22px ui-monospace, monospace; color: var(--gold); }
.ch-v.sm { font-size: 14px; color: #fff; }
.ch-main { padding-bottom: 4px; border-bottom: 1px solid rgba(255,255,255,.15); }
@media (max-width: 760px) {
  .count-hud { position: static; transform: none; grid-template-columns: repeat(3, auto); justify-content: center; gap: 4px 16px; margin: 0 auto 8px; min-width: 0; }
  .ch-main { border-bottom: 0; padding-bottom: 0; }
  .ch-row { gap: 6px; }
}

/* ---------- Lesson callouts ---------- */
.ls-callout { margin: 12px 0; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); font-size: 15px; line-height: 1.55; max-width: 62ch; }
.ls-callout-k { display: block; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 3px; }
.ls-callout.tip { border-color: rgba(230,184,76,.45); background: rgba(230,184,76,.08); }
.ls-callout.tip .ls-callout-k { color: var(--gold); }
.ls-callout.warn { border-color: rgba(240,112,106,.45); background: rgba(240,112,106,.08); }
.ls-callout.warn .ls-callout-k { color: var(--bad); }
.ls-callout.example { border-color: rgba(106,169,240,.45); background: rgba(106,169,240,.08); }
.ls-callout.example .ls-callout-k { color: var(--hint); }
.ls-body ul.ls-rules, .ls-body ol.ls-steps { margin-bottom: 10px; }

/* "The science" callout in lessons */
.ls-callout.why { border-color: rgba(168,140,255,.5); background: rgba(168,140,255,.09); }
.ls-callout.why .ls-callout-k { color: #b8a4ff; }

/* ---------- Recommended lessons under each test ---------- */
.tr-rec { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.tr-rec-k { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--hint); margin-right: 2px; }
.tr-rec-link { font: inherit; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; border: 1px solid rgba(106,169,240,.45); background: rgba(106,169,240,.1); color: var(--text); cursor: pointer; }
.tr-rec-link span { color: var(--muted); font-weight: 400; margin-left: 4px; }
.tr-rec-link.complete { border-color: rgba(76,195,138,.5); background: rgba(76,195,138,.1); }
.tr-rec-link:hover { border-color: var(--hint); }
.tr-rec-note { flex-basis: 100%; font-size: 12px; color: var(--muted); }
.test-row .tr-rec + .btn.primary { margin-top: 12px; }

/* Running count off while count checks are on */
.settings label.check.off { color: var(--muted); }
.settings label.check.off input { cursor: not-allowed; }
.setting-note { margin: 4px 0 0 26px; font-size: 12px; color: var(--muted); }
.cc-note { margin-top: 8px; font-size: 13px; color: var(--gold); }
.cc-note.cc-ok { color: var(--ok); }
.ls-deck { display: inline-block; vertical-align: middle; margin-left: 8px; font-size: 12px; font-weight: 700; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }

/* ---------- Accounts (web version) ---------- */
.ac-signin { color: var(--gold); border-color: rgba(230,184,76,.5); }
.ac-signin .ac-dot { background: var(--gold); animation: none; }
.ap-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ap-actions { display: flex; gap: 8px; flex: none; }
.badge-modal.auth-modal { width: min(420px, 100%); text-align: left; position: relative; padding: 24px; }
.auth-brand { margin-bottom: 6px; }
.auth-brand img { width: 48px; height: 48px; border-radius: 11px; }
.auth-brand h2 { margin: 2px 0 0; font-size: 24px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; margin: 14px 0 10px; }
.auth-field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; }
.auth-field em { font-style: normal; font-weight: 400; color: var(--muted); }
.auth-field input { font: inherit; font-size: 16px; font-weight: 400; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); }
.auth-field input:focus { outline: none; border-color: var(--gold); }
.auth-form .btn.primary { margin-top: 4px; }
.auth-msg { margin: 0; font-size: 14px; line-height: 1.45; padding: 8px 12px; border-radius: 8px; }
.auth-msg.bad { color: #ffb4ab; background: rgba(224,80,64,.12); }
.auth-msg.ok { color: #a6e8bf; background: rgba(80,200,120,.12); }
.auth-links { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.auth-close { position: absolute; top: 10px; right: 12px; background: none; border: 0; color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer; padding: 4px 8px; }
.auth-close:hover { color: var(--text); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--gold); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.intro-account { margin-top: 14px; font-size: 14px; color: var(--muted); }
