/* ==========================================================
   霸总请你背单词 · 组件与布局
   ========================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  color: var(--ink);
  background:
    radial-gradient(1100px 560px at 76% -8%, var(--gold-soft), transparent 62%),
    radial-gradient(900px 500px at 8% 108%, rgba(156, 61, 80, .06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  transition: background-color .3s ease, color .3s ease;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.is-cover { overflow: hidden; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); }
::selection { background: var(--word-bg); color: var(--word); }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- 顶部进度条 ---------- */
.progress-rail {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 80;
  background: transparent; pointer-events: none;
}
#progressBar {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .12s linear;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar-h); z-index: 50;
  display: flex; align-items: center; gap: 8px; padding: 0 14px;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.topbar-center {
  flex: 1 1 auto; min-width: 0; text-align: center;
  font-family: var(--font-en); font-size: 10.5px; letter-spacing: .18em;
  color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-transform: uppercase;
}
.icon-btn {
  width: 34px; height: 34px; flex: 0 0 auto;
  display: inline-grid; place-items: center; position: relative;
  border: 1px solid transparent; border-radius: 10px;
  background: transparent; color: var(--ink-2);
  transition: background .18s, color .18s, border-color .18s;
}
.icon-btn:hover { background: var(--line-soft); color: var(--ink); border-color: var(--line-soft); }
.icon-btn svg { width: 18px; height: 18px; display: block; }
.icon-btn.text { font-family: var(--font-en); font-size: 12px; letter-spacing: .02em; width: 36px; }
.star-badge {
  position: absolute; top: 1px; right: 0;
  min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px;
  background: var(--accent); color: #fff; font-size: 9px; line-height: 15px;
  text-align: center; font-family: var(--font-en); opacity: 0; transform: scale(.7);
  transition: opacity .2s, transform .2s;
}
.star-badge.on { opacity: 1; transform: scale(1); }

.brand {
  display: flex; align-items: center; gap: 9px; padding: 4px 6px;
  border: 0; border-radius: 10px; background: transparent; text-align: left;
}
.brand:hover { background: var(--line-soft); }
.brand-seal {
  width: 30px; height: 30px; flex: 0 0 auto; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #a63e55, #6f2334);
  color: #fff6ef; font-family: var(--font-kai); font-size: 16px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22), 0 4px 10px rgba(120, 40, 60, .22);
}
.brand-name { display: flex; flex-direction: column; line-height: 1.08; }
.brand-name b { font-size: 12.5px; letter-spacing: .07em; }
.brand-name span { font-size: 8.5px; letter-spacing: .18em; color: var(--muted); margin-top: 2px; }

/* ---------- 模式栏 ---------- */
.mode-bar {
  position: fixed; top: var(--topbar-h); left: 0; right: 0; z-index: 49;
  height: var(--modebar-h); display: flex; align-items: center; justify-content: center;
  padding: 0 12px;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line-soft);
}
.mode-tabs {
  display: flex; gap: 3px; padding: 4px; max-width: 100%;
  background: var(--bg-soft); border: 1px solid var(--line-soft); border-radius: 999px;
  overflow-x: auto; scrollbar-width: none;
}
.mode-tabs::-webkit-scrollbar { display: none; }
.mode-tab {
  position: relative; border: 0; background: transparent; white-space: nowrap;
  padding: 7px 15px; border-radius: 999px;
  font-size: 12.5px; letter-spacing: .04em; color: var(--muted);
  transition: background .2s, color .2s, box-shadow .2s;
}
.mode-tab:hover { color: var(--ink); }
.mode-tab.active {
  background: var(--paper); color: var(--accent);
  font-weight: 600; box-shadow: 0 1px 5px rgba(0, 0, 0, .08);
}
html[data-theme="dark"] .mode-tab.active { background: var(--paper-2); }

/* ---------- 左侧目录 ---------- */
.sidebar {
  position: fixed; top: calc(var(--topbar-h) + var(--modebar-h)); bottom: 0; left: 0;
  width: var(--sidebar-w); z-index: 40;
  display: flex; flex-direction: column;
  background: var(--paper); border-right: 1px solid var(--line);
  transform: translateX(0);
  transition: transform .32s var(--ease);
  overflow: hidden;
}
body:not(.toc-open) .sidebar { transform: translateX(-100%); }
.sidebar-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  padding: 18px 14px 14px 20px; border-bottom: 1px solid var(--line-soft);
}
.side-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.side-brand .brand-seal { width: 34px; height: 34px; font-size: 17px; }
.side-brand-txt { min-width: 0; }
.side-brand-txt b { display: block; font-size: 13px; letter-spacing: .06em; }
.side-brand-txt span {
  display: block; font-family: var(--font-en); font-size: 8.5px; letter-spacing: .19em;
  color: var(--muted); margin-top: 3px; text-transform: uppercase;
}
.toc-progress { padding: 14px 20px 12px; border-bottom: 1px solid var(--line-soft); }
.toc-progress-top {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 11px; color: var(--muted); letter-spacing: .04em;
}
.toc-progress-top b { font-family: var(--font-en); color: var(--ink-2); font-weight: 600; }
.mini-bar {
  height: 5px; margin-top: 9px; border-radius: 999px; overflow: hidden;
  background: var(--bg-soft); border: 1px solid var(--line-soft);
}
.mini-bar span {
  display: block; height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .4s var(--ease);
}
.toc-nav { flex: 1 1 auto; overflow-y: auto; padding: 4px 10px 18px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.volume { margin-top: 8px; }
.volume-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 12px 10px 5px;
}
.volume-head b {
  font-family: var(--font-kai); font-size: 12.5px; color: var(--ink-2); font-weight: 400;
  letter-spacing: .08em;
}
.volume-head span {
  font-family: var(--font-en); font-size: 9px; letter-spacing: .14em; color: var(--muted);
}
.toc-item {
  width: 100%; display: flex; align-items: flex-start; gap: 9px;
  padding: 8px 10px; border: 0; border-radius: 10px; background: transparent;
  text-align: left; color: var(--ink-2);
  transition: background .16s, color .16s;
}
.toc-item:hover { background: var(--bg-soft); }
.toc-item.current { background: var(--accent-soft); color: var(--accent); }
.toc-no {
  min-width: 21px; padding-top: 1px;
  font-family: var(--font-en); font-size: 11px; color: var(--muted);
}
.toc-item.current .toc-no { color: var(--accent); }
.toc-text { min-width: 0; flex: 1 1 auto; }
.toc-title { display: block; font-size: 12.5px; font-weight: 600; line-height: 1.35; }
.toc-meta { display: block; margin-top: 2px; font-size: 9.5px; color: var(--muted); letter-spacing: .03em; }
.toc-check { margin-left: auto; font-size: 11px; color: var(--green); opacity: 0; padding-top: 2px; }
.toc-item.is-read .toc-check { opacity: 1; }
.sidebar-foot {
  border-top: 1px solid var(--line-soft); padding: 12px 16px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.side-foot-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 999px; background: transparent;
  padding: 7px 12px; font-size: 11px; color: var(--ink-2);
}
.side-foot-btn:hover { border-color: var(--accent-2); color: var(--accent); }
.side-foot-btn svg { width: 13px; height: 13px; }
.side-foot-note { font-size: 9.5px; color: var(--muted); letter-spacing: .04em; }

.scrim {
  position: fixed; inset: 0; z-index: 65; background: var(--scrim);
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}

/* ---------- 主阅读区 ---------- */
.main {
  padding: calc(var(--topbar-h) + var(--modebar-h) + 34px) 22px 64px;
  transition: margin-left .32s var(--ease);
}
.chapter-card {
  position: relative; max-width: var(--maxw); margin: 0 auto;
  padding: clamp(26px, 5.5vw, 62px) clamp(20px, 6vw, 70px) clamp(28px, 5vw, 54px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: var(--shadow);
}
.chapter-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-2) 22%, var(--accent) 50%, var(--accent-2) 78%, transparent);
  opacity: .55;
}
.chapter-head { margin-bottom: 8px; }
.chapter-kicker {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-en); font-size: 10.5px; letter-spacing: .26em;
  color: var(--accent-2); text-transform: uppercase;
}
.chapter-kicker::after {
  content: ""; flex: 1 1 auto; height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}
.chapter-head h1 {
  margin: 18px 0 8px;
  font-family: var(--font-serif); font-weight: 700;
  font-size: clamp(29px, 5vw, 44px); line-height: 1.2; letter-spacing: .02em;
}
.chapter-en {
  margin: 0 0 4px;
  font-family: var(--font-en); font-style: italic; font-size: 14px; color: var(--muted);
  letter-spacing: .03em;
}
.chapter-hook {
  margin: 18px 0 20px; padding-left: 14px;
  border-left: 2px solid var(--accent-2);
  font-family: var(--font-kai); font-size: clamp(15px, 2vw, 17.5px);
  line-height: 1.75; color: var(--quote);
}
.chapter-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 20px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 10.5px; letter-spacing: .05em; color: var(--muted);
}
.chip.ok { color: var(--green); border-color: var(--green-line); background: var(--green-bg); }
.mode-hint {
  display: flex; align-items: flex-start; gap: 9px;
  margin: 0 0 30px; padding: 11px 14px;
  border: 1px solid var(--line-soft); border-radius: 12px;
  background: var(--bg-soft);
  font-size: 12px; line-height: 1.65; color: var(--ink-2);
}
.mode-hint svg { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 2px; color: var(--accent); }
.mode-hint b { color: var(--accent); font-weight: 600; }

/* ---------- 正文 ---------- */
.story p {
  margin: 0 0 1.3em;
  font-family: var(--font-serif);
  font-size: calc(17px * var(--reader-scale));
  line-height: 2.06;
  letter-spacing: .018em;
  text-align: justify;
  color: var(--ink);
}
.story p:last-child { margin-bottom: 0; }
.story p:first-of-type::first-line { letter-spacing: .04em; }

/* 单词 token：三种模式 */
.word-token {
  display: inline;
  margin: 0 .07em; padding: .02em .22em .05em;
  border: 0; border-bottom: 1.5px solid var(--word-line); border-radius: 5px 5px 2px 2px;
  background: var(--word-bg); color: var(--word);
  font-family: var(--font-en); font-size: .96em; font-weight: 600; line-height: 1.2;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
  vertical-align: baseline;
  transition: background .18s, color .18s, transform .18s, border-color .18s;
}
.word-token:hover { background: var(--word-hover); transform: translateY(-1px); }
.word-token .gloss {
  margin-left: .24em;
  font-family: var(--font-kai); font-size: .72em; font-weight: 400;
  letter-spacing: 0; color: var(--word); opacity: .86;
}
.word-token .gloss.blank { opacity: .48; letter-spacing: .08em; }
.word-token.mode-en2zh {
  background: var(--green-bg); border-bottom-color: var(--green-line); color: var(--green);
}
.word-token.mode-en2zh .gloss { color: var(--green); }
.word-token.mode-en2zh.revealed {
  background: var(--word-bg); border-bottom-color: var(--word-line); color: var(--word);
}
.word-token.mode-en2zh.revealed .gloss { color: var(--word); }
.word-token.mode-zh2en {
  background: var(--blank-bg); border-bottom: 1.5px dashed var(--accent-2);
  color: var(--accent-2); min-width: 3.4em;
}
.word-token.mode-zh2en .gloss { color: var(--muted); opacity: .8; font-size: .68em; }
.word-token.mode-zh2en .blank { letter-spacing: .12em; opacity: .8; }
.word-token.mode-zh2en.revealed {
  background: var(--word-bg); border-bottom-style: solid; border-bottom-color: var(--word-line);
  color: var(--word);
}
.word-token.mode-zh2en.revealed .gloss { color: var(--word); opacity: .85; }
.word-token.reveal-pop { animation: reveal-pop .34s var(--ease); }
@keyframes reveal-pop {
  0% { transform: scale(.92); opacity: .55; }
  62% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* ---------- 本章单词 ---------- */
.vocab-section {
  margin-top: 40px; padding-top: 26px; border-top: 1px solid var(--line);
}
.vocab-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  margin-bottom: 13px;
}
.vocab-head h2 {
  margin: 0; font-family: var(--font-serif); font-size: 19px; letter-spacing: .03em;
}
.vocab-head h2 span {
  margin-left: 7px; font-family: var(--font-en); font-size: 12px;
  font-weight: 400; color: var(--muted); letter-spacing: .06em;
}
.vocab-note { font-size: 10px; color: var(--muted); letter-spacing: .03em; }
.vocab-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 7px;
}
.vocab-item {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: 10px;
  background: var(--paper-2);
}
.vocab-star {
  flex: 0 0 auto; border: 0; background: none; padding: 0;
  color: var(--muted); font-size: 14px; line-height: 1;
  transition: color .16s, transform .16s;
}
.vocab-star:hover { transform: scale(1.15); color: var(--accent-2); }
.vocab-star.on { color: var(--accent-2); }
.vocab-main { min-width: 0; }
.vocab-word { display: block; font-family: var(--font-en); font-size: 13.5px; font-weight: 700; line-height: 1.2; }
.vocab-ph { display: block; font-size: 9.5px; color: var(--muted); margin-top: 2px; }
.vocab-zh { margin-left: auto; text-align: right; font-size: 11px; line-height: 1.45; color: var(--ink-2); }
.vocab-zh .pos { color: var(--accent); font-size: 9.5px; margin-right: 3px; }
.vocab-speak {
  flex: 0 0 auto; width: 26px; height: 26px; display: grid; place-items: center;
  border: 1px solid var(--line-soft); border-radius: 8px; background: transparent;
  color: var(--muted);
}
.vocab-speak:hover { color: var(--accent); border-color: var(--accent-2); }
.vocab-speak svg { width: 13px; height: 13px; }

/* ---------- 章节底部导航 ---------- */
.chapter-foot {
  display: flex; align-items: stretch; gap: 10px;
  margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--line);
}
.nav-btn {
  display: flex; flex-direction: column; gap: 3px; min-width: 0;
  padding: 11px 16px; border: 1px solid var(--line); border-radius: 12px;
  background: transparent; text-align: left; color: var(--ink-2);
  transition: border-color .18s, background .18s, color .18s;
}
.nav-btn:hover { border-color: var(--accent-2); background: var(--bg-soft); color: var(--ink); }
.nav-btn small { font-size: 9px; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; }
.nav-btn b { font-family: var(--font-serif); font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-btn.next { margin-left: auto; text-align: right; align-items: flex-end; }
.nav-btn[disabled] { opacity: .35; pointer-events: none; }
.site-foot {
  max-width: var(--maxw); margin: 26px auto 0;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  font-size: 10px; color: var(--muted); letter-spacing: .05em; line-height: 1.7;
}
.site-foot .kbd {
  display: inline-block; padding: 1px 5px; margin: 0 2px;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px;
  font-family: var(--font-en); font-size: 9px;
}

/* ---------- 单词浮卡 ---------- */
.word-card {
  position: fixed; z-index: 90; width: 276px; max-width: calc(100vw - 24px);
  padding: 16px 16px 14px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow);
  animation: card-in .18s var(--ease);
}
@keyframes card-in { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.wc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wc-ph { font-family: var(--font-en); font-size: 11px; color: var(--muted); }
.wc-close { border: 0; background: none; padding: 0; color: var(--muted); font-size: 17px; line-height: 1; }
.wc-word {
  margin-top: 7px; font-family: var(--font-en); font-size: 24px; font-weight: 700;
  letter-spacing: .01em; color: var(--word);
}
.wc-zh { margin-top: 5px; font-size: 13px; color: var(--ink-2); }
.wc-zh .pos { color: var(--accent); font-size: 10.5px; margin-right: 4px; }
.wc-actions { display: flex; gap: 7px; margin-top: 13px; }
.wc-act {
  flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 7px 8px; border: 1px solid var(--line); border-radius: 9px;
  background: transparent; font-size: 11px; color: var(--ink-2);
}
.wc-act:hover { border-color: var(--accent-2); color: var(--accent); }
.wc-act.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.wc-act svg { width: 13px; height: 13px; }

/* ---------- 弹层通用 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 95;
  display: grid; place-items: center; padding: 16px;
  background: var(--scrim);
  -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
  animation: fade-in .2s ease;
}
@keyframes fade-in { from { opacity: 0; } }
.modal-card {
  display: flex; flex-direction: column;
  width: min(720px, 100%); max-height: min(84vh, 780px);
  background: var(--paper); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow); overflow: hidden;
  animation: modal-in .24s var(--ease);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.985); } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px 18px 14px; border-bottom: 1px solid var(--line-soft);
}
.modal-head h2 { margin: 0; font-family: var(--font-serif); font-size: 19px; letter-spacing: .03em; }
.modal-head h2 span { font-family: var(--font-en); font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 5px; }
.modal-close { border: 0; background: none; color: var(--muted); font-size: 20px; line-height: 1; padding: 2px 4px; }
.wb-toolbar { display: flex; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--line-soft); }
.wb-search {
  flex: 1 1 auto; min-width: 0;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--bg-soft); color: var(--ink); font-size: 12px;
}
.wb-search::placeholder { color: var(--muted); }
.wb-flash-btn {
  flex: 0 0 auto; padding: 8px 13px; border: 1px solid var(--accent-2); border-radius: 9px;
  background: transparent; color: var(--accent); font-size: 11.5px; letter-spacing: .04em;
}
.wb-flash-btn:hover { background: var(--accent-soft); }
.wb-flash-btn[disabled] { opacity: .4; pointer-events: none; }
.wb-body { flex: 1 1 auto; overflow-y: auto; padding: 10px 12px 16px; }
.wb-list { display: flex; flex-direction: column; gap: 5px; }
.wb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border: 1px solid var(--line-soft); border-radius: 10px;
  background: var(--paper-2);
}
.wb-main { min-width: 0; flex: 1 1 auto; }
.wb-word { font-family: var(--font-en); font-size: 14px; font-weight: 700; }
.wb-ph { margin-left: 6px; font-size: 10px; color: var(--muted); font-weight: 400; }
.wb-zh { font-size: 11px; color: var(--ink-2); margin-top: 2px; }
.wb-src { font-size: 9.5px; color: var(--muted); margin-left: 6px; }
.wb-actions { display: flex; gap: 4px; }
.wb-mini {
  width: 28px; height: 28px; display: grid; place-items: center;
  border: 1px solid var(--line-soft); border-radius: 8px; background: transparent;
  color: var(--muted); font-size: 13px;
}
.wb-mini:hover { color: var(--accent); border-color: var(--accent-2); }
.wb-mini svg { width: 13px; height: 13px; }
.wb-empty { padding: 46px 22px 52px; text-align: center; color: var(--muted); }
.wb-empty .big { font-family: var(--font-kai); font-size: 34px; color: var(--accent-2); opacity: .7; }
.wb-empty p { margin: 12px auto 0; max-width: 320px; font-size: 12px; line-height: 1.8; }

/* 闪卡 */
.fc-wrap { padding: 12px 18px 18px; }
.fc-stage { perspective: 1300px; padding: 8px 0 14px; }
.fc-card {
  position: relative; width: min(430px, 100%); height: 262px; margin: 0 auto;
  transform-style: preserve-3d; transition: transform .5s var(--ease); cursor: pointer;
}
.fc-card.flipped { transform: rotateY(180deg); }
.fc-face {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px;
  padding: 22px; text-align: center;
  border: 1px solid var(--line); border-radius: 18px;
  background: var(--paper-2); box-shadow: var(--shadow);
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
}
.fc-face.back { transform: rotateY(180deg); background: var(--accent-soft); }
.fc-label { font-family: var(--font-en); font-size: 9px; letter-spacing: .2em; color: var(--muted); text-transform: uppercase; }
.fc-word { font-family: var(--font-en); font-size: clamp(28px, 6vw, 40px); font-weight: 700; color: var(--word); }
.fc-ph { font-family: var(--font-en); font-size: 12px; color: var(--muted); }
.fc-zh { font-family: var(--font-serif); font-size: 23px; color: var(--ink); }
.fc-pos { color: var(--accent); font-size: 13px; }
.fc-src { font-size: 10px; color: var(--muted); margin-top: 3px; }
.fc-hint { text-align: center; font-size: 10px; color: var(--muted); letter-spacing: .06em; }
.fc-controls { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; }
.fc-btn {
  min-width: 38px; height: 36px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px; background: transparent;
  font-size: 12px; color: var(--ink-2);
}
.fc-btn:hover { border-color: var(--accent-2); color: var(--accent); }
.fc-count { font-family: var(--font-en); font-size: 10px; color: var(--muted); letter-spacing: .1em; min-width: 62px; text-align: center; }
.fc-exit { border: 0; background: none; color: var(--muted); font-size: 11px; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 测验 ---------- */
.quiz-wrap { margin-top: 2px; }
.quiz-top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 16px;
}
.quiz-step { font-family: var(--font-en); font-size: 10px; letter-spacing: .18em; color: var(--muted); }
.quiz-score { font-size: 11px; color: var(--muted); }
.quiz-score b { color: var(--accent); font-family: var(--font-en); font-size: 14px; }
.quiz-bar { height: 4px; border-radius: 999px; overflow: hidden; background: var(--bg-soft); margin-bottom: 26px; }
.quiz-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .35s var(--ease); }
.quiz-prompt { text-align: center; padding: 8px 0 22px; }
.quiz-prompt .label { font-family: var(--font-en); font-size: 9px; letter-spacing: .22em; color: var(--muted); text-transform: uppercase; }
.quiz-prompt .big {
  margin: 10px 0 4px; font-family: var(--font-en); font-size: clamp(30px, 7vw, 44px);
  font-weight: 700; color: var(--word); word-break: break-word;
}
.quiz-prompt .big.zh { font-family: var(--font-serif); font-size: clamp(26px, 6vw, 36px); color: var(--ink); }
.quiz-prompt .ph { font-family: var(--font-en); font-size: 12px; color: var(--muted); }
.quiz-prompt .ask { margin-top: 12px; font-size: 11.5px; color: var(--muted); letter-spacing: .04em; }
.quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.quiz-opt {
  display: flex; align-items: center; gap: 10px;
  min-height: 58px; padding: 10px 14px; text-align: left;
  border: 1px solid var(--line); border-radius: 12px; background: var(--paper-2);
  color: var(--ink-2); font-size: 13px; line-height: 1.45;
  transition: border-color .16s, background .16s, transform .16s;
}
.quiz-opt:hover { border-color: var(--accent-2); transform: translateY(-1px); }
.quiz-opt .letter {
  flex: 0 0 auto; width: 22px; height: 22px; display: grid; place-items: center;
  border-radius: 7px; background: var(--bg-soft); color: var(--muted);
  font-family: var(--font-en); font-size: 10px;
}
.quiz-opt.correct { border-color: var(--green-line); background: var(--green-bg); color: var(--green); }
.quiz-opt.correct .letter { background: var(--green); color: #fff; }
.quiz-opt.wrong { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.quiz-opt.wrong .letter { background: var(--accent); color: #fff; }
.quiz-opt:disabled { cursor: default; transform: none; }
.quiz-feedback {
  margin-top: 15px; padding: 12px 14px; border-radius: 11px;
  border: 1px solid var(--line-soft); background: var(--bg-soft);
  font-size: 12px; line-height: 1.7; color: var(--ink-2);
}
.quiz-feedback.good { border-color: var(--green-line); background: var(--green-bg); }
.quiz-feedback.bad { border-color: var(--word-line); background: var(--word-bg); color: var(--word); }
.quiz-actions { display: flex; justify-content: flex-end; margin-top: 16px; }
.quiz-next {
  border: 0; border-radius: 999px; padding: 10px 22px;
  background: linear-gradient(135deg, var(--accent), #6f2334); color: #fff6ef;
  font-size: 12px; letter-spacing: .08em; box-shadow: 0 6px 16px rgba(140, 50, 70, .24);
}
.quiz-next:hover { transform: translateY(-1px); }
.quiz-result { text-align: center; padding: 8px 0 4px; }
.quiz-result .score-big { font-family: var(--font-en); font-size: 64px; line-height: 1; color: var(--accent); }
.quiz-result .score-big small { font-size: 18px; color: var(--muted); }
.quiz-result h3 { font-family: var(--font-serif); font-size: 22px; margin: 12px 0 6px; }
.quiz-result p { font-size: 12px; color: var(--muted); line-height: 1.7; margin: 0 auto; max-width: 380px; }
.quiz-wrong-list { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 18px 0 2px; }
.quiz-wrong-chip {
  padding: 5px 9px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper-2); font-size: 11px;
}
.quiz-wrong-chip b { font-family: var(--font-en); color: var(--accent); }
.quiz-result-actions { display: flex; justify-content: center; gap: 8px; margin-top: 20px; }
.quiz-again {
  border: 1px solid var(--line); border-radius: 999px; padding: 9px 20px;
  background: transparent; color: var(--ink-2); font-size: 12px;
}
.quiz-again:hover { border-color: var(--accent-2); color: var(--accent); }

/* ---------- 封面 ---------- */
.cover {
  position: fixed; inset: 0; z-index: 100;
  display: flex; overflow-y: auto;
  background:
    radial-gradient(760px 520px at 50% -8%, rgba(166, 62, 85, .30), transparent 62%),
    radial-gradient(620px 460px at 88% 112%, rgba(201, 154, 75, .14), transparent 58%),
    linear-gradient(160deg, #1b1114 0%, #120d12 54%, #0e0b0d 100%);
  color: #f7eadc;
}
.cover::before {
  content: ""; position: fixed; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(216, 176, 106, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(216, 176, 106, .045) 1px, transparent 1px);
  background-size: 58px 58px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 78%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 78%);
}
.cover-inner {
  position: relative; z-index: 1;
  width: min(94vw, 560px); margin: auto; padding: 54px 18px 42px;
  text-align: center;
}
.cover-eyebrow {
  margin: 0 0 24px; font-family: var(--font-en); font-size: 9px; letter-spacing: .42em;
  color: #b99b73; text-transform: uppercase;
}
.cover-seal {
  width: 74px; height: 74px; margin: 0 auto 24px; border-radius: 50%;
  display: grid; place-items: center; position: relative;
  border: 1px solid rgba(216, 176, 106, .48);
  font-family: var(--font-kai); font-size: 33px; color: #e7c98e;
  box-shadow: 0 0 0 9px rgba(216, 176, 106, .05), inset 0 0 26px rgba(216, 176, 106, .16);
}
.cover-seal::before, .cover-seal::after {
  content: ""; position: absolute; inset: 6px; border: 1px solid rgba(216, 176, 106, .22); border-radius: 50%;
}
.cover-seal::after { inset: -16px; border-style: dashed; opacity: .5; }
.cover-title {
  margin: 0; font-family: var(--font-serif); font-weight: 700;
  font-size: clamp(46px, 12.5vw, 78px); line-height: 1.06; letter-spacing: .07em;
  background: linear-gradient(180deg, #fff7ea 0%, #f0d6ae 48%, #c69a62 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 8px 28px rgba(201, 154, 75, .16));
}
.cover-en {
  margin: 19px 0 0; font-family: var(--font-en); font-size: 9.5px; letter-spacing: .38em;
  color: #b18f69; text-transform: uppercase;
}
.cover-sub {
  margin: 20px 0 0; font-family: var(--font-kai); font-size: 16.5px; letter-spacing: .09em; color: #d7c1ad;
}
.cover-sample {
  max-width: 360px; margin: 28px auto 0;
  font-family: var(--font-serif); font-size: 14px; line-height: 2; color: #bca795;
}
.cover-sample .hl {
  color: #f2cbd6; border-bottom: 1px dashed rgba(226, 154, 171, .6); padding: 0 1px;
}
.cover-stats {
  display: flex; justify-content: center; gap: 22px; margin: 28px 0 30px;
  font-size: 9.5px; letter-spacing: .14em; color: #98816d;
}
.cover-stats span { display: flex; align-items: baseline; gap: 4px; }
.cover-stats b { font-family: var(--font-en); font-size: 19px; font-weight: 400; color: #e9d3b6; }
.cover-actions { display: flex; flex-direction: column; gap: 9px; width: min(290px, 78vw); margin: 0 auto; }
.cover-btn {
  border: 0; border-radius: 999px; padding: 14px 22px;
  background: linear-gradient(135deg, #a63e55, #7a2739);
  color: #fff7ef; font-size: 13.5px; letter-spacing: .14em;
  box-shadow: 0 12px 32px rgba(166, 62, 85, .34);
  transition: transform .18s, box-shadow .18s;
}
.cover-btn:hover { transform: translateY(-1px); box-shadow: 0 16px 38px rgba(166, 62, 85, .44); }
.cover-btn.ghost {
  background: transparent; border: 1px solid rgba(216, 176, 106, .34);
  color: #d8c3b0; box-shadow: none; font-size: 12px;
}
.cover-btn.ghost:hover { border-color: rgba(216, 176, 106, .62); background: rgba(216, 176, 106, .06); }
.cover-link {
  border: 0; background: none; color: #a58d77; font-size: 11px;
  text-decoration: underline; text-underline-offset: 4px; margin-top: 3px;
}
.cover-link:hover { color: #e0c9ae; }
.cover-tip {
  margin: 26px 0 0; font-size: 10px; letter-spacing: .18em; color: #816c5b;
}
.cover-foot {
  margin: 34px auto 0; padding-top: 18px; border-top: 1px solid rgba(216, 176, 106, .14);
  font-family: var(--font-en); font-size: 8.5px; letter-spacing: .24em; color: #6f5d50;
  text-transform: uppercase;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 120;
  padding: 9px 17px; border-radius: 999px;
  background: var(--ink); color: var(--paper);
  font-size: 12px; letter-spacing: .03em;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .22);
  opacity: 0; transform: translate(-50%, 16px); pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 响应式 ---------- */
@media (min-width: 901px) {
  body.toc-open .main { margin-left: var(--sidebar-w); }
}
@media (max-width: 900px) {
  .sidebar {
    top: 0; width: min(84vw, 330px); z-index: 70;
    box-shadow: var(--shadow); transform: translateX(-100%);
  }
  body.toc-open .sidebar { transform: translateX(0); }
  body.toc-open .scrim { opacity: 1; pointer-events: auto; }
  .main { padding: calc(var(--topbar-h) + var(--modebar-h) + 22px) 12px 54px; }
  .chapter-card { border-radius: 14px; padding: 28px 20px 32px; }
  .chapter-card::before { border-radius: 14px 14px 0 0; }
  .topbar { padding: 0 8px; }
  .brand-name { display: none; }
  .topbar-center { font-size: 9px; letter-spacing: .12em; }
  .mode-tab { padding: 7px 12px; font-size: 11.5px; }
  .chapter-hook { font-size: 15px; }
  .quiz-options { grid-template-columns: 1fr; }
  .chapter-foot { flex-direction: column; }
  .nav-btn.next { margin-left: 0; text-align: left; align-items: flex-start; }
  .site-foot { flex-direction: column; }
  .modal { padding: 10px; }
  .modal-card { max-height: 90vh; border-radius: 16px; }
  .vocab-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .topbar-center { display: none; }
  .topbar-right { margin-left: auto; }
  .chapter-head h1 { margin-top: 14px; }
  .chapter-kicker { letter-spacing: .18em; }
  .word-card { width: calc(100vw - 24px); }
  .cover-inner { padding-top: 42px; }
  .cover-stats { gap: 15px; }
  .fc-card { height: 238px; }
  .quiz-prompt .big { font-size: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
