:root {
  color-scheme: dark;
  --bg: #020617;
  --bg-2: #07111f;
  --surface: rgba(15, 23, 42, 0.76);
  --surface-strong: rgba(15, 23, 42, 0.94);
  --surface-soft: rgba(8, 18, 32, 0.78);
  --ink: #e6f4ff;
  --ink-strong: #ffffff;
  --muted: #9db2ce;
  --muted-2: #6f86a5;
  --line: rgba(125, 211, 252, 0.22);
  --line-strong: rgba(34, 211, 238, 0.54);
  --primary: #22d3ee;
  --primary-strong: #67e8f9;
  --secondary: #f59e0b;
  --mint: #34d399;
  --coral: #fb7185;
  --blue: #60a5fa;
  --violet: #c084fc;
  --focus: #fbbf24;
  --success-bg: rgba(16, 185, 129, 0.14);
  --success-text: #a7f3d0;
  --danger-bg: rgba(244, 63, 94, 0.14);
  --danger-text: #fecdd3;
  --shadow-sm: 0 12px 34px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 24px 72px rgba(0, 0, 0, 0.34);
  --radius-sm: 8px;
  --radius-md: 8px;
  --max: 1280px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  position: relative;
  margin: 0;
  min-height: 100dvh;
  overflow-x: hidden;
  color: var(--ink);
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Segoe UI",
    system-ui,
    sans-serif;
  font-size: 16px;
  line-height: 1.62;
  letter-spacing: 0;
  background:
    linear-gradient(135deg, rgba(34, 211, 238, 0.14), transparent 28%),
    linear-gradient(315deg, rgba(245, 158, 11, 0.12), transparent 34%),
    linear-gradient(180deg, var(--bg), #08111d 58%, #0b1220);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(rgba(125, 211, 252, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(125, 211, 252, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0.26));
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.025) 0,
      rgba(255, 255, 255, 0.025) 1px,
      transparent 1px,
      transparent 5px
    );
  opacity: 0.34;
}

button,
input,
textarea {
  font: inherit;
  max-width: 100%;
}

button {
  min-height: 44px;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

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

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
main:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

svg {
  width: 1.1em;
  height: 1.1em;
  flex: 0 0 auto;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  transform: translateY(-160%);
  opacity: 0;
  pointer-events: none;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #04111d;
  padding: 10px 14px;
  font-weight: 900;
  text-decoration: none;
  transition: transform 180ms var(--ease), opacity 180ms var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.app-shell {
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.88), rgba(8, 18, 32, 0.72)),
    rgba(15, 23, 42, 0.78);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  padding: 10px;
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: max-content;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-strong);
  padding: 8px 10px;
  text-align: left;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(103, 232, 249, 0.42);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(145deg, rgba(34, 211, 238, 0.95), rgba(37, 99, 235, 0.78)),
    #0e7490;
  color: #04111d;
  font-weight: 1000;
  box-shadow:
    0 0 28px rgba(34, 211, 238, 0.34),
    inset 0 -5px 0 rgba(0, 0, 0, 0.18);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1.06rem;
  line-height: 1.2;
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
}

.main-nav {
  display: flex;
  gap: 8px;
  justify-content: center;
  overflow-x: auto;
  scrollbar-width: thin;
  padding: 2px;
}

.nav-button,
.primary-action,
.ghost-action,
.icon-button,
.lesson-button,
.answer-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  transition:
    transform 180ms var(--ease),
    background 180ms var(--ease),
    box-shadow 180ms var(--ease),
    border-color 180ms var(--ease),
    color 180ms var(--ease);
}

.nav-button {
  flex: 0 0 auto;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  padding: 9px 12px;
  font-weight: 800;
}

.nav-button:hover,
.nav-button.active {
  border-color: rgba(34, 211, 238, 0.38);
  background: rgba(34, 211, 238, 0.12);
  color: var(--primary-strong);
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.08);
}

.student-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  border: 1px solid rgba(245, 158, 11, 0.48);
  border-radius: var(--radius-sm);
  background: rgba(245, 158, 11, 0.1);
  padding: 8px 13px;
  color: #fde68a;
  white-space: nowrap;
  box-shadow: 0 0 22px rgba(245, 158, 11, 0.12);
}

.student-chip strong {
  color: #fff7cc;
  font-size: 1.35rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

main {
  min-height: calc(100dvh - 122px);
}

.screen {
  display: none;
}

.screen.active {
  display: block;
  animation: screen-in 260ms var(--ease);
}

.dashboard-band {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 0.82fr);
  gap: 18px;
  margin-bottom: 18px;
}

.today-panel,
.learning-meter,
.panel,
.quiz-card,
.score-panel,
.stage-panel,
.concept-panel,
.subject-panel,
.report-card,
.setting-row,
.badge-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background:
    linear-gradient(145deg, rgba(15, 23, 42, 0.88), rgba(8, 18, 32, 0.74)),
    rgba(15, 23, 42, 0.78);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.today-panel::before,
.module-card::before,
.quiz-card::before,
.stage-panel::before,
.concept-panel::before,
.subject-panel::before,
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background:
    linear-gradient(120deg, rgba(34, 211, 238, 0.2), transparent 26%, rgba(245, 158, 11, 0.12) 76%, transparent),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 34%);
  opacity: 0.75;
}

.today-panel {
  min-height: 304px;
  padding: clamp(26px, 5vw, 56px);
}

.today-panel > * {
  position: relative;
  z-index: 1;
}

.today-panel::after {
  content: "";
  position: absolute;
  right: clamp(18px, 4vw, 56px);
  bottom: 26px;
  width: min(32vw, 260px);
  height: 126px;
  border: 1px solid rgba(34, 211, 238, 0.22);
  background:
    linear-gradient(90deg, transparent 0 14px, rgba(34, 211, 238, 0.14) 14px 16px, transparent 16px 28px),
    linear-gradient(180deg, transparent 0 14px, rgba(34, 211, 238, 0.1) 14px 16px, transparent 16px 28px);
  opacity: 0.62;
  transform: skewX(-12deg);
}

.eyebrow,
.concept-kicker {
  margin: 0 0 8px;
  color: var(--primary-strong);
  font-size: 0.8rem;
  font-weight: 1000;
}

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

h1 {
  max-width: 780px;
  margin-bottom: 24px;
  color: var(--ink-strong);
  font-size: clamp(2.2rem, 5vw, 4.65rem);
  line-height: 1.04;
}

h2 {
  margin-bottom: 8px;
  color: var(--ink-strong);
  font-size: clamp(1.72rem, 3vw, 2.7rem);
  line-height: 1.16;
}

h3 {
  color: var(--ink-strong);
  font-size: 1.26rem;
  line-height: 1.3;
}

.daily-actions,
.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-action,
.ghost-action {
  min-width: 126px;
  padding: 11px 16px;
  font-weight: 900;
}

.primary-action {
  border: 1px solid rgba(103, 232, 249, 0.62);
  background:
    linear-gradient(135deg, rgba(34, 211, 238, 0.95), rgba(37, 99, 235, 0.72)),
    var(--primary);
  color: #03131f;
  box-shadow: 0 12px 28px rgba(34, 211, 238, 0.2);
}

.primary-action:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 16px 38px rgba(34, 211, 238, 0.28);
}

.ghost-action {
  border: 1px solid rgba(148, 163, 184, 0.26);
  background: rgba(15, 23, 42, 0.7);
  color: var(--ink);
}

.ghost-action:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: rgba(34, 211, 238, 0.08);
  color: var(--primary-strong);
}

.learning-meter {
  align-self: stretch;
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 24px;
}

.learning-meter > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #fde68a;
}

.learning-meter strong {
  color: #fff7cc;
  font-size: 2.1rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.meter-track,
.progress-bar {
  height: 10px;
  overflow: hidden;
  border: 1px solid rgba(125, 211, 252, 0.12);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.88);
}

.meter-track span,
.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--mint), var(--secondary));
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.42);
}

.learning-meter p {
  margin-bottom: 0;
  color: var(--muted);
}

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

.module-card {
  position: relative;
  display: grid;
  align-items: start;
  justify-content: stretch;
  min-height: 178px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background:
    linear-gradient(145deg, rgba(15, 23, 42, 0.88), rgba(8, 18, 32, 0.76));
  color: var(--ink);
  padding: 20px;
  text-align: left;
  box-shadow: var(--shadow-sm);
  transform-style: preserve-3d;
}

.module-card > * {
  position: relative;
  z-index: 1;
}

.module-card:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md), 0 0 34px rgba(34, 211, 238, 0.13);
}

.module-card strong,
.module-card p,
.module-number {
  display: block;
}

.module-number {
  margin-bottom: 18px;
  color: var(--primary-strong);
  font-family: "Cascadia Mono", "SFMono-Regular", monospace;
  font-weight: 1000;
}

.module-card strong {
  margin-bottom: 8px;
  color: var(--ink-strong);
  font-size: 1.2rem;
}

.module-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.module-card.featured {
  border-color: rgba(52, 211, 153, 0.36);
  background:
    linear-gradient(145deg, rgba(6, 78, 59, 0.4), rgba(15, 23, 42, 0.88));
}

.module-card.featured-alt {
  border-color: rgba(34, 211, 238, 0.4);
  background:
    linear-gradient(145deg, rgba(14, 116, 144, 0.32), rgba(15, 23, 42, 0.88));
}

.module-card.featured-coding {
  border-color: rgba(192, 132, 252, 0.34);
  background:
    linear-gradient(145deg, rgba(88, 28, 135, 0.28), rgba(15, 23, 42, 0.88));
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 18px;
}

.panel {
  padding: 24px;
}

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

.panel.calm,
.panel.warm {
  background:
    linear-gradient(145deg, rgba(15, 23, 42, 0.86), rgba(8, 18, 32, 0.76));
}

.chat-surface,
.writing-board {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.chat-surface {
  max-height: min(48vh, 520px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}

.chat-bubble {
  max-width: 76%;
  border: 1px solid rgba(125, 211, 252, 0.16);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.chat-bubble.ai {
  justify-self: start;
  background: rgba(34, 211, 238, 0.1);
  color: #d9f7ff;
}

.chat-bubble.is-thinking {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 172px;
  color: #cffafe;
  background:
    linear-gradient(135deg, rgba(34, 211, 238, 0.16), rgba(14, 165, 233, 0.07)),
    rgba(8, 47, 73, 0.35);
}

.thinking-orbit {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(103, 232, 249, 0.22);
  border-top-color: rgba(103, 232, 249, 0.96);
  border-radius: 999px;
  box-shadow: 0 0 14px rgba(34, 211, 238, 0.32);
  animation: thinking-spin 0.9s linear infinite;
}

.thinking-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding-top: 5px;
}

.thinking-dots i {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.35;
  animation: thinking-pulse 1s ease-in-out infinite;
}

.thinking-dots i:nth-child(2) {
  animation-delay: 0.14s;
}

.thinking-dots i:nth-child(3) {
  animation-delay: 0.28s;
}

.primary-action:disabled {
  cursor: wait;
  opacity: 0.72;
}

.chat-bubble.child {
  justify-self: end;
  background: rgba(37, 99, 235, 0.58);
  color: #fff;
}

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

@keyframes thinking-pulse {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.32;
  }

  45% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.input-row,
.setting-row {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.message-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.input-row input,
.writing-board textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(125, 211, 252, 0.22);
  border-radius: var(--radius-sm);
  background: rgba(2, 6, 23, 0.58);
  color: var(--ink);
  padding: 12px 14px;
}

.message-composer input {
  min-width: 0;
}

.writing-board textarea {
  min-height: 180px;
  resize: vertical;
}

.coding-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.65fr);
  gap: 18px;
  align-items: start;
}

.coding-prompt-row textarea,
#codingPrompt {
  width: 100%;
  min-height: 156px;
  border: 1px solid rgba(125, 211, 252, 0.22);
  border-radius: var(--radius-sm);
  background: rgba(2, 6, 23, 0.58);
  color: var(--ink);
  padding: 12px 14px;
  resize: vertical;
}

.block-result {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.block-placeholder {
  border: 1px dashed rgba(125, 211, 252, 0.24);
  border-radius: var(--radius-sm);
  background: rgba(2, 6, 23, 0.28);
  padding: 16px;
  display: grid;
  gap: 10px;
}

.block-placeholder strong {
  color: var(--ink-strong);
}

.block-placeholder p,
.block-placeholder li {
  color: var(--muted);
  margin-bottom: 0;
}

.block-placeholder ul {
  margin: 0;
  padding-left: 1.15rem;
  display: grid;
  gap: 6px;
}

.block-step {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border: 1px solid rgba(125, 211, 252, 0.16);
  border-radius: var(--radius-sm);
  background: rgba(2, 6, 23, 0.42);
  padding: 12px;
}

.block-step > span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(192, 132, 252, 0.36);
  border-radius: var(--radius-sm);
  background: rgba(192, 132, 252, 0.14);
  color: #e9d5ff;
  font-family: "Cascadia Mono", "SFMono-Regular", monospace;
  font-weight: 1000;
}

.block-step strong {
  display: block;
  color: var(--ink-strong);
}

.block-step p {
  margin-bottom: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.coding-save-panel {
  display: grid;
  gap: 14px;
}

.coding-save-panel h3 {
  margin-bottom: 0;
}

.save-programming-button {
  width: 100%;
}

.project-list {
  margin-top: 0;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.panel-actions .primary-action,
.panel-actions .ghost-action {
  min-width: 0;
}

.check-list {
  padding-left: 1.2rem;
}

.check-list li + li {
  margin-top: 10px;
}

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

.work-list span {
  border: 1px solid rgba(125, 211, 252, 0.14);
  border-radius: var(--radius-sm);
  background: rgba(2, 6, 23, 0.4);
  padding: 12px;
  font-weight: 800;
}

.work-list span small {
  color: var(--muted);
  font-weight: 700;
}

.chat-hint,
.result-box {
  border: 1px solid rgba(125, 211, 252, 0.18);
  border-radius: var(--radius-sm);
  background: rgba(2, 6, 23, 0.44);
  color: var(--muted);
  padding: 12px 14px;
}

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

.result-box strong {
  color: var(--ink-strong);
}

.result-box span {
  color: var(--muted);
  font-size: 0.92rem;
}

.result-box.compact {
  min-height: 84px;
}

.result-item {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-top: 1px solid rgba(125, 211, 252, 0.12);
}

.result-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.section-heading {
  max-width: 880px;
  margin: 8px 0 20px;
}

.section-heading p:last-child {
  color: var(--muted);
}

.quiz-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 190px;
  gap: 16px;
  align-items: start;
}

.topic-rail,
.lesson-switcher {
  display: grid;
  gap: 10px;
}

.topic-pill {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(125, 211, 252, 0.18);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.78);
  color: var(--muted);
  padding: 10px 12px;
  font-weight: 900;
}

.topic-pill.active {
  border-color: rgba(52, 211, 153, 0.58);
  background: rgba(16, 185, 129, 0.14);
  color: var(--success-text);
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.1);
}

.quiz-card {
  min-height: 438px;
  padding: clamp(18px, 3vw, 30px);
}

.quiz-card > * {
  position: relative;
  z-index: 1;
}

.quiz-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-family: "Cascadia Mono", "SFMono-Regular", monospace;
  font-weight: 900;
}

.progress-bar {
  margin: 12px 0 22px;
}

#questionText {
  min-height: 68px;
  margin-bottom: 18px;
  color: var(--ink-strong);
  font-size: clamp(1.15rem, 2vw, 1.56rem);
}

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

.answer-option {
  justify-content: flex-start;
  min-height: 58px;
  border: 1px solid rgba(125, 211, 252, 0.2);
  background: rgba(2, 6, 23, 0.48);
  color: var(--ink);
  padding: 13px 15px;
  text-align: left;
  font-weight: 850;
}

.answer-option:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: rgba(34, 211, 238, 0.08);
  color: var(--ink-strong);
}

.answer-option.correct {
  border-color: rgba(52, 211, 153, 0.72);
  background: var(--success-bg);
  color: var(--success-text);
}

.answer-option.wrong {
  border-color: rgba(251, 113, 133, 0.76);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.feedback-box {
  min-height: 56px;
  margin: 18px 0;
  border: 1px solid rgba(125, 211, 252, 0.18);
  border-radius: var(--radius-sm);
  background: rgba(2, 6, 23, 0.44);
  color: var(--muted);
  padding: 12px 14px;
}

.feedback-box.is-correct {
  border-color: rgba(52, 211, 153, 0.46);
  background: var(--success-bg);
  color: var(--success-text);
}

.feedback-box.is-wrong {
  border-color: rgba(251, 113, 133, 0.48);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.score-panel {
  display: grid;
  gap: 10px;
  padding: 20px;
  text-align: center;
}

.score-panel span {
  color: #fde68a;
}

.score-panel strong {
  color: #fff7cc;
  font-size: 3.6rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 24px rgba(245, 158, 11, 0.35);
}

.score-panel p {
  margin-bottom: 0;
  color: var(--muted);
}

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

.subject-panel > * {
  position: relative;
  z-index: 1;
}

.subject-panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
}

.subject-panel-head h3 {
  margin-bottom: 0;
}

.subject-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.subject-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  border: 1px solid rgba(125, 211, 252, 0.18);
  border-radius: var(--radius-sm);
  background: rgba(2, 6, 23, 0.46);
  color: var(--muted);
  padding: 8px 12px;
  font-weight: 900;
}

.subject-button:hover,
.subject-button.active {
  border-color: rgba(192, 132, 252, 0.5);
  background: rgba(192, 132, 252, 0.12);
  color: #e9d5ff;
}

.subject-card {
  display: grid;
  gap: 14px;
  border-top: 1px solid rgba(125, 211, 252, 0.16);
  padding-top: 16px;
}

#subjectQuestionText {
  margin-bottom: 0;
  color: var(--ink-strong);
  font-size: clamp(1.08rem, 1.7vw, 1.34rem);
  overflow-wrap: anywhere;
}

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

.subject-option {
  min-height: 54px;
  min-width: 0;
}

.lab-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) 268px;
  gap: 16px;
  align-items: start;
}

.lesson-button {
  justify-content: flex-start;
  min-height: 72px;
  border: 1px solid rgba(125, 211, 252, 0.18);
  background: rgba(15, 23, 42, 0.74);
  color: var(--ink);
  padding: 13px 14px;
  text-align: left;
  font-weight: 950;
}

.lesson-button span {
  display: inline-grid;
  place-items: center;
  min-width: 54px;
  min-height: 30px;
  border: 1px solid rgba(96, 165, 250, 0.28);
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.18);
  color: #bfdbfe;
  font-family: "Cascadia Mono", "SFMono-Regular", monospace;
  font-size: 0.82rem;
}

.lesson-button.active {
  border-color: var(--line-strong);
  background: rgba(34, 211, 238, 0.12);
  color: var(--ink-strong);
  box-shadow: 0 0 26px rgba(34, 211, 238, 0.12);
}

.stage-panel {
  overflow: hidden;
  min-height: 520px;
}

.three-stage {
  width: 100%;
  height: 456px;
  min-height: 320px;
  background:
    linear-gradient(180deg, rgba(8, 18, 32, 0.95), rgba(3, 9, 18, 0.98));
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.three-stage:active {
  cursor: grabbing;
}

.three-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.stage-status {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  border-top: 1px solid rgba(125, 211, 252, 0.18);
  background: rgba(3, 9, 18, 0.76);
  padding: 10px 14px;
}

.stage-status span {
  min-width: 0;
  color: var(--ink);
  font-weight: 850;
  overflow-wrap: anywhere;
}

.icon-button {
  flex: 0 0 44px;
  width: 44px;
  min-width: 44px;
  border: 1px solid rgba(103, 232, 249, 0.44);
  background: rgba(34, 211, 238, 0.14);
  color: var(--primary-strong);
}

.icon-button.is-paused {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.1);
  color: #fde68a;
}

.concept-panel {
  padding: 20px;
}

.concept-panel > * {
  position: relative;
  z-index: 1;
}

.concept-panel h3 {
  margin-bottom: 16px;
}

.concept-item {
  border-top: 1px solid rgba(125, 211, 252, 0.18);
  padding: 14px 0;
}

.concept-item:last-child {
  padding-bottom: 0;
}

.concept-item strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink-strong);
}

.concept-item p {
  margin-bottom: 0;
  color: var(--muted);
}

.lab-control-card {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  border-top: 1px solid rgba(125, 211, 252, 0.18);
  padding-top: 18px;
}

.lab-control-head {
  display: grid;
  gap: 4px;
}

.lab-control-head strong {
  color: var(--ink-strong);
  font-size: 1.05rem;
}

.lab-control-head span {
  color: var(--muted);
  font-size: 0.9rem;
}

.lab-slider {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 10px;
  align-items: center;
}

.lab-slider span {
  color: var(--ink-strong);
  font-weight: 900;
}

.lab-slider output {
  min-width: 40px;
  border: 1px solid rgba(34, 211, 238, 0.2);
  border-radius: var(--radius-sm);
  background: rgba(34, 211, 238, 0.1);
  color: var(--primary-strong);
  padding: 3px 8px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.lab-slider input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 32px;
  accent-color: var(--primary);
  cursor: pointer;
}

.lab-control-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 4px;
}

.lab-control-actions .primary-action,
.lab-control-actions .ghost-action {
  min-width: 0;
  width: 100%;
  padding-inline: 10px;
}

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

.growth-report-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr);
  gap: 14px;
  margin-top: 14px;
}

.badge-card {
  display: grid;
  justify-items: start;
  gap: 10px;
  min-height: 154px;
  padding: 20px;
}

.badge-card svg {
  width: 34px;
  height: 34px;
  color: var(--primary-strong);
}

.badge-card.earned {
  border-color: rgba(52, 211, 153, 0.34);
  background:
    linear-gradient(145deg, rgba(6, 78, 59, 0.42), rgba(15, 23, 42, 0.84));
}

.setting-row,
.report-card {
  padding: 18px;
}

.setting-row input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
}

.setting-row input[type="checkbox"] {
  width: 24px;
  height: 24px;
  accent-color: var(--primary);
}

.report-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.weekly-report-card,
.daily-task-card {
  display: grid;
  gap: 12px;
}

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

.weekly-stats span {
  display: grid;
  gap: 2px;
  border: 1px solid rgba(125, 211, 252, 0.14);
  border-radius: var(--radius-sm);
  background: rgba(2, 6, 23, 0.4);
  color: var(--muted);
  padding: 10px;
}

.weekly-stats strong {
  color: #fff7cc;
  font-size: 1.45rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.daily-task-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.daily-task-list li {
  position: relative;
  border: 1px solid rgba(125, 211, 252, 0.14);
  border-radius: var(--radius-sm);
  background: rgba(2, 6, 23, 0.4);
  color: var(--ink);
  padding: 10px 12px 10px 34px;
  overflow-wrap: anywhere;
}

.daily-task-list li::before {
  content: "✓";
  position: absolute;
  left: 12px;
  top: 10px;
  color: var(--mint);
  font-weight: 1000;
}

.checkin-button {
  justify-self: start;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1080px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .main-nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .dashboard-band,
  .coding-layout,
  .growth-report-grid,
  .quiz-layout,
  .lab-layout {
    grid-template-columns: 1fr;
  }

  .subject-panel-head {
    grid-template-columns: 1fr;
  }

  .subject-buttons {
    justify-content: flex-start;
  }

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

  .topic-rail,
  .lesson-switcher {
    display: flex;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .topic-pill,
  .lesson-button {
    flex: 0 0 auto;
  }

  .concept-panel {
    order: 3;
  }

  .score-panel {
    grid-row: 2;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 10px;
  }

  .topbar {
    margin: 0 0 18px;
  }

  .brand {
    min-width: 0;
  }

  .brand small {
    display: none;
  }

  .student-chip span {
    display: none;
  }

  .nav-button {
    padding: 9px 10px;
  }

  .nav-button svg {
    width: 1rem;
    height: 1rem;
  }

  .module-grid,
  .two-column,
  .badge-grid,
  .parent-grid,
  .subject-answer-grid,
  .answer-grid {
    grid-template-columns: 1fr;
  }

  .weekly-stats {
    grid-template-columns: 1fr;
  }

  .today-panel {
    min-height: 248px;
    padding: 24px;
  }

  .today-panel::after {
    width: 170px;
    height: 88px;
    right: 16px;
    bottom: 18px;
  }

  .module-card {
    min-height: 142px;
  }

  .chat-bubble {
    max-width: 92%;
  }

  .block-step {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .block-step > span {
    width: 34px;
    height: 34px;
  }

  .quiz-card {
    min-height: 0;
  }

  .stage-panel {
    min-height: 420px;
  }

  .three-stage {
    height: min(72vw, 390px);
  }

  .stage-status {
    align-items: flex-start;
  }
}

@media (max-width: 420px) {
  .daily-actions,
  .quiz-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .primary-action,
  .ghost-action {
    width: 100%;
  }

  .subject-button {
    flex: 1 1 calc(50% - 8px);
  }

  .lesson-button {
    min-width: 220px;
  }
}

@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;
  }
}
