/* 颜色规则（scripts/check.py 会校验对比度，改色值后跑一下）：
   - 能点的图标一律用 --ic（深色纯白 / 浅色近黑），不用灰色。
   - 文字分级：--fg 正文/当前句，--t2 说明文字，--t5 当前句的对照，--t3 未播句，--t4 未播句的对照。
   - 深色每级比浅色多 6–10 个百分点（纯黑底上同比例的灰看起来更暗）。 */
:root[data-theme="dark"] {
  --bg: #000; --fg: #f2f2f2; --ic: #fff;
  --t2: #a3a3a3; --t3: #555; --t4: #444; --t5: #999;
  --line: #2a2a2a; --press: rgba(255,255,255,.12); --toast-bg: #f2f2f2; --toast-fg: #000;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #fff; --fg: #111; --ic: #111;
  --t2: #6e6e6e; --t3: #d1d1d1; --t4: #dbdbdb; --t5: #6e6e6e;
  --line: #ebebeb; --press: rgba(0,0,0,.07); --toast-bg: #111; --toast-fg: #fff;
  color-scheme: light;
}
:root { --gutter: 24px; --font: -apple-system, "PingFang SC", "SF Pro Text", "Helvetica Neue", sans-serif; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font-family: var(--font); }
body { overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
button { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ic); border-radius: 10px; transition: background .15s, opacity .15s; }
button:active { background: var(--press); }
button:focus-visible { outline: 2px solid var(--ic); outline-offset: 2px; }
svg.i { width: 1em; height: 1em; display: block; fill: currentColor; }
.g { padding-left: var(--gutter); padding-right: var(--gutter); }
.el { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.view { position: fixed; inset: 0; display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }

/* ---------- 列表页 ---------- */
.lib-head { display: flex; align-items: center; justify-content: space-between; padding-top: 20px; padding-bottom: 8px; flex: none; }
.lib-head h1 { margin: 0; font-size: 24px; font-weight: 600; }
.lib-list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 24px; }
.row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; cursor: pointer; border-radius: 0; }
.row:active { opacity: .55; }
.row .t { font-size: 17px; line-height: 1.35; }
.row .sub { font-size: 13px; color: var(--t2); margin-top: 3px; }
.row .n { font-size: 13px; color: var(--t2); padding-top: 3px; flex: none; }
.state { flex: 1; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 10px; padding-bottom: 20vh; }
.state .h { font-size: 17px; }
.state .d { font-size: 14px; color: var(--t2); line-height: 1.6; }
.state button { font-size: 15px; gap: 6px; padding: 8px 14px; margin-left: -14px; }
.sk { height: 14px; border-radius: 4px; background: var(--line); }

/* ---------- 背诵页 ---------- */
.p-head { display: flex; align-items: center; gap: 4px; padding-top: 10px; padding-bottom: 8px; flex: none; }
.p-head .titles { flex: 1; min-width: 0; margin-left: 2px; }
.p-head .tt { font-size: 15px; }
.p-head .pg { font-size: 12px; color: var(--t2); margin-top: 1px; }
.hb { width: 36px; height: 36px; font-size: 21px; flex: none; }
.hb.back { margin-left: -10px; font-size: 22px; }
.hb.last { margin-right: -8px; }

.scroller { flex: 1; position: relative; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.text { padding-top: 12px; padding-bottom: 55vh; }
.para { margin-bottom: 22px; }
.s { display: block; max-width: 94%; line-height: 1.6; margin-bottom: 10px; color: var(--t3); cursor: pointer;
  transform-origin: left center; transition: color .25s ease, transform .25s ease; word-break: break-word; }
.s.on { color: var(--fg); transform: scale(1.06); }
.s .tr { display: block; font-size: 13px; line-height: 1.5; color: var(--t4); margin-top: 3px; transition: color .25s ease; }
.s.on .tr { color: var(--t5); }
.s .tr:empty { display: none; }
.text.fz0 { font-size: 16px; } .text.fz1 { font-size: 18px; } .text.fz2 { font-size: 21px; }

.pill { position: absolute; left: 50%; transform: translateX(-50%); bottom: 10px; background: var(--toast-bg); color: var(--toast-fg);
  border-radius: 16px; font-size: 13px; padding: 7px 14px; gap: 5px; z-index: 2; }
.pill:active { background: var(--toast-bg); opacity: .8; }
.pill[hidden], .toast[hidden] { display: none; }
.toast { position: absolute; left: 50%; transform: translateX(-50%); top: 8px; background: var(--toast-bg); color: var(--toast-fg);
  border-radius: 16px; font-size: 13px; padding: 7px 14px; z-index: 3; white-space: nowrap; pointer-events: none; }

.dock { flex: none; padding-bottom: 6px; }
.bar { height: 2px; background: var(--line); }
.bar > div { height: 2px; width: 0; background: var(--fg); }
.ctl { display: flex; align-items: center; justify-content: center; gap: 40px; padding-top: 8px; }
.ctl .sk2 { width: 44px; height: 44px; font-size: 23px; border-radius: 22px; }
.ctl .play { width: 50px; height: 50px; border-radius: 25px; background: var(--fg); color: var(--bg); font-size: 21px; }
.ctl .play:active { opacity: .75; background: var(--fg); }
.ctl .play.loading svg { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.tools { display: grid; grid-template-columns: repeat(4, 1fr); padding-top: 2px; }
.tools button { height: 38px; font-size: 20px; color: var(--t2); }
.tools button.on { color: var(--ic); }
.tools .spd { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
