:root {
  --ink: #203046;
  --muted: #6f7b83;
  --soft: #f4f0e8;
  --paper: #fffdf8;
  --line: #e7e0d4;
  --blue: #3568d4;
  --blue-soft: #e8effc;
  --orange: #db7b35;
  --orange-soft: #fff0e3;
  --teal: #238b83;
  --teal-soft: #e3f3ef;
  --red: #c64a47;
  --shadow: 0 12px 28px rgba(32, 48, 70, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--soft);
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(180deg, #faf8f3 0, #f4f0e8 56%, #eee8de 100%);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(53, 104, 212, 0.28);
  outline-offset: 2px;
}

.app-shell {
  width: min(1240px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px;
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
  gap: 22px;
}

.sidebar {
  position: sticky;
  top: 22px;
  height: calc(100vh - 44px);
  padding: 20px 14px;
  border: 1px solid rgba(231, 224, 212, 0.92);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.86);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 3px 8px 24px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-name {
  font-weight: 850;
  letter-spacing: 0;
}

.brand-sub {
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-button {
  min-height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-weight: 750;
}

.nav-button:hover,
.nav-button.active {
  background: var(--blue-soft);
  color: var(--blue);
}

.sidebar-note {
  margin-top: auto;
  padding: 13px;
  border-radius: 8px;
  background: var(--orange-soft);
  color: #9a5a24;
  font-size: 12px;
}

.sidebar-note strong {
  display: block;
  margin-bottom: 4px;
  color: #7e4418;
}

.main {
  min-width: 0;
}

.topbar {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--orange);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-title {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-menu {
  display: none;
}

.icon-button,
.text-button {
  min-width: 42px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
}

.text-button {
  min-width: auto;
  font-size: 13px;
  font-weight: 800;
}

.icon-button:hover,
.text-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.hero {
  padding: 28px 30px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(220px, 0.7fr);
  gap: 28px;
  align-items: end;
}

.hero h1 {
  max-width: 620px;
  margin: 0;
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1.06;
  letter-spacing: 0;
}

.hero p {
  max-width: 620px;
  margin: 15px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 15px;
}

.hero-meta {
  display: grid;
  gap: 12px;
  padding-left: 22px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.hero-stat {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
}

.hero-stat strong {
  color: #fff;
  font-size: 18px;
}

.primary,
.secondary,
.quiet,
.danger {
  min-height: 46px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 820;
}

.primary {
  background: var(--blue);
  color: #fff;
}

.primary:hover {
  background: #2e59b8;
}

.secondary {
  background: var(--orange);
  color: #fff;
}

.secondary:hover {
  background: #bd6425;
}

.quiet {
  background: var(--blue-soft);
  color: var(--blue);
}

.danger {
  background: #fde9e6;
  color: var(--red);
}

.hero .primary {
  margin-top: 22px;
  background: #fff;
  color: var(--ink);
}

.hero .primary:hover {
  background: #f2eee7;
}

.section {
  margin-top: 24px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-head h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.section-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

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

.metric {
  min-height: 106px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 5px 16px rgba(32, 48, 70, 0.04);
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.metric-value {
  margin-top: 7px;
  font-size: 30px;
  font-weight: 850;
  line-height: 1;
}

.metric-sub {
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
}

.metric.orange .metric-value {
  color: var(--orange);
}

.metric.blue .metric-value {
  color: var(--blue);
}

.metric.teal .metric-value {
  color: var(--teal);
}

.metric.red .metric-value {
  color: var(--red);
}

.daily-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 5px 16px rgba(32, 48, 70, 0.04);
}

.daily-setting h2 {
  margin: 2px 0 3px;
  font-size: 20px;
}

.daily-setting p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.daily-control {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.stepper-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--ink);
  font-size: 21px;
  line-height: 1;
}

.stepper-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.daily-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.daily-input-wrap input {
  width: 62px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 20px;
  font-weight: 850;
  text-align: center;
}

.daily-input-wrap input::-webkit-inner-spin-button,
.daily-input-wrap input::-webkit-outer-spin-button {
  margin: 0;
}

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

.workflow-step {
  min-height: 156px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.workflow-number {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 850;
}

.workflow-step h3 {
  margin: 16px 0 5px;
  font-size: 16px;
}

.workflow-step p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

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

.mode-card {
  min-height: 140px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  text-align: left;
}

.mode-card:hover,
.mode-card.active {
  border-color: var(--blue);
  box-shadow: 0 8px 20px rgba(53, 104, 212, 0.11);
}

.mode-card.active {
  background: #f8fbff;
}

.mode-letter {
  color: var(--orange);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.mode-card h3 {
  margin: 8px 0 5px;
  font-size: 16px;
}

.mode-card p {
  min-height: 38px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.mode-target {
  display: inline-block;
  margin-top: 11px;
  padding: 4px 7px;
  border-radius: 6px;
  background: var(--soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

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

.word-preview {
  min-height: 128px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.word-preview-term {
  font-size: 17px;
  font-weight: 850;
  letter-spacing: 0;
}

.word-preview-meaning {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
}

.word-preview-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 15px;
  color: var(--orange);
  font-size: 11px;
  font-weight: 800;
}

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

.chapter-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 5px 16px rgba(32, 48, 70, 0.04);
}

.chapter-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chapter-number {
  color: var(--orange);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.chapter-card h3 {
  margin: 15px 0 3px;
  font-size: 17px;
}

.chapter-name {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.chapter-meta {
  min-height: 36px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 11px;
}

.chapter-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-top: 13px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.chapter-progress .session-progress {
  height: 6px;
}

.chapter-card-actions {
  display: flex;
  gap: 7px;
  margin-top: 14px;
}

.chapter-card-actions button {
  min-height: 38px;
  padding: 0 10px;
  font-size: 12px;
}

.panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.session-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.session-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: #ddd7cc;
}

.session-progress-fill {
  height: 100%;
  background: var(--blue);
  transition: width 180ms ease;
}

.session-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.session-mode-bar {
  display: flex;
  gap: 7px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.mode-chip {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.mode-chip.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.word-panel {
  padding: 28px;
  border-radius: 8px;
  background: #f3eee5;
  text-align: center;
}

.word-topic {
  color: var(--orange);
  font-size: 12px;
  font-weight: 850;
}

.word-term {
  margin: 16px 0 7px;
  font-size: clamp(32px, 7vw, 62px);
  line-height: 1.08;
  letter-spacing: 0;
}

.word-phonetic {
  color: var(--muted);
  font-family: Georgia, serif;
  font-size: 17px;
}

.word-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 22px;
}

.sound-button {
  min-height: 52px;
  padding: 0 18px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 850;
}

.sound-button:hover {
  background: #2f4662;
}

.detail-toggle {
  margin-top: 17px;
  background: transparent;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.word-detail {
  max-width: 660px;
  margin: 18px auto 0;
  padding-top: 18px;
  border-top: 1px solid rgba(32, 48, 70, 0.14);
  text-align: left;
}

.meaning {
  font-size: 24px;
  font-weight: 850;
}

.detail-label {
  margin-top: 15px;
  color: var(--orange);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-copy {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.detail-copy strong {
  color: var(--ink);
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-top: 13px;
}

.session-metric {
  padding: 12px;
  border-radius: 8px;
  background: var(--paper);
  text-align: left;
}

.session-metric-label {
  color: var(--muted);
  font-size: 11px;
}

.session-metric-value {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 850;
}

.instruction-strip {
  margin-top: 13px;
  padding: 13px 14px;
  border-left: 3px solid var(--orange);
  border-radius: 0 8px 8px 0;
  background: var(--orange-soft);
  color: #87501f;
  font-size: 13px;
}

.session-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 15px;
}

.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.review-layout,
.check-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 0.62fr);
  gap: 16px;
  align-items: start;
}

.recall-box {
  min-height: 300px;
  padding: 28px;
  border-radius: 8px;
  background: #f3eee5;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.recall-prompt {
  color: var(--muted);
  font-size: 13px;
}

.recall-meaning {
  margin: 13px 0 20px;
  font-size: 30px;
  font-weight: 850;
}

.answer-reveal {
  margin-top: 15px;
  padding: 16px;
  border-radius: 8px;
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 800;
}

.check-input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-size: 17px;
}

.check-result {
  margin-top: 13px;
  padding: 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}

.check-result.correct {
  background: var(--teal-soft);
  color: var(--teal);
}

.check-result.wrong {
  background: #fde9e6;
  color: var(--red);
}

.library-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 14px;
}

.search-input,
.filter-select {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
}

.search-input {
  flex: 1 1 240px;
}

.filter-select {
  flex: 0 0 190px;
}

.library-list {
  display: grid;
  gap: 9px;
}

.library-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(120px, 0.8fr) minmax(130px, 0.8fr) 64px 82px;
  gap: 12px;
  align-items: center;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.library-term {
  font-weight: 850;
}

.library-meaning,
.library-topic,
.library-page {
  color: var(--muted);
  font-size: 12px;
}

.library-page {
  color: var(--orange);
  font-weight: 800;
}

.status {
  justify-self: end;
  padding: 5px 7px;
  border-radius: 6px;
  background: var(--soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.status.done {
  background: var(--teal-soft);
  color: var(--teal);
}

.status.circle {
  background: var(--orange-soft);
  color: var(--orange);
}

.gpoint-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 0.62fr);
  gap: 16px;
}

.gpoint-intro {
  padding: 20px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: #294b91;
}

.gpoint-intro h3 {
  margin: 0 0 7px;
  font-size: 19px;
}

.gpoint-intro p {
  margin: 0;
  font-size: 13px;
}

.checkpoint-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.checkpoint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.checkpoint-name {
  font-weight: 850;
}

.checkpoint-time {
  color: var(--muted);
  font-size: 11px;
}

.gpoint-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.gpoint-card h3 {
  margin: 0;
  font-size: 17px;
}

.gpoint-card p {
  color: var(--muted);
  font-size: 13px;
}

.empty {
  padding: 32px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.64);
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 5;
  max-width: min(340px, calc(100vw - 36px));
  padding: 12px 15px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 750;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 190px minmax(0, 1fr);
    padding: 16px;
    gap: 16px;
  }

  .hero-grid,
  .review-layout,
  .check-layout,
  .gpoint-grid {
    grid-template-columns: 1fr;
  }

  .hero-meta {
    padding: 14px 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-left: 0;
  }
}

@media (max-width: 680px) {
  .app-shell {
    display: block;
    padding: 12px;
  }

  .sidebar {
    position: static;
    height: auto;
    margin-bottom: 12px;
    padding: 11px;
  }

  .brand {
    padding: 2px 5px 11px;
  }

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

  .nav-button {
    min-width: 0;
    min-height: 40px;
    padding: 0 10px;
    font-size: 12px;
    text-align: center;
    line-height: 1.3;
    white-space: normal;
  }

  .sidebar-note {
    display: none;
  }

  .topbar {
    margin-bottom: 12px;
  }

  .mobile-menu {
    display: inline-grid;
    place-items: center;
  }

  .topbar-title {
    font-size: 16px;
  }

  .hero {
    padding: 22px 18px;
  }

  .hero h1 {
    font-size: 35px;
  }

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

  .daily-setting {
    align-items: flex-start;
    flex-direction: column;
  }

  .daily-control {
    align-self: stretch;
    justify-content: flex-end;
  }

  .workflow,
  .mode-grid,
  .chapter-grid {
    grid-template-columns: 1fr;
  }

  .word-panel {
    padding: 22px 15px;
  }

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

  .session-footer {
    flex-direction: column;
  }

  .session-footer button {
    width: 100%;
  }

  .library-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .library-meaning,
  .library-topic {
    display: none;
  }

  .library-page {
    justify-self: end;
  }
}
