/* Mental Math Dojo — dark slate + amber, matching the George-side aesthetic. */

:root {
  --bg: #12131a;
  --bg-card: #1b1d27;
  --bg-card-2: #232634;
  --ink: #f2f3f8;
  --ink-dim: rgba(242, 243, 248, 0.62);
  --ink-faint: rgba(242, 243, 248, 0.38);
  --accent: #f5a623;
  --accent-2: #7dd3fc;
  --right: #4fbf7b;
  --wrong: #ef5f6b;
  --line: rgba(255, 255, 255, 0.09);
  --radius: 14px;
  font-size: 16px;
}

* { box-sizing: border-box; }

/* A class rule like `display: flex` outranks the UA stylesheet's [hidden] rule,
 * so the attribute needs teeth of its own — several panels here are toggled with it. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -10%, #1e2130 0%, var(--bg) 60%);
  color: var(--ink);
  font-family: "Nunito", "Quicksand", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

.screen { display: none; padding: 0 1.1rem 3rem; max-width: 780px; margin: 0 auto; }
.screen--active { display: block; }

/* ---------- header ---------- */
.hero { padding: 1.6rem 0 1.1rem; text-align: center; position: relative; }
.hero--compact { padding: 1.3rem 0 0.8rem; }
.hero h1 { margin: 0.6rem 0 0.2rem; font-size: 2rem; letter-spacing: -0.02em; }
.hero__accent { color: var(--accent); }
.hero__sub { margin: 0.35rem 0 0; color: var(--ink-dim); font-size: 0.95rem; }

.back-link {
  position: absolute; left: 0; top: 1.5rem;
  color: var(--ink-faint); text-decoration: none; font-size: 0.85rem;
}
.back-link:hover { color: var(--accent); }
.back-link--btn { background: none; border: 0; cursor: pointer; font-family: inherit; padding: 0; }

/* ---------- rank banner ---------- */
.rank-banner {
  display: flex; align-items: center; gap: 0.9rem;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 0.85rem 1rem; margin-bottom: 1.4rem;
}
.belt-swatch {
  display: inline-block; width: 2.1rem; height: 0.62rem; border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35) inset;
}
.rank-banner__text { display: flex; flex-direction: column; line-height: 1.35; flex: 1; min-width: 0; }
.rank-banner__label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); }
.rank-banner__detail { font-size: 0.8rem; color: var(--ink-dim); }

/* ---------- topics + decks ---------- */
.topic { margin-bottom: 1.6rem; }
.topic__name {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-dim); margin: 0 0 0.7rem;
}
.topic__icon { color: var(--accent); font-size: 1.05rem; }

.deck-grid { display: grid; gap: 0.6rem; }
.deck {
  display: flex; align-items: center; gap: 0.85rem; width: 100%;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.85rem 1rem; cursor: pointer; text-align: left; color: inherit;
  font-family: inherit; transition: transform 0.12s ease, border-color 0.12s ease;
}
.deck:hover { transform: translateY(-2px); border-color: rgba(245, 166, 35, 0.45); }
.deck__belt { flex: 0 0 auto; width: 0.42rem; height: 2.6rem; border-radius: 3px; }
.deck__body { display: flex; flex-direction: column; gap: 0.12rem; flex: 1; min-width: 0; }
.deck__name { font-size: 1.02rem; }
.deck__blurb { font-size: 0.82rem; color: var(--ink-dim); }
.deck__stats { font-size: 0.72rem; color: var(--ink-faint); }
.deck__cta { color: var(--accent); font-size: 0.85rem; }

/* ---------- settings ---------- */
.settings {
  display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap;
  border-top: 1px solid var(--line); padding-top: 1.1rem; margin-top: 0.6rem;
}
.opt-label { font-size: 0.78rem; color: var(--ink-dim); margin-right: 0.2rem; }
.setsize {
  background: var(--bg-card); color: var(--ink-dim); border: 1px solid var(--line);
  border-radius: 9px; padding: 0.35rem 0.7rem; cursor: pointer; font-family: inherit; font-size: 0.85rem;
}
.setsize--active { background: var(--accent); color: #17181f; border-color: var(--accent); font-weight: 700; }

/* ---------- buttons ---------- */
.btn {
  font-family: inherit; font-size: 0.95rem; border-radius: 11px; cursor: pointer;
  padding: 0.7rem 1.2rem; border: 1px solid transparent; transition: filter 0.12s ease;
}
.btn:hover { filter: brightness(1.1); }
.btn--primary { background: var(--accent); color: #17181f; font-weight: 800; }
.btn--primary:disabled { opacity: 0.35; cursor: not-allowed; filter: none; }
.btn--ghost { background: transparent; color: var(--ink-dim); border-color: var(--line); }
.btn--danger { background: transparent; color: var(--wrong); border-color: rgba(239, 95, 107, 0.35); margin-left: auto; }
.btn--small { font-size: 0.78rem; padding: 0.4rem 0.75rem; }

.setup-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; margin-top: 1.4rem; }

/* ---------- trick cards ---------- */
.trick {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem; margin-bottom: 0.7rem;
}
.trick h3 { margin: 0 0 0.4rem; font-size: 1.02rem; color: var(--accent); }
.trick__how { margin: 0 0 0.6rem; font-size: 0.92rem; line-height: 1.5; color: var(--ink); }
.trick__ex {
  margin: 0; font-size: 0.9rem; color: var(--accent-2);
  font-variant-numeric: tabular-nums; background: rgba(125, 211, 252, 0.07);
  border-left: 2px solid rgba(125, 211, 252, 0.45); padding: 0.5rem 0.7rem; border-radius: 0 8px 8px 0;
}
.trick__ex-label {
  display: block; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--ink-faint); margin-bottom: 0.2rem;
}
.book-section { margin-bottom: 1.8rem; }

/* ---------- play ---------- */
.play-bar {
  display: flex; align-items: center; gap: 0.7rem; padding: 1.2rem 0 0.9rem;
  position: relative; justify-content: space-between;
}
.play-bar .back-link--btn { position: static; }
.play-bar__deck { font-size: 0.85rem; color: var(--ink-dim); flex: 1; text-align: center; }
.play-bar__count { font-size: 0.85rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

.progress-dots { display: flex; gap: 0.3rem; justify-content: center; margin-bottom: 1rem; flex-wrap: wrap; }
.dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: rgba(255, 255, 255, 0.14); }
.dot--now { box-shadow: 0 0 0 2px rgba(245, 166, 35, 0.5); }
.dot--right { background: var(--right); }
.dot--wrong { background: var(--wrong); }

.problem-card {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 18px;
  padding: 1.5rem 1.1rem 1.2rem; text-align: center;
}
.problem {
  font-size: 2.15rem; font-weight: 700; letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums; margin-bottom: 1.1rem; line-height: 1.25;
}

.entry {
  min-height: 3rem; font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums;
  background: var(--bg-card-2); border: 2px solid var(--line); border-radius: 12px;
  display: flex; align-items: center; justify-content: center; margin-bottom: 0.8rem;
  color: var(--accent);
}
.entry--right { border-color: var(--right); color: var(--right); }
.entry--wrong { border-color: var(--wrong); color: var(--wrong); }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; max-width: 320px; margin: 0 auto; }
.key {
  background: var(--bg-card-2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 12px; padding: 0.85rem 0; font-size: 1.25rem; font-family: inherit;
  cursor: pointer; font-variant-numeric: tabular-nums;
}
.key:hover { background: #2b2f40; }
.key--wide { grid-column: span 2; }
.key--del { color: var(--ink-dim); }

.answer-choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.55rem; }
.choice {
  background: var(--bg-card-2); color: var(--ink); border: 2px solid var(--line);
  border-radius: 12px; padding: 0.9rem 0.5rem; font-size: 1.2rem; font-family: inherit;
  cursor: pointer; font-variant-numeric: tabular-nums;
}
.choice:hover:not(:disabled) { border-color: rgba(245, 166, 35, 0.5); }
.choice--picked { border-color: var(--accent); color: var(--accent); }
.choice--right { border-color: var(--right); color: var(--right); background: rgba(79, 191, 123, 0.1); }
.choice--wrong { border-color: var(--wrong); color: var(--wrong); background: rgba(239, 95, 107, 0.08); }
.choice:disabled { cursor: default; }

.play-actions { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; margin-top: 1.1rem; }

/* ---------- feedback ---------- */
.feedback {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem; margin-top: 0.9rem; text-align: left;
}
.feedback__head { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.tag {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.09em; font-weight: 800;
  padding: 0.22rem 0.5rem; border-radius: 999px;
}
.tag--right { background: rgba(79, 191, 123, 0.16); color: var(--right); }
.tag--wrong { background: rgba(239, 95, 107, 0.16); color: var(--wrong); }
.tag--hint { background: rgba(245, 166, 35, 0.16); color: var(--accent); }
.feedback__answer { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.feedback__trick { font-size: 0.9rem; color: var(--accent); margin-bottom: 0.5rem; }
.feedback__steps { margin: 0 0 0.9rem; padding-left: 1.3rem; }
.feedback__steps li {
  font-size: 0.92rem; line-height: 1.6; color: var(--ink-dim);
  font-variant-numeric: tabular-nums; margin-bottom: 0.2rem;
}
.feedback__steps li b { color: var(--ink); }

/* ---------- summary ---------- */
.rank-up {
  display: flex; align-items: center; gap: 0.7rem; justify-content: center;
  background: rgba(245, 166, 35, 0.1); border: 1px solid rgba(245, 166, 35, 0.35);
  border-radius: var(--radius); padding: 0.8rem 1rem; margin-bottom: 1.2rem;
}
.review__head {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-dim); margin: 1rem 0 0.6rem;
}
.review-item {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.9rem 1rem; margin-bottom: 0.6rem;
}
.review-item__q { font-size: 1.15rem; font-variant-numeric: tabular-nums; margin-bottom: 0.15rem; }
.review-item__trick { font-size: 0.82rem; color: var(--accent); margin-bottom: 0.5rem; }

/* ---------- footer ---------- */
footer { text-align: center; margin-top: 2.4rem; }
.made-by { color: var(--ink-faint); font-size: 0.85rem; margin: 0 0 0.25rem; }
.disclaimer { color: var(--ink-faint); opacity: 0.6; font-size: 0.7rem; margin: 0; }

@media (max-width: 420px) {
  .problem { font-size: 1.8rem; }
  .hero h1 { font-size: 1.65rem; }
}
