:root {
  --bg: #0C0D10;
  --bg-2: #13151A;
  --card: #1A1C22;
  --card-2: #22252C;
  --line: #2C3038;
  --text: #F1EBE3;
  --muted: #9B958C;
  --faint: #6E6A64;
  --gold: #E8B86D;
  --gold-dim: #3A2F1C;
  --green: #7BC49A;
  --green-dim: #1C3328;
  --red: #E07A6A;
  --red-dim: #3A1F1C;
  --blue: #8AA4C8;
  --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: 1;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  font-size: calc(16px * var(--font));
  line-height: 1.55;
  min-height: 100%;
  overflow: hidden;
}
button {
  font: inherit; color: inherit; background: none; border: 0; padding: 0;
  cursor: pointer;
}
button:disabled { opacity: .4; }
#app { height: 100dvh; display: flex; flex-direction: column; }

.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.scroll { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; padding: 16px 18px calc(24px + var(--safe-bottom)); }
.topbar {
  padding: calc(14px + var(--safe-top)) 18px 12px;
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(180deg, var(--bg) 70%, transparent);
}
.topbar h1 { font-size: 1.15rem; font-weight: 700; margin: 0; letter-spacing: .02em; }
.topbar .sub { color: var(--muted); font-size: .8rem; margin-top: 2px; }
.topbar .grow { flex: 1; min-width: 0; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--card); color: var(--text);
  display: grid; place-items: center; flex-shrink: 0;
}
.icon-btn svg { width: 20px; height: 20px; }

.hero {
  background: linear-gradient(160deg, #2A2418 0%, var(--card) 55%);
  border: 1px solid #3A3428;
  border-radius: 20px;
  padding: 18px 18px 16px;
  margin-bottom: 16px;
}
.hero .label { color: var(--gold); font-size: .78rem; letter-spacing: .08em; }
.hero .nums { display: flex; gap: 18px; margin-top: 10px; }
.hero .n { font-size: 1.6rem; font-weight: 700; color: var(--text); }
.hero .n small { display: block; font-size: .72rem; font-weight: 500; color: var(--muted); margin-top: 2px; }
.bar { height: 6px; background: #2A2A28; border-radius: 99px; overflow: hidden; margin-top: 14px; }
.bar > i { display: block; height: 100%; background: var(--gold); border-radius: 99px; width: 0; transition: width .3s; }

.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.mode {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 14px 12px;
  text-align: left;
  min-height: 76px;
}
.mode .t { font-weight: 650; }
.mode .d { color: var(--muted); font-size: .78rem; margin-top: 4px; }
.mode.warn { border-color: #4A2E2A; background: var(--red-dim); }
.mode.warn .t { color: #F0A89C; }

.sec-title { color: var(--muted); font-size: .78rem; margin: 6px 0 10px; letter-spacing: .06em; }

.ch {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 8px;
  text-align: left;
}
.ch .no {
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--gold-dim); color: var(--gold);
  display: grid; place-items: center;
  font-weight: 700; flex-shrink: 0;
}
.ch .meta { flex: 1; min-width: 0; }
.ch .name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch .info { color: var(--muted); font-size: .76rem; margin-top: 2px; }
.ch .mini { width: 64px; height: 4px; background: #2A2A28; border-radius: 99px; overflow: hidden; flex-shrink: 0; }
.ch .mini i { display: block; height: 100%; background: var(--gold); }

.q-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill {
  font-size: .72rem; padding: 3px 8px; border-radius: 999px;
  background: var(--card-2); color: var(--muted);
}
.pill.gold { background: var(--gold-dim); color: var(--gold); }
.pill.red { background: var(--red-dim); color: #F0A89C; }
.pill.green { background: var(--green-dim); color: var(--green); }
.pill.blue { background: #1C2733; color: var(--blue); }
.q-progress { margin-left: auto; color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }

.know { color: var(--gold); font-size: .85rem; margin: 8px 0 12px; }

.stem { font-size: 1.02rem; white-space: pre-wrap; word-break: break-word; }
.code {
  margin: 12px 0 0;
  background: #0A0B0E;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 12px 12px 14px;
  overflow: auto;
  font-family: "Droid Sans Mono", "Cascadia Mono", "Menlo", ui-monospace, monospace;
  font-size: .82rem;
  line-height: 1.5;
  color: #D7E0EA;
  white-space: pre;
}
.code .lbl { display: block; color: var(--faint); font-family: inherit; font-size: .7rem; margin-bottom: 6px; letter-spacing: .06em; }

.reveal {
  width: 100%;
  margin-top: 20px;
  background: var(--gold);
  color: #1A140C;
  font-weight: 700;
  border-radius: 14px;
  padding: 14px;
  min-height: 52px;
}
.ans {
  margin-top: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
}
.ans .h { color: var(--green); font-size: .78rem; letter-spacing: .08em; margin-bottom: 8px; }
.ans .body { white-space: pre-wrap; word-break: break-word; }

.dock {
  padding: 10px 16px calc(12px + var(--safe-bottom));
  background: #101117;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.dock .row2 { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn {
  border-radius: 14px; padding: 12px 10px; min-height: 48px;
  font-weight: 650; background: var(--card-2); color: var(--text);
}
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.btn.ok { background: var(--green-dim); color: var(--green); border: 1px solid #2E5440; }
.btn.bad { background: var(--red-dim); color: #F0A89C; border: 1px solid #54302E; }

.sheet {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: flex-end; z-index: 20;
}
.sheet .panel {
  width: 100%; background: #16181E;
  border-radius: 20px 20px 0 0;
  padding: 10px 18px calc(20px + var(--safe-bottom));
}
.grab { width: 40px; height: 4px; background: #3A3A40; border-radius: 99px; margin: 6px auto 14px; }
.opt { width: 100%; text-align: left; padding: 14px 4px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; }
.opt:last-child { border-bottom: 0; }
.opt .cur { color: var(--gold); }

.empty { text-align: center; color: var(--muted); padding: 48px 12px; }
.toast {
  position: fixed; left: 50%; bottom: calc(90px + var(--safe-bottom));
  transform: translateX(-50%);
  background: #2A2D34; color: var(--text);
  padding: 8px 14px; border-radius: 999px; font-size: .82rem;
  opacity: 0; pointer-events: none; transition: opacity .2s;
  z-index: 30;
}
.toast.show { opacity: 1; }

.filter-row { display: flex; gap: 8px; overflow: auto; padding-bottom: 8px; margin-bottom: 8px; }
.chip {
  flex-shrink: 0; padding: 6px 12px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line);
  color: var(--muted); font-size: .8rem;
}
.chip.on { background: var(--gold-dim); border-color: #5A4A2A; color: var(--gold); }

/* 科目切换 */
.subj-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 18px 6px; }
.subj-tabs.n3 { grid-template-columns: 1fr 1fr 1fr; }
.subj-tabs.n3 .subj { padding: 8px 6px; font-size: .92rem; }
.subj-tabs.n4 { grid-template-columns: 1fr 1fr; }
.subj-tabs.n4 .subj { min-height: 52px; }
.subj {
  min-height: 52px; border-radius: 14px; background: var(--card); border: 1px solid var(--line);
  color: var(--muted); font-weight: 650; padding: 8px 10px; text-align: center; line-height: 1.25;
}
.subj small { display: block; font-size: .7rem; font-weight: 500; color: var(--faint); margin-top: 2px; }
.subj.on { background: var(--gold-dim); border-color: #5A4A2A; color: var(--gold); }
.subj.on small { color: #B8975E; }

/* 选择题 */
.stem.en { font-size: 1.06rem; line-height: 1.65; }
.stem u { text-decoration-color: var(--gold); text-underline-offset: 3px; }
.stem u b { color: var(--gold); font-weight: 600; font-size: .8em; margin-left: 2px; }
.choices { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.choice {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px;
  padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line);
  text-align: left; transition: background .15s, border-color .15s;
}
.choice:disabled { opacity: 1; }
.choice .k {
  width: 32px; height: 32px; border-radius: 10px; background: var(--card-2); color: var(--muted);
  display: grid; place-items: center; font-weight: 700; flex-shrink: 0;
}
.choice .v { flex: 1; word-break: break-word; }
.choice.right { background: var(--green-dim); border-color: #2E5440; }
.choice.right .k { background: var(--green); color: #0C1A12; }
.choice.wrong { background: var(--red-dim); border-color: #54302E; }
.choice.wrong .k { background: var(--red); color: #1A0C0A; }
.choice.dim { opacity: .55; }
.ans.good { border-color: #2E5440; }
.ans.badans { border-color: #54302E; }
.ans .verdict { font-weight: 700; margin-bottom: 6px; }
.ans.good .verdict { color: var(--green); }
.ans.badans .verdict { color: #F0A89C; }
.ans .src { color: var(--faint); font-size: .74rem; margin-top: 10px; }
.ans .src.warnc { color: var(--gold); }


/* 章节题目目录 */
.filter-row { flex-shrink: 0; }
.qrow {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 68px;
  padding: 12px 14px; margin-bottom: 8px;
  border-radius: 14px; background: var(--card); border: 1px solid var(--line);
  text-align: left;
}
.qrow .idx {
  width: 28px; flex-shrink: 0;
  color: var(--faint); font-weight: 700; font-variant-numeric: tabular-nums;
}
.qrow .meta { flex: 1; min-width: 0; }
.qrow .line1 { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.qrow .know-s { color: var(--muted); font-size: .86rem; }
.qrow .snip {
  color: var(--faint); font-size: .8rem; margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.qrow .st { flex-shrink: 0; font-size: .78rem; font-weight: 650; }
.qrow.st-new .st { color: var(--muted); }
.qrow.st-ok .st { color: var(--green); }
.qrow.st-wrong .st { color: var(--red); }
.qrow.st-seen .st { color: var(--blue); }
.qrow.last { border-color: #5A4A2A; background: var(--gold-dim); }
.cat-sec {
  color: var(--muted); font-size: .8rem; font-weight: 650;
  padding: 14px 4px 8px;
}
.cat-sec:first-child { padding-top: 4px; }

/* 填空 / 综合 */
.passage {
  margin: 2px 0 16px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 1rem;
  color: var(--text);
}
.fill-box { margin-top: 18px; }
.fill-input {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #0A0B0E;
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
  -webkit-appearance: none;
  appearance: none;
}
.fill-input::placeholder { color: var(--faint); }
.fill-input:focus { outline: none; border-color: var(--gold); background: #101218; }
.fill-input:disabled { opacity: .85; }
.fill-submit {
  width: 100%;
  margin-top: 10px;
  background: var(--gold);
  color: #1A140C;
  font-weight: 700;
  border-radius: 14px;
  padding: 14px;
  min-height: 52px;
}

/* ===== 小蓝书背单词（不背单词风格） ===== */
.hub-cards { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.hub-card {
  width: 100%; text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px 18px 16px;
}
.hub-card.vocab {
  background: linear-gradient(160deg, #1A2430 0%, var(--card) 55%);
  border-color: #2A3A4A;
}
.hub-card .k { font-size: .78rem; letter-spacing: .08em; color: var(--gold); }
.hub-card.vocab .k { color: var(--blue); }
.hub-card .tt { font-size: 1.2rem; font-weight: 700; margin: 4px 0 6px; }
.hub-card .dd { color: var(--muted); font-size: .84rem; }
.hub-card .hub-bar { margin-top: 12px; }

.vlist {
  width: 100%; text-align: left;
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 14px;
  margin-bottom: 10px;
}
.vlist .no {
  width: 42px; height: 42px; border-radius: 14px;
  background: #1C2733; color: var(--blue);
  display: grid; place-items: center;
  font-weight: 700; flex-shrink: 0; font-size: .95rem;
}
.vlist .meta { flex: 1; min-width: 0; }
.vlist .name { font-weight: 700; font-size: 1.02rem; }
.vlist .info { color: var(--muted); font-size: .76rem; margin-top: 3px; }
.vlist .mini { width: 64px; height: 4px; background: #2A2A28; border-radius: 99px; overflow: hidden; flex-shrink: 0; }
.vlist .mini i { display: block; height: 100%; background: var(--blue); }

.vocab-screen .scroll { display: flex; flex-direction: column; }
.v-modes { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.vcard {
  flex: 1;
  min-height: 260px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px 22px 22px;
  display: flex; flex-direction: column;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  user-select: none;
}
.vcard .hint { color: var(--faint); font-size: .8rem; margin-bottom: 18px; }
.vcard .head {
  font-size: calc(1.85rem * var(--font));
  font-weight: 750;
  line-height: 1.3;
  word-break: break-word;
  letter-spacing: .01em;
  color: var(--text);
}
.vcard .subtag { color: var(--muted); font-size: .78rem; margin-top: 10px; }
.vcard.back { background: linear-gradient(180deg, #1A1E26 0%, var(--card) 40%); }
.vcard .meaning {
  font-size: calc(1.35rem * var(--font));
  font-weight: 650;
  line-height: 1.45;
  color: var(--text);
  word-break: break-word;
}
.vcard .extra {
  margin-top: 16px;
  color: var(--gold);
  font-size: calc(1.02rem * var(--font));
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
}
.vcard .front-en { color: var(--muted); font-size: 1rem; margin-top: 12px; }

.dock.vocab-dock { grid-template-columns: 1fr 1fr; }
.dock.vocab-dock .btn {
  min-height: 56px;
  font-size: 1.05rem;
  font-weight: 750;
  border-radius: 16px;
}
.dock.vocab-dock .btn.bad { background: #4A2622; color: #F4B0A4; border-color: #6A3A34; }
.dock.vocab-dock .btn.ok { background: #1E3A2C; color: #8FD4AC; border-color: #2E5440; }

.vwrite { margin-top: 8px; }
.vwrite .prompt {
  text-align: center;
  font-size: calc(1.7rem * var(--font));
  font-weight: 750;
  margin-bottom: 6px;
}
.vwrite .prompt-zh { text-align: center; color: var(--muted); margin-bottom: 18px; }
.vwrite label { display: block; color: var(--muted); font-size: .8rem; margin: 10px 0 6px; }
.vwrite .fill-input.okish { border-color: #2E5440; }
.vwrite .fill-input.badish { border-color: #54302E; }
.vwrite .grade {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
}
.vwrite .grade.good { border-color: #2E5440; }
.vwrite .grade.bad { border-color: #54302E; }
.vwrite .grade .verdict { font-weight: 700; margin-bottom: 6px; }
.vwrite .grade.good .verdict { color: var(--green); }
.vwrite .grade.bad .verdict { color: #F0A89C; }

.vsum { text-align: center; padding: 12px 8px 8px; }
.vsum .big { font-size: 1.3rem; font-weight: 700; margin: 8px 0 16px; }
.vsum .nums { display: flex; justify-content: center; gap: 28px; margin-bottom: 22px; }
.vsum .n { font-size: 1.7rem; font-weight: 700; }
.vsum .n small { display: block; font-size: .75rem; font-weight: 500; color: var(--muted); margin-top: 2px; }
.vsum .n.ok { color: var(--green); }
.vsum .n.bad { color: var(--red); }
.vsum-actions { display: flex; flex-direction: column; gap: 10px; }
.vsum-actions .btn { min-height: 52px; }

.v-empty { text-align: center; color: var(--muted); padding: 36px 12px; }
