:root {
  --bg: #e2e6f0;
  --card: #eef1f8;
  --text: #0f172a;
  --muted: #5b6b7c;
  --border: #b8c0d4;
  --accent: #4f46e5;
  --accent-soft: #e0e7ff;
  --ok: #15803d;
  --bad: #b91c1c;
  --thai: #be123c;
  --shadow: 0 10px 32px rgba(15, 23, 42, 0.12);
  --font-display: 'Outfit', 'Segoe UI', sans-serif;
  --font-thai: 'Sarabun', 'Segoe UI', sans-serif;
}
html.dark body, body.dark {
  --bg: #0b1220;
  --card: #111827;
  --text: #e5eef7;
  --muted: #94a3b8;
  --border: #1e293b;
  --accent: #818cf8;
  --accent-soft: #312e81;
  --ok: #4ade80;
  --bad: #fb7185;
  --thai: #fb7185;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  font-family: var(--font-display);
  margin: 0;
  padding: 16px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  background:
    radial-gradient(1000px 420px at 0% 0%, rgba(99, 102, 241, 0.28), transparent 55%),
    radial-gradient(800px 360px at 100% 0%, rgba(244, 63, 94, 0.14), transparent 50%),
    linear-gradient(180deg, #cfd5e8 0%, var(--bg) 45%, #d8dceb 100%);
  color: var(--text);
}
body.mode-addsub {
  background:
    radial-gradient(1000px 420px at 0% 0%, rgba(34, 197, 94, 0.22), transparent 55%),
    radial-gradient(800px 360px at 100% 0%, rgba(59, 130, 246, 0.16), transparent 50%),
    linear-gradient(180deg, #d1fae5 0%, var(--bg) 45%, #dbeafe 100%);
}
body.mode-muldiv {
  background:
    radial-gradient(1000px 420px at 0% 0%, rgba(249, 115, 22, 0.22), transparent 55%),
    radial-gradient(800px 360px at 100% 0%, rgba(168, 85, 247, 0.16), transparent 50%),
    linear-gradient(180deg, #ffedd5 0%, var(--bg) 45%, #f3e8ff 100%);
}
body.mode-p14 {
  background:
    radial-gradient(1000px 420px at 0% 0%, rgba(14, 165, 233, 0.22), transparent 55%),
    radial-gradient(800px 360px at 100% 0%, rgba(234, 179, 8, 0.16), transparent 50%),
    linear-gradient(180deg, #e0f2fe 0%, var(--bg) 45%, #fef9c3 100%);
}
.wrap { max-width: 920px; margin: 0 auto; }
.tm-hero-math-add {
  background:
    radial-gradient(900px 380px at 8% -20%, rgba(74, 222, 128, 0.35), transparent 55%),
    linear-gradient(145deg, #052e16 0%, #166534 50%, #1d4ed8 100%) !important;
}
.tm-hero-math-mul {
  background:
    radial-gradient(900px 380px at 8% -20%, rgba(251, 146, 60, 0.4), transparent 55%),
    linear-gradient(145deg, #7c2d12 0%, #c2410c 45%, #7e22ce 100%) !important;
}
.tm-hero-math-p14 {
  background:
    radial-gradient(900px 380px at 8% -20%, rgba(56, 189, 248, 0.4), transparent 55%),
    linear-gradient(145deg, #0c4a6e 0%, #0369a1 45%, #a16207 100%) !important;
}
.tm-hero h1 .th {
  display: block;
  font-family: var(--font-thai);
  font-size: 0.72em;
  font-weight: 700;
  opacity: 0.92;
  margin-top: 4px;
}
.tm-lead .th {
  display: block;
  font-family: var(--font-thai);
  margin-top: 4px;
  opacity: 0.9;
}

.math-panel {
  margin-top: 14px;
  padding: 14px 12px 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(160deg, #eef2ff 0%, #fff 55%, #fdf2f8 100%);
  box-shadow: var(--shadow);
}
html.dark .math-panel, body.dark .math-panel {
  background: linear-gradient(160deg, #312e81 0%, #0f172a 55%, #4c0519 100%);
  border-color: #334155;
}
.math-panel h2 {
  margin: 0 0 4px;
  font-size: 1.1rem;
  font-weight: 800;
}
.math-sub { margin: 0 0 12px; color: var(--muted); font-size: 0.85rem; font-weight: 600; }

.math-digits, .math-vocab {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
}
.math-vocab { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.math-digit, .math-vocab-card {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 14px;
  padding: 10px 8px;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: transform 0.12s, border-color 0.15s;
}
.math-digit:hover, .math-vocab-card:hover { transform: translateY(-2px); border-color: var(--accent); }
html.dark .math-digit, body.dark .math-digit,
html.dark .math-vocab-card, body.dark .math-vocab-card { background: #1e293b; }
.math-digit .n { font-size: 1.4rem; font-weight: 800; }
.math-digit .en, .math-vocab-card strong { font-size: 0.72rem; font-weight: 700; }
.math-digit .th, .math-vocab-card .th {
  font-family: var(--font-thai);
  font-weight: 700;
  color: var(--thai);
  font-size: 0.85rem;
}
.math-vocab-card em {
  font-style: normal;
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 600;
}

.math-practice-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.math-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.math-controls select, .math-tool {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  font-weight: 700;
  font-size: 0.8rem;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
}
html.dark .math-controls select, body.dark .math-controls select,
html.dark .math-tool, body.dark .math-tool { background: #1e293b; color: #e2e8f0; }
.math-score { font-weight: 800; font-size: 0.85rem; color: var(--muted); }

.math-ex-types {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}
.math-ex {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 700;
  font-size: 0.72rem;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
}
.math-ex.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
html.dark .math-ex, body.dark .math-ex { background: #1e293b; color: #e2e8f0; }
html.dark .math-ex.active, body.dark .math-ex.active {
  background: var(--accent);
  color: #fff;
}

.math-dir-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin: 0 0 12px;
}
.math-dir {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
  padding: 8px 6px;
  cursor: pointer;
  font: inherit;
  text-align: center;
  color: var(--text);
}
.math-dir.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
html.dark .math-dir, body.dark .math-dir { background: #1e293b; color: #e2e8f0; }
.math-dir strong { display: block; font-size: 0.85rem; }
.math-dir em {
  display: block;
  font-style: normal;
  font-size: 0.72rem;
  color: var(--muted);
  font-family: var(--font-thai);
  margin-top: 2px;
}

.math-prompt-primary {
  font-weight: 800;
  font-size: 1.05rem;
  margin: 8px 0 0;
  line-height: 1.35;
}
.math-prompt-primary.is-th { font-family: var(--font-thai); color: var(--thai); font-size: 1.15rem; }
.math-prompt-secondary {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--muted);
  margin: 4px 0 0;
  line-height: 1.35;
}
.math-prompt-secondary.is-th { font-family: var(--font-thai); }
body.dir-en-th .math-prompt-secondary { opacity: 0.85; }
body.dir-th-en .math-prompt-secondary { opacity: 0.85; }
body.dir-en-th #mathPlayTarget { border-color: var(--thai); }
body.dir-th-en #mathPlayTarget { border-color: var(--accent); }

.math-eq-box {
  text-align: center;
  padding: 18px 12px;
  border-radius: 16px;
  background: rgba(79, 70, 229, 0.08);
  border: 1px dashed var(--accent);
  margin-bottom: 12px;
}
.math-eq {
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  margin: 0;
}
.math-eq-th {
  font-family: var(--font-thai);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--thai);
  margin: 6px 0 0;
}
.math-eq-en {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  margin: 4px 0 0;
}

.math-answer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 10px;
}
.math-answer-row input {
  width: min(160px, 40vw);
  font-size: 1.4rem;
  font-weight: 800;
  text-align: center;
  padding: 10px;
  border-radius: 12px;
  border: 2px solid var(--accent);
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
html.dark .math-answer-row input, body.dark .math-answer-row input {
  background: #0f172a;
  color: #e2e8f0;
}
.math-answer-row button {
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
}

.math-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-width: 420px;
  margin: 0 auto 10px;
}
.math-choice {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 14px;
  padding: 12px;
  font-size: 1.25rem;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.math-choice .th {
  font-family: var(--font-thai);
  font-size: 0.8rem;
  color: var(--thai);
  font-weight: 700;
}
html.dark .math-choice, body.dark .math-choice { background: #1e293b; }
.math-choice:hover { border-color: var(--accent); }

.math-feedback {
  text-align: center;
  min-height: 1.4em;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--muted);
  margin: 8px 0;
}
.math-feedback.ok { color: var(--ok); }
.math-feedback.bad { color: var(--bad); }

.math-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.math-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 18px;
  padding: 12px 4px 8px;
  font-size: 0.85rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}
.math-footer a { color: var(--accent); font-weight: 700; text-decoration: none; }

.mobile-dock {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 9998;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, #0b1220 92%, transparent);
  backdrop-filter: blur(14px);
  border-top: 2px solid color-mix(in srgb, #818cf8 55%, transparent);
}
.mobile-dock button, .mobile-dock a.dock-link {
  min-height: 56px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.08);
  color: #e2e8f0;
  border-radius: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  font-size: 0.62rem;
  line-height: 1.1;
  padding: 4px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  text-decoration: none;
}
.mobile-dock a.dock-link.primary {
  background: color-mix(in srgb, #4f46e5 70%, transparent);
  border-color: #818cf8;
}
.dock-ico { font-size: 1.1rem; }
.dock-th { font-family: var(--font-thai); font-size: 0.68rem; }

.math-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 23, 42, 0.55);
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
}
.math-menu-overlay.open { display: flex; }
.math-menu-sheet {
  width: min(480px, 100%);
  background: #fff;
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
}
html.dark .math-menu-sheet, body.dark .math-menu-sheet { background: #0f172a; color: #e2e8f0; }
.math-menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.math-menu-grid a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  font-weight: 700;
}
.math-menu-grid a .th { font-family: var(--font-thai); }
.math-menu-grid a .en { font-size: 0.75rem; color: var(--muted); }
.math-menu-close {
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--accent-soft);
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
}

@media (max-width: 900px) {
  .mobile-dock { display: grid; }
  body { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 640px) {
  body { padding: 10px; padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
  .math-dir-row { grid-template-columns: 1fr; }
}
@media (min-width: 901px) {
  .mobile-dock { display: none !important; }
}

/* —— Glass Blue Number Lab —— */
body.math-lab {
  --lab-night: #020617;
  --lab-glass: rgba(37, 99, 235, 0.22);
  --lab-stroke: rgba(147, 197, 253, 0.38);
  --lab-indigo: #818cf8;
  --lab-blue: #60a5fa;
  --lab-ice: #e0f2fe;
  color: var(--lab-ice);
  background: var(--lab-night);
  position: relative;
  overflow-x: hidden;
}
.math-ambient {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(900px 520px at 10% -8%, rgba(96, 165, 250, 0.28), transparent 58%),
    radial-gradient(760px 480px at 95% 10%, rgba(129, 140, 248, 0.22), transparent 55%),
    radial-gradient(600px 400px at 50% 100%, rgba(59, 130, 246, 0.12), transparent 60%),
    linear-gradient(180deg, #020617 0%, #0f172a 42%, #020617 100%);
}
body.math-lab .wrap { position: relative; z-index: 1; }
.math-glass-card {
  background: linear-gradient(155deg, rgba(255,255,255,0.09), rgba(255,255,255,0.02) 40%, var(--lab-glass));
  border: 1px solid var(--lab-stroke);
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  box-shadow: 0 18px 50px rgba(2,6,23,0.5), inset 0 1px 0 rgba(255,255,255,0.14);
  border-radius: 22px;
}
.tm-hero-math-lab {
  margin: 0 0 14px; padding: 16px;
  background: linear-gradient(155deg, rgba(59, 130, 246, 0.28), transparent 42%, rgba(99, 102, 241, 0.16)) !important;
}
.tm-hero-math-lab .tm-kicker {
  color: var(--lab-blue); font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; font-size: 0.68rem; margin: 0 0 6px;
}
.tm-hero-math-lab h1 { margin: 0 0 8px; font-size: clamp(1.55rem, 4.2vw, 2.1rem); font-weight: 800; color: #fff; }
.tm-hero-math-lab h1 .th {
  display: block; font-family: var(--font-thai); font-size: 0.72em; margin-top: 4px; color: var(--lab-ice);
}
body.math-lab .tm-lead { color: #94a3b8; font-weight: 600; margin: 0 0 6px; }
.math-streak { margin: 0 0 4px; font-weight: 800; color: var(--lab-blue); font-size: 0.9rem; }
.math-stars-line { margin: 0 0 12px; font-size: 0.85rem; color: #fbbf24; font-weight: 800; }
.math-hero-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.math-daily-cta, .math-cont-cta, .math-swap-cta {
  display: inline-flex; align-items: center; gap: 10px;
  border: 1px solid rgba(96, 165, 250, 0.65);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.55), rgba(67, 56, 202, 0.5));
  color: #fff; border-radius: 16px; padding: 12px 16px;
  font: inherit; font-weight: 800; cursor: pointer; text-align: left;
}
.math-cont-cta, .math-swap-cta { background: rgba(255,255,255,0.08); border-color: var(--lab-stroke); }
.math-swap-cta.is-reverse {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.45), rgba(79, 70, 229, 0.45));
  border-color: #fda4af;
}
.math-swap-cta.is-both {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.35), rgba(37, 99, 235, 0.4));
}
.math-daily-cta em, .math-swap-cta em { display: block; font-style: normal; font-size: 0.8rem; color: #bfdbfe; font-weight: 600; }
.math-dir-row-top { margin-bottom: 12px; }
body.dir-th-en .math-eq-box { border-color: #fda4af; }
body.dir-th-en .math-prompt-primary.is-th { color: #fda4af; }
body.math-lab .tm-nav a { color: var(--lab-ice); opacity: 0.85; }
body.math-lab .tm-nav a.active { color: var(--lab-blue); opacity: 1; }
body.math-lab .tm-dark-btn {
  border: 1px solid var(--lab-stroke); background: rgba(255,255,255,0.08);
  color: var(--lab-ice); border-radius: 10px; padding: 6px 10px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.math-audio-unlock {
  width: 100%; margin-bottom: 10px; padding: 10px 12px; border-radius: 14px;
  border: 1px dashed var(--lab-blue); background: rgba(37, 99, 235, 0.22);
  color: #fff; font-weight: 800; font-family: inherit; cursor: pointer;
}
body.math-lab .math-panel {
  margin-top: 14px; padding: 14px;
  background: linear-gradient(155deg, rgba(255,255,255,0.09), rgba(255,255,255,0.02) 40%, var(--lab-glass));
  border-color: var(--lab-stroke);
}
body.math-lab .math-panel h2 { color: #fff; }
body.math-lab .math-sub { color: #94a3b8; }
.math-modes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; align-items: center; }
.math-mode-btn {
  border: 1px solid var(--lab-stroke); background: rgba(255,255,255,0.06);
  color: var(--lab-ice); border-radius: 12px; padding: 8px 10px;
  font-weight: 700; font-size: 0.75rem; cursor: pointer; font-family: inherit;
}
.math-duo-lab { font-size: 0.78rem; font-weight: 700; color: #94a3b8; display: inline-flex; gap: 6px; align-items: center; }
.math-sec-title {
  margin: 12px 0 8px; font-size: 0.8rem; font-weight: 800; color: var(--lab-blue);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.math-packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-bottom: 10px; }
.math-pack {
  display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: 14px;
  border: 1px solid var(--lab-stroke); background: rgba(15,23,42,0.45);
  cursor: pointer; text-align: left; font-family: inherit; color: inherit;
}
.math-pack.active, .math-pack:hover { border-color: var(--lab-blue); }
.math-pack strong { color: #fff; font-size: 0.85rem; }
.math-pack em { font-style: normal; font-family: var(--font-thai); color: var(--lab-indigo); font-weight: 700; font-size: 0.78rem; }
.math-recent, .math-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; }
.math-chip-label { font-size: 0.7rem; font-weight: 800; color: #94a3b8; text-transform: uppercase; }
.math-chip {
  border: 1px solid var(--lab-stroke); background: rgba(255,255,255,0.06); color: var(--lab-ice);
  border-radius: 999px; padding: 5px 10px; font-size: 0.75rem; font-weight: 700; cursor: pointer; font-family: inherit;
}
.math-chip.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.55), rgba(67, 56, 202, 0.45));
  border-color: var(--lab-blue); color: #fff;
}
.math-search {
  width: 100%; margin: 8px 0 10px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--lab-stroke); background: rgba(15,23,42,0.65); color: var(--lab-ice);
  font: inherit; font-weight: 600;
}
.math-tracks { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.math-track {
  border: 1px solid var(--lab-stroke); background: rgba(255,255,255,0.06); color: var(--lab-ice);
  border-radius: 12px; padding: 8px 12px; font-weight: 700; font-size: 0.78rem; cursor: pointer; font-family: inherit;
}
.math-track.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.5), rgba(79, 70, 229, 0.4));
  border-color: var(--lab-blue);
}
.math-mode-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.math-mode-links a {
  color: var(--lab-blue); font-weight: 800; text-decoration: none; font-size: 0.85rem;
  padding: 6px 10px; border-radius: 10px; border: 1px solid transparent;
}
.math-mode-links a.active { border-color: var(--lab-stroke); background: rgba(255,255,255,0.06); color: #fff; }
body.math-lab .math-digit, body.math-lab .math-vocab-card,
body.math-lab .math-dir, body.math-lab .math-ex, body.math-lab .math-choice,
body.math-lab .math-controls select, body.math-lab .math-tool {
  background: rgba(15,23,42,0.55); border-color: var(--lab-stroke); color: var(--lab-ice);
}
body.math-lab .math-ex.active {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
body.math-lab .math-dir.active { background: rgba(37, 99, 235, 0.35); border-color: var(--lab-blue); }
body.math-lab .math-eq-box {
  background: rgba(37, 99, 235, 0.12); border-color: var(--lab-blue);
}
body.math-lab .math-eq { color: #fff; }
.math-eq.is-listen { font-size: 2.4rem; }
.math-roman, .math-isaan {
  margin: 6px 0 0; font-size: 0.82rem; font-weight: 700; color: #93c5fd;
}
.math-isaan { font-family: var(--font-thai); color: #f9a8d4; }
.math-digit .td {
  display: inline-block; margin-left: 4px; font-family: var(--font-thai);
  font-size: 0.85em; color: var(--lab-blue); opacity: 0.9;
}
body.math-lab .math-answer-row input {
  background: rgba(15,23,42,0.75); color: #fff; border-color: var(--lab-blue);
}
.math-mic-hold {
  border: 1px solid var(--lab-stroke); background: rgba(255,255,255,0.08);
  color: #fff; border-radius: 12px; padding: 10px 12px; font-size: 1.1rem;
  cursor: pointer; font-family: inherit;
}
.math-mic-hold:active { background: rgba(37, 99, 235, 0.45); }
.math-done {
  margin-top: 14px; padding: 14px; border-radius: 16px;
  border: 1px solid var(--lab-stroke); background: rgba(15,23,42,0.5); text-align: center;
}
.math-done h3 { margin: 0 0 8px; color: #fff; }
.math-done-ctas { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
.math-done-ctas a, .math-done-ctas button {
  border: 1px solid var(--lab-stroke); background: rgba(255,255,255,0.08);
  color: var(--lab-ice); border-radius: 12px; padding: 8px 12px;
  font-weight: 700; text-decoration: none; font-family: inherit; cursor: pointer;
}
.math-bridges {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--lab-stroke);
}
.math-bridges a {
  color: var(--lab-blue); font-weight: 700; text-decoration: none; font-size: 0.85rem;
}
body.math-lab .math-footer { border-color: var(--lab-stroke); color: #94a3b8; }
body.math-lab .math-footer a { color: var(--lab-blue); }
body.math-lab .math-prompt-primary { color: #fff; }
body.math-lab .math-prompt-primary.is-th { color: #fda4af; }
body.math-duo .math-eq-box { outline: 2px solid rgba(251, 191, 36, 0.45); }
body.math-lab .mobile-dock {
  background: color-mix(in srgb, #020617 92%, transparent);
  border-top-color: color-mix(in srgb, #60a5fa 55%, transparent);
}
body.math-lab .mobile-dock a.dock-link.primary {
  background: color-mix(in srgb, #2563eb 70%, transparent);
  border-color: #60a5fa;
}
