:root {
  color-scheme: light;
  --bg: #f6f5f1;
  --card: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --line: #e1e0d9;
  --axis: #c3c2b7;
  --ring: rgba(11, 11, 11, 0.1);
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --accent-soft: #e3eefb;
  --ok: #006300;
  --ok-soft: #e2f3e2;
  --warn: #8a5a00;
  --warn-soft: #fdf1d6;
  --danger: #c52f2f;
  --hit: rgba(11, 11, 11, 0.05);
  /* 分类色（按固定顺序分配，见 dataviz 参考调色板） */
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --s5: #e87ba4;
  --s6: #008300;
  --s7: #4a3aa7;
  --s8: #e34948;
  --s-other: #a3a29b;
  --radius: 14px;
  --tabbar-h: 58px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211;
    --card: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --line: #2c2c2a;
    --axis: #383835;
    --ring: rgba(255, 255, 255, 0.1);
    --accent: #3987e5;
    --accent-soft: #1b2d44;
    --ok: #0ca30c;
    --ok-soft: #173017;
    --warn: #fab219;
    --warn-soft: #3a2e10;
    --danger: #e66767;
    --hit: rgba(255, 255, 255, 0.06);
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --s4: #c98500;
    --s5: #d55181;
    --s6: #008300;
    --s7: #9085e9;
    --s8: #e66767;
    --s-other: #6b6a65;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211;
  --card: #1a1a19;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --line: #2c2c2a;
  --axis: #383835;
  --ring: rgba(255, 255, 255, 0.1);
  --accent: #3987e5;
  --accent-soft: #1b2d44;
  --ok: #0ca30c;
  --ok-soft: #173017;
  --warn: #fab219;
  --warn-soft: #3a2e10;
  --danger: #e66767;
  --hit: rgba(255, 255, 255, 0.06);
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --s4: #c98500;
  --s5: #d55181;
  --s6: #008300;
  --s7: #9085e9;
  --s8: #e66767;
  --s-other: #6b6a65;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "PingFang SC", "Segoe UI", "Microsoft YaHei", sans-serif;
  padding: calc(env(safe-area-inset-top) + 52px) 0 calc(env(safe-area-inset-bottom) + var(--tabbar-h) + 84px);
  overscroll-behavior-y: none;
}
body.sheet-open { overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; }
h3 { font-size: 15px; margin-bottom: 10px; display: flex; align-items: baseline; gap: 8px; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.pad { padding: 10px 4px; }

/* ---------- 顶栏 / 底栏 ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  padding: env(safe-area-inset-top) 16px 0;
  height: calc(env(safe-area-inset-top) + 52px);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync-badge {
  flex: none; border: 0; border-radius: 999px; padding: 4px 10px; font-size: 12px;
  background: var(--line); color: var(--ink-2);
}
.sync-badge.ok { background: var(--ok-soft); color: var(--ok); }
.sync-badge.busy { background: var(--accent-soft); color: var(--accent); }
.sync-badge.warn, .sync-badge.err { background: var(--warn-soft); color: var(--warn); }

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tabbar button {
  height: var(--tabbar-h); border: 0; background: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px;
}
.tabbar .ti { font-size: 20px; line-height: 1; filter: grayscale(1); opacity: .7; }
.tabbar button.on { color: var(--accent); font-weight: 600; }
.tabbar button.on .ti { filter: none; opacity: 1; }

.fab {
  position: fixed; z-index: 19; right: 16px;
  bottom: calc(env(safe-area-inset-bottom) + var(--tabbar-h) + 16px);
  border: 0; border-radius: 999px; padding: 13px 20px;
  background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 16px;
  box-shadow: 0 6px 18px rgba(42, 120, 214, .35);
}
body:not([data-tab="log"]) .fab { display: none; }

main { max-width: 640px; margin: 0 auto; padding: 12px 16px; }

/* ---------- 卡片 / 通用 ---------- */
.card {
  background: var(--card); border-radius: var(--radius); padding: 14px;
  box-shadow: 0 0 0 1px var(--ring); margin-bottom: 12px;
}
.btn {
  border: 0; border-radius: 10px; padding: 10px 14px; background: var(--accent-soft); color: var(--accent); font-weight: 600;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-2); font-weight: 500; }
.btn.danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1px var(--line); }
.btn.wide { display: block; width: 100%; margin: 4px 0 12px; }
.btn:disabled { opacity: .5; }
.link { border: 0; background: none; color: var(--accent); padding: 4px 0; }
.link.strong { font-weight: 700; }
.link.danger { color: var(--danger); }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.row-btns .btn { flex: 1; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; margin-right: 6px; vertical-align: 1px; }
/* 多类型内容：几个色点挨着 */
.dots { display: inline-flex; gap: 2px; margin-right: 6px; flex: none; vertical-align: 1px; }
.dots .dot { margin-right: 0; }

input[type="text"], input:not([type]), input[type="search"], input[type="number"], input[type="date"], input[type="time"], textarea {
  border: 0; border-radius: 10px; padding: 9px 11px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line);
  outline: none; min-width: 0; font-size: 16px; /* 16px 避免 iOS 聚焦时自动放大 */
}
input:focus, textarea:focus { box-shadow: inset 0 0 0 2px var(--accent); }
textarea { width: 100%; resize: vertical; }

.frow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; }
.frow > span:first-child { color: var(--ink-2); flex: none; }
.frow input { flex: 1; max-width: 220px; }
.times { display: flex; align-items: center; gap: 6px; }
.times input { width: 104px; }
.field-label { color: var(--ink-2); margin: 12px 0 6px; font-size: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.chip {
  border: 0; border-radius: 999px; padding: 7px 12px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line);
  display: inline-flex; align-items: center; font-size: 14px; max-width: 100%;
}
.chip.small { padding: 5px 10px; font-size: 13px; }
.chip.on { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); color: var(--ink); font-weight: 600; }
.chip.add { color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: transparent; }
.chip.ghost { background: transparent; }

.seg { display: flex; background: var(--line); border-radius: 10px; padding: 3px; margin-bottom: 12px; }
.seg button { flex: 1; border: 0; background: none; border-radius: 8px; padding: 7px 4px; color: var(--ink-2); font-size: 14px; white-space: nowrap; }
.seg button.on { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.seg.small button { padding: 5px 8px; font-size: 13px; }
.toolbar { display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.toolbar .seg { margin-bottom: 10px; }

/* ---------- 统计小卡 ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.tiles.three { grid-template-columns: repeat(3, 1fr); }
@media (min-width: 480px) { .tiles { grid-template-columns: repeat(4, 1fr); } .tiles.three { grid-template-columns: repeat(3, 1fr); } }
.tile { background: var(--card); border-radius: 12px; padding: 10px 12px; box-shadow: 0 0 0 1px var(--ring); min-width: 0; }
.tile-label { font-size: 12.5px; color: var(--ink-2); }
.tile-value { font-size: 24px; font-weight: 700; line-height: 1.25; white-space: nowrap; }
.tile-value small { font-size: 12.5px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.tile-sub { font-size: 12px; color: var(--muted); }

/* ---------- 记录列表 ---------- */
.onboard b { font-size: 16px; }
.timer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.timer > .btn, .timer-btns .btn { white-space: nowrap; flex-shrink: 0; }
.timer.running { box-shadow: 0 0 0 2px var(--accent); }
.timer .clock { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.timer-btns { display: flex; flex-direction: column; gap: 6px; }
.day-head { display: flex; justify-content: space-between; color: var(--ink-2); font-size: 13.5px; font-weight: 600; margin: 18px 4px 8px; }
.block { cursor: pointer; }
.block:active { transform: scale(.995); }
.block-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; gap: 8px; }
.block-time { font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }
.bi { padding: 6px 0; border-top: 1px dashed var(--line); }
.bi:first-of-type { border-top: 0; }
.bi-top { display: flex; align-items: center; gap: 4px; }
.bi-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bi-min { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.block-note { color: var(--ink-2); font-size: 13.5px; margin-top: 6px; }
.wchips { display: flex; flex-wrap: wrap; gap: 6px; }
.wchips.small { margin: 6px 0 0 15px; }
.wchips.small span { font-size: 12.5px; padding: 2px 8px; border-radius: 6px; background: var(--bg); color: var(--ink-2); }
.wchips.small .more { color: var(--muted); }
.empty { text-align: center; padding: 40px 16px; color: var(--ink-2); }
.empty.small { padding: 24px 8px; font-size: 14px; color: var(--muted); }
.empty-icon { font-size: 40px; }

/* ---------- 抽屉（编辑器） ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet-panel {
  width: 100%; max-width: 640px; height: calc(100% - env(safe-area-inset-top) - 10px);
  background: var(--bg); border-radius: 16px 16px 0 0; display: flex; flex-direction: column;
}
/* 只在打开时播放，内部重绘不会再闪 */
.sheet.enter .sheet-panel { animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-head { display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 16px; text-align: center; }
.sheet-head .link:last-child { text-align: right; }
.sheet-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 16px calc(env(safe-area-inset-bottom) + 40px); }
.item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { border: 0; border-radius: 8px; width: 40px; height: 36px; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.stepper input { width: 64px; text-align: center; }
.newres { background: var(--bg); border-radius: 10px; padding: 10px; margin: 8px 0; box-shadow: inset 0 0 0 1px var(--line); }
.newres input { width: 100%; background: var(--card); }
.alloc { font-size: 13.5px; text-align: center; margin: -4px 0 12px; }
.alloc.ok { color: var(--ok); }
.alloc.warn { color: var(--warn); }

.wchip { display: inline-flex; align-items: center; gap: 2px; background: var(--accent-soft); color: var(--ink); border-radius: 8px; padding: 3px 4px 3px 10px; font-size: 14px; }
.wchip button { border: 0; background: none; color: var(--muted); font-size: 16px; line-height: 1; padding: 2px 6px; }
.search { margin: 8px 0 4px; }
.search input { width: 100%; }
.search.sticky { position: sticky; top: calc(env(safe-area-inset-top) + 58px); z-index: 5; margin-top: 0; }
.results { max-height: 300px; overflow-y: auto; border-radius: 10px; }
.results:empty { display: none; }
.results { box-shadow: inset 0 0 0 1px var(--line); margin-top: 6px; }
.word-row { display: flex; align-items: center; gap: 8px; padding: 10px 10px; border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; }
.word-row:last-child { border-bottom: 0; }
.word-row .check { width: 22px; height: 22px; border-radius: 6px; box-shadow: inset 0 0 0 1.5px var(--axis); display: grid; place-items: center; flex: none; font-size: 14px; font-weight: 700; }
.word-row.sel { background: var(--accent-soft); }
.word-row.sel .check { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.word-row .w { font-weight: 600; }
.word-row .m { color: var(--ink-2); font-size: 13.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.word-row.add { color: var(--accent); justify-content: center; }
/* 英式音标 */
.ph { color: var(--muted); font-size: 13px; font-weight: 400; white-space: nowrap; }
.word-row .ph { flex: none; margin-left: -2px; }
.wrow .ph, .rv-main .ph { margin-right: 8px; }
.badge { font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: var(--bg); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); flex: none; }
.badge.ok { color: var(--ok); background: var(--ok-soft); box-shadow: none; }

/* ---------- 单词本 ---------- */
.wlist { padding: 0 14px; }
.wrow { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.wrow:last-child { border-bottom: 0; }
.wrow-main { flex: 1; min-width: 0; }
.wrow .w { font-weight: 700; font-size: 16px; margin-right: 8px; }
.wrow .m { color: var(--ink-2); font-size: 14px; }
.master { flex: none; border: 0; border-radius: 999px; padding: 6px 12px; font-size: 13px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-2); }
.master.on { background: var(--ok-soft); color: var(--ok); box-shadow: none; font-weight: 600; }
.word-hero { text-align: center; }
.word-hero .big { font-size: 34px; font-weight: 800; }
.word-hero .ph { display: block; font-size: 17px; margin-top: 2px; }
.word-hero .meaning { color: var(--ink-2); font-size: 17px; margin: 4px 0 14px; }
.speak { border: 0; background: var(--accent-soft); border-radius: 999px; width: 40px; height: 40px; font-size: 18px; vertical-align: middle; }
.master.big-btn { padding: 10px 20px; font-size: 15px; }
.occ { display: flex; justify-content: space-between; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; cursor: pointer; }
.occ:last-child { border-bottom: 0; }
.occ-res { color: var(--ink-2); text-align: right; }

/* ---------- 设置 ---------- */
.code { font-size: 30px; font-weight: 800; letter-spacing: 3px; text-align: center; font-variant-numeric: tabular-nums; padding: 8px; background: var(--bg); border-radius: 10px; margin-bottom: 6px; }
#dlg-code { text-transform: uppercase; letter-spacing: 1px; }
.lrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.lrow > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 图表 ---------- */
.chart-card { overflow: hidden; }
.chart { display: block; margin-top: 6px; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .direct { fill: var(--ink-2); font-size: 11.5px; font-weight: 600; }
.chart .ring { stroke: var(--card); stroke-width: 2; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit.active { fill: var(--hit); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink-2); margin: 6px 0 2px; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-item i { width: 10px; height: 10px; border-radius: 3px; }
.hbars { display: flex; flex-direction: column; gap: 12px; }
.hbar-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; margin-bottom: 4px; }
.hbar-label { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.hbar-label i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.hbar-val { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hbar-track { height: 8px; border-radius: 4px; background: var(--bg); }
.hbar-fill { height: 100%; border-radius: 4px; }
.hbar-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.table-view { margin-top: 10px; font-size: 13px; }
.table-view summary { color: var(--accent); cursor: pointer; }
.table-view table { width: 100%; border-collapse: collapse; margin-top: 8px; font-variant-numeric: tabular-nums; }
.table-view th, .table-view td { padding: 5px 4px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.table-view th:first-child, .table-view td:first-child { text-align: left; }
.table-view { overflow-x: auto; }

.viz-tip {
  position: absolute; z-index: 60; pointer-events: none; white-space: pre-line;
  background: var(--ink); color: var(--card); font-size: 12.5px; line-height: 1.5;
  padding: 7px 10px; border-radius: 8px; max-width: 240px; box-shadow: 0 4px 14px rgba(0,0,0,.2);
}
.viz-tip[hidden] { display: none; }

.toast {
  position: fixed; left: 50%; z-index: 120; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  bottom: calc(env(safe-area-inset-bottom) + var(--tabbar-h) + 80px);
  background: var(--ink); color: var(--card); padding: 10px 16px; border-radius: 999px; font-size: 14px;
  transition: .2s; max-width: calc(100% - 32px); display: flex; align-items: center; gap: 10px;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { border: 0; background: var(--accent); color: #fff; border-radius: 999px; padding: 4px 12px; font-weight: 600; }

/* ---------- 对话框 ---------- */
.dlg {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; justify-content: center; align-items: flex-start;
  padding: calc(env(safe-area-inset-top) + 12vh) 16px 16px; overflow-y: auto;
}
.dlg-box {
  width: 100%; max-width: 380px; background: var(--card); border-radius: 16px; padding: 18px 16px 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25); animation: pop .16s ease-out;
}
.dlg-box.narrow { max-width: 300px; }
.dlg-box.wide { max-width: 480px; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.dlg-title { font-size: 17px; margin-bottom: 6px; display: block; }
.dlg-msg { color: var(--ink-2); font-size: 14.5px; margin: 0 0 10px; }
.dlg-input { width: 100%; margin: 6px 0; }
.dlg-btns { display: flex; gap: 8px; margin-top: 14px; }
.dlg-btns .btn { flex: 1; }
.dlg-list { max-height: 50vh; overflow-y: auto; }
.btn.danger-solid { background: var(--danger); color: #fff; }
.lrow.static { cursor: default; }
.lrow-btns { display: flex; gap: 14px; flex: none; }
.chip.static { cursor: default; }
.help-list { padding-left: 20px; margin: 4px 0; font-size: 14px; color: var(--ink-2); }
.help-list li { margin-bottom: 8px; }
.help-list b { color: var(--ink); }

/* ---------- 编辑器：管理内容 ---------- */
.item-acts { display: flex; gap: 14px; }
.item.managing { box-shadow: 0 0 0 2px var(--accent); }
.manage-tip { margin: 0 0 4px; }
.chip.editing { border-style: dashed; }
.chip .pen { margin-left: 6px; color: var(--accent); font-size: 12px; }
.chip.archived { opacity: .75; }

/* ---------- 掌握程度 ---------- */
.lvl { flex: none; border: 0; border-radius: 999px; padding: 6px 12px; font-size: 13px; white-space: nowrap; }
.lv0.lvl, .badge.lv0 { background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-2); }
.lv1.lvl, .badge.lv1 { background: var(--warn-soft); color: var(--warn); box-shadow: none; }
.lv2.lvl, .badge.lv2 { background: var(--accent-soft); color: var(--accent); box-shadow: none; }
.lv3.lvl, .badge.lv3 { background: var(--ok-soft); color: var(--ok); box-shadow: none; font-weight: 600; }
.lvl-pick { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.lvl-pick .lvl { padding: 11px; font-size: 15px; }
.lvl-pick .lvl.cur { font-weight: 700; outline: 2px solid currentColor; outline-offset: -2px; }
.lvl-seg { margin: 4px 0 6px; }
.lvl-seg button.on.lv1 { background: var(--warn-soft); color: var(--warn); }
.lvl-seg button.on.lv2 { background: var(--accent-soft); color: var(--accent); }
.lvl-seg button.on.lv3 { background: var(--ok-soft); color: var(--ok); }
.lvbar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; gap: 2px; margin: -2px 0 6px; }
.lvbar i, .lvlegend i { display: block; }
.lvbar i.lv0, .lvlegend i.lv0 { background: var(--axis); }
.lvbar i.lv1, .lvlegend i.lv1 { background: var(--warn); }
.lvbar i.lv2, .lvlegend i.lv2 { background: var(--accent); }
.lvbar i.lv3, .lvlegend i.lv3 { background: var(--ok); }
.lvlegend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--ink-2); margin-bottom: 12px; }
.lvlegend span { display: inline-flex; align-items: center; gap: 4px; }
.lvlegend i { width: 8px; height: 8px; border-radius: 2px; }
.toolbar > .muted { align-self: center; margin-bottom: 10px; }

/* ---------- 今日复习 ---------- */
.review { padding-bottom: 8px; }
.rv-head { display: flex; justify-content: space-between; align-items: baseline; }
.rv-head h3 { margin-bottom: 6px; }
.rv-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.rv-row.done { opacity: .6; }
.rv-main { flex: 1; min-width: 0; cursor: pointer; }
.rv-main .w { font-weight: 700; font-size: 16px; margin-right: 6px; }
.rv-main .m { color: var(--ink-2); font-size: 14px; }
.rv-btns { display: flex; gap: 6px; flex: none; }
.rv-btn { border: 0; border-radius: 999px; padding: 7px 11px; font-size: 13.5px; font-weight: 600; }
.rv-btn.no { background: var(--warn-soft); color: var(--warn); }
.rv-btn.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); box-shadow: none; }
button.badge { border: 0; font-size: 12.5px; padding: 4px 10px; }
.speak.sm { width: 34px; height: 34px; font-size: 15px; flex: none; }
.rv-banner { display: flex; justify-content: space-between; align-items: center; width: 100%; border: 0; font-size: 15px; color: var(--ink); text-align: left; }

/* ---------- 日历 ---------- */
.cal-head, .sum-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-nav { border: 0; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); width: 38px; height: 38px; border-radius: 10px; font-size: 20px; color: var(--ink-2); }
.cal-nav:disabled { opacity: .3; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-w { text-align: center; font-size: 12px; color: var(--muted); padding-bottom: 2px; }
.cal-d {
  border: 0; border-radius: 9px; aspect-ratio: 1 / 1.05; min-height: 40px; padding: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1px; background: var(--bg); color: var(--ink); font-variant-numeric: tabular-nums;
}
.cal-d:disabled { background: transparent; color: var(--axis); }
.cal-n { font-size: 14px; font-weight: 600; line-height: 1; }
.cal-m { font-size: 10.5px; line-height: 1; opacity: .85; }
.cal-d.lv1, .cal-scale i.lv1 { background: color-mix(in srgb, var(--accent) 18%, var(--card)); }
.cal-d.lv2, .cal-scale i.lv2 { background: color-mix(in srgb, var(--accent) 38%, var(--card)); }
.cal-d.lv3, .cal-scale i.lv3 { background: color-mix(in srgb, var(--accent) 65%, var(--card)); color: #fff; }
.cal-d.lv4, .cal-scale i.lv4 { background: var(--accent); color: #fff; }
.cal-d.today { box-shadow: inset 0 0 0 2px var(--ink-2); }
.cal-d.sel { box-shadow: inset 0 0 0 2px var(--ink), 0 0 0 2px var(--card); transform: scale(1.04); }
.cal-legend { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); margin-top: 10px; }
.cal-scale { display: inline-flex; align-items: center; gap: 3px; }
.cal-scale i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }

/* ---------- 总结 ---------- */
.sec-title { font-size: 15px; color: var(--ink-2); margin: 20px 4px 10px; }
.summary .seg { margin-bottom: 10px; }
.sum-lead { font-size: 15.5px; margin: 0 0 12px; }
.sum-lead .up { color: var(--ok); }
.sum-lead .down { color: var(--warn); }
.sharebar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 2px; }
.sum-list { list-style: none; padding: 0; margin: 10px 0 0; }
.sum-list li { padding: 8px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.wtags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.wtag { border: 0; border-radius: 6px; padding: 2px 8px; font-size: 13px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); }
.sum-tips { background: var(--bg); border-radius: 10px; padding: 10px 12px; margin-top: 10px; font-size: 14px; color: var(--ink-2); }
.sum-tips b { color: var(--ink); }
.sum-tips p { margin: 4px 0 0; }

@media (forced-colors: active) {
  .chart .hit.active { fill: Highlight; opacity: .2; }
}
