:root {
  --ink: #0f172a;
  --muted: #475569;
  --outline: #64748b;
  --outline-soft: #cbd5e1;
  --paper: #f1f5f9;
  --surface: #f8fafc;
  --card: #ffffff;
  --surface-low: #f1f5f9;
  --surface-high: #e2e8f0;
  --primary: #0284c7;
  --primary-deep: #0369a1;
  --primary-soft: #e0f2fe;
  --secondary: #059669;
  --secondary-soft: #d1fae5;
  --tertiary: #4f46e5;
  --amber: #f59e0b;
  --ok: #059669;
  --bad: #ba1a1a;
  --learning: #0284c7;
  --locked: #94a3b8;
  --accent-2: #ea580c;
  --shadow-1: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 20px -6px rgba(15, 23, 42, 0.06);
  --shadow-2: 0 6px 18px -4px rgba(2, 132, 199, 0.16), 0 2px 6px -1px rgba(15, 23, 42, 0.05);
  --radius-card: 1rem;
  --radius-btn: 0.7rem;
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --font-display: "Literata", "Times New Roman", Georgia, serif;
  --rail: 268px;
  --coach: 300px;
  --top-h: 4.1rem;
}

* { box-sizing: border-box; }

html {
  font-size: 15px;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 65% 42% at 8% -5%, #bae6fd 0%, transparent 55%),
    radial-gradient(ellipse 48% 38% at 96% 0%, #a7f3d0 0%, transparent 52%),
    radial-gradient(ellipse 40% 30% at 70% 100%, #e0e7ff 0%, transparent 50%),
    linear-gradient(180deg, #f8fafc 0%, #f1f5f9 45%, #eef2ff 100%);
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 1rem;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  flex-wrap: nowrap;
  flex-shrink: 0;
  min-height: var(--top-h);
}

.brand-block,
.top-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.top-left {
  gap: 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 0;
  text-decoration: none;
}

.brand-logo img {
  display: block;
  height: 3.6rem;
  width: auto;
}

.subject-pill {
  position: relative;
  flex-shrink: 0;
  margin-left: 1.25rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--primary-deep);
  background: var(--primary-soft);
}

.subject-pill::before {
  content: "";
  position: absolute;
  left: -0.75rem;
  top: 18%;
  bottom: 18%;
  width: 1px;
  background: color-mix(in srgb, var(--outline-soft) 90%, transparent);
}

.brand-mark {
  width: 2rem;
  height: 2rem;
  border-radius: 0.65rem;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--primary), var(--primary-deep));
  box-shadow: var(--shadow-2);
  flex-shrink: 0;
}

.brand {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--primary-deep);
  line-height: 1.1;
}

.tagline {
  font-size: 0.65rem;
  color: var(--outline);
  font-weight: 500;
}

.answer-anchor.is-empty {
  display: none;
}

.top-nav {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.nav-item {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  color: var(--muted);
}

.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary-deep);
}

.nav-item.muted { opacity: 0.55; }

.stats {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: wrap;
}

.stat-chip {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink);
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--outline-soft) 80%, transparent);
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  box-shadow: var(--shadow-1);
}

.stat-chip.subtle {
  color: var(--muted);
  background: var(--surface-low);
}

main.layout {
  --tab: 1.35rem;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  display: grid;
  gap: 0.45rem;
  padding: 0.2rem 0.65rem 0.45rem;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.center-stack {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  min-height: 0;
  align-self: stretch;
  overflow: hidden;
}

.practice-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.center-stack .panel.practice-panel {
  padding: 0.4rem 0.7rem 0.45rem;
  background: color-mix(in srgb, var(--card) 97%, transparent);
}

.side-rail {
  display: flex;
  align-items: stretch;
  align-self: stretch;
  max-height: 100%;
  min-height: 0;
}

.map-rail { flex-direction: row; }
.coach-rail { flex-direction: row; }

.rail-content {
  width: var(--rail);
  max-height: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.coach-rail .rail-content {
  width: var(--coach);
  overflow: auto;
}

.rail-toggle {
  flex: 0 0 var(--tab);
  width: var(--tab);
  align-self: center;
  height: 5rem;
  margin: 0;
  padding: 0;
  border-radius: 0.65rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: var(--primary-deep);
  box-shadow: var(--shadow-1);
  cursor: pointer;
  display: grid;
  place-items: center;
  z-index: 2;
}

.rail-toggle:hover {
  background: var(--primary-soft);
  box-shadow: var(--shadow-2);
}

.rail-toggle .chev {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
}

.map-rail .rail-toggle .chev::before { content: "‹‹"; }
.coach-rail .rail-toggle .chev::before { content: "››"; }

main.layout.map-collapsed .map-rail .rail-content { display: none; }
main.layout.map-collapsed .map-rail .rail-toggle .chev::before { content: "››"; }

main.layout.coach-collapsed .coach-rail .rail-content { display: none; }
main.layout.coach-collapsed .coach-rail .rail-toggle .chev::before { content: "‹‹"; }

main.layout.zen-mode .map-rail .rail-content,
main.layout.zen-mode .coach-rail .rail-content {
  display: none;
}

/* Keep center column width identical to both-rails-open layout. */
main.layout.zen-mode {
  grid-template-columns:
    calc(var(--rail) + var(--tab))
    minmax(0, 1fr)
    calc(var(--coach) + var(--tab));
}

main.layout.zen-mode .map-rail {
  justify-content: flex-end;
}

main.layout.zen-mode .coach-rail {
  justify-content: flex-start;
}

main.layout.zen-mode .map-rail .rail-toggle .chev::before { content: "››"; }
main.layout.zen-mode .coach-rail .rail-toggle .chev::before { content: "‹‹"; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.panel {
  background: color-mix(in srgb, var(--card) 96%, transparent);
  border: 1px solid #edf2f7;
  border-radius: var(--radius-card);
  padding: 0.7rem 0.75rem 0.8rem;
  box-shadow: var(--shadow-1);
}

.map-rail .panel.right-rail,
.map-rail .rail-content.panel {
  height: 100%;
  min-height: 0;
}

.rail-head h2,
.coach-head h2,
.skill-heading h1 {
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 0.1rem;
}

.center-stack .skill-heading {
  flex-shrink: 0;
}

.center-stack .skill-heading h1 {
  font-size: 0.95rem;
  margin: 0;
}

.center-stack .skill-heading .lede {
  margin: 0.1rem 0 0;
  font-size: 0.72rem;
  line-height: 1.3;
}

.center-stack .mastery-line {
  margin: 0.15rem 0 0;
  font-size: 0.72rem;
}

.coach-head h2 { font-size: 0.92rem; }

.lede {
  color: var(--muted);
  margin: 0 0 0.45rem;
  line-height: 1.35;
  font-size: 0.78rem;
}

.lede.tight { margin-bottom: 0.4rem; font-size: 0.72rem; }

.mastery-line {
  margin: 0 0 0.45rem;
  font-weight: 700;
  color: var(--secondary);
  font-size: 0.78rem;
}

.skill-progress {
  margin: 0.1rem 0 0;
  padding: 0.15rem 0.1rem 0.05rem;
  border-top: 1px solid color-mix(in srgb, var(--border, #dbe3ee) 80%, transparent);
  flex: 0 0 auto;
}

.skill-progress.hidden { display: none !important; }

.skill-progress-bar {
  display: grid;
  gap: 0.25rem;
}

.skill-progress-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 0.5rem;
  font-size: 0.72rem;
  line-height: 1.25;
  color: var(--ink, #0f172a);
}

.skill-progress-summary-label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--muted);
  font-size: 0.68rem;
}

.skill-progress-summary-count {
  font-weight: 800;
}

.skill-progress-summary-goal {
  color: var(--secondary, #0284c7);
  font-weight: 600;
  min-width: 0;
}

.skill-progress-more {
  margin-top: 0.15rem;
}

.skill-progress-more-summary {
  list-style: none;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  user-select: none;
}

.skill-progress-more-summary::-webkit-details-marker { display: none; }

.skill-progress-more-summary::before {
  content: "▸ ";
  font-size: 0.62rem;
}

.skill-progress-more[open] .skill-progress-more-summary::before { content: "▾ "; }

.skill-heading.is-compact .lede {
  display: none;
}

.skill-progress-track {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.2rem;
  margin: 0.35rem 0 0;
  padding: 0;
}

.skill-progress-seg {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.28rem;
  min-width: 0;
  text-align: center;
}

.skill-progress-dot {
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 999px;
  border: 2px solid color-mix(in srgb, var(--muted) 55%, transparent);
  background: transparent;
  position: relative;
}

.skill-progress-seg::after {
  content: "";
  position: absolute;
  /* connectors drawn via track background instead */
}

.skill-progress-track {
  position: relative;
}

.skill-progress-track::before {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  top: 0.32rem;
  height: 2px;
  background: color-mix(in srgb, var(--muted) 28%, transparent);
  z-index: 0;
}

.skill-progress-seg { position: relative; z-index: 1; }

.skill-progress-seg[data-state="ACHIEVED"] .skill-progress-dot {
  background: var(--secondary, #0284c7);
  border-color: var(--secondary, #0284c7);
}

.skill-progress-seg[data-state="IN_PROGRESS"] .skill-progress-dot {
  background: color-mix(in srgb, var(--secondary, #0284c7) 35%, white);
  border-color: var(--secondary, #0284c7);
}

.skill-progress-seg[data-state="LOCKED"] .skill-progress-dot {
  background: transparent;
}

.skill-progress-mark {
  font-size: 0.62rem;
  line-height: 1;
  color: var(--muted);
}

.skill-progress-seg[data-state="ACHIEVED"] .skill-progress-mark {
  color: var(--secondary, #0284c7);
  font-weight: 700;
}

.skill-progress-label {
  font-size: 0.68rem;
  line-height: 1.2;
  color: var(--muted);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.skill-progress-seg[data-state="ACHIEVED"] .skill-progress-label,
.skill-progress-seg[data-state="IN_PROGRESS"] .skill-progress-label {
  color: var(--ink, #0f172a);
  font-weight: 600;
}

.skill-progress-count {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink, #0f172a);
}

.skill-progress-goal {
  margin: 0.3rem 0 0;
  display: grid;
  gap: 0.12rem;
}

.skill-progress-goal-title {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink, #0f172a);
}

.skill-progress-goal-meta {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--secondary, #0284c7);
}

.skill-progress-goal-hint {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.3;
  color: var(--muted);
}

.skill-progress-goal-btn {
  margin-top: 0.25rem;
  justify-self: start;
  border: 0;
  border-radius: 0.55rem;
  padding: 0.35rem 0.65rem;
  background: color-mix(in srgb, var(--secondary, #0284c7) 14%, white);
  color: var(--secondary, #0284c7);
  font-weight: 700;
  font-size: 0.72rem;
  cursor: pointer;
}

.skill-progress-goal-btn:hover {
  background: color-mix(in srgb, var(--secondary, #0284c7) 22%, white);
}

.skill-progress-goal.hidden,
.skill-progress-goal-btn.hidden,
.skill-progress-review.hidden,
.skill-progress-strengthen.hidden,
.skill-progress-milestone.hidden { display: none; }

.skill-progress-review {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--secondary, #0284c7);
}

.skill-progress-strengthen {
  margin: 0.4rem 0 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ok, #059669);
}

.skill-progress-seg.is-new .skill-progress-dot {
  animation: skill-seg-pop 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}

@keyframes skill-seg-pop {
  0% { transform: scale(0.7); }
  55% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.skill-progress-milestone {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px dashed color-mix(in srgb, var(--muted) 35%, transparent);
}

.skill-progress-milestone-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 800;
}

.skill-progress-milestone-list {
  margin: 0.2rem 0 0;
  padding-left: 0;
  list-style: none;
  font-size: 0.72rem;
  color: var(--muted);
}

.skill-progress-milestone-compact {
  margin: 0;
  line-height: 1.3;
}

.skill-progress-next-skill {
  margin: 0.45rem 0 0;
  font-size: 0.78rem;
}

@media (max-width: 520px) {
  .skill-progress-label { font-size: 0.62rem; }
  .skill-progress-track { gap: 0.2rem; }
}

.map-rail .rail-content {
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.92) 0%, rgba(240, 253, 244, 0.55) 40%, rgba(224, 242, 254, 0.65) 100%);
  border-color: #dbeafe;
  padding: 0.55rem 0.5rem 0.55rem;
}

.map-rail .rail-head {
  flex-shrink: 0;
  padding: 0 0.15rem 0.35rem;
}

.map-rail .lede.tight {
  display: none;
}

.map-topic {
  margin: 0.15rem 0 0;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary-deep);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid #dbeafe;
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map.path-map {
  margin-top: 0.15rem;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.map.path-map > .path-trail {
  height: 100%;
  flex: 1;
}

.path-trail {
  display: flex;
  flex-direction: column-reverse;
  gap: 0.15rem;
  padding: 0.55rem 0.35rem 0.6rem;
  border-radius: 0.9rem;
  border: 1px solid color-mix(in srgb, var(--primary) 14%, #e2e8f0);
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  isolation: isolate;
  flex: 1;
  min-height: 0;
  justify-content: flex-start;
  background-color: #8fad9c;
  background-image:
    linear-gradient(
      180deg,
      rgba(15, 23, 42, 0.08) 0%,
      rgba(255, 255, 255, 0.08) 28%,
      rgba(224, 242, 254, 0.18) 100%
    ),
    url("/static/img/mountain-trail.jpg");
  background-size: cover, cover;
  background-position: center, center 22%;
  background-repeat: no-repeat;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.path-trail::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.2), transparent 18%, transparent 82%, rgba(255, 255, 255, 0.22)),
    linear-gradient(180deg, transparent 70%, rgba(15, 23, 42, 0.12));
  pointer-events: none;
}

.map-title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.map-title-icon {
  font-size: 1.15rem !important;
  line-height: 1;
  color: var(--primary-deep);
}

.path-step {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 0.4rem;
  align-items: stretch;
  min-height: 0;
  flex: 0 0 auto;
  position: relative;
}

/* Few skills: stretch steps so the trail still fills the rail without huge empty bands. */
.path-trail:not(:has(.path-step:nth-child(8))) {
  justify-content: space-evenly;
}
.path-trail:not(:has(.path-step:nth-child(8))) .path-step {
  flex: 1 1 0;
}

.path-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100%;
  position: relative;
  z-index: 1;
}

.path-node {
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 800;
  background: #fff;
  border: 2.5px solid #cbd5e1;
  color: var(--muted);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.path-line {
  width: 4px;
  flex: 1;
  min-height: 0.95rem;
  margin-top: 0.15rem;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(226, 232, 240, 0.85));
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.path-step:first-child .path-line {
  display: none;
}

.path-step.status-mastered .path-node {
  background: linear-gradient(145deg, #34d399, #059669);
  border-color: #047857;
  color: #fff;
}

.path-step.status-mastered .path-line {
  background: linear-gradient(180deg, #34d399, #7dd3fc);
}

.path-step.status-review_due .path-node {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #b45309;
}

.path-step.status-learning .path-node {
  background: #fff;
  border-color: #7dd3fc;
  color: var(--primary-deep);
}

.path-step.status-locked .path-node {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #64748b;
}

.path-step.is-current .path-node {
  width: 1.85rem;
  height: 1.85rem;
  background: linear-gradient(145deg, #38bdf8, #0284c7);
  border: 3px solid #fff;
  color: #fff;
  box-shadow: 0 0 0 3px #0284c7, 0 4px 14px rgba(2, 132, 199, 0.35);
  animation: path-pulse 2.4s ease-in-out infinite;
}

.path-here {
  display: none;
  position: absolute;
  left: 2.35rem;
  top: -0.55rem;
  z-index: 3;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #fff;
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
  white-space: nowrap;
  pointer-events: none;
}

.path-here::after {
  content: "";
  position: absolute;
  left: 0.35rem;
  bottom: -0.28rem;
  border: 0.28rem solid transparent;
  border-top-color: #0284c7;
}

.path-step.is-current .path-here {
  display: inline-block;
}

@keyframes path-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.path-card {
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 0.75rem;
  padding: 0.38rem 0.55rem;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  width: 100%;
  font: inherit;
  color: inherit;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.path-card:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--primary) 45%, transparent);
  box-shadow: var(--shadow-2);
  background: rgba(255, 255, 255, 0.94);
}

.path-card:disabled {
  opacity: 0.78;
  cursor: not-allowed;
  background: rgba(248, 250, 252, 0.58);
  color: var(--locked);
}

.path-step.is-current .path-card {
  border-color: #0284c7;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.18), var(--shadow-1);
  background: rgba(255, 255, 255, 0.95);
  padding-top: 0.55rem;
}

.path-step.status-mastered .path-card {
  border-color: color-mix(in srgb, var(--secondary) 40%, #edf2f7);
}

.path-state {
  display: none;
}

.path-card .title {
  font-weight: 800;
  display: block;
  margin-bottom: 0.05rem;
  font-size: 0.76rem;
  line-height: 1.2;
  color: var(--ink);
}

.path-card .meta {
  font-size: 0.6rem;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.15;
}

.map-legend {
  margin-top: 0.4rem;
  margin-bottom: 0;
  font-size: 0.62rem;
  flex-shrink: 0;
  line-height: 1.25;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  color: var(--muted);
  font-weight: 600;
}

.map-legend .leg::before {
  content: "";
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  margin-right: 0.25rem;
  vertical-align: -0.05rem;
  border: 1.5px solid transparent;
}

.map-legend .leg.done::before {
  background: #10b981;
  border-color: #047857;
}
.map-legend .leg.here::before {
  background: #0ea5e9;
  border-color: #fff;
  box-shadow: 0 0 0 1.5px #0284c7;
}
.map-legend .leg.locked::before {
  background: #e2e8f0;
  border-color: #94a3b8;
}
.map-legend .leg.review::before {
  background: #fef3c7;
  border-color: #f59e0b;
}

.task-box.hidden,
.hidden { display: none !important; }

.task-box {
  background: var(--card);
  border: 1px solid #e8eef5;
  border-radius: var(--radius-card);
  padding: 0.4rem 0.65rem 0.45rem;
  box-shadow: var(--shadow-1);
  position: relative;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.question {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.5vw, 1.95rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
  line-height: 1.25;
  text-align: center;
  padding: 0.35rem 0.4rem 0.4rem;
  border-radius: 0;
  background: transparent;
  border: none;
  font-variant-numeric: tabular-nums;
  color: #0f172a;
  box-shadow: none;
}

.question.has-katex {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 2.4rem;
}

.question .katex {
  font-size: 1.22em;
}

.level {
  font-size: 0.65rem;
  color: var(--primary-deep);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--primary-soft);
  border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
}

.answer-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 0.45rem;
  gap: 0.08rem;
}

.answer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: auto;
  max-width: 100%;
}

.answer-anchor {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

#answer {
  width: 9.5rem;
  max-width: min(42vw, 12rem);
  min-height: 2.2rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.4rem 0.65rem;
  border-radius: 0.55rem;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  text-align: center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.answer-form.is-lang #answer {
  width: min(100%, 13.5rem);
  max-width: 13.5rem;
  border-radius: 999px;
  border-style: solid;
  border-width: 1.5px;
  border-color: color-mix(in srgb, var(--primary) 45%, #cbd5e1);
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(180deg, #e0f2fe, #fff) border-box;
  box-shadow: inset 0 -2px 0 rgba(2, 132, 199, 0.18);
  letter-spacing: 0.02em;
}

.gap-hint {
  margin: 0.1rem 0 0;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.3rem;
  justify-content: center;
}

.primary-actions {
  margin-top: 0.4rem;
  width: 100%;
  flex-wrap: nowrap;
}

.secondary-actions {
  margin-top: 0.2rem;
  width: 100%;
  justify-content: center;
}

.secondary-actions .ghost {
  font-size: 0.74rem;
  padding: 0.3rem 0.6rem;
  opacity: 0.95;
}

.answer-form #check-btn {
  padding: 0.45rem 1rem;
  font-size: 0.86rem;
  box-shadow: 0 4px 12px -2px rgba(2, 132, 199, 0.35);
}

.answer-form #hint-btn .hint-icon {
  color: #ca8a04;
}

.answer-form #example-btn .example-icon {
  color: var(--primary-deep);
}

.material-symbols-outlined {
  font-family: "Material Symbols Outlined" !important;
  font-weight: normal !important;
  font-style: normal;
  font-feature-settings: "liga";
  -webkit-font-feature-settings: "liga";
}

.material-symbols-outlined.filled {
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 20;
}

/* Keep workpad / feedback visually below the hero equation */
.task-arena .workpad {
  margin-top: 0.2rem;
  border-top: 1px dashed #e2e8f0;
  padding-top: 0.15rem;
}

.task-box > .example-box:not(.hidden),
.task-box > .advance-box:not(.hidden) {
  border-top: 1px solid #f1f5f9;
  margin-top: 0.85rem;
  padding-top: 0.65rem;
}

.center-stack button:not(.mode-card):not(.modes-toggle):not(.mode-item) {
  font-size: 0.8rem;
  padding: 0.38rem 0.7rem;
}

.center-stack .btn-with-icon .material-symbols-outlined {
  font-size: 1.05rem;
}

.center-stack #check-btn .material-symbols-outlined {
  font-size: 1.15rem;
}

.feedback {
  min-height: 0;
  margin-top: 0.25rem;
  font-weight: 700;
  font-size: 0.8rem;
}

.feedback:empty {
  display: none;
}

.why-this {
  margin: 0.35rem 0 0.15rem;
  font-size: 0.78rem;
  color: var(--muted, #64748b);
  border: 1px solid rgba(100, 116, 139, 0.25);
  border-radius: 8px;
  padding: 0.25rem 0.55rem;
  background: rgba(248, 250, 252, 0.7);
}

.why-this summary {
  cursor: pointer;
  font-weight: 600;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.why-source {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  border: 1px solid rgba(100, 116, 139, 0.35);
  color: #475569;
  background: rgba(241, 245, 249, 0.9);
}

.why-source[data-source="jev"] {
  color: #0f766e;
  border-color: rgba(13, 148, 136, 0.45);
  background: rgba(204, 251, 241, 0.65);
}

.why-source[data-source="fallback"] {
  color: #b45309;
  border-color: rgba(217, 119, 6, 0.4);
  background: rgba(255, 237, 213, 0.7);
}

.why-source[data-source="assignment"] {
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.4);
  background: rgba(219, 234, 254, 0.75);
}

.why-this-text {
  margin: 0.35rem 0 0.2rem;
  line-height: 1.35;
  font-weight: 500;
}

.task-box::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, #0284c7, #38bdf8 40%, #10b981 85%);
  opacity: 0.9;
  border-radius: var(--radius-card) var(--radius-card) 0 0;
}

.task-arena {
  margin-top: 0.1rem;
  padding: 0.4rem 0.65rem 0.5rem;
  border-radius: 0.85rem;
  border: 1px solid #e8eef5;
  background:
    radial-gradient(ellipse 70% 55% at 100% 0%, rgba(14, 165, 233, 0.05), transparent 55%),
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.task-meta {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.fit-badge {
  font-size: 0.62rem;
  font-weight: 700;
  color: #047857;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
}

.fit-badge::before {
  content: "◎ ";
}

.task-instruction {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.3;
}

/* Language tasks: softer prompt above, hero sentence below */
.task-instruction.is-lang {
  text-align: center;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0;
  margin: 0.2rem 0 0.65rem;
  line-height: 1.55;
  opacity: 0.95;
}

/* Base-form lemma callout in EN instructions: «walk» → highlighted chip */
.en-lemma {
  display: inline-block;
  margin: 0 0.2em;
  padding: 0.14em 0.62em 0.18em;
  border-radius: 0.5rem;
  font-family: var(--font);
  font-size: 1.18em;
  font-weight: 800;
  font-style: normal;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(145deg, #0ea5e9 0%, #0284c7 100%);
  border: 1px solid #0369a1;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.28);
  vertical-align: baseline;
  line-height: 1.25;
}

.equation-stage.is-lang .question {
  font-family: var(--font);
  font-size: clamp(1.2rem, 2.2vw, 1.55rem);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.55;
  text-align: center;
  padding: 1rem 1.1rem;
  background: linear-gradient(180deg, #f0f9ff 0%, #ffffff 70%);
  border: 1px solid #bae6fd;
  border-radius: 0.95rem;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -1px 0 rgba(14, 165, 233, 0.06);
}

.equation-stage {
  margin: 0.1rem 0 0;
  padding: 0.1rem 0 0;
}

.workpad {
  margin: 0.05rem 0 0;
  border-radius: 0.5rem;
}

.workpad.hidden { display: none; }

.workpad-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 0.45rem;
  font-size: 0.68rem;
  line-height: 1.25;
  color: var(--muted);
  user-select: none;
  padding: 0.1rem 0;
}

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

.workpad-summary::before {
  content: "›";
  display: inline-block;
  width: 0.85em;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  color: var(--secondary, #0284c7);
  transform: translateY(0.05em);
}

.workpad[open] .workpad-summary::before {
  transform: rotate(90deg) translateY(0.05em);
}

.workpad-summary-closed,
.workpad-summary-open {
  font-weight: 700;
  color: var(--ink, #0f172a);
}

.workpad-summary-open { display: none; }
.workpad[open] .workpad-summary-closed { display: none; }
.workpad[open] .workpad-summary-open { display: inline; }

.workpad-summary-hint {
  font-weight: 500;
  color: var(--muted);
}

.workpad-text {
  display: block;
  width: 100%;
  margin: 0.15rem 0 0;
  box-sizing: border-box;
  min-height: 1.9rem;
  max-height: 4rem;
  resize: vertical;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  padding: 0.28rem 0.45rem;
  font: inherit;
  font-size: 0.76rem;
  line-height: 1.3;
  color: var(--ink, #0f172a);
  background: #f8fafc;
}

.workpad-text:focus {
  outline: 2px solid color-mix(in srgb, var(--secondary, #0284c7) 35%, transparent);
  outline-offset: 1px;
  background: #fff;
}

.workpad.has-notes .workpad-summary-open::after {
  content: " ·";
  color: var(--secondary, #0284c7);
}

.equation-stage.word-only:not(.is-lang) .question {
  font-family: var(--font);
  font-size: clamp(0.98rem, 1.5vw, 1.18rem);
  font-weight: 700;
  text-align: left;
  padding: 0.65rem 0.8rem;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
}

/* English cloze gap — visual "aukko" in the sentence (non-editable / hunt) */
.en-gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.75rem;
  height: 1.45em;
  margin: 0 0.28rem;
  padding: 0 0.55rem;
  vertical-align: baseline;
  border-radius: 0.45rem 0.45rem 0.2rem 0.2rem;
  border: 1.5px dashed color-mix(in srgb, var(--primary) 55%, #94a3b8);
  border-bottom: 2.5px solid var(--primary);
  background:
    linear-gradient(180deg, rgba(224, 242, 254, 0.55), rgba(255, 255, 255, 0.9));
  box-shadow: inset 0 -1px 0 rgba(2, 132, 199, 0.12);
  color: var(--primary-deep);
  font-weight: 700;
  font-size: 0.72em;
  letter-spacing: 0.08em;
  animation: gap-breathe 2.8s ease-in-out infinite;
}

.en-gap::before {
  content: "···";
  opacity: 0.55;
}

/* Editable cloze gap — type the answer in the sentence */
.en-gap-input {
  display: inline-block;
  box-sizing: border-box;
  min-width: 5.25rem;
  width: 6.5rem;
  max-width: min(42vw, 9.5rem);
  margin: 0 0.28rem;
  padding: 0.12em 0.45rem 0.16em;
  vertical-align: baseline;
  border-radius: 0.45rem 0.45rem 0.2rem 0.2rem;
  border: 1.5px dashed color-mix(in srgb, var(--primary) 55%, #94a3b8);
  border-bottom: 2.5px solid var(--primary);
  background:
    linear-gradient(180deg, rgba(224, 242, 254, 0.65), rgba(255, 255, 255, 0.98));
  box-shadow: inset 0 -1px 0 rgba(2, 132, 199, 0.12);
  color: var(--ink);
  font: inherit;
  font-size: 0.92em;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
  line-height: 1.35;
}

.en-gap-input::placeholder {
  color: color-mix(in srgb, var(--primary) 45%, #94a3b8);
  opacity: 0.7;
  letter-spacing: 0.12em;
}

.en-gap-input:focus {
  outline: none;
  border-style: solid;
  border-color: var(--primary);
  box-shadow:
    inset 0 -1px 0 rgba(2, 132, 199, 0.16),
    0 0 0 3px rgba(14, 165, 233, 0.18);
  background: #fff;
}

.answer-form.has-inline-gap {
  margin-top: 0.55rem;
}

.answer-form.has-inline-gap .answer-row.hidden {
  display: none;
}

/* Light anti-copy on EN prompt/sentence (inputs stay selectable) */
.en-nocopy {
  -webkit-user-select: none;
  user-select: none;
}

.en-nocopy input,
.en-nocopy textarea,
.en-nocopy .en-gap-input {
  -webkit-user-select: text;
  user-select: text;
}

@keyframes gap-breathe {
  0%, 100% {
    box-shadow: inset 0 -1px 0 rgba(2, 132, 199, 0.12), 0 0 0 0 rgba(14, 165, 233, 0);
  }
  50% {
    box-shadow: inset 0 -1px 0 rgba(2, 132, 199, 0.18), 0 0 0 4px rgba(14, 165, 233, 0.12);
  }
}

.mode-badge {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-deep);
  border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
}

.mode-badge.recovery {
  color: #9a3412;
  background: #fff7ed;
  border-color: #fdba74;
}
.mode-badge.challenge {
  color: #065f46;
  background: var(--secondary-soft);
  border-color: #6ee7b7;
}
.mode-badge.memory_check {
  color: #4338ca;
  background: #eef2ff;
  border-color: #a5b4fc;
}
.mode-badge.error_hunt {
  color: #9f1239;
  background: #fff1f2;
  border-color: #fda4af;
}
.mode-badge.compare_solutions {
  color: #075985;
  background: #e0f2fe;
  border-color: #7dd3fc;
}
.mode-badge.worked_example {
  color: #92400e;
  background: #fffbeb;
  border-color: #fcd34d;
}
.mode-badge.prerequisite_review {
  color: #3f6212;
  background: #f7fee7;
  border-color: #a3e635;
}
.mode-badge.boss_challenge {
  color: #9a3412;
  background: #fff7ed;
  border-color: #fdba74;
}
.mode-badge.speed_run {
  color: #065f46;
  background: #ecfdf5;
  border-color: #6ee7b7;
}
.mode-badge.verification {
  color: #0f766e;
  background: #f0fdfa;
  border-color: #5eead4;
}

.seq-progress {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--muted);
}

/* Speed Run digital clock HUD */
.speed-timer {
  --speed-ink: #ecfdf5;
  --speed-glow: #34d399;
  --speed-bezel: #064e3b;
  --speed-panel: #022c22;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0.35rem 0 0.85rem;
  padding: 0.75rem 1rem 0.75rem 0.75rem;
  border-radius: 1.1rem;
  background:
    radial-gradient(ellipse 80% 120% at 10% 50%, rgba(16, 185, 129, 0.22), transparent 55%),
    linear-gradient(135deg, #065f46 0%, #022c22 55%, #0f172a 100%);
  border: 1px solid rgba(52, 211, 153, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 10px 28px -12px rgba(6, 78, 59, 0.55);
  color: var(--speed-ink);
  animation: speed-timer-in 0.35s ease-out;
}
@keyframes speed-timer-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.speed-timer-ring-wrap {
  position: relative;
  width: 7.25rem;
  height: 7.25rem;
  flex-shrink: 0;
}
.speed-timer-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.speed-timer-ring-bg,
.speed-timer-ring-fg {
  fill: none;
  stroke-width: 8;
}
.speed-timer-ring-bg {
  stroke: rgba(167, 243, 208, 0.18);
}
.speed-timer-ring-fg {
  stroke: var(--speed-glow);
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 0;
  filter: drop-shadow(0 0 6px rgba(52, 211, 153, 0.55));
  transition: stroke-dashoffset 0.25s linear, stroke 0.2s ease;
}
.speed-timer-core {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  border-radius: 50%;
  margin: 0.55rem;
  background:
    radial-gradient(circle at 50% 35%, rgba(52, 211, 153, 0.12), transparent 60%),
    var(--speed-panel);
  box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.2);
}
.speed-timer-tag {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: rgba(167, 243, 208, 0.7);
  margin-bottom: 0.05rem;
}
.speed-timer-digits {
  font-family: "Share Tech Mono", ui-monospace, monospace;
  font-size: 1.85rem;
  line-height: 1;
  letter-spacing: 0.04em;
  color: #a7f3d0;
  text-shadow:
    0 0 10px rgba(52, 211, 153, 0.55),
    0 0 2px rgba(236, 253, 245, 0.35);
  font-variant-numeric: tabular-nums;
}
.speed-timer-side {
  min-width: 0;
  display: grid;
  gap: 0.2rem;
}
.speed-timer-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.speed-timer-slot {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(209, 250, 229, 0.88);
}
.speed-timer-hint {
  margin: 0.15rem 0 0;
  font-size: 0.72rem;
  color: rgba(167, 243, 208, 0.65);
}
.speed-timer-dots {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.35rem;
}
.speed-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: rgba(167, 243, 208, 0.22);
  box-shadow: inset 0 0 0 1px rgba(167, 243, 208, 0.25);
}
.speed-dot.done {
  background: #34d399;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.55);
}
.speed-dot.current {
  background: #fbbf24;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.55);
  animation: speed-dot-pulse 1s ease-in-out infinite;
}
@keyframes speed-dot-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}
.speed-timer.is-urgent {
  --speed-glow: #fbbf24;
  border-color: rgba(251, 191, 36, 0.45);
}
.speed-timer.is-urgent .speed-timer-digits {
  color: #fde68a;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.65);
}
.speed-timer.is-urgent .speed-timer-ring-fg {
  stroke: #fbbf24;
  filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.55));
}
.speed-timer.is-critical {
  --speed-glow: #f87171;
  border-color: rgba(248, 113, 113, 0.5);
  animation: speed-timer-in 0.35s ease-out, speed-critical-pulse 0.85s ease-in-out infinite;
}
.speed-timer.is-critical .speed-timer-digits {
  color: #fecaca;
  text-shadow: 0 0 14px rgba(248, 113, 113, 0.75);
}
.speed-timer.is-critical .speed-timer-ring-fg {
  stroke: #f87171;
  filter: drop-shadow(0 0 8px rgba(248, 113, 113, 0.65));
}
.speed-timer.is-critical .speed-timer-hint {
  color: #fecaca;
  font-weight: 700;
}
@keyframes speed-critical-pulse {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 10px 28px -12px rgba(127, 29, 29, 0.45); }
  50% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 0 0 2px rgba(248, 113, 113, 0.35), 0 12px 32px -10px rgba(185, 28, 28, 0.55); }
}
@media (max-width: 640px) {
  .speed-timer {
    gap: 0.75rem;
    padding: 0.65rem;
  }
  .speed-timer-ring-wrap {
    width: 5.8rem;
    height: 5.8rem;
  }
  .speed-timer-digits {
    font-size: 1.45rem;
  }
}

.hunt-steps { display: grid; gap: 0.55rem; margin: 0.35rem 0 0.55rem; }
.hunt-start {
  padding: 0.15rem 0 0.35rem;
  border: none;
  background: transparent;
}
.hunt-start-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--outline);
  margin-bottom: 0.25rem;
}
.hunt-start .eq {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.hunt-choices {
  display: grid;
  gap: 0.45rem;
  padding: 0.75rem;
  border-radius: 0.9rem;
  border: 1px solid #edf2f7;
  background: var(--surface-low);
  max-height: min(42vh, 22rem);
  overflow: auto;
}
.compare-choices {
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .compare-choices {
    grid-template-columns: 1fr 1fr;
  }
}
.compare-option {
  align-items: flex-start;
  min-height: 4.5rem;
  display: flex;
}
.compare-path {
  display: grid;
  gap: 0.25rem;
  text-align: left;
  flex: 1;
}
.compare-path .eq {
  font-size: 0.95rem;
}
.worked-steps {
  display: grid;
  gap: 0.4rem;
  margin: 0.35rem 0 0.55rem;
  padding: 0.75rem;
  border-radius: 0.9rem;
  border: 1px solid #fde68a;
  background: #fffbeb;
  max-height: min(42vh, 22rem);
  overflow: auto;
}
.worked-step {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.35rem 0.45rem;
  border-radius: 0.55rem;
  background: #fff;
  border: 1px solid #fef3c7;
}
.worked-step .idx {
  min-width: 1.2rem;
  font-weight: 800;
  color: #b45309;
  font-size: 0.8rem;
}
.prereq-bridge {
  margin: 0.35rem 0 0.55rem;
  padding: 0;
  border: none;
  background: transparent;
  max-height: none;
  overflow: visible;
}
.prereq-card {
  padding: 0.75rem 0.9rem;
  border-radius: 0.9rem;
  border: 1px solid #bef264;
  background: #f7fee7;
  display: grid;
  gap: 0.35rem;
}
.prereq-card strong {
  font-size: 0.85rem;
  color: #3f6212;
}
.prereq-card p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--ink);
}
.worked-step .label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 0.1rem;
}
.hunt-step {
  text-align: left;
  width: 100%;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  padding: 0.7rem 0.85rem;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  cursor: pointer;
}
.hunt-step:hover { border-color: var(--primary); }
.hunt-step.selected {
  outline: 2px solid color-mix(in srgb, var(--primary) 35%, transparent);
  border-color: var(--primary);
}
.hunt-step .idx {
  display: inline-block;
  min-width: 1.4rem;
  color: var(--muted);
  font-size: 0.85rem;
  margin-right: 0.45rem;
  font-weight: 800;
}
.hunt-cta {
  margin: 0.5rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.mission-bar {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 0.55rem;
  margin-bottom: 0.25rem;
  padding: 0.35rem 0.55rem 0.35rem 0.55rem;
  border-radius: 0.85rem;
  border: 1px solid color-mix(in srgb, var(--primary) 16%, transparent);
  background:
    radial-gradient(ellipse 40% 80% at 100% 50%, rgba(14, 165, 233, 0.08), transparent 55%),
    linear-gradient(180deg, #ffffff, #f0f9ff 130%);
  box-shadow: var(--shadow-1);
  flex-shrink: 0;
}

.mission-body {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  flex: 1;
}

.mission-icon {
  flex-shrink: 0;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 0.55rem;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #e0f2fe, #bae6fd);
  color: var(--primary-deep);
  border: 1px solid #7dd3fc;
}

.mission-icon .material-symbols-outlined {
  font-size: 1.2rem;
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 20;
}

.mission-title-row strong {
  color: var(--primary-deep);
  font-weight: 800;
  font-size: 0.88rem;
}

.mission-sub {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  margin-left: 0.15rem;
}

.mission-top {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
  flex: 1;
}

.mission-title-row {
  display: flex;
  justify-content: flex-start;
  gap: 0.45rem;
  align-items: baseline;
  font-size: 0.78rem;
  flex-wrap: wrap;
}

.mission-title-row #mission-progress {
  margin-left: auto;
  font-weight: 800;
  color: var(--ink);
  font-size: 0.78rem;
}

.mission-segments {
  display: flex;
  gap: 0.28rem;
  width: min(100%, 16rem);
}

.mission-seg {
  flex: 1;
  height: 0.48rem;
  border-radius: 999px;
  background: #e2e8f0;
}

.mission-seg.done { background: linear-gradient(90deg, #10b981, #059669); }
.mission-seg.current { background: linear-gradient(90deg, #38bdf8, #0284c7); }

.mission-cta {
  flex-shrink: 0;
  align-self: center;
}

.mission-peak {
  flex-shrink: 0;
  width: 7.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  padding: 0.1rem 0.2rem;
  border-left: 1px solid #e2e8f0;
}

.mission-peak-art {
  width: 100%;
  height: auto;
  max-height: 2.6rem;
  display: block;
}

.mission-peak-text {
  margin: 0;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--primary-deep);
  text-align: center;
  line-height: 1.2;
}

@media (max-width: 900px) {
  .mission-peak { display: none; }
}

.question .katex-display {
  margin: 0;
}

.math-inline .katex {
  font-size: 1.05em;
}

.answer-anchor .katex {
  font-size: 1.05em;
}

.hunt-start .eq .katex,
.hunt-step .eq .katex {
  font-size: 1.05em;
}

.example-body.example-katex {
  font-family: var(--font);
  white-space: normal;
}

.example-line {
  margin: 0.15rem 0;
  line-height: 1.4;
}

#answer:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.25);
}

button {
  font: inherit;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-btn);
  padding: 0.7rem 1.15rem;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

button:hover:not(:disabled):not(.ghost):not(.mode-card):not(.path-card):not(.progress-link):not(.coach-teaser):not(.text-link):not(.rail-toggle):not(.modes-toggle):not(.bt-action):not(.icon-btn) {
  background: var(--primary-deep);
  box-shadow: var(--shadow-2);
}

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

button.ghost {
  background: #fff;
  color: var(--ink);
  border: 1px solid #e2e8f0;
}

button.ghost:hover:not(:disabled) {
  background: var(--surface-low);
  box-shadow: none;
}

.btn-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.btn-with-icon .material-symbols-outlined {
  font-size: 1.25rem;
  line-height: 1;
}

#check-btn .material-symbols-outlined {
  font-size: 1.35rem;
}

#hint-btn .hint-icon {
  color: #f59e0b;
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 20;
}

#example-btn .example-icon {
  color: #64748b;
}

#coach-btn .coach-icon {
  color: #0284c7;
}

button.icon-btn {
  font-size: 0.82rem;
  padding: 0.45rem 0.8rem;
}

.feedback.ok {
  color: var(--ok);
  animation: feedback-pop 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.feedback.bad { color: var(--bad); }

@keyframes feedback-pop {
  0% { transform: scale(0.96); opacity: 0.4; }
  60% { transform: scale(1.03); opacity: 1; }
  100% { transform: scale(1); }
}

.stat-chip.pop {
  animation: chip-pop 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.25);
}

@keyframes chip-pop {
  0% { transform: scale(1); }
  35% { transform: scale(1.12); box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.25); }
  100% { transform: scale(1); box-shadow: none; }
}

.celebrate-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 80;
  overflow: hidden;
}

.cele-toast {
  position: absolute;
  left: 50%;
  top: 18%;
  transform: translateX(-50%) translateY(12px) scale(0.94);
  min-width: min(22rem, calc(100vw - 2rem));
  max-width: 28rem;
  padding: 0.95rem 1.15rem;
  border-radius: 1.1rem;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #dbeafe;
  box-shadow: 0 12px 32px -8px rgba(15, 23, 42, 0.18), 0 2px 8px rgba(2, 132, 199, 0.08);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  opacity: 0;
  animation: cele-toast-in 0.45s ease forwards, cele-toast-out 0.4s ease 2.4s forwards;
}

.cele-toast.kind-level {
  border-color: #6ee7b7;
  background: linear-gradient(135deg, #ecfdf5, #fff 55%);
}

.cele-toast.kind-breakthrough,
.cele-toast.kind-mastery {
  border-color: #fcd34d;
  background: linear-gradient(135deg, #fffbeb, #fff 55%);
}

.cele-toast.kind-badge {
  border-color: #93c5fd;
  background: linear-gradient(135deg, #eff6ff, #fff 55%);
}

.cele-toast.kind-challenge,
.cele-toast.kind-boss {
  border-color: #fdba74;
  background: linear-gradient(135deg, #fff7ed, #fff 55%);
}

.cele-toast .cele-ico {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.85rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: #e0f2fe;
  color: #0369a1;
}

.cele-toast.kind-level .cele-ico { background: #d1fae5; color: #047857; }
.cele-toast.kind-breakthrough .cele-ico,
.cele-toast.kind-mastery .cele-ico { background: #fef3c7; color: #b45309; }
.cele-toast.kind-challenge .cele-ico,
.cele-toast.kind-boss .cele-ico { background: #ffedd5; color: #c2410c; }

.cele-toast .cele-ico .material-symbols-outlined {
  font-size: 1.35rem;
}

.cele-toast .cele-ico .material-symbols-outlined.filled {
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24;
}

.cele-toast .cele-copy strong {
  display: block;
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.cele-toast .cele-copy span {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--muted);
}

@keyframes cele-toast-in {
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

@keyframes cele-toast-out {
  to { opacity: 0; transform: translateX(-50%) translateY(-10px) scale(0.98); }
}

.cele-xp {
  position: absolute;
  font-weight: 800;
  font-size: 1.05rem;
  color: #059669;
  text-shadow: 0 1px 0 rgba(255,255,255,0.8);
  animation: cele-xp-fly 0.95s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  white-space: nowrap;
}

@keyframes cele-xp-fly {
  0% { opacity: 0; transform: translate(-50%, 0) scale(0.7); }
  18% { opacity: 1; transform: translate(-50%, -8px) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -72px) scale(0.9); }
}

.cele-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: cele-dot-burst 0.85s ease-out forwards;
}

@keyframes cele-dot-burst {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.3); }
}

.task-card.flash-ok {
  animation: card-flash-ok 0.7s ease;
}

@keyframes card-flash-ok {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
  35% { box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.28); }
  100% { box-shadow: var(--shadow-1); }
}

.breakthrough-card {
  animation: breakthrough-reveal 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

@keyframes breakthrough-reveal {
  0% { opacity: 0; transform: translateY(8px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .feedback.ok,
  .stat-chip.pop,
  .cele-toast,
  .cele-xp,
  .cele-dot,
  .task-card.flash-ok,
  .breakthrough-card,
  .skill-progress-seg.is-new .skill-progress-dot {
    animation: none !important;
    opacity: 1;
    transform: none;
  }
}

.advance-box,
.example-box,
.breakthrough-box {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 0.9rem;
}

.advance-box {
  border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent);
  background: color-mix(in srgb, var(--ok) 8%, #fff);
}

.example-box {
  border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
  background: color-mix(in srgb, var(--primary) 6%, #fff);
}

.example-title { margin: 0 0 0.4rem; font-weight: 800; }
.example-body {
  margin: 0;
  white-space: pre-wrap;
  font-family: var(--font);
  line-height: 1.45;
}

.breakthrough-box {
  border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent);
  background: #fffbeb;
  font-weight: 800;
}

.advance-msg { margin: 0 0 0.65rem; font-weight: 700; line-height: 1.4; }

.modes-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.2rem;
  margin-top: auto;
  padding-top: 0.35rem;
  border-top: 1px solid #e8eef5;
}

.support-status {
  margin: 0 0 0.15rem;
  padding: 0.35rem 0.45rem;
  border-radius: 0.55rem;
  border: 1px solid #99f6e4;
  background: #f0fdfa;
  color: #115e59;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.3;
}

.support-status.hidden {
  display: none;
}

.modes-bar-body {
  padding: 0;
}

.modes-heading {
  margin: 0 0 0.2rem;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--ink);
}

.modes-heading span {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.62rem;
}

.modes-subheading {
  margin: 0.3rem 0 0.12rem;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted, #64748b);
}

.modes-subheading:first-of-type {
  margin-top: 0;
}

.modes-grid {
  display: grid;
  gap: 0.22rem;
}

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

.modes-grid-challenge {
  grid-template-columns: 1fr;
}

.manual-support {
  margin: 0.2rem 0 0.15rem;
  border: none;
  padding: 0;
}

.manual-support-toggle {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--muted, #64748b);
  padding: 0.2rem 0;
  user-select: none;
}

.manual-support-toggle::-webkit-details-marker {
  display: none;
}

.manual-support-toggle::before {
  content: "▸";
  font-size: 0.65rem;
  line-height: 1;
  color: var(--muted, #94a3b8);
}

.manual-support[open] > .manual-support-toggle::before {
  content: "▾";
}

.manual-support-hint {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #94a3b8;
}

.manual-support-note {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--muted, #64748b);
}

.mode-card {
  text-align: left;
  border: 1px solid transparent;
  border-radius: 0.6rem;
  padding: 0.22rem 0.28rem;
  cursor: pointer;
  font: inherit;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.35rem;
  row-gap: 0.02rem;
  min-height: 0;
  min-width: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  position: relative;
  align-content: center;
  align-items: center;
}

.mode-card .mode-icon {
  grid-row: 1 / span 2;
  margin-bottom: 0;
}

.mode-card strong {
  grid-column: 2;
  align-self: end;
}

.mode-card .mode-desc {
  grid-column: 2;
  align-self: start;
}

.mode-icon {
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 0.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0;
  overflow: hidden;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.mode-card:hover:not(:disabled) .mode-icon {
  transform: scale(1.06);
}

.mode-icon .material-symbols-outlined {
  font-family: "Material Symbols Outlined" !important;
  font-size: 1.05rem;
  font-weight: normal !important;
  line-height: 1;
  opacity: 1;
  font-feature-settings: "liga";
  -webkit-font-feature-settings: "liga";
}

.mode-icon .material-symbols-outlined.filled {
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 20;
}

.mode-card.mode-support .mode-icon {
  background: #ccfbf1;
  color: #0f766e;
}

.mode-card.mode-hunt .mode-icon {
  background: #ffe4e6;
  color: #e11d48;
}

.mode-card.mode-compare .mode-icon {
  background: #e0f2fe;
  color: #0284c7;
}

.mode-card.mode-worked .mode-icon {
  background: #fef3c7;
  color: #b45309;
}

.mode-card.mode-prereq .mode-icon {
  background: #ecfccb;
  color: #4d7c0f;
}

.mode-card.mode-boss .mode-icon {
  background: #ffedd5;
  color: #d97706;
}

.mode-card.mode-memory .mode-icon {
  background: #ede9fe;
  color: #7c3aed;
}

.mode-card.mode-speed .mode-icon {
  background: #d1fae5;
  color: #059669;
}

.mode-card:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  filter: brightness(0.98) saturate(1.05);
}

.mode-card.mode-support:hover:not(:disabled) {
  background: #ccfbf1;
  border-color: #5eead4;
  color: #115e59;
}

.mode-card.mode-hunt:hover:not(:disabled) {
  background: #ffe4e6;
  border-color: #fda4af;
  color: #9f1239;
}

.mode-card.mode-compare:hover:not(:disabled) {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #075985;
}

.mode-card.mode-worked:hover:not(:disabled) {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

.mode-card.mode-prereq:hover:not(:disabled) {
  background: #ecfccb;
  border-color: #a3e635;
  color: #3f6212;
}

.mode-card.mode-boss:hover:not(:disabled) {
  background: #ffedd5;
  border-color: #fdba74;
  color: #9a3412;
}

.mode-card.mode-memory:hover:not(:disabled) {
  background: #e0e7ff;
  border-color: #a5b4fc;
  color: #4338ca;
}

.mode-card.mode-speed:hover:not(:disabled) {
  background: #d1fae5;
  border-color: #6ee7b7;
  color: #065f46;
}

.mode-card.is-suggested {
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.25), var(--shadow-1);
}

.mode-card.is-active {
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.45), var(--shadow-1);
  border-color: rgba(15, 118, 110, 0.55);
  filter: saturate(1.08);
}

.mode-card.mode-support.is-active {
  background: #ccfbf1;
  border-color: #2dd4bf;
  color: #115e59;
}

.mode-card.mode-hunt.is-active {
  background: #ffe4e6;
  border-color: #fb7185;
}

.mode-card.mode-compare.is-active {
  background: #e0f2fe;
  border-color: #38bdf8;
}

.mode-card.mode-worked.is-active {
  background: #fef3c7;
  border-color: #fbbf24;
}

.mode-card.mode-prereq.is-active {
  background: #ecfccb;
  border-color: #84cc16;
}

.mode-card.mode-boss.is-active {
  background: #ffedd5;
  border-color: #fb923c;
}

.mode-card.mode-memory.is-active {
  background: #e0e7ff;
  border-color: #818cf8;
}

.mode-card.mode-speed.is-active {
  background: #d1fae5;
  border-color: #34d399;
}

.mode-card:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.mode-card strong {
  font-size: 0.6rem;
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.mode-card .mode-desc {
  font-size: 0.5rem;
  line-height: 1.15;
  color: inherit;
  opacity: 0.85;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mode-kicker {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  font-size: 0.55rem !important;
  font-weight: 800 !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(255,255,255,0.75);
  border-radius: 999px;
  padding: 0.08rem 0.3rem;
  opacity: 1 !important;
}

.mode-card.mode-support {
  background: #f0fdfa;
  border-color: #99f6e4;
  color: #115e59;
}

.mode-card.mode-hunt {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #9f1239;
}

.mode-card.mode-compare {
  background: #f0f9ff;
  border-color: #bae6fd;
  color: #075985;
}

.mode-card.mode-worked {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.mode-card.mode-prereq {
  background: #f7fee7;
  border-color: #d9f99d;
  color: #3f6212;
}

.mode-card.mode-boss {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.mode-card.mode-memory {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #4338ca;
}

.mode-card.mode-speed {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.modes-extra {
  margin-top: 0.3rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.mode-item {
  font-size: 0.85rem;
  padding: 0.55rem 0.85rem;
  border-radius: 0.85rem;
  font-weight: 700;
}

.mode-item.mode-neutral { background: #fff; }

.right-rail {
  width: var(--coach);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  height: 100%;
  min-height: 0;
}

.progress-stack {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  min-height: 0;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.4rem;
}

.progress-head h2 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 800;
}

.text-link {
  border: none;
  background: transparent;
  color: var(--primary-deep);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
}

.stat-card {
  background: #f8fafc;
  border: 1px solid #edf2f7;
  border-radius: 0.55rem;
  padding: 0.28rem 0.38rem;
}

.stat-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.05rem;
}

.stat-icon {
  width: 1rem;
  height: 1rem;
  border-radius: 0.3rem;
  display: grid;
  place-items: center;
  font-size: 0.58rem;
  background: #e0f2fe;
  color: var(--primary-deep);
}

.stat-icon.speed { background: #ffedd5; color: #c2410c; }
.stat-icon.streak { background: #fee2e2; color: #b91c1c; }
.stat-icon.mastery { background: #dbeafe; color: #1d4ed8; }

.stat-delta {
  font-size: 0.55rem;
  font-weight: 800;
  color: var(--secondary);
}

.stat-value {
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.stat-label {
  margin-top: 0.04rem;
  font-size: 0.58rem;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.2;
}

.coach-teaser {
  text-align: left;
  width: 100%;
  border: 1px solid #bfdbfe;
  background: linear-gradient(180deg, #eff6ff, #dbeafe);
  border-radius: 0.7rem;
  padding: 0.4rem 0.5rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
  box-shadow: var(--shadow-1);
}

.coach-teaser:hover {
  box-shadow: var(--shadow-2);
}

.coach-teaser-top {
  display: flex;
  gap: 0.45rem;
  align-items: flex-start;
}

.coach-bot {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid #bfdbfe;
  flex-shrink: 0;
  font-size: 0.85rem;
}

.coach-teaser strong {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
}

.coach-teaser-preview {
  margin: 0.35rem 0 0;
  padding: 0.35rem 0.45rem;
  border-radius: 0.55rem;
  background: rgba(255,255,255,0.85);
  border: 1px solid #dbeafe;
  font-size: 0.7rem;
  line-height: 1.3;
  color: var(--ink);
}

.breakthrough-card {
  border: 1px solid #fde68a;
  background: linear-gradient(180deg, #fffbeb, #fef3c7);
  border-radius: 0.75rem;
  padding: 0.5rem 0.55rem;
  font-weight: 700;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #92400e;
}

.breakthrough-card .bt-title {
  display: block;
  font-size: 0.85rem;
  font-weight: 800;
  margin-bottom: 0.2rem;
}

.breakthrough-card .bt-action {
  margin-top: 0.4rem;
  width: 100%;
  border: 1px solid #fcd34d;
  background: #fff7ed;
  color: #9a3412;
  border-radius: 999px;
  padding: 0.35rem 0.6rem;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.progress-links {
  display: grid;
  gap: 0.28rem;
}

.progress-link {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.4rem;
  align-items: center;
  text-align: left;
  width: 100%;
  border: 1px solid #dbeafe;
  background: #f8fbff;
  border-radius: 0.65rem;
  padding: 0.4rem 0.5rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.progress-link:hover {
  background: #eff6ff;
}

.progress-link strong {
  display: block;
  font-size: 0.75rem;
  font-weight: 800;
}

.progress-link em {
  display: block;
  margin-top: 0.05rem;
  font-style: normal;
  font-size: 0.64rem;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.25;
}

.plink-icon {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 0.4rem;
  display: grid;
  place-items: center;
  background: #dbeafe;
  color: var(--primary-deep);
  font-size: 0.72rem;
}

.plink-chev {
  color: var(--outline);
  font-weight: 800;
}

.coach-focus-panel[hidden] { display: none !important; }

.coach-focus-panel .coach-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.coach-focus-panel .coach-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.right-rail.coach-focus .progress-stack { display: none; }
.right-rail.coach-focus .coach-focus-panel { display: block !important; }

.coach-status {
  margin: 0.08rem 0 0;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--secondary);
  line-height: 1.25;
}

.coach-log {
  margin-top: 0.55rem;
  display: grid;
  gap: 0.65rem;
}

.coach-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  background: var(--surface-low);
  border-radius: 0.85rem;
  padding: 0.85rem 0.9rem;
}

.coach-bubble {
  margin: 0;
  padding: 0.85rem 0.9rem;
  border-radius: 0.85rem;
  background: #fff;
  border: 1px solid #edf2f7;
  box-shadow: var(--shadow-1);
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.coach-bubble.hint {
  background: #fffbeb;
  border-color: #fde68a;
}

.coach-bubble.coach-pending {
  background: linear-gradient(180deg, #e0f2fe 0%, #f0f9ff 100%);
  border-color: #bae6fd;
  color: var(--primary-deep);
  font-weight: 600;
}

.coach-bubble.coach-pending .pending-text {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
}

.coach-bubble.coach-pending .pending-text::after {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  margin-left: 0.35rem;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
  animation: coach-pulse 0.9s ease-in-out infinite;
}

@keyframes coach-pulse {
  0%, 100% { opacity: 0.25; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

.coach-bubble .tag {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--primary-deep);
  margin-bottom: 0.35rem;
}

.pick-hint {
  margin-top: 0.15rem;
}

footer {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 1.35rem 1.75rem;
  color: var(--outline);
  font-size: 0.8rem;
}

@media (max-width: 1100px) {
  html { font-size: 16px; }
  body {
    height: auto;
    min-height: 100vh;
    overflow: auto;
    display: block;
  }
  main.layout {
    grid-template-columns: 1fr;
    flex: none;
    overflow: visible;
    height: auto;
  }
  .side-rail {
    position: static;
    max-height: none;
    height: auto;
  }
  .rail-content,
  .coach-rail .rail-content,
  .right-rail {
    width: 100%;
    max-height: none;
    height: auto;
    overflow: visible;
  }
  .path-trail {
    flex: none;
    justify-content: flex-start;
  }
  .path-step { flex: none; }
  .map-rail { order: 1; }
  .center-stack { order: 2; overflow: visible; }
  .coach-rail { order: 3; }
  main.layout.map-collapsed .map-rail .rail-content { display: none; }
  main.layout.coach-collapsed .coach-rail .rail-content { display: none; }
  .top-nav { display: none; }
  .modes-grid-challenge { grid-template-columns: 1fr; }
  .modes-grid-support-manual { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .answer-row { flex-direction: row; align-items: center; justify-content: center; }
  .answer-anchor { font-size: 1.15rem; }
  #answer { width: 8.5rem; max-width: 70vw; }
  .question { font-size: 1.45rem; }
  .equation-stage.is-lang .question { text-align: center; }
  .cele-toast { top: 12%; }
  .mission-body { flex-wrap: wrap; }
}
