:root {
  --bg: #f4f8ef;
  --surface: #ffffff;
  --surface-soft: #f8fbf4;
  --ink: #243124;
  --muted: #75836f;
  --line: #dfe9d8;
  --green: #6dab63;
  --green-soft: #e8f6df;
  --yellow: #ffd95b;
  --orange: #f3a13d;
  --blue: #73c4ec;
  --red: #e96579;
  --shadow: 0 10px 28px rgba(37, 54, 32, 0.08);
  --soft-shadow: 0 4px 12px rgba(37, 54, 32, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #eef5eb;
  color: var(--ink);
  font-family: Arial, "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
  color: inherit;
}

.app-shell {
  width: min(100vw, 430px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--surface-soft);
  position: relative;
  overflow-x: hidden;
  padding: 16px 16px 100px;
}

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

.title-block h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
}

.title-block p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.pill {
  border-radius: 999px;
  padding: 8px 13px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  white-space: nowrap;
}

.pill.secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}

.search {
  width: 100%;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 12px 15px;
  margin-bottom: 14px;
  outline: none;
}

.search:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(109, 171, 99, 0.14);
}

.hero-card,
.card,
.word-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: none;
}

.hero-card {
  background: var(--green-soft);
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: none;
}

.hero-row,
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hero-card h2,
.section-title {
  margin: 0;
  font-size: 16px;
}

.hero-card .unit-name {
  margin: 10px 0 7px;
  font-size: 22px;
  line-height: 1.12;
  font-weight: 900;
}

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

.progress-track {
  height: 8px;
  background: #d7e8cd;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 14px;
}

.progress-fill {
  height: 100%;
  width: var(--value, 0%);
  background: var(--green);
  border-radius: inherit;
}

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

.tile {
  min-height: 68px;
  text-align: left;
  padding: 13px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: none;
}

.tile strong {
  display: block;
  font-size: 16px;
  margin-bottom: 8px;
}

.section {
  margin-top: 20px;
}

.section-note {
  margin: 10px 0 0;
}

.stack {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.card {
  padding: 14px;
  text-align: left;
  width: 100%;
}

.card.selected-card {
  border-color: var(--green);
  background: var(--green-soft);
}

.card.locked-card {
  background: #fbfcf8;
  border-style: dashed;
}

.card h3 {
  margin: 0 0 7px;
  font-size: 16px;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.unit-path-hero .unit-name {
  font-size: 20px;
}

.path-score {
  min-width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 900;
}

.path-list {
  display: grid;
  gap: 10px;
}

.path-step {
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  text-align: left;
}

.path-index {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--green-soft);
  display: grid;
  place-items: center;
  font-weight: 900;
}

.path-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.path-copy strong {
  font-size: 16px;
}

.path-copy span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.path-copy em {
  color: #5e7158;
  font-size: 12px;
  font-style: normal;
  line-height: 1.3;
}

.path-side {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.path-status {
  min-width: 56px;
  text-align: center;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f8fbf4;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.path-status.done {
  background: var(--green-soft);
  border-color: #cfe7c5;
  color: #2f7032;
}

.path-status.doing {
  background: #fff7d7;
  border-color: #f5df8b;
  color: #90691c;
}

.path-status.todo {
  background: #f8fbf4;
  color: var(--muted);
}

.path-action {
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.result-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.result-ring {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 21px;
  font-weight: 900;
  flex: 0 0 auto;
}

.result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.result-tags span {
  padding: 8px 11px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 800;
}

.compact-empty {
  margin-top: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.result-actions {
  margin-top: 20px;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100vw, 430px);
  height: 76px;
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 8px 8px 10px;
  backdrop-filter: blur(12px);
}

.nav-btn {
  background: transparent;
  border-radius: 18px;
  color: var(--muted);
  display: grid;
  place-items: center;
  gap: 3px;
  font-size: 11px;
}

.nav-btn .icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 15px;
}

.nav-btn.active {
  color: var(--ink);
  font-weight: 800;
}

.nav-btn.active .icon {
  background: var(--green-soft);
}

.mode-bar,
.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.mode-bar {
  margin-bottom: 12px;
}

.mode-btn,
.chip {
  min-width: 46px;
  min-height: 38px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 800;
  padding: 0 15px;
  white-space: nowrap;
}

.mode-btn.active,
.chip.active {
  background: var(--yellow);
  border-color: var(--yellow);
}

.filter-primary {
  margin: 4px 0 8px;
  flex-wrap: wrap;
  overflow-x: visible;
}

.filter-primary .chip {
  min-width: 68px;
  font-size: 15px;
}

.filter-secondary {
  margin-bottom: 8px;
}

.filter-secondary .chip {
  min-height: 34px;
  font-size: 13px;
  background: #fff;
}

.filter-secondary .chip.active {
  background: var(--green-soft);
  border-color: #b9d8ae;
}

.filter-panel {
  margin: 10px 0;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.filter-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 9px;
}

.filter-grid {
  display: grid;
  gap: 8px;
}

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

.filter-card {
  min-height: 42px;
  border-radius: 14px;
  background: #f8fbf4;
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  padding: 8px 6px;
  overflow-wrap: anywhere;
}

.filter-card.active {
  background: var(--yellow);
  border-color: var(--yellow);
}

.reading-tabs {
  margin-bottom: 12px;
}

.word-card {
  min-height: 430px;
  padding: 22px 18px;
  text-align: center;
  box-shadow: none;
}

.word {
  margin: 24px 0 18px;
  font-size: clamp(36px, 11vw, 48px);
  font-weight: 900;
  line-height: 1;
}

.word .part:nth-child(1),
.syllable-card:nth-child(1) {
  --syllable-color: var(--orange);
}

.word .part:nth-child(2),
.syllable-card:nth-child(2) {
  --syllable-color: var(--blue);
}

.word .part:nth-child(3),
.syllable-card:nth-child(3) {
  --syllable-color: var(--green);
}

.word .part:nth-child(4),
.syllable-card:nth-child(4) {
  --syllable-color: var(--red);
}

.word .part {
  color: var(--syllable-color, var(--ink));
  display: inline-block;
}

.dot {
  color: #c7d0c1;
  padding: 0 4px;
}

.phonetic {
  font-size: 21px;
  font-weight: 900;
  color: #74481f;
}

.meaning {
  margin-top: 14px;
  font-size: 20px;
  font-weight: 800;
}

.audio-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 18px 0;
}

.round-btn {
  min-width: 48px;
  height: 44px;
  border-radius: 999px;
  background: var(--yellow);
  font-weight: 900;
  box-shadow: var(--soft-shadow);
}

.round-btn.soft {
  background: #f5faf1;
  border: 1px solid var(--line);
}

.syllables {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 22px 0 16px;
}

.syllable-card {
  background: var(--syllable-color);
  color: #fff;
  min-height: 74px;
  border-radius: 16px;
  padding: 13px 6px;
  font-weight: 900;
  box-shadow: none;
}

.syllable-card span {
  display: block;
  margin-top: 10px;
  font-size: 16px;
}

.example {
  background: #f5faf1;
  border-radius: 18px;
  padding: 14px;
  text-align: left;
}

.example.compact {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
}

.example p {
  margin: 0;
}

.example .cn {
  color: var(--muted);
  font-size: 13px;
  margin-top: 5px;
}

.study-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.primary {
  min-height: 46px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.primary.green {
  background: var(--green);
}

.ghost {
  min-height: 46px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-weight: 800;
}

.quiz-options {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.option {
  min-height: 48px;
  text-align: left;
  padding: 12px 16px;
  border-radius: 16px;
  background: #f8fbf4;
  border: 1px solid var(--line);
}

.option.correct {
  background: var(--green-soft);
  border-color: var(--green);
}

.option.wrong {
  background: #fde9ed;
  border-color: var(--red);
}

.letter-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.letter {
  min-width: 42px;
  height: 42px;
  border-radius: 13px;
  background: #f8fbf4;
  border: 1px solid var(--line);
  font-weight: 900;
}

.letter.used {
  background: #e8e8e8;
  border-color: #ccc;
  color: #aaa;
  cursor: default;
}

.answer-box {
  min-height: 48px;
  margin: 16px auto;
  border-radius: 16px;
  border: 1px dashed #b9c7b2;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 3px;
  padding: 12px;
  color: var(--muted);
}

.text-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  outline: none;
  margin-top: 18px;
}

.import-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--soft-shadow);
  padding: 14px;
  margin-bottom: 14px;
}

.import-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.file-btn {
  display: grid;
  place-items: center;
}

.file-btn input {
  display: none;
}

.import-status {
  margin: 12px 0 0;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.import-reports {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.subtle-panel {
  background: #f8fbf4;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 13px;
}

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

.compact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(223, 233, 216, 0.8);
}

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

.feedback {
  min-height: 24px;
  color: var(--muted);
  font-weight: 800;
  margin-top: 12px;
}

.feedback.good {
  color: var(--green);
}

.feedback.bad {
  color: var(--red);
}

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

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
}

.stat strong {
  display: block;
  font-size: 28px;
  margin-bottom: 4px;
}

.empty {
  margin-top: 28px;
  text-align: center;
  color: var(--muted);
  line-height: 1.6;
}

.reading-text {
  line-height: 2;
}

.reading-word {
  display: inline;
  padding: 3px 5px;
  border-radius: 8px;
  background: #f2f8ec;
  font-weight: 800;
}

.reading-list-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.reading-list-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.sub-tab-bar {
  display: flex;
  gap: 6px;
  padding: 0 16px 12px;
}

.sub-tab {
  flex: 1;
  padding: 8px 0;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.sub-tab.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.book-card-inner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.book-cover {
  width: 56px;
  height: 72px;
  border-radius: 6px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.book-cover-initial {
  font-size: 26px;
  font-weight: 900;
  color: rgba(255,255,255,0.9);
}

.book-info {
  flex: 1;
  text-align: left;
}

.book-info h3 {
  margin: 0 0 3px;
  font-size: 15px;
  line-height: 1.3;
}

.book-meta {
  margin: 0 0 2px;
  font-size: 12px;
  color: var(--muted);
}

.book-author {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

.book-progress {
  margin: 0;
  font-size: 12px;
  color: var(--green);
  font-weight: 600;
}

.book-desc-card {
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

.translation-toggle {
  display: block;
  width: 100%;
  padding: 10px 14px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
}

.translation-toggle:hover {
  background: var(--surface-soft);
}

.translation-body {
  margin-top: 8px;
  font-size: 14px;
  line-height: 2;
  color: var(--muted);
}

.reading-done-badge {
  font-size: 12px;
  font-weight: 900;
  color: #2f7032;
  background: var(--green-soft);
  border: 1px solid #cfe7c5;
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

.reading-actions-top {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.reading-speak-btn {
  flex: 1;
}

.reading-body-card {
  line-height: 2;
  font-size: 15px;
}

.reading-question p.reading-q-text {
  margin: 0 0 10px;
  font-weight: 800;
  font-size: 14px;
  line-height: 1.5;
}

@media (min-width: 680px) {
  body {
    padding: 28px 0;
  }

  .app-shell {
    min-height: 844px;
    border-radius: 32px;
    box-shadow: 0 26px 80px rgba(37, 54, 32, 0.18);
  }

  .bottom-nav {
    bottom: 28px;
    border-radius: 0 0 32px 32px;
  }
}
