:root {
  color-scheme: light;
  /* Local Material 3-style token map. This is not the official Material Web library. */
  --md-sys-color-primary: #2563eb;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #dbeafe;
  --md-sys-color-on-primary-container: #0b3b8f;
  --md-sys-color-secondary: #00796b;
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-tertiary: #b45309;
  --md-sys-color-error: #b42318;
  --md-sys-color-surface: #fffbff;
  --md-sys-color-surface-container-low: #f7f2fa;
  --md-sys-color-surface-container: #f3edf7;
  --md-sys-color-surface-container-high: #ece6f0;
  --md-sys-color-on-surface: #1d1b20;
  --md-sys-color-on-surface-variant: #49454f;
  --md-sys-color-outline: #79747e;
  --md-sys-color-outline-variant: #cac4d0;
  --md-sys-state-hover: rgba(29, 27, 32, 0.08);
  --md-sys-state-focus: rgba(37, 99, 235, 0.14);
  --md-sys-shape-corner-extra-small: 4px;
  --md-sys-shape-corner-small: 8px;
  --md-sys-shape-corner-medium: 12px;
  --md-sys-shape-corner-large: 16px;
  --md-sys-shape-corner-extra-large: 28px;
  --md-sys-shape-corner-full: 999px;
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-strong: #f8fafc;
  --text: var(--md-sys-color-on-surface);
  --muted: var(--md-sys-color-on-surface-variant);
  --line: var(--md-sys-color-outline-variant);
  --primary: var(--md-sys-color-primary);
  --primary-strong: #1d4ed8;
  --primary-soft: var(--md-sys-color-primary-container);
  --accent: #f59e0b;
  --accent-soft: #fef3c7;
  --success: #15803d;
  --warning: #b45309;
  --danger: var(--md-sys-color-error);
  --focus: #0f172a;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
  --radius: var(--md-sys-shape-corner-large);
  --radius-container: var(--md-sys-shape-corner-extra-large);
  --radius-card: 20px;
  --radius-control: var(--md-sys-shape-corner-large);
  --control-height: 64px;
  --touch-target: 48px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(219, 234, 254, 0.45), rgba(255, 255, 255, 0) 280px),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

.skip-link {
  position: fixed;
  z-index: 100;
  left: 12px;
  top: 12px;
  transform: translateY(-140%);
  padding: 10px 14px;
  border-radius: var(--radius-control);
  background: #111827;
  color: #fff;
  font-weight: 900;
  text-decoration: none;
  transition: transform 120ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

img {
  display: block;
  max-width: 100%;
}

.hidden {
  display: none !important;
}

body[data-access="kid"] .parent-only {
  display: none !important;
}

body:not([data-admin="true"]) .admin-only {
  display: none !important;
}

body[data-access="kid"] .tabs {
  display: flex;
}

.toast {
  position: fixed;
  z-index: 40;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: var(--radius-card);
  background: #111827;
  color: white;
  box-shadow: var(--shadow);
  font-weight: 800;
  transform: translateY(24px);
  opacity: 0;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

.auth-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(330px, 440px);
  gap: 28px;
  align-items: center;
  padding: 32px;
}

.auth-art {
  min-height: min(720px, calc(100vh - 64px));
  display: grid;
  align-content: end;
  gap: 24px;
  padding: clamp(24px, 5vw, 56px);
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.15), rgba(22, 163, 74, 0.12)),
    #eef2ff;
  border: 1px solid var(--line);
  border-radius: var(--radius-container);
  overflow: hidden;
}

.auth-art img {
  width: min(680px, 100%);
  align-self: center;
  justify-self: center;
  border-radius: var(--radius-card);
  box-shadow: 0 22px 70px rgba(30, 41, 59, 0.24);
}

.auth-art h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(2.15rem, 4vw, 4.4rem);
  line-height: 1;
}

.auth-panel,
.tool-panel,
.flashcard {
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--radius-container);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.14), 0 1px 2px rgba(15, 23, 42, 0.1);
}

.auth-panel {
  padding: 26px;
}

.auth-panel h2,
.section-header h2,
.rail-heading h2,
.tool-panel h3 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

label,
.field-label {
  display: grid;
  gap: 6px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.25;
}

input,
select,
textarea {
  min-height: var(--control-height);
  width: 100%;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--radius-control);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  padding: 0 18px;
  outline: none;
  font-size: 1rem;
  line-height: normal;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

textarea {
  min-height: 96px;
  height: auto;
  padding: 16px 18px;
  line-height: 1.45;
  resize: vertical;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--md-sys-color-on-surface-variant) 50%),
    linear-gradient(135deg, var(--md-sys-color-on-surface-variant) 50%, transparent 50%);
  background-position:
    calc(100% - 22px) 50%,
    calc(100% - 16px) 50%;
  background-size:
    6px 6px,
    6px 6px;
  background-repeat: no-repeat;
  padding-right: 48px;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--md-sys-color-on-surface);
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--md-sys-color-primary);
  box-shadow: inset 0 0 0 1px var(--md-sys-color-primary);
}

:focus-visible {
  outline: 3px solid #facc15;
  outline-offset: 3px;
}

button:focus-visible,
.child-button:focus-visible,
.theme-option:focus-visible {
  border-color: var(--md-sys-color-primary);
  box-shadow:
    0 0 0 4px rgba(250, 204, 21, 0.34),
    0 0 0 8px var(--md-sys-state-focus);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--md-sys-color-primary);
  box-shadow:
    inset 0 0 0 1px var(--md-sys-color-primary),
    0 0 0 4px var(--md-sys-state-focus);
}

.auth-panel label + label,
.auth-panel button,
.tool-panel label + label {
  margin-top: 14px;
}

.primary-button,
.secondary-button,
.small-button,
.text-button,
.icon-button,
.tab,
.choice-button,
.help-button {
  min-height: var(--touch-target);
  border: 1px solid transparent;
  border-radius: var(--md-sys-shape-corner-full);
  padding: 10px 18px;
  font-weight: 800;
  letter-spacing: 0;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

.primary-button {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.18);
}

.primary-button:hover {
  background: var(--primary-strong);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
}

.secondary-button,
.small-button,
.help-button {
  background: transparent;
  color: var(--md-sys-color-primary);
  border-color: var(--md-sys-color-outline);
  box-shadow: none;
}

.secondary-button:hover,
.small-button:hover,
.help-button:hover {
  background: rgba(37, 99, 235, 0.08);
}

.text-button {
  width: fit-content;
  justify-self: center;
  background: transparent;
  color: var(--md-sys-color-primary);
  border-color: transparent;
  box-shadow: none;
}

.text-button:hover {
  background: rgba(37, 99, 235, 0.08);
}

.icon-button {
  width: var(--touch-target);
  min-width: var(--touch-target);
  min-height: var(--touch-target);
  padding: 0;
  display: inline-grid;
  place-items: center;
  background: #fff;
  border-color: var(--md-sys-color-outline);
  color: var(--md-sys-color-on-surface-variant);
}

.icon-button span {
  transform: translateY(-1px);
  font-size: 1.2rem;
  line-height: 1;
}

.app-view {
  min-height: 100vh;
}

.topbar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 26px;
  width: 248px;
  min-height: 100vh;
  padding: 28px 18px;
  background: rgba(255, 255, 255, 0.96);
  border-right: 1px solid var(--line);
  box-shadow: 10px 0 30px rgba(15, 23, 42, 0.04);
  backdrop-filter: blur(16px);
}

body[data-access="kid"] .topbar {
  width: 92px;
  padding: 18px 14px;
}

body[data-access="kid"] .brand {
  justify-content: center;
}

body[data-access="kid"] .brand div {
  display: none;
}

.top-actions {
  position: fixed;
  top: 18px;
  right: 24px;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  justify-content: end;
  gap: 12px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: #111827;
  color: #fff;
  font-weight: 900;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.16);
}

.brand div {
  display: grid;
  min-width: 0;
}

.brand span:last-child {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.85rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-summary {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  min-width: 150px;
  padding: 8px 12px 8px 8px;
  border: 2px solid #e5e7eb;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  line-height: 1.1;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.account-summary img {
  grid-row: 1 / 3;
  width: 42px;
  height: 42px;
  object-fit: contain;
}

#family-name {
  max-width: 150px;
  overflow: hidden;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-logout {
  min-height: 26px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--md-sys-color-primary);
  font-size: 0.78rem;
  font-weight: 850;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.account-logout:hover {
  color: var(--primary-strong);
}

.tabs {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: auto;
  border-bottom: 0;
}

.tab {
  position: relative;
  min-height: 58px;
  width: 100%;
  padding: 0 16px;
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  border-radius: 14px;
  border: 2px solid transparent;
  box-shadow: none;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tab.active {
  background: #e0f2fe;
  color: var(--md-sys-color-primary);
  border-color: #7dd3fc;
}

.tab[aria-selected="true"] {
  background: #e0f2fe;
  color: var(--md-sys-color-primary);
}

.tab::after {
  display: none;
}

.tab[aria-selected="true"]::after {
  background: var(--md-sys-color-primary);
}

.tab:hover {
  background: rgba(14, 165, 233, 0.12);
}

.workspace {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 20px;
  width: min(1720px, 100%);
  margin: 0 auto;
  padding: 32px 34px 32px 282px;
}

body[data-access="kid"] .workspace {
  padding-left: 126px;
}

body[data-round="active"] .workspace {
  grid-template-columns: minmax(0, 1fr);
  width: min(1500px, 100%);
}

.profile-rail {
  position: sticky;
  top: 24px;
  z-index: 40;
  align-self: start;
  min-height: auto;
  padding: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.96)),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
  overflow: visible;
}

body[data-round="active"] .profile-rail {
  display: none;
}

.rail-heading,
.section-header,
.button-row,
.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rail-heading {
  justify-content: center;
}

.rail-heading h2 {
  display: none;
}

.rail-heading .small-button {
  width: 54px;
  min-width: 54px;
  padding-inline: 0;
}

.child-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  justify-items: center;
}

.child-button {
  position: relative;
  width: 58px;
  height: 58px;
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  gap: 0;
  padding: 4px;
  border: 2px solid var(--line);
  border-radius: 20px;
  background: #fff;
  color: var(--text);
  text-align: center;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

.child-button.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.child-button:hover {
  transform: translateY(-2px);
  background: #f8fafc;
}

.avatar-chip {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #eef2ff;
  color: #1e40af;
  font-weight: 900;
}

.child-button > span:not(.avatar-chip):not(.level-pill) {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  z-index: 80;
  display: grid;
  min-width: 174px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(-6px);
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.child-button:hover > span:not(.avatar-chip):not(.level-pill),
.child-button:focus-visible > span:not(.avatar-chip):not(.level-pill) {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.child-button strong,
.child-button span:not(.avatar-chip) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.child-button span:not(.avatar-chip) {
  color: var(--muted);
  font-size: 0.84rem;
}

.child-button .level-pill {
  position: absolute;
  right: -7px;
  bottom: -8px;
  min-height: 24px;
  padding: 2px 7px;
  font-size: 0.68rem;
  border: 2px solid #fff;
}

.level-pill,
.stat-pill,
.badge-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 5px 10px;
  background: #f1f5f9;
  color: #334155;
  font-size: 0.8rem;
  font-weight: 850;
  white-space: nowrap;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

#math-war-view {
  padding-top: 72px;
}

.math-war-shell {
  display: grid;
  gap: 18px;
}

.math-war-hero,
.math-war-topline,
.math-war-board,
.math-war-results {
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--radius-container);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.math-war-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.5fr);
  gap: 18px;
  align-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(245, 158, 11, 0.18)),
    #ffffff;
}

.math-war-hero h2,
.math-war-topline h2,
.math-war-results h2 {
  margin: 0;
  font-size: clamp(1.65rem, 3vw, 2.8rem);
  line-height: 1;
}

.math-war-mode-grid {
  display: grid;
  gap: 10px;
}

.math-war-mode {
  min-height: 68px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: #fff;
  color: var(--text);
  font-weight: 900;
  text-align: left;
}

.math-war-mode.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.math-war-mode span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.math-war-start {
  display: grid;
  gap: 18px;
}

.math-war-start fieldset {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.math-war-start legend {
  grid-column: 1 / -1;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.math-war-check {
  min-height: 54px;
  display: flex;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface-strong);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 800;
}

.math-war-check input {
  width: 20px;
  height: 20px;
}

.math-war-topline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px;
}

@media (min-width: 981px) {
  .math-war-topline {
    padding-right: 340px;
  }

  .math-war-topline .button-row {
    justify-content: start;
  }
}

.math-war-scoreboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.math-war-scoreboard span {
  min-height: 52px;
  display: grid;
  align-content: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: #fff;
  color: var(--muted);
  font-weight: 800;
}

.math-war-scoreboard strong {
  color: var(--text);
  font-size: 1.25rem;
}

.math-war-board {
  display: grid;
  grid-template-columns: minmax(190px, 0.52fr) minmax(280px, 1fr) minmax(190px, 0.52fr);
  gap: 18px;
  align-items: stretch;
  padding: 18px;
  background:
    radial-gradient(circle at top left, rgba(245, 158, 11, 0.16), transparent 34%),
    radial-gradient(circle at bottom right, rgba(37, 99, 235, 0.14), transparent 32%),
    #ffffff;
}

.war-card {
  height: clamp(320px, 48vw, 560px);
  min-height: 320px;
  max-height: 560px;
  aspect-ratio: 2.5 / 3.5;
  width: 100%;
  max-width: 400px;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  align-items: center;
  justify-items: center;
  padding: 16px;
  border: 2px solid #111827;
  border-radius: 18px;
  background: #fff;
  color: #111827;
  box-shadow: 0 16px 28px rgba(15, 23, 42, 0.16);
}

.math-war-board .war-card:first-child {
  justify-self: end;
}

.math-war-board .war-card:last-child {
  justify-self: start;
}

.war-card.red {
  color: #dc2626;
}

.war-card span,
.war-card small {
  color: var(--muted);
  font-weight: 900;
}

.war-card strong {
  font-size: clamp(3.2rem, 8vw, 5.8rem);
  line-height: 1;
}

.war-card em {
  font-size: 2.5rem;
  font-style: normal;
}

.math-war-problem-panel {
  display: grid;
  gap: 14px;
  align-content: center;
  padding: 18px;
  border-radius: var(--radius-container);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
}

.math-war-timer {
  height: 16px;
  overflow: hidden;
  border-radius: var(--md-sys-shape-corner-full);
  background: #e5e7eb;
}

.math-war-timer span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #16a34a, #f59e0b, #dc2626);
  transition: width 180ms linear;
}

.math-war-bot,
.math-war-result {
  margin: 0;
  color: var(--muted);
  font-weight: 900;
}

.math-war-problem-panel h3 {
  margin: 0;
  font-size: clamp(2.6rem, 7vw, 5rem);
  line-height: 1;
  text-align: center;
}

.math-war-read-button {
  justify-self: center;
  min-height: 48px;
  padding-inline: 18px;
}

#math-war-answer-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

#math-war-answer-form input {
  min-height: 72px;
  font-size: 2rem;
  font-weight: 900;
  text-align: center;
}

.math-war-numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.math-war-numpad button {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface-strong);
  color: var(--text);
  font-weight: 900;
}

.math-war-result {
  min-height: 44px;
  display: grid;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius-control);
  border: 2px solid transparent;
  background: var(--accent-soft);
  color: #78350f;
}

.math-war-result-success {
  border-color: #16a34a;
  background: #dcfce7;
  color: #14532d;
}

.math-war-result-fail {
  border-color: #dc2626;
  background: #fee2e2;
  color: #7f1d1d;
}

.math-war-result-neutral {
  border-color: #fde68a;
}

.math-war-results {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.practice-layout {
  display: grid;
  grid-template-columns: minmax(520px, 820px) minmax(300px, 360px);
  gap: 22px 28px;
  align-items: start;
  justify-content: center;
  padding-top: 74px;
}

.learning-column,
.quest-sidebar {
  display: grid;
  gap: 18px;
  align-items: start;
}

.learning-column {
  min-width: 0;
}

.quest-sidebar {
  min-width: 0;
  gap: 16px;
}

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

.mission-tile {
  min-height: 68px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.9)),
    var(--surface);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.mission-tile span,
.mission-tile small {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.mission-tile span {
  font-size: 0.78rem;
}

.mission-tile strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: clamp(1.05rem, 2vw, 1.45rem);
  line-height: 1.1;
}

.mission-tile small {
  margin-top: 2px;
  font-size: 0.72rem;
  line-height: 1.2;
}

#practice-view[data-round="active"] .mission-hud {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  position: sticky;
  top: 92px;
  z-index: 8;
}

#practice-view[data-round="active"] .mission-tile {
  min-height: 70px;
  padding: 10px 12px;
}

#practice-view[data-round="active"] .mission-tile small {
  display: none;
}

.reward-shop {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-container);
  background:
    linear-gradient(135deg, rgba(239, 246, 255, 0.96), rgba(255, 251, 235, 0.82)),
    #fff;
}

#practice-view[data-round="active"] .reward-shop {
  display: none;
}

.shop-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.shop-heading h3 {
  margin: 2px 0 0;
  font-size: 1.35rem;
}

.coin-balance {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border-radius: 999px;
  padding: 6px 12px;
  background: #111827;
  color: #fff;
  font-weight: 900;
  white-space: nowrap;
}

.shop-items {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.shop-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  align-content: space-between;
  min-height: 92px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.36);
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.86);
}

.shop-item strong,
.shop-item p {
  overflow-wrap: anywhere;
}

.shop-item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
}

.theme-stage {
  position: relative;
  min-height: 190px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-container);
  background: #111827;
  box-shadow:
    0 18px 45px rgba(15, 23, 42, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
  isolation: isolate;
  transform: perspective(900px) rotateX(var(--stage-tilt-x, 0deg)) rotateY(var(--stage-tilt-y, 0deg));
  transform-style: preserve-3d;
  transition:
    box-shadow 220ms ease,
    transform 220ms ease;
}

.theme-stage:hover {
  box-shadow:
    0 22px 60px rgba(15, 23, 42, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

#practice-view[data-round="active"] .theme-stage {
  min-height: 120px;
  margin-bottom: -72px;
  opacity: 0.42;
  pointer-events: none;
  transform: none;
}

#practice-view[data-round="active"] .theme-stage img {
  min-height: 120px;
  filter: saturate(1.08) contrast(0.98);
}

#practice-view[data-round="active"] .stage-copy,
#practice-view[data-round="active"] .stage-runner {
  display: none;
}

.theme-stage::before,
.theme-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.theme-stage::before {
  z-index: 1;
  background:
    radial-gradient(circle at var(--stage-shine-x, 74%) var(--stage-shine-y, 24%), rgba(255, 255, 255, 0.28), transparent 24%),
    linear-gradient(90deg, rgba(15, 23, 42, 0.28), rgba(15, 23, 42, 0) 35%, rgba(15, 23, 42, 0.22)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(15, 23, 42, 0.12));
  mix-blend-mode: multiply;
}

.theme-stage::after {
  z-index: 2;
  background: linear-gradient(115deg, transparent 0 34%, rgba(255, 255, 255, 0.28) 46%, transparent 58% 100%);
  opacity: 0.34;
  transform: translateX(-72%);
  animation: stageShine 9s ease-in-out infinite;
}

.theme-stage img {
  position: relative;
  z-index: 0;
  width: 100%;
  height: 100%;
  min-height: 190px;
  border-radius: inherit;
  object-fit: cover;
  filter: saturate(1.08) contrast(1.02);
  transform: scale(1.015);
  transition:
    filter 240ms ease,
    transform 500ms ease;
  animation: sceneDrift 14s ease-in-out infinite alternate;
}

.theme-stage:hover img {
  filter: saturate(1.18) contrast(1.05);
  transform: scale(1.055);
}

.theme-stage.stage-swap img {
  animation: sceneSwap 500ms ease both;
}

.theme-stage[data-art-style="anime"]::before {
  background:
    radial-gradient(circle at var(--stage-shine-x, 74%) var(--stage-shine-y, 24%), rgba(255, 255, 255, 0.34), transparent 20%),
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.18) 0 2px, transparent 2px 18px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(15, 23, 42, 0.08));
  mix-blend-mode: screen;
  opacity: 0.52;
}

.theme-stage[data-art-style="anime"] img {
  filter: saturate(1.22) contrast(1.08);
}

.scene-particles {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  transform: translate(var(--particle-shift-x, 0px), var(--particle-shift-y, 0px));
  transition: transform 220ms ease;
}

.scene-particle {
  position: absolute;
  width: var(--size, 8px);
  height: var(--size, 8px);
  left: var(--x, 50%);
  top: var(--y, 50%);
  border-radius: 999px;
  background: var(--color, rgba(255, 255, 255, 0.78));
  box-shadow: 0 0 18px var(--glow, rgba(255, 255, 255, 0.3));
  opacity: 0.82;
  animation: particleFloat var(--speed, 8s) ease-in-out infinite alternate;
  animation-delay: var(--delay, 0s);
}

.particle-star,
.particle-spark {
  border-radius: 2px;
  clip-path: polygon(50% 0, 61% 34%, 98% 35%, 68% 56%, 79% 91%, 50% 70%, 21% 91%, 32% 56%, 2% 35%, 39% 34%);
}

.particle-diamond {
  border-radius: 3px;
  transform: translate(-50%, -50%) rotate(45deg);
}

.particle-ring {
  background: transparent;
  border: 3px solid var(--color, #fff);
}

.particle-leaf {
  border-radius: 100% 0 100% 0;
  transform: translate(-50%, -50%) rotate(28deg);
}

.particle-pebble {
  border-radius: 45% 55% 50% 42%;
}

.particle-dash {
  width: calc(var(--size, 8px) * 2.4);
  height: max(4px, calc(var(--size, 8px) * 0.42));
  border-radius: 999px;
}

.theme-stage[data-art-style="anime"] .scene-particle {
  animation-name: particleFloatAnime;
}

.stage-runner {
  position: absolute;
  z-index: 4;
  left: clamp(42px, var(--runner-x, 0%), calc(100% - 42px));
  bottom: 28px;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  transform: translateX(-50%);
  transition: left 320ms ease;
}

.stage-runner::before {
  content: "";
  position: absolute;
  right: 34px;
  top: 50%;
  width: 82px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--runner-glow, #93c5fd));
  filter: blur(5px);
  opacity: 0.62;
  transform: translateY(-50%);
  animation: runnerTrail 1.4s ease-in-out infinite;
}

.stage-runner span {
  width: 34px;
  height: 34px;
  border: 5px solid rgba(255, 255, 255, 0.92);
  border-radius: 50% 50% 50% 12px;
  background: var(--runner-color, #2563eb);
  box-shadow:
    0 12px 26px rgba(15, 23, 42, 0.32),
    0 0 22px var(--runner-glow, #93c5fd),
    inset 0 0 0 6px rgba(255, 255, 255, 0.14);
  transform: rotate(-45deg);
  animation: markerPulse 1.4s ease-in-out infinite;
}

.theme-stage[data-art-style="anime"] .stage-runner span {
  border-radius: 40% 50% 50% 14px;
  border-color: #111827;
  box-shadow:
    0 12px 0 rgba(15, 23, 42, 0.24),
    0 0 0 5px rgba(255, 255, 255, 0.74),
    0 0 26px var(--runner-glow, #93c5fd);
}

.stage-copy {
  position: absolute;
  z-index: 5;
  left: 24px;
  bottom: 22px;
  width: min(440px, calc(100% - 48px));
  padding: 16px;
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  box-shadow: 0 12px 35px rgba(15, 23, 42, 0.16);
  backdrop-filter: blur(12px);
}

.stage-copy h2 {
  margin: 0 0 12px;
  font-size: clamp(1.4rem, 2.8vw, 2.4rem);
  line-height: 1.05;
}

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

.progress-line span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #16a34a, #f59e0b, #2563eb);
  background-size: 220% 100%;
  transition: width 260ms ease;
  animation: progressFlow 4s linear infinite;
}

#daily-progress-text {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.learning-map {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 14px;
  scroll-margin-top: 28px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-container);
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 255, 255, 0.85), transparent 26%),
    linear-gradient(135deg, #f8fafc, #eff6ff);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.learning-map::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: calc(var(--radius-container) - 10px);
  background:
    radial-gradient(circle at 12% 78%, rgba(255, 255, 255, 0.56), transparent 16%),
    radial-gradient(circle at 86% 22%, rgba(255, 255, 255, 0.48), transparent 18%);
  pointer-events: none;
}

.learning-map > * {
  position: relative;
  z-index: 1;
}

#practice-view[data-round="active"] .learning-map {
  border-color: rgba(148, 163, 184, 0.42);
  background-blend-mode: screen, normal;
  box-shadow:
    0 18px 44px rgba(15, 23, 42, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.62);
}

.learning-map[data-theme="space"] {
  background:
    radial-gradient(circle at 16% 22%, rgba(255, 255, 255, 0.9), transparent 25%),
    linear-gradient(135deg, #eef2ff, #dbeafe 45%, #f8fafc);
}

.learning-map[data-theme="jungle"] {
  background:
    radial-gradient(circle at 18% 20%, rgba(236, 253, 245, 0.9), transparent 25%),
    linear-gradient(135deg, #ecfdf5, #bbf7d0 48%, #fefce8);
}

.learning-map[data-theme="royal"] {
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 255, 255, 0.92), transparent 25%),
    linear-gradient(135deg, #fdf2f8, #dbeafe 52%, #fef3c7);
}

.learning-map[data-theme="dino"] {
  background:
    radial-gradient(circle at 18% 20%, rgba(254, 243, 199, 0.88), transparent 25%),
    linear-gradient(135deg, #ecfccb, #fde68a 52%, #fed7aa);
}

.learning-map[data-theme="cars"] {
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 255, 255, 0.9), transparent 25%),
    linear-gradient(135deg, #fee2e2, #dbeafe 48%, #fef3c7);
}

.learning-map[data-theme="sports"] {
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 255, 255, 0.9), transparent 25%),
    linear-gradient(135deg, #dbeafe, #dcfce7 52%, #fed7aa);
}

.map-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.map-header h3 {
  margin: 0;
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  line-height: 1.1;
}

.map-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.map-progress {
  display: inline-grid;
  min-height: 38px;
  min-width: 68px;
  place-items: center;
  border-radius: var(--radius-control);
  background: #111827;
  color: #fff;
  font-weight: 900;
}

.map-exit-button {
  min-height: var(--touch-target);
  padding-inline: 16px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
}

.grade-sections {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.grade-section {
  min-height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(148, 163, 184, 0.42);
  border-radius: var(--radius-control);
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
  font-weight: 950;
}

.grade-section.done {
  border-color: rgba(34, 197, 94, 0.58);
  background: rgba(220, 252, 231, 0.82);
  color: #166534;
}

.grade-section.current {
  border-color: var(--primary);
  background: #dbeafe;
  color: #1d4ed8;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.map-route {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, minmax(38px, 50px));
  justify-content: center;
  gap: clamp(2px, 0.4vw, 5px);
  align-items: center;
  width: min(100%, 980px);
  min-height: 92px;
  margin-inline: auto;
  padding: 14px 6px 8px;
}

.map-route::before,
.map-route::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 35px;
  height: 8px;
  border-radius: 999px;
}

.map-route::before {
  background: rgba(148, 163, 184, 0.28);
}

.map-route::after {
  right: auto;
  width: calc(var(--map-progress, 0%) - 3px);
  max-width: calc(100% - 36px);
  background: linear-gradient(90deg, #2563eb, #22c55e, #f59e0b);
  box-shadow: 0 0 18px rgba(37, 99, 235, 0.22);
}

.map-node {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  text-align: center;
  transform: translateY(var(--node-wave, 0));
}

.map-node > span {
  position: relative;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 3px solid #cbd5e1;
  border-radius: 50%;
  background: #fff;
  color: #64748b;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.map-node.done > span .node-number {
  opacity: 0;
}

.map-node.done > span::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 45%;
  width: 10px;
  height: 16px;
  border: solid currentColor;
  border-width: 0 4px 4px 0;
  transform: translate(-50%, -50%) rotate(45deg);
}

.map-node small {
  max-width: 52px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-node.done > span {
  border-color: #16a34a;
  background: #22c55e;
  color: #fff;
}

.map-node.current > span {
  border-color: #2563eb;
  background: #dbeafe;
  color: #1d4ed8;
  animation: mapNodeGlow 1.4s ease-in-out infinite;
  position: relative;
}

.map-node.current > span::after {
  content: "";
  position: absolute;
  inset: -11px;
  border-radius: inherit;
  border: 2px solid rgba(37, 99, 235, 0.18);
  animation: mapGuideRing 1.4s ease-in-out infinite;
}

.map-node.badge-waiting > span,
.map-node.earned > span,
.map-node.gate-node > span {
  border-radius: 32% 32% 50% 50%;
}

.map-node.badge-waiting > span {
  border-color: #f59e0b;
  background: #fff7ed;
  color: #b45309;
}

.map-node.earned > span {
  border-color: #f59e0b;
  background: #facc15;
  color: #713f12;
  box-shadow:
    0 0 0 5px rgba(250, 204, 21, 0.18),
    0 10px 22px rgba(180, 83, 9, 0.18);
}

.map-node.gate-node:not(.earned):not(.badge-waiting) > span {
  border-color: #7c3aed;
  background: #ede9fe;
  color: #5b21b6;
}

.map-node.gate-node.current > span {
  border-color: #7c3aed;
  background: #f5f3ff;
  color: #5b21b6;
}

.memory-map-note {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.34);
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.66);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
}

.memory-map-note strong {
  color: var(--text);
}

.guide-panel {
  display: grid;
  grid-template-columns: 106px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.42);
  border-radius: var(--radius-container);
  background:
    radial-gradient(circle at 8% 20%, rgba(255, 255, 255, 0.92), transparent 28%),
    linear-gradient(135deg, #ffffff, #eff6ff);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
}

body[data-guide="off"] .guide-panel {
  display: none;
}

.guide-character {
  position: relative;
  width: 88px;
  height: 104px;
  justify-self: center;
  background: url("/assets/guide-owl.svg") center / contain no-repeat;
  filter: drop-shadow(0 12px 14px rgba(15, 23, 42, 0.18));
}

.guide-character img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.guide-face,
.guide-body,
.guide-hair,
.guide-tassel,
.guide-glasses,
.guide-beak,
.guide-bow,
.guide-feet,
.guide-pointer {
  position: absolute;
  display: block;
}

.guide-character > span {
  display: none;
}

.guide-body {
  left: 7px;
  top: 22px;
  width: 60px;
  height: 60px;
  border-radius: 42% 42% 30% 30%;
  background:
    linear-gradient(145deg, transparent 0 56%, #2f2f2f 57%),
    #a66a3f;
}

.guide-body::before,
.guide-body::after {
  content: "";
  position: absolute;
  top: 28px;
  width: 30px;
  height: 42px;
  background: #2f2f2f;
  border-radius: 10px 10px 4px 4px;
}

.guide-body::before {
  left: 2px;
  transform: skewX(-10deg);
}

.guide-body::after {
  right: 2px;
  transform: skewX(10deg);
}

.guide-face {
  left: 9px;
  top: 26px;
  width: 56px;
  height: 34px;
  border-radius: 45% 45% 58% 58%;
  background:
    radial-gradient(circle at 28% 48%, #fff 0 16px, transparent 17px),
    radial-gradient(circle at 72% 48%, #fff 0 16px, transparent 17px),
    #c99566;
}

.guide-hair {
  z-index: 4;
  left: 5px;
  top: 4px;
  width: 64px;
  height: 28px;
  background: #111;
  clip-path: polygon(50% 0, 100% 28%, 50% 58%, 0 28%);
}

.guide-hair::after {
  content: "";
  position: absolute;
  left: 34px;
  top: 12px;
  width: 13px;
  height: 8px;
  border-radius: 999px;
  background: #2f2f2f;
}

.guide-tassel {
  z-index: 5;
  left: 18px;
  top: 18px;
  width: 4px;
  height: 24px;
  border-radius: 999px;
  background: #facc15;
}

.guide-tassel::before,
.guide-tassel::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: #facc15;
}

.guide-tassel::before {
  top: 11px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.guide-tassel::after {
  bottom: -8px;
  width: 14px;
  height: 14px;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.guide-glasses {
  z-index: 3;
  left: 8px;
  top: 31px;
  width: 58px;
  height: 28px;
}

.guide-glasses::before,
.guide-glasses::after {
  content: "";
  position: absolute;
  top: -2px;
  width: 28px;
  height: 28px;
  border: 5px solid #dc2626;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 35%, #fff 0 3px, transparent 4px),
    radial-gradient(circle at 54% 56%, #202124 0 10px, transparent 11px),
    #fff;
}

.guide-glasses::before {
  left: 0;
}

.guide-glasses::after {
  right: 0;
}

.guide-beak {
  z-index: 4;
  left: 31px;
  top: 52px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 18px solid #fb923c;
}

.guide-bow {
  z-index: 4;
  left: 25px;
  bottom: 18px;
  width: 24px;
  height: 16px;
}

.guide-bow::before,
.guide-bow::after {
  content: "";
  position: absolute;
  top: 0;
  width: 14px;
  height: 16px;
  background: #111;
}

.guide-bow::before {
  left: 0;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.guide-bow::after {
  right: 0;
  clip-path: polygon(100% 0, 0 50%, 100% 100%);
}

.guide-feet {
  left: 22px;
  bottom: 0;
  width: 31px;
  height: 10px;
}

.guide-feet::before,
.guide-feet::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 15px;
  height: 10px;
  border-radius: 999px 999px 3px 3px;
  background: #fb923c;
}

.guide-feet::before {
  left: 0;
  transform: rotate(12deg);
}

.guide-feet::after {
  right: 0;
  transform: rotate(-12deg);
}

.guide-pointer {
  z-index: 2;
  right: -5px;
  bottom: 22px;
  width: 31px;
  height: 38px;
  border-radius: 6px 28px 28px 8px;
  background: #8b5e34;
  transform: rotate(-20deg);
  transform-origin: left bottom;
}

.guide-pointer::before {
  content: "";
  position: absolute;
  right: 2px;
  top: 4px;
  width: 22px;
  height: 28px;
  border-radius: 5px 24px 24px 5px;
  background: #2f2f2f;
}

.guide-bubble {
  position: relative;
  min-height: 76px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.guide-bubble::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 34px;
  width: 16px;
  height: 16px;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  transform: rotate(45deg);
}

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

.guide-heading .eyebrow {
  margin: 0;
}

#guide-message {
  margin: 0;
  color: var(--text);
  font-size: clamp(0.95rem, 1.3vw, 1.08rem);
  font-weight: 800;
  line-height: 1.35;
}

.guide-panel[data-tone="celebrate"] {
  background:
    radial-gradient(circle at 8% 20%, rgba(254, 243, 199, 0.92), transparent 28%),
    linear-gradient(135deg, #fff7ed, #eff6ff);
}

.guide-panel[data-tone="help"] {
  background:
    radial-gradient(circle at 8% 20%, rgba(254, 249, 195, 0.92), transparent 28%),
    linear-gradient(135deg, #fefce8, #ffffff);
}

.guide-panel[data-tone="focus"] .guide-pointer {
  animation: guidePoint 1.2s ease-in-out infinite;
}

.guide-settings-grid {
  align-items: end;
}

.guide-setting-switch {
  min-height: var(--control-height);
  align-items: center;
  margin: 0;
  padding: 0 2px;
}

.quest-track {
  display: none;
  position: relative;
  grid-template-columns: repeat(var(--track-count, 12), minmax(22px, 1fr));
  gap: 8px;
  align-items: center;
  min-height: 52px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-container);
  background: linear-gradient(90deg, #ffffff, #f8fafc);
  overflow: hidden;
}

.quest-track::before {
  content: "";
  position: absolute;
  left: 24px;
  right: 24px;
  top: 50%;
  height: 4px;
  border-radius: 999px;
  background: #e2e8f0;
  transform: translateY(-50%);
}

.quest-step {
  position: relative;
  z-index: 1;
  width: 28px;
  height: 28px;
  justify-self: center;
  border: 3px solid #cbd5e1;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}

.quest-step.done {
  border-color: #16a34a;
  background: #22c55e;
  animation: stepComplete 420ms ease both;
  animation-delay: calc(var(--step-index, 0) * 22ms);
}

.quest-step.done::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 45%;
  width: 8px;
  height: 13px;
  border: solid #fff;
  border-width: 0 3px 3px 0;
  transform: translate(-50%, -50%) rotate(45deg);
}

.quest-step.current {
  border-color: #2563eb;
  background: #dbeafe;
  box-shadow:
    0 0 0 8px rgba(37, 99, 235, 0.12),
    0 8px 18px rgba(37, 99, 235, 0.18);
  animation: runnerPulse 1.2s ease-in-out infinite;
}

.quest-step.current::before {
  content: "";
  position: absolute;
  inset: -9px;
  border-radius: inherit;
  border: 2px solid rgba(37, 99, 235, 0.28);
  animation: questStepPing 1.4s ease-out infinite;
}

.practice-controls,
.stats-strip,
.form-grid,
.report-grid,
.theme-options {
  display: grid;
  gap: 12px;
}

.practice-controls {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: end;
}

#practice-view[data-round="active"] .practice-controls,
#practice-view[data-round="active"] .stats-strip {
  display: none;
}

#practice-view[data-round="active"] .flashcard {
  min-height: min(620px, calc(100vh - 340px));
}

.stats-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-tile,
.report-tile {
  min-height: 88px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background:
    linear-gradient(180deg, #ffffff, #f8fafc),
    var(--surface);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

.stat-tile:hover,
.report-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.stat-tile span,
.report-tile span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.stat-tile strong,
.report-tile strong {
  display: block;
  margin-top: 6px;
  font-size: 1.42rem;
  line-height: 1.1;
}

.flashcard {
  min-height: 360px;
  display: grid;
  grid-template-rows: auto minmax(88px, auto) 1fr auto auto;
  gap: 16px;
  padding: clamp(18px, 2.2vw, 26px);
  background:
    linear-gradient(180deg, #ffffff, #f8fafc),
    var(--surface);
  transform-origin: center top;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

#read-card-button {
  min-width: 132px;
}

.flashcard.card-enter {
  animation: cardEnter 260ms ease both;
}

.flashcard.correct-pop {
  animation: correctPop 420ms ease both;
  border-color: #86efac;
}

.flashcard.wrong-shake {
  animation: wrongShake 360ms ease both;
  border-color: #fbbf24;
}

.flashcard:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.1);
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--primary-soft);
  color: #1d4ed8;
  font-size: 0.78rem;
  font-weight: 850;
}

.flashcard h3 {
  margin: 0;
  font-size: clamp(1.35rem, 2.5vw, 2.4rem);
  line-height: 1.14;
}

.flashcard h3.math-card-prompt {
  display: grid;
  gap: 12px;
  align-content: start;
  font-size: clamp(1.2rem, 2.2vw, 2rem);
}

.math-prompt-label {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 850;
  text-transform: uppercase;
}

.math-equation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 900;
  line-height: 1.05;
}

.math-times {
  color: var(--muted);
  font-size: 0.72em;
  transform: translateY(0.03em);
}

.math-var {
  display: inline-grid;
  min-width: 1.35em;
  min-height: 1.2em;
  place-items: center;
  padding: 0 0.2em;
  border: 2px solid #93c5fd;
  border-radius: var(--radius-control);
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 950;
}

.math-given {
  width: fit-content;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: var(--touch-target);
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #f8fafc;
  color: var(--text);
  font-size: clamp(1rem, 2vw, 1.3rem);
  font-weight: 900;
}

.math-given .math-var {
  min-width: 1.8em;
  min-height: 1.8em;
  border-width: 1px;
}

.answer-area {
  display: grid;
  gap: 10px;
  align-content: start;
}

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

.choice-button {
  position: relative;
  min-height: 64px;
  padding-right: 44px;
  border-radius: var(--radius-card);
  background: #fff;
  color: #1e293b;
  border-color: #cbd5e1;
  text-align: left;
  overflow-wrap: anywhere;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease,
    box-shadow 140ms ease;
}

.choice-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.choice-button:focus-visible {
  border-color: var(--primary);
  background: #eff6ff;
  transform: translateY(-2px);
  box-shadow:
    0 0 0 4px rgba(250, 204, 21, 0.34),
    0 0 0 8px rgba(37, 99, 235, 0.16),
    0 12px 26px rgba(15, 23, 42, 0.1);
}

.choice-button:active {
  transform: translateY(0) scale(0.99);
}

.choice-button.selected {
  border-color: var(--primary);
  background: #eff6ff;
  color: #1d4ed8;
  transform: translateY(-2px) scale(1.01);
}

.choice-button.reading-choice {
  border-color: #f59e0b;
  background: #fffbeb;
  color: #78350f;
  transform: translateY(-2px) scale(1.012);
  box-shadow:
    0 0 0 5px rgba(250, 204, 21, 0.32),
    0 0 0 10px rgba(245, 158, 11, 0.14),
    0 16px 34px rgba(146, 64, 14, 0.18);
}

.choice-button:disabled {
  opacity: 1;
}

.choice-button[aria-disabled="true"] {
  cursor: default;
}

.choice-button.choice-correct {
  border-color: #16a34a;
  background: #ecfdf5;
  color: #14532d;
  box-shadow:
    0 0 0 4px rgba(34, 197, 94, 0.12),
    0 14px 30px rgba(21, 128, 61, 0.14);
}

.choice-button.choice-correct::before,
.choice-button.choice-correct::after,
.choice-button.choice-missed::after {
  position: absolute;
}

.choice-button.choice-correct::after,
.choice-button.choice-missed::after {
  right: 14px;
  top: 50%;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 900;
  transform: translateY(-50%);
}

.choice-button.choice-correct::before {
  content: "";
  z-index: 1;
  display: block;
  right: 23px;
  top: 50%;
  width: 7px;
  height: 14px;
  border: solid #fff;
  border-width: 0 3px 3px 0;
  transform: translateY(-58%) rotate(45deg);
}

.choice-button.choice-correct::after {
  content: "";
  background: #16a34a;
}

.choice-button.choice-missed {
  border-color: #f59e0b;
  background: #fffbeb;
  color: #7c2d12;
  animation: missNudge 360ms ease both;
}

.choice-button.choice-missed::after {
  content: "!";
  background: #f59e0b;
}

#typed-answer.answer-correct {
  border-color: #16a34a;
  background: #ecfdf5;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12);
}

#typed-answer.answer-needs-help {
  border-color: #f59e0b;
  background: #fffbeb;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.14);
}

.feedback-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-card);
  border: 1px solid #cbd5e1;
  background: #f8fafc;
}

.feedback-panel.correct {
  border-color: #86efac;
  background: #f0fdf4;
}

.feedback-panel strong {
  color: var(--text);
}

.feedback-panel.needs-help {
  border-color: #fde68a;
  background: #fffbeb;
}

.feedback-panel h4,
.feedback-panel p {
  margin: 0;
}

.feedback-economy {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.feedback-economy span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(15, 23, 42, 0.08);
  color: var(--ink);
  font-weight: 850;
  font-size: 0.82rem;
}

.help-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tool-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
  margin-top: 16px;
}

.panel-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading h3 {
  margin: 0;
}

.helper-copy,
.field-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.35;
}

.field-hint {
  margin: 0;
  font-size: 0.76rem;
}

.form-status {
  min-width: min(280px, 100%);
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.3;
}

.form-status.error {
  border-color: #fca5a5;
  background: #fef2f2;
  color: var(--danger);
}

.form-status.success {
  border-color: #86efac;
  background: #f0fdf4;
  color: var(--success);
}

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

.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.switch-row input {
  width: 20px;
  height: 20px;
}

.theme-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 8px;
}

.subject-settings {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #f8fafc;
}

.subject-enable-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}

.subject-toggle {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: #fff;
  font-weight: 850;
}

.subject-toggle input {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
}

.theme-option {
  min-height: 64px;
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 10px;
  background: #fff;
  text-align: left;
}

.theme-option.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.theme-swatch {
  width: 100%;
  height: 8px;
  border-radius: 999px;
}

.theme-option strong {
  overflow-wrap: anywhere;
}

.report-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-top: 16px;
}

.subject-report,
.objective-report,
.library-list {
  display: grid;
  gap: 10px;
}

.library-count {
  margin: 0;
  color: var(--muted);
  font-weight: 850;
}

.subject-row,
.objective-row,
.unit-objective-row,
.library-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #fff;
}

.library-card-main {
  min-width: 0;
}

.subject-row strong,
.objective-row strong,
.unit-objective-row strong,
.library-card strong {
  display: block;
  overflow-wrap: anywhere;
}

.subject-row span,
.objective-row span,
.unit-objective-row span,
.library-card span,
.library-card p,
.email-draft {
  color: var(--muted);
}

.objective-row p,
.unit-objective-row p {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.learning-path-report,
.learning-units-list,
.coverage-gaps-list,
.authoring-task-list,
.unit-objective-list {
  display: grid;
  gap: 12px;
}

.coverage-gaps-summary {
  display: grid;
  gap: 10px;
}

.compact-stat-grid {
  margin: 12px 0;
}

.coverage-gap-objective .objective-mastery-score {
  align-content: start;
}

.objective-mastery-score {
  display: grid;
  justify-items: end;
  gap: 6px;
  min-width: 118px;
}

.objective-mastery-score strong {
  font-size: 1.2rem;
}

.library-card p {
  margin: 6px 0 0;
}

.library-source {
  font-size: 0.82rem;
}

.library-card-details {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.library-card-details summary {
  width: fit-content;
  cursor: pointer;
  color: var(--primary);
  font-weight: 900;
}

.library-card-details dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin: 12px 0 0;
}

.library-card-details div {
  min-width: 0;
  padding: 10px;
  border-radius: var(--radius-control);
  background: #f8fafc;
}

.library-card-details dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.library-card-details dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-weight: 750;
}

.library-card-details a {
  color: var(--primary);
}

.standards-panel {
  display: grid;
  gap: 16px;
}

.standards-filter-row,
.generated-review-filters {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.generated-review-filters {
  grid-template-columns: repeat(4, minmax(140px, 1fr));
}

.generated-review-panel,
.generated-review-list {
  display: grid;
  gap: 12px;
}

.standards-summary,
.standards-coverage-list {
  display: grid;
  gap: 10px;
}

.coverage-audit-panel {
  display: grid;
  gap: 10px;
}

.coverage-audit-card {
  display: grid;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #fff;
}

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

.audit-list {
  display: grid;
  align-content: start;
  gap: 10px;
}

.audit-list h4 {
  margin: 0;
  font-size: 1rem;
}

.audit-objective-row,
.audit-card-row {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: #f8fafc;
}

.audit-objective-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.audit-objective-row.unmapped {
  border-color: #ef4444;
  background: #fef2f2;
}

.audit-objective-row.weak {
  border-color: #f59e0b;
  background: #fffbeb;
}

.audit-objective-row strong,
.audit-card-row strong {
  display: block;
  overflow-wrap: anywhere;
}

.audit-objective-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.bulk-map-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: #eef2ff;
  color: var(--muted);
  font-weight: 850;
}

.unmapped-card-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.audit-card-row {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  cursor: pointer;
}

.audit-card-row input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
}

.audit-card-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 800;
}

.coverage-row {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #fff;
  overflow: hidden;
}

.coverage-row summary {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 12px 12px 46px;
  cursor: pointer;
  list-style: none;
}

.coverage-row summary::-webkit-details-marker {
  display: none;
}

.coverage-row summary::before {
  content: "+";
  position: absolute;
  left: 12px;
  top: 14px;
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--primary);
  font-weight: 1000;
}

.coverage-row[open] summary::before {
  content: "-";
}

.coverage-main {
  display: grid;
  gap: 4px;
}

.coverage-main strong {
  color: var(--text);
  overflow-wrap: anywhere;
}

.coverage-main span {
  color: var(--muted);
  font-weight: 800;
}

.coverage-counts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.warning-pill {
  background: #fef3c7;
  color: #92400e;
}

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

.danger-pill {
  background: #fee2e2;
  color: #991b1b;
}

.coverage-row.weak {
  border-color: #f59e0b;
}

.coverage-row.covered {
  border-color: #bbf7d0;
}

.coverage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 0 12px 12px 46px;
}

.coverage-note {
  color: var(--muted);
  font-weight: 850;
}

.coverage-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0 12px 12px;
}

.coverage-details div {
  min-width: 0;
  padding: 10px;
  border-radius: var(--radius-control);
  background: #f8fafc;
}

.coverage-details dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.coverage-details dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-weight: 750;
}

.mapped-card-panel {
  display: grid;
  gap: 10px;
  margin: 0 12px 12px;
  padding: 12px;
  border-radius: var(--radius-card);
  background: #f8fafc;
}

.muted-panel {
  color: var(--muted);
  font-weight: 850;
}

.mapped-card-heading,
.mapped-card-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.mapped-card-heading span,
.mapped-card p {
  color: var(--muted);
  font-weight: 800;
}

.mapped-card-list {
  display: grid;
  gap: 10px;
}

.mapped-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #fff;
}

.mapped-card.inactive-card {
  border-color: #f59e0b;
  background: #fffbeb;
}

.mapped-card.secondary-map {
  border-style: dashed;
}

.mapped-card p {
  margin: 0;
}

.mapped-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mapped-card-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin: 0;
}

.mapped-card-details div {
  min-width: 0;
  padding: 8px;
  border-radius: var(--radius-control);
  background: #eef2ff;
}

.mapped-card-details dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.mapped-card-details dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-weight: 750;
}

.mapping-edit-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.mapping-edit-row label {
  width: auto;
  min-width: 132px;
}

.mapping-edit-row input[type="number"] {
  min-height: 44px;
}

.checkbox-line {
  display: inline-flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
  min-height: 44px;
  font-weight: 850;
}

.checkbox-line input {
  width: 20px;
  height: 20px;
}

.card-search-panel {
  display: grid;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.template-generate-panel,
.ai-draft-panel {
  display: grid;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.guided-card-panel {
  display: grid;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.guided-objective-context {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-weight: 850;
}

.guided-objective-context span {
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef2ff;
}

.template-generate-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 180px) auto;
  gap: 10px;
  align-items: end;
}

.guided-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.guided-card-grid label:nth-child(5),
.guided-card-grid label:nth-child(7),
.guided-card-grid label:nth-child(9) {
  grid-column: 1 / -1;
}

.guided-active-toggle {
  align-self: end;
}

.card-search-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.card-search-results {
  display: grid;
  gap: 10px;
}

.card-search-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #fff;
}

.card-search-result.inactive-card {
  border-color: #f59e0b;
  background: #fffbeb;
}

.card-search-result strong {
  display: block;
  overflow-wrap: anywhere;
}

.card-search-result p {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.authoring-task-card,
.generated-review-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #fff;
}

.authoring-task-card {
  border-left: 5px solid #2563eb;
}

.authoring-task-card.done-task {
  border-left-color: #16a34a;
  background: #f0fdf4;
}

.generated-review-card.inactive-card {
  border-color: #f59e0b;
  background: #fffbeb;
}

.generated-review-card > p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

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

.generated-edit-grid label:first-child,
.generated-edit-grid label:nth-child(3),
.generated-edit-grid label:nth-child(5) {
  grid-column: 1 / -1;
}

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

.quality-checklist-panel,
.ai-validation-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #f8fafc;
}

.ai-tools-content,
.ai-smoke-results {
  display: grid;
  gap: 12px;
}

.ai-tools-status .source-stat small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 800;
}

.ai-smoke-result {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #f8fafc;
}

.ai-smoke-result.success {
  border-color: #86efac;
  background: #f0fdf4;
}

.ai-smoke-result.error {
  border-color: #fecaca;
  background: #fef2f2;
}

.ai-smoke-result p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.ai-smoke-result pre {
  max-height: 260px;
  margin: 0;
  overflow: auto;
  padding: 12px;
  border-radius: var(--radius-card);
  background: #111827;
  color: #f8fafc;
  font: 800 0.85rem/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.quality-checklist-panel.incomplete {
  border-color: #f59e0b;
  background: #fffbeb;
}

.quality-checklist-panel.complete {
  border-color: #86efac;
  background: #f0fdf4;
}

.ai-validation-result {
  display: grid;
  gap: 8px;
}

.ai-validation-result p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

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

.quality-check-item.optional {
  color: var(--muted);
}

.error-copy {
  color: var(--danger);
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.admin-list,
.admin-user-list,
.admin-child-list {
  display: grid;
  gap: 10px;
}

.admin-row,
.admin-user-card,
.admin-child-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #fff;
}

.admin-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.admin-row strong,
.admin-user-card strong,
.admin-child-row strong {
  display: block;
}

.admin-row span,
.admin-user-card span,
.admin-child-row span {
  color: var(--muted);
}

.admin-user-header,
.admin-child-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.admin-user-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.admin-actions {
  justify-content: flex-start;
}

.danger-button {
  border-color: #fecaca;
  color: #b91c1c;
  background: #fff5f5;
}

.source-summary {
  display: grid;
  gap: 16px;
}

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

.source-stat {
  min-height: 76px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: color-mix(in srgb, var(--primary) 6%, #fff);
}

.source-stat span {
  display: block;
  color: var(--muted);
  font-weight: 850;
  font-size: 0.88rem;
}

.source-stat strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 1.45rem;
}

.grade-coverage,
.source-list {
  display: grid;
  gap: 8px;
}

.grade-coverage {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.grade-coverage span,
.source-row {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #fff;
}

.grade-coverage span {
  padding: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.grade-coverage strong {
  display: block;
  color: var(--primary);
  font-size: 0.92rem;
}

.source-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
}

.source-row strong,
.source-row a {
  color: var(--ink);
}

.source-row p {
  margin: 4px 0 0;
  color: var(--muted);
}

.badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reward-burst {
  position: fixed;
  z-index: 60;
  left: var(--burst-x, 50%);
  top: var(--burst-y, 50%);
  pointer-events: none;
}

.reward-particle {
  position: absolute;
  width: var(--size, 9px);
  height: var(--size, 9px);
  border-radius: 3px;
  background: var(--color, #2563eb);
  transform: translate(-50%, -50%);
  animation: burstParticle 680ms ease-out forwards;
}

.anime-burst .reward-particle {
  filter: drop-shadow(0 0 8px var(--color, #2563eb));
  animation-duration: 820ms;
}

.points-pop {
  position: fixed;
  z-index: 61;
  left: var(--burst-x, 50%);
  top: var(--burst-y, 50%);
  padding: 8px 11px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-weight: 900;
  pointer-events: none;
  animation: pointsPop 760ms ease-out forwards;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.5);
}

.modal-panel {
  width: min(440px, 100%);
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-container);
  background: #fff;
  box-shadow: var(--shadow);
}

.modal-panel h2 {
  margin: 0;
}

@keyframes sceneDrift {
  from {
    transform: scale(1.015) translateX(-4px);
  }
  to {
    transform: scale(1.055) translateX(4px);
  }
}

@keyframes sceneSwap {
  0% {
    opacity: 0.42;
    transform: scale(1.08) translateY(8px);
  }
  100% {
    opacity: 1;
    transform: scale(1.015) translateY(0);
  }
}

@keyframes stageShine {
  0%,
  64% {
    transform: translateX(-72%);
  }
  100% {
    transform: translateX(72%);
  }
}

@keyframes progressFlow {
  to {
    background-position: -220% 0;
  }
}

@keyframes particleFloat {
  from {
    transform: translateY(0) scale(1);
  }
  to {
    transform: translateY(-22px) scale(1.18);
  }
}

@keyframes particleFloatAnime {
  from {
    transform: translateY(0) translateX(0) scale(1) rotate(0deg);
  }
  to {
    transform: translateY(-28px) translateX(calc(var(--drift, 1) * 12px)) scale(1.22) rotate(18deg);
  }
}

@keyframes runnerPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.12);
  }
}

@keyframes mapNodeGlow {
  0%,
  100% {
    box-shadow:
      0 0 0 6px rgba(37, 99, 235, 0.12),
      0 8px 18px rgba(37, 99, 235, 0.18);
    transform: scale(1);
  }
  50% {
    box-shadow:
      0 0 0 12px rgba(37, 99, 235, 0.18),
      0 12px 24px rgba(37, 99, 235, 0.24);
    transform: scale(1.08);
  }
}

@keyframes mapGuideRing {
  0% {
    opacity: 0.72;
    transform: scale(0.82);
  }
  100% {
    opacity: 0;
    transform: scale(1.42);
  }
}

@keyframes guidePoint {
  0%,
  100% {
    transform: rotate(-20deg) translateX(0);
  }
  50% {
    transform: rotate(-20deg) translateX(7px);
  }
}

@keyframes runnerTrail {
  0%,
  100% {
    opacity: 0.42;
    transform: translateY(-50%) scaleX(0.78);
  }
  50% {
    opacity: 0.72;
    transform: translateY(-50%) scaleX(1.08);
  }
}

@keyframes stepComplete {
  0% {
    transform: scale(0.82);
  }
  55% {
    transform: scale(1.18);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes questStepPing {
  0% {
    opacity: 0.72;
    transform: scale(0.82);
  }
  100% {
    opacity: 0;
    transform: scale(1.32);
  }
}

@keyframes markerPulse {
  0%,
  100% {
    transform: rotate(-45deg) scale(1);
  }
  50% {
    transform: rotate(-45deg) scale(1.12);
  }
}

@keyframes missNudge {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  55% {
    transform: translateX(4px);
  }
  78% {
    transform: translateX(-2px);
  }
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes correctPop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.018);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes wrongShake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-7px);
  }
  55% {
    transform: translateX(6px);
  }
  75% {
    transform: translateX(-3px);
  }
}

@keyframes burstParticle {
  to {
    opacity: 0;
    transform: translate(calc(var(--dx) * 1px), calc(var(--dy) * 1px)) rotate(180deg);
  }
}

@keyframes pointsPop {
  0% {
    opacity: 0;
    transform: translate(-50%, 10px) scale(0.92);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -4px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -44px) scale(0.98);
  }
}

body[data-motion="calm"] .theme-stage,
body[data-motion="calm"] .theme-stage img {
  transform: none !important;
}

body[data-motion="calm"] .theme-stage::after,
body[data-motion="calm"] .scene-particles,
body[data-motion="calm"] .stage-runner::before {
  display: none;
}

body[data-motion="calm"] .theme-stage img,
body[data-motion="calm"] .progress-line span,
body[data-motion="calm"] .map-node.current > span,
body[data-motion="calm"] .map-node.current > span::after,
body[data-motion="calm"] .quest-step.current,
body[data-motion="calm"] .quest-step.current::before,
body[data-motion="calm"] .guide-panel[data-tone="focus"] .guide-pointer {
  animation: none !important;
}

body[data-motion="calm"] .map-node.current > span {
  box-shadow:
    0 0 0 8px rgba(37, 99, 235, 0.12),
    0 8px 18px rgba(37, 99, 235, 0.18);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .theme-stage,
  .theme-stage img {
    transform: none !important;
  }

  .theme-stage::after,
  .scene-particles,
  .stage-runner::before {
    display: none !important;
  }
}

@media (max-width: 980px) {
  .auth-view {
    grid-template-columns: 1fr;
  }

  .auth-art {
    min-height: auto;
  }

  .topbar {
    position: sticky;
    inset: 0 0 auto;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 12px;
    width: 100%;
    min-height: auto;
    padding: 12px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  }

  body[data-access="kid"] .topbar {
    width: 100%;
    padding: 12px 14px;
  }

  body[data-access="kid"] .brand div {
    display: grid;
  }

  .tabs {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .tab {
    width: auto;
    min-width: 116px;
    min-height: 48px;
    text-align: center;
  }

  .top-actions {
    position: fixed;
    top: 12px;
    right: 12px;
    gap: 8px;
  }

  .workspace,
  body[data-access="kid"] .workspace {
    grid-template-columns: 1fr;
    padding: 18px;
  }

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

  .profile-rail {
    position: static;
    min-height: auto;
    padding: 16px;
  }

  .rail-heading {
    justify-content: space-between;
  }

  .rail-heading h2 {
    display: block;
  }

  .rail-heading .small-button {
    width: auto;
    min-width: var(--touch-target);
    padding-inline: 18px;
  }

  .child-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-items: stretch;
  }

  .child-button {
    width: 100%;
    height: auto;
    min-height: 72px;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 12px;
    padding: 10px 12px;
    text-align: left;
  }

  .child-button > span:not(.avatar-chip):not(.level-pill) {
    position: static;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  .child-button:hover > span:not(.avatar-chip):not(.level-pill),
  .child-button:focus-visible > span:not(.avatar-chip):not(.level-pill) {
    transform: none;
  }

  .child-button .level-pill {
    position: static;
    border: 0;
  }

  .practice-layout {
    grid-template-columns: 1fr;
    padding-top: 12px;
  }

  #math-war-view {
    padding-top: 82px;
  }

  .math-war-hero,
  .math-war-board {
    grid-template-columns: 1fr;
  }

  .math-war-topline {
    align-items: stretch;
    flex-direction: column;
  }

  .war-card {
    justify-self: center;
    height: clamp(240px, 78vw, 420px);
    min-height: 240px;
  }

  .learning-column,
  .quest-sidebar {
    grid-column: 1;
  }

  .theme-stage,
  .mission-hud,
  .reward-shop,
  .learning-map,
  .guide-panel,
  .quest-track,
  .practice-controls,
  .stats-strip,
  .flashcard {
    grid-column: 1;
    grid-row: auto;
  }

  #practice-view[data-round="active"] .mission-hud {
    position: static;
  }
}

@media (max-width: 700px) {
  .auth-view,
  .workspace {
    padding: 14px;
  }

  .topbar {
    padding: 12px 14px;
  }

  .brand div {
    display: none;
  }

  .top-actions {
    top: 10px;
    right: 10px;
  }

  #access-mode-button {
    min-width: 56px;
    padding-inline: 10px;
    font-size: 0;
  }

  #access-mode-button::before {
    content: "Lock";
    font-size: 0.88rem;
  }

  .account-summary {
    grid-template-columns: 36px minmax(0, 1fr);
    min-width: 138px;
    padding: 6px 10px 6px 6px;
    column-gap: 8px;
  }

  .account-summary img {
    width: 36px;
    height: 36px;
  }

  #family-name {
    max-width: 74px;
  }

  .practice-controls,
  .stats-strip,
  .mission-hud,
  .math-war-scoreboard,
  .form-grid,
  .report-grid,
  .source-stat-grid,
  .grade-coverage,
  .standards-filter-row,
  .generated-review-filters,
  .template-generate-grid,
  .guided-card-grid,
  .card-search-grid,
  .generated-edit-grid,
  .quality-checklist-grid,
  .shop-items,
  .theme-options,
  .child-list,
  .choice-grid {
    grid-template-columns: 1fr;
  }

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

  .coverage-counts {
    justify-content: flex-start;
  }

  .card-search-result,
  .objective-row {
    grid-template-columns: 1fr;
  }

  .objective-mastery-score {
    justify-items: start;
  }

  .audit-columns,
  .audit-objective-row {
    grid-template-columns: 1fr;
  }

  #practice-view[data-round="active"] .mission-hud {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stage-copy {
    left: 12px;
    bottom: 12px;
    width: calc(100% - 24px);
  }

  .quest-track {
    grid-template-columns: repeat(6, minmax(22px, 1fr));
  }

  .learning-map {
    padding: 12px;
  }

  .map-header,
  .memory-map-note {
    align-items: stretch;
    flex-direction: column;
  }

  .map-actions {
    justify-content: space-between;
  }

  .map-exit-button {
    flex: 1;
  }

  .grade-sections {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .map-route {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    row-gap: 14px;
    min-height: 178px;
  }

  .map-route::before,
  .map-route::after {
    display: none;
  }

  .map-node small {
    display: none;
  }

  .guide-panel {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }

  .guide-character {
    width: 70px;
    height: 82px;
    margin-inline: -8px;
    transform: none;
  }

  .guide-face {
    left: 9px;
    top: 26px;
    width: 56px;
    height: 34px;
  }

  .guide-body {
    left: 7px;
    top: 22px;
    width: 60px;
    height: 60px;
  }

  .guide-hair {
    left: 5px;
    top: 4px;
    width: 64px;
    height: 28px;
  }

  .guide-pointer {
    right: -5px;
    bottom: 22px;
    width: 31px;
    height: 38px;
  }

  .guide-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .rail-heading,
  .panel-heading,
  .section-header,
  .button-row,
  .card-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .button-row button,
  .card-actions button,
  .practice-controls button,
  #math-war-answer-form {
    width: 100%;
  }

  #math-war-answer-form {
    grid-template-columns: 1fr;
  }
}
