body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f6fb;
  margin: 0;
  color: #172033;
}

.app {
  max-width: 940px;
  margin: 32px auto;
  padding: 0 16px;
}

.card {
  background: white;
  border-radius: 24px;
  box-shadow: 0 16px 40px rgba(23, 32, 51, 0.08);
  padding: 24px;
  margin-bottom: 18px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-block {
  min-width: 0;
}

.brand-lockup,
.login-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  width: 104px;
  height: 104px;
  object-fit: contain;
  flex: 0 0 auto;
}

.login-logo {
  width: 88px;
  height: 88px;
}

.eyebrow {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: #667085;
  font-weight: 700;
}

h1, h2 {
  margin: 0.2em 0;
}

.scoreboard {
  display: flex;
  gap: 14px;
  font-size: 18px;
  font-weight: 800;
}

.input-row, .answer-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  align-items: center;
}

input {
  flex: 1;
  border: 1px solid #d0d5dd;
  border-radius: 14px;
  padding: 14px;
  font-size: 16px;
}

textarea {
  width: 100%;
  border: 1px solid #d0d5dd;
  border-radius: 14px;
  padding: 14px;
  font-size: 16px;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
}

/* Canonical button baseline. Applies to <button>, anchors styled as buttons,
   and any element that opts in via .btn. Variant classes below override
   colors, sizes, and (for pill variants) the border-radius. */
button,
.btn,
.ghost-btn,
.start-btn,
.start-giant-btn,
.secondary-btn,
.quit-btn,
.pause-btn,
.guest-name-btn,
.level-chip,
.student-chip,
.resume-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.1;
  cursor: pointer;
  text-decoration: none;
  background: #172033;
  color: white;
  transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

button:hover,
.btn:hover,
.ghost-btn:hover,
.start-btn:hover,
.start-giant-btn:hover,
.secondary-btn:hover,
.quit-btn:hover,
.pause-btn:hover,
.guest-name-btn:hover,
.level-chip:hover,
.student-chip:hover,
.resume-pill:hover {
  transform: translateY(-1px);
}

button:focus-visible,
.btn:focus-visible,
.ghost-btn:focus-visible,
.start-btn:focus-visible,
.start-giant-btn:focus-visible,
.secondary-btn:focus-visible,
.quit-btn:focus-visible,
.pause-btn:focus-visible,
.guest-name-btn:focus-visible,
.level-chip:focus-visible,
.student-chip:focus-visible,
.resume-pill:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 2px;
}

button:disabled,
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.game-card {
  text-align: center;
}

.timer-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
}

/* Game stage: equation card on the left, vertical stat column on the right.
   Collapses to a single column on small screens, with the stat column moved
   above the card. */
.game-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 18px;
  align-items: stretch;
}

.phase-label {
  margin: 0 0 4px;
  font-weight: 800;
  color: #475467;
  text-align: center;
}

.stat-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 14px;
  background:
    radial-gradient(circle at top, rgba(99, 102, 241, 0.08), transparent 50%),
    white;
  border: 1px solid rgba(99, 102, 241, 0.18);
  border-radius: 18px;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.06);
}

.stat-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-level-label {
  font-weight: 900;
  font-size: 22px;
  color: #1e293b;
  letter-spacing: 0.01em;
}

.stat-level-label span {
  color: #2563eb;
}

.stat-progress-text {
  font-weight: 700;
  font-size: 13px;
  color: #64748b;
}

.stat-momentum-caption {
  text-align: center;
  font-weight: 800;
  font-size: 13px;
  color: #475467;
  min-height: 1.2em;
}

.stat-lanes {
  display: flex;
  flex-direction: row;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 280px;
  align-items: stretch;
  justify-content: center;
}

.stat-lane {
  position: relative;
  width: 36px;
  border-radius: 10px;
  overflow: hidden;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
}

/* Progress lane: vertical stack of 5 tick segments, fill bottom-up. */
.stat-progress-lane {
  display: flex;
  flex-direction: column-reverse;
  padding: 4px;
  gap: 4px;
  background: #eef2ff;
}

.stat-progress-tick {
  flex: 1 1 0;
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.12);
  transition: background 0.25s ease, transform 0.2s ease;
}

.stat-progress-tick.filled {
  background: linear-gradient(180deg, #34d399, #16a34a);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.stat-progress-tick.just-filled {
  transform: scaleY(1.04);
}

.stat-progress-lane.at-risk .stat-progress-tick.filled {
  background: linear-gradient(180deg, #fbbf24, #d97706);
}

/* Timer lane: continuous fill drained top-down. The fill anchors to the
   bottom and shrinks each second via a 1s linear height transition. */
.stat-timer-lane {
  --timer-color-start: #38bdf8;
  --timer-color-end: #1d4ed8;
  background: #eff6ff;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.stat-lane-fill {
  position: absolute;
  inset: auto 0 0 0;
  height: 100%;
  background: linear-gradient(180deg, var(--timer-color-start), var(--timer-color-end));
  transition: height 1s linear, background 0.4s ease;
}

.stat-timer-number {
  position: relative;
  z-index: 1;
  font-weight: 900;
  font-size: 13px;
  color: #0f172a;
  margin-bottom: 6px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

/* Subtle 1Hz flash on every tick. .tick is added briefly each second by
   startTimer so the visual rhythm is felt even while the bar drains
   smoothly. */
.stat-timer-lane.tick .stat-lane-fill {
  filter: brightness(1.18);
}

/* Momentum colors fold into the timer lane fill. updateMomentum applies
   the matching class to .stat-timer-lane. */
.stat-timer-lane.timer-fire    { --timer-color-start: #fbbf24; --timer-color-end: #d97706; }
.stat-timer-lane.timer-hot     { --timer-color-start: #fb923c; --timer-color-end: #c2410c; }
.stat-timer-lane.timer-climb   { --timer-color-start: #4ade80; --timer-color-end: #15803d; }
.stat-timer-lane.timer-steady  { --timer-color-start: #38bdf8; --timer-color-end: #1d4ed8; }
.stat-timer-lane.timer-cool    { --timer-color-start: #94a3b8; --timer-color-end: #475569; }
.stat-timer-lane.timer-risk    { --timer-color-start: #f87171; --timer-color-end: #b91c1c; }

/* Time-running-out override: regardless of momentum, the timer reddens
   when only a few seconds remain. */
.stat-timer-lane.urgent { --timer-color-start: #f87171; --timer-color-end: #b91c1c; }

@media (max-width: 720px) {
  .game-stage {
    grid-template-columns: minmax(0, 1fr);
  }

  .stat-column {
    order: -1;
  }

  .stat-lanes {
    flex-direction: column;
    min-height: 0;
  }

  .stat-lane {
    width: 100%;
    height: 18px;
  }

  /* Horizontal mode: progress fills left-to-right, timer drains
     right-to-left. */
  .stat-progress-lane {
    flex-direction: row;
  }

  .stat-timer-lane {
    align-items: stretch;
  }

  .stat-lane-fill {
    inset: 0 0 0 0;
    width: 100%;
  }

  .stat-timer-number {
    margin: 0;
    align-self: center;
    padding-right: 8px;
  }
}

#timerCircle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #eef2ff;
  font-size: 26px;
  font-weight: 900;
}

#question {
  font-size: 42px;
  margin-top: 22px;
}

#question.word-story {
  font-size: 22px;
  line-height: 1.45;
  font-weight: 600;
  text-align: left;
  max-width: 640px;
  margin: 22px auto 8px;
  color: #1f2937;
}

.topic-badge {
  display: inline-block;
  background: #eef2ff;
  color: #4338ca;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 0.08em;
  padding: 6px 12px;
  border-radius: 999px;
  margin: 0;
}

.topic-badge:empty {
  display: none;
}

.level-card {
  padding: 16px 24px;
}

.level-progress-header {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  font-size: 14px;
  color: #344054;
  margin-bottom: 8px;
}

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

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #ec4899);
  border-radius: 999px;
  transition: width 0.4s ease, background 0.3s ease;
}

.progress-bar.at-risk {
  background: linear-gradient(90deg, #f59e0b, #dc2626);
  animation: at-risk-pulse 1.2s ease-in-out infinite;
}

@keyframes at-risk-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.5); }
  50%      { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}

.momentum-header {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  font-size: 14px;
  color: #344054;
  margin: 14px 0 8px;
}

.momentum-track {
  position: relative;
  height: 14px;
  background: linear-gradient(90deg, #fee2e2 0%, #fee2e2 50%, #dcfce7 50%, #dcfce7 100%);
  border-radius: 999px;
  overflow: hidden;
}

.momentum-zero {
  position: absolute;
  left: 50%;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: #475569;
  transform: translateX(-50%);
  z-index: 1;
}

.momentum-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 0%;
  transition: left 0.4s ease, width 0.4s ease, background 0.3s ease;
  border-radius: 999px;
}

.momentum-fill.positive {
  background: linear-gradient(90deg, #4ade80, #16a34a);
}

.momentum-fill.negative {
  background: linear-gradient(90deg, #dc2626, #f87171);
}

.feedback {
  min-height: 30px;
  margin-top: 16px;
  font-size: 22px;
  font-weight: 900;
}

.hint {
  margin: 12px auto;
  padding: 14px;
  background: #fff7e6;
  border-radius: 16px;
  max-width: 650px;
  display: none;
}

.hint-equation {
  font-size: 26px;
  font-weight: 800;
  text-align: center;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  color: #1f2937;
}

.coach-hint-stage {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

/* When another coach stage is active, suppress this stage's owl rail and
   collapse the layout so the speech bubble takes the full width. Keeps a
   single Coach visible at any time, anchored to the most recent bubble. */
.coach-hint-stage.coach-no-owl {
  grid-template-columns: minmax(0, 1fr);
}

.coach-hint-stage.coach-no-owl .coach-owl-rail {
  display: none;
}

.coach-hint-simple {
  grid-template-columns: 180px minmax(0, 1fr);
}

.coach-owl-rail {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}

.coach-hint-owl {
  width: 180px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  flex: 0 0 auto;
}

.coach-pointer {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #c2410c;
  font-weight: 900;
}

.coach-pointer-line {
  width: 26px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f59e0b, #c2410c);
  display: inline-block;
}

.coach-pointer-arrow {
  font-size: 22px;
  line-height: 1;
}

.coach-hint-content {
  min-width: 0;
}

.coach-work-stack {
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid #fcd34d;
  border-radius: 18px;
  padding: 14px 16px;
}

.coach-origin {
  color: #475467;
}

.coach-prior {
  color: #667085;
  font-size: 22px;
}

.coach-focus {
  background: #ffffff;
  border: 2px solid #f59e0b;
  box-shadow: 0 10px 24px rgba(245, 158, 11, 0.18);
  border-radius: 16px;
  padding: 10px 12px;
  color: #9a3412;
}

.coach-bubble {
  margin-top: 12px;
  background: #ffffff;
  border: 2px solid #fdba74;
  border-radius: 18px;
  color: #7c2d12;
  font-weight: 800;
  line-height: 1.4;
  padding: 12px 14px;
  position: relative;
  text-align: left;
}

.coach-bubble::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 20px;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-left: 2px solid #fdba74;
  border-bottom: 2px solid #fdba74;
  transform: rotate(45deg);
}

.hint-arrow {
  text-align: center;
  color: #94a3b8;
  font-size: 14px;
  margin: 4px 0;
}

.explain-header {
  font-weight: 800;
  color: #475569;
  margin-bottom: 10px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
}

.hint-equation.fade-in {
  animation: explain-fade 0.45s ease-out;
}

@keyframes explain-fade {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.choices {
  display: grid;
  gap: 10px;
  max-width: 760px;
  margin: 18px auto;
}

.choices button {
  background: #ffffff;
  color: #111827;
  border: 2px solid #2563eb;
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.08);
}

.choices button:hover {
  background: #eff6ff;
  transform: translateY(-1px);
}

.guided-options {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

.small {
  color: #667085;
}

.celebrate-burst {
  display: inline-block;
  font-size: 88px;
  vertical-align: middle;
  animation: celeb-burst 0.5s ease-out;
}

@keyframes celeb-burst {
  0% { transform: scale(0.2); opacity: 0; }
  60% { transform: scale(1.4); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.celebrate-fire {
  display: inline-block;
  font-size: 88px;
  vertical-align: middle;
  animation: celeb-fire-flicker 1.2s ease-in-out infinite;
}

@keyframes celeb-fire-flicker {
  0%, 100% { transform: scaleX(1)  scale(1); }
  25%      { transform: scaleX(-1) scale(1.08); }
  50%      { transform: scaleX(1)  scale(0.96); }
  75%      { transform: scaleX(-1) scale(1.05); }
}

.celebrate-text {
  font-size: 40px;
  font-weight: 900;
  vertical-align: middle;
}

.next-correct {
  background: #16a34a;
  border: 3px solid #064e3b;
  animation: flash-once 0.6s ease-out 1;
}

@keyframes flash-once {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.75); transform: scale(1); }
  50%  { box-shadow: 0 0 0 20px rgba(34, 197, 94, 0); transform: scale(1.1); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); transform: scale(1); }
}

.next-countdown {
  display: inline-grid;
  place-items: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #065f46;
  font-weight: 900;
  font-size: 18px;
}

.pause-btn {
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid #cbd5e1;
}

.upload-card summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
}

.upload-card summary::-webkit-details-marker {
  display: none;
}

.upload-card summary::before {
  content: "❯";
  display: inline-block;
  font-weight: 900;
  font-size: 18px;
  color: #475569;
  transition: transform 0.2s ease;
}

.upload-card details[open] summary::before {
  transform: rotate(90deg);
}

.upload-card summary h2 {
  margin: 0;
}

.answer-row .answer-x,
.answer-row .answer-op {
  font-size: 36px;
  font-weight: 800;
}

.answer-row #answer {
  flex: 0 0 auto;
  width: 180px;
  font-size: 36px;
  font-weight: 800;
  text-align: center;
  padding: 10px 14px;
}

#answerSymbol {
  border: 2px solid #4338ca;
  border-radius: 14px;
  padding: 8px 16px;
  font-size: 36px;
  font-weight: 800;
  background: #eef2ff;
  color: #1e1b4b;
  cursor: pointer;
}

.symbol-wrap {
  position: relative;
  display: inline-block;
}

.sym-spark {
  position: absolute;
  font-size: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.symbol-wrap.symbol-error #answerSymbol {
  border-color: #16a34a;
  background: #dcfce7;
  color: #14532d;
  animation: symbol-pulse 0.7s ease-in-out infinite;
}

.symbol-wrap.symbol-error .sym-spark {
  opacity: 1;
  animation: sym-twinkle 1.1s ease-in-out infinite;
}

.compound-row {
  justify-content: center;
}

.compound-input {
  flex: 0 0 auto;
  width: 130px;
  font-size: 36px;
  font-weight: 800;
  text-align: center;
  padding: 10px 14px;
}

.compound-sep {
  font-size: 36px;
  font-weight: 800;
  color: #1f2937;
}

.symbol-wrap.symbol-error .sym-spark.s1 { top: -22px; left: -16px; animation-delay: 0s; }
.symbol-wrap.symbol-error .sym-spark.s2 { top: -22px; right: -16px; animation-delay: 0.3s; }
.symbol-wrap.symbol-error .sym-spark.s3 { bottom: -22px; left: -10px; animation-delay: 0.6s; }
.symbol-wrap.symbol-error .sym-spark.s4 { bottom: -22px; right: -10px; animation-delay: 0.9s; }

@keyframes symbol-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.65); transform: scale(1); }
  50%      { box-shadow: 0 0 0 14px rgba(22, 163, 74, 0); transform: scale(1.06); }
}

@keyframes sym-twinkle {
  0%, 100% { transform: scale(0.5) rotate(0deg);  opacity: 0.4; }
  50%      { transform: scale(1.3) rotate(20deg); opacity: 1; }
}

.start-btn {
  background: #16a34a;
  color: white;
  font-size: 13px;
  padding: 6px 14px;
}

.quit-btn {
  background: transparent;
  color: #dc2626;
  border: 1px solid #fecaca;
  font-size: 13px;
  padding: 6px 12px;
}

.guest-name-btn {
  background: #fff7e6;
  color: #92400e;
  border: 1px solid #fcd34d;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 8px 12px;
}

.guest-edit-icon {
  font-size: 14px;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.leaderboard-table th, .leaderboard-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
  font-size: 14px;
}

.leaderboard-table th {
  font-weight: 800;
  color: #475569;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.06em;
}

.leaderboard-table tbody tr:first-child td {
  background: #fef3c7;
  font-weight: 800;
}

.achievement-toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #422006;
  padding: 14px 20px;
  border-radius: 16px;
  display: none;
  align-items: center;
  gap: 14px;
  box-shadow: 0 14px 30px rgba(0,0,0,0.3);
  z-index: 1100;
  font-weight: 800;
  border: 2px solid #b45309;
  max-width: 360px;
}

.achievement-toast.show {
  display: flex;
  animation: ach-slide 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes ach-slide {
  0%   { transform: translateX(120%) scale(0.8); opacity: 0; }
  100% { transform: translateX(0) scale(1);      opacity: 1; }
}

.achievement-toast .achievement-icon {
  font-size: 38px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.achievement-toast .achievement-name {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.achievement-toast .achievement-desc {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.85;
  margin-top: 2px;
}

.ach-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ach-counter {
  font-weight: 800;
  font-size: 14px;
  color: #b45309;
  background: #fef3c7;
  padding: 4px 12px;
  border-radius: 999px;
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.achievement-tile {
  padding: 16px 12px;
  border-radius: 14px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.achievement-tile.locked {
  opacity: 0.55;
  filter: grayscale(0.85);
}

.achievement-tile.earned {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-color: #f59e0b;
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.25);
}

.achievement-tile.earned:hover {
  transform: translateY(-2px);
}

.achievement-tile .ach-icon {
  font-size: 38px;
  display: block;
  margin-bottom: 6px;
}

.achievement-tile .ach-name {
  font-weight: 900;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #1f2937;
}

.achievement-tile .ach-desc {
  font-size: 12px;
  color: #475569;
  margin-top: 4px;
  font-weight: 600;
  line-height: 1.3;
}


.level-splash {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.level-splash.show {
  display: flex;
  animation: splash-fade 3s ease-out forwards;
}

@keyframes splash-fade {
  0%   { opacity: 0; }
  10%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { opacity: 0; }
}

.ribbon-wrap {
  position: relative;
  text-align: center;
  width: 360px;
  height: 440px;
  display: grid;
  place-items: center;
  animation: ribbon-pop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes ribbon-pop {
  0%   { transform: scale(0.3) rotate(-12deg); opacity: 0; }
  60%  { transform: scale(1.15) rotate(4deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg);    opacity: 1; }
}

.sunburst {
  position: absolute;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background: conic-gradient(from 0deg,
    transparent 0deg, rgba(147,197,253,0.35) 12deg, transparent 24deg,
    transparent 60deg, rgba(255,255,255,0.25) 72deg, transparent 84deg,
    transparent 120deg, rgba(147,197,253,0.35) 132deg, transparent 144deg,
    transparent 180deg, rgba(255,255,255,0.25) 192deg, transparent 204deg,
    transparent 240deg, rgba(147,197,253,0.35) 252deg, transparent 264deg,
    transparent 300deg, rgba(255,255,255,0.25) 312deg, transparent 324deg);
  animation: spin 4s linear infinite;
  z-index: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.ribbon {
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 0 18px rgba(96,165,250,0.7)) drop-shadow(0 14px 24px rgba(0,0,0,0.35));
  animation: ribbon-glow 1s ease-in-out infinite alternate;
}

@keyframes ribbon-glow {
  from { filter: drop-shadow(0 0 14px rgba(96,165,250,0.55)) drop-shadow(0 14px 24px rgba(0,0,0,0.35)); }
  to   { filter: drop-shadow(0 0 32px rgba(191,219,254,1))   drop-shadow(0 14px 24px rgba(0,0,0,0.35)); }
}

.splash-caption {
  position: relative;
  z-index: 2;
  margin-top: 8px;
  color: white;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.sparkle {
  position: absolute;
  font-size: 30px;
  z-index: 1;
  animation: twinkle 1.4s ease-in-out infinite;
  pointer-events: none;
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.7));
}

@keyframes twinkle {
  0%, 100% { transform: scale(0.4) rotate(0deg);  opacity: 0; }
  50%      { transform: scale(1.3) rotate(20deg); opacity: 1; }
}

.sparkle.s1 { top:  10%; left:   8%; animation-delay: 0.0s; font-size: 36px; }
.sparkle.s2 { top:   4%; right: 14%; animation-delay: 0.2s; font-size: 28px; }
.sparkle.s3 { top:  35%; right:  2%; animation-delay: 0.5s; font-size: 32px; }
.sparkle.s4 { top:  60%; left:   2%; animation-delay: 0.7s; font-size: 38px; }
.sparkle.s5 { bottom: 8%; right: 12%; animation-delay: 0.3s; font-size: 30px; }
.sparkle.s6 { bottom: 4%; left:  20%; animation-delay: 0.9s; font-size: 28px; }
.sparkle.s7 { top:  45%; left:  -4%; animation-delay: 1.1s; font-size: 26px; }
.sparkle.s8 { top:  20%; right: -2%; animation-delay: 0.6s; font-size: 32px; }

.scoreboard-wrap {
  display: grid;
  gap: 12px;
  justify-items: end;
}

.hero-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.debug-level-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: #475467;
  font-size: 13px;
  font-weight: 700;
}

.debug-level-panel button {
  background: #ffffff;
  color: #111827;
  border: 1px solid #2563eb;
  border-radius: 999px;
  padding: 6px 10px;
}

.debug-level-panel button:hover {
  background: #eff6ff;
}

.hero-actions form {
  margin: 0;
}

.ghost-btn {
  background: white;
  color: #172033;
  border: 1px solid #d0d5dd;
}

.hero-link,
.resume-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.session-meta {
  margin: 8px 0 0;
  color: #475467;
  font-weight: 700;
}

.meta-divider {
  margin: 0 8px;
  color: #98a2b3;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.login-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(99, 102, 241, 0.16), transparent 30%),
    radial-gradient(circle at bottom right, rgba(22, 163, 74, 0.12), transparent 35%),
    #f4f6fb;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  align-content: center;
  row-gap: 12px;
  padding: 20px;
}

.landing-stack {
  width: min(1160px, 100%);
  display: grid;
  gap: 18px;
}

.landing-hero {
  background:
    radial-gradient(circle at top left, rgba(99, 102, 241, 0.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(34, 197, 94, 0.16), transparent 34%),
    white;
}

.home-hero {
  width: min(1160px, 100%);
  background:
    radial-gradient(circle at left center, rgba(34, 197, 94, 0.14), transparent 24%),
    radial-gradient(circle at right top, rgba(99, 102, 241, 0.18), transparent 26%),
    white;
}

.home-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.home-links {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.home-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  align-items: stretch;
  gap: 28px;
  margin-top: 18px;
}

.home-owl {
  width: 100%;
  height: 100%;
  max-height: 360px;
  object-fit: contain;
}

.home-cta h1 {
  font-size: clamp(42px, 6vw, 72px);
  line-height: 0.95;
  margin: 0;
}

.home-action-row {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.start-giant-btn {
  background: linear-gradient(135deg, #22c55e, #15803d);
  color: white;
  font-size: 26px;
  padding: 20px 34px;
  border-radius: 22px;
  box-shadow: 0 18px 40px rgba(21, 128, 61, 0.28);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border: 0;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
}

.start-giant-btn.start-secondary-btn {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 18px 40px rgba(29, 78, 216, 0.28);
}

.start-giant-btn:hover {
  transform: translateY(-1px);
}

.resume-row {
  width: min(1160px, 100%);
  margin-bottom: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.resume-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #22c55e, #15803d);
  color: white;
  text-decoration: none;
  padding: 14px 24px;
  border-radius: 999px;
  font-size: 16px;
  box-shadow: 0 12px 28px rgba(21, 128, 61, 0.24);
}

.resume-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(21, 128, 61, 0.32);
}

.resume-pill-label {
  font-weight: 500;
  opacity: 0.9;
}

.resume-pill-divider {
  opacity: 0.55;
}

.resume-pill-class {
  font-weight: 500;
  opacity: 0.9;
}

.resume-pill-cta {
  margin-left: 6px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.resume-switch-form {
  margin: 0;
}

.small-side-btn {
  padding: 12px 16px;
}

.hero-logo {
  width: 120px;
  height: 120px;
}

.login-stack {
  width: min(980px, 100%);
  display: grid;
  gap: 18px;
}

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

.path-card {
  display: grid;
  align-content: start;
  gap: 12px;
}

.login-card {
  width: min(460px, 100%);
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.login-form label {
  display: grid;
  gap: 8px;
  font-weight: 700;
  color: #344054;
}

.form-error {
  background: #fef2f2;
  color: #b42318;
  border: 1px solid #fecdca;
  padding: 12px 14px;
  border-radius: 14px;
  margin-top: 16px;
  font-weight: 700;
}

.landing-error {
  margin-top: 18px;
}

.resume-banner {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #eef6ff;
  border: 1px solid #c7d7fe;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.resume-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.resume-actions form {
  margin: 0;
}

.hero-copy {
  margin: 10px 0 0;
  max-width: 720px;
  color: #475467;
  line-height: 1.6;
}

.compact-form {
  gap: 12px;
}

.inline-action {
  margin: 0;
}

.secondary-btn {
  background: #0f766e;
}

.roster-box {
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid #e5e7eb;
}

.student-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.student-chip-grid form {
  margin: 0;
}

.student-chip {
  background: #eef2ff;
  color: #312e81;
  border: 1px solid #c7d2fe;
  padding: 10px 14px;
}

.top-gap {
  margin-top: 14px;
}

.info-card h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.info-copy {
  color: #475467;
  line-height: 1.6;
  margin-bottom: 18px;
}

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

.info-list {
  margin: 0;
  padding-left: 20px;
  color: #344054;
  line-height: 1.6;
}

.info-list li + li {
  margin-top: 6px;
}

.coverage-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 18px;
  align-items: start;
}

.coverage-row > .info-card {
  margin: 0;
}

.level-list {
  list-style: none;
  padding-left: 0;
  margin-top: 12px;
}

.level-list li {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
  padding: 6px 4px;
  border-bottom: 1px solid rgba(99, 102, 241, 0.12);
}

.level-list li:last-child {
  border-bottom: none;
}

.level-list li + li {
  margin-top: 0;
}

.level-name {
  font-weight: 600;
  color: #1e293b;
}

.level-chip {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  border: 0;
  border-radius: 999px;
  padding: 6px 0;
  width: 96px;
  box-sizing: border-box;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 14px rgba(29, 78, 216, 0.22);
  cursor: pointer;
  text-align: center;
}

.level-list .inline-action {
  flex: 0 0 96px;
}

.level-chip:hover {
  background: linear-gradient(135deg, #1e40af, #1e3a8a);
  transform: translateY(-1px);
}

.teacher-app {
  max-width: 1100px;
}

.created-banner {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border: 2px solid #10b981;
}

.created-code-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.created-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 44px;
  font-weight: 800;
  letter-spacing: 0.18em;
  background: white;
  border: 2px dashed #10b981;
  border-radius: 14px;
  padding: 10px 24px;
  color: #064e3b;
}

.field-hint {
  font-weight: 400;
  color: #64748b;
  font-size: 12px;
}

.teacher-hero {
  align-items: flex-start;
}

.teacher-summary {
  display: grid;
  gap: 8px;
  text-align: right;
  font-weight: 800;
}

.teacher-table td,
.teacher-table th {
  white-space: nowrap;
}

.status-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-pill.ok {
  background: #dcfce7;
  color: #166534;
}

.status-pill.stuck {
  background: #fef3c7;
  color: #b45309;
}

.topic-bars {
  display: grid;
  gap: 14px;
}

.topic-row-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
}

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

.teacher-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #0f766e);
  border-radius: 999px;
}

@media (max-width: 820px) {
  .hero,
  .section-head,
  .timer-wrap,
  .answer-row,
  .actions,
  .topic-row-head {
    flex-direction: column;
    align-items: stretch;
  }

  .brand-lockup,
  .login-brand {
    align-items: flex-start;
  }

  .login-stack {
    width: 100%;
  }

  .landing-stack {
    width: 100%;
  }

  .coverage-row {
    grid-template-columns: 1fr;
  }

  .home-topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .home-stage {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .home-owl {
    width: 60%;
    max-width: 220px;
    height: auto;
    justify-self: center;
  }

  .home-action-row {
    width: 100%;
    align-items: stretch;
  }

  .start-giant-btn,
  .small-side-btn {
    width: 100%;
    justify-content: center;
  }

  .resume-row {
    flex-direction: column;
    align-items: stretch;
  }

  .resume-pill {
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
  }

  .login-card {
    width: 100%;
  }

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

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

  .scoreboard-wrap {
    justify-items: stretch;
  }

  .scoreboard,
  .hero-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .coach-hint-stage,
  .coach-hint-simple {
    grid-template-columns: 1fr;
  }

  .coach-owl-rail {
    justify-content: flex-start;
  }

  .coach-hint-owl {
    width: 150px;
  }

  .coach-bubble::before {
    left: 28px;
    top: -10px;
    border-left: 2px solid #fdba74;
    border-top: 2px solid #fdba74;
    border-bottom: 0;
  }

  #question {
    font-size: 32px;
  }

  .leaderboard-table {
    display: block;
    overflow-x: auto;
  }
}
