/* ============ 基础与主题 ============ */
:root {
  --red: #e30a17;
  --red-dark: #b80812;
  --red-soft: #fdecee;
  --ink: #1d2129;
  --ink-soft: #4e5969;
  --ink-faint: #86909c;
  --bg: #f6f7f9;
  --card: #ffffff;
  --line: #e5e6eb;
  --gold: #c9a86a;
  --green: #16a34a;
  --green-soft: #e9f8ef;
  --amber: #d97706;
  --amber-soft: #fef3e2;
  --shadow: 0 4px 18px rgba(29, 33, 41, 0.07);
  --shadow-lg: 0 14px 40px rgba(227, 10, 23, 0.12);
  --radius: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.3; }

/* ============ 顶栏 ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 12px 32px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.brand-crescent {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--red);
  color: #fff;
  font-size: 24px;
  box-shadow: 0 6px 14px rgba(227, 10, 23, .35);
}
.brand h1 { font-size: 19px; letter-spacing: .2px; }
.brand p { font-size: 12px; color: var(--ink-faint); }

.mainnav { display: flex; gap: 4px; margin-left: auto; }
.nav-btn {
  border: none;
  background: none;
  padding: 8px 15px;
  border-radius: 999px;
  font-size: 14.5px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all .18s ease;
  white-space: nowrap;
}
.nav-btn:hover { background: var(--red-soft); color: var(--red); }
.nav-btn.active { background: var(--red); color: #fff; box-shadow: 0 4px 12px rgba(227,10,23,.28); }

.menu-toggle {
  display: none;
  margin-left: auto;
  border: none; background: none;
  font-size: 24px; cursor: pointer; color: var(--ink);
}

/* ============ 布局 ============ */
.container { max-width: 1080px; margin: 0 auto; padding: 32px 24px 60px; }
.view { display: none; animation: fadeUp .35s ease both; }
.view.active { display: block; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.view-head { margin-bottom: 26px; }
.view-head h2 { font-size: 26px; margin-bottom: 8px; }
.view-head h2 small { font-size: 15px; color: var(--ink-faint); font-weight: 500; margin-left: 8px; }
.view-head p { color: var(--ink-soft); font-size: 15px; }

.section-title { margin: 40px 0 18px; font-size: 20px; }

/* ============ 按钮 ============ */
.btn {
  border: none; cursor: pointer;
  font-size: 15px;
  padding: 11px 22px;
  border-radius: 999px;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  font-family: inherit;
}
.btn:active { transform: scale(.96); }
.btn-primary {
  background: var(--red); color: #fff;
  box-shadow: 0 8px 20px rgba(227, 10, 23, .3);
}
.btn-primary:hover { background: var(--red-dark); }
.btn-ghost {
  background: transparent; color: var(--red);
  border: 1.5px solid #f3b7bc;
}
.btn-ghost:hover { background: var(--red-soft); }
.btn-small { padding: 7px 15px; font-size: 13.5px; }
.btn-large { padding: 14px 40px; font-size: 17px; }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: var(--red-dark); }
.btn-soft { background: #f2f3f5; color: var(--ink-soft); }
.btn-soft:hover { background: #e8eaed; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { filter: brightness(.95); }
.btn-warn { background: var(--amber); color: #fff; }
.btn-warn:hover { filter: brightness(.95); }

/* ============ 首页 Hero ============ */
.hero {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 28px;
  align-items: stretch;
  background: linear-gradient(135deg, #fff 55%, var(--red-soft) 100%);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 40px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "☾";
  position: absolute;
  right: -20px; top: -30px;
  font-size: 180px;
  color: rgba(227, 10, 23, .05);
  pointer-events: none;
}
.badge {
  display: inline-block;
  font-size: 13px;
  background: var(--red-soft);
  color: var(--red);
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 16px;
  font-weight: 500;
}
.hero-text h2 { font-size: 30px; margin-bottom: 14px; }
.hero-text h2 em { font-style: normal; color: var(--red); }
.hero-sub { color: var(--ink-soft); margin-bottom: 24px; font-size: 15.5px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.hero-card {
  background: var(--red);
  color: #fff;
  border-radius: 20px;
  padding: 26px;
  display: flex; flex-direction: column;
  justify-content: center;
  box-shadow: var(--shadow-lg);
}
.hc-label { font-size: 13px; opacity: .85; margin-bottom: 10px; }
.hero-card h3 { font-size: 34px; margin-bottom: 2px; }
.hc-pron { opacity: .85; font-size: 14px; margin-bottom: 8px; }
.hc-meaning { font-size: 16px; margin-bottom: 18px; }
.hero-card .btn { align-self: flex-start; background: #fff; color: var(--red); }
.hero-card .btn:hover { background: #fff3f4; }

/* ============ 统计 ============ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 22px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex; flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow);
}
.stat-num { font-size: 30px; font-weight: 700; color: var(--red); }
.stat-label { font-size: 13.5px; color: var(--ink-faint); }

/* ============ 模块卡片 ============ */
.module-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.module-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  box-shadow: var(--shadow);
}
.module-card:hover {
  transform: translateY(-4px);
  border-color: #f0b4b9;
  box-shadow: var(--shadow-lg);
}
.mc-icon { font-size: 32px; display: block; margin-bottom: 12px; }
.module-card h4 { font-size: 17px; margin-bottom: 6px; }
.module-card p { font-size: 13.5px; color: var(--ink-soft); }
#tipCard { cursor: default; background: linear-gradient(135deg, #fffdf5, #fff7e0); border-color: #f0e0b4; }
#tipCard:hover { transform: none; box-shadow: var(--shadow); }

/* ============ 字母表 ============ */
.alpha-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.alpha-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px;
  text-align: center;
  cursor: pointer;
  transition: all .18s ease;
  box-shadow: var(--shadow);
  position: relative;
}
.alpha-card:hover {
  transform: translateY(-3px);
  border-color: var(--red);
  box-shadow: var(--shadow-lg);
}
.alpha-letter { font-size: 40px; font-weight: 700; color: var(--ink); line-height: 1.1; }
.alpha-letter small { font-size: 22px; color: var(--ink-faint); font-weight: 500; margin-left: 4px; }
.alpha-sound { font-size: 13px; color: var(--red); margin: 6px 0 8px; font-weight: 500; }
.alpha-word { font-size: 12.5px; color: var(--ink-soft); border-top: 1px dashed var(--line); padding-top: 8px; }
.alpha-word b { color: var(--ink); font-weight: 600; }
.alpha-card.special { background: linear-gradient(160deg, #fff, var(--red-soft)); }

.info-banner {
  margin-top: 24px;
  background: #fff8e8;
  border: 1px solid #f2e0b0;
  border-left: 4px solid var(--gold);
  border-radius: 12px;
  padding: 16px 20px;
  font-size: 14px;
  color: #6b5320;
}
.info-banner b { color: var(--red-dark); }

/* ============ 闪卡 ============ */
.vocab-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 6px 15px;
  font-size: 13.5px;
  cursor: pointer;
  color: var(--ink-soft);
  transition: all .15s ease;
}
.chip:hover { border-color: var(--red); color: var(--red); }
.chip.active { background: var(--red); border-color: var(--red); color: #fff; }
.vocab-actions { display: flex; align-items: center; gap: 10px; }
.progress-text { font-size: 13.5px; color: var(--ink-faint); margin-right: 4px; }

.flashcard-stage { max-width: 560px; margin: 0 auto; }
.flashcard { perspective: 1200px; height: 300px; cursor: pointer; }
.fc-inner {
  position: relative;
  width: 100%; height: 100%;
  transition: transform .55s cubic-bezier(.4,.2,.2,1);
  transform-style: preserve-3d;
}
.flashcard.flipped .fc-inner { transform: rotateY(180deg); }
.fc-face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  border-radius: 22px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px;
  padding: 30px;
  box-shadow: var(--shadow-lg);
}
.fc-front {
  background: linear-gradient(150deg, #fff 60%, var(--red-soft));
  border: 1px solid #f3d2d5;
}
.fc-front h3 { font-size: 42px; color: var(--ink); text-align: center; }
.fc-back {
  background: var(--red);
  color: #fff;
  transform: rotateY(180deg);
}
.fc-back h3 { font-size: 32px; text-align: center; }
.fc-tag {
  position: absolute; top: 18px; left: 20px;
  font-size: 12px;
  background: rgba(227,10,23,.1);
  color: var(--red);
  padding: 3px 12px; border-radius: 999px;
}
.fc-back .fc-tag { background: rgba(255,255,255,.2); color: #fff; }
.fc-hint { font-size: 12.5px; color: var(--ink-faint); margin-top: 4px; }
.fc-example { font-size: 14px; opacity: .9; text-align: center; font-style: italic; }
.fc-speak { margin-top: 8px; }

.fc-controls {
  display: flex; justify-content: center; gap: 10px;
  margin-top: 22px; flex-wrap: wrap;
}
.fc-complete {
  margin-top: 24px;
  text-align: center;
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid #bbe7cc;
  border-radius: 14px;
  padding: 18px;
  font-weight: 500;
}

/* ============ 短语 ============ */
.phrase-groups { display: flex; flex-direction: column; gap: 26px; }
.phrase-group h3 { font-size: 18px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.phrase-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 12px;
}
.phrase-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
  transition: border-color .15s ease;
}
.phrase-item:hover { border-color: #f0b4b9; }
.phrase-texts { flex: 1; min-width: 0; }
.phrase-tr { font-size: 16.5px; font-weight: 600; color: var(--ink); }
.phrase-zh { font-size: 13px; color: var(--ink-faint); }
.speak-btn {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--red-soft);
  color: var(--red);
  font-size: 16px;
  cursor: pointer;
  transition: all .15s ease;
}
.speak-btn:hover { background: var(--red); color: #fff; transform: scale(1.08); }
.speak-mini {
  border: none; background: var(--red-soft); color: var(--red);
  width: 28px; height: 28px; border-radius: 50%;
  cursor: pointer; font-size: 12px;
  margin-left: 8px;
}
.speak-mini:hover { background: var(--red); color: #fff; }

/* ============ 语法 ============ */
.grammar-block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px 30px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.grammar-block h3 { font-size: 19px; margin-bottom: 12px; }
.grammar-block p { color: var(--ink-soft); font-size: 14.5px; margin-bottom: 12px; }
.grammar-block .rule {
  background: var(--red-soft);
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--ink);
  font-size: 14px;
}
.grammar-block .rule b { color: var(--red-dark); }

.vowel-table-wrap, .suffix-table-wrap { overflow-x: auto; margin: 14px 0; }
.vowel-table, .suffix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}
.vowel-table th, .vowel-table td,
.suffix-table th, .suffix-table td {
  border: 1px solid var(--line);
  padding: 10px 12px;
  text-align: center;
}
.vowel-table thead th { background: var(--red); color: #fff; font-weight: 600; }
.vowel-table tbody th { background: #fafbfc; color: var(--ink-soft); }
.vowel-table tbody td { font-size: 24px; font-weight: 700; color: var(--red); }
.suffix-table thead th { background: #fafbfc; color: var(--ink); }
.suffix-table td:nth-child(2) { color: var(--red); font-weight: 600; white-space: nowrap; }

.example-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.ex {
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 3px;
}
.ex span { font-size: 13px; color: var(--ink-faint); }
.ex b { font-size: 16px; color: var(--ink); }
.ex em { font-style: normal; font-size: 13px; color: var(--ink-soft); }

.word-chain { display: flex; gap: 6px; margin: 14px 0 6px; flex-wrap: wrap; }
.chain-stem, .chain-suf {
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 22px;
  font-weight: 700;
}
.chain-stem { background: var(--ink); color: #fff; }
.chain-suf { background: var(--red); color: #fff; }
.chain-mean { font-size: 14px; color: var(--ink-soft) !important; }
.chain-mean b { color: var(--red); }

.sentence-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.sentence-list li {
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14.5px;
}
.sentence-list b { color: var(--red-dark); }
.sentence-list span { color: var(--ink); margin-left: 6px; }

/* ============ 测验 ============ */
.quiz-setup {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 34px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  align-items: center; gap: 22px;
  max-width: 640px; margin: 0 auto;
}
.quiz-mode-row { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.quiz-mode {
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 16px 22px;
  cursor: pointer;
  font-size: 15px;
  transition: all .15s ease;
  display: flex; align-items: center; gap: 8px;
}
.quiz-mode input { accent-color: var(--red); }
.quiz-mode.selected { border-color: var(--red); background: var(--red-soft); }
.quiz-num-row { color: var(--ink-soft); font-size: 14.5px; }
.quiz-num-row select {
  padding: 6px 12px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-size: 14.5px;
  margin-left: 6px;
  font-family: inherit;
  background: #fff;
}

.quiz-play { max-width: 640px; margin: 0 auto; }
.quiz-topline {
  display: flex; justify-content: space-between;
  font-size: 14px; color: var(--ink-soft);
  margin-bottom: 10px;
}
.quiz-streak { color: var(--amber); font-weight: 500; }
.quiz-progress {
  height: 8px; background: var(--line);
  border-radius: 999px; overflow: hidden;
  margin-bottom: 26px;
}
.quiz-progress-bar {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--red), #ff6b74);
  border-radius: 999px;
  transition: width .35s ease;
}
.quiz-question {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 34px;
  text-align: center;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.q-label { font-size: 13.5px; color: var(--ink-faint); }
.quiz-question h3 { font-size: 38px; margin: 10px 0 14px; word-break: break-word; }
.quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quiz-opt {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  font-size: 16px;
  cursor: pointer;
  text-align: left;
  transition: all .15s ease;
  font-family: inherit;
  color: var(--ink);
}
.quiz-opt:hover { border-color: var(--red); background: var(--red-soft); }
.quiz-opt .opt-key {
  display: inline-grid; place-items: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #f2f3f5;
  font-size: 12px;
  margin-right: 10px;
  color: var(--ink-soft);
}
.quiz-opt.correct { border-color: var(--green); background: var(--green-soft); }
.quiz-opt.correct .opt-key { background: var(--green); color: #fff; }
.quiz-opt.wrong { border-color: var(--red); background: var(--red-soft); }
.quiz-opt.wrong .opt-key { background: var(--red); color: #fff; }
.quiz-opt:disabled { cursor: default; }

.quiz-result {
  max-width: 560px; margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px;
  text-align: center;
  box-shadow: var(--shadow);
}
.result-ring {
  width: 130px; height: 130px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--red) 0deg, var(--red-soft) 0deg);
  position: relative;
}
.result-ring::before {
  content: ""; position: absolute; inset: 10px;
  background: #fff; border-radius: 50%;
}
.result-ring span {
  position: relative; z-index: 1;
  font-size: 26px; font-weight: 700; color: var(--red);
}
.result-wrong {
  text-align: left;
  margin: 18px 0;
  display: flex; flex-direction: column; gap: 8px;
}
.wrong-item {
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
}
.wrong-item b { color: var(--red-dark); }
.wrong-item .right { color: var(--green); }
.result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ============ 页脚 ============ */
.footer {
  text-align: center;
  padding: 28px;
  font-size: 12.5px;
  color: var(--ink-faint);
  border-top: 1px solid var(--line);
}

/* ============ 智能朗读 ============ */
.reader-input-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
#readerInput {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 16.5px;
  line-height: 1.7;
  font-family: inherit;
  color: var(--ink);
  resize: vertical;
  min-height: 110px;
  transition: border-color .15s ease;
  background: #fcfcfd;
}
#readerInput:focus { outline: none; border-color: var(--red); background: #fff; }
.reader-input-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; flex-wrap: wrap; margin-top: 12px;
}
.sample-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sample-label { font-size: 13px; color: var(--ink-faint); }
.char-count { font-size: 12.5px; color: var(--ink-faint); }
.char-count b { color: var(--red); }

.reader-console {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 18px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.speed-box { font-size: 13.5px; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; }
.speed-box select {
  padding: 6px 10px; border: 1.5px solid var(--line); border-radius: 8px;
  font-size: 13.5px; font-family: inherit; background: #fff;
}
.auto-tr { font-size: 13.5px; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; cursor: pointer; }
.auto-tr input { accent-color: var(--red); width: 15px; height: 15px; }
.engine-dot {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--ink-faint);
}
.engine-dot .dot-pulse {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--ink-faint);
}
.engine-dot.probing .dot-pulse { background: var(--amber); animation: pulse 1.1s infinite; }
.engine-dot.online .dot-pulse { background: var(--green); box-shadow: 0 0 0 4px rgba(22,163,74,.15); }
.engine-dot.local .dot-pulse { background: var(--gold); }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(.8); }
}

.reader-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}
.reader-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.rp-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px; margin-bottom: 14px;
}
.rp-head h3 { font-size: 16.5px; }
.rp-hint { font-size: 12px; color: var(--ink-faint); }
.reader-text {
  font-size: 17px;
  line-height: 2.15;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 6px;
}
.reader-placeholder { color: var(--ink-faint); font-size: 14.5px; line-height: 1.8; }
.reader-text .sentence {
  border-radius: 10px;
  padding: 2px 6px;
  margin: 0 -6px 2px;
  cursor: default;
  transition: background .25s ease;
}
.reader-text .sentence.speaking {
  background: var(--red-soft);
  box-shadow: inset 3px 0 0 var(--red);
}
.reader-text .tok {
  cursor: pointer;
  border-radius: 4px;
  padding: 0 1px;
  transition: background .12s ease;
}
.reader-text .tok:hover { background: #fff1d6; }
.reader-text .tok.kw-word {
  color: #0e7490;
  border-bottom: 1.5px dotted #67c3d4;
}
.reader-text .tok.kw-phrase {
  color: var(--red-dark);
  font-weight: 600;
  border-bottom: 2px solid rgba(227,10,23,.45);
}
.reader-text .sentence.speaking .tok.kw-phrase { text-shadow: 0 0 0.01px var(--red-dark); }

.reader-translation {
  font-size: 15.5px;
  line-height: 2;
  color: var(--ink);
  max-height: 420px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.reader-keypoints {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.kp-block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px 24px;
  box-shadow: var(--shadow);
}
.kp-block h4 { font-size: 15.5px; margin-bottom: 12px; }
.kp-list { display: flex; flex-wrap: wrap; gap: 9px; }
.kp-empty { font-size: 13px; color: var(--ink-faint); }
.kp-chip {
  display: inline-flex; flex-direction: column; align-items: flex-start;
  border: 1.5px solid var(--line);
  background: #fcfcfd;
  border-radius: 12px;
  padding: 7px 13px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: all .15s ease;
  max-width: 100%;
}
.kp-chip:hover { border-color: var(--red); transform: translateY(-1px); box-shadow: var(--shadow); }
.kp-chip b { font-size: 14.5px; color: var(--ink); }
.kp-chip span { font-size: 12px; color: var(--ink-faint); }
.kp-chip.kp-phrase { border-color: #f3c9cc; background: var(--red-soft); }
.kp-chip.kp-phrase b { color: var(--red-dark); }
.kp-chip.kp-word b { color: #0e7490; }

/* 点词即译弹卡 */
.word-pop {
  position: fixed;
  z-index: 300;
  width: 248px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(29,33,41,.18);
  padding: 14px 16px;
  animation: popIn .16s ease both;
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(6px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.wp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.wp-head b { font-size: 19px; color: var(--red-dark); word-break: break-word; }
.wp-speak {
  flex-shrink: 0;
  border: none; width: 34px; height: 34px; border-radius: 50%;
  background: var(--red); color: #fff; cursor: pointer; font-size: 14px;
  transition: transform .12s ease;
}
.wp-speak:hover { transform: scale(1.1); }
.wp-meaning { font-size: 15px; line-height: 1.6; color: var(--ink); }
.wp-loading { color: var(--ink-faint); font-size: 13.5px; }
.wp-source { margin-top: 6px; font-size: 11.5px; color: var(--ink-faint); }
.wp-source b { color: #0e7490; }

/* 神经网络引擎灯（绿色） */
.engine-dot.edge .dot-pulse { background: var(--green); box-shadow: 0 0 0 4px rgba(22,163,74,.18); }

/* 自动排版徽标 */
.rp-right { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.format-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: #92590a;
  background: #fff4dd; border: 1px solid #f3dca8;
  padding: 3px 9px 3px 10px; border-radius: 999px;
}
.format-badge button {
  border: none; background: var(--gold, #d99a1f); color: #fff;
  font-family: inherit; font-size: 11.5px; padding: 2px 9px;
  border-radius: 999px; cursor: pointer; transition: filter .15s ease;
}
.format-badge button:hover { filter: brightness(.93); }

/* 中文逐句对照与同步高亮 */
.reader-translation { white-space: normal; }
.tr-sentence {
  border-radius: 10px;
  padding: 2px 8px;
  margin: 0 -8px 4px;
  transition: background .25s ease, box-shadow .25s ease;
}
.tr-sentence.speaking {
  background: #e0f2fe;
  box-shadow: inset 3px 0 0 #0284c7;
}
.tr-loading { color: var(--ink-faint); font-size: 13px; }

/* ============ 课本模块 ============ */
.tb-back { margin-bottom: 14px; }
.tb-list { display: flex; flex-direction: column; gap: 14px; }

.tb-book {
  display: flex; align-items: center; gap: 18px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 20px 24px;
  cursor: pointer; text-align: left; font-family: inherit;
  box-shadow: var(--shadow); transition: all .18s ease;
}
.tb-book:hover { border-color: var(--red); transform: translateY(-2px); }
.tb-book-cover {
  width: 64px; height: 78px; border-radius: 8px 12px 12px 8px;
  background: linear-gradient(145deg, #e30a17, #b00010);
  color: #fff; font-size: 30px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 4px 4px 12px rgba(176,0,16,.28);
  flex-shrink: 0;
}
.tb-book-info { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.tb-book-info b { font-size: 19px; color: var(--ink); }
.tb-book-info em {
  font-style: normal; font-size: 12px; color: #fff; background: var(--red);
  border-radius: 6px; padding: 1px 7px; margin-left: 6px; vertical-align: middle;
}
.tb-book-info span { font-size: 13.5px; color: var(--ink-soft); }
.tb-book-meta { color: var(--ink-faint) !important; font-size: 12.5px !important; }
.tb-book-arrow { font-size: 30px; color: var(--ink-faint); flex-shrink: 0; }

.tb-empty {
  background: var(--card); border: 1.5px dashed var(--line);
  border-radius: 20px; padding: 54px 28px; text-align: center;
  color: var(--ink-soft);
}
.tb-empty-icon { font-size: 42px; display: block; margin-bottom: 12px; }
.tb-empty h3 { font-size: 18px; color: var(--ink); margin-bottom: 10px; }
.tb-empty p { font-size: 14px; line-height: 1.9; }
.tb-empty-desc { color: var(--ink-faint); font-size: 13px; margin-top: 12px; }

.tb-unit {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 18px 22px; box-shadow: var(--shadow);
}
.tb-unit h3 { font-size: 16.5px; margin-bottom: 12px; }
.tb-unit h3 small { font-size: 13px; color: var(--ink-faint); font-weight: 400; }
.tb-lessons { display: flex; flex-direction: column; gap: 9px; }
.tb-lesson {
  display: flex; justify-content: space-between; align-items: center;
  border: 1.5px solid var(--line); background: #fcfcfd;
  border-radius: 12px; padding: 11px 16px;
  cursor: pointer; font-family: inherit; font-size: 14.5px;
  transition: all .15s ease; text-align: left;
}
.tb-lesson:hover { border-color: var(--red); background: #fff; }
.tb-lesson.done { background: #f3faf4; border-color: #bfe3c6; }
.tb-check { color: #16a34a; font-size: 13px; flex-shrink: 0; }
.tb-go { color: var(--ink-faint); font-size: 13px; flex-shrink: 0; }

.tb-detail {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; padding: 26px 30px; box-shadow: var(--shadow);
}
.tb-lesson-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 14px; border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 20px;
}
.tb-crumb { font-size: 12.5px; color: var(--ink-faint); }
.tb-lesson-head h2 { font-size: 22px; margin-top: 4px; }
.tb-lesson-head h2 small { font-size: 14px; color: var(--ink-faint); font-weight: 400; }
.tb-sec { margin-bottom: 24px; }
.tb-sec h4 { font-size: 16px; margin-bottom: 12px; }
.tb-sec h4 small { color: var(--ink-faint); font-weight: 400; font-size: 12.5px; margin-left: 6px; }
.tb-row { display: flex; gap: 10px; align-items: flex-start; padding: 7px 8px; border-radius: 12px; }
.tb-row:hover { background: #faf7f2; }
.tb-row-speak {
  flex-shrink: 0; margin-top: 2px;
  width: 32px; height: 32px; border-radius: 50%;
  border: 1.5px solid var(--line); background: #fff;
  cursor: pointer; font-size: 13px; transition: all .15s ease;
}
.tb-row-speak:hover { border-color: var(--red); background: var(--red-soft); }
.tb-row-tr { font-size: 17px; line-height: 1.7; color: var(--ink); cursor: pointer; }
.tb-row-zh { font-size: 14px; line-height: 1.7; color: var(--ink-soft); margin-top: 1px; }
.tb-vocab { display: flex; flex-wrap: wrap; gap: 9px; }
.tb-vocab-chip {
  display: inline-flex; flex-direction: column; align-items: flex-start;
  border: 1.5px solid var(--line); background: #fcfcfd;
  border-radius: 11px; padding: 7px 13px; cursor: pointer;
  font-family: inherit; text-align: left; transition: all .15s ease;
}
.tb-vocab-chip:hover { border-color: #0284c7; transform: translateY(-1px); box-shadow: var(--shadow); }
.tb-vocab-chip b { font-size: 14.5px; }
.tb-vocab-chip span { font-size: 12px; color: var(--ink-faint); }
.tb-note {
  background: #fff8ec; border: 1px solid #f3e2bd;
  border-radius: 14px; padding: 14px 18px;
}
.tb-note p { font-size: 14px; line-height: 1.9; color: var(--ink-soft); }

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding: 28px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .module-grid { grid-template-columns: repeat(2, 1fr); }
  .reader-grid { grid-template-columns: 1fr; }
  .reader-keypoints { grid-template-columns: 1fr; }
  .engine-dot { margin-left: 0; }
}
@media (max-width: 680px) {
  .topbar { padding: 10px 16px; flex-wrap: wrap; gap: 10px; }
  .menu-toggle { display: block; }
  .mainnav {
    display: none;
    order: 3;
    width: 100%;
    margin-left: 0;
    flex-direction: column;
  }
  .mainnav.open { display: flex; }
  .nav-btn { text-align: left; border-radius: 10px; }
  .container { padding: 22px 14px 40px; }
  .hero-text h2 { font-size: 24px; }
  .module-grid { grid-template-columns: 1fr; }
  .quiz-options { grid-template-columns: 1fr; }
  .phrase-list { grid-template-columns: 1fr; }
  .fc-front h3 { font-size: 34px; }
  .grammar-block { padding: 22px 18px; }
  .alpha-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* ============ 账号区 / 登录弹窗 / 云同步 ============ */
.account-area {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 14px;
  white-space: nowrap;
}
.acct-btn {
  border: 1px solid rgba(227, 10, 23, .35);
  background: #fff;
  color: var(--red);
  font-size: 13.5px;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .18s ease;
  white-space: nowrap;
}
.acct-btn:hover { background: var(--red-soft); border-color: var(--red); }
.acct-login { background: var(--red); color: #fff; border-color: var(--red); }
.acct-login:hover { background: var(--red-dark); }
.acct-email {
  font-size: 13px;
  color: var(--ink-soft);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.acct-sync { font-size: 10px; line-height: 1; }
.acct-sync.sync-ok { color: #16a34a; }
.acct-sync.sync-syncing { color: #d97706; animation: syncPulse 1s ease-in-out infinite; }
.acct-sync.sync-offline { color: #dc2626; }
.acct-sync.sync-idle { color: #9ca3af; }
@keyframes syncPulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 17, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeUp .2s ease both;
}
.auth-overlay[hidden] { display: none; }
.auth-modal {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 20px;
  padding: 30px 28px 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .22);
}
.auth-modal h3 { font-size: 21px; margin-bottom: 18px; }
.auth-close {
  position: absolute;
  top: 14px; right: 16px;
  border: none; background: none;
  font-size: 26px; line-height: 1;
  color: var(--ink-faint);
  cursor: pointer;
}
.auth-close:hover { color: var(--ink); }
.auth-tabs {
  display: flex;
  gap: 6px;
  background: #f4f5f7;
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 20px;
}
.auth-tab {
  flex: 1;
  border: none;
  background: none;
  padding: 8px 0;
  border-radius: 999px;
  font-size: 14.5px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all .18s ease;
}
.auth-tab.active {
  background: #fff;
  color: var(--red);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}
.auth-field { display: block; margin-bottom: 14px; }
.auth-field[hidden] { display: none; }
.auth-field span { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; }
.auth-field input {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  font-size: 15px;
  transition: border-color .15s ease;
}
.auth-field input:focus { outline: none; border-color: var(--red); }
.auth-error {
  background: var(--red-soft);
  color: var(--red-dark);
  font-size: 13.5px;
  padding: 9px 13px;
  border-radius: 10px;
  margin-bottom: 12px;
}
.auth-submit { width: 100%; margin-top: 4px; }
.auth-submit:disabled { opacity: .6; cursor: wait; }
.auth-forgot {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 4px;
  background: none;
  border: 0;
  color: var(--brand, #e05a2b);
  font-size: 13px;
  cursor: pointer;
  text-align: center;
}
.auth-forgot:hover { text-decoration: underline; }
.auth-forgot[hidden] { display: none; }
.auth-back { color: var(--ink-faint); }
.auth-success {
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--ink);
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 16px;
}
.auth-tip { font-size: 12.5px; color: var(--ink-faint); }
.auth-foot {
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--ink-faint);
  text-align: center;
  line-height: 1.6;
}

.cloud-toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(17, 17, 17, .88);
  color: #fff;
  font-size: 14px;
  padding: 11px 20px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: all .25s ease;
  z-index: 1100;
  max-width: 86vw;
  text-align: center;
}
.cloud-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 680px) {
  .account-area { margin-left: auto; order: 2; gap: 6px; }
  .menu-toggle { margin-left: 0; order: 2; }
  .acct-email { display: none; }
  .acct-btn { padding: 6px 11px; font-size: 12.5px; }
}
