/* ==========================================================================
   四级冲刺 · 单词本
   设计方向：夜自习的单词本。墨蓝纸面 / 荧光笔主色 / 音节格
   ========================================================================== */

:root {
  --ink:        #0C1218;
  --ink-2:      #111A22;
  --surface:    #16212C;
  --surface-2:  #1C2936;
  --line:       #25333F;
  --line-soft:  #1D2934;
  --text:       #EDF3F8;
  --text-2:     #B9C6D2;
  --muted:      #7E8E9D;
  --hi:         #FFD166;
  --hi-btn:     #FFD166;
  --hi-dim:     #D8AE4E;
  --hi-wash:    rgba(255, 209, 102, .13);
  --red:        #F2705F;
  --red-wash:   rgba(242, 112, 95, .13);
  --green:      #6FD08C;
  --green-wash: rgba(111, 208, 140, .13);

  --r-s: 10px;
  --r-m: 16px;
  --r-l: 22px;
  --r-xl: 28px;

  --pad: 20px;
  --tab-h: 64px;

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
               "HarmonyOS Sans SC", "MiSans", "Noto Sans SC", "Microsoft YaHei",
               system-ui, sans-serif;
  --font-word: Georgia, "Noto Serif", "Songti SC", "STSong", "SimSun", serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Roboto Mono",
               "Noto Sans Mono", monospace;

  --ease: cubic-bezier(.32, .72, .26, 1);
  --shadow: 0 18px 40px -24px rgba(0, 0, 0, .9);
}

[data-theme="light"] {
  --ink:        #F7F5EF;
  --ink-2:      #F1EEE5;
  --surface:    #FFFFFF;
  --surface-2:  #FAF8F2;
  --line:       #E3DED1;
  --line-soft:  #EDE9DE;
  --text:       #17202A;
  --text-2:     #46545F;
  --muted:      #7A8894;
  --hi:         #D9A21A;
  --hi-btn:     #F0BC3C;
  --hi-dim:     #B8860B;
  --hi-wash:    rgba(217, 162, 26, .12);
  --red:        #C9503C;
  --red-wash:   rgba(201, 80, 60, .10);
  --green:      #2F8F55;
  --green-wash: rgba(47, 143, 85, .10);
  --shadow: 0 16px 36px -26px rgba(40, 35, 20, .55);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--ink);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

/* 手记的点阵纸：极淡的半径圆点，模仿练习本的格线 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle at 1px 1px, var(--line-soft) 1px, transparent 0);
  background-size: 24px 24px;
  opacity: .55;
  z-index: 0;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--hi);
  outline-offset: 3px;
  border-radius: 6px;
}

.tnum { font-variant-numeric: tabular-nums; }

/* ============================ 布局骨架 ============================ */

#app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 var(--pad);
  padding-top: max(18px, env(safe-area-inset-top));
}

.view {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-bottom: calc(var(--tab-h) + 28px + env(safe-area-inset-bottom));
  animation: viewIn .34s var(--ease) both;
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ============================ 顶部栏 ============================ */

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 10px;
}

.topbar h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 620;
  letter-spacing: -.01em;
}

.topbar .eyebrow {
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.streak {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.streak b { color: var(--hi); font-weight: 680; }

/* ============================ 倒计时 ============================ */

.countdown {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 8px;
  padding: 2px 0 0;
}

.countdown .num {
  font-family: var(--font-word);
  font-size: clamp(52px, 17vw, 72px);
  line-height: .92;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}

.countdown .num small {
  font-family: var(--font-sans);
  font-size: 14px;
  letter-spacing: .04em;
  color: var(--muted);
  margin-left: 6px;
  font-weight: 500;
}

.countdown .meta {
  text-align: right;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
}

.countdown .meta b { color: var(--text-2); font-weight: 600; }

/* 细高的进度尺 */
.ruler {
  height: 4px;
  border-radius: 999px;
  background: var(--line-soft);
  overflow: hidden;
  margin-top: 14px;
}

.ruler > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--hi-dim), var(--hi));
  transition: width .6s var(--ease);
}

/* ============================ 卡片 ============================ */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  box-shadow: var(--shadow);
}

.card-pad { padding: 18px; }

.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin: 2px 2px -4px;
}

/* 今日任务三联 */
.tasks { display: grid; gap: 1px; background: var(--line-soft); border-radius: var(--r-l); overflow: hidden; }

.task {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 15px 16px;
  background: var(--surface);
  text-align: left;
  width: 100%;
  transition: background .2s var(--ease);
}

.task:active { background: var(--surface-2); }

.task .ico {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--hi);
}

.task .ico svg { width: 17px; height: 17px; }

.task > span:nth-child(2) { min-width: 0; }
.task .label { display: block; font-size: 15px; font-weight: 560; }
.task .sub { display: block; font-size: 12.5px; color: var(--muted); margin-top: 1px; }

.task .count {
  font-size: 15px;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}

.task .count em { font-style: normal; color: var(--muted); font-weight: 500; font-size: 12.5px; }
.task.done .count { color: var(--green); }
.task.done .ico { color: var(--green); }

/* ============================ 按钮 ============================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 22px;
  border-radius: var(--r-m);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .01em;
  transition: transform .16s var(--ease), background .2s var(--ease), opacity .2s;
  user-select: none;
}

.btn:active { transform: scale(.975); }

.btn-primary {
  background: var(--hi-btn);
  color: #191407;
  width: 100%;
  min-height: 58px;
  font-size: 17px;
  border-radius: var(--r-l);
  box-shadow: 0 14px 30px -18px var(--hi-btn);
}

.btn-primary:disabled { opacity: .45; box-shadow: none; }

.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  width: 100%;
}

.btn-quiet {
  color: var(--text-2);
  min-height: 44px;
  font-size: 14.5px;
  font-weight: 500;
}

/* ============================ 学习卡 ============================ */

.study-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.study-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.study-top .x {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  flex: none;
}

.progress-bar {
  flex: 1;
  height: 5px;
  background: var(--line-soft);
  border-radius: 999px;
  overflow: hidden;
  display: flex;
}

.progress-bar i { display: block; height: 100%; transition: width .4s var(--ease); }
.progress-bar .p-rev { background: var(--hi); }
.progress-bar .p-new { background: var(--green); }

.frac {
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex: none;
  min-width: 46px;
  text-align: right;
}

/* 卡片本体 */
.flash {
  position: relative;
  flex: 1;
  min-height: 340px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 26px 22px 22px;
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  -webkit-user-select: none;
  user-select: none;
}

/* 翻面后底部提示让位给内容 */
.flash.revealed .flash-foot { display: none; }

.flash::before {
  /* 顶部极淡的暖光，像台灯照在纸面上 */
  content: "";
  position: absolute;
  inset: -40% 30% auto -10%;
  height: 60%;
  background: radial-gradient(ellipse at top, var(--hi-wash), transparent 70%);
  pointer-events: none;
}

.flash-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 16px;
  z-index: 1;
}

.flash-tag .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--hi); }

.flash-word {
  position: relative;
  display: inline-block;
  align-self: flex-start;
  font-family: var(--font-word);
  font-size: clamp(38px, 12vw, 56px);
  line-height: 1.14;
  letter-spacing: -.015em;
  word-break: break-word;
  z-index: 1;
  margin: 6px 0 2px;
}

/* 荧光笔划过：翻面时在词根下方画一道 */
.flash-word::after {
  content: "";
  position: absolute;
  left: -3px; right: -3px;
  bottom: 1px;
  height: 7px;
  background: var(--hi);
  opacity: 0;
  border-radius: 4px;
  transform: scaleX(0) rotate(-.5deg);
  transform-origin: left center;
  z-index: -1;
  transition: transform .42s var(--ease), opacity .3s;
}

.flash.revealed .flash-word::after {
  opacity: .92;
  transform: scaleX(1) rotate(-.5deg);
}

.syll {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: .12em;
  color: var(--muted);
  margin-top: 8px;
  z-index: 1;
}

.flash-foot {
  position: absolute;
  left: 22px; right: 22px; bottom: 20px;
  z-index: 1;
}

.hint {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
}

.hint kbd {
  font-family: var(--font-sans);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-2);
}

/* 释义面 */
.answer {
  animation: answerIn .3s var(--ease) both;
}

@keyframes answerIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.answer .pos {
  display: inline-block;
  font-size: 12px;
  letter-spacing: .06em;
  color: var(--hi);
  font-weight: 640;
  margin-right: 8px;
}

.answer .def {
  font-size: 19px;
  line-height: 1.62;
  color: var(--text);
  margin: 12px 0 0;
}

.answer .ipa {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-2);
  margin-top: 10px;
  letter-spacing: .02em;
}

/* 音节格 */
.cells { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 16px; }

.cell {
  min-width: 26px;
  padding: 5px 8px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: .06em;
  color: var(--text-2);
  text-align: center;
}

.cell-dot { color: var(--muted); font-size: 14px; }

/* 词族 */
.family {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.family .t {
  font-size: 11.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.family .list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: var(--text-2);
}

.family .list b { color: var(--hi); font-weight: 600; }

/* ============================ AI 解析 ============================ */

/* 卡片背面的入口条 */
.note-teaser {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  margin-top: 16px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  text-align: left;
  font: inherit;
  color: var(--text-2);
  cursor: pointer;
}

.note-teaser:active { transform: scale(.995); }

.note-teaser .k {
  flex: none;
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--hi);
  font-weight: 700;
  padding-top: 3px;
}

.note-teaser .v {
  font-size: 13.5px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 抽屉里的解析区块 */
.ns { margin-top: 20px; }

.ns-t {
  font-size: 11.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 9px;
}

.ns-b { font-size: 14.5px; line-height: 1.72; color: var(--text-2); }
.ns-b p { margin: 0 0 8px; }
.ns-b p:last-child { margin-bottom: 0; }

/* 拆词 */
.morph {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 14px;
}

.morph em { color: var(--muted); font-style: normal; }

.mz {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.mz b { color: var(--hi); font-weight: 600; }
.mz i { font-style: normal; font-size: 12px; color: var(--muted); }

/* 例句 */
.sent {
  padding: 11px 13px;
  border-radius: 11px;
  background: var(--surface-2);
  margin-bottom: 8px;
}

.sent:last-child { margin-bottom: 0; }
.sent .en { font-size: 14.5px; line-height: 1.6; color: var(--text); }
.sent .zh { font-size: 13px; line-height: 1.55; color: var(--muted); margin-top: 5px; }

/* 同反义词 / 同根词 */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }

.chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 13px;
}

.chip b { font-weight: 500; color: var(--text); }
.chip i { font-style: normal; font-size: 11.5px; color: var(--muted); }

/* 抽屉头部 */
.sheet-head { display: flex; align-items: flex-start; gap: 12px; }.sheet-sub {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13.5px;
  margin-top: 6px;
}
.sheet-sub span { font-family: var(--font-sans); }

/* ============================ 评分条 ============================ */

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

.grade {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 13px 4px 12px;
  border-radius: var(--r-m);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 14.5px;
  font-weight: 600;
  transition: transform .14s var(--ease), border-color .2s, background .2s;
}

.grade:active { transform: scale(.965); }
.grade span { font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: .04em; }

.grade.bad   { color: var(--red); }
.grade.bad:active { background: var(--red-wash); }
.grade.mid   { color: var(--hi); }
.grade.mid:active { background: var(--hi-wash); }
.grade.good  { color: var(--green); }
.grade.good:active { background: var(--green-wash); }

/* ============================ 拼写 ============================ */

.spell-box { display: flex; flex-direction: column; gap: 10px; }

.spell-hint {
  font-size: 17px;
  line-height: 1.55;
  color: var(--text);
}

.spell-hint .pos { color: var(--hi); font-size: 13px; font-weight: 640; margin-right: 6px; }

.slots { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }

.slot {
  width: 15px; height: 26px;
  border-bottom: 2px solid var(--line);
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 17px;
  color: var(--text-2);
}

.slot.dot { width: 8px; border-bottom-color: transparent; color: var(--muted); }
.slot.filled { border-bottom-color: var(--hi); color: var(--text); }
.slot.bad { border-bottom-color: var(--red); color: var(--red); }

.input {
  width: 100%;
  min-height: 56px;
  padding: 0 16px;
  border-radius: var(--r-m);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 22px;
  letter-spacing: .06em;
  outline: none;
}

.input:focus { border-color: var(--hi); }
.input::placeholder { color: var(--muted); letter-spacing: .02em; font-size: 16px; }

/* 拼写模式下真实输入框隐形，字母显示在上面的音节格里 */
.input.ghost {
  position: absolute;
  left: 0; bottom: 0;
  width: 1px; height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.slots { cursor: text; }

.spell-result { font-family: var(--font-mono); font-size: 15px; letter-spacing: .04em; }
.spell-result .ok { color: var(--green); }
.spell-result .no { color: var(--red); }

/* ============================ 完成页 ============================ */

.result {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 40px 0;
}

.result .big {
  font-family: var(--font-word);
  font-size: clamp(56px, 18vw, 76px);
  line-height: 1;
  letter-spacing: -.03em;
}

.result .cap { font-size: 14px; color: var(--muted); }

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line-soft);
  border-radius: var(--r-m);
  overflow: hidden;
  width: 100%;
  margin: 18px 0;
}

.result-stats div { background: var(--surface); padding: 14px 6px; text-align: center; }
.result-stats b { display: block; font-size: 19px; font-variant-numeric: tabular-nums; }
.result-stats span { font-size: 11.5px; color: var(--muted); }

/* ============================ 统计 ============================ */

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

.stat {
  padding: 15px 14px;
  border-radius: var(--r-m);
  background: var(--surface);
  border: 1px solid var(--line);
}

.stat span { font-size: 11.5px; color: var(--muted); letter-spacing: .06em; }
.stat b {
  display: block;
  font-family: var(--font-word);
  font-size: 27px;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.stat b em { font-style: normal; font-size: 14px; color: var(--muted); font-family: var(--font-sans); }

/* 掌握度分布 */
.dist { display: flex; flex-direction: column; gap: 9px; }

.dist-row { display: grid; grid-template-columns: 66px 1fr 44px; align-items: center; gap: 10px; font-size: 12.5px; }
.dist-row .t { color: var(--text-2); }
.dist-row .bar { height: 7px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.dist-row .bar i { display: block; height: 100%; border-radius: 999px; }
.dist-row .n { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* 热力图 */
.heat {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 14px);
  grid-auto-columns: 14px;
  gap: 5px;
  justify-content: space-between;
  overflow: hidden;
}

.heat i {
  border-radius: 4px;
  background: var(--line-soft);
}

.heat i[data-l="1"] { background: color-mix(in srgb, var(--hi) 24%, var(--ink)); }
.heat i[data-l="2"] { background: color-mix(in srgb, var(--hi) 46%, var(--ink)); }
.heat i[data-l="3"] { background: color-mix(in srgb, var(--hi) 70%, var(--ink)); }
.heat i[data-l="4"] { background: var(--hi); }
.heat i[data-f="1"] { outline: 1px solid var(--hi-dim); outline-offset: -1px; }

.heat-legend {
  display: flex; align-items: center; justify-content: flex-end; gap: 5px;
  margin-top: 13px; font-size: 11px; color: var(--muted); letter-spacing: .04em;
}
.heat-legend i { width: 11px; height: 11px; border-radius: 3px; background: var(--line-soft); }

/* 倒计时小标题 */
.cd-label { font-size: 12.5px; color: var(--muted); letter-spacing: .02em; margin-bottom: 4px; }

/* 词库字母分隔 */
.letter {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 14px 2px 6px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .16em;
  color: var(--hi-dim);
  background: linear-gradient(var(--ink) 62%, transparent);
}

/* ============================ 词库 ============================ */

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 46px;
  border-radius: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
}

.search input {
  flex: 1;
  border: 0;
  background: none;
  outline: none;
  font-size: 16px;
  color: var(--text);
}

.search input::placeholder { color: var(--muted); }

.wlist { display: flex; flex-direction: column; }

.wrow {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 13px 2px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  width: 100%;
}

.wrow .wmain {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.wrow .w {
  display: block;
  font-family: var(--font-word);
  font-size: 20px;
  letter-spacing: -.01em;
  line-height: 1.15;
}

.wrow .d {
  display: block;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wrow .mark {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  flex: none;
}

.wrow .mark.hot { color: var(--hi); background: var(--hi-wash); }
.wrow .mark.ok { color: var(--green); background: var(--green-wash); }

.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

/* ============================ 设置 ============================ */

.setting {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line-soft);
}

.setting:first-child { border-radius: var(--r-l) var(--r-l) 0 0; }
.setting:last-child { border-radius: 0 0 var(--r-l) var(--r-l); border-bottom: 0; }
.setting .t { font-size: 15px; }
.setting .s { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.45; }

.switch {
  position: relative;
  width: 46px; height: 28px;
  border-radius: 999px;
  background: var(--line);
  transition: background .22s var(--ease);
  flex: none;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--text);
  transition: transform .22s var(--ease);
}

.switch[aria-checked="true"] { background: var(--hi); }
.switch[aria-checked="true"]::after { transform: translateX(18px); background: #191407; }

.seg { display: flex; gap: 4px; padding: 3px; background: var(--surface-2); border-radius: 9px; }

.seg button {
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 560;
}

.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.18); }

/* ============================ 底部导航 ============================ */

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  background: color-mix(in srgb, var(--ink) 86%, transparent);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-top: 1px solid var(--line-soft);
  z-index: 40;
}

.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  letter-spacing: .02em;
  color: var(--muted);
  padding: 6px 0;
  transition: color .2s;
}

.tabbar a svg { width: 21px; height: 21px; }

.tabbar a[aria-current="page"] { color: var(--hi); }
.tabbar a[aria-current="page"] svg { stroke-width: 2.1; }

/* 学习模式隐藏导航 */
body.no-tabs .tabbar { display: none; }
body.no-tabs .view { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }

/* ============================ 底部抽屉 ============================ */

.sheet-back {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 60;
  opacity: 0;
  animation: fade .2s var(--ease) forwards;
}

@keyframes fade { to { opacity: 1; } }

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 560px;
  max-height: 82dvh;
  overflow-y: auto;
  background: var(--ink-2);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  border-top: 1px solid var(--line);
  padding: 10px var(--pad) calc(24px + env(safe-area-inset-bottom));
  z-index: 61;
  animation: sheetUp .3s var(--ease) forwards;
}

@keyframes sheetUp { to { transform: translateX(-50%) translateY(0); } }

.sheet .grab {
  width: 38px; height: 4px;
  border-radius: 999px;
  background: var(--line);
  margin: 4px auto 16px;
}

.sheet h2 { margin: 0 0 4px; font-size: 17px; font-weight: 620; }

/* 提示条 */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + 22px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(10px);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13.5px;
  padding: 10px 18px;
  border-radius: 999px;
  z-index: 70;
  opacity: 0;
  transition: opacity .22s, transform .22s var(--ease);
  pointer-events: none;
  white-space: nowrap;
}

.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================ 杂项 ============================ */

.divider { height: 1px; background: var(--line-soft); margin: 4px 0; }

.note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.65;
}

.note b { color: var(--text-2); font-weight: 600; }

.linkish { color: var(--hi); font-size: 13.5px; font-weight: 560; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

@media (min-width: 480px) {
  :root { --pad: 24px; }
  .countdown .num { font-size: 76px; }
}
