/* ============ 基础 · Apple 系统设计语言 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --pri: #007aff;            /* Apple 系统蓝 */
  --pri-dark: #0071e3;
  --pri-soft: rgba(0, 122, 255, .11);
  --bg: #f5f5f7;             /* Apple 系统灰 */
  --card: #ffffff;
  --text: #1d1d1f;
  --text2: #6e6e73;
  --line: rgba(0, 0, 0, .08);
  --ok: #34c759;
  --bad: #ff3b30;
  --warn: #ff9f0a;
  --radius: 12px;
  --shadow: 0 0 0 1px rgba(0, 0, 0, .04), 0 2px 10px rgba(0, 0, 0, .05);
  --shadow-deep: 0 0 0 1px rgba(0, 0, 0, .05), 0 12px 32px rgba(0, 0, 0, .14);
  --ring: 0 0 0 3.5px rgba(0, 122, 255, .22);
  --ease: cubic-bezier(.25, .1, .25, 1);
  --pop: cubic-bezier(.3, .9, .4, 1.14); /* 轻微回弹，用于开关等有"物理感"的小控件 */
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; }
button:focus-visible { outline: none; box-shadow: var(--ring); }
input, textarea, select { font-family: inherit; font-size: 16px; color: var(--text); }
::selection { background: rgba(0, 122, 255, .18); }

/* ============ 手机端基础（mobile-native 清单） ============ */
/* 触屏基础：去掉双击缩放延迟；控件不选中文字、不弹长按菜单（内容文本不受影响） */
button, a, [role="button"], .tab, .seg button, .file-drop, .hdr-btn, .hdr-btn2 {
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
/* 防下拉误刷新：导入等待 AI 的 1-2 分钟里，误下拉等于丢进度 */
html { overscroll-behavior-y: none; }
/* 悬停样式只给有真实悬停能力的设备（触屏 tap 后 hover 会卡住不消失） */
@media (hover: hover) and (pointer: fine) {
  .word-row .w-edit:hover { color: var(--pri); background: var(--pri-soft); }
  .word-row .speak.sub-speak:hover { color: var(--pri); background: var(--pri-soft); }
  .tab-exit:hover { background: rgba(0, 0, 0, .06); color: var(--text); }
}
/* 触屏上输入框一律 16px：更小的字号会让 iOS 聚焦时自动放大页面且不回弹 */
@media (pointer: coarse) {
  .input, textarea.input, select, .voice-select, .edit-tbl .input { font-size: 16px; }
}
/* macOS 叠加式细滚动条 */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, .25); border-radius: 6px;
  border: 3.5px solid transparent; background-clip: content-box;
}
.hidden { display: none !important; }

#app { max-width: 520px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
#view { flex: 1; padding: 12px 14px 90px; }
#view.no-pad { padding: 0; }

/* ============ 顶栏 · 半透明工具栏材质 ============ */
#hdr {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: rgba(245, 245, 247, .78);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
#hdr h1 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; font-weight: 600; text-align: center; letter-spacing: -.01em; }
.hdr-btn {
  width: 32px; height: 32px; border-radius: 50%; font-size: 24px; line-height: 28px;
  color: var(--pri); background: rgba(255, 255, 255, .9);
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .1), 0 1px 3px rgba(0, 0, 0, .08);
  transition: transform 100ms ease-out, background-color .15s;
}
.hdr-btn:active { transform: scale(.92); background: rgba(0, 122, 255, .1); }
#hdrRight { min-width: 32px; display: flex; justify-content: flex-end; gap: 6px; }
#hdrRight .hdr-btn { font-size: 16px; }
/* 标题栏右侧的紧凑操作按钮 */
.hdr-btn2 {
  padding: 6px 11px; border-radius: 8px; font-size: 13px; font-weight: 600;
  background: var(--pri-soft); color: var(--pri); white-space: nowrap;
  transition: transform 100ms ease-out, filter .15s;
}
.hdr-btn2:active { transform: scale(.95); filter: brightness(.93); }
.hdr-btn2.pri {
  background: linear-gradient(180deg, #0a84ff, #0067d6); color: #fff;
  box-shadow: 0 1px 2px rgba(0, 80, 180, .3), inset 0 1px 0 rgba(255, 255, 255, .16);
}

/* ============ 底部导航 · 半透明材质，内容从下方滚过 ============ */
#tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 520px; z-index: 30;
  display: flex;
  background: rgba(255, 255, 255, .8);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab { flex: 1; position: relative; padding: 7px 0 6px; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 11px; color: var(--text2); transition: color .15s; }
.tab-ico { font-size: 21px; }
.tab.active { color: var(--pri); font-weight: 600; }
.badge {
  position: absolute; top: 3px; right: calc(50% - 22px);
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--bad); color: #fff; font-size: 10px; line-height: 16px; font-style: normal; text-align: center;
}
/* cs 退出登录：手机底栏不显示（入口在设置页底部），桌面宽屏在侧边栏吸底常驻 */
.tab-exit { display: none; }

/* ============ 通用组件 ============ */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; margin-bottom: 12px;
}
.card-title { font-size: 13px; font-weight: 600; color: var(--text2); margin-bottom: 10px; letter-spacing: .01em; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 16px; border-radius: 8px; font-size: 15px; font-weight: 600;
  transition: transform 100ms ease-out, filter .15s, background-color .15s;
}
/* 按压即时反馈：pointer-down 起效，不等松手 */
.btn:active { transform: scale(.98); filter: brightness(.9); }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn-pri {
  background: linear-gradient(180deg, #0a84ff, #0067d6); color: #fff;
  box-shadow: 0 1px 2px rgba(0, 80, 180, .3), inset 0 1px 0 rgba(255, 255, 255, .16);
}
.btn-pri:disabled { background: #9ecbff; box-shadow: none; }
.btn-ghost { background: var(--pri-soft); color: var(--pri); }
.btn-line { background: #fff; color: var(--text); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14), 0 1px 1px rgba(0, 0, 0, .04); }
.btn-danger { background: rgba(255, 59, 48, .11); color: var(--bad); }
.btn-block { display: flex; width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 6px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 6px; font-weight: 600; }
.input, textarea.input {
  width: 100%; padding: 11px 12px; border: 1px solid #d2d2d7; border-radius: 8px;
  background: #fff; outline: none; box-shadow: 0 1px 1px rgba(0, 0, 0, .03);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--pri); box-shadow: var(--ring); }
.voice-select { width: auto; flex: none; max-width: 230px; padding: 7px 10px; font-size: 13.5px; }
textarea.input { min-height: 150px; resize: vertical; line-height: 1.6; }

/* macOS 分段控件 */
.seg { display: flex; background: rgba(120, 120, 128, .14); border-radius: 9px; padding: 2px; gap: 2px; }
.seg button { flex: 1; padding: 8px 4px; border-radius: 7px; font-size: 14px; color: var(--text); font-weight: 500; transition: background-color .15s, box-shadow .15s; }
.seg button.active {
  background: #fff; color: var(--pri); font-weight: 600;
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .08), 0 1.5px 3px rgba(0, 0, 0, .14);
}
/* 行内小型分段控件（设置页） */
.set-row .seg { width: auto; flex: none; }
.set-row .seg button { flex: none; padding: 6px 12px; font-size: 12.5px; }

.set-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: none; }
.set-row .lbl { font-size: 15px; font-weight: 500; }
.set-row .sub { font-size: 12px; color: var(--text2); }
/* iOS/macOS 系统开关规格：50×30，26px 旋钮，回弹缓动 */
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i {
  position: absolute; inset: 0; border-radius: 15px; background: #e9e9ea;
  box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .05);
  transition: background-color .22s var(--ease);
}
.switch i::before {
  content: ""; position: absolute; width: 26px; height: 26px; border-radius: 50%;
  background: #fff; top: 2px; left: 2px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .18), 0 0 0 .5px rgba(0, 0, 0, .04);
  transition: left .22s var(--pop);
}
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::before { left: 22px; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 7px; font-size: 12px; font-weight: 600; }
.tag-ok { background: rgba(52, 199, 89, .15); color: #1f8a3d; }
.tag-bad { background: rgba(255, 59, 48, .12); color: #d70015; }
.tag-warn { background: rgba(255, 159, 10, .16); color: #a05a00; }
.tag-gray { background: rgba(120, 120, 128, .12); color: var(--text2); }

.empty { text-align: center; color: var(--text2); padding: 60px 20px; font-size: 14px; }
.empty .ico { font-size: 44px; display: block; margin-bottom: 12px; }

/* ============ 首页 ============ */
.import-cta {
  width: 100%; display: flex; align-items: center; gap: 13px; text-align: left;
  background: linear-gradient(180deg, #0a84ff, #0067d6); color: #fff;
  border-radius: var(--radius); padding: 16px;
  box-shadow: 0 4px 14px rgba(0, 105, 214, .3), inset 0 1px 0 rgba(255, 255, 255, .18);
  margin-bottom: 16px;
  transition: transform 100ms ease-out, filter .15s;
}
.import-cta:active { transform: scale(.98); filter: brightness(.92); }
.import-cta .ico { font-size: 30px; }
.import-cta b { display: block; font-size: 16px; margin-bottom: 2px; }
.import-cta span { font-size: 12.5px; opacity: .85; }
.sec-title { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 600; color: var(--text2); margin: 4px 2px 10px; letter-spacing: .01em; }
.list-card {
  display: block; width: 100%; text-align: left; background: var(--card);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 10px;
  transition: transform 100ms ease-out, filter .15s;
}
.list-card:active { transform: scale(.985); filter: brightness(.96); }
.list-card .top { display: flex; justify-content: space-between; align-items: baseline; }
.list-card .name { font-size: 16px; font-weight: 600; }
.list-card .cnt { font-size: 12.5px; color: var(--text2); }
.list-card .meta { font-size: 12.5px; color: var(--text2); margin-top: 4px; }
.list-card .meta b.good { color: var(--ok); }
.list-card .meta b.warn { color: var(--warn); }

/* ============ 导入 ============ */
.file-drop {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  border: 2px dashed rgba(0, 122, 255, .32); border-radius: var(--radius); padding: 30px 16px;
  color: var(--text2); font-size: 13.5px; background: rgba(255, 255, 255, .6); margin-bottom: 12px;
}
.file-drop .ico { font-size: 34px; }
.preview-img { max-width: 100%; max-height: 220px; border-radius: 10px; display: block; margin-bottom: 10px; box-shadow: var(--shadow); }
/* 预览图旋转/镜像按钮：极简文字按钮，贴近内容 */
.pv-tool { background: none; border: none; color: var(--text2); font-size: 13px; padding: 4px 10px; border-radius: 6px; flex: none; }
.pv-tool:active { background: rgba(0, 0, 0, .06); color: var(--text); }

.edit-tbl { width: 100%; border-collapse: collapse; }
.edit-tbl th { font-size: 12px; color: var(--text2); font-weight: 600; text-align: left; padding: 4px 4px 8px; }
.edit-tbl td { padding: 3px 3px; }
.edit-tbl .input { padding: 8px 9px; border-radius: 7px; font-size: 14.5px; }
.edit-tbl .idx { width: 24px; text-align: center; color: var(--text2); font-size: 13px; }
.edit-tbl .del { width: 30px; color: var(--bad); font-size: 17px; }
.tbl-wrap { max-height: 52vh; overflow: auto; }

/* ---- 整理结果词单（简洁列表） ---- */
.pw { padding: 10px 4px; border-bottom: 1px solid var(--line); }
.pw:last-child { border-bottom: none; }
.pw-row { display: flex; align-items: flex-start; gap: 8px; }
.pw-idx { width: 22px; flex: none; text-align: center; color: var(--text2); font-size: 13px; padding-top: 2px; }
.pw-main { flex: 1; min-width: 0; cursor: pointer; }
.pw-en { font-weight: 600; font-size: 15px; }
.pw-sub { font-size: 12.5px; color: var(--text2); }
.pw-del { flex: none; color: rgba(0, 0, 0, .26); padding: 2px 6px; }
.pw-subs { font-size: 12px; color: var(--text2); padding: 3px 0 0 30px; }
.pw-lbl, .w-lbl { color: var(--pri); font-weight: 600; }

/* ============ 词库详情 ============ */
.word-row {
  display: flex; align-items: center; gap: 10px; padding: 12px 4px;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.word-row:last-child { border-bottom: none; }
.word-row .w-main { flex: 1; min-width: 0; }
.word-row .w-en { font-weight: 600; font-size: 18px; letter-spacing: -.01em; }
.word-row .w-sub { font-size: 15px; color: var(--text2); margin-top: 1px; }
.word-row .w-subs { font-size: 15px; color: var(--text2); padding-left: 8px; border-left: 2px solid var(--line); margin-top: 5px; line-height: 1.9; }
.word-row .speak {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--pri-soft); color: var(--pri);
  transition: transform 100ms ease-out, background-color .15s, color .15s;
}
.word-row .speak svg { width: 14px; height: 14px; }
.word-row .speak:active { transform: scale(.88); }
/* 背单词：逐条翻页卡片，中英文同屏，进页自动读英文。
   卡片垂直居中、翻页键吸底（位置不随条目内容多少变化），布局同播放器（no-pad + 100dvh flex） */
.study-wrap { display: flex; flex-direction: column; min-height: calc(100dvh - 60px); }
.study-stage { flex: 1; display: flex; flex-direction: column; padding: 10px 14px 4px; }
.study-stage .study-card { margin: auto; width: 100%; } /* auto 外边距居中；内容超高时退化为顶对齐，不裁顶 */
.study-card { text-align: center; padding: 34px 20px 30px; cursor: pointer; } /* 点卡片即重读英文 */
.study-prog { font-size: 13px; color: var(--text2); margin-bottom: 20px; }
.study-en { font-size: clamp(34px, 9vw, 52px); font-weight: 700; letter-spacing: -.01em; line-height: 1.2; word-break: break-word; }
.study-ipa { font-size: 16px; color: var(--text2); margin-top: 8px; min-height: 22px; }
.study-zh { font-size: clamp(20px, 5.5vw, 28px); font-weight: 600; margin-top: 14px; line-height: 1.45; }
.study-subs { margin-top: 16px; text-align: left; }
.study-subs .w-subs { margin-top: 6px; font-size: 15px; color: var(--text2); padding-left: 8px; border-left: 2px solid var(--line); line-height: 1.9; }
.study-nav { display: flex; gap: 10px; padding: 12px 16px calc(18px + env(safe-area-inset-bottom)); }
.study-nav .btn { flex: 1; padding: 14px 8px; }
.study-nav .btn:disabled { opacity: .4; }
/* 编辑按钮：独立的次要小圆钮，点行不再进编辑，避免浏览词库时误触 */
.word-row .w-edit {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; color: var(--text2); font-size: 15px;
  transition: transform 100ms ease-out, background-color .15s, color .15s;
}
.word-row .w-edit:active { transform: scale(.88); }
/* hover 样式统一在文件顶部的 @media (hover:hover) 块里（触屏 tap 后 hover 卡住不消失） */
/* 子项播放按钮：极简三角，内联跟随在句末 */
.word-row .speak.sub-speak {
  width: 20px; height: 20px; margin-left: 4px;
  background: none; color: var(--text2);
  vertical-align: middle;
}
.word-row .speak.sub-speak svg { width: 10px; height: 10px; }
.word-row .speak.sub-speak { width: 24px; height: 24px; font-size: 12px; margin-left: auto; }

/* ============ 默写设置 ============ */
.opt-group { margin-bottom: 18px; }
.opt-group .g-lbl { font-size: 13px; font-weight: 600; color: var(--text2); margin-bottom: 8px; letter-spacing: .01em; }
.note { font-size: 12.5px; color: var(--text2); background: rgba(120, 120, 128, .08); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; }

/* ============ 默写播放器（纸笔） ============ */
.player { display: flex; flex-direction: column; min-height: calc(100dvh - 60px); }
.p-top { display: flex; align-items: center; gap: 10px; padding: 12px 16px 4px; }
.p-prog { flex: 1; text-align: center; font-size: 15px; font-weight: 600; color: var(--text2); font-variant-numeric: tabular-nums; }
.p-clock { font-size: 12px; color: var(--text2); margin-left: 4px; font-weight: 600; font-variant-numeric: tabular-nums; }
.p-bar { height: 4px; background: rgba(120, 120, 128, .2); border-radius: 2px; margin: 8px 16px 0; overflow: hidden; }
.p-bar i { display: block; height: 100%; background: var(--pri); border-radius: 2px; transition: width .25s var(--ease); }
.p-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; text-align: center; }
.p-pos { font-size: 15px; color: var(--text2); margin-bottom: 6px; }
.p-zh { font-size: clamp(36px, 11vw, 62px); font-weight: 700; letter-spacing: .04em; line-height: 1.15; }
.p-cd { margin-top: 18px; font-size: 13px; color: var(--warn); font-weight: 600; font-variant-numeric: tabular-nums; }
.p-hint { margin-top: 14px; font-size: 15px; color: var(--text2); letter-spacing: .2em; }
/* 默写提示按钮：卡片下方居中独立成行（用到提示的词会计入成绩与错题本，须是主动明确点击） */
.p-hint { display: flex; justify-content: center; padding: 0 16px 8px; }
.p-ctrl { display: flex; gap: 10px; padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); }
.p-ctrl .btn { flex: 1; padding: 14px 8px; }
.p-sub { display: flex; justify-content: center; gap: 14px; padding: 0 16px 16px; }
.p-sub button { font-size: 13px; color: var(--text2); padding: 6px 10px; border-radius: 7px; background: rgba(120, 120, 128, .12); }
.p-sub button.on { background: var(--pri-soft); color: var(--pri); font-weight: 600; }
.plist-overlay { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .38); display: flex; align-items: flex-end; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.plist-panel {
  background: var(--card); width: 100%; max-width: 520px; margin: 0 auto;
  border-radius: 22px 22px 0 0; padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 78dvh; overflow: auto; box-shadow: var(--shadow-deep);
}
.plist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.plist-item { border: 1px solid #d2d2d7; border-radius: 9px; padding: 9px 10px; font-size: 14px; text-align: left; background: #fff; }
.plist-item small { color: var(--text2); font-size: 11px; margin-right: 5px; }
.plist-item.cur { border-color: var(--pri); background: var(--pri-soft); font-weight: 600; box-shadow: var(--ring); }

/* 摄像头拍摄弹层预览 */
.cam-wrap video { width: 100%; max-height: 56vh; border-radius: 10px; background: #000; display: block; }

/* ============ 拍照批改 ============ */
.cam-btn {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: linear-gradient(180deg, #0a84ff, #0067d6); color: #fff;
  border-radius: var(--radius); padding: 34px 16px; font-size: 17px; font-weight: 700;
  box-shadow: 0 4px 14px rgba(0, 105, 214, .3), inset 0 1px 0 rgba(255, 255, 255, .18);
  margin-bottom: 12px;
  transition: transform 100ms ease-out, filter .15s;
}
.cam-btn:active { transform: scale(.98); filter: brightness(.92); }
.cam-btn .ico { font-size: 40px; }

/* ============ 批改结果表 ============ */
.g-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--card); border-radius: 10px; margin-bottom: 8px; box-shadow: var(--shadow);
}
.g-row.low { box-shadow: inset 0 0 0 1.5px rgba(255, 214, 10, .85), var(--shadow); }
.g-row .g-i { width: 26px; text-align: center; font-size: 13px; color: var(--text2); flex: none; font-variant-numeric: tabular-nums; }
.g-row .g-main { flex: 1; min-width: 0; }
.g-row .g-en { font-weight: 600; font-size: 15px; }
.g-row .g-zh { font-size: 12px; color: var(--text2); }
.g-row .g-rec { font-size: 12.5px; color: var(--text2); margin-top: 2px; }
.g-row .g-rec s { color: var(--bad); }
.g-toggle { flex: none; width: 62px; padding: 9px 0; border-radius: 8px; font-size: 13.5px; font-weight: 700; transition: transform 100ms ease-out; }
.g-toggle:active { transform: scale(.94); }
.g-toggle.on { background: rgba(52, 199, 89, .15); color: #1f8a3d; }
.g-toggle.off { background: rgba(255, 59, 48, .12); color: #d70015; }
.g-foot {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 520px; z-index: 25;
  background: rgba(255, 255, 255, .85);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}

/* ============ 成绩页 ============ */
.score-hero { text-align: center; padding: 26px 0 10px; }
.score-num { font-size: 74px; font-weight: 800; line-height: 1.05; letter-spacing: -.02em; font-family: ui-rounded, -apple-system, BlinkMacSystemFont, sans-serif; }
.score-num.good { color: var(--ok); }
.score-num.mid { color: var(--warn); }
.score-num.bad { color: var(--bad); }
.score-sub { color: var(--text2); font-size: 14px; margin-top: 6px; }
.wrong-item { display: flex; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); align-items: baseline; }
.wrong-item:last-child { border-bottom: none; }
.wrong-item .we { font-weight: 600; }
.wrong-item .wy { color: var(--bad); font-size: 13px; text-decoration: line-through; }
.wrong-item .wz { margin-left: auto; color: var(--text2); font-size: 13px; }

/* ============ 错词本 / 统计 ============ */
/* 家长统计的尝试列表行：时间 · 词单 · 词数/提示 · 状态 */
.ps-row { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.ps-row:last-child { border-bottom: none; }
.ps-t { flex: none; color: var(--text2); font-variant-numeric: tabular-nums; }
.ps-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-meta { flex: none; color: var(--text2); font-size: 13px; }
.wb-row { display: flex; align-items: center; gap: 10px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.wb-row:last-child { border-bottom: none; }
.wb-row .wb-main { flex: 1; min-width: 0; }
.wb-row .wb-en { font-weight: 600; }
.wb-row .wb-sub { font-size: 12.5px; color: var(--text2); }
.wb-row .wb-cnt { flex: none; background: rgba(255, 59, 48, .12); color: #d70015; border-radius: 8px; padding: 2px 8px; font-size: 12px; font-weight: 700; }
.wb-row .wb-del { flex: none; color: rgba(0, 0, 0, .26); font-size: 16px; padding: 6px; }
.stat-grid { display: flex; gap: 10px; margin-bottom: 12px; }
.stat-cell { flex: 1; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 13px; text-align: center; }
.stat-cell b { font-size: 23px; display: block; letter-spacing: -.02em; font-family: ui-rounded, -apple-system, BlinkMacSystemFont, sans-serif; }
.stat-cell span { font-size: 12px; color: var(--text2); }
.h-row { display: flex; align-items: center; gap: 10px; padding: 11px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.h-row:last-child { border-bottom: none; }
.h-row .h-date { color: var(--text2); font-size: 12.5px; width: 78px; flex: none; font-variant-numeric: tabular-nums; }
.h-row .h-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-row .h-score { font-weight: 700; font-variant-numeric: tabular-nums; }
.h-row.h-link { cursor: pointer; }
.h-row.h-link:active { background: rgba(0, 0, 0, .03); }
.h-row .h-arrow { flex: none; color: var(--text2); font-size: 17px; line-height: 1; }

/* ============ 首页待批改提醒 ============ */
.resume-card { box-shadow: inset 0 0 0 1.5px var(--pri), var(--shadow); }

/* ============ 拍照批改：多张照片 ============ */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-cell {
  position: relative; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden;
  background: #ececf0; box-shadow: var(--shadow); cursor: pointer;
}
.photo-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-cell .photo-idx {
  position: absolute; left: 0; top: 0; background: rgba(17, 17, 17, .5); color: #fff;
  font-size: 11px; padding: 2px 7px; border-radius: 0 0 8px 0;
}
.photo-cell .photo-del {
  position: absolute; right: 5px; top: 5px; width: 26px; height: 26px;
  border: none; border-radius: 50%; background: rgba(17, 17, 17, .55); color: #fff;
  font-size: 13px; display: flex; align-items: center; justify-content: center;
}
.photo-add {
  aspect-ratio: 1 / 1; border: 1.5px dashed #c7c7cc; border-radius: 10px;
  background: none; color: var(--text2); font-size: 26px; font-weight: 300;
}
.photo-add:active { background: rgba(0, 0, 0, .04); }

/* ============ 弹层 / 提示 ============ */
#modalRoot .mask {
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .36);
  display: flex; align-items: flex-end; justify-content: center;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  animation: maskIn .2s var(--ease) both;
}
.modal-box {
  background: var(--card); width: 100%; max-width: 520px;
  border-radius: 22px 22px 0 0; padding: 20px 18px calc(24px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-deep);
  animation: sheetIn .32s var(--ease) both;
}
.modal-box.center { border-radius: 16px; width: calc(100% - 48px); max-width: 400px; margin: auto; animation: zoomIn .24s var(--ease) both; }
.modal-box h3 { font-size: 17px; margin-bottom: 14px; text-align: center; font-weight: 700; letter-spacing: -.01em; }
.modal-close { position: absolute; }
@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetIn { from { transform: translateY(28px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes zoomIn { from { transform: scale(.95); opacity: 0; } to { transform: none; opacity: 1; } }
#toast {
  position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 99;
  background: rgba(28, 28, 30, .72); color: #fff; font-size: 14px;
  padding: 10px 18px; border-radius: 22px; max-width: 80vw; text-align: center;
  -webkit-backdrop-filter: saturate(160%) blur(16px); backdrop-filter: saturate(160%) blur(16px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid #fff; border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-tip { text-align: center; color: var(--text2); font-size: 14px; padding: 26px 0; }

/* 拖拽文件导入的全窗口提示 */
#view.drag-over::after {
  content: "📂 松开导入文件";
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 700; color: var(--pri);
  background: rgba(245, 245, 247, .88);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border: 3px dashed var(--pri);
  pointer-events: none;
}

/* ============ 桌面版（Electron）：红绿灯入页，顶栏可拖拽窗口 ============ */
body.mac #hdr { padding-left: 80px; -webkit-app-region: drag; }
body.mac #hdr .hdr-btn, body.mac #hdrRight { -webkit-app-region: no-drag; }
body.mac .p-top { padding: 34px 16px 4px 78px; } /* 顶部避开窗口红绿灯 */

/* ============ 宽屏（桌面）布局：侧边栏 + 内容区 ============ */
@media (min-width: 700px) {
  #app {
    display: grid;
    grid-template-columns: 200px 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "side hdr"
      "side view";
    max-width: none;
    height: 100dvh; /* app-shell：页面本体不滚动，只有内容区滚 */
  }
  /* 底部 tab 栏 → macOS 侧边栏 */
  #tabbar {
    grid-area: side;
    position: static;
    transform: none;
    width: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 12px 8px;
    background: rgba(240, 240, 243, .82);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: none;
    border-right: 1px solid var(--line);
  }
  .tab {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: 9px;
    padding: 8px 12px;
    border-radius: 7px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text);
    transition: background-color .15s;
  }
  .tab-ico { font-size: 17px; }
  .tab.active { background: rgba(0, 0, 0, .08); color: var(--text); font-weight: 600; }
  .badge { position: static; margin-left: auto; }
  /* 退出登录：吸底 + 分隔线，与上方导航项明确分开 */
  .tab-exit {
    display: flex;
    margin-top: auto;
    color: var(--text2);
  }
  .tab-exit::before {
    content: '';
    position: absolute; top: -6px; left: 10px; right: 10px; height: 1px;
    background: var(--line);
  }
  #hdr { grid-area: hdr; }
  #view { grid-area: view; padding: 22px 32px 48px; overflow-y: auto; min-height: 0; }
  #view > * { max-width: 680px; margin-left: auto; margin-right: auto; }
  #view.no-pad { padding: 0; }
  #view.no-pad > * { max-width: none; margin-left: 0; margin-right: 0; }
  /* 桌面侧边栏常驻所有页面（二级页不再隐藏），仅播放器沉浸式隐藏 */
  #tabbar.hidden { display: flex !important; }
  body.in-player #tabbar { display: none !important; }
  body.in-player #app { grid-template-columns: 0 1fr; }
  .player { min-height: 100dvh; }
  /* 背单词：宽屏下卡片与翻页键居中限宽，不铺满整屏 */
  .study-stage, .study-nav { width: 100%; max-width: 760px; margin-left: auto; margin-right: auto; }
  /* 桌面弹层：居中浮动面板（macOS 对话框），而非贴底 sheet */
  #modalRoot .mask, .plist-overlay { align-items: center; }
  .modal-box {
    width: calc(100% - 48px); max-width: 420px;
    border-radius: 16px; padding: 22px 22px 24px;
    animation-name: zoomIn;
  }
  #view > .g-foot { max-width: none; }
  .plist-panel { width: calc(100% - 48px); max-width: 600px; border-radius: 16px; max-height: 72dvh; }
  .g-foot { left: 200px; transform: none; width: auto; max-width: none; }
  #toast { left: calc(50% + 100px); }
  /* 桌面宽屏下红绿灯落在侧边栏上方：侧边栏可拖拽，顶栏恢复常规内边距 */
  body.mac #hdr { padding-left: 14px; }
  body.mac #tabbar { padding-top: 42px; -webkit-app-region: drag; }
  body.mac #tabbar .tab { -webkit-app-region: no-drag; }
}

/* ============ 可访问性：跟随系统减弱动效 / 降低透明度 ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
@media (prefers-reduced-transparency: reduce) {
  #hdr, #tabbar, .g-foot { background: #f5f5f7; -webkit-backdrop-filter: none; backdrop-filter: none; }
  #tabbar, .g-foot { background: #fff; }
  #modalRoot .mask, .plist-overlay { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(0, 0, 0, .5); }
  #toast { background: rgba(28, 28, 30, .96); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  .card, .list-card, .stat-cell, .g-row, .modal-box { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }
  .input, .plist-item { border-color: rgba(0, 0, 0, .4); }
}

/* AI 长任务进度条（导入整理等流式反馈）：细条 + 主色填充，宽度由 JS 实时更新 */
.ai-prog { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; margin: 14px 0 8px; }
.ai-prog > i { display: block; height: 100%; width: 4%; background: var(--pri); border-radius: 4px; transition: width .5s ease; }
