/* ==========================================================================
   小小计算家 — playful, high-contrast UI for young children.
   No external fonts, icons or CDNs: the page works fully offline.
   ========================================================================== */

:root {
  --bg-top: #e8f4ff;
  --bg-mid: #f6fbff;
  --bg-bottom: #fff9ee;

  --card: #ffffff;
  --ink: #1b2a4a;
  --ink-soft: #61708c;
  --line: #e3ebf6;

  --blue: #4f9cf9;
  --blue-dark: #2563eb;
  --blue-soft: #eaf4ff;

  --mint: #34d399;
  --mint-dark: #0f9d6e;
  --mint-soft: #e9fbf3;

  --amber: #fbbf24;
  --amber-dark: #d97706;
  --amber-soft: #fff7e3;

  --coral: #fb7185;
  --coral-dark: #e11d48;
  --coral-soft: #fff0f2;

  --purple: #a78bfa;
  --purple-dark: #7c3aed;
  --purple-soft: #f4f0ff;

  --radius: 24px;
  --shadow-sm: 0 4px 14px rgba(31, 83, 158, 0.07);
  --shadow: 0 12px 30px rgba(31, 83, 158, 0.09);
  --shadow-lg: 0 18px 40px rgba(31, 83, 158, 0.14);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Nunito", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 12% -8%, #dcefff 0%, transparent 60%),
    radial-gradient(800px 480px at 92% 8%, #fff2d8 0%, transparent 55%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 45%, var(--bg-bottom) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

/* ---------- floating background symbols ---------- */
.bg-decor {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.float-shape {
  position: absolute;
  font-weight: 900;
  color: var(--blue);
  opacity: 0.07;
  user-select: none;
  animation: floaty 11s ease-in-out infinite;
}

.s1 { font-size: 92px; top: 7%; left: 4%; }
.s2 { font-size: 104px; top: 20%; right: 6%; color: var(--amber); animation-delay: 1.4s; }
.s3 { font-size: 70px; bottom: 16%; left: 8%; color: var(--mint); animation-delay: 3.1s; }
.s4 { font-size: 84px; bottom: 10%; right: 9%; color: var(--purple); animation-delay: 2.2s; }
.s5 { font-size: 66px; top: 54%; left: 3%; animation-delay: 4.2s; }
.s6 { font-size: 78px; top: 68%; right: 4%; color: var(--coral); animation-delay: 2.7s; }
.s7 { font-size: 58px; top: 38%; right: 22%; color: var(--mint); animation-delay: 5s; }

@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-18px) rotate(7deg); }
}

/* ---------- header ---------- */
.top-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 22px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 2px solid #e6f0ff;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 900;
  font-size: 20px;
  color: var(--blue-dark);
}

.brand-icon { font-size: 26px; }

.header-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.nav-pill {
  border: 2px solid transparent;
  background: #f1f5fb;
  color: var(--ink-soft);
  padding: 8px 16px;
  border-radius: 999px;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.nav-pill:hover { background: #e6f0ff; color: var(--blue-dark); }
.nav-pill.active {
  background: var(--blue-soft);
  color: var(--blue-dark);
  border-color: #c3ddff;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 14px;
}

.star-pill { background: var(--amber-soft); color: #a16207; }
.streak-pill { background: var(--coral-soft); color: #be123c; }

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--blue-soft);
  border: 2px solid #d6e8ff;
  font: inherit;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
}

.avatar-emoji { font-size: 20px; line-height: 1; }

.icon-btn {
  border: 2px solid var(--line);
  background: #fff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, border-color 0.15s;
}

.icon-btn:hover { border-color: #c3ddff; transform: translateY(-1px); }
.icon-btn.is-off { opacity: 0.5; }

/* ---------- layout ---------- */
.app-container {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 22px 16px 40px;
}

.card {
  background: var(--card);
  border: 2px solid rgba(227, 235, 246, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.section-title {
  margin: 28px 0 12px;
  font-size: 19px;
  font-weight: 900;
  color: #17356b;
}

.section-sub {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--ink-soft);
}

.app-footer {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding: 10px 16px 34px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: #8a97ad;
}

/* ---------- buttons ---------- */
button { font-family: inherit; }

.btn-primary,
.btn-mint,
.btn-amber,
.btn-purple,
.btn-ghost {
  border: none;
  border-radius: 16px;
  padding: 11px 20px;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.15s ease;
}

.btn-primary { background: var(--blue); }
.btn-mint { background: var(--mint); }
.btn-amber { background: var(--amber); color: #7c4a03; }
.btn-purple { background: var(--purple); }
.btn-ghost {
  background: #f4f7fc;
  color: var(--ink);
  border: 2px solid var(--line);
}

.btn-3d.btn-primary { box-shadow: 0 5px 0 var(--blue-dark); }
.btn-3d.btn-mint { box-shadow: 0 5px 0 var(--mint-dark); }
.btn-3d.btn-amber { box-shadow: 0 5px 0 var(--amber-dark); }
.btn-3d.btn-purple { box-shadow: 0 5px 0 var(--purple-dark); }

.btn-3d:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.22) !important;
}

.btn-primary:hover:not(:disabled),
.btn-mint:hover:not(:disabled),
.btn-amber:hover:not(:disabled),
.btn-purple:hover:not(:disabled) { filter: brightness(1.04); }

.btn-primary:disabled,
.btn-mint:disabled,
.btn-amber:disabled,
.btn-purple:disabled {
  opacity: 0.6;
  cursor: progress;
}

.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 12px; }
.btn-lg { padding: 14px 26px; font-size: 17px; border-radius: 18px; }
.btn-xl { padding: 17px 40px; font-size: 20px; border-radius: 22px; }
.full-width { width: 100%; }

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 2px;
}

/* ---------- auth ---------- */
.auth-hero {
  margin: 26px auto 24px;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  margin-bottom: 10px;
  padding: 6px 16px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: #a16207;
  font-size: 14px;
  font-weight: 800;
}

.hero-title {
  margin: 0;
  font-size: clamp(28px, 5vw, 38px);
  font-weight: 900;
  color: #17356b;
  letter-spacing: 0.5px;
}

.hero-title span { color: var(--blue-dark); }

.hero-sub {
  max-width: 540px;
  margin: 10px auto 0;
  color: var(--ink-soft);
  font-weight: 600;
  line-height: 1.6;
}

.auth-card {
  max-width: 500px;
  margin: 0 auto;
}

.auth-footnote {
  max-width: 500px;
  margin: 16px auto 0;
  text-align: center;
  font-size: 12.5px;
  color: #8a97ad;
  line-height: 1.6;
}

.auth-extra {
  margin-top: 16px;
  text-align: center;
}

.tab-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-bottom: 18px;
  padding: 5px;
  border-radius: 16px;
  background: #f2f6fc;
}

.tab-btn {
  border: none;
  background: transparent;
  padding: 10px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink-soft);
  cursor: pointer;
}

.tab-btn.active {
  background: #fff;
  color: var(--blue-dark);
  box-shadow: var(--shadow-sm);
}

.form-group { margin-bottom: 14px; }

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 800;
}

.form-group input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 14px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.form-group input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(79, 156, 249, 0.15);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-error {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--coral-soft);
  color: #b91c1c;
  font-size: 14px;
  font-weight: 800;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.avatar-option {
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 8px 4px;
  background: #f8fafd;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}

.avatar-option .emo { display: block; font-size: 26px; line-height: 1.2; }
.avatar-option .nm { font-size: 11px; font-weight: 800; color: var(--ink-soft); }

.avatar-option:hover { border-color: #c3ddff; }
.avatar-option.selected {
  border-color: var(--blue);
  background: var(--blue-soft);
  transform: scale(1.05);
}

/* ---------- home ---------- */
.welcome-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, #ffffff 0%, #f0f7ff 100%);
}

.welcome-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.big-avatar {
  width: 70px;
  height: 70px;
  border-radius: 22px;
  background: #dcecff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  flex: 0 0 auto;
}

.welcome-left h2 { margin: 0 0 4px; font-size: 22px; }
.welcome-left p { margin: 0; color: var(--ink-soft); font-weight: 700; line-height: 1.5; }

.welcome-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.monster-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--purple-soft);
  color: var(--purple-dark);
  font-weight: 800;
  font-size: 14px;
}

.monster-chip.is-clear { background: var(--mint-soft); color: var(--mint-dark); }

.difficulty-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.diff-card {
  position: relative;
  padding: 20px;
  border: 3px solid var(--line);
  border-radius: 22px;
  background: #fff;
  cursor: pointer;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}

.diff-card.enabled { border-color: var(--mint); background: linear-gradient(180deg, #f3fdf8 0%, #ffffff 62%); box-shadow: 0 12px 26px rgba(52, 211, 153, 0.16); }
.diff-card.enabled:hover { transform: translateY(-2px); }
.diff-card.selected {
  border-color: var(--blue);
  background: linear-gradient(180deg, #f0f7ff 0%, #ffffff 62%);
  box-shadow: 0 14px 30px rgba(79, 156, 249, 0.2);
  transform: translateY(-2px);
}
.diff-card.selected .diff-badge.open { background: var(--blue); color: #fff; }
.diff-card.locked { opacity: 0.7; background: #f8fafc; cursor: not-allowed; }
.diff-card.locked:hover { transform: none; }

.diff-badge {
  display: inline-block;
  margin-bottom: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.diff-badge.open { background: #d9f7e8; color: #0b7a54; }
.diff-badge.soon { background: #e9eef7; color: #55657f; }

.diff-card h4 { margin: 0 0 6px; font-size: 18px; }
.diff-sub { margin-bottom: 6px; font-size: 14px; font-weight: 800; color: var(--blue-dark); }
.diff-desc { margin: 0; font-size: 13px; line-height: 1.55; color: var(--ink-soft); }

.setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.setup-item.full-span {
  grid-column: 1 / -1;
  padding-top: 16px;
  border-top: 2px dashed var(--line);
}

.setup-label { margin-bottom: 6px; font-size: 15px; font-weight: 900; }
.setup-item small { display: block; margin-top: 5px; color: var(--ink-soft); }

.pill-info {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 12px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-weight: 900;
}

.setup-row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.segmented-control {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: #f2f6fc;
}

.seg-btn {
  border: none;
  background: transparent;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink-soft);
  cursor: pointer;
}

.seg-btn.active {
  background: #fff;
  color: var(--blue-dark);
  box-shadow: var(--shadow-sm);
}

.seg-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  text-decoration: line-through;
}

/* switch */
.switch {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 56px;
  height: 32px;
}

.switch input { width: 0; height: 0; opacity: 0; }

.slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #cbd5e1;
  cursor: pointer;
  transition: background 0.25s;
}

.slider::before {
  content: "";
  position: absolute;
  left: 4px;
  bottom: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.25s;
}

.switch input:checked + .slider { background: var(--mint); }
.switch input:checked + .slider::before { transform: translateX(24px); }
.switch input:focus-visible + .slider { outline: 3px solid #93c5fd; outline-offset: 2px; }

.time-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.chip-btn {
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 7px 14px;
  font: inherit;
  font-weight: 800;
  font-size: 14px;
  color: var(--ink-soft);
  cursor: pointer;
}

.chip-btn.active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.start-btn-wrap {
  margin-top: 22px;
  text-align: center;
}

.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.badge-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: #f8fafd;
}

.badge-item.unlocked {
  border-color: #fde68a;
  background: #fffbeb;
}

.badge-item.locked { filter: grayscale(1); opacity: 0.55; }

.badge-ico { font-size: 28px; }
.badge-name { font-size: 14px; font-weight: 900; }
.badge-desc { font-size: 12px; color: var(--ink-soft); line-height: 1.4; }

/* ---------- quiz ---------- */
.quiz-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 20px;
  margin-bottom: 14px;
}

.hud-left,
.hud-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mode-tag {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 900;
}

.diff-tag {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--mint-soft);
  color: var(--mint-dark);
  font-size: 12px;
  font-weight: 900;
}

.selected-difficulty {
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
}

.selected-difficulty strong { color: var(--blue-dark); }

.hud-center {
  flex: 1 1 180px;
  min-width: 170px;
  max-width: 380px;
}

.timer-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 5px;
  font-size: 22px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.timer-display.warn { color: var(--amber-dark); }
.timer-display.danger { color: var(--coral-dark); animation: pulse 0.85s infinite; }
.timer-display.paused { color: var(--amber-dark); animation: none; }

.clock-state {
  margin-left: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: #a16207;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.07); }
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: #e6edf8;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--mint), var(--blue));
  transition: width 0.2s linear;
}

.score-live { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }

.streak-live {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: #a16207;
  font-size: 13px;
  font-weight: 900;
}

.per-q-timer-wrap {
  margin-bottom: 14px;
  padding: 10px 18px;
  background: #fffdf3;
  border-color: #fde68a;
}

.per-q-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 900;
  color: #92400e;
  font-variant-numeric: tabular-nums;
}

.per-q-track {
  height: 10px;
  border-radius: 999px;
  background: #fdf0c9;
  overflow: hidden;
}

.per-q-fill {
  height: 100%;
  width: 100%;
  background: var(--amber);
  transition: width 0.08s linear;
}

.per-q-fill.danger { background: var(--coral); }

/* Frozen while the child reads the explanation for a wrong answer. */
.per-q-timer-wrap.is-frozen { opacity: 0.6; }
.per-q-timer-wrap.is-frozen .per-q-fill { transition: none; }

.question-stage {
  position: relative;
  padding: 26px 22px 32px;
  text-align: center;
}

.q-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.q-pill,
.q-subtype-pill {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
}

.q-pill { background: #f2f6fc; color: var(--ink-soft); }
.q-subtype-pill { background: var(--purple-soft); color: var(--purple-dark); }

.equation-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 16px 0 26px;
  font-size: clamp(42px, 8.5vw, 68px);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #10203c;
}

.equation-text { letter-spacing: 2px; }
.equation-eq { color: #94a3b8; }

.equation-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 86px;
  height: 76px;
  padding: 0 14px;
  border: 3px dashed var(--blue);
  border-radius: 20px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.equation-slot.correct {
  border: 3px solid var(--mint);
  background: #dcfce7;
  color: var(--mint-dark);
}

.equation-slot.wrong {
  border: 3px solid var(--coral);
  background: var(--coral-soft);
  color: var(--coral-dark);
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  max-width: 820px;
  margin: 0 auto;
}

.option-btn {
  position: relative;
  padding: 20px 8px;
  border: 3px solid #cbd5e1;
  border-radius: 20px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 32px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  box-shadow: 0 6px 0 #cbd5e1;
  transition: transform 0.1s, border-color 0.15s, background 0.15s, box-shadow 0.1s;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--blue);
  background: var(--blue-soft);
  transform: translateY(-2px);
}

.option-btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #cbd5e1;
}

.option-btn .key-hint {
  position: absolute;
  top: 6px;
  left: 10px;
  font-size: 11px;
  font-weight: 900;
  color: #a8b4c7;
}

.option-btn:disabled { cursor: default; opacity: 1; }

.option-btn.is-pending {
  border-color: var(--blue);
  background: var(--blue-soft);
  transform: scale(0.97);
  animation: breathe 0.9s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}

.option-btn.is-correct {
  border-color: var(--mint) !important;
  background: #dcfce7 !important;
  color: #15803d !important;
  box-shadow: 0 6px 0 var(--mint-dark) !important;
  transform: scale(1.04);
}

.option-btn.is-wrong {
  border-color: var(--coral) !important;
  background: var(--coral-soft) !important;
  color: #b91c1c !important;
  box-shadow: 0 6px 0 var(--coral-dark) !important;
}

.correct-toast {
  display: inline-block;
  margin-top: 18px;
  padding: 8px 20px;
  border-radius: 999px;
  background: #dcfce7;
  color: #15803d;
  font-size: 17px;
  font-weight: 900;
  animation: pop 0.25s ease-out;
}

@keyframes pop {
  from { transform: scale(0.82); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.wrong-feedback-panel {
  max-width: 660px;
  margin: 22px auto 0;
  padding: 18px 20px;
  border: 3px solid #fca5a5;
  border-radius: 22px;
  background: #fff6f7;
  text-align: left;
  animation: pop 0.22s ease-out;
}

.wrong-banner-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wrong-icon { font-size: 34px; }
.wrong-banner-head h3 { margin: 0; font-size: 20px; color: #b91c1c; }
.wrong-banner-head p { margin: 2px 0 0; font-size: 14px; font-weight: 700; color: #7f1d1d; }

.wrong-equation-highlight {
  margin: 12px 0;
  padding: 10px;
  border: 2px solid #86efac;
  border-radius: 14px;
  background: #dcfce7;
  color: #14532d;
  font-size: 26px;
  font-weight: 900;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.tenframe-box { margin-bottom: 12px; }

.tf-wrap {
  padding: 10px;
  border: 2px dashed #cbd5e1;
  border-radius: 14px;
  background: #fff;
  text-align: center;
}

.tf-frames {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 6px;
}

.tf-frame {
  background: #f8fafc;
  border-radius: 10px;
}

.tf-legend { font-size: 13px; font-weight: 800; color: #475569; }
.tf-legend .dot-blue { color: #2563eb; }
.tf-legend .dot-green { color: #16a34a; }
.tf-legend .dot-cut { color: #dc2626; }

.wrong-tip-box {
  margin-bottom: 14px;
  padding: 10px 14px;
  border: 2px solid #fde68a;
  border-radius: 14px;
  background: #fffbeb;
  color: #92400e;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.6;
}

.wrong-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.auto-next-hint {
  font-size: 13px;
  font-weight: 800;
  color: #9f1239;
  font-variant-numeric: tabular-nums;
}

.net-error {
  max-width: 620px;
  margin: 18px auto 0;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 2px solid #fcd34d;
  border-radius: 16px;
  background: #fffbeb;
}

.net-error-text { font-size: 14px; font-weight: 800; color: #92400e; }

/* ---------- summary ---------- */
.summary-hero {
  margin-bottom: 16px;
  text-align: center;
}

.summary-emoji { font-size: 56px; line-height: 1.2; }
.summary-hero h2 { margin: 6px 0 4px; font-size: clamp(22px, 4vw, 28px); }
.summary-hero p { margin: 0 0 18px; color: var(--ink-soft); font-weight: 700; }

.summary-kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.kpi-box { padding: 14px 10px; border-radius: 18px; }
.kpi-blue { background: var(--blue-soft); }
.kpi-mint { background: var(--mint-soft); }
.kpi-amber { background: var(--amber-soft); }
.kpi-purple { background: var(--purple-soft); }
.kpi-gold { background: #fef3c7; }

.kpi-num { font-size: 23px; font-weight: 900; font-variant-numeric: tabular-nums; }
.kpi-label { margin-top: 2px; font-size: 12px; font-weight: 800; color: var(--ink-soft); }

.new-badges-banner {
  margin-bottom: 16px;
  padding: 12px;
  border: 2px solid #fcd34d;
  border-radius: 16px;
  background: #fffbeb;
  color: #92400e;
  font-weight: 900;
}

.summary-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.summary-details-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 16px;
}

.review-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
}

.review-item {
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: #f8fafd;
}

.review-item.is-wrong { border-color: #fecaca; background: #fff6f7; }

.review-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 16px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.review-meta { font-size: 13px; color: var(--ink-soft); }
.review-tip { margin-top: 4px; font-size: 13px; font-weight: 800; color: #92400e; }

/* ---------- report ---------- */
.report-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 18px;
}

.filter-tabs { display: flex; flex-wrap: wrap; gap: 6px; }

.filter-btn {
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 7px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-soft);
  cursor: pointer;
}

.filter-btn.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.picker-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
}

.picker-group input {
  padding: 6px 10px;
  border: 2px solid var(--line);
  border-radius: 10px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

.empty-state { padding: 46px 20px; text-align: center; }
.empty-emoji { font-size: 54px; }
.empty-state p { color: var(--ink-soft); }

.report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.mini-kpi { padding: 14px; text-align: center; }
.mini-kpi-label { font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.mini-kpi-val { margin-top: 4px; font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; }

.text-coral { color: var(--coral-dark); }
.text-amber { color: var(--amber-dark); }
.text-blue { color: var(--blue-dark); }
.text-mint { color: var(--mint-dark); }

.report-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 16px 0;
}

.card-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.card-head-row h3,
.card > h3 { margin: 0 0 8px; font-size: 17px; }
.card-head-row h3 { margin: 0; }

.chart-legend { font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.svg-chart-box { width: 100%; min-height: 225px; }

.table-scroll { overflow-x: auto; }
.max-h-320 { max-height: 320px; overflow-y: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.data-table th {
  background: #f7fafd;
  color: var(--ink-soft);
  font-weight: 900;
}

.data-table.compact th,
.data-table.compact td { padding: 8px 6px; font-size: 13px; }

.cell-note {
  min-width: 170px;
  margin-top: 3px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  color: #64748b;
  white-space: normal;
}

.status-tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.tag-mastered { background: #d9f7e8; color: #0b7a54; }
.tag-good { background: #dbeafe; color: #1d4ed8; }
.tag-needs_accuracy { background: var(--coral-soft); color: #b91c1c; }
.tag-needs_speed { background: var(--amber-soft); color: #a16207; }
.tag-untested { background: #f1f5f9; color: #64748b; }

.pattern-list { display: flex; flex-direction: column; gap: 12px; }
.pattern-row { display: flex; flex-direction: column; gap: 4px; }
.pattern-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 800; }

.pattern-bar-bg {
  height: 10px;
  border-radius: 999px;
  background: #f2f6fc;
  overflow: hidden;
}

.pattern-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #fda4af, var(--coral-dark));
}

.subtabs { display: flex; gap: 8px; margin-bottom: 10px; }

.subtab-btn {
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 5px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-soft);
  cursor: pointer;
}

.subtab-btn.active { border-color: var(--blue); background: var(--blue-soft); color: var(--blue-dark); }

.problem-rank-list,
.session-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.rank-item,
.session-row-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafd;
  font-size: 14px;
}

.session-row-btn {
  width: 100%;
  font-family: inherit;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.session-row-btn:hover { border-color: #c3ddff; background: var(--blue-soft); }

.ai-export-card {
  background: linear-gradient(135deg, #f8fbff 0%, #eef6ff 100%);
  border: 2px solid #bfdbfe;
}

.ai-export-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.ai-export-head h3 { margin: 0 0 4px; }
.ai-export-head p { max-width: 620px; margin: 0; font-size: 13px; line-height: 1.6; color: var(--ink-soft); }

.ai-export-btns { display: flex; flex-wrap: wrap; gap: 8px; }

.ai-preview-box {
  max-height: 300px;
  margin: 0;
  padding: 14px;
  border-radius: 14px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
}

/* ---------- leaderboard ---------- */
.lb-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: linear-gradient(135deg, #fff8e1 0%, #f2f8ff 60%, #f7f1ff 100%);
  border: 2px solid #ffe0a3;
}

.lb-hero-left { display: flex; align-items: center; gap: 14px; }

.lb-hero-emoji {
  font-size: 46px;
  line-height: 1;
  filter: drop-shadow(0 6px 10px rgba(217, 119, 6, 0.25));
  animation: lbTrophy 3.2s ease-in-out infinite;
}

@keyframes lbTrophy {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-6px) rotate(3deg); }
}

.lb-hero-title { margin: 0 0 4px; font-size: 26px; font-weight: 900; color: #12406f; }
.lb-hero-sub { margin: 0; font-size: 14px; font-weight: 700; color: var(--ink-soft); }

.lb-period-tabs { flex-shrink: 0; }

/* my rank banner */
.lb-my-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  border: 2px solid #cfe3ff;
  background: linear-gradient(120deg, #f3f9ff 0%, #ffffff 55%, #f6f1ff 100%);
}

.lb-my-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 10px 12px;
  border-radius: 18px;
  background: #fff;
  border: 2px dashed #bcd8fb;
  line-height: 1.1;
}

.lb-my-badge strong { font-size: 30px; font-weight: 900; color: var(--blue-dark); font-variant-numeric: tabular-nums; }
.lb-my-badge small { margin-top: 4px; font-size: 12px; font-weight: 800; color: var(--ink-soft); }

.lb-my-text { flex: 1 1 220px; min-width: 0; }
.lb-my-text h4 { margin: 0 0 4px; font-size: 17px; font-weight: 900; color: #17356b; }
.lb-my-text p { margin: 0; font-size: 13.5px; font-weight: 700; line-height: 1.6; color: var(--ink-soft); }
.lb-my-text .lb-nudge { color: #b45309; }

.lb-my-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* board selector */
.lb-board-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 2px 2px;
}

/* difficulty scope selector */
.lb-scope-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 18px;
  border: 2px dashed #dbe4f2;
  background: #fbfdff;
}

.lb-scope-label { font-size: 13px; font-weight: 900; color: var(--ink-soft); }

.lb-scope-chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: #fff;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 900;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
}

.lb-scope-chip:hover { border-color: #bcd8fb; background: var(--blue-soft); }

.lb-scope-chip.active {
  border-color: var(--purple);
  background: var(--purple);
  color: #fff;
  box-shadow: 0 5px 12px rgba(167, 139, 250, 0.32);
}

.lb-head-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.lb-scope-tag {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--purple-soft);
  color: var(--purple-dark);
  font-size: 11.5px;
  font-weight: 900;
}

.lb-board-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 10px 16px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: #fff;
  font-size: 14.5px;
  font-weight: 900;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
}

.lb-board-tab:hover { border-color: #bcd8fb; background: var(--blue-soft); }

.lb-board-tab.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(79, 156, 249, 0.3);
}

.lb-board-tab .lb-tab-ico { font-size: 17px; }
.lb-board-tab .lb-tab-me {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: #a16207;
  font-size: 11px;
  font-weight: 900;
}

.lb-board-tab.active .lb-tab-me { background: #fff5d6; color: #a16207; }

/* header of the selected board */
.lb-board-meta { font-size: 12.5px; font-weight: 800; color: var(--ink-soft); }

/* podium */
.lb-podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
  padding: 10px 4px 4px;
}

.lb-podium-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 0;
  max-width: 190px;
  padding: 14px 10px 12px;
  border-radius: 20px;
  border: 2px solid var(--line);
  background: #fff;
  text-align: center;
  transition: transform 0.15s ease;
}

.lb-podium-item.place-1 {
  order: 2;
  border-color: #fcd34d;
  background: linear-gradient(180deg, #fffbeb 0%, #fff 55%);
  box-shadow: 0 14px 28px rgba(217, 119, 6, 0.16);
  transform: translateY(-14px);
}

.lb-podium-item.place-2 { order: 1; border-color: #cbd5e1; background: linear-gradient(180deg, #f8fafc 0%, #fff 60%); }
.lb-podium-item.place-3 { order: 3; border-color: #f0c9a8; background: linear-gradient(180deg, #fff7f0 0%, #fff 60%); }

.lb-podium-item.is-me { box-shadow: 0 0 0 3px #bfdbfe, 0 12px 24px rgba(37, 99, 235, 0.18); }

.lb-podium-medal { font-size: 30px; line-height: 1; }

.lb-podium-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  margin: 6px 0 8px;
  border-radius: 50%;
  font-size: 32px;
  background: var(--blue-soft);
  border: 3px solid #fff;
  box-shadow: var(--shadow-sm);
}

.lb-podium-item.place-1 .lb-podium-avatar {
  width: 74px;
  height: 74px;
  font-size: 38px;
  background: #fff3cf;
}

.lb-podium-name {
  max-width: 100%;
  font-size: 15px;
  font-weight: 900;
  color: #17356b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-podium-value {
  margin-top: 4px;
  font-size: 19px;
  font-weight: 900;
  color: var(--blue-dark);
  font-variant-numeric: tabular-nums;
}

.lb-podium-item.place-1 .lb-podium-value { font-size: 23px; color: #b45309; }
.lb-podium-detail { margin-top: 3px; font-size: 11.5px; font-weight: 700; color: var(--ink-soft); }

.lb-podium-me-tag {
  position: absolute;
  top: -10px;
  right: -6px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--blue-dark);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

/* rank list (rows 4+) */
.lb-rank-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }

.lb-rank-row {
  display: grid;
  grid-template-columns: 42px 34px minmax(0, 1fr) 118px;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 16px;
  background: #f8fafd;
  border: 1px solid var(--line);
}

.lb-rank-row.is-me {
  background: linear-gradient(90deg, #eaf4ff 0%, #f7fbff 100%);
  border-color: #93c5fd;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.12);
}

.lb-rank-no {
  font-size: 16px;
  font-weight: 900;
  color: var(--ink-soft);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.lb-rank-avatar { font-size: 22px; line-height: 1; text-align: center; }

.lb-rank-body { min-width: 0; }

.lb-rank-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14.5px;
  font-weight: 900;
  color: var(--ink);
  overflow: hidden;
}

.lb-rank-name-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lb-rank-detail { margin-top: 2px; font-size: 11.5px; font-weight: 700; color: var(--ink-soft); }

.lb-rank-bar-track {
  margin-top: 5px;
  height: 9px;
  border-radius: 999px;
  background: #e8eef8;
  overflow: hidden;
}

.lb-rank-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #93c5fd, #4f9cf9);
  transition: width 0.5s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.lb-rank-row.is-me .lb-rank-bar { background: linear-gradient(90deg, #fbbf24, #f59e0b); }

.lb-rank-value {
  font-size: 15px;
  font-weight: 900;
  color: var(--blue-dark);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.lb-rank-value small { display: block; font-size: 10.5px; font-weight: 800; color: var(--ink-soft); }

.lb-me-tag {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--blue-dark);
  color: #fff;
  font-size: 10.5px;
  font-weight: 900;
}

.lb-badge-chip {
  flex: 0 0 auto;
  padding: 1px 7px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 10.5px;
  font-weight: 900;
}

.lb-me-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 18px;
  background: linear-gradient(120deg, #eef6ff 0%, #f9fcff 100%);
  border: 2px dashed #93c5fd;
  font-size: 14px;
  font-weight: 800;
  color: #17356b;
}

.lb-me-row .lb-me-rank { font-size: 20px; font-weight: 900; color: var(--blue-dark); }
.lb-me-row p { margin: 0; font-size: 13px; font-weight: 700; color: var(--ink-soft); }

.lb-empty-hint { padding: 26px 8px; text-align: center; font-size: 14px; font-weight: 800; color: var(--ink-soft); }

/* compare chart tips */
.lb-compare-tips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.lb-tip {
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--blue-soft);
  color: #1e40af;
  font-size: 13px;
  font-weight: 800;
}

.lb-tip.is-win { background: var(--mint-soft); color: var(--mint-dark); }
.lb-tip.is-gap { background: var(--amber-soft); color: #a16207; }

/* five boards overview */
.lb-all-boards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.lb-board-card {
  padding: 14px;
  border-radius: 18px;
  border: 2px solid var(--line);
  background: #fbfdff;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.lb-board-card:hover { transform: translateY(-2px); border-color: #bcd8fb; box-shadow: var(--shadow-sm); }

.lb-board-card.is-active { border-color: var(--blue); background: #f2f8ff; }

.lb-board-card-head { display: flex; align-items: center; gap: 7px; font-size: 14.5px; font-weight: 900; color: var(--ink); }
.lb-board-card-head .ico { font-size: 18px; }

.lb-board-card-leader {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-board-card-leader strong { color: var(--blue-dark); }

.lb-board-card-me {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: #a16207;
  font-size: 11.5px;
  font-weight: 900;
}

.lb-board-card-me.is-champion { background: var(--mint-soft); color: var(--mint-dark); }
.lb-board-card-me.is-none { background: #f1f5f9; color: #64748b; }

/* ---------- admin console ---------- */
.admin-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 55%, #fff7ed 100%);
  border: 2px solid #c7d2fe;
}

.admin-hero-left { display: flex; align-items: center; gap: 14px; }
.admin-hero-emoji { font-size: 42px; line-height: 1; }
.admin-hero-title { margin: 0 0 4px; font-size: 24px; font-weight: 900; color: #1e293b; }
.admin-hero-sub { margin: 0; font-size: 13.5px; font-weight: 700; color: var(--ink-soft); line-height: 1.55; }
.admin-hero-sub b { color: #b91c1c; }

.admin-pill { background: #eef2ff; color: #4338ca; }

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.admin-stat {
  padding: 14px 16px;
  border-radius: 18px;
  border: 2px solid var(--line);
  background: #fff;
  text-align: center;
}

.admin-stat-val { font-size: 24px; font-weight: 900; color: var(--blue-dark); font-variant-numeric: tabular-nums; }
.admin-stat-label { margin-top: 2px; font-size: 12.5px; font-weight: 800; color: var(--ink-soft); }

.admin-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.admin-toolbar input[type="search"] {
  width: 200px;
  padding: 8px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  font-family: inherit;
  font-size: 13.5px;
  background: #f8fafd;
}

.admin-table td { font-size: 13px; white-space: nowrap; }
.admin-table .admin-user { display: flex; align-items: center; gap: 6px; }
.admin-table .admin-user small { color: var(--ink-soft); font-weight: 700; }

.admin-actions { display: flex; gap: 6px; }

.admin-hint { margin: 10px 0 0; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }

.admin-code {
  padding: 1px 6px;
  border-radius: 6px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12.5px;
}

.btn-ghost-danger { color: #b91c1c; border-color: #fecaca; background: #fff5f5; }
.btn-ghost-danger:hover { background: #fee2e2; border-color: #fca5a5; }

.btn-danger { background: #ef4444; }
.btn-3d.btn-danger { box-shadow: 0 5px 0 #b91c1c; }
.btn-danger:disabled { background: #fca5a5; box-shadow: none; cursor: not-allowed; }

.modal-note { margin: 0 0 12px; font-size: 14px; font-weight: 800; color: #17356b; }
.modal-hint { margin: 6px 0 12px; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); line-height: 1.55; }
.modal-danger-text { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: #fef2f2; color: #991b1b; font-size: 13px; font-weight: 700; line-height: 1.6; }
.modal-danger code { padding: 1px 6px; border-radius: 6px; background: #eef2ff; color: #3730a3; font-size: 13px; }

/* ---------- modal / toast ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.45);
}

.modal-card {
  width: 100%;
  max-width: 480px;
  max-height: 86vh;
  overflow-y: auto;
}

.modal-card.modal-lg { max-width: 700px; }

.modal-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.modal-head-row h3 { margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

.modal-divider {
  margin: 18px 0 14px;
  border: none;
  border-top: 2px dashed var(--line);
}

.modal-subtitle {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 900;
  color: #17356b;
}

.global-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 200;
  max-width: calc(100vw - 32px);
  padding: 11px 22px;
  border-radius: 999px;
  background: #1e293b;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  transform: translateX(-50%);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.global-toast.is-error { background: #b91c1c; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .difficulty-grid { grid-template-columns: 1fr; }
  .setup-grid { grid-template-columns: 1fr; }
  .summary-kpis { grid-template-columns: repeat(2, 1fr); }
  .summary-details-grid { grid-template-columns: 1fr; }
  .report-kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .report-two-col { grid-template-columns: 1fr; }
  .options-grid { grid-template-columns: repeat(3, 1fr); }
  .welcome-actions { width: 100%; }
  .lb-rank-row { grid-template-columns: 36px 30px minmax(0, 1fr) 100px; }
}

@media (max-width: 620px) {
  .top-header { padding: 8px 10px; gap: 6px; }
  .brand-text { display: none; }
  .header-nav { order: 3; width: 100%; justify-content: center; gap: 5px; }
  .nav-pill { padding: 7px 10px; font-size: 13px; }
  .header-right { order: 2; margin-left: auto; gap: 6px; }
  .stat-pill { padding: 4px 9px; font-size: 13px; }
  .user-chip { padding: 4px 9px; font-size: 13px; }
  .icon-btn { width: 34px; height: 34px; font-size: 16px; }
  .header-right .btn-sm { padding: 4px 9px; font-size: 12px; }
  .app-container { padding: 14px 10px 32px; }
  .card { padding: 16px; border-radius: 20px; }
  .form-row { grid-template-columns: 1fr; }
  .avatar-grid { grid-template-columns: repeat(3, 1fr); }
  .report-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .options-grid { grid-template-columns: repeat(2, 1fr); }
  .option-btn:last-child { grid-column: span 2; }
  .option-btn { font-size: 28px; padding: 16px 6px; }
  .equation-box { gap: 8px; }
  .equation-slot { min-width: 66px; height: 62px; }
  .question-stage { padding: 18px 12px 24px; }
  .quiz-hud { padding: 10px 12px; }
  .hud-center { order: 3; flex-basis: 100%; max-width: none; }
  .timer-display { font-size: 20px; }
  .wrong-feedback-panel { padding: 14px; }
  .wrong-equation-highlight { font-size: 22px; }
  .summary-kpis { grid-template-columns: repeat(2, 1fr); }
  .app-footer { padding-bottom: 26px; }
  .lb-hero { flex-direction: column; align-items: flex-start; }
  .lb-hero-emoji { font-size: 34px; }
  .lb-hero-title { font-size: 21px; }
  .lb-podium { gap: 6px; }
  .lb-podium-item { padding: 10px 6px 9px; border-radius: 16px; }
  .lb-podium-avatar { width: 46px; height: 46px; margin: 4px 0 6px; font-size: 23px; }
  .lb-podium-item.place-1 .lb-podium-avatar { width: 56px; height: 56px; font-size: 28px; }
  .lb-podium-medal { font-size: 22px; }
  .lb-podium-name { font-size: 12.5px; }
  .lb-podium-value { font-size: 15px; }
  .lb-podium-item.place-1 .lb-podium-value { font-size: 18px; }
  .lb-podium-detail { display: none; }
  .lb-rank-row { grid-template-columns: 28px 24px minmax(0, 1fr) 82px; gap: 7px; padding: 8px 9px; }
  .lb-rank-value { font-size: 13.5px; }
  .lb-rank-row .lb-rank-detail { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
