:root {
  color-scheme: light;
  --ink: #16231f;
  --ink-soft: #31433d;
  --green-900: #17362d;
  --green-800: #20493d;
  --green-700: #2d6857;
  --green-100: #dfeee5;
  --warm-50: #fbf7ee;
  --warm-100: #f2eadc;
  --warm-200: #e5d8c1;
  --steel-900: #242b2f;
  --steel-700: #4f5b61;
  --steel-500: #78858b;
  --steel-300: #c6ced1;
  --steel-150: #e5e9e9;
  --orange: #d96b2b;
  --orange-dark: #a94b1d;
  --orange-soft: #fde1cf;
  --red: #bf3c35;
  --red-soft: #f7d7d4;
  --success: #2f7c5b;
  --white: #fffdf8;
  --shadow: 0 18px 44px rgba(22, 35, 31, 0.13);
  --shadow-sm: 0 8px 22px rgba(22, 35, 31, 0.1);
  --ring: 0 0 0 3px rgba(217, 107, 43, 0.24);
  --radius: 8px;
  --radius-sm: 6px;
  --page-pad: clamp(16px, 3vw, 32px);
  --font-body: "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
  --font-display: "Bahnschrift", "DIN Condensed", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--warm-50);
  scroll-padding-top: 112px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
  background:
    linear-gradient(135deg, rgba(23, 54, 45, 0.07) 0 25%, transparent 25% 100%) 0 0 / 42px 42px,
    radial-gradient(circle at 8% 8%, rgba(217, 107, 43, 0.16), transparent 28%),
    linear-gradient(180deg, #fffaf0 0%, #f5efe4 48%, #edf1ed 100%);
}

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

button {
  cursor: pointer;
}

img,
svg {
  max-width: 100%;
}

a {
  color: var(--green-700);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.app-shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: var(--page-pad);
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 18px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(280px, 520px) auto;
  align-items: center;
  gap: 18px;
  padding: 14px 18px;
  border: 1px solid rgba(36, 43, 47, 0.12);
  border-left: 6px solid var(--orange);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
}

.brand-block,
.student-card,
.student-meta,
.topbar-actions,
.progress-summary,
.quest-stats {
  display: flex;
  align-items: center;
}

.brand-block {
  min-width: 0;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--white);
  background:
    linear-gradient(135deg, transparent 0 42%, rgba(255, 255, 255, 0.18) 42% 58%, transparent 58%),
    var(--green-900);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-title {
  margin: 0;
  color: var(--green-900);
  font-family: var(--font-display);
  font-size: clamp(18px, 2vw, 26px);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.08;
}

.brand-subtitle {
  margin: 2px 0 0;
  color: var(--steel-700);
  font-size: 13px;
}

.student-card {
  justify-content: space-between;
  min-width: 0;
  gap: 16px;
  padding: 10px 12px;
  border: 1px solid rgba(79, 91, 97, 0.18);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #fffdfa, var(--warm-100));
}

.student-meta {
  min-width: 0;
  gap: 10px;
}

.avatar {
  width: 38px;
  height: 38px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 2px solid var(--green-800);
  border-radius: 50%;
  color: var(--green-900);
  background: var(--green-100);
  font-weight: 800;
}

.student-name,
.level-title,
.task-title,
.panel-title,
.teacher-name {
  overflow-wrap: anywhere;
}

.student-name {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
}

.student-level,
.student-class,
.progress-label,
.micro-label {
  color: var(--steel-700);
  font-size: 12px;
}

.progress-summary {
  gap: 10px;
}

.progress-ring {
  --progress: 68;
  width: 42px;
  height: 42px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--green-900);
  background:
    radial-gradient(circle at center, var(--white) 0 57%, transparent 58%),
    conic-gradient(var(--orange) calc(var(--progress) * 1%), var(--steel-150) 0);
  font-size: 11px;
  font-weight: 900;
}

.progress-block {
  display: grid;
  gap: 5px;
}

.progress-track {
  width: min(24vw, 260px);
  min-width: 150px;
  height: 10px;
  overflow: hidden;
  border: 1px solid rgba(36, 43, 47, 0.15);
  border-radius: 999px;
  background: #dce3df;
}

.progress-fill {
  width: var(--progress, 68%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green-700), var(--orange));
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}

.topbar-actions {
  justify-content: flex-end;
  gap: 8px;
}

.icon-button,
.ghost-button,
.primary-button,
.danger-button,
.map-filter {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 800;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease;
}

.icon-button {
  width: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--green-900);
  background: var(--green-100);
}

.ghost-button,
.primary-button,
.danger-button,
.map-filter {
  padding: 0 14px;
}

.primary-button {
  color: var(--white);
  background: var(--orange);
  border-color: var(--orange-dark);
  box-shadow: 0 6px 0 var(--orange-dark);
}

.ghost-button,
.map-filter {
  color: var(--green-900);
  background: rgba(255, 253, 248, 0.76);
  border-color: rgba(47, 124, 91, 0.22);
}

.danger-button {
  color: var(--white);
  background: var(--red);
  border-color: #922b27;
  box-shadow: 0 6px 0 #922b27;
}

.icon-button:hover,
.ghost-button:hover,
.primary-button:hover,
.danger-button:hover,
.map-filter:hover,
.map-filter.is-active {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.primary-button:active,
.danger-button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.24);
}

.main-stage {
  display: grid;
  grid-template-columns: minmax(300px, 0.88fr) minmax(0, 1.25fr) minmax(280px, 0.82fr);
  gap: 18px;
  align-items: start;
}

.quest-map,
.workspace,
.teacher-panel,
.wrong-review,
.achievement-panel,
.unit-overview {
  border: 1px solid rgba(36, 43, 47, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow);
}

.quest-map {
  position: relative;
  overflow: hidden;
  padding: 18px;
  background:
    linear-gradient(145deg, rgba(23, 54, 45, 0.94), rgba(32, 73, 61, 0.9)),
    var(--green-900);
  color: var(--white);
}

.quest-map::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.24;
  background:
    linear-gradient(90deg, transparent 0 48%, rgba(255, 253, 248, 0.22) 49% 51%, transparent 52% 100%) 0 0 / 52px 52px,
    linear-gradient(0deg, transparent 0 48%, rgba(255, 253, 248, 0.12) 49% 51%, transparent 52% 100%) 0 0 / 52px 52px;
}

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

.map-header,
.workspace-header,
.panel-header,
.task-header,
.review-header,
.teacher-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.map-eyebrow,
.task-eyebrow,
.panel-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 4px;
  color: inherit;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.map-eyebrow::before,
.task-eyebrow::before,
.panel-eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--orange);
}

.map-title,
.workspace-title,
.panel-title,
.review-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(20px, 2.4vw, 30px);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.05;
}

.map-copy,
.workspace-copy,
.panel-copy,
.review-copy {
  margin: 8px 0 0;
  color: rgba(255, 253, 248, 0.78);
  font-size: 13px;
}

.workspace-copy,
.panel-copy,
.review-copy {
  color: var(--steel-700);
}

.quest-stats {
  justify-content: space-between;
  gap: 10px;
  margin: 18px 0;
}

.stat-pill,
.badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 900;
}

.stat-pill {
  color: var(--white);
  background: rgba(255, 253, 248, 0.14);
  border: 1px solid rgba(255, 253, 248, 0.18);
}

.badge {
  color: var(--green-900);
  background: var(--orange-soft);
  border: 1px solid rgba(217, 107, 43, 0.28);
}

.badge.is-earned {
  color: var(--white);
  background: var(--green-700);
  border-color: var(--green-100);
}

.badge.is-locked {
  color: var(--steel-700);
  background: var(--steel-150);
  border-color: var(--steel-300);
}

.map-path {
  position: relative;
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.map-path::before {
  content: "";
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 23px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--orange), rgba(255, 253, 248, 0.28));
}

.level-card {
  position: relative;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 82px;
  padding: 12px;
  border: 1px solid rgba(255, 253, 248, 0.16);
  border-radius: var(--radius);
  color: var(--white);
  background: rgba(255, 253, 248, 0.1);
  backdrop-filter: blur(6px);
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease;
}

.level-card:hover,
.level-card.is-current {
  transform: translateX(3px);
  border-color: rgba(217, 107, 43, 0.78);
  background: rgba(255, 253, 248, 0.18);
}

.level-card.is-complete {
  border-color: rgba(223, 238, 229, 0.54);
}

.level-card.is-locked {
  opacity: 0.58;
  filter: grayscale(0.55);
}

.level-node {
  position: relative;
  z-index: 1;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 3px solid rgba(255, 253, 248, 0.72);
  border-radius: 50%;
  color: var(--green-900);
  background: var(--warm-50);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 900;
}

.level-card.is-current .level-node {
  border-color: var(--orange);
  background: var(--orange);
  color: var(--white);
  box-shadow: 0 0 0 6px rgba(217, 107, 43, 0.2);
}

.level-title {
  margin: 0;
  font-size: 15px;
  font-weight: 900;
}

.level-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  color: rgba(255, 253, 248, 0.76);
  font-size: 12px;
}

.level-action {
  min-width: 76px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 253, 248, 0.24);
  border-radius: var(--radius-sm);
  color: var(--white);
  background: rgba(217, 107, 43, 0.9);
  font-weight: 900;
}

.workspace {
  min-width: 0;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(217, 107, 43, 0.12), transparent 34%),
    rgba(255, 253, 248, 0.94);
}

.workspace-header {
  padding: 20px 22px 14px;
  border-bottom: 1px solid rgba(36, 43, 47, 0.12);
}

.workspace-title {
  color: var(--green-900);
}

.task-card {
  padding: 22px;
}

.task-header {
  align-items: center;
  margin-bottom: 16px;
}

.task-title {
  margin: 0;
  color: var(--ink);
  font-size: clamp(20px, 2vw, 28px);
  font-weight: 900;
  line-height: 1.16;
}

.task-text {
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-size: 16px;
}

.task-media,
.listen-box,
.translation-box {
  margin-top: 16px;
  border: 1px solid rgba(79, 91, 97, 0.18);
  border-radius: var(--radius);
  background: var(--white);
}

.task-media {
  display: grid;
  min-height: 190px;
  place-items: center;
  overflow: hidden;
  color: var(--steel-700);
  background:
    linear-gradient(135deg, rgba(32, 73, 61, 0.08) 0 25%, transparent 25% 50%, rgba(217, 107, 43, 0.1) 50% 75%, transparent 75%) 0 0 / 48px 48px,
    #fffdfa;
}

.listen-box,
.translation-box {
  padding: 14px;
}

.listen-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.audio-bar {
  flex: 1 1 180px;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--steel-150);
}

.audio-fill {
  width: var(--audio-progress, 42%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green-700), var(--orange));
}

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

.option-button {
  position: relative;
  min-height: 64px;
  padding: 13px 14px 13px 44px;
  border: 1px solid rgba(79, 91, 97, 0.22);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--white);
  text-align: left;
  font-weight: 800;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease;
}

.option-button::before {
  content: attr(data-label);
  position: absolute;
  top: 14px;
  left: 14px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--green-900);
  background: var(--green-100);
  font-size: 12px;
  font-weight: 900;
}

.option-button:hover,
.option-button.is-selected {
  transform: translateY(-2px);
  border-color: var(--orange);
  box-shadow: var(--shadow-sm);
}

.option-button.is-selected {
  background: var(--orange-soft);
}

.option-button.is-correct {
  border-color: var(--success);
  background: #e4f2ea;
}

.option-button.is-correct::before {
  color: var(--white);
  background: var(--success);
}

.option-button.is-wrong {
  border-color: var(--red);
  background: var(--red-soft);
}

.option-button.is-wrong::before {
  color: var(--white);
  background: var(--red);
}

.task-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(36, 43, 47, 0.1);
}

.hint-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 12px 14px;
  border-left: 4px solid var(--orange);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  background: #fff4e6;
}

.right-rail {
  display: grid;
  gap: 18px;
}

.teacher-panel,
.wrong-review,
.achievement-panel,
.unit-overview {
  padding: 18px;
}

.teacher-panel {
  background:
    linear-gradient(180deg, rgba(36, 43, 47, 0.04), transparent 34%),
    rgba(255, 253, 248, 0.94);
}

.teacher-header {
  align-items: center;
}

.teacher-avatar {
  width: 44px;
  height: 44px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--white);
  background: var(--steel-900);
  font-weight: 900;
}

.teacher-name {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
}

.teacher-role {
  margin: 2px 0 0;
  color: var(--steel-700);
  font-size: 12px;
}

.teacher-metrics,
.review-list,
.badge-grid,
.unit-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.metric-row,
.review-item,
.unit-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(36, 43, 47, 0.1);
}

.metric-row:last-child,
.review-item:last-child,
.unit-item:last-child {
  border-bottom: 0;
}

.metric-label,
.review-label,
.unit-label {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
}

.metric-value,
.review-value,
.unit-value {
  color: var(--green-900);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 900;
}

.teacher-chart {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
  height: 112px;
  margin-top: 18px;
  padding: 12px;
  border: 1px solid rgba(79, 91, 97, 0.16);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--warm-50), var(--warm-100));
}

.chart-bar {
  min-height: 18px;
  height: var(--value, 60%);
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, var(--orange), var(--green-700));
}

.wrong-review {
  border-left: 6px solid var(--red);
}

.review-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.status-pill {
  color: var(--ink);
  background: var(--steel-150);
}

.status-pill.is-risk {
  color: var(--red);
  background: var(--red-soft);
}

.status-pill.is-ready {
  color: var(--success);
  background: #dff1e5;
}

.review-item {
  grid-template-columns: 28px 1fr auto;
}

.review-index {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--white);
  background: var(--red);
  font-size: 12px;
  font-weight: 900;
}

.review-action {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(191, 60, 53, 0.3);
  border-radius: var(--radius-sm);
  color: var(--red);
  background: var(--red-soft);
  font-size: 12px;
  font-weight: 900;
}

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

.badge-tile {
  min-height: 78px;
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(79, 91, 97, 0.16);
  border-radius: var(--radius);
  color: var(--green-900);
  background: var(--white);
  text-align: center;
  font-size: 12px;
  font-weight: 900;
}

.badge-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--white);
  background: var(--orange);
  font-size: 16px;
}

.badge-tile.is-locked {
  color: var(--steel-700);
  background: var(--steel-150);
}

.badge-tile.is-locked .badge-icon {
  background: var(--steel-500);
}

.unit-overview {
  background: var(--green-900);
  color: var(--white);
}

.unit-overview .panel-copy,
.unit-overview .metric-label,
.unit-overview .unit-label {
  color: rgba(255, 253, 248, 0.76);
}

.unit-overview .unit-item {
  border-color: rgba(255, 253, 248, 0.16);
}

.unit-overview .unit-value {
  color: var(--orange-soft);
}

.empty-state,
.loading-state {
  display: grid;
  min-height: 180px;
  place-items: center;
  padding: 24px;
  border: 1px dashed rgba(79, 91, 97, 0.34);
  border-radius: var(--radius);
  color: var(--steel-700);
  background: rgba(255, 253, 248, 0.78);
  text-align: center;
}

.divider {
  height: 1px;
  margin: 16px 0;
  background: rgba(36, 43, 47, 0.12);
}

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

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

  .student-card,
  .topbar-actions {
    width: 100%;
  }

  .progress-track {
    width: min(56vw, 420px);
  }

  .main-stage {
    grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.15fr);
  }

  .right-rail {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .app-shell {
    padding: 12px;
    gap: 12px;
  }

  .topbar {
    position: static;
    padding: 12px;
  }

  .brand-block,
  .student-card,
  .task-footer,
  .map-header,
  .workspace-header,
  .panel-header,
  .review-header,
  .teacher-header {
    align-items: stretch;
  }

  .student-card,
  .task-footer,
  .map-header,
  .workspace-header,
  .panel-header,
  .review-header {
    flex-direction: column;
  }

  .student-card,
  .progress-summary {
    align-items: flex-start;
  }

  .progress-track {
    width: calc(100vw - 104px);
    min-width: 0;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .icon-button,
  .ghost-button,
  .primary-button,
  .danger-button {
    width: 100%;
  }

  .main-stage,
  .right-rail {
    grid-template-columns: 1fr;
  }

  .workspace-header,
  .task-card,
  .teacher-panel,
  .wrong-review,
  .achievement-panel,
  .unit-overview {
    padding: 16px;
  }

  .quest-map {
    padding: 16px;
  }

  .level-card {
    grid-template-columns: 44px 1fr;
  }

  .level-node {
    width: 44px;
    height: 44px;
  }

  .level-action {
    grid-column: 2;
    justify-self: start;
  }

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

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

@media (max-width: 520px) {
  .brand-title,
  .map-title,
  .workspace-title,
  .panel-title,
  .review-title,
  .task-title {
    font-size: 20px;
  }

  .student-meta,
  .progress-summary,
  .listen-controls {
    width: 100%;
  }

  .progress-summary {
    display: grid;
    grid-template-columns: 42px 1fr;
  }

  .topbar-actions {
    grid-template-columns: 1fr 1fr;
  }

  .quest-stats,
  .level-meta,
  .review-status {
    align-items: flex-start;
    flex-direction: column;
  }

  .stat-pill,
  .badge,
  .status-pill {
    width: 100%;
    justify-content: flex-start;
  }

  .task-media {
    min-height: 150px;
  }

  .teacher-chart {
    height: 96px;
  }

  .metric-row,
  .unit-item {
    grid-template-columns: 1fr;
  }

  .review-item {
    grid-template-columns: 28px 1fr;
  }

  .review-action {
    grid-column: 2;
    justify-self: start;
  }
}

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

/* Integrated app surface */
.topbar {
  grid-template-columns: minmax(0, 1fr) auto;
}

.topbar h1,
.topbar p {
  margin: 0;
}

.topbar h1 {
  color: var(--green-900);
  font-family: var(--font-display);
  font-size: clamp(24px, 4vw, 42px);
  line-height: 1;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--orange-dark);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.subtitle {
  margin-top: 6px;
  color: var(--steel-700);
}

.student-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--white);
  background: var(--green-900);
  font-weight: 900;
}

.student-card {
  min-width: 190px;
}

.student-card > div {
  display: grid;
  gap: 2px;
}

.student-card span:last-child {
  color: var(--steel-700);
  font-size: 13px;
}

main {
  display: grid;
  gap: 18px;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, 0.92fr);
  gap: 18px;
  align-items: stretch;
}

.hero-copy,
.hero-visual,
.stats-strip article,
.badge-panel,
.side-panel .wrong-review,
.question-card,
.word-chip,
.pattern-row,
.case-card,
.creative-board > *,
.teacher-grid article {
  border: 1px solid rgba(36, 43, 47, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow-sm);
}

.hero-copy {
  display: grid;
  align-content: center;
  min-height: 420px;
  padding: clamp(24px, 5vw, 54px);
  background:
    linear-gradient(135deg, rgba(23, 54, 45, 0.95), rgba(32, 73, 61, 0.92)),
    var(--green-900);
  color: var(--white);
}

.unit-badge {
  width: fit-content;
  margin-bottom: 18px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 253, 248, 0.22);
  border-radius: var(--radius-sm);
  color: var(--orange-soft);
  font-weight: 900;
}

.hero-copy h2 {
  max-width: 780px;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(34px, 6vw, 68px);
  line-height: 1.03;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 680px;
  margin: 18px 0 0;
  color: rgba(255, 253, 248, 0.78);
  font-size: clamp(15px, 1.6vw, 18px);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.sound-btn,
.mini-sound,
.sentence-bank button,
.option-grid button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 900;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

.primary-btn {
  padding: 0 18px;
  color: var(--white);
  background: var(--orange);
  border-color: var(--orange-dark);
  box-shadow: 0 6px 0 var(--orange-dark);
}

.secondary-btn,
.ghost-btn,
.sound-btn,
.mini-sound,
.sentence-bank button {
  padding: 0 14px;
  color: var(--green-900);
  background: var(--green-100);
  border-color: rgba(47, 124, 91, 0.22);
}

.secondary-btn.small,
.mini-sound {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover,
.sound-btn:hover,
.mini-sound:hover,
.sentence-bank button:hover,
.option-grid button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.primary-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--orange-dark);
}

.hero-visual {
  position: relative;
  min-height: 420px;
  margin: 0;
  overflow: hidden;
  background: var(--steel-900);
}

.hero-visual img {
  width: 100%;
  height: 100%;
  min-height: 420px;
  display: block;
  object-fit: cover;
}

.hero-visual figcaption {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--white);
  background: rgba(22, 35, 31, 0.74);
  backdrop-filter: blur(10px);
  font-size: 13px;
  font-weight: 800;
}

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

.stats-strip article {
  padding: 16px;
}

.stats-strip span {
  display: block;
  color: var(--green-900);
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 46px);
  font-weight: 900;
  line-height: 1;
}

.stats-strip p {
  margin: 6px 0 0;
  color: var(--steel-700);
  font-size: 13px;
  font-weight: 800;
}

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

.section-heading h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.08;
  letter-spacing: 0;
}

.section-heading.compact {
  margin-bottom: 10px;
}

.level-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.level-grid .level-card {
  grid-template-columns: 1fr;
  min-height: 280px;
  padding: 12px;
  text-align: left;
}

.level-card img {
  width: 100%;
  height: 112px;
  display: block;
  border-radius: var(--radius-sm);
  object-fit: cover;
  filter: saturate(0.92) contrast(1.04);
}

.level-index {
  position: absolute;
  top: 18px;
  left: 18px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--green-900);
  background: var(--warm-50);
  font-family: var(--font-display);
  font-weight: 900;
}

.level-status {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--green-900);
  background: var(--orange-soft);
  font-size: 12px;
  font-weight: 900;
}

.level-card strong {
  font-size: 17px;
  line-height: 1.2;
}

.level-card small {
  color: rgba(255, 253, 248, 0.76);
  font-size: 12px;
}

.level-card .progress-track {
  width: 100%;
  min-width: 0;
  margin-top: auto;
  background: rgba(255, 253, 248, 0.2);
}

.level-card .progress-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--orange);
}

.level-card:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  padding: 18px;
}

.workspace-main {
  min-width: 0;
}

.mission-text {
  margin: 0 0 16px;
  color: var(--ink-soft);
  font-weight: 800;
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.badge-panel,
.side-panel .wrong-review {
  padding: 16px;
}

.badge-panel h3,
.wrong-review h3,
.question-block h3,
.case-card h3,
.task-brief h3,
.sentence-bank h3,
.sample-answer h3 {
  margin: 0;
  color: var(--green-900);
  font-family: var(--font-display);
  letter-spacing: 0;
}

.badge-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.badge-list .badge {
  justify-content: flex-start;
  border-radius: var(--radius);
  white-space: normal;
}

.badge-list .badge span {
  width: 32px;
  height: 32px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--white);
  background: var(--steel-500);
}

.badge-list .badge.earned span {
  background: var(--success);
}

.badge-list .badge div {
  display: grid;
  gap: 1px;
}

.badge-list small {
  color: var(--steel-700);
}

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

.word-chip {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.word-chip > div {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.word-chip strong {
  color: var(--green-900);
  font-size: 18px;
}

.word-chip span,
.pattern-row span,
.case-card > span,
.question-card > span {
  color: var(--orange-dark);
  font-size: 12px;
  font-weight: 900;
}

.word-chip p,
.word-chip small,
.pattern-row p,
.case-card p,
.wrong-item p,
.task-brief p,
.sample-answer p {
  margin: 0;
  color: var(--ink-soft);
}

.pattern-list,
.question-block,
.case-grid,
.creative-board {
  display: grid;
  gap: 12px;
}

.pattern-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 14px;
}

.pattern-row strong {
  display: block;
  color: var(--green-900);
  font-size: 18px;
}

.question-block {
  margin-top: 16px;
}

.question-card {
  padding: 14px;
}

.question-card h4 {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 16px;
}

.question-card input,
.draft-box textarea {
  width: 100%;
  margin-top: 12px;
  border: 1px solid rgba(79, 91, 97, 0.26);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--white);
}

.question-card input {
  min-height: 44px;
  padding: 0 12px;
}

.option-grid button {
  min-height: 54px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--white);
  border-color: rgba(79, 91, 97, 0.22);
  text-align: left;
}

.option-grid button.chosen {
  border-color: var(--orange);
  background: var(--orange-soft);
}

.feedback {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 13px;
}

.feedback strong {
  margin-right: 8px;
}

.feedback.is-right {
  background: #dff1e5;
  border-left: 4px solid var(--success);
}

.feedback.is-wrong {
  background: var(--red-soft);
  border-left: 4px solid var(--red);
}

.complete-level-btn {
  width: fit-content;
  margin-top: 4px;
}

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

.case-card {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-row em {
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--green-900);
  background: var(--green-100);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.creative-board {
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
}

.creative-board > * {
  padding: 16px;
}

.draft-box,
.sample-answer,
#submitSpeechBtn {
  grid-column: 1 / -1;
}

.task-brief ul {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--ink-soft);
}

.sentence-bank {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
}

.sentence-bank h3 {
  width: 100%;
}

.draft-box span {
  display: block;
  margin-bottom: 8px;
  color: var(--green-900);
  font-weight: 900;
}

.draft-box textarea {
  min-height: 160px;
  padding: 12px;
  resize: vertical;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.wrong-item {
  display: grid;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(36, 43, 47, 0.1);
}

.wrong-item:last-child {
  border-bottom: 0;
}

.wrong-item span {
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
}

.empty-state {
  min-height: 92px;
}

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

.teacher-grid article {
  display: grid;
  gap: 6px;
  padding: 16px;
}

.teacher-grid strong {
  color: var(--green-900);
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1;
}

.teacher-grid span,
.data-note {
  color: var(--steel-700);
  font-size: 13px;
  font-weight: 800;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: var(--radius);
  color: var(--white);
  background: var(--steel-900);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, 14px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.is-hidden {
  display: none !important;
}

.topbar {
  grid-template-columns: minmax(0, 1fr) minmax(220px, auto) auto;
}

.topbar-actions {
  justify-content: flex-end;
}

.feature-hub,
.class-panel,
.workspace,
.review-page,
.teacher-panel,
.quest-map {
  scroll-margin-top: 112px;
}

.feature-hub,
.review-page {
  padding: 18px;
  border: 1px solid rgba(36, 43, 47, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow-sm);
}

.feature-grid,
.review-page-grid {
  display: grid;
  gap: 12px;
}

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

.feature-card,
.review-summary-card {
  min-width: 0;
  border: 1px solid rgba(36, 43, 47, 0.14);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fffdfa, var(--warm-100));
  box-shadow: var(--shadow-sm);
}

.feature-card {
  min-height: 188px;
  padding: 16px;
  display: grid;
  align-content: start;
  gap: 10px;
  color: var(--ink);
  text-align: left;
}

.feature-card:hover {
  transform: translateY(-2px);
  border-color: rgba(217, 107, 43, 0.42);
  box-shadow: var(--shadow);
}

.feature-card span,
.review-summary-card span {
  color: var(--orange-dark);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.feature-card strong,
.review-summary-card strong {
  color: var(--green-900);
  font-family: var(--font-display);
  font-size: clamp(22px, 2.5vw, 30px);
  line-height: 1.08;
}

.feature-card p,
.review-summary-card p {
  margin: 0;
  color: var(--ink-soft);
}

.feature-card em {
  width: fit-content;
  margin-top: auto;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  color: var(--green-900);
  background: var(--green-100);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

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

.review-page-grid .wrong-item,
.review-summary-card {
  padding: 16px;
}

.review-page-grid .wrong-item {
  border: 1px solid rgba(36, 43, 47, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow-sm);
}

.review-summary-card {
  display: grid;
  gap: 8px;
}

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

.auth-gate {
  min-height: 100dvh;
  padding: var(--page-pad);
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
  gap: 18px;
}

.auth-visual,
.auth-form,
.class-panel,
.class-card,
.join-class-form,
.create-class-form,
.class-switcher,
.student-table,
.teacher-workspace article {
  border: 1px solid rgba(36, 43, 47, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow);
}

.auth-visual {
  min-height: 620px;
  padding: clamp(28px, 5vw, 64px);
  display: grid;
  align-content: end;
  color: var(--white);
  background:
    linear-gradient(180deg, rgba(23, 54, 45, 0.18), rgba(23, 54, 45, 0.96)),
    url("./assets/image22-web.jpg") center / cover;
}

.auth-visual h1 {
  max-width: 720px;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(38px, 6vw, 72px);
  line-height: 1.02;
}

.auth-visual p {
  max-width: 620px;
  margin: 16px 0 0;
  color: rgba(255, 253, 248, 0.82);
  font-size: 18px;
}

.demo-account {
  width: fit-content;
  margin-top: 24px;
  padding: 12px 14px;
  display: grid;
  gap: 4px;
  border-radius: var(--radius);
  background: rgba(22, 35, 31, 0.72);
  backdrop-filter: blur(10px);
}

.demo-account strong {
  color: var(--orange-soft);
}

.demo-account span {
  font-size: 13px;
}

.auth-form {
  padding: clamp(20px, 4vw, 34px);
  align-self: stretch;
  display: grid;
  align-content: center;
  gap: 14px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.auth-tabs button,
.class-switcher button {
  min-height: 42px;
  border: 1px solid rgba(47, 124, 91, 0.2);
  border-radius: var(--radius-sm);
  color: var(--green-900);
  background: var(--green-100);
  font-weight: 900;
}

.auth-tabs button.is-active,
.class-switcher button.is-active {
  color: var(--white);
  background: var(--green-900);
  border-color: var(--green-900);
}

.auth-form label,
.join-class-form label,
.create-class-form label {
  display: grid;
  gap: 7px;
  color: var(--green-900);
  font-weight: 900;
}

.auth-form input,
.auth-form select,
.join-class-form input,
.create-class-form input {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid rgba(79, 91, 97, 0.24);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--white);
}

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

.class-panel {
  padding: 18px;
}

.class-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: 12px;
  align-items: stretch;
}

.teacher-class-layout {
  grid-template-columns: minmax(280px, 0.7fr) minmax(0, 1.3fr);
}

.class-card,
.join-class-form,
.create-class-form {
  padding: 16px;
}

.class-card {
  display: grid;
  align-content: center;
  gap: 8px;
}

.class-card strong {
  color: var(--green-900);
  font-size: 22px;
}

.class-card span {
  color: var(--steel-700);
  font-weight: 800;
}

.join-class-form,
.create-class-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.class-switcher {
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

.class-switcher button {
  min-height: 76px;
  padding: 10px;
  display: grid;
  gap: 4px;
  text-align: left;
}

.class-switcher span {
  font-size: 12px;
  opacity: 0.78;
}

.student-table {
  margin-top: 12px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.student-table-head,
.student-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.5fr) repeat(3, minmax(80px, 1fr));
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(36, 43, 47, 0.1);
}

.student-table-head {
  color: var(--steel-700);
  font-size: 12px;
  font-weight: 900;
}

.student-row:last-child {
  border-bottom: 0;
}

.student-row strong {
  color: var(--green-900);
}

.risk-text {
  color: var(--red);
  font-weight: 900;
}

.ok-text {
  color: var(--success);
  font-weight: 900;
}

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

.teacher-workspace article {
  padding: 16px;
}

.teacher-workspace h3 {
  margin: 0 0 8px;
  color: var(--green-900);
  font-family: var(--font-display);
}

.teacher-workspace p {
  margin: 0;
  color: var(--ink-soft);
}

@media (max-width: 1100px) {
  .hero-panel,
  .workspace,
  .auth-card,
  .class-layout,
  .teacher-class-layout {
    grid-template-columns: 1fr;
  }

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

  .word-bank,
  .feature-grid,
  .teacher-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  html {
    scroll-padding-top: 220px;
  }

  .feature-hub,
  .class-panel,
  .workspace,
  .review-page,
  .teacher-panel,
  .quest-map {
    scroll-margin-top: 220px;
  }

  .topbar,
  .hero-panel,
  .stats-strip,
  .level-grid,
  .feature-grid,
  .review-page-grid,
  .word-bank,
  .case-grid,
  .creative-board,
  .teacher-grid,
  .auth-card,
  .teacher-workspace,
  .class-switcher {
    grid-template-columns: 1fr;
  }

  .hero-copy,
  .hero-visual,
  .hero-visual img {
    min-height: 320px;
  }

  .section-heading,
  .hero-actions,
  .word-chip > div {
    align-items: stretch;
    flex-direction: column;
  }

  .auth-visual {
    min-height: 420px;
  }

  .join-class-form,
  .create-class-form,
  .student-table-head,
  .student-row {
    grid-template-columns: 1fr;
  }

  .auth-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .topbar {
    gap: 10px;
    padding: 10px 12px;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .topbar .subtitle {
    display: none;
  }

  .student-card {
    min-width: 0;
    padding: 8px;
  }

  .student-avatar {
    width: 36px;
    height: 36px;
  }

  .auth-actions button {
    min-height: 36px;
  }

  .feature-card {
    min-height: 144px;
  }

  .page-actions {
    justify-content: stretch;
  }

  .page-actions > * {
    flex: 1 1 auto;
  }
}
