:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --bg-deep: #eceef3;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --ink: #111827;
  --ink-soft: #1d1d1f;
  --muted: #6e6e73;
  --muted-2: #8a8a91;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.13);
  --primary: #2563eb;
  --primary-2: #5e5ce6;
  --primary-soft: #eef4ff;
  --green: #0f9f6e;
  --green-soft: #ecfdf5;
  --red: #e11d48;
  --red-soft: #fff1f2;
  --amber: #b45309;
  --amber-soft: #fff7ed;
  --violet-soft: #f4f1ff;
  --shadow-sm: 0 4px 14px rgba(17, 24, 39, 0.06);
  --shadow: 0 18px 52px rgba(17, 24, 39, 0.10);
  --shadow-lg: 0 34px 90px rgba(17, 24, 39, 0.14);
  --radius-xl: 22px;
  --radius-2xl: 30px;
  --radius-3xl: 40px;
  --max: 1280px;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 8% -8%, rgba(94, 92, 230, 0.20), transparent 34rem),
    radial-gradient(circle at 88% 5%, rgba(14, 165, 233, 0.14), transparent 31rem),
    radial-gradient(circle at 45% 18%, rgba(255, 255, 255, 0.92), transparent 28rem),
    linear-gradient(180deg, #fbfbfd 0%, var(--bg) 42%, var(--bg-deep) 100%);
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255,255,255,0.45) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.45) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(to bottom, black, transparent 68%);
}

button, input, textarea { font: inherit; }

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 3px;
}

code {
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.06rem 0.4rem;
  color: #1d4ed8;
}

pre {
  overflow: auto;
  border-radius: 22px;
  background: #101010;
  color: #f5f5f7;
  padding: 1.05rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

/* =========================
   Top navigation / Apple glass
   ========================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 78px;
  padding: 0.85rem max(1.25rem, calc((100vw - var(--max)) / 2 + 1.25rem));
  border-bottom: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(251, 251, 253, 0.76);
  backdrop-filter: blur(24px) saturate(190%);
  -webkit-backdrop-filter: blur(24px) saturate(190%);
  box-shadow: 0 1px 0 rgba(0,0,0,0.05), 0 10px 40px rgba(17, 24, 39, 0.04);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: max-content;
}

.logo {
  position: relative;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 17px;
  color: #fff;
  font-weight: 900;
  letter-spacing: -0.07em;
  background:
    radial-gradient(circle at 30% 15%, rgba(255,255,255,0.58), transparent 29%),
    linear-gradient(135deg, #007aff 0%, #5856d6 55%, #af52de 100%);
  box-shadow: 0 18px 34px rgba(88, 86, 214, 0.28), inset 0 1px 0 rgba(255,255,255,0.45);
}

.logo::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.38);
}

.brand-title {
  color: var(--ink-soft);
  font-weight: 820;
  font-size: 1.23rem;
  letter-spacing: -0.045em;
}

.brand-subtitle {
  margin-top: 0.1rem;
  font-size: 0.76rem;
  color: var(--muted);
  letter-spacing: -0.01em;
}

.nav {
  display: flex;
  gap: 0.36rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding: 0.25rem;
  border: 1px solid rgba(255,255,255,0.72);
  border-radius: 999px;
  background: rgba(255,255,255,0.58);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 8px 24px rgba(17,24,39,0.04);
}

.nav-btn,
.tab-btn {
  border: 0;
  border-radius: 999px;
  padding: 0.68rem 1rem;
  background: transparent;
  color: #515154;
  font-size: 0.9rem;
  font-weight: 720;
  letter-spacing: -0.015em;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.nav-btn:hover,
.tab-btn:hover {
  background: rgba(255,255,255,0.86);
  color: var(--ink-soft);
}

.nav-btn.active,
.tab-btn.active {
  color: #fff;
  background: linear-gradient(180deg, #2f7df6 0%, #1f62df 100%);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.24), inset 0 1px 0 rgba(255,255,255,0.34);
}

.nav-btn:active,
.tab-btn:active,
.primary-btn:active,
.secondary-btn:active,
.danger-btn:active,
.mini-btn:active {
  transform: scale(0.98);
}

/* =========================
   Layout / hero
   ========================= */
.app-shell {
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(1.35rem, 3.2vw, 3rem) 0 3rem;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 380px);
  gap: clamp(1rem, 2.4vw, 1.8rem);
  align-items: stretch;
  margin-bottom: 1.55rem;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -1.6rem -1.2rem auto auto;
  width: min(42vw, 520px);
  height: min(42vw, 520px);
  border-radius: 999px;
  background: radial-gradient(circle, rgba(0,122,255,0.12), transparent 66%);
  pointer-events: none;
  z-index: -1;
}

.hero h1 {
  max-width: 960px;
  margin: 0.38rem 0 0.92rem;
  color: #1d1d1f;
  font-size: clamp(2.65rem, 6.2vw, 5.8rem);
  line-height: 0.93;
  letter-spacing: -0.082em;
  font-weight: 840;
}

.eyebrow,
.small-label {
  margin: 0;
  color: #2563eb;
  font-size: 0.76rem;
  font-weight: 820;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.hero-text {
  max-width: 820px;
  margin: 0;
  color: var(--muted);
  line-height: 1.72;
  font-size: clamp(1.02rem, 1.4vw, 1.18rem);
  letter-spacing: -0.015em;
}

.hero-card,
.panel,
.stat-card,
.exercise-card,
.word-card,
.mistake-card,
.review-item,
.passage-card,
.chapter-sidebar,
.lesson-panel {
  position: relative;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-bottom-color: rgba(0, 0, 0, 0.08);
  border-right-color: rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px) saturate(170%);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
}

.hero-card::before,
.panel::before,
.stat-card::before,
.lesson-panel::before,
.chapter-sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,0.72), rgba(255,255,255,0.18) 45%, transparent);
  opacity: 0.82;
}

.hero-card > *,
.panel > *,
.stat-card > *,
.lesson-panel > *,
.chapter-sidebar > * { position: relative; }

.hero-card {
  padding: 1.28rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 236px;
  overflow: hidden;
}

.hero-card::after {
  content: "";
  position: absolute;
  right: -3rem;
  bottom: -3rem;
  width: 13rem;
  height: 13rem;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(94, 92, 230, 0.18), transparent 67%);
}

.metric-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.78rem;
  margin: 1.12rem 0;
}

.metric-row div {
  padding: 1.05rem;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(255,255,255,0.75);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 12px 24px rgba(17,24,39,0.04);
}

.metric-row strong {
  display: block;
  color: #1d1d1f;
  font-size: 2.25rem;
  font-weight: 820;
  letter-spacing: -0.07em;
}

.metric-row span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
}

.view { display: none; }
.view.active { display: block; }
.hidden { display: none !important; }

.notice {
  padding: 1.12rem;
  border-radius: 24px;
  margin-bottom: 1.2rem;
}

.notice.error {
  background: rgba(255, 241, 242, 0.88);
  border: 1px solid #fecdd3;
  color: #9f1239;
  box-shadow: var(--shadow-sm);
}

/* =========================
   Dashboard / panels
   ========================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.stat-card {
  min-height: 160px;
  padding: 1.22rem;
  overflow: hidden;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.stat-card:hover,
.chapter-card:hover,
.word-card:hover,
.passage-card:hover,
.exercise-card:hover,
.review-item:hover,
.mistake-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(255,255,255,0.96);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 820;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  margin-top: 0.45rem;
  color: #1d1d1f;
  font-size: 3rem;
  font-weight: 820;
  letter-spacing: -0.08em;
}

.stat-card p {
  margin: 0.28rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.panel-row {
  display: grid;
  grid-template-columns: minmax(0, 1.72fr) minmax(270px, 0.78fr);
  gap: 1rem;
}

.panel {
  padding: 1.3rem;
  overflow: hidden;
}

.panel.large { min-height: 430px; }

.panel-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-title h2 {
  margin: 0;
  color: #1d1d1f;
  font-size: clamp(1.5rem, 2.5vw, 2.15rem);
  font-weight: 820;
  letter-spacing: -0.055em;
}

.panel-title p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  line-height: 1.55;
}

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

.chapter-card {
  position: relative;
  min-height: 245px;
  border: 1px solid rgba(255,255,255,0.78);
  border-bottom-color: rgba(0,0,0,0.08);
  border-radius: 28px;
  padding: 1.15rem;
  background: rgba(255,255,255,0.72);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.chapter-card::after {
  content: "";
  position: absolute;
  right: -3rem;
  top: -3rem;
  width: 10rem;
  height: 10rem;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(37,99,235,0.10), transparent 68%);
  pointer-events: none;
}

.chapter-card h3 {
  position: relative;
  margin: 0.36rem 0 0.5rem;
  color: #1d1d1f;
  font-size: 1.42rem;
  font-weight: 810;
  line-height: 1.08;
  letter-spacing: -0.055em;
}

.chapter-card p {
  position: relative;
  color: var(--muted);
  line-height: 1.6;
}

.tag-row {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0.28rem 0.68rem;
  font-size: 0.72rem;
  font-weight: 820;
  color: #1d4ed8;
  background: rgba(238, 244, 255, 0.92);
  border: 1px solid rgba(37, 99, 235, 0.10);
}

/* =========================
   Buttons
   ========================= */
.primary-btn,
.secondary-btn,
.danger-btn {
  border: 0;
  border-radius: 18px;
  padding: 0.78rem 1.04rem;
  font-weight: 820;
  letter-spacing: -0.018em;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.primary-btn {
  color: #fff;
  background: linear-gradient(180deg, #2f7df6 0%, #1f62df 100%);
  box-shadow: 0 14px 26px rgba(37, 99, 235, 0.24), inset 0 1px 0 rgba(255,255,255,0.32);
}

.primary-btn:hover { box-shadow: 0 18px 34px rgba(37, 99, 235, 0.30), inset 0 1px 0 rgba(255,255,255,0.34); }

.secondary-btn {
  color: #1d1d1f;
  background: rgba(255,255,255,0.68);
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.85), 0 8px 18px rgba(17,24,39,0.04);
}

.secondary-btn:hover { background: rgba(255,255,255,0.92); }

.danger-btn {
  color: #be123c;
  background: rgba(255, 241, 242, 0.82);
  border: 1px solid rgba(244, 63, 94, 0.20);
}

.danger-btn:hover { background: rgba(255, 228, 230, 0.95); }

.mini-btn {
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 999px;
  padding: 0.48rem 0.78rem;
  color: #1d4ed8;
  background: rgba(238, 244, 255, 0.76);
  font-size: 0.82rem;
  font-weight: 820;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72);
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.mini-btn:hover {
  background: rgba(219, 234, 254, 0.92);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.10);
}

/* =========================
   Learning workspace
   ========================= */
.workspace {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 1rem;
}

.chapter-sidebar,
.lesson-panel {
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow);
}

.chapter-sidebar {
  padding: 1rem;
  align-self: start;
  position: sticky;
  top: 96px;
}

.chapter-sidebar h2 {
  margin: 0 0 0.9rem;
  color: #1d1d1f;
  font-size: 1.55rem;
  font-weight: 820;
  letter-spacing: -0.055em;
}

.chapter-list {
  display: grid;
  gap: 0.55rem;
}

.chapter-list button {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 0.86rem;
  background: rgba(255,255,255,0.52);
  color: #3f3f46;
  font-weight: 780;
  line-height: 1.32;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.chapter-list button:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,0.82);
  box-shadow: var(--shadow-sm);
}

.chapter-list button.active {
  color: #fff;
  border-color: rgba(255,255,255,0.55);
  background: linear-gradient(180deg, #2f7df6 0%, #1f62df 100%);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22), inset 0 1px 0 rgba(255,255,255,0.28);
}

.lesson-panel {
  min-width: 0;
  overflow: hidden;
}

.lesson-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.28rem;
  border-bottom: 1px solid rgba(0,0,0,0.07);
  background: linear-gradient(180deg, rgba(255,255,255,0.55), rgba(255,255,255,0.18));
}

.lesson-header h2 {
  margin: 0.22rem 0 0;
  color: #1d1d1f;
  font-size: clamp(1.8rem, 3.8vw, 3.35rem);
  line-height: 0.98;
  font-weight: 835;
  letter-spacing: -0.072em;
}

.tabbar {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding: 0.25rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(255,255,255,0.72);
}

.tab-content {
  display: none;
  padding: 1.28rem;
}

.tab-content.active { display: block; }

.markdown-body {
  max-width: 920px;
  line-height: 1.78;
  color: #3f3f46;
  font-size: 1.02rem;
  letter-spacing: -0.008em;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  color: #1d1d1f;
  letter-spacing: -0.055em;
  line-height: 1.08;
}

.markdown-body h1 { font-size: 2.2rem; }
.markdown-body h2 { margin-top: 1.5rem; font-size: 1.65rem; }
.markdown-body h3 { margin-top: 1.2rem; font-size: 1.28rem; }

.markdown-body li { margin: 0.36rem 0; }
.markdown-body strong { color: #1d1d1f; }

.passage-area {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
}

.passage-card {
  padding: 1.05rem;
  box-shadow: var(--shadow-sm);
  background: rgba(255,255,255,0.68);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.passage-card h3 {
  margin: 0 0 0.55rem;
  color: #1d1d1f;
  font-weight: 810;
  letter-spacing: -0.045em;
}

.passage-card p {
  color: #3f3f46;
  line-height: 1.78;
}

.word-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.95rem;
}

.word-card {
  padding: 1.05rem;
  box-shadow: var(--shadow-sm);
  background: rgba(255,255,255,0.68);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.word-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.word-card h3 {
  margin: 0;
  color: #1d1d1f;
  font-size: 1.55rem;
  font-weight: 835;
  letter-spacing: -0.065em;
}

.word-card small {
  color: #2563eb;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.word-card p {
  color: #4b5563;
  line-height: 1.62;
}

.word-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.48rem;
  margin-top: 0.75rem;
}

.practice-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

#questionCounter {
  color: var(--muted);
  font-weight: 820;
}

.exercise-card {
  padding: 1.22rem;
  box-shadow: var(--shadow-sm);
  background: rgba(255,255,255,0.72);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.exercise-card h3 {
  margin: 0 0 1rem;
  color: #1d1d1f;
  font-size: clamp(1.28rem, 2.1vw, 1.75rem);
  font-weight: 805;
  letter-spacing: -0.045em;
  line-height: 1.32;
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.option-list {
  display: grid;
  gap: 0.68rem;
}

.option-btn {
  display: flex;
  gap: 0.78rem;
  align-items: center;
  width: 100%;
  text-align: left;
  border: 1.5px solid rgba(0,0,0,0.08);
  border-radius: 22px;
  padding: 0.92rem 1rem;
  background: rgba(255,255,255,0.72);
  font-weight: 680;
  color: #34343a;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.82);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.option-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(37,99,235,0.22);
  background: rgba(255,255,255,0.95);
  box-shadow: 0 10px 22px rgba(17,24,39,0.06);
}

.option-btn.selected {
  border-color: rgba(37, 99, 235, 0.38);
  background: linear-gradient(180deg, rgba(238,244,255,0.98), rgba(219,234,254,0.92));
  color: #1e3a8a;
  box-shadow: 0 12px 24px rgba(37,99,235,0.10), inset 0 1px 0 rgba(255,255,255,0.88);
}

.option-letter {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: rgba(245,245,247,0.92);
  color: #52525b;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}

.option-btn.selected .option-letter {
  background: #2563eb;
  color: #fff;
}

.answer-box {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  border: 1.5px solid rgba(0,0,0,0.10);
  border-radius: 24px;
  padding: 1rem;
  line-height: 1.68;
  color: #1d1d1f;
  background: rgba(255,255,255,0.78);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.78), 0 10px 24px rgba(17,24,39,0.04);
}

.feedback {
  display: none;
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 22px;
  line-height: 1.62;
  box-shadow: var(--shadow-sm);
}

.feedback.show { display: block; }

.feedback.correct {
  background: rgba(236, 253, 245, 0.9);
  color: #065f46;
  border: 1px solid rgba(16, 185, 129, 0.22);
}

.feedback.wrong {
  background: rgba(255, 241, 242, 0.9);
  color: #9f1239;
  border: 1px solid rgba(244, 63, 94, 0.22);
}

.rubric {
  margin-top: 0.85rem;
  padding: 1rem;
  border-radius: 22px;
  background: rgba(255,255,255,0.62);
  border: 1px solid rgba(0,0,0,0.07);
}

.rubric ul { margin: 0.45rem 0 0; }

/* =========================
   Review / mistakes / progress
   ========================= */
.review-curve {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.review-curve span {
  display: block;
  text-align: center;
  padding: 0.75rem 0.35rem;
  border-radius: 18px;
  color: #1d4ed8;
  background: rgba(238,244,255,0.78);
  border: 1px solid rgba(37,99,235,0.09);
  font-weight: 820;
  font-size: 0.82rem;
}

.review-list,
.mistakes-list {
  display: grid;
  gap: 0.78rem;
}

.review-item,
.mistake-card {
  padding: 1.08rem;
  box-shadow: var(--shadow-sm);
  background: rgba(255,255,255,0.7);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.review-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.review-item h3,
.mistake-card h3 {
  margin: 0 0 0.36rem;
  color: #1d1d1f;
  font-weight: 820;
  letter-spacing: -0.05em;
}

.review-item p,
.mistake-card p {
  margin: 0.24rem 0;
  color: #4b5563;
  line-height: 1.6;
}

.due {
  background: linear-gradient(180deg, rgba(255, 251, 235, 0.95), rgba(255,247,237,0.76));
  border-color: rgba(251, 191, 36, 0.25);
}

.empty-state {
  padding: 2.2rem;
  border-radius: 28px;
  background: rgba(255,255,255,0.58);
  color: var(--muted);
  text-align: center;
  border: 1px dashed rgba(0,0,0,0.10);
}

canvas {
  width: 100%;
  max-width: 100%;
  border: 1px solid rgba(255,255,255,0.78);
  border-bottom-color: rgba(0,0,0,0.08);
  border-radius: 28px;
  background: rgba(255,255,255,0.74);
  box-shadow: var(--shadow-sm);
}

.study-plan {
  color: #4b5563;
  line-height: 1.72;
  padding-left: 1.2rem;
}

.study-plan li { margin: 0.48rem 0; }

footer {
  padding: 2.4rem 1rem 3rem;
  color: var(--muted);
  text-align: center;
  font-size: 0.86rem;
}

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

@media (max-width: 1080px) {
  .hero,
  .panel-row,
  .workspace {
    grid-template-columns: 1fr;
  }

  .chapter-sidebar {
    position: static;
  }

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

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.85rem;
  }

  .nav {
    width: 100%;
    justify-content: flex-start;
    border-radius: 24px;
  }

  .hero h1 { letter-spacing: -0.07em; }
}

@media (max-width: 640px) {
  .app-shell { width: min(100% - 1rem, var(--max)); }

  .stats-grid,
  .chapter-grid,
  .word-grid,
  .review-curve {
    grid-template-columns: 1fr;
  }

  .lesson-header,
  .panel-title,
  .review-item,
  .practice-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .hero h1 { font-size: 2.55rem; }

  .hero-text { font-size: 0.98rem; }

  .nav-btn,
  .tab-btn {
    padding: 0.58rem 0.78rem;
  }

  .hero-card,
  .panel,
  .stat-card,
  .lesson-panel,
  .chapter-sidebar {
    border-radius: 26px;
  }
}

/* =========================
   Bilingual support mode
   ========================= */
.support-mode-panel {
  margin-top: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(760px, 100%);
  padding: 0.75rem;
  border-radius: 26px;
  background: rgba(255,255,255,0.68);
  border: 1px solid rgba(255,255,255,0.86);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.92), 0 12px 34px rgba(17,24,39,0.06);
  backdrop-filter: blur(18px) saturate(160%);
}

.support-mode-panel strong {
  display: block;
  font-size: 0.92rem;
  color: var(--ink-soft);
  letter-spacing: -0.01em;
}

.support-mode-panel span {
  display: block;
  margin-top: 0.16rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.support-switch {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 999px;
  background: rgba(245,245,247,0.82);
  border: 1px solid rgba(0,0,0,0.06);
  flex-shrink: 0;
}

.support-switch button {
  border: 0;
  border-radius: 999px;
  padding: 0.56rem 0.82rem;
  background: transparent;
  color: #515154;
  font-size: 0.82rem;
  font-weight: 760;
  letter-spacing: -0.02em;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.support-switch button:hover {
  background: rgba(255,255,255,0.9);
}

.support-switch button.active {
  color: #fff;
  background: linear-gradient(180deg, #111827 0%, #34343a 100%);
  box-shadow: 0 10px 22px rgba(17,24,39,0.18), inset 0 1px 0 rgba(255,255,255,0.18);
}

.chapter-zh {
  display: inline-block;
  margin-left: 0.35rem;
  color: var(--muted);
  font-size: 0.8em;
  font-weight: 680;
  letter-spacing: -0.02em;
}

.mode-note,
.listening-first {
  margin: 1rem 0;
  padding: 0.9rem 1rem;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(238,244,255,0.92), rgba(255,255,255,0.74));
  border: 1px solid rgba(37,99,235,0.12);
  color: #33508f;
  font-size: 0.92rem;
  line-height: 1.55;
}

.zh-help {
  margin: 0.75rem 0;
  border-radius: 18px;
  border: 1px solid rgba(37,99,235,0.12);
  background: linear-gradient(180deg, rgba(239,246,255,0.92), rgba(255,255,255,0.70));
  overflow: hidden;
}

.zh-help summary {
  cursor: pointer;
  list-style: none;
  padding: 0.7rem 0.9rem;
  color: #1d4ed8;
  font-size: 0.86rem;
  font-weight: 780;
  letter-spacing: -0.01em;
  user-select: none;
}

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

.zh-help summary::after {
  content: "显示/隐藏";
  float: right;
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 650;
}

.zh-help[open] summary {
  border-bottom: 1px solid rgba(37,99,235,0.10);
}

.zh-help p,
.zh-help ul {
  margin: 0;
  padding: 0.85rem 0.95rem 1rem;
  color: #334155;
  font-size: 0.94rem;
  line-height: 1.68;
}

.zh-help ul { padding-left: 1.7rem; }
.zh-help li { margin: 0.25rem 0; }

.option-zh {
  display: block;
  margin-top: 0.28rem;
  color: #5b6472;
  font-size: 0.82rem;
  line-height: 1.35;
  font-weight: 560;
}

.option-btn.selected .option-zh {
  color: rgba(255,255,255,0.82);
}

html[data-support-mode="challenge"] .option-zh,
html[data-support-mode="challenge"] .chapter-card .zh-help:not([open]) + .tag-row {
  display: none;
}

@media (max-width: 720px) {
  .support-mode-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .support-switch {
    width: 100%;
    justify-content: space-between;
    border-radius: 22px;
  }

  .support-switch button {
    flex: 1;
    padding: 0.58rem 0.45rem;
  }
}
