﻿/* ============================================================
   H+Y Forever · system.css
   紫为主色，黄为标记色。所有尺寸走 token，换主题只改这里。
   ============================================================ */

:root {
  /* —— 颜色 —— */
  --paper:   #fbf8f2;   /* 纸白底 */
  --paper-2: #ffffff;   /* 抬起一层 */
  --purple:  #4c1d95;   /* 主色（可交互） */
  --deep:    #2e1065;   /* 主色深（大面积块） */
  --lilac:   #c4b5fd;   /* 深底上的次文本 */
  --yellow:  #ffd60a;   /* 标记色：只用在小面积 */
  --ink:     #14100a;
  --ink-58:  rgba(20, 16, 10, .58);
  --ink-38:  rgba(20, 16, 10, .38);
  --ink-26:  rgba(20, 16, 10, .26);
  --hair:    rgba(20, 16, 10, .11);
  --on-deep-44: rgba(255, 255, 255, .44);
  --on-deep-16: rgba(255, 255, 255, .16);

  /* —— 字体 —— */
  --sans: "Funnel Display", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* —— 圆角（三级，不再多） —— */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-pill: 999px;

  /* —— 间距 —— */
  --gutter: 24px;
  --tab-h: 78px;

  /* —— 安全区 —— */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);

  /* —— 动效 —— */
  --spring: cubic-bezier(.2, .9, .3, 1);
  --fast: .18s;
}

/* 字体只声明本地文件，不依赖任何外链 */
@font-face {
  font-family: "Funnel Display";
  src: url("../fonts/w06.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "DM Mono";
  src: url("../fonts/w08.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "DM Mono";
  src: url("../fonts/w10.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

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

/* display:flex/grid 会盖掉 UA 的 [hidden]，这里显式兜住 */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body {
  display: flex;
  justify-content: center;
}

.app {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--paper);
}

/* ---------- 状态栏（仅浏览器里显示；装到主屏后由系统显示） ---------- */
.status {
  height: calc(54px + var(--safe-t));
  padding: var(--safe-t) var(--gutter) 6px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 600;
  flex: 0 0 auto;
}

@media (display-mode: standalone), (display-mode: fullscreen) {
  .status { display: none; }
  .app { padding-top: var(--safe-t); }
}

.sb-r { display: flex; align-items: center; gap: 6px; }
.sb-bars { display: flex; align-items: flex-end; gap: 2px; height: 11px; }
.sb-bars i { width: 3px; background: var(--ink); border-radius: 1px; display: block; }
.sb-bars i:nth-child(1) { height: 4px; }
.sb-bars i:nth-child(2) { height: 6px; }
.sb-bars i:nth-child(3) { height: 8px; }
.sb-bars i:nth-child(4) { height: 11px; }
.sb-wifi { width: 15px; height: 11px; position: relative; }
.sb-wifi::before, .sb-wifi::after {
  content: ""; position: absolute; left: 50%; transform: translateX(-50%);
  border: 1.7px solid var(--ink); border-bottom-color: transparent;
  border-left-color: transparent; border-right-color: transparent; border-radius: 50%;
}
.sb-wifi::before { width: 15px; height: 15px; top: 1px; }
.sb-wifi::after { width: 8px; height: 8px; top: 6px; }
.sb-batt {
  width: 24px; height: 12px; border: 1.6px solid rgba(20, 16, 10, .3);
  border-radius: 3.5px; position: relative; padding: 1.5px;
}
.sb-batt::after {
  content: ""; position: absolute; right: -3.4px; top: 3.5px; width: 2px; height: 5px;
  background: rgba(20, 16, 10, .3); border-radius: 0 1px 1px 0;
}
.sb-batt i { display: block; height: 100%; width: 78%; background: var(--ink); border-radius: 2px; }

/* ---------- 滚动区 ---------- */
.screen {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: calc(var(--tab-h) + var(--safe-b));
}
.screen::-webkit-scrollbar { display: none; }

/* ---------- 头部 ---------- */
.top { flex: 0 0 auto; padding: 0 var(--gutter); }

.brandrow {
  display: flex; align-items: center; justify-content: space-between;
  padding: 2px 0 16px;
}
.brand {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 2.4px;
  color: var(--purple);
}
.date { font-family: var(--mono); font-size: 9.5px; letter-spacing: 1.2px; color: var(--ink-38); }

.greet { margin: 0; font-size: 14px; color: var(--ink-58); }

/* 大数字：黄色只做一道笔迹 */
.numline { margin-top: 4px; display: flex; align-items: flex-end; }
.digits {
  display: inline-block; padding: 0 9px 2px 0; margin-left: -5px;
  font-size: 84px; font-weight: 600; letter-spacing: -5.8px; line-height: .92;
  color: var(--purple); font-variant-numeric: tabular-nums;
  background: linear-gradient(to top, var(--yellow) 0 10px, rgba(255, 214, 10, 0) 10px);
}
.unit { margin-left: 11px; padding-bottom: 12px; font-size: 17px; font-weight: 500; color: var(--deep); }

.sideline { margin: 12px 0 0; font-size: 12.5px; color: var(--ink-58); letter-spacing: .1px; }

/* ---------- 主按钮 ---------- */
.cta {
  width: 100%; height: 54px; margin-top: 18px;
  border: none; border-radius: var(--r-pill);
  background: var(--deep); color: #fff;
  font-family: var(--sans); font-size: 16px; font-weight: 500; letter-spacing: -.1px;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  cursor: pointer;
  transition: transform var(--fast) var(--spring), filter var(--fast);
}
.cta:active { transform: scale(.982); }
.cta .a { font-family: var(--mono); font-size: 14px; opacity: .72; }

/* ---------- 中段 ---------- */
.mid { flex: 0 0 auto; padding: 0 var(--gutter); }

.stats {
  display: flex; padding: 16px 0 14px; border-bottom: 1px solid var(--hair);
}
.stats > div { flex: 1; display: flex; align-items: baseline; gap: 6px; }
.stats > div + div { border-left: 1px solid var(--hair); padding-left: 14px; }
.stats b {
  font-family: var(--mono); font-size: 15px; font-weight: 500; letter-spacing: -.4px;
  color: var(--purple);
}
.stats span { font-size: 11px; color: var(--ink-38); }

.slabel {
  display: flex; align-items: center; justify-content: space-between; padding: 6px 0 2px;
}
.slabel h2 {
  margin: 0; display: flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 9.5px; font-weight: 400; letter-spacing: 2.2px;
  color: var(--ink-38);
}
.slabel h2 i { width: 6px; height: 6px; background: var(--yellow); border-radius: 1px; display: block; }
.slabel .act {
  min-height: 44px; display: inline-flex; align-items: center;
  font-size: 11.5px; color: var(--purple); font-weight: 500;
  background: none; border: none; padding: 0; cursor: pointer; font-family: var(--sans);
  position: relative;
}
.slabel .act::after { content: ""; position: absolute; inset: -11px -8px; }

/* 领域条 */
.domains { display: flex; align-items: center; gap: 8px; }
.chips-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
/* 右侧渐隐只做视觉提示，不拦截点击 */
.chips-wrap::after {
  content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 14px;
  background: linear-gradient(90deg, rgba(251, 248, 242, 0), var(--paper) 82%);
  pointer-events: none;
}
.chips {
  display: flex; gap: 4px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
  padding: 6px 14px 6px 0; margin: -6px 0;
  scroll-behavior: smooth;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; height: 33px; padding: 0 10px; border-radius: var(--r-pill);
  display: flex; align-items: center; white-space: nowrap;
  font-family: var(--sans); font-size: 12.5px; font-weight: 500;
  border: 1px solid rgba(76, 29, 149, .22); color: var(--purple); background: transparent;
  cursor: pointer; transition: background var(--fast), color var(--fast), transform var(--fast) var(--spring);
}
.chip[aria-selected="true"] { background: var(--purple); border-color: var(--purple); color: #fff; }
.chip:active { transform: scale(.96); }
/* 视觉 33px，触达补到 45px */
.chip { position: relative; }
.chip::after { content: ""; position: absolute; left: 0; right: 0; top: -6px; bottom: -6px; }
.addbtn {
  flex: 0 0 33px; width: 33px; height: 33px; border-radius: 50%;
  border: 1px dashed rgba(76, 29, 149, .4); background: transparent;
  display: grid; place-items: center; font-size: 16px; line-height: 1;
  color: var(--purple); cursor: pointer;
}
.addbtn:active { transform: scale(.94); }
.addbtn { position: relative; }
.addbtn::after { content: ""; position: absolute; inset: -6px; }

.path {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 9px 0 0; font-size: 11.5px; color: var(--ink-38);
}
.path b { color: var(--ink); font-weight: 500; }
.live {
  font-family: var(--mono); font-size: 8px; letter-spacing: .7px; font-weight: 500;
  background: var(--yellow); color: var(--deep); padding: 2px 5px; border-radius: 3px;
}

/* ---------- 深紫块 ---------- */
.purpleblock {
  flex: 1 1 auto; min-height: 200px;
  margin-top: 16px; padding: 16px var(--gutter) 18px;
  background: var(--deep); color: #fff;
  display: flex; flex-direction: column;
}
.pblock-head {
  display: flex; align-items: baseline; justify-content: space-between; padding-bottom: 4px;
}
.pblock-head h2 {
  margin: 0; font-family: var(--mono); font-size: 9.5px; font-weight: 400;
  letter-spacing: 2.2px; color: var(--on-deep-44);
}
.pblock-head span { font-family: var(--mono); font-size: 9px; letter-spacing: 1px; color: var(--lilac); }

.prow {
  display: flex; align-items: center; gap: 12px; padding: 13px 0;
  position: relative; cursor: pointer; text-align: left;
  background: none; border: none; color: inherit; font-family: inherit; width: 100%;
}
.prow + .prow::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--on-deep-16);
}
.prow:active { background: rgba(255, 255, 255, .04); }
.prow .idx { font-family: var(--mono); font-size: 9.5px; color: rgba(255, 255, 255, .34); width: 15px; flex: 0 0 15px; }
.prow .w { flex: 1; min-width: 0; }
.prow b { display: block; font-size: 15.5px; font-weight: 500; letter-spacing: -.2px; }
.prow span { display: block; font-size: 11.5px; color: rgba(255, 255, 255, .46); margin-top: 2px; }
.prow .m { font-family: var(--mono); font-size: 9.5px; color: var(--lilac); letter-spacing: .4px; }

.pfoot {
  margin-top: auto; padding-top: 14px; border-top: 1px solid var(--on-deep-16);
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .8px; color: rgba(255, 255, 255, .42);
}
.streak {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--yellow); color: var(--deep);
  padding: 4px 7px; border-radius: 5px;
  font-family: var(--sans); font-size: 10.5px; font-weight: 500; letter-spacing: 0;
}
.streak i { width: 4px; height: 4px; border-radius: 50%; background: var(--deep); display: block; }

/* ---------- 标签栏 ---------- */
.tabs {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 0; width: 100%; max-width: 480px;
  height: calc(var(--tab-h) + var(--safe-b));
  padding: 12px 30px calc(12px + var(--safe-b));
  background: var(--paper);
  border-top: 1px solid var(--hair);
  display: flex; justify-content: space-between; align-items: flex-start;
  z-index: 20;
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  width: 60px; padding: 4px 0 0;
  font-family: var(--mono); font-size: 9px; letter-spacing: 1.1px;
  color: var(--ink-38); background: none; border: none; cursor: pointer;
}
.tab svg { width: 21px; height: 21px; }
.tab { position: relative; min-height: 44px; justify-content: flex-start; }
.tab::after { content: ""; position: absolute; top: -2px; bottom: -2px; left: 0; right: 0; }
.tab[aria-current="page"] { color: var(--purple); }

/* ---------- 底部弹层（新增领域等） ---------- */
.sheet-mask {
  position: fixed; inset: 0; background: rgba(20, 16, 10, .38);
  opacity: 0; pointer-events: none; transition: opacity .22s var(--spring); z-index: 40;
}
.sheet-mask[data-open="true"] { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 50%; bottom: 0; transform: translate(-50%, 102%);
  width: 100%; max-width: 480px;
  background: var(--paper); border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 20px var(--gutter) calc(20px + var(--safe-b));
  z-index: 41; transition: transform .28s var(--spring);
  box-shadow: 0 -18px 40px rgba(20, 16, 10, .16);
}
.sheet[data-open="true"] { transform: translate(-50%, 0); }
.sheet h3 { margin: 0 0 4px; font-size: 17px; font-weight: 600; letter-spacing: -.3px; }
.sheet p { margin: 0 0 16px; font-size: 12px; color: var(--ink-58); line-height: 1.6; }
.sheet input {
  width: 100%; height: 48px; padding: 0 14px; font-family: var(--sans); font-size: 15px;
  color: var(--ink); background: #fff; border: 1px solid var(--hair);
  border-radius: var(--r-md); outline: none;
}
.sheet input:focus { border-color: var(--purple); }
.sheet-row { display: flex; gap: 10px; margin-top: 14px; }
.sheet-row button {
  flex: 1; height: 48px; border-radius: var(--r-md); font-family: var(--sans);
  font-size: 15px; font-weight: 500; cursor: pointer; border: none;
}
.sheet-row .ghost { background: transparent; color: var(--ink-58); border: 1px solid var(--hair); }
.sheet-row .primary { background: var(--deep); color: #fff; }
.sheet-note {
  margin-top: 14px; font-family: var(--mono); font-size: 8.5px; letter-spacing: .8px;
  color: var(--ink-26);
}

/* ---------- 安装提示条 ---------- */
.install {
  position: fixed; left: 50%; transform: translate(-50%, 220%);
  bottom: calc(var(--tab-h) + var(--safe-b) + 12px);
  opacity: 0; pointer-events: none; visibility: hidden;
  width: calc(100% - 32px); max-width: 448px;
  background: var(--paper-2); color: var(--ink);
  border: 1px solid var(--hair); border-radius: var(--r-md);
  padding: 12px 14px; display: flex; align-items: center; gap: 12px;
  z-index: 30; transition: transform .3s var(--spring), opacity .2s;
  box-shadow: 0 14px 34px rgba(20, 16, 10, .18);
}
.install[data-show="true"] { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; visibility: visible; }
/* 提示条出现时，整屏底部多留一段，紫块整体上移，不压统计 */
body.has-install .screen { padding-bottom: calc(var(--tab-h) + var(--safe-b) + 84px); }
body.has-install .pfoot { display: none; }
.install .t { flex: 1; font-size: 12.5px; line-height: 1.5; }
.install .t b { display: block; font-size: 13px; margin-bottom: 1px; }
.install .go {\n  border: none; background: var(--yellow); color: var(--deep);\n  font-family: var(--sans); font-size: 12.5px; font-weight: 600;\n  padding: 9px 13px; border-radius: var(--r-sm); cursor: pointer;\n}\n.install button {
  border: none; background: var(--yellow); color: var(--deep);
  font-family: var(--sans); font-size: 12.5px; font-weight: 600;
  padding: 9px 13px; border-radius: var(--r-sm); cursor: pointer;
}
.install .x {
  background: transparent; color: var(--ink-38); border: none;
  font-size: 16px; padding: 4px 6px; cursor: pointer;
}

/* ---------- 无障碍 / 降动效 ---------- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }

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

/* ============================================================
   视图容器 + 复习页
   ============================================================ */
.view { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.view[hidden] { display: none; }

.rv-top {
  flex: 0 0 auto; display: flex; align-items: center; gap: 12px;
  padding: 8px var(--gutter) 0;
}
.rv-close {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 34px;
  border: 1px solid var(--hair); background: transparent; color: var(--ink-58);
  font-size: 13px; line-height: 1; display: grid; place-items: center; cursor: pointer;
}
.rv-track { flex: 1 1 auto; height: 3px; border-radius: 2px; background: var(--hair); overflow: hidden; }
.rv-track i {
  display: block; height: 100%; width: 0; background: var(--purple);
  border-radius: 2px; transition: width .28s var(--spring);
}
.rv-count {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .8px;
  color: var(--ink-38); min-width: 52px; text-align: right;
}

.rv-body {
  flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center;
  padding: 0 var(--gutter); min-height: 0;
}
.rv-card { display: flex; flex-direction: column; align-items: flex-start; }
.rv-tag {
  font-family: var(--mono); font-size: 8.5px; letter-spacing: .8px; color: var(--purple);
  border: 1px solid rgba(76, 29, 149, .25); border-radius: 4px; padding: 2px 6px;
  margin-bottom: 16px;
}
.rv-term {
  margin: 0; font-size: 38px; font-weight: 600; letter-spacing: -1.4px; line-height: 1.12;
  max-width: 100%; overflow-wrap: anywhere;
}
.rv-phon {
  margin: 7px 0 0; font-family: var(--mono); font-size: 12.5px;
  color: var(--ink-38); letter-spacing: .2px;
}
.rv-reveal {
  margin-top: 26px; width: 100%; height: 50px; border-radius: var(--r-md);
  border: 1px dashed rgba(76, 29, 149, .45); background: transparent; color: var(--purple);
  font-family: var(--sans); font-size: 14.5px; font-weight: 500; cursor: pointer;
  transition: background var(--fast), transform var(--fast) var(--spring);
}
.rv-reveal:active { transform: scale(.985); background: rgba(76, 29, 149, .05); }
.rv-ans { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--hair); width: 100%; }
.rv-def { margin: 0; font-size: 19px; line-height: 1.5; font-weight: 500; letter-spacing: -.2px; }
.rv-sent { margin: 12px 0 0; font-size: 13.5px; line-height: 1.65; color: var(--ink-58); }
.rv-src {
  margin: 10px 0 0; font-family: var(--mono); font-size: 9px; letter-spacing: .6px;
  color: var(--ink-26);
}

.rv-acts {
  flex: 0 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  padding: 12px var(--gutter) 16px;
}
.rate {
  height: 58px; border-radius: var(--r-md); border: 1px solid var(--hair);
  background: transparent; color: var(--ink-58); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-family: var(--sans); font-size: 13.5px; font-weight: 500;
  transition: transform .16s var(--spring), background .16s;
}
.rate i { font-family: var(--mono); font-size: 8.5px; font-style: normal; letter-spacing: .3px; color: var(--ink-26); }
.rate:active { transform: scale(.97); }
.rate.r1 { color: var(--ink); border-color: rgba(20, 16, 10, .22); }
.rate.r3 { background: var(--deep); border-color: var(--deep); color: #fff; }
.rate.r3 i { color: rgba(255, 255, 255, .5); }

.rv-done { text-align: center; }
.rv-done-k {
  margin: 0 0 18px; font-family: var(--mono); font-size: 9.5px; letter-spacing: 2px; color: var(--ink-38);
}
.rv-done-n {
  display: inline-block; padding: 0 10px 2px 0;
  font-size: 84px; font-weight: 600; letter-spacing: -5px; line-height: .92;
  color: var(--purple);
  background: linear-gradient(to top, var(--yellow) 0 10px, rgba(255, 214, 10, 0) 10px);
  font-variant-numeric: tabular-nums;
}
.rv-done-d {
  margin: 16px 0 0; font-family: var(--mono); font-size: 10px; letter-spacing: .4px; color: var(--ink-58);
}
.rv-done-t { margin: 8px 0 28px; font-size: 12px; color: var(--ink-38); }
.rv-done-t b, .rv-done-t span { font-family: var(--mono); }

/* 轻提示：顶部滑下，不遮挡底部操作 */
.toast {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 58px);
  transform: translate(-50%, -160%); opacity: 0; pointer-events: none;
  max-width: calc(100% - 48px); padding: 10px 15px; border-radius: 12px;
  background: var(--paper-2); color: var(--ink); border: 1px solid var(--hair);
  box-shadow: 0 10px 26px rgba(20, 16, 10, .16);
  font-family: var(--sans); font-size: 12.5px; line-height: 1.5; text-align: center;
  z-index: 60; transition: transform .26s var(--spring), opacity .2s;
}
.toast[data-show="true"] { transform: translate(-50%, 0); opacity: 1; }

/* 复习卡片顶部对齐，揭示后向下生长，不再上下跳 */
.rv-body { justify-content: flex-start; padding-top: min(13vh, 104px); }
.rv-card { width: 100%; }

/* 复习时进入专注模式：藏起标签栏，评分为主 */
body.reviewing .tabs {
  transform: translate(-50%, 120%); opacity: 0; pointer-events: none;
  transition: transform .26s var(--spring), opacity .2s;
}
body.reviewing .screen { padding-bottom: calc(10px + var(--safe-b)); }
body.reviewing .rv-acts { padding-bottom: calc(22px + var(--safe-b)); }

/* 收尾页垂直居中 */
.rv-done { margin: auto 0; }

/* ============================================================
   精读页
   ============================================================ */
.rd-top {
  flex: 0 0 auto; display: flex; align-items: center; gap: 12px;
  padding: 8px var(--gutter) 0;
}
.rd-title { flex: 1; font-size: 13.5px; font-weight: 500; text-align: center; }
.rd-meta {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .8px;
  color: var(--ink-38); min-width: 52px; text-align: right;
}

.rd-body {
  flex: 1 1 auto; overflow-y: auto; min-height: 0; scrollbar-width: none;
  padding: 18px var(--gutter) 22px;
}
.rd-body::-webkit-scrollbar { display: none; }

.rd-lead { margin: 0 0 14px; font-size: 19px; font-weight: 600; letter-spacing: -.4px; line-height: 1.35; }
.rd-lead span {
  display: block; margin-top: 5px; font-size: 12px; font-weight: 400;
  color: var(--ink-58); letter-spacing: 0;
}
.rd-textarea {
  width: 100%; height: 176px; padding: 14px; border-radius: var(--r-md);
  border: 1px solid var(--hair); background: var(--paper-2); color: var(--ink);
  font-family: var(--sans); font-size: 13.5px; line-height: 1.62; resize: none; outline: none;
}
.rd-textarea:focus { border-color: var(--purple); }
.rd-textarea::placeholder { color: var(--ink-26); }
.rd-tip {
  margin: 12px 0 0; font-family: var(--mono); font-size: 9px; letter-spacing: .5px;
  color: var(--ink-26); text-align: center;
}

.rd-sum {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .8px; color: var(--ink-38);
  padding-bottom: 12px; border-bottom: 1px solid var(--hair);
}
.rd-sent { padding: 16px 0; border-bottom: 1px solid var(--hair); }
.rd-sent-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.rd-idx { font-family: var(--mono); font-size: 9.5px; color: var(--ink-26); }
.rd-flag {
  font-family: var(--mono); font-size: 8.5px; letter-spacing: .6px; font-weight: 500;
  background: var(--yellow); color: var(--deep); padding: 2px 5px; border-radius: 3px;
}
.rd-words { margin-left: auto; font-family: var(--mono); font-size: 9px; color: var(--ink-26); }

.rd-text { margin: 0; font-size: 15px; line-height: 1.72; letter-spacing: -.1px; }
.rd-word {
  display: inline; background: none; border: none; padding: 0; margin: 0;
  font: inherit; color: var(--ink); cursor: pointer;
  border-bottom: 1px solid transparent; transition: border-color .14s, color .14s;
}
.rd-word:hover { border-bottom-color: var(--purple); }
.rd-word:active { color: var(--purple); }
.rd-word.stop { color: var(--ink-58); }
.rd-word.mark { color: var(--purple); border-bottom: 1px dotted rgba(76, 29, 149, .5); }

.rd-hint-line {
  margin-top: 10px; font-family: var(--mono); font-size: 9.5px; line-height: 1.75;
  color: var(--ink-38); letter-spacing: .2px;
}
.rd-hint-line .dot { margin: 0 6px; color: var(--ink-26); }

.rd-foot {
  display: flex; align-items: center; justify-content: space-between; padding-top: 18px;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .6px; color: var(--ink-38);
}
.rd-again {
  background: none; border: 1px solid var(--hair); border-radius: 999px;
  padding: 9px 15px; font-family: var(--sans); font-size: 12px; color: var(--purple); cursor: pointer;
}

/* 单词弹层 */
.w-phon { margin: -4px 0 14px; font-family: var(--mono); font-size: 11.5px; color: var(--ink-38); }
.w-phon:empty { display: none; }
.w-src {
  margin: 10px 0 0; font-family: var(--mono); font-size: 9px; line-height: 1.6;
  letter-spacing: .3px; color: var(--ink-26); min-height: 14px;
}

body.reading .tabs {
  transform: translate(-50%, 120%); opacity: 0; pointer-events: none;
  transition: transform .26s var(--spring), opacity .2s;
}
body.reading .screen { padding-bottom: calc(10px + var(--safe-b)); }

/* AI 拆解块 */
.rd-ai { margin-top: 12px; }
.rd-ai-btn {
  height: 32px; padding: 0 13px; border-radius: 999px;
  border: 1px solid rgba(76, 29, 149, .3); background: transparent; color: var(--purple);
  font-family: var(--sans); font-size: 12px; font-weight: 500; cursor: pointer;
}
.rd-ai-btn:active { background: rgba(76, 29, 149, .06); }
.rd-ai-out { margin-top: 12px; padding-left: 12px; border-left: 2px solid var(--yellow); }
.rd-ai-out[data-state="loading"], .rd-ai-out[data-state="error"] {
  font-family: var(--mono); font-size: 10px; letter-spacing: .4px; color: var(--ink-38);
  border-left-color: var(--hair);
}
.rd-ai-out p { margin: 0 0 7px; font-size: 12.5px; line-height: 1.6; }
.ai-main { font-weight: 500; }
.ai-clause { color: var(--ink-58); }
.ai-read { color: var(--ink); }
.ai-tag {
  font-family: var(--mono); font-size: 8.5px !important; letter-spacing: .5px;
  color: var(--ink-26) !important;
}
.ai-terms { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.ai-term {
  height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--hair);
  background: var(--paper-2); color: var(--ink); font-family: var(--sans);
  font-size: 11.5px; cursor: pointer;
}
.ai-term:active { border-color: var(--purple); color: var(--purple); }

/* ============================================================
   启动屏（预留：assets/splash/hero.png 到位后自动启用）
   ============================================================ */
#splash {
  position: fixed; inset: 0; z-index: 90;
  background: var(--deep);
  display: grid; place-items: center;
  transition: opacity .42s var(--spring), visibility .42s;
}
#splash[hidden] { display: none !important; }
#splash.out { opacity: 0; visibility: hidden; }
.sp-media { width: 62%; max-width: 260px; aspect-ratio: 1 / 1; display: grid; place-items: center; }
.sp-media img {
  width: 100%; height: auto; display: block; opacity: 0;
  transform: scale(1.08);
  transition: opacity .5s ease, transform 1.1s var(--spring);
}
#splash.in .sp-media img { opacity: 1; transform: scale(1); }

/* ============================================================
   我的
   ============================================================ */
.me-top { display: flex; align-items: center; gap: 14px; padding: 10px var(--gutter) 16px; }
.me-avatar {
  width: 54px; height: 54px; border-radius: 50%; flex: 0 0 54px;
  display: grid; place-items: center; font-size: 20px; font-weight: 600; color: #fff;
  background: var(--deep); letter-spacing: .5px;
}
.me-id { flex: 1; min-width: 0; }
.me-name { font-size: 21px; font-weight: 600; letter-spacing: -.6px; }
.me-sub { margin-top: 3px; font-size: 11.5px; color: var(--ink-58); }

.me-seg {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  margin: 0 var(--gutter) 16px; padding: 4px;
  background: var(--surface); border-radius: var(--r-pill);
}
.seg {
  height: 38px; border: none; border-radius: var(--r-pill); background: transparent;
  font-family: var(--sans); font-size: 14px; font-weight: 500; color: var(--ink-58);
  cursor: pointer; transition: background .18s var(--spring), color .18s;
}
.seg.on { background: var(--paper-2); color: var(--deep); box-shadow: 0 1px 3px rgba(20, 16, 10, .12); }

.me-stats {
  display: flex; margin: 0 var(--gutter) 4px; padding: 14px 0;
  border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair);
}
.me-stats > div { flex: 1; display: flex; align-items: baseline; gap: 6px; }
.me-stats > div + div { border-left: 1px solid var(--hair); padding-left: 14px; }
.me-stats b { font-family: var(--mono); font-size: 15px; font-weight: 500; color: var(--purple); }
.me-stats span { font-size: 11px; color: var(--ink-38); }

.me-label {
  padding: 20px var(--gutter) 8px;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 2.2px; color: var(--ink-38);
}
.me-group { margin: 0 var(--gutter); border-top: 1px solid var(--hair); }
.me-row {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 15px 2px; background: none; border: none; border-bottom: 1px solid var(--hair);
  font-family: var(--sans); font-size: 15px; color: var(--ink); cursor: pointer; text-align: left;
}
.me-row i { font-style: normal; color: var(--ink-26); font-size: 15px; }
.me-row:active { opacity: .55; }
.me-row.danger { color: #b3261e; }

.me-ai { display: flex; gap: 8px; margin: 0 var(--gutter); }
.me-ai input {
  flex: 1; height: 44px; padding: 0 12px; border-radius: var(--r-md);
  border: 1px solid var(--hair); background: var(--paper-2); color: var(--ink);
  font-family: var(--mono); font-size: 11.5px; outline: none; min-width: 0;
}
.me-ai input:focus { border-color: var(--purple); }
.me-ai button {
  flex: 0 0 64px; height: 44px; border: none; border-radius: var(--r-md);
  background: var(--deep); color: #fff; font-family: var(--sans); font-size: 13.5px; cursor: pointer;
}
.me-note {
  margin: 10px var(--gutter) 0; padding-bottom: 4px;
  font-size: 11.5px; line-height: 1.6; color: var(--ink-38);
}
.me-about { margin: 0 var(--gutter) 24px; }
.me-about p {
  margin: 0 0 6px; font-size: 11.5px; line-height: 1.65; color: var(--ink-38);
  font-family: var(--mono); letter-spacing: .2px;
}

/* 安装引导步骤 */
.ins-step { display: flex; gap: 11px; align-items: flex-start; padding: 9px 0; }
.ins-step b {
  flex: 0 0 20px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface); color: var(--ink-58);
  font-family: var(--mono); font-size: 10px; font-weight: 400;
  display: grid; place-items: center; margin-top: 1px;
}
.ins-step span { font-size: 13px; line-height: 1.6; color: var(--ink); }
.ins-step em { font-style: normal; color: var(--purple); font-weight: 500; }
.ins-note {
  margin: 12px 0 0; padding: 11px 12px; border-radius: 10px; background: var(--surface);
  font-size: 11.5px; line-height: 1.65; color: var(--ink-58);
}

/* ============================================================
   词库
   ============================================================ */
.lib-top {
  flex: 0 0 auto; display: flex; align-items: baseline; justify-content: space-between;
  padding: 6px var(--gutter) 12px;
}
.lib-title { font-size: 30px; font-weight: 600; letter-spacing: -1.2px; }
.lib-count { font-family: var(--mono); font-size: 9.5px; letter-spacing: .8px; color: var(--ink-38); }

.lib-search { flex: 0 0 auto; padding: 0 var(--gutter) 12px; }
.lib-search input {
  width: 100%; height: 44px; padding: 0 14px; border-radius: var(--r-md);
  border: 1px solid var(--hair); background: var(--paper-2); color: var(--ink);
  font-family: var(--sans); font-size: 14px; outline: none;
  -webkit-appearance: none; appearance: none;
}
.lib-search input:focus { border-color: var(--purple); }
.lib-search input::placeholder { color: var(--ink-26); }

.lib-filters {
  flex: 0 0 auto;
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding: 0 var(--gutter) 12px;
  -webkit-overflow-scrolling: touch;
}
.lib-filters::-webkit-scrollbar { display: none; }
.lib-chip {
  flex: 0 0 auto; height: 32px; padding: 0 12px; border-radius: var(--r-pill);
  border: 1px solid rgba(76, 29, 149, .22); background: transparent; color: var(--purple);
  font-family: var(--sans); font-size: 12.5px; white-space: nowrap; cursor: pointer;
}
.lib-chip.on { background: var(--purple); border-color: var(--purple); color: #fff; }

.lib-list {
  flex: 1 1 auto; overflow-y: auto; padding: 0 var(--gutter) 24px;
  scrollbar-width: none;
}
.lib-list::-webkit-scrollbar { display: none; }

.lib-add {
  width: 100%; height: 48px; margin-bottom: 4px; border-radius: var(--r-md);
  border: 1px dashed rgba(76, 29, 149, .35); background: transparent; color: var(--purple);
  font-family: var(--sans); font-size: 13.5px; cursor: pointer;
}
.lib-add span { font-size: 15px; margin-right: 4px; }
.lib-add:active { background: rgba(76, 29, 149, .05); }

.lib-row {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 13px 2px;
  background: none; border: none; border-bottom: 1px solid var(--hair);
  text-align: left; cursor: pointer; font-family: var(--sans);
}
.lib-row:active { opacity: .55; }
.lib-main { flex: 1; min-width: 0; }
.lib-main b { display: block; font-size: 15.5px; font-weight: 500; letter-spacing: -.2px; }
.lib-main span {
  display: block; margin-top: 2px; font-size: 12px; color: var(--ink-58);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lib-side { flex: 0 0 auto; text-align: right; }
.lib-side i {
  display: block; font-style: normal; font-family: var(--mono); font-size: 8.5px;
  letter-spacing: .5px; color: var(--purple);
}
.lib-side em {
  display: block; margin-top: 3px; font-style: normal; font-size: 10px; color: var(--ink-26);
}
.lib-empty {
  margin: 26px 4px; font-size: 12.5px; line-height: 1.7; color: var(--ink-38); text-align: center;
}

/* 卡片编辑表单 */
.card-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.card-form input, .card-form textarea, .card-form select {
  width: 100%; padding: 12px 13px; border-radius: var(--r-md);
  border: 1px solid var(--hair); background: var(--paper-2); color: var(--ink);
  font-family: var(--sans); font-size: 14px; outline: none; resize: none;
  -webkit-appearance: none; appearance: none;
}
.card-form input:focus, .card-form textarea:focus, .card-form select:focus { border-color: var(--purple); }
.card-form textarea { line-height: 1.55; }
.card-form select {
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-38) 50%),
                    linear-gradient(135deg, var(--ink-38) 50%, transparent 50%);
  background-position: calc(100% - 17px) 20px, calc(100% - 12px) 20px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.card-del {
  width: 100%; margin-top: 14px; padding: 12px 0; border: none; background: none;
  color: #b3261e; font-family: var(--sans); font-size: 13.5px; cursor: pointer;
}

/* ============================================================
   Agent / 批改
   ============================================================ */
#view-agent { overflow-y: auto; scrollbar-width: none; padding-bottom: 18px; }
#view-agent::-webkit-scrollbar { display: none; }

.wr-top {
  flex: 0 0 auto; display: flex; align-items: baseline; justify-content: space-between;
  padding: 6px var(--gutter) 10px;
}
.wr-title { font-size: 30px; font-weight: 600; letter-spacing: -1.2px; }
.wr-mode { font-family: var(--mono); font-size: 9.5px; letter-spacing: .8px; color: var(--ink-38); }

.wr-chips {
  flex: 0 0 auto; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding: 0 var(--gutter) 10px;
}
.wr-chips::-webkit-scrollbar { display: none; }
.wr-chip {
  flex: 0 0 auto; height: 32px; padding: 0 12px; border-radius: var(--r-pill);
  border: 1px solid rgba(76, 29, 149, .22); background: transparent; color: var(--purple);
  font-family: var(--sans); font-size: 12.5px; white-space: nowrap; cursor: pointer;
}
.wr-chip.on { background: var(--purple); border-color: var(--purple); color: #fff; }

.wr-hint {
  margin: 0 var(--gutter) 12px; font-size: 11.5px; line-height: 1.55; color: var(--ink-38);
}

.wr-editor { margin: 0 var(--gutter) 12px; }
.wr-textarea {
  width: 100%; height: 176px; padding: 14px; border-radius: var(--r-md);
  border: 1px solid var(--hair); background: var(--paper-2); color: var(--ink);
  font-family: var(--sans); font-size: 13.5px; line-height: 1.65; resize: none; outline: none;
}
.wr-textarea:focus { border-color: var(--purple); }
.wr-ehead { display: flex; justify-content: space-between; margin-top: 7px; }
.wr-ph { font-size: 11px; color: var(--ink-26); }
.wr-count { font-family: var(--mono); font-size: 9.5px; color: var(--ink-38); }

.wr-controls {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 var(--gutter) 14px;
}
.wr-stylewrap { display: flex; gap: 4px; background: var(--surface); border-radius: var(--r-pill); padding: 3px; }
.wr-style {
  height: 30px; padding: 0 14px; border: none; border-radius: var(--r-pill);
  background: transparent; color: var(--ink-58); font-family: var(--sans);
  font-size: 12.5px; cursor: pointer;
}
.wr-style.on { background: var(--paper-2); color: var(--deep); box-shadow: 0 1px 2px rgba(20, 16, 10, .1); }
.wr-saved { font-family: var(--mono); font-size: 9px; letter-spacing: .3px; color: var(--ink-26); }

#view-agent > .cta { margin: 0 var(--gutter) 16px; width: calc(100% - var(--gutter) * 2); }
#view-agent > .cta:disabled { opacity: .5; }

.wr-result { margin: 0 var(--gutter) 24px; }
.wr-note {
  padding: 12px 13px; border-radius: 10px; background: var(--surface);
  font-family: var(--mono); font-size: 10.5px; line-height: 1.7; color: var(--ink-58);
}
.wr-note.error { color: #b3261e; background: rgba(179, 38, 30, .07); }

.wr-head { display: flex; align-items: flex-end; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--hair); }
.wr-score { display: flex; align-items: baseline; gap: 4px; }
.wr-score b { font-size: 46px; font-weight: 600; letter-spacing: -2.6px; line-height: .9; color: var(--purple); }
.wr-score span { font-family: var(--mono); font-size: 10px; color: var(--ink-38); }
.wr-level { flex: 1; margin: 0 0 4px; font-size: 12px; line-height: 1.5; color: var(--ink-58); }

.wr-issue { display: flex; gap: 10px; padding: 13px 0; border-bottom: 1px solid var(--hair); }
.wr-i { font-family: var(--mono); font-size: 9px; color: var(--ink-26); padding-top: 3px; }
.wr-ibody { flex: 1; min-width: 0; }
.wr-quote { display: block; margin-bottom: 5px; font-size: 12px; font-style: italic; color: var(--ink-58); }
.wr-problem { margin: 0; font-size: 13px; line-height: 1.55; }
.wr-fix { margin: 5px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--purple); }

.wr-rewrite {
  margin-top: 14px; padding: 13px 14px; border-radius: 0 10px 10px 0;
  border-left: 2px solid var(--yellow); background: var(--surface);
}
.wr-rlabel { font-family: var(--mono); font-size: 8.5px; letter-spacing: 1px; color: var(--ink-38); }
.wr-rewrite p { margin: 7px 0 0; font-size: 13px; line-height: 1.65; }

.wr-outline { display: flex; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--hair); }
.wr-outline p { margin: 0; font-size: 13px; line-height: 1.6; }
.wr-gtitle { margin: 0 0 10px; font-size: 15px; font-weight: 600; letter-spacing: -.2px; }
.wr-tag { margin: 16px 0 0; font-family: var(--mono); font-size: 8.5px; letter-spacing: .5px; color: var(--ink-26); }

/* 领域管理 */
.dm-list { max-height: 240px; overflow-y: auto; margin: 6px 0 4px; scrollbar-width: thin; }
.dm-row { padding: 10px 0; border-bottom: 1px solid var(--hair); }
.dm-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 7px; }
.dm-head b { font-size: 14px; font-weight: 500; }
.dm-head span { font-family: var(--mono); font-size: 9px; color: var(--ink-26); }
.dm-chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.dm-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 6px 0 9px;
  border-radius: 8px; background: var(--paper-2); border: 1px solid var(--hair);
}
.dm-chip em { font-style: normal; font-size: 11.5px; color: var(--ink); }
.dm-chip i {
  font-style: normal; color: var(--ink-26); font-size: 13px; line-height: 1;
  padding: 0 2px; cursor: pointer;
}
.dm-chip i:active { color: #b3261e; }
.dm-add {
  height: 28px; padding: 0 10px; border-radius: 8px; border: 1px dashed rgba(76, 29, 149, .35);
  background: transparent; color: var(--purple); font-family: var(--sans);
  font-size: 11.5px; cursor: pointer;
}
.dm-input {
  height: 28px; width: 92px; padding: 0 8px; border-radius: 8px;
  border: 1px solid var(--purple); background: var(--paper-2); color: var(--ink);
  font-family: var(--sans); font-size: 11.5px; outline: none;
}
.dm-sub-label {
  margin: 14px 0 4px !important; font-family: var(--mono); font-size: 9px;
  letter-spacing: 1.6px; color: var(--ink-26) !important;
}

/* 自测弹层 */
.qz-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 14px; }
.qz-chip {
  height: 32px; padding: 0 12px; border-radius: var(--r-pill);
  border: 1px solid rgba(76, 29, 149, .22); background: transparent; color: var(--purple);
  font-family: var(--sans); font-size: 12.5px; cursor: pointer;
}
.qz-chip.on { background: var(--purple); border-color: var(--purple); color: #fff; }
.qz-counts { display: flex; gap: 6px; margin-bottom: 16px; }
.qz-n {
  flex: 1; height: 38px; border-radius: var(--r-md); border: 1px solid var(--hair);
  background: transparent; color: var(--ink-58); font-family: var(--sans);
  font-size: 12.5px; cursor: pointer;
}
.qz-n.on { background: var(--surface); color: var(--deep); border-color: transparent; font-weight: 500; }
