:root {
  color-scheme: light;
  --bg: #f5f1e8;
  --ink: #17211d;
  --muted: #66716c;
  --line: #d9d1c1;
  --paper: #fffaf0;
  --panel: #fbf7ee;
  --accent: #0f7c67;
  --accent-dark: #085746;
  --gold: #bc7a18;
  --rose: #b84d5b;
  --shadow: 0 18px 45px rgba(37, 30, 18, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(15, 124, 103, 0.08), transparent 32%),
    linear-gradient(315deg, rgba(184, 77, 91, 0.08), transparent 36%),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

button:focus-visible {
  outline: 3px solid rgba(15, 124, 103, 0.28);
  outline-offset: 2px;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  padding: 22px 0 18px;
}

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

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

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 5vw, 4.7rem);
  line-height: 0.96;
  letter-spacing: 0;
  max-width: 820px;
}

.hero-copy {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
  max-width: 680px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(86px, 1fr));
  gap: 8px;
  min-width: 310px;
}

.stats span {
  display: grid;
  gap: 2px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.72);
  color: var(--muted);
  font-size: 0.82rem;
}

.stats strong {
  color: var(--ink);
  font-size: 1.45rem;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  gap: 10px;
  padding: 12px 0;
  backdrop-filter: blur(16px);
}

.toolbar .primary {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.toolbar .ghost {
  margin-left: auto;
  color: var(--muted);
}

.study-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.72fr);
  gap: 18px;
  align-items: start;
}

.lesson-card,
.side-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.9);
  box-shadow: var(--shadow);
}

.lesson-card {
  min-height: 620px;
  padding: clamp(22px, 4vw, 42px);
}

.lesson-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

h2 {
  margin: 14px 0 18px;
  font-size: clamp(1.75rem, 4vw, 3.5rem);
  line-height: 1.04;
  letter-spacing: 0;
}

.memory-strip {
  margin-bottom: 22px;
  padding: 14px 16px;
  border-left: 4px solid var(--gold);
  background: #f7ead4;
  color: #664611;
  border-radius: 0 8px 8px 0;
  line-height: 1.55;
  font-weight: 700;
}

.lesson-text {
  margin: 0;
  color: #24312c;
  font-size: clamp(1.06rem, 2vw, 1.28rem);
  line-height: 1.92;
  white-space: pre-line;
}

.lesson-card.recite .lesson-text {
  color: transparent;
  text-shadow: 0 0 12px rgba(23, 33, 29, 0.28);
  user-select: none;
}

.lesson-card.recite::after {
  content: "背诵模式：只看速记线索复述，想检查时再点一次“背诵模式”。";
  display: block;
  margin-top: 22px;
  color: var(--rose);
  font-weight: 800;
}

.side-panel {
  overflow: hidden;
}

.status-panel {
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 124, 103, 0.06);
}

.panel-label {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

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

.status-buttons button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
}

.tab {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.tab.active {
  background: var(--paper);
  color: var(--accent-dark);
  box-shadow: inset 0 -3px 0 var(--accent);
}

.tab-content {
  display: grid;
  gap: 12px;
  max-height: 600px;
  overflow: auto;
  padding: 18px;
}

.entry {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.entry strong {
  display: block;
  margin-bottom: 5px;
  color: var(--accent-dark);
}

.entry span {
  color: var(--muted);
  line-height: 1.55;
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 22px, 720px);
    padding-top: 16px;
  }

  .hero,
  .study-grid {
    grid-template-columns: 1fr;
  }

  .stats {
    min-width: 0;
  }

  .toolbar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .toolbar .ghost {
    margin-left: 0;
  }

  .lesson-card {
    min-height: 520px;
  }
}

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

  .status-buttons {
    grid-template-columns: 1fr;
  }
}
