/* Math Sprint 7 — Arcade-EdTech UI Upgrade (100% compatible with existing HTML/JS) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  color-scheme: light;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-soft: #eef2ff;
  --green: #10b981;
  --green-dark: #047857;
  --green-soft: #ecfdf5;
  --red: #ef4444;
  --red-dark: #b91c1c;
  --red-soft: #fef2f2;
  --amber: #b45309;
  --amber-soft: #fffbeb;
  --ice: #e0f2fe;
  --ice-ink: #0369a1;
  --radius: 20px;
  --shadow: 0 10px 28px -6px rgba(15, 23, 42, 0.08), 0 4px 10px -4px rgba(15, 23, 42, 0.04);
  --focus: 0 0 0 3px rgba(99, 102, 241, 0.45);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top center, #f8fafc 0%, var(--bg) 100%);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled {
  cursor: default;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid #6366f1;
  outline-offset: 3px;
}

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  line-height: 1.18;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

h1 {
  font-size: clamp(1.65rem, 3.5vw, 2.5rem);
  font-weight: 900;
}

h2 {
  font-size: 1.4rem;
  font-weight: 800;
}

h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

strong {
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--primary);
  line-height: 1.4;
  text-transform: uppercase;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  transform: translateY(-150%);
  background: #fff;
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 10px;
}

.skip-link:focus {
  transform: none;
}

.noscript {
  padding: 16px;
  text-align: center;
  background: var(--amber-soft);
  color: var(--amber);
}

.main {
  width: min(1120px, 100%);
  margin: auto;
  padding: 28px 24px 48px;
  outline: none;
}

.view {
  min-width: 0;
  animation: view-in 0.24s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================== BUTTONS, INPUTS & PROGRESS ==================== */
.btn {
  min-height: 46px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 14px;
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.25;
  text-align: center;
  transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:active:not(:disabled),
.answer-btn:active:not(:disabled),
.icon-button:active {
  transform: translateY(2px) scale(0.985);
}

.btn-primary {
  color: #ffffff;
  background: linear-gradient(135deg, #4f46e5 0%, #0ea5e9 100%);
  box-shadow: 0 4px 0 #312e81, 0 8px 18px rgba(79, 70, 229, 0.25);
}

.btn-secondary {
  background: #ffffff;
  color: var(--ink);
  border: 1.5px solid #cbd5e1;
  box-shadow: 0 3px 0 #e2e8f0;
}

.btn-quiet {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.btn-large {
  min-height: 54px;
  font-size: 1.02rem;
  border-radius: 16px;
}

.btn:disabled {
  opacity: 0.48;
  box-shadow: none;
}

.full-width {
  width: 100%;
}

@media (hover: hover) {
  .btn-primary:not(:disabled):hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
  }

  .btn-secondary:not(:disabled):hover,
  .btn-quiet:hover {
    background: #f8fafc;
    border-color: #94a3b8;
  }
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: 1.5px solid var(--line);
  border-radius: 13px;
  background: #ffffff;
  color: var(--ink);
  font-size: 1.15rem;
  box-shadow: 0 2px 0 #e2e8f0;
}

.icon-button[aria-pressed="true"] {
  background: var(--primary-soft);
  border-color: #c7d2fe;
}

.pill,
.tag,
.mode-tag,
.heading-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  line-height: 1.25;
  font-weight: 700;
}

.progress {
  display: block;
  width: 100%;
  height: 10px;
  border: 0;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
}

.progress::-webkit-progress-bar {
  background: #e2e8f0;
  border-radius: 999px;
}

.progress::-webkit-progress-value {
  background: linear-gradient(90deg, #10b981, #34d399);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.progress::-moz-progress-bar {
  background: linear-gradient(90deg, #10b981, #34d399);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.progress-mastery::-webkit-progress-value {
  background: linear-gradient(90deg, #059669, #34d399);
}

.progress-mastery::-moz-progress-bar {
  background: linear-gradient(90deg, #059669, #34d399);
}

.meter-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 7px;
  font-size: 0.8rem;
  color: var(--muted);
}

.meter-label strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.form-stack {
  display: grid;
  gap: 12px;
  text-align: left;
}

.form-stack label {
  font-weight: 700;
  font-size: 0.9rem;
}

.form-stack input {
  width: 100%;
  min-height: 52px;
  border: 2px solid #cbd5e1;
  border-radius: 14px;
  padding: 12px 14px;
  background: #f8fafc;
  color: var(--ink);
  font-size: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-stack input:focus {
  border-color: var(--primary);
  background: #fff;
  outline: none;
  box-shadow: var(--focus);
}

.form-stack input[aria-invalid="true"] {
  border-color: var(--red);
}

.form-error {
  color: var(--red-dark);
  font-size: 0.85rem;
  font-weight: 600;
}

.form-message {
  min-height: 1.4em;
  font-size: 0.85rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.form-message.is-error {
  color: var(--red-dark);
}

.form-message.is-success {
  color: var(--green-dark);
}

.privacy-note {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.55;
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 4px 10px 4px 0;
  border: 0;
  background: transparent;
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 4px 0 22px;
}

.page-heading .eyebrow,
.game-heading .eyebrow {
  margin-bottom: 6px;
}

.page-heading .muted {
  margin-top: 6px;
}

.heading-chip {
  color: var(--primary-dark);
  background: var(--primary-soft);
  border: 1px solid #c7d2fe;
  flex: none;
}

.section-heading {
  margin: 28px 0 14px;
}

.section-heading .muted {
  margin-top: 4px;
  font-size: 0.9rem;
}

/* ==================== WELCOME & NAVBAR ==================== */
.welcome-view {
  min-height: calc(100dvh - 78px);
  display: grid;
  place-items: center;
}

.welcome-card {
  width: min(100%, 440px);
  text-align: center;
  padding: 36px 30px;
  display: grid;
  gap: 15px;
}

.welcome-card h1 {
  font-size: clamp(1.8rem, 6vw, 2.3rem);
}

.welcome-card .form-stack {
  margin-top: 8px;
}

.welcome-mark {
  width: 80px;
  height: 80px;
  position: relative;
  margin: 0 auto 4px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  color: #fff;
  font-size: 3.2rem;
  font-weight: 900;
  box-shadow: 0 12px 26px rgba(79, 70, 229, 0.3);
  transform: rotate(-4deg);
}

.welcome-mark span {
  position: absolute;
  top: -10px;
  right: -10px;
  font-size: 1.7rem;
  color: #f59e0b;
  text-shadow: 0 2px #fff;
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  width: min(1168px, 100%);
  margin: auto;
  min-height: 70px;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  background: none;
  padding: 0;
  border: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 1.18rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  white-space: nowrap;
  min-height: 44px;
}

.brand b {
  color: var(--primary);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, #4f46e5, #10b981);
  font-size: 1.4rem;
  font-weight: 900;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.nav-actions .pill {
  min-height: 40px;
  padding: 8px 14px;
  white-space: nowrap;
}

.streak-pill {
  color: #ffffff;
  background: linear-gradient(135deg, #f97316, #f59e0b);
  border: none;
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.35);
  font-variant-numeric: tabular-nums;
}

.nav-button {
  color: var(--primary-dark);
  border: 1.5px solid #c7d2fe;
  background: #eef2ff;
}

.profile-pill {
  color: #334155;
  background: #f1f5f9;
  border: 1.5px solid var(--line);
  max-width: 180px;
}

.profile-pill>span:first-child {
  color: var(--green);
  font-size: 0.65rem;
}

#nav-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==================== DASHBOARD & CARDS ==================== */
.mastery-panel {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 20px 26px;
  margin-bottom: 18px;
}

.mastery-copy {
  flex: none;
}

.mastery-copy h2 {
  font-size: 1.65rem;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.mastery-copy h2 .muted {
  font-size: 1rem;
  letter-spacing: 0;
  font-weight: 600;
}

.mastery-meter {
  flex: 1;
  min-width: 0;
}

.mastery-meter .progress {
  height: 14px;
}

.support-banner {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 16px;
  padding: 20px 24px;
  border: none;
  border-radius: 20px;
  background: linear-gradient(110deg, #ff7a3d 0%, #f04286 52%, #7c3aed 100%);
  box-shadow: 0 12px 28px rgba(240, 66, 134, 0.25);
  text-align: left;
  color: #ffffff;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

@media (hover: hover) {
  .support-banner:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(240, 66, 134, 0.32);
  }
}

.support-symbol {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 15px;
  color: #fff;
  background: rgba(255, 255, 255, 0.22);
  font-size: 1.6rem;
}

.banner-copy {
  display: grid;
  flex: 1;
  gap: 3px;
}

.banner-copy strong {
  font-size: 1.12rem;
  font-weight: 800;
  color: #fff;
}

.banner-copy>span {
  font-size: 0.86rem;
  color: rgba(255, 255, 255, 0.9);
}

.banner-action {
  background: #fde047;
  color: #1e1b4b;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 3px 0 #ca8a04;
}

.topic-grid,
.support-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.topic-card,
.skill-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

@media (hover: hover) {

  .topic-card:hover,
  .skill-card:hover {
    transform: translateY(-3px);
    border-color: #c7d2fe;
    box-shadow: 0 14px 30px -8px rgba(79, 70, 229, 0.14);
  }
}

.topic-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.topic-number {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.mode-tag {
  color: #5b21b6;
  background: #ede9fe;
  font-size: 0.7rem;
  white-space: nowrap;
}

.mode-tag.is-summit,
.mode-tag.summit {
  color: #0369a1;
  background: #e0f2fe;
}

.topic-title {
  min-height: 2.5em;
}

.topic-progress {
  margin-top: auto;
}

.topic-best {
  color: #92400e;
  font-size: 0.76rem;
  font-weight: 800;
  align-self: flex-start;
  border-radius: 8px;
  background: #fef3c7;
  padding: 4px 9px;
}

.topic-actions {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 8px;
  margin-top: 4px;
}

.topic-actions .btn {
  padding-inline: 8px;
}

.skill-card h3 {
  min-height: 2.4em;
}

.skill-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 1.5rem;
}

.skill-description {
  font-size: 0.88rem;
  flex: 1;
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  margin: 36px auto 0;
  max-width: 580px;
}

/* ==================== SHARED QUESTION & PRACTICE ==================== */
.focused-view {
  width: min(740px, 100%);
  margin: auto;
}

.compact-heading {
  align-items: center;
  margin-bottom: 16px;
}

.compact-heading h1,
.game-heading h1 {
  font-size: clamp(1.35rem, 3vw, 1.95rem);
}

.tag {
  background: var(--primary-soft);
  color: var(--primary-dark);
  flex: none;
}

.practice-status {
  padding: 15px 19px;
  margin-bottom: 15px;
}

.question-card {
  padding: clamp(18px, 3vw, 32px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #ffffff;
  position: relative;
  color: var(--ink);
  border-radius: 22px;
}

.question-kicker {
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.question-content {
  display: grid;
  place-items: center;
  min-height: 108px;
  padding: 10px 0;
  text-align: center;
  font-size: clamp(1.3rem, 3.5vw, 1.95rem);
  font-weight: 700;
  overflow-wrap: anywhere;
  line-height: 1.55;
}

.question-content>* {
  max-width: 100%;
  min-width: 0;
}

.question-content .math,
.answer-content .math {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 2px;
}

.question-content .katex-display {
  margin: 0;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  padding: 5px 0;
}

.question-content .katex {
  font-size: 1.15em;
}

.question-content svg,
.coordinate-grid,
.problem-diagram {
  display: block;
  width: min(100%, 310px);
  height: auto;
  max-height: 310px;
  margin: 8px auto;
}

.question-text {
  font-size: clamp(1.02rem, 2.5vw, 1.25rem);
  font-weight: 600;
}

.problem-diagram {
  filter: drop-shadow(0 8px 18px rgba(79, 70, 229, 0.08));
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.answer-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 74px;
  min-width: 0;
  background: #ffffff;
  color: var(--ink);
  border: 2px solid #cbd5e1;
  border-radius: 16px;
  padding: 12px 10px;
  text-align: center;
  font-weight: 800;
  font-size: clamp(1rem, 2.8vw, 1.25rem);
  line-height: 1.35;
  box-shadow: 0 4px 0 #cbd5e1;
  transition: background 0.13s, border-color 0.13s, transform 0.1s, box-shadow 0.1s;
}

.answer-letter {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.answer-content {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  overflow-x: auto;
  padding: 3px 0;
}

.answer-content .katex {
  font-size: 1.07em;
}

@media (hover: hover) {
  .answer-btn:not(:disabled):hover {
    background: #eef2ff;
    border-color: #6366f1;
    box-shadow: 0 4px 0 #818cf8;
  }
}

.answer-btn:disabled {
  opacity: 1;
}

.answer-btn.is-correct,
.answer-btn.correct {
  background: #10b981;
  border-color: #059669;
  color: #ffffff;
  box-shadow: 0 4px 0 #047857;
}

.answer-btn.is-wrong,
.answer-btn.wrong {
  background: #fef2f2;
  border-color: #ef4444;
  color: #b91c1c;
  box-shadow: 0 4px 0 #fca5a5;
}

.answer-btn.is-correct .answer-letter,
.answer-btn.correct .answer-letter {
  color: #047857;
  background: #ffffff;
}

.answer-btn.is-wrong .answer-letter,
.answer-btn.wrong .answer-letter {
  color: #fff;
  background: #ef4444;
}

.hint-button {
  align-self: center;
}

.hint-box,
.feedback {
  padding: 15px;
  border-radius: 14px;
  font-size: 0.94rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.hint-box {
  background: var(--amber-soft);
  color: #78350f;
  border: 1.5px solid #fcd34d;
}

.feedback {
  display: grid;
  gap: 6px;
  background: var(--green-soft);
  color: #065f46;
  border: 1.5px solid #6ee7b7;
}

.feedback.is-wrong,
.feedback.wrong {
  background: var(--red-soft);
  color: #991b1b;
  border-color: #fca5a5;
}

.solution {
  display: grid;
  gap: 6px;
  color: inherit;
}

.solution .katex-display {
  overflow-x: auto;
  overflow-y: hidden;
}

.game-feedback {
  min-height: 1.4em;
  text-align: center;
  font-weight: 800;
  font-size: 0.88rem;
  color: #059669;
}

.game-feedback.is-wrong,
.game-feedback.wrong {
  color: #dc2626;
}

.completion-card {
  padding: 34px 24px;
  text-align: center;
  display: grid;
  gap: 14px;
  justify-items: center;
}

.celebration-mark {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 2.3rem;
  font-weight: 900;
}

.completion-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
}

.result-copy {
  font-size: 1.08rem;
  font-weight: 700;
}

/* ==================== BLITZ 30S (ARCADE DARK GLOW) ==================== */
.game-view {
  max-width: 920px;
  margin: auto;
}

.game-shell {
  padding: clamp(16px, 2.8vw, 28px);
  border-radius: 26px;
  background: linear-gradient(145deg, #1e1b4b 0%, #312e81 100%);
  border: 2px solid #4338ca;
  color: #ffffff;
  box-shadow: 0 20px 44px rgba(30, 27, 75, 0.3);
  transition: background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

.game-shell:not(.summit-shell) .eyebrow {
  color: #a5b4fc;
}

.game-shell:not(.summit-shell) .game-tip {
  color: #c7d2fe;
}

.game-shell:not(.summit-shell) .timer-panel,
.game-shell:not(.summit-shell) .stat-tile {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  backdrop-filter: blur(8px);
}

.game-shell:not(.summit-shell) .timer-label>span,
.game-shell:not(.summit-shell) .stat-tile>span {
  color: #c7d2fe;
}

.game-shell:not(.summit-shell) .combo-tile strong {
  color: #fbbf24;
}

.game-shell:not(.summit-shell) .timer-track {
  background: rgba(15, 23, 42, 0.45);
}

.game-shell.streak-tier-1:not(.summit-shell) {
  background: linear-gradient(145deg, #1e3a8a 0%, #3730a3 100%);
  border-color: #38bdf8;
  box-shadow: 0 0 32px rgba(56, 189, 248, 0.35);
}

.game-shell.streak-tier-2:not(.summit-shell) {
  background: linear-gradient(145deg, #311068 0%, #5b21b6 100%);
  border-color: #a855f7;
  box-shadow: 0 0 38px rgba(168, 85, 247, 0.45);
}

.game-shell.streak-tier-3:not(.summit-shell) {
  background: linear-gradient(145deg, #3b0764 0%, #6d28d9 60%, #9333ea 100%);
  border-color: #fbbf24;
  animation: combo-aura 1.6s ease-in-out infinite alternate;
}

@keyframes combo-aura {
  from {
    box-shadow: 0 0 24px rgba(168, 85, 247, 0.5);
  }

  to {
    box-shadow: 0 0 38px rgba(251, 191, 36, 0.65), 0 0 14px rgba(168, 85, 247, 0.7);
  }
}

.game-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.game-heading>div {
  min-width: 0;
}

.lives {
  white-space: nowrap;
  color: #f43f5e;
  font-size: clamp(1.25rem, 3vw, 1.65rem);
  letter-spacing: 0.04em;
  text-shadow: 0 2px 8px rgba(244, 63, 94, 0.35);
}

.lives .lost,
.life-lost {
  opacity: 0.25;
  filter: grayscale(1);
}

.rope-lives {
  font-size: clamp(1rem, 2.9vw, 1.45rem);
  text-shadow: none;
}

.blitz-hud {
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.timer-panel,
.stat-tile {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 12px 14px;
  min-width: 0;
}

.timer-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
}

.timer-label>span,
.stat-tile>span {
  font-size: 0.66rem;
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0.08em;
}

.timer-value-wrap {
  position: relative;
}

.timer-value {
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1.05;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.timer-track {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: #e2e8f0;
}

.timer-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  will-change: width;
}

.timer-fill.is-low,
.timer-fill.danger,
.timer-track.is-low .timer-fill {
  background: linear-gradient(90deg, #ef4444, #f97316);
}

.timer-track.is-pulsing,
.timer-track.pulse {
  animation: timer-pulse 0.32s ease-out;
}

@keyframes timer-pulse {
  50% {
    box-shadow: 0 0 0 6px rgba(52, 211, 153, 0.55);
  }
}

.time-bonus {
  position: absolute;
  bottom: 105%;
  left: 50%;
  white-space: nowrap;
  pointer-events: none;
  font-size: 1.15rem;
  font-weight: 900;
  color: #4ade80;
  opacity: 0;
  text-shadow: 0 0 12px rgba(74, 222, 128, 0.85);
}

.time-bonus.show,
.time-bonus.is-visible {
  animation: bonus-float 0.8s ease-out both;
}

@keyframes bonus-float {
  0% {
    opacity: 0;
    transform: translate(-50%, 6px) scale(0.85);
  }

  20% {
    opacity: 1;
  }

  65% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -26px) scale(1.06);
  }
}

.stat-tile {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  text-align: center;
}

.stat-tile strong {
  font-size: clamp(1.2rem, 3.3vw, 1.65rem);
  font-weight: 900;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.combo-tile strong {
  color: var(--primary);
}

.game-tip {
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 14px;
  font-weight: 500;
}

.shake,
.is-shaking {
  animation: shake 0.27s ease both;
}

@keyframes shake {

  20%,
  60% {
    transform: translateX(-6px);
  }

  40%,
  80% {
    transform: translateX(6px);
  }
}

.ice-shake,
.is-ice-shaking {
  animation: ice-shake 0.35s ease both;
}

@keyframes ice-shake {

  20%,
  60% {
    transform: translateX(-6px);
    box-shadow: 0 0 18px #38bdf8;
  }

  40%,
  80% {
    transform: translateX(6px);
  }
}

/* ==================== SUMMIT CLIMB (ALPINE SKY THEME) ==================== */
.summit-shell {
  background: linear-gradient(160deg, #e0f2fe 0%, #f0f9ff 52%, #e2e8f0 100%);
  border: 2px solid #bae6fd;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.summit-shell .eyebrow {
  color: #0369a1;
}

.summit-shell.streak-tier-1,
.summit-shell.streak-tier-2,
.summit-shell.streak-tier-3 {
  border-color: #38bdf8;
  box-shadow: 0 0 28px rgba(56, 189, 248, 0.25);
}

.summit-hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.summit-layout {
  display: grid;
  grid-template-columns: minmax(175px, 225px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.mountain-panel {
  padding: 14px;
  background: rgba(255, 255, 255, 0.88);
  border-color: #bae6fd;
}

.mountain-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.zone-badge {
  background: #e0f2fe;
  color: #0369a1;
  border: 1.5px solid #7dd3fc;
  font-size: 0.66rem;
  padding: 4px 7px;
  border-radius: 8px;
  font-weight: 800;
}

.mountain-track {
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: relative;
  max-height: 360px;
  overflow: auto;
  padding: 3px;
  scrollbar-width: thin;
}

.track-step,
.mountain-step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  min-height: 31px;
  padding: 4px 9px;
  border-radius: 9px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 700;
  flex: none;
  position: relative;
}

.track-step.is-ice,
.mountain-step.is-ice,
.track-step.ice,
.mountain-step.ice {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #7dd3fc;
}

.track-step.is-camp,
.mountain-step.is-camp,
.track-step.camp,
.mountain-step.camp {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac;
}

.track-step.is-reached,
.mountain-step.is-reached {
  opacity: 0.65;
}

.track-step.is-current,
.mountain-step.is-current,
.track-step.current,
.mountain-step.current {
  border: 2px solid #0284c7;
  color: #0c4a6e;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.35);
  font-weight: 900;
  opacity: 1;
  background: #ffffff;
}

.mountain-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 0.66rem;
  color: var(--muted);
  margin-top: 10px;
  font-weight: 600;
}

.mountain-legend>span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.camp-dot {
  background: #22c55e;
}

.ice-dot {
  background: #38bdf8;
}

.summit-question-area {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.bank-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1.5px solid #bbf7d0;
  border-radius: 16px;
  background: #ffffff;
}

.bank-panel strong {
  font-size: 0.94rem;
  color: var(--green-dark);
  font-variant-numeric: tabular-nums;
}

.bank-panel p {
  font-size: 0.78rem;
}

.btn-bank {
  color: #fff;
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 4px 0 #047857, 0 6px 18px rgba(16, 185, 129, 0.3);
  flex: none;
}

.btn-bank:disabled {
  background: #e2e8f0;
  color: #64748b;
  box-shadow: none;
  opacity: 1;
}

/* ==================== SUPPORT SKILLS (NEUTRAL 5S HELPER) ==================== */
.support-hud {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 15px 20px;
  margin-bottom: 14px;
}

.support-hud>div:first-child {
  display: grid;
  gap: 4px;
}

#support-score {
  font-size: 1.75rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: var(--primary);
}

.support-meter {
  flex: 1;
  min-width: 0;
}

.helper-card {
  background: #fffbeb;
  border: 2px solid #fcd34d;
  border-radius: 16px;
  padding: 15px;
  color: #78350f;
  animation: helper-open 0.25s ease-out both;
}

@keyframes helper-open {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.helper-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 8px;
  margin-bottom: 10px;
}

.helper-heading strong {
  font-size: 0.95rem;
  font-weight: 800;
}

.helper-caption {
  color: #92400e;
  font-size: 0.78rem;
  font-weight: 500;
}

.helper-content {
  font-size: 0.88rem;
  overflow-x: auto;
  line-height: 1.6;
}

.helper-content p+p {
  margin-top: 6px;
}

.helper-content table {
  border-collapse: collapse;
  width: 100%;
  text-align: center;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  background: #ffffff;
  border-radius: 8px;
  overflow: hidden;
}

.helper-content td,
.helper-content th {
  padding: 5px;
  border: 1px solid #fde68a;
  font-weight: 500;
  background: transparent;
  color: inherit;
}

.helper-content .multiplication-grid {
  min-width: 300px;
}

.helper-content .reference-row,
.helper-content .multiples-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 5px 0;
}

.helper-content .katex-display {
  overflow-x: auto;
  overflow-y: hidden;
}

/* ==================== GAME OVER & TOP 10 LEADERBOARD ==================== */
.results-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  align-items: start;
  gap: 20px;
  max-width: 960px;
  margin: 8px auto;
}

.results-card {
  padding: 30px;
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 12px;
}

.result-medallion {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  color: #b45309;
  background: linear-gradient(135deg, #fef08a, #fde047);
  border: 2px solid #facc15;
  border-radius: 50%;
  font-size: 2rem;
  box-shadow: 0 8px 20px rgba(250, 204, 21, 0.35);
}

.results-card h1 {
  font-size: clamp(1.75rem, 4vw, 2.3rem);
  color: #ea580c;
}

.score-label {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  font-weight: 800;
  color: var(--muted);
  margin-top: 4px;
}

.result-score {
  font-size: clamp(2.7rem, 7vw, 4.1rem);
  color: var(--ink);
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  max-width: 100%;
}

.personal-best {
  color: var(--green-dark);
  background: var(--green-soft);
  border: 1px solid #6ee7b7;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
}

.result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  margin: 6px 0;
}

.result-stats>div {
  display: grid;
  gap: 4px;
  border-radius: 14px;
  padding: 12px 10px;
  background: #f1f5f9;
}

.result-stats span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.result-stats strong {
  font-size: 1.35rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

#over-again {
  background: linear-gradient(135deg, #f97316 0%, #8b5cf6 100%);
  box-shadow: 0 4px 0 #6d28d9, 0 10px 22px rgba(139, 92, 246, 0.3);
}

.leaderboard-card {
  padding: 24px;
}

.leaderboard-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
  margin-bottom: 14px;
}

.leaderboard-heading h2 {
  margin-top: 4px;
  font-size: 1.25rem;
}

.sync-status {
  padding: 5px 10px;
  color: var(--muted);
  background: #f1f5f9;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.sync-status.is-synced,
.sync-status.synced {
  color: var(--green-dark);
  background: var(--green-soft);
}

.leaderboard-list {
  padding: 0;
  margin: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.92rem;
  border: 1.5px solid transparent;
}

.leaderboard-row:nth-child(odd) {
  background: #f8fafc;
}

.leaderboard-row.is-self,
.leaderboard-row.current-user {
  background: #eef2ff;
  border-color: #818cf8;
  color: var(--primary-dark);
  font-weight: 700;
}

.leaderboard-rank {
  font-weight: 900;
  color: var(--muted);
  text-align: center;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 0.82rem;
}

.leaderboard-row:nth-child(1) .leaderboard-rank {
  background: #fef08a;
  color: #854d0e;
}

.leaderboard-row:nth-child(2) .leaderboard-rank {
  background: #e2e8f0;
  color: #334155;
}

.leaderboard-row:nth-child(3) .leaderboard-rank {
  background: #fed7aa;
  color: #9a3412;
}

.leaderboard-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-score {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.empty-state {
  padding: 24px 10px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ==================== MODAL & TOAST ==================== */
.dialog {
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px;
  width: min(440px, calc(100% - 28px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.25);
}

.dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(4px);
}

.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.dialog-heading h2 {
  margin-top: 4px;
}

.dialog>.muted {
  font-size: 0.88rem;
}

.profile-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 14px;
  background: #f1f5f9;
  padding: 12px;
  margin: 16px 0;
}

.profile-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  flex: none;
}

.profile-summary .muted {
  font-size: 0.78rem;
}

.form-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.form-divider::before,
.form-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.dialog .privacy-note {
  margin-top: 10px;
}

.toast {
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 28px);
  z-index: 30;
  padding: 11px 18px;
  border-radius: 14px;
  background: #0f172a;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.25);
  pointer-events: none;
  text-align: center;
}

/* ==================== RESPONSIVE & REDUCED MOTION ==================== */
@media (max-width: 900px) {

  .topic-grid,
  .support-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .heading-chip {
    display: none;
  }
}

@media (max-width: 680px) {
  .main {
    padding: 18px 14px 32px;
  }

  .nav-inner {
    padding: 8px 14px;
    flex-wrap: wrap;
    gap: 6px 10px;
    min-height: 0;
  }

  .nav-actions {
    flex: 1 1 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) 42px;
    gap: 6px;
  }

  .nav-actions .pill {
    min-height: 40px;
    justify-content: center;
    padding: 6px;
    font-size: 0.72rem;
    min-width: 0;
  }

  .nav-actions .icon-button {
    height: 40px;
    width: 42px;
  }

  .profile-pill {
    max-width: none;
  }

  #nav-name {
    max-width: 100%;
  }

  .navbar {
    position: static;
  }

  .page-heading {
    margin-bottom: 18px;
  }

  .mastery-panel {
    padding: 18px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .support-banner {
    padding: 16px;
    gap: 12px;
  }

  .banner-action {
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  .topic-card,
  .skill-card {
    padding: 16px;
  }

  .topic-actions {
    gap: 6px;
  }

  .topic-actions .btn {
    font-size: 0.84rem;
  }

  .summit-layout {
    grid-template-columns: 1fr;
  }

  .mountain-panel {
    padding: 10px;
  }

  .mountain-track {
    flex-direction: row-reverse;
    overflow-x: auto;
    overflow-y: hidden;
    max-height: none;
  }

  .track-step,
  .mountain-step {
    flex: 0 0 58px;
    min-height: 44px;
    flex-direction: column;
    justify-content: center;
    gap: 0;
    padding: 3px 5px;
    text-align: center;
  }

  .mountain-legend {
    margin-top: 6px;
  }

  .results-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .results-card {
    padding: 24px;
  }

  .game-shell {
    border-radius: 20px;
  }

  .question-card {
    gap: 12px;
  }

  .stat-tile,
  .timer-panel {
    padding: 10px 8px;
  }
}

@media (max-width: 470px) {

  .topic-grid,
  .support-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .topic-title,
  .skill-card h3 {
    min-height: 0;
  }

  .topic-card,
  .skill-card {
    gap: 10px;
  }

  .topic-actions .btn {
    min-height: 46px;
    font-size: 0.9rem;
  }

  .welcome-card {
    padding: 28px 20px;
  }

  .welcome-view {
    min-height: calc(100dvh - 48px);
  }

  .compact-heading {
    flex-wrap: wrap;
    gap: 8px;
  }

  .question-content {
    min-height: 92px;
  }

  .answer-grid {
    gap: 9px;
  }

  .answer-btn {
    min-height: 68px;
    padding: 8px 6px;
    gap: 6px;
  }

  .answer-letter {
    width: 20px;
    height: 20px;
    font-size: 0.68rem;
  }

  .blitz-hud,
  .summit-hud {
    gap: 6px;
  }

  .timer-label {
    flex-wrap: wrap;
    gap: 3px;
  }

  .timer-value {
    font-size: 1.25rem;
  }

  .stat-tile>span,
  .timer-label>span {
    font-size: 0.6rem;
  }

  .bank-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .bank-panel .btn {
    width: 100%;
  }

  .game-heading {
    gap: 7px;
  }

  .leaderboard-card {
    padding: 18px;
  }

  .support-hud {
    gap: 14px;
  }
}

@media (max-width: 350px) {
  .nav-actions {
    grid-template-columns: 1fr 1fr 42px;
  }

  .streak-pill {
    grid-column: 1 / -1;
  }

  .answer-grid {
    grid-template-columns: 1fr;
  }

  .answer-btn {
    min-height: 54px;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==================== INTERACTIVE SVG MOUNTAIN (SUMMIT CLIMB) ==================== */
.mountain-track {
  overflow: visible;
  max-height: none;
  padding: 0;
}

.summit-svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid #bae6fd;
  box-shadow: inset 0 0 18px rgba(15, 23, 42, 0.08);
}

.trail-seg {
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 5 5;
  transition: stroke 0.3s ease;
}

.trail-seg.is-ice {
  stroke: #38bdf8;
  stroke-width: 5;
  stroke-dasharray: none;
  filter: drop-shadow(0 0 4px rgba(56, 189, 248, 0.8));
}

.trail-seg.is-climbed {
  stroke: #34d399;
  stroke-dasharray: none;
}

.node-dot {
  fill: #e2e8f0;
  stroke: #334155;
  stroke-width: 1.5;
}

.camp-dot-svg {
  fill: #22c55e;
  stroke: #ffffff;
  stroke-width: 2;
}

.camp-flag {
  fill: #22c55e;
  stroke: #ffffff;
  stroke-width: 1.2;
}

.ice-dot-svg {
  fill: #38bdf8;
  stroke: #ffffff;
  stroke-width: 1.5;
}

.node-label {
  font-size: 9px;
  font-weight: 800;
  fill: #f8fafc;
  paint-order: stroke;
  stroke: #1e293b;
  stroke-width: 2.5px;
  stroke-linejoin: round;
}

.is-camp-label {
  fill: #86efac;
  font-size: 10px;
}

.is-ice-label {
  fill: #7dd3fc;
}

.climber-pin {
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.climber-pin.is-slipping {
  transition: transform 0.38s cubic-bezier(0.55, 0.06, 0.68, 0.19);
}

.climber-halo {
  fill: rgba(250, 204, 21, 0.35);
  animation: climber-pulse 1.5s ease-in-out infinite;
}

.climber-body {
  fill: #ffffff;
  stroke: #4f46e5;
  stroke-width: 2.5;
}

.climber-icon {
  font-size: 12px;
}

@keyframes climber-pulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.7;
  }

  50% {
    transform: scale(1.25);
    opacity: 0.2;
  }
}

.climber-delta {
  font-size: 12px;
  font-weight: 900;
  opacity: 0;
  paint-order: stroke;
  stroke: #0f172a;
  stroke-width: 3px;
}

.climber-delta.show.is-up {
  fill: #4ade80;
  animation: delta-pop 0.8s ease-out both;
}

.climber-delta.show.is-down {
  fill: #f87171;
  animation: delta-pop 0.8s ease-out both;
}

@keyframes delta-pop {
  0% {
    opacity: 0;
    transform: translateY(4px);
  }

  25% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translateY(-14px);
  }
}

@media (max-width: 680px) {
  .mountain-track {
    display: block;
    overflow: visible;
  }

  .summit-svg {
    max-width: 220px;
    margin: 0 auto;
  }
}
/* ==================== OPTIONAL LONG-ARITHMETIC WORKSPACE ==================== */
.workpad {
  width: min(100%, 330px);
  padding: 12px 10px 9px;
  margin: 4px auto;
  color: var(--ink);
  background: #f8fafc;
  border: 1px solid #dbe4ef;
  border-radius: 16px;
  font-size: 1rem;
  font-weight: 600;
}
.workpad-grid {
  --cell: minmax(0, 1fr);
  width: min(100%, 244px);
  margin: 0 auto;
  font-variant-numeric: tabular-nums;
}
.workpad-row {
  display: grid;
  grid-template-columns: minmax(0, 42px) repeat(4, var(--cell));
  align-items: center;
  column-gap: 5px;
  margin: 3px 0;
}
.workpad-division .workpad-row {
  grid-template-columns: minmax(0, 42px) repeat(3, var(--cell));
}
.workpad-digit, .workpad-symbol {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 32px;
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.1;
}
.workpad-symbol { color: var(--muted); font-size: 1.15rem; }
.workpad-decimal { position: absolute; right: -4px; bottom: 4px; line-height: 1; }
.workpad-cell {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0;
  border: 1.5px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  text-align: center;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.workpad-cell:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.workpad-cell:disabled { opacity: .7; }
.workpad-carry .workpad-cell { height: 29px; font-size: .92rem; border-style: dashed; }
.workpad-small { color: var(--muted); font-size: .65rem; text-align: right; }
.workpad-rule-row { margin: 5px 0; }
.workpad-rule { border-top: 2px solid #64748b; }
.workpad-decimal-result { grid-column: 2 / -1; text-align: right; padding-inline: 10px; }
.workpad-house {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 5px;
  border-top: 2px solid var(--ink);
  border-left: 2px solid var(--ink);
  border-top-left-radius: 9px;
  padding-top: 3px;
}
.workpad-divisor { padding-top: 5px; }
.workpad-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 9px;
}
.workpad-caption { font-size: .68rem; line-height: 1.35; color: var(--muted); text-align: left; }
.workpad-clear {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: var(--primary-dark);
  border-radius: 8px;
  padding: 5px 9px;
  font-size: .75rem;
  font-weight: 700;
  min-height: 32px;
}
@media (max-width: 360px) {
  .workpad { padding-inline: 6px; }
  .workpad-row { column-gap: 3px; }
  .workpad-house { gap: 3px; }
  .workpad-cell { height: 34px; }
}
.workpad-clear { flex: 0 0 auto; white-space: nowrap; }
