:root {
  color-scheme: light;
  --red-900: #6f1f25;
  --red-800: #86262c;
  --red-700: #9b2b31;
  --red-600: #ad383d;
  --red-100: #f5e3e4;
  --red-050: #fff7f7;
  --ink: #24191b;
  --muted: #716366;
  --line: #e9dddd;
  --paper: #ffffff;
  --soft: #fbf8f8;
  --success: #1f8a5b;
  --shadow: 0 18px 44px rgba(111, 31, 37, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  color: var(--ink);
  background: #fbfbfb;
}

button,
a {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 18rem minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  padding: 1.5rem;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 2.8rem;
  height: 2.8rem;
  place-items: center;
  border-radius: 0.7rem;
  color: white;
  background: var(--red-700);
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(111, 31, 37, 0.18);
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.nav-list {
  display: grid;
  gap: 0.4rem;
  margin-top: 2rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: 0.5rem;
  color: var(--muted);
  text-decoration: none;
}

.nav-link span {
  display: grid;
  width: 1.35rem;
  place-items: center;
  color: var(--red-700);
}

.nav-link:hover,
.nav-link.active {
  color: var(--red-900);
  background: var(--red-050);
}

.sidebar-note {
  margin-top: 2rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--soft);
}

.note-label,
.section-kicker,
.status-pill,
.count-badge {
  letter-spacing: 0;
  font-size: 0.78rem;
  font-weight: 800;
}

.note-label,
.section-kicker {
  color: var(--red-700);
}

.sidebar-note p {
  margin: 0.55rem 0 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.92rem;
}

.main-content {
  width: min(82rem, 100%);
  margin: 0 auto;
  padding: 1.5rem;
}

.eyebrow,
.section-kicker {
  margin: 0 0 0.45rem;
}

.intro-screen {
  position: relative;
  display: grid;
  min-height: calc(100vh - 3rem);
  align-items: center;
  padding: 4rem 0;
}

.intro-copy {
  max-width: 54rem;
}

.intro-copy h1 {
  margin: 0;
  color: var(--red-900);
  font-size: clamp(4.2rem, 11vw, 9rem);
  line-height: 0.9;
  letter-spacing: 0;
}

.intro-copy p:not(.eyebrow) {
  max-width: 40rem;
  margin: 1.2rem 0 0;
  color: var(--muted);
  font-size: clamp(1.1rem, 2vw, 1.55rem);
  line-height: 1.55;
}

.intro-actions,
.card-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.intro-actions {
  margin-top: 2rem;
}

.text-link {
  color: var(--red-800);
  font-weight: 900;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

.scroll-cue {
  position: absolute;
  right: 2rem;
  bottom: 2rem;
  display: grid;
  width: 2.2rem;
  height: 3.5rem;
  place-items: start center;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.scroll-cue span {
  width: 0.35rem;
  height: 0.35rem;
  margin-top: 0.7rem;
  border-radius: 50%;
  background: var(--red-800);
  animation: cueDrop 1.8s ease-in-out infinite;
}

@keyframes cueDrop {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  50% {
    transform: translateY(1.1rem);
    opacity: 1;
  }
}

.icon-button,
.primary-button,
.ghost-button,
.danger-button,
.neutral-button,
.success-button {
  min-height: 2.6rem;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  padding: 0.65rem 0.95rem;
  font-weight: 800;
}

.icon-button {
  width: 2.6rem;
  padding: 0;
  border-color: var(--line);
  color: var(--red-800);
  background: white;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  background: var(--red-700);
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(111, 31, 37, 0.18);
}

.primary-button:hover {
  background: var(--red-800);
}

.ghost-button,
.neutral-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--red-800);
  border-color: var(--line);
  background: white;
  text-decoration: none;
}

.danger-button {
  color: var(--red-800);
  background: var(--red-100);
}

.success-button {
  color: white;
  background: var(--success);
}

.stage-picker {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(18rem, 0.35fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
  margin-top: 3.5rem;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: white;
  box-shadow: var(--shadow);
}

.reveal-section,
.module-card {
  transform: translateY(3rem);
  opacity: 0;
  transition:
    opacity 700ms ease,
    transform 700ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.reveal-section.in-view,
.module-card.in-view {
  transform: translateY(0);
  opacity: 1;
}

.stage-picker-copy {
  padding: 1rem;
}

.stage-picker-copy h2 {
  max-width: 30rem;
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 3.4rem);
  line-height: 1.04;
  letter-spacing: 0;
}

.stage-picker-copy p:not(.section-kicker) {
  max-width: 28rem;
  margin: 1rem 0 0;
  color: var(--muted);
  line-height: 1.75;
}

.stage-switcher {
  display: flex;
  align-self: center;
  gap: 0.35rem;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--red-050);
}

.stage-tab {
  flex: 1;
  min-height: 3.1rem;
  border: 0;
  border-radius: 0.38rem;
  color: var(--red-900);
  background: transparent;
  font-weight: 900;
}

.stage-tab.active {
  color: white;
  background: var(--red-800);
  box-shadow: 0 10px 22px rgba(111, 31, 37, 0.18);
}

.stage-focus {
  min-height: 20rem;
  padding: 2rem;
  border-radius: 0.45rem;
  color: white;
  background: var(--red-800);
}

.stage-detail {
  display: none;
}

.stage-detail.active {
  display: block;
}

.stage-detail h3 {
  max-width: 34rem;
  margin: 4.5rem 0 0;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.stage-detail p {
  max-width: 34rem;
  margin: 1.1rem 0 0;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.8;
}

.inverted-link {
  display: inline-flex;
  margin-top: 1.4rem;
  color: white;
  font-weight: 900;
  text-decoration: none;
}

.inverted-link:hover { text-decoration: underline; }

.stage-number {
  display: block;
  font-size: 0.95rem;
  font-weight: 900;
}

.library-block {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: stretch;
  margin-top: 6rem;
  padding: clamp(1.4rem, 3vw, 2.4rem);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: white;
  box-shadow: var(--shadow);
}

.library-copy {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 24rem;
}

.library-copy h2 {
  max-width: 36rem;
  margin: 0;
  color: var(--red-900);
  font-size: clamp(2.35rem, 5vw, 5.4rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.library-copy p:not(.section-kicker) {
  max-width: 34rem;
  margin: 1.1rem 0 0;
  color: var(--muted);
  line-height: 1.8;
}

.source-note {
  margin-top: 2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}

.source-note span,
.library-columns span,
.grammar-map span {
  color: var(--red-700);
  font-size: 0.8rem;
  font-weight: 900;
}

.source-note p {
  margin-top: 0.4rem;
}

.source-note a {
  display: inline-flex;
  margin-top: 0.7rem;
  color: var(--red-800);
  font-weight: 900;
  text-decoration: none;
}

.source-note a:hover {
  text-decoration: underline;
}

.library-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.library-columns article,
.grammar-map article {
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--soft);
}

.library-columns h3,
.grammar-map h3 {
  margin: 0.55rem 0 0;
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  letter-spacing: 0;
}

.library-columns p { color: var(--muted); line-height: 1.65; }

.card-link {
  display: inline-flex;
  margin-top: 1rem;
  color: var(--red-800);
  font-weight: 900;
  text-decoration: none;
}

.card-link:hover { text-decoration: underline; }

.library-columns ul {
  display: grid;
  gap: 0.75rem;
  padding-left: 1.1rem;
  margin: 1rem 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.grammar-map {
  display: grid;
  gap: 1rem;
}

.grammar-map article {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 0.45fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.grammar-map p {
  margin: 0.52rem 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.daily-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  margin-top: 6rem;
}

.action-card { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.action-card h2 { margin: 0; font-size: clamp(1.65rem, 3vw, 2.7rem); line-height: 1.08; }
.action-card p:not(.section-kicker) { max-width: 38rem; color: var(--muted); line-height: 1.75; }

.word-card,
.grammar-card,
.review-card,
.progress-card,
.ai-card,
.module-strip article {
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: white;
}

.word-card,
.grammar-card,
.review-card,
.progress-card,
.ai-card {
  min-height: 18rem;
  padding: clamp(1.4rem, 3vw, 2.25rem);
}

.ai-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  color: white;
  background: linear-gradient(135deg, var(--red-900), var(--red-800));
}

.ai-card h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 3rem);
  line-height: 1.08;
}

.ai-card p:not(.section-kicker) {
  max-width: 42rem;
  margin: 0.8rem 0 0;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.75;
}

.ai-card .section-kicker {
  color: rgba(255, 255, 255, 0.72);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.card-header h2 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.4rem);
  letter-spacing: 0;
}

.status-pill,
.count-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.8rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  color: var(--red-900);
  background: var(--red-100);
  white-space: nowrap;
}

.status-pill.muted {
  color: var(--muted);
  background: #f7eff0;
}

.word-meta,
.word-meaning,
.grammar-card p {
  color: var(--muted);
  line-height: 1.7;
}

.word-meta {
  margin: 1.1rem 0 0.5rem;
}

.word-meaning {
  margin: 0 0 1rem;
}

.example-box {
  padding: 1rem;
  border-left: 4px solid var(--red-700);
  border-radius: 0.45rem;
  background: var(--red-050);
}

.example-box span {
  color: var(--red-700);
  font-weight: 900;
}

.example-box p {
  margin: 0.35rem 0 0;
  line-height: 1.6;
}

.card-actions {
  margin-top: 1rem;
}

.card-actions button {
  flex: 1 1 6rem;
}

.check-list {
  display: grid;
  gap: 0.65rem;
  padding: 0;
  margin: 1rem 0;
  list-style: none;
}

.check-list li {
  position: relative;
  padding-left: 1.55rem;
  color: var(--ink);
}

.check-list li::before {
  position: absolute;
  left: 0;
  color: var(--red-700);
  content: "✓";
  font-weight: 900;
}

.full-width {
  width: 100%;
}

.review-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}

.review-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.15rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  color: var(--ink);
  background: var(--soft);
  text-align: left;
}

.review-list strong {
  color: var(--red-800);
}

.bar-list {
  display: grid;
  gap: 1rem;
  margin-top: 1.3rem;
}

.bar-list label {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-weight: 800;
}

progress {
  width: 100%;
  height: 0.75rem;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: #f4dde1;
}

progress::-webkit-progress-bar {
  background: #f4dde1;
}

progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--red-700);
}

progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--red-700);
}

.module-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  margin-top: 6rem;
  padding-bottom: 4rem;
}

.module-strip article {
  min-height: 12rem;
  padding: 1.35rem;
}

.module-strip span {
  color: var(--red-700);
  font-weight: 900;
}

.module-strip h3 {
  margin: 0.6rem 0 0.5rem;
  font-size: 1.05rem;
}

.module-strip p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: 0.94rem;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 0 2rem;
  color: var(--muted);
}

.site-footer span {
  font-weight: 900;
}

.site-footer a {
  color: var(--red-800);
  font-weight: 900;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 10;
  max-width: min(24rem, calc(100vw - 2rem));
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  color: var(--red-900);
  background: white;
  box-shadow: var(--shadow);
  font-weight: 800;
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 1rem;
  }

  .nav-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-top: 1rem;
  }

  .nav-link {
    justify-content: center;
    min-height: 2.5rem;
    padding: 0.55rem;
  }

  .nav-link span {
    display: none;
  }

  .sidebar-note {
    display: none;
  }

  .hero-panel {
    grid-template-columns: 1fr;
  }

  .stage-picker {
    grid-template-columns: 1fr;
  }

  .library-block,
  .library-columns {
    grid-template-columns: 1fr;
  }

  .library-copy {
    min-height: 0;
  }

  .grammar-map article {
    grid-template-columns: 2.2rem minmax(0, 1fr);
  }

  .grammar-map p {
    grid-column: 2;
  }

  .module-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .main-content {
    padding: 1rem;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
    padding-bottom: 0.25rem;
  }

  .nav-link {
    min-width: 4.5rem;
  }

  .module-strip {
    grid-template-columns: 1fr;
  }

  .ai-card,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal-section,
  .module-card {
    transform: none;
    opacity: 1;
    transition: none;
  }

  .scroll-cue span {
    animation: none;
  }
}