:root {
  /* ---------- 换色主题变量（默认 = 经典蓝紫）---------- */
  --t-acc: #2563eb;        /* 主强调色：按钮 / 标签 / 高亮 */
  --t-acc-d: #1d4ed8;      /* 强调色深色态（按下） */
  --t-acc-l: #93c5fd;      /* 强调色浅色态（悬停边框） */
  --t-rgb: 37,99,235;      /* 强调色 rgb，供 rgba() 使用 */
  --t-g1: #3f7ef0;         /* 页面渐变起点 */
  --t-g2: #5b62ef;         /* 页面渐变中点 */
  --t-g3: #7d4ded;         /* 页面渐变终点 */
  --t-solid: #5b62ef;      /* 页面底色兜底 */
  --t-o1: 125,211,252;     /* 弥散光斑 1 */
  --t-o2: 216,180,254;     /* 弥散光斑 2 */
  --t-o3: 59,130,246;      /* 弥散光斑 3 */
  --t-dk-acc: #34d399;     /* 黑暗模式下的强调色 */
  --t-dk-acc-d: #059669;   /* 黑暗模式下的强调色深色态 */
  --t-dk-acc-l: #a7f3d0;   /* 黑暗模式下的强调色浅色态 */
  --t-dk-rgb: 52,211,153;  /* 黑暗模式强调色 rgb */

  --blue: var(--t-acc);
  --blue-d: var(--t-acc-d);
  --bg: #f6f8fb;
  --card: #ffffff;
  --line: #e5e9f0;
  --text: #1f2937;
  --muted: #6b7280;
  --hl: #fde047;
  --ok: #16a34a;
  --no: #dc2626;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html {
  /* 全局科技渐变背景（画布层）：首页与所有模块共用，随「换色」主题切换 */
  background-color: var(--t-solid);
  background-image: linear-gradient(135deg, var(--t-g1) 0%, var(--t-g2) 45%, var(--t-g3) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}
body {
  margin: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
/* 全局弥散柔光 + 极简细网格：固定全屏、置于所有内容之下，首页与各模块完全一致 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(40% 32% at 8% 6%,   rgba(var(--t-o1),.55), transparent 70%),
    radial-gradient(36% 28% at 96% 16%, rgba(var(--t-o2),.48), transparent 70%),
    radial-gradient(50% 36% at 50% 108%, rgba(var(--t-o3),.42), transparent 72%),
    linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 44px 44px, 44px 44px;
}

.app-header {
  background: rgba(var(--t-rgb),.82);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 38px; height: 38px; border-radius: 9px; background: #fff; }
.title { font-weight: 700; font-size: 17px; }

.tabs {
  display: flex;
  background: rgba(255,255,255,.82);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,.5);
  box-shadow: 0 2px 12px rgba(20,22,80,.10);
  position: sticky;
  top: 0;
  z-index: 10;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tab {
  flex: 0 0 auto;
  padding: 12px 13px;
  border: none;
  background: none;
  font-size: 15px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}
.tab.active { color: var(--blue); font-weight: 700; border-bottom-color: var(--blue); }

main { padding: 14px; max-width: 760px; margin: 0 auto; }
.panel { display: none; }
.panel.active { display: block; }
/* 非首页模块：统一铺一层半透明"毛玻璃"浅色面板，保证深色文字在渐变背景上仍清晰可读；
   面板之外的区域露出与首页完全一致的蓝紫渐变背景。 */
.panel:not(#home) {
  background: rgba(255,255,255,.93);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 20px;
  padding: 20px 18px;
  box-shadow: 0 12px 40px rgba(20,22,80,.20);
}

.field { margin-bottom: 16px; }
.field > label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
  user-select: none;
}
.btn.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn.primary:active { background: var(--blue-d); }
.btn.block { display: flex; width: 100%; margin-top: 8px; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn.no { background: var(--no); color: #fff; border-color: var(--no); }
.btn.danger { color: var(--no); border-color: #fca5a5; }
.btn.ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn.ghost:hover { background: rgba(120,140,255,.08); }
html.dark .btn.ghost { color: #9fb3aa; }
/* 点击即时反馈：按下缩放，避免"点了没反应"的错觉 */
.btn { transition: transform .08s ease, filter .12s ease, opacity .12s ease; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: scale(.96); filter: brightness(.92); }
.btn.ok:active { background: #15803d; }
.btn.no:active { background: #b91c1c; }
/* 禁用态必须有明显区别（之前没有样式，禁用后看起来仍可点，点了毫无反应） */
.btn:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.35); }
.btn:disabled:active { transform: none; filter: grayscale(.35); }
.btn-row.center .btn { min-width: 96px; padding: 12px 26px; font-size: 16px; font-weight: 600; }
.btn-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.btn-row.center { justify-content: center; margin-top: 12px; }

.input, .ocr-text {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  background: #fff;
  color: var(--text);
}
.ocr-text { min-height: 130px; resize: vertical; line-height: 1.6; font-family: "Georgia", "Times New Roman", serif; }

.hint { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
hr { border: none; border-top: 1px solid var(--line); margin: 14px 0; }

.image-wrap { margin: 10px 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #000; }
.image-wrap img, .image-wrap canvas { width: 100%; display: block; }

/* 应用内相机取景框 */
.cam-modal { position: fixed; inset: 0; z-index: 90; background: #000; display: flex; align-items: center; justify-content: center; }
.cam-box { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: #000; }
.cam-video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.cam-topbar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px; padding: max(10px, env(safe-area-inset-top)) 12px 10px; background: linear-gradient(180deg, rgba(0,0,0,.62), rgba(0,0,0,0)); }
.cam-title { flex: 1; text-align: center; color: #fff; font-size: 13px; }
.cam-bottombar { position: absolute; bottom: 0; left: 0; right: 0; padding: 16px 12px max(18px, env(safe-area-inset-bottom)); background: linear-gradient(0deg, rgba(0,0,0,.62), rgba(0,0,0,0)); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.cam-guide { width: min(86%, 620px); aspect-ratio: 4 / 3; border: 2px dashed rgba(255,255,255,.55); border-radius: 10px; }
.shutter { width: 72px; height: 72px; border-radius: 50%; border: 4px solid #fff; background: rgba(255,255,255,.28); cursor: pointer; }
.shutter:active { background: #fff; }
.btn.tiny.ghost { background: rgba(255,255,255,.18); color: #fff; border-color: rgba(255,255,255,.4); }
.btn.tiny.ghost:hover { background: rgba(255,255,255,.3); }

/* 照片预览：procCanvas 既是 OCR 输入也是展示区 */
.btn.active { background: var(--blue); color: #fff; border-color: var(--blue); font-weight: 600; }

.mode-switch { display: flex; gap: 8px; background: #eef2f9; padding: 4px; border-radius: 12px; margin-bottom: 14px; }
.mode { flex: 1; border: none; background: none; padding: 9px; border-radius: 9px; font-size: 15px; color: var(--muted); cursor: pointer; }
.mode.active { background: #fff; color: var(--blue); font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.progress { margin-top: 12px; }
.progress .bar { height: 10px; background: #e5e9f0; border-radius: 6px; overflow: hidden; }
.progress .bar span { display: block; height: 100%; width: 0; background: var(--blue); transition: width .2s; }
.progress-text { font-size: 13px; color: var(--muted); margin-top: 6px; }

.word-cloud { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fff; line-height: 2.2; }
.ocr-line { margin-bottom: 6px; }
.word {
  display: inline;
  padding: 1px 4px;
  margin: 0 1px;
  border-radius: 5px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.word.selected { background: var(--hl); border-bottom-color: #eab308; font-weight: 600; }
.word.garbled { background: #ffedd5; border-bottom-color: #ea580c; color: #c2410c; }
.word.unknown { background: #fef9c3; border-bottom-color: #ca8a04; color: #a16207; }
.w-mark { font-size: 10px; font-weight: 700; margin-left: 1px; vertical-align: super; }
.word.garbled .w-mark { color: #ea580c; }
.word.unknown .w-mark { color: #ca8a04; }
.ocr-notice { margin: 4px 0 10px; padding: 9px 12px; border-radius: 10px; background: #fffbeb; border: 1px solid #fde68a; color: #92400e; font-size: 13px; line-height: 1.6; }
.ocr-notice .oc-gar { color: #ea580c; font-size: 15px; }
.ocr-notice .oc-unk { color: #ca8a04; font-size: 15px; }
.counter { font-size: 14px; color: var(--muted); }
.counter b { color: var(--blue); }

.status { margin-top: 12px; padding: 12px; border-radius: 10px; background: #ecfdf5; color: #065f46; font-size: 14px; }
.hidden { display: none !important; }

/* 词库 */
/* ===== 列表（一览表） ===== */
.tag-bar { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.tag-bar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.tag-bar-title { font-size: 13px; font-weight: 700; color: var(--blue); }
.tag-bar .tag-picker { margin: 0; }
.tag-filter-chip { padding: 4px 11px; font-size: 12.5px; display: inline-flex; align-items: center; gap: 5px; }
.tag-filter-chip .chip-count { font-weight: 700; font-size: 11px; opacity: .75; background: rgba(37,99,235,.1); color: var(--blue); border-radius: 999px; padding: 0 6px; min-width: 16px; text-align: center; }
.tag-filter-chip.on .chip-count { background: rgba(255,255,255,.28); color: #fff; }
.tag-filter-chip.zero { opacity: .55; }
.tag-empty { font-size: 12.5px; color: var(--muted); }
.tag-manager { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.tag-manager-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.tag-manage-chip { padding: 4px 8px 4px 12px; font-size: 12.5px; display: inline-flex; align-items: center; gap: 5px; cursor: default; }
.tag-manage-chip .chip-count { font-weight: 700; font-size: 11px; color: var(--muted); }
.chip-del { font-style: normal; cursor: pointer; color: #ef4444; font-size: 14px; line-height: 1; padding: 0 3px; border-radius: 999px; }
.chip-del:hover { background: #fee2e2; }
.tag-add-row { margin-bottom: 6px; }
.tag-clickable { cursor: pointer; }
.tag-clickable:hover { background: #dbeafe; }
.list-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.list-bar .input { flex: 1; min-width: 0; }
.list-bar .btn { flex: none; min-width: 76px; }
.list-stat { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13.5px; color: var(--blue); font-weight: 700; margin: 0 2px 8px; }
.list-tip { font-weight: 400; font-size: 12px; color: var(--muted); }
.list-wrap { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.vocab-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.vocab-table thead th { background: #f8fafc; color: var(--muted); font-size: 12.5px; font-weight: 600; text-align: left; padding: 8px 9px; border-bottom: 1px solid var(--line); }
.vocab-table td { padding: 9px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.vocab-table tbody tr:last-child td { border-bottom: none; }
.vocab-table tbody tr { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.vocab-table tbody tr:hover { background: #f8fbff; }
.vocab-table tbody tr:active { background: #eff6ff; }
.vocab-table th.c-idx, .vocab-table td.c-idx { width: 40px; text-align: right; color: #9ca3af; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.vocab-table th.c-word, .vocab-table td.c-word { width: 27%; font-weight: 700; color: #111827; font-size: 15px; word-break: break-word; }
.vocab-table td.c-word .ph { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; margin: 2px 0 0; word-break: break-all; }
.vocab-table th.c-pos, .vocab-table td.c-pos { width: 62px; color: #6b7280; font-size: 12.5px; white-space: nowrap; }
.vocab-table td.c-def { color: #374151; font-size: 13.5px; line-height: 1.55; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.vocab-table td.c-def .no-def { color: #c7cbd1; }
@media (max-width: 430px) {
  .vocab-table th.c-word, .vocab-table td.c-word { width: 31%; font-size: 14px; }
  .vocab-table th.c-pos, .vocab-table td.c-pos { width: 54px; }
  .vocab-table td { padding: 8px 7px; }
}

.lib-list { display: flex; flex-direction: column; gap: 10px; }
.lib-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.lib-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lib-word { font-size: 18px; font-weight: 700; }
.lib-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tag { display: inline-block; background: #eef2f9; color: var(--blue); border-radius: 999px; padding: 2px 9px; font-size: 12px; margin: 2px 4px 2px 0; }
.lib-body { margin-top: 8px; }
.lib-body textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 14px; resize: vertical; min-height: 38px; }
.lib-context { font-size: 13px; color: #374151; background: #f8fafc; border-left: 3px solid var(--blue); padding: 6px 10px; border-radius: 6px; margin: 6px 0; }
.lib-context mark { background: var(--hl); padding: 0 2px; border-radius: 3px; }
.lib-actions { display: flex; gap: 8px; margin-top: 8px; }
.chk { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: #374151; margin-top: 10px; font-weight: 500; }
.chk input { width: 16px; height: 16px; }
.ph { font-size: 13px; color: #6b7280; font-weight: 400; margin-left: 6px; }
.freq-tag { font-size: 11.5px; padding: 1px 8px; border-radius: 999px; margin-left: 6px; vertical-align: middle; font-weight: 600; }
.freq-high { background: #fee2e2; color: #b91c1c; }
.freq-mid { background: #fef3c7; color: #b45309; }
.freq-low { background: #e0e7ff; color: #3730a3; }
.freq-rare { background: #f3f4f6; color: #6b7280; }
.exam-tag { background: #dbeafe; color: #1e40af; border-radius: 999px; padding: 2px 9px; font-size: 12px; margin: 2px 4px 2px 0; display: inline-block; }
.fill-list { margin: 6px 0 8px; max-height: 180px; overflow: auto; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 8px 10px; font-size: 13px; color: #14532d; line-height: 1.75; }
.def-en { font-size: 12.5px; color: #6b7280; font-style: italic; margin: 4px 0 8px; }
.mini-label { display: block; font-size: 12px; color: #6b7280; margin: 8px 0 4px; }
.tag-picker { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.chip { padding: 6px 13px; border-radius: 999px; border: 1.5px solid #d1d5db; background: #fff; color: #374151; font-size: 13px; line-height: 1.2; cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; transition: background .12s, border-color .12s, color .12s; }
.chip:hover { border-color: #93c5fd; color: #1d4ed8; }
.chip.on { background: #2563eb; border-color: #2563eb; color: #fff; font-weight: 600; }
.tag-editor { margin-top: 8px; }
.tag-editor .tag-picker { max-height: 150px; overflow-y: auto; }
.input.tiny { font-size: 13px; padding: 7px 10px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.search-empty { padding: 40px 20px 56px; text-align: center; }
/* 搜不到时的提示文案 + 放大镜整体绕一个"隐形中心"公转（自身不旋转） */
.search-empty .se-title { font-size: 15px; color: var(--muted); margin-bottom: 4px; }
.se-orbit { position: relative; width: 132px; height: 132px; margin: 48px auto 8px; }
.se-orbit .se-glass { position: absolute; inset: 0; width: 132px; height: 132px; color: var(--muted); opacity: .8; offset-path: circle(42px at 66px 66px); offset-anchor: 66px 66px; offset-rotate: 0deg; animation: seOrbit 9s linear infinite; }
/* 只走圆周，不叠加自身 rotate —— 图标始终保持同一朝向 */
@keyframes seOrbit {
  from { offset-distance: 0%; }
  to   { offset-distance: 100%; }
}
@media (prefers-reduced-motion: reduce) { .se-orbit .se-glass { animation: none; } }
/* 回车搜索命中的那条：短暂高亮，方便一眼确认 */
.lib-card.search-hit { animation: searchHit 1.2s ease-out; }
@keyframes searchHit {
  0% { box-shadow: 0 0 0 0 rgba(37,99,235,.55); border-color: var(--blue); }
  70% { box-shadow: 0 0 0 8px rgba(37,99,235,0); border-color: var(--blue); }
  100% { box-shadow: 0 0 0 0 rgba(37,99,235,0); }
}
html.dark .lib-card.search-hit { animation: searchHitDark 1.2s ease-out; }
@keyframes searchHitDark {
  0% { box-shadow: 0 0 0 0 rgba(52,211,153,.6); border-color: #34d399; }
  70% { box-shadow: 0 0 0 8px rgba(52,211,153,0); border-color: #34d399; }
  100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
}
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
input[type="search"] { -webkit-appearance: none; }

/* 复习 */
.review-start p { color: var(--muted); font-size: 14px; }
.review-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; text-align: center; }
.rc-source { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.rc-sentence { font-size: 18px; line-height: 1.7; font-family: "Georgia", serif; margin-bottom: 14px; }
.rc-sentence mark { background: var(--hl); padding: 0 3px; border-radius: 4px; }
/* 复习卡只留目标词：黄色高亮、居中放大 */
.rc-sentence .rc-word { display: inline-block; font-size: 40px; font-weight: 800; font-family: "Georgia", serif; color: var(--text); background: var(--hl); padding: 6px 22px; border-radius: 12px; letter-spacing: .5px; box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.rc-answer { margin-top: 12px; padding: 12px; background: #f0f7ff; border-radius: 10px; text-align: left; }
.rc-answer .a-word { font-size: 20px; font-weight: 700; color: var(--blue); }
.rc-answer .a-mean { margin-top: 4px; }
.rc-answer .a-note { margin-top: 6px; font-size: 13px; color: var(--muted); }
.rc-progress { margin-top: 12px; font-size: 13px; color: var(--muted); }
/* 判定成功的即时闪动，确认"点到了" */
@keyframes rcFlash { 0% { box-shadow: 0 0 0 0 rgba(37,99,235,.45); } 100% { box-shadow: 0 0 0 14px rgba(37,99,235,0); } }
@keyframes rcFlashOk { 0% { box-shadow: 0 0 0 0 rgba(22,163,74,.5); } 100% { box-shadow: 0 0 0 14px rgba(22,163,74,0); } }
@keyframes rcFlashNo { 0% { box-shadow: 0 0 0 0 rgba(220,38,38,.5); } 100% { box-shadow: 0 0 0 14px rgba(220,38,38,0); } }
.review-card.flash { animation: rcFlash .22s ease-out; }
.review-card.flash-ok { animation: rcFlashOk .22s ease-out; }
.review-card.flash-no { animation: rcFlashNo .22s ease-out; }

/* 正确率面板 */
.acc-panel { margin-top: 14px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: 0 2px 10px rgba(15,23,42,.05); }
.acc-chart-wrap { position: relative; width: 220px; height: 220px; margin: 0 auto 8px; }
.acc-canvas { display: block; width: 220px; height: 220px; }
.acc-center { position: absolute; top: 0; left: 0; width: 220px; height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.acc-center b { font-size: 34px; line-height: 1; color: var(--text); }
.acc-center span { font-size: 12px; color: var(--gray); margin-top: 2px; }
.acc-legend { display: flex; gap: 10px; margin-top: 6px; }
.acc-item { flex: 1; display: flex; align-items: center; gap: 7px; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font-size: 13px; }
.acc-dot { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.acc-right .acc-dot { background: #22c55e; }
.acc-wrong .acc-dot { background: #ef4444; }
.acc-name { color: var(--gray); }
.acc-item b { font-size: 16px; color: var(--text); }
.acc-pct { margin-left: auto; font-size: 13px; color: var(--gray); }
.acc-right b { color: #16a34a; }
.acc-wrong b { color: #dc2626; }
.acc-total { text-align: center; margin-top: 12px; font-size: 14px; color: var(--text); }
.acc-total .ok-text { color: #16a34a; }
.acc-total .no-text { color: #dc2626; }
.acc-words { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.acc-words-title { width: 100%; font-size: 13px; color: var(--gray); margin-bottom: 2px; }
.acc-word-chip { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; }
.acc-all-right { width: 100%; text-align: center; color: #16a34a; font-weight: 700; font-size: 14px; }

/* 错题本 */
.tab-badge { display: inline-block; min-width: 17px; height: 17px; line-height: 17px; margin-left: 5px; padding: 0 5px; background: #dc2626; color: #fff; border-radius: 999px; font-size: 11px; text-align: center; vertical-align: 1px; }
.wrong-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.wrong-head label { font-size: 15px; font-weight: 700; color: var(--blue); }
.wrong-stat { flex: none; text-align: center; background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px; padding: 6px 14px; }
.wrong-stat b { display: block; font-size: 22px; line-height: 1.1; color: #dc2626; }
.wrong-stat span { font-size: 11px; color: #b91c1c; }
.wrong-list { display: flex; flex-direction: column; gap: 10px; }
.wrong-card { background: #fff; border: 1px solid var(--line); border-left: 4px solid #ef4444; border-radius: 12px; padding: 11px 13px; }
.wrong-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.wrong-word { font-size: 18px; font-weight: 700; color: var(--text); display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.wrong-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.wrong-badge-x { background: #fee2e2; color: #b91c1c; border-radius: 999px; padding: 1px 9px; font-weight: 700; }
.wrong-needs { background: #fffbeb; color: #b45309; border-radius: 999px; padding: 1px 9px; }
.wrong-clear-ok { background: #dcfce7; color: #15803d; border-radius: 999px; padding: 1px 9px; }
.wrong-mean { margin-top: 6px; font-size: 14px; line-height: 1.6; }
.wrong-peg { margin-top: 6px; padding: 7px 10px; background: #fffaf0; border-left: 3px solid #f59e0b; border-radius: 6px; font-size: 12.5px; line-height: 1.6; color: #78350f; }
.wrong-ctx { margin-top: 6px; padding: 6px 10px; background: #f8fafc; border-left: 3px solid #94a3b8; border-radius: 6px; font-size: 13px; line-height: 1.6; color: #334155; }
.wrong-ctx mark { background: #fde68a; padding: 0 1px; border-radius: 2px; }
.wrong-actions { display: flex; gap: 7px; margin-top: 9px; flex-wrap: wrap; }

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  background: rgba(17,24,39,.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 99;
  max-width: 90%;
  text-align: center;
}

/* 发音口音切换（顶部右侧） */
.accent-switch { margin-left: auto; display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 5px; font-size: 12px; color: #fff; }
.acc-label { opacity: .9; }
.acc-label + .acc-label, .acc-btn + .acc-label { margin-left: 4px; }
.acc-btn { border: 1px solid rgba(255,255,255,.55); background: rgba(255,255,255,.14); color: #fff; padding: 4px 10px; border-radius: 999px; font-size: 12px; cursor: pointer; transition: background .12s, color .12s, border-color .12s; }
.acc-btn.active { background: #fff; color: var(--blue); font-weight: 700; border-color: #fff; }
.acc-btn:active { filter: brightness(.92); }

/* 发音按钮 */
.speak-btn { border: none; background: #eef2f9; color: var(--blue); border-radius: 8px; padding: 2px 8px; font-size: 13px; line-height: 1.5; cursor: pointer; margin-left: 6px; vertical-align: middle; transition: transform .08s ease, background .12s ease; }
.speak-btn:active { transform: scale(.9); background: #dbeafe; }
.speak-btn.tiny { padding: 1px 5px; font-size: 11px; margin-left: 4px; }

/* 知识图谱：词卡关联词面板（阶段0/1） */
/* 记忆桩区块：视觉主角，暖色 + 左侧粗边，和冷色的释义框形成对比 */
.peg-box { border: 1px solid #f0c987; border-left: 4px solid #f59e0b; border-radius: 10px; background: linear-gradient(180deg, #fffaf0 0%, #fffdf7 100%); padding: 8px 10px; margin-bottom: 8px; }
.peg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; flex-wrap: wrap; }
.peg-title { font-size: 13px; font-weight: 800; color: #b45309; letter-spacing: .3px; }
.peg-sub { font-size: 11.5px; color: #a16207; opacity: .8; flex: 1; min-width: 90px; }
.peg-area { width: 100%; min-height: 74px; background: #fff; border-color: #f5d9a8; font-size: 13.5px; line-height: 1.65; }
.peg-area:focus { border-color: #f59e0b; }
.btn.tiny { padding: 2px 8px; font-size: 11.5px; flex: none; }
.ph-missing { background: #fff7ed; border: 1px dashed #fdba74; color: #c2410c; border-radius: 6px; padding: 0 6px; font-size: 11.5px; cursor: pointer; font-family: inherit; vertical-align: middle; }
.ph-missing:hover { background: #ffedd5; }
.ph-missing:disabled { opacity: .55; cursor: default; }
/* 复习页的记忆桩 */
.a-peg { margin: 8px 0; padding: 9px 11px; background: #fffaf0; border: 1px solid #f0c987; border-left: 4px solid #f59e0b; border-radius: 8px; font-size: 13.5px; line-height: 1.7; color: #78350f; white-space: normal; }
.a-pos { margin: 5px 0 2px; }
.a-pos .pos-tag { font-size: 12.5px; }
.a-eg { margin: 7px 0; padding: 6px 10px; background: #f8fafc; border-left: 3px solid #94a3b8; border-radius: 6px; font-size: 13px; line-height: 1.65; color: #334155; }
.a-eg mark, .eg-inline mark { background: #fde68a; padding: 0 1px; border-radius: 2px; }
.eg-inline { margin-top: 6px; padding: 5px 9px; background: #f8fafc; border-left: 3px solid #94a3b8; border-radius: 6px; font-size: 12.5px; line-height: 1.6; color: #334155; }

.peg-inline { margin-top: 6px; padding: 6px 9px; background: #fffaf0; border-left: 3px solid #f59e0b; border-radius: 6px; font-size: 12.5px; line-height: 1.65; color: #78350f; }

/* 词性标签：中性冷色，不与暖色的记忆桩抢注意力 */
.pos-row { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-bottom: 8px; }
.pos-row.picking { background: #f8fafc; border: 1px dashed var(--line); border-radius: 8px; padding: 7px 8px; }
.pos-tag { display: inline-block; background: #eef2f7; color: #475569; border: 1px solid #dde3ec; border-radius: 6px; padding: 1px 8px; font-size: 12px; font-weight: 500; font-family: inherit; }
button.pos-tag { cursor: pointer; }
button.pos-tag:hover { background: #e2e8f0; }
.pos-tag.chosen { background: #dbeafe; border-color: #93c5fd; color: #1d4ed8; }
.pos-add, .pos-tag.pos-add { background: #fff7ed; border: 1px dashed #fdba74; color: #c2410c; cursor: pointer; }
.pos-done { background: var(--blue); border-color: var(--blue); color: #fff; cursor: pointer; }
.pos-row .pos-add:not(.pos-tag) { padding: 1px 7px; border-radius: 6px; font-size: 12px; font-family: inherit; background: #fff7ed; border: 1px dashed #fdba74; color: #c2410c; cursor: pointer; }

/* 例句框：夹在词性和释义之间，视觉上比释义轻 */
.eg-box { border: 1px solid #dbe3ec; border-left: 3px solid #94a3b8; border-radius: 8px; background: #fbfcfe; padding: 6px 9px; margin-bottom: 8px; }
.eg-head { display: flex; align-items: baseline; gap: 7px; margin-bottom: 4px; }
.eg-title { font-size: 12.5px; font-weight: 700; color: #475569; }
.eg-sub { font-size: 11px; color: var(--muted); }
.eg-area { width: 100%; min-height: 46px; background: #fff; border-color: #dde3ec; font-size: 13px; line-height: 1.6; }
.eg-area:focus { border-color: #94a3b8; }

.rel-panel { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; }
.rel-head { font-size: 13px; font-weight: 700; color: var(--blue); margin-bottom: 6px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rel-hint { font-weight: 400; font-size: 11px; color: var(--muted); }
.rel-row { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin: 4px 0; }
.rel-type { font-size: 12px; font-weight: 700; margin-right: 2px; }
.rel-chip { display: inline-block; background: #eef2f9; color: #1d4ed8; border-radius: 999px; padding: 2px 10px; font-size: 12.5px; cursor: pointer; user-select: none; transition: background .12s; }
.rel-chip:hover { background: #dbeafe; }
.rel-more { font-size: 12px; color: var(--muted); }
.rel-empty { font-size: 12.5px; color: var(--muted); }
.rel-add { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.rel-add .input.tiny { flex: 1; min-width: 0; }
.rel-type-sel { width: auto; flex: none; }

/* 知识图谱页（阶段2） */
.graph-controls .input { margin-top: 4px; }
.graph-filters { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.gf { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: #374151; cursor: pointer; user-select: none; }
.gf input { width: 15px; height: 15px; }
.graph-wrap { position: relative; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #f8fafc; }
.graph-wrap canvas { width: 100%; display: block; touch-action: none; }
.graph-detail { position: absolute; top: 8px; right: 8px; max-width: 62%; max-height: 72%; overflow: auto; background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.graph-detail .rel-head { margin-bottom: 4px; }
.graph-legend { position: absolute; bottom: 8px; left: 8px; display: flex; flex-wrap: wrap; gap: 8px; background: rgba(255,255,255,.9); border-radius: 8px; padding: 4px 8px; font-size: 11.5px; color: #374151; }
.graph-legend .lg { display: inline-flex; align-items: center; gap: 4px; }
.graph-legend .lg i { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }

/* ============ PK 对战 ============ */
.pk-start, .pk-end { max-width: 560px; margin: 18px auto; text-align: center; }
.pk-title { font-size: 22px; margin: 4px 0 10px; }
.pk-desc { font-size: 14px; line-height: 1.8; color: var(--text); background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.pk-desc b { color: var(--blue); }
.pk-need { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: #fff7ed; border: 1px solid #fed7aa; color: #c2410c; font-size: 13px; }
.pk-diff { margin: 16px 0 4px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcfe; }
.pk-diff-label { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.pk-diff-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pk-diff-btns button { padding: 11px 8px; font-size: 15px; font-weight: 700; font-family: inherit; color: var(--text); background: #fff; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; transition: border-color .12s, background .12s, color .12s; }
.pk-diff-btns button:hover { border-color: var(--blue); }
.pk-diff-btns button.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.pk-diff-hint { margin-top: 10px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.pk-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0 4px; }
.pk-ver { font-size: 12px; color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; }
.pk-clear { font-size: 12px; color: var(--blue); background: #eef4ff; border: 1px solid #c7dbff; border-radius: 8px; padding: 5px 12px; cursor: pointer; font-family: inherit; }
.pk-clear:hover { background: #e0ecff; }
.pk-quiz { max-width: 560px; margin: 10px auto; }
.pk-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.pk-round { font-size: 14px; font-weight: 700; color: var(--blue); }
.pk-score { font-size: 14px; color: var(--text); margin-left: auto; }
.pk-quit { font-size: 12px; color: var(--muted); background: none; border: 1px solid var(--line); border-radius: 8px; padding: 3px 10px; cursor: pointer; }
.pk-word { text-align: center; font-size: 40px; font-weight: 800; letter-spacing: .5px; color: var(--text); line-height: 1.1; }
.pk-phon { text-align: center; font-size: 15px; color: var(--muted); margin-top: 4px; min-height: 18px; }
.pk-bot { margin: 16px 0 18px; }
.pk-bot-label { font-size: 13px; color: #6b7280; margin-bottom: 5px; text-align: center; }
.pk-bot-bar { height: 8px; background: #eef2f7; border-radius: 999px; overflow: hidden; }
.pk-bot-fill { height: 100%; width: 0%; background: linear-gradient(90deg,#818cf8,#6366f1); border-radius: 999px; }
.pk-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pk-opt { padding: 14px 12px; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; font-size: 15px; line-height: 1.4; cursor: pointer; font-family: inherit; color: var(--text); transition: transform .08s, border-color .12s, background .12s; }
.pk-opt:hover:not(:disabled) { border-color: var(--blue); background: #f5f8ff; }
.pk-opt:active:not(:disabled) { transform: scale(.98); }
.pk-opt.correct { background: #ecfdf5; border-color: #22c55e; color: #047857; font-weight: 700; }
.pk-opt.wrong { background: #fef2f2; border-color: #ef4444; color: #b91c1c; }
.pk-qresult { margin-top: 14px; text-align: center; font-size: 14px; font-weight: 700; padding: 9px; border-radius: 10px; }
.pk-qresult.win { background: #ecfdf5; color: #047857; }
.pk-qresult.lose { background: #fef2f2; color: #b91c1c; }
.pk-winner { font-size: 26px; font-weight: 800; margin-bottom: 8px; }
.pk-winner.win { color: #16a34a; }
.pk-winner.lose { color: #dc2626; }
.pk-winner.draw { color: #6b7280; }
.pk-final { font-size: 18px; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.pk-times { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
@media (max-width: 420px) { .pk-options { grid-template-columns: 1fr; } .pk-word { font-size: 34px; } }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 生词本命名弹窗 */
.name-modal { position: fixed; inset: 0; z-index: 95; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; padding: 20px; }
.name-box { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; padding: 20px 18px 16px; box-shadow: 0 18px 50px rgba(0,0,0,.3); }
.name-box .input, .name-box input { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; pointer-events: auto; }
.name-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 12px; }
.name-row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.name-row-stack { flex-direction: column; }
.name-row-stack .btn { width: 100%; }
.redo-modal-text { font-size: 13.5px; line-height: 1.7; color: var(--muted); margin: 0 0 4px; }
/* 粗鲁词检测弹窗 */
.prof-words { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0 4px; }
.prof-chip { font-size: 14px; font-weight: 700; color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; padding: 4px 10px; }
html.dark .prof-chip { color: #fca5a5; background: #2b0f0f; border-color: #7f1d1d; }
html.dark .name-modal { background: rgba(0,0,0,.7); }
html.dark .name-box { background: var(--card); border: 1px solid var(--line); }
html.dark .name-title { color: var(--text); }

/* 复习：常规 / 默写 模式切换 */
.rev-mode { display: flex; gap: 8px; margin-bottom: 14px; padding: 5px; background: rgba(0,0,0,.04); border-radius: 12px; }
.rev-mode-btn { flex: 1; padding: 11px 8px; border: none; border-radius: 9px; background: none; font-family: inherit; font-size: 14.5px; font-weight: 700; color: var(--muted); cursor: pointer; transition: background .14s, color .14s, box-shadow .14s; }
.rev-mode-btn.on { background: #fff; color: var(--blue); box-shadow: 0 1px 3px rgba(0,0,0,.10); }
html.dark .rev-mode { background: #0b100e; }
html.dark .rev-mode-btn.on { background: #16211d; color: var(--blue); box-shadow: none; }

/* ---------- 单词默写 ---------- */
.dict-desc { font-size: 13.5px; line-height: 1.7; color: var(--text); background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; }
.dict-desc strong { color: var(--blue); }
.dict-scopes { display: flex; flex-direction: column; gap: 8px; }
.dict-radio { display: flex; align-items: center; gap: 9px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 14.5px; cursor: pointer; }
.dict-radio input { flex: none; }
/* 文字与数字分开布局：数字用胶囊徽标靠右，避免窄屏挤压导致文字重叠 */
.dict-radio .dr-text { white-space: nowrap; }
.dict-radio .dr-n { margin-left: auto; flex: none; color: var(--blue); font-size: 13px; font-weight: 700; background: rgba(37,99,235,.10); border-radius: 999px; padding: 2px 10px; min-width: 30px; text-align: center; }
.dict-counts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 4px; }
.dict-counts button { padding: 11px 4px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; font-family: inherit; font-size: 15px; font-weight: 700; color: var(--text); cursor: pointer; }
.dict-counts button.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.dict-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.dict-round { font-size: 14px; font-weight: 700; color: var(--blue); }
.dict-score { font-size: 14px; color: var(--text); margin-left: auto; }
.dict-prompt { background: #f8fafc; border: 1px solid var(--line); border-radius: 14px; padding: 22px 16px; text-align: center; margin-bottom: 14px; }
.dict-pos { min-height: 20px; margin-bottom: 8px; }
.dict-meaning { font-size: 24px; font-weight: 800; line-height: 1.45; color: var(--text); }
.dict-input { font-size: 20px !important; text-align: center; font-family: Georgia, "Times New Roman", serif; letter-spacing: 1px; padding: 14px 12px !important; }
.dict-input.ok { border-color: var(--ok) !important; background: #f0fdf4 !important; }
.dict-input.bad { border-color: var(--no) !important; background: #fef2f2 !important; }
/* 自选单词：词库点选区 */
.dict-pick-box { border: 1px dashed var(--line); border-radius: 12px; padding: 14px; margin-bottom: 10px; background: #fbfcfe; }
.dict-pick-pool { display: flex; flex-wrap: wrap; gap: 7px; max-height: 190px; overflow: auto; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.dict-pick-pool .pick-chip { font-size: 13.5px; padding: 5px 11px; }
.dict-pick-pool .pick-chip.on { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
html.dark .dict-pick-box { background: #0b100e; border-color: var(--line); }
html.dark .dict-pick-pool { background: #0e1512; border-color: var(--line); }
.dict-wrong-box { margin-top: 16px; padding: 16px; border: 1px solid #fca5a5; border-radius: 14px; background: #fff5f5; }
/* 结果明细：全部题目一次性公布对错 */
.dict-all-box { margin-top: 16px; padding: 14px 4px 4px; }
.dict-all-head { font-size: 14.5px; font-weight: 700; color: var(--text); margin-bottom: 10px; padding: 0 12px; }
.dict-all-list { display: flex; flex-direction: column; gap: 8px; }
.dict-all-item { display: grid; grid-template-columns: 22px 20px minmax(0,auto) 1fr; align-items: baseline; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--line); }
.dict-all-item.ok { border-left-color: var(--ok); }
.dict-all-item.bad { border-left-color: var(--no); }
.dict-all-item .da-idx { font-size: 12px; color: var(--muted); }
.dict-all-item .da-mark { font-size: 15px; font-weight: 800; }
.dict-all-item.ok .da-mark { color: var(--ok); }
.dict-all-item.bad .da-mark { color: var(--no); }
.dict-all-item .da-word { font-size: 16px; font-weight: 700; color: var(--text); font-family: Georgia, serif; }
.dict-all-item .da-mean { font-size: 12.5px; color: var(--muted); }
.dict-all-item .da-yours { grid-column: 3 / -1; font-size: 12.5px; color: var(--muted); }
.dict-all-item.bad .da-yours { color: var(--no); }
html.dark .dict-all-head { color: var(--text); }
.dict-wrong-head { font-size: 14.5px; font-weight: 700; color: #b91c1c; margin-bottom: 12px; }
.dict-wrong-list { display: flex; flex-direction: column; gap: 10px; }
.dict-wrong-item { background: #fff; border: 1px solid var(--line); border-left: 4px solid #ef4444; border-radius: 10px; padding: 11px 12px; }
.dict-wrong-item.done { border-left-color: var(--ok); opacity: .75; }
.dict-wrong-q { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.dict-wrong-a { font-size: 13px; color: var(--muted); }
.dict-wrong-a b { color: var(--no); }
/* 重新拼写阶段：先挡住「正确拼写/你写的」，只留中文词义提示，写对后再揭晓 */
.dict-wrong-item .dict-wrong-a { display: none; }
.dict-wrong-item.done .dict-wrong-a { display: block; animation: da-reveal .28s ease; }
@keyframes da-reveal { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.dict-redo-hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
.dict-wrong-item.done .dict-redo-hint { display: none; }
.dict-redo-row { display: flex; gap: 8px; margin-top: 9px; }
.dict-redo-row .input { flex: 1; font-size: 15px; padding: 9px 11px; }
.dict-redo-state { font-size: 13px; margin-left: 4px; white-space: nowrap; }
.dict-redo-state.ok { color: var(--ok); font-weight: 700; }
.dict-redo-state.no { color: var(--no); font-weight: 700; }

/* 默写在深色模式下的适配 */
html.dark .dict-desc { background: #0b100e; border-color: var(--line); }
html.dark .dict-radio, html.dark .dict-counts button { background: #16211d; border-color: var(--line); color: var(--text); }
html.dark .dict-radio .dr-n { color: #7dd3fc; background: rgba(125,211,252,.12); }
html.dark .dict-counts button.on { background: #059669; border-color: #059669; color: #fff; }
html.dark .dict-prompt { background: #0b100e; border-color: var(--line); }
html.dark .dict-meaning { color: #fff; }
html.dark .dict-input.ok { background: #052e23 !important; border-color: #22c55e !important; }
html.dark .dict-input.bad { background: #2b0f0f !important; border-color: #ef4444 !important; }
html.dark .dict-wrong-box { background: #1a0e0e; border-color: #7f1d1d; }
html.dark .dict-all-item { background: #0e1512; border-color: var(--line); }
html.dark .dict-wrong-head { color: #fca5a5; }
html.dark .dict-wrong-item { background: #0e1512; border-color: var(--line); }
html.dark .dict-wrong-q { color: var(--text); }
html.dark .dict-wrong-a { color: var(--muted); }
html.dark .dict-round { color: #34d399; }

/* 小剑：点标题里的 👋 切换鼠标指针（右上角不再显示指示图） */
/* 👋 是彩蛋：不做悬停动画/提示，只在开启时显示绿色发光 */
.sword-hand { display: inline-block; padding: 0 2px; border: none; background: none; font-family: inherit; font-size: 1em; line-height: 1; cursor: pointer; vertical-align: baseline; -webkit-tap-highlight-color: transparent; }
.sword-hand.on { filter: drop-shadow(0 0 8px rgba(52,211,153,.95)) drop-shadow(0 0 20px rgba(52,211,153,.6)); }
/* 标题上方的 MINECRAFT logo：仅在小剑鼠标开启时显示，关闭时隐藏（占位保留以免标题跳动） */
.fn-logo { display: block; width: min(300px, 78%); height: auto; margin: 0 auto 14px; image-rendering: auto; opacity: 0; transform: translateY(-10px) scale(.92); pointer-events: none; transition: opacity .3s ease, transform .38s cubic-bezier(.34,1.4,.64,1); }
html.cursor-sword .fn-logo { opacity: .96; transform: translateY(0) scale(1); filter: drop-shadow(0 6px 18px rgba(0,0,0,.45)); }
/* 🤖 → 苦力怕：小剑（Minecraft 彩蛋）开启时，页面上所有 .bot-ico 从 emoji 换成苦力怕图。
   用 text-indent + overflow 把原 emoji 推出可视区：彩色 emoji 字形不认 color，
   color:transparent 遮不住它，所以走"推出裁剪"这条路更稳。 */
.bot-ico, .cam-ico, .book-ico, .warn-ico, .list-ico, .craft-ico, .furnace-ico, .chest-ico { display: inline-block; }
html.cursor-sword .bot-ico,
html.cursor-sword .cam-ico,
html.cursor-sword .book-ico,
html.cursor-sword .warn-ico,
html.cursor-sword .list-ico,
html.cursor-sword .craft-ico,
html.cursor-sword .furnace-ico,
html.cursor-sword .chest-ico {
  width: 1.15em; height: 1.15em;
  overflow: hidden; text-indent: -999px; white-space: nowrap;
  vertical-align: -0.18em;
  image-rendering: pixelated;
  filter: drop-shadow(0 1px 4px rgba(0,0,0,.45));
}
html.cursor-sword .bot-ico { background: url("./creeper-bot.png") center center / contain no-repeat; }
/* 相机 → 像素镐：小剑模式下首页「采集生词」的 📷 同步换成 MC 风格镐子 */
html.cursor-sword .cam-ico { background: url("./pickaxe-ico.png") center center / contain no-repeat; }
/* 书本 → 像素书：小剑模式下首页「词库浏览」的 📚 换成 MC 风格书 */
html.cursor-sword .book-ico { background: url("./books-ico.png") center center / contain no-repeat; }
/* 警告 → 像素块：小剑模式下首页「错题本」的 ⚠️ 换成 MC 风格像素图 */
html.cursor-sword .warn-ico { background: url("./wrong-ico.png") center center / contain no-repeat; }
/* 剪贴板 → 像素宝石：小剑模式下首页「一览表」的 📋 换成 MC 风格像素图 */
html.cursor-sword .list-ico { background: url("./list-ico.png") center center / contain no-repeat; }
/* 蛛网 → 像素工作台：小剑模式下首页「知识图谱」的 🕸️ 换成 MC 风格工作台 */
html.cursor-sword .craft-ico { background: url("./craft-ico.png") center center / contain no-repeat; }
/* 软盘 → 像素熔炉：小剑模式下首页「导出备份」的 💾 换成 MC 风格熔炉 */
html.cursor-sword .furnace-ico { background: url("./furnace-ico.png") center center / contain no-repeat; }
/* 大脑 → 像素箱子：小剑模式下首页「复习练习」的 🧠 换成 MC 风格箱子（仅首页卡片这一处；记忆桩的 🧠 不动） */
html.cursor-sword .chest-ico { background: url("./chest-ico.png") center center / contain no-repeat; }
/* 开启后全站隐藏系统指针，改用小剑（热点在剑尖附近） */
html.cursor-sword, html.cursor-sword body, html.cursor-sword *,
html.cursor-sword a, html.cursor-sword button, html.cursor-sword input,
html.cursor-sword textarea, html.cursor-sword label, html.cursor-sword select,
html.cursor-sword canvas, html.cursor-sword svg { cursor: url("./sword-cursor.png") 4 4, pointer !important; }

/* 小剑模式彩蛋背景：换成 Minecraft 风景图（[data-theme] 提高特异性，可覆盖自定义配色里的背景图） */
html.cursor-sword, html.cursor-sword[data-theme] {
  background-color: #0d1b2a !important;
  background-image: url("./sword-bg.jpg") !important;
  background-size: cover !important;
  background-position: center center !important;
  background-repeat: no-repeat !important;
  background-attachment: fixed !important;
}
/* 图片上方压一层淡暗纱：既是氛围，也保证首页白色文字读得清 */
html.cursor-sword body::before,
html.cursor-sword.dark body::before {
  background-image: linear-gradient(180deg, rgba(6,16,30,.34) 0%, rgba(6,16,30,.20) 38%, rgba(6,16,30,.46) 100%);
  background-size: 100% 100%;
}
/* 顶栏 / 标签栏改成半透明玻璃，让背景图透出来（详见文件末尾「小剑模式彩蛋」） */

/* ---------- 首页（沿用全局科技渐变背景）---------- */
#home {
  position: relative;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  margin-top: -14px;
  margin-bottom: -14px;
  padding: 60px 20px 72px;
  min-height: calc(100vh - 60px);
  overflow: hidden;
  background: transparent;   /* 背景由 html/body 全局渐变提供 */
  font-family: 'Segoe UI', system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
/* 缓慢漂移的柔光球（首页装饰） */
.home-orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .38; pointer-events: none; }
.home-orb.o1 { width: 300px; height: 300px; top: -90px; left: -80px; background: radial-gradient(circle, #93c5fd, transparent 70%); animation: orbFloat1 15s ease-in-out infinite; }
.home-orb.o2 { width: 280px; height: 280px; bottom: -100px; right: -70px; background: radial-gradient(circle, #c4b5fd, transparent 70%); animation: orbFloat2 18s ease-in-out infinite; }
@keyframes orbFloat1 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(50px,44px) scale(1.1); } }
@keyframes orbFloat2 { 0%,100% { transform: translate(0,0) scale(1.05); } 50% { transform: translate(-44px,38px) scale(.94); } }

/* 内容限宽居中，四周留足呼吸 */
#home > *:not(.home-orb) { max-width: 680px; margin-left: auto; margin-right: auto; position: relative; z-index: 2; }

.home-hero { text-align: center; padding: 12px 4px 44px; position: relative; }
.home-chips { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 22px; }
.home-chip { font-size: 12px; letter-spacing: .3px; color: #fff; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.34); border-radius: 999px; padding: 5px 14px; backdrop-filter: blur(8px); }
.home-title { font-size: 29px; font-weight: 800; letter-spacing: 1.5px; line-height: 1.3; color: #fff; text-shadow: 0 2px 24px rgba(255,255,255,.28); }
.home-sub { margin-top: 12px; font-size: 13.5px; color: rgba(255,255,255,.82); letter-spacing: 3px; }

.home-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-bottom: 26px; }
.home-stat { position: relative; text-align: center; padding: 24px 16px; border-radius: 22px; background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.26); backdrop-filter: blur(16px); box-shadow: 0 10px 30px rgba(31,38,135,.14); }
/* 可点击的错题卡：提示"点击开始复习"，悬停/按下有反馈 */
#homeStatWrong { cursor: pointer; transition: transform .1s, background .2s, border-color .2s, box-shadow .2s; -webkit-tap-highlight-color: transparent; }
#homeStatWrong:hover { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.45); }
#homeStatWrong:active { transform: scale(.97); }
#homeStatWrong:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.home-stat-cta { display: block; margin-top: 10px; font-style: normal; font-size: 12px; letter-spacing: .5px; color: rgba(255,255,255,.72); background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); border-radius: 999px; padding: 4px 10px; display: inline-block; }
#homeStatWrong:hover .home-stat-cta { background: rgba(255,255,255,.22); color: #fff; }
html.dark #homeStatWrong { cursor: pointer; }
html.dark .home-stat-cta { color: #7fd8b4; background: rgba(52,211,153,.10); border-color: rgba(52,211,153,.28); }
html.dark #homeStatWrong:hover .home-stat-cta { background: rgba(52,211,153,.2); color: #a7f3d0; }
.home-stat b { display: block; font-size: 38px; font-weight: 800; line-height: 1.05; color: #fff; text-shadow: 0 2px 18px rgba(255,255,255,.3); }
/* 转筒式数字翻滚 */
.roll-reel { display: inline-block; height: 1.05em; overflow: hidden; vertical-align: top; }
.roll-strip { display: block; will-change: transform; }
.roll-cell { display: block; height: 1.05em; line-height: 1.05em; font-size: 1em; text-align: center; }
.home-stat > span { display: block; margin-top: 8px; font-size: 13px; color: rgba(255,255,255,.8); letter-spacing: 1.5px; }

/* 黑暗模式开关 */
.home-darkrow { margin-top: 26px; display: inline-flex; align-items: center; gap: 12px; padding: 9px 10px 9px 18px; border-radius: 999px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.26); backdrop-filter: blur(12px); }
.home-darklabel { font-size: 14px; font-weight: 600; color: #fff; letter-spacing: 1px; }
.dark-switch { position: relative; width: 52px; height: 30px; border-radius: 999px; border: 1px solid rgba(255,255,255,.4); background: rgba(255,255,255,.18); cursor: pointer; padding: 0; transition: background .25s, border-color .25s; flex: none; }
.dark-switch .dark-knob { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.3); transition: transform .25s cubic-bezier(.4,1.4,.5,1); }
.dark-switch[aria-checked="true"] { background: #111216; border-color: #111216; }
.dark-switch[aria-checked="true"] .dark-knob { transform: translateX(22px); background: #7dd3fc; }

/* ---------- 黑暗模式（石墨炭灰 #111216 + 墨绿 UI）---------- */
/* 关键：必须覆盖 :root 里的颜色变量，否则卡片变深后 var(--text) 仍是浅色模式的近黑色，
   文字与卡片同色 → 整片"看不见"，看起来像搜索/渲染失灵。 */
html.dark {
  --bg: #111216;
  --card: #0e1512;
  --line: #24322c;
  --text: #e8ece9;
  --muted: #8fa39b;
  --blue: var(--t-dk-acc);
  --blue-d: var(--t-dk-acc-d);
  --hl: #facc15;
  --ok: #22c55e;
  --no: #f87171;
  background-color: #111216;
  background-image: none;
}
html.dark body { background: #111216; color: #e8ece9; }
html.dark body::before {
  background-image:
    radial-gradient(40% 32% at 8% 6%,   rgba(var(--t-dk-rgb),.10), transparent 70%),
    radial-gradient(36% 28% at 96% 16%, rgba(var(--t-dk-rgb),.08), transparent 70%),
    linear-gradient(rgba(255,255,255,.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.028) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 44px 44px, 44px 44px;
}
html.dark .app-header { background: rgba(17,18,22,.88); border-bottom: 1px solid #1e2a26; }
html.dark .tabs { background: rgba(17,18,22,.88); border-bottom: 1px solid #1e2a26; box-shadow: 0 2px 14px rgba(0,0,0,.5); }
html.dark .tab { color: #7d8c86; }
html.dark .tab.active { color: #34d399; border-bottom-color: #34d399; }
html.dark .tab-badge { background: #b91c1c; }
html.dark .panel:not(#home) { background: #0e1512; border-color: #1e2a26; box-shadow: 0 12px 40px rgba(0,0,0,.55); }
html.dark #home { background: #111216; }
html.dark .home-orb.o1 { background: radial-gradient(circle, #134e4a, transparent 70%); }
html.dark .home-orb.o2 { background: radial-gradient(circle, #14532d, transparent 70%); }
html.dark .home-title { color: #e8ece9; text-shadow: 0 2px 24px rgba(52,211,153,.25); }
html.dark .home-sub, html.dark .home-stat > span { color: #8fa39b; }
html.dark .home-chip { color: #a7f3d0; background: rgba(52,211,153,.08); border-color: rgba(52,211,153,.28); }
html.dark .home-stat, html.dark .home-card, html.dark .home-quick-btn { background: #0e1512; border-color: #1e2a26; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
html.dark .home-stat b { color: #34d399; text-shadow: 0 2px 18px rgba(52,211,153,.3); }
html.dark .home-card:hover, html.dark .home-quick-btn:hover { background: #132019; border-color: rgba(52,211,153,.5); }
html.dark .home-card .hc-title, html.dark .home-quick-btn, html.dark .home-darklabel { color: #e8ece9; }
html.dark .home-card .hc-desc { color: #7d8c86; }
html.dark .home-darkrow { background: #0e1512; border-color: #1e2a26; }
html.dark .dark-switch { background: #1e2a26; border-color: #2b3a34; }
html.dark .dark-switch[aria-checked="true"] { background: #34d399; border-color: #34d399; }
html.dark .dark-switch[aria-checked="true"] .dark-knob { background: #0b0f0d; }

/* 通用组件在黑暗模式下的配色 */
html.dark .input, html.dark .ocr-text { background: #0b100e; color: var(--text); border-color: var(--line); }
html.dark .input::placeholder, html.dark .ocr-text::placeholder { color: #6b7a74; }
html.dark .lib-body textarea, html.dark .eg-area, html.dark .peg-area { background: #0b100e; color: var(--text); border-color: var(--line); }
html.dark .btn { background: #16211d; color: var(--text); border-color: var(--line); }
html.dark .btn:hover { background: #1c2a24; }
html.dark .btn.primary { background: #059669; border-color: #059669; color: #fff; }
html.dark .btn.danger { color: var(--no); border-color: #7f1d1d; }
html.dark .hint, html.dark .rc-progress { color: var(--muted); }
html.dark .word-cloud, html.dark .list-wrap, html.dark .lib-card, html.dark .review-card, html.dark .acc-panel, html.dark .acc-item, html.dark .tag-bar, html.dark .pk-desc, html.dark .pk-opt, html.dark .rc-answer, html.dark .lib-context, html.dark .graph-wrap, html.dark .mode-switch { background: var(--card); border-color: var(--line); color: var(--text); }
html.dark .mode.active, html.dark .btn.active { background: #059669; color: #fff; }
html.dark .vocab-table thead th { background: #101a16; color: var(--muted); border-color: var(--line); }
html.dark .vocab-table td { border-color: #1a2420; color: var(--text); }
html.dark .tag { background: #14211c; color: var(--blue); }
html.dark .pk-opt:hover:not(:disabled) { background: #16211d; border-color: #34d399; }
html.dark .empty { color: var(--muted); }
html.dark .rc-sentence .rc-word { color: var(--text); }
html.dark .search-empty { color: var(--muted); }
html.dark .se-orbit .se-glass { color: #7d8c86; opacity: .85; }

/* PK 难度选择区 / 清缓存按钮 / 提示条：深色适配（原先是硬编码白底，深色模式下会出白块） */
html.dark .pk-diff { background: #0b100e; border-color: var(--line); }
html.dark .pk-diff-btns button { background: #16211d; color: var(--text); border-color: var(--line); }
html.dark .pk-diff-btns button:hover { border-color: var(--blue); background: #1c2a24; }
html.dark .pk-diff-btns button.on { background: #059669; border-color: #059669; color: #fff; }
html.dark .pk-clear { background: #16211d; color: var(--blue); border-color: var(--line); }
html.dark .pk-clear:hover { background: #1c2a24; }
html.dark .pk-need { background: #2a1f0b; border-color: #7c5a12; color: #fbbf24; }
html.dark .pk-title { color: var(--text); }

/* 其余硬编码浅色块（入库状态 / 补全列表 / PK 进度条与结果 / 词性标签等） */
html.dark .status { background: #052e23; color: #6ee7b7; }
html.dark .fill-list { background: #052e23; border-color: #14532d; color: #a7f3d0; }
html.dark .pk-bot-bar { background: #1c2a24; }
html.dark .pk-qresult.win { background: #052e23; color: #6ee7b7; }
html.dark .pk-qresult.lose { background: #2b0f0f; color: #fca5a5; }
html.dark .pos-tag { background: #16211d; color: #cbd5e1; border-color: var(--line); }
html.dark .pos-tag.chosen, html.dark .pos-done { background: #059669; color: #fff; border-color: #059669; }
html.dark .freq-tag, html.dark .exam-tag { background: #14211c; color: #93c5fd; }
html.dark .chip { background: #16211d; color: #cbd5e1; border-color: var(--line); }
html.dark .chip.on { background: #059669; color: #fff; border-color: #059669; }
html.dark .speak-btn { background: #16211d; color: var(--blue); }
html.dark .graph-detail, html.dark .graph-legend { background: rgba(14,21,18,.97); border-color: var(--line); color: var(--text); }
html.dark .graph-wrap { background: #0b100e; }
html.dark .pos-add, html.dark .pos-tag.pos-add { background: #2a1f0b; border-color: #7c5a12; color: #fbbf24; }
html.dark .chip-del:hover { background: #2b0f0f; }

/* 剩余浅色块：错题卡 / 例句块 / 记忆桩 / 关联词 chip / PK 选项结果态 / 顶栏口音按钮 */
html.dark .wrong-card { background: var(--card); border-color: var(--line); }
html.dark .wrong-ctx, html.dark .a-eg, html.dark .eg-inline, html.dark .eg-box, html.dark .pos-row.picking { background: #0b100e; border-color: var(--line); color: var(--text); }
html.dark .eg-box { border-left-color: #475569; }
html.dark .eg-area, html.dark .peg-area { background: #0b100e; border-color: var(--line); color: var(--text); }
html.dark .rel-chip { background: #14211c; color: var(--blue); }
html.dark .pk-opt.correct { background: #052e23; border-color: #22c55e; color: #6ee7b7; }
html.dark .pk-opt.wrong { background: #2b0f0f; border-color: #ef4444; color: #fca5a5; }
html.dark .acc-btn.active { background: #0e1512; color: var(--blue); border-color: var(--line); }
html.dark .logo { background: #0e1512; }

/* PK 答题页：单词/音标/比分等在深色下强制提亮（不依赖 --text 继承，避免旧缓存下变量没覆盖时变暗） */
html.dark .pk-word { color: #ffffff; text-shadow: 0 2px 18px rgba(0,0,0,.55); }
html.dark .pk-phon { color: #9fb3aa; }
html.dark .pk-score { color: #e8ece9; }
html.dark .pk-round { color: #34d399; }
html.dark .pk-quit { color: #9fb3aa; background: #16211d; border-color: var(--line); }
html.dark .pk-bot-label { color: #9fb3aa; }
html.dark .pk-final { color: var(--text); }
html.dark .pk-times { color: var(--muted); }

.home-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 34px; }
.home-quick-btn { padding: 20px 14px; border: 1px solid rgba(255,255,255,.4); border-radius: 20px; font-size: 16.5px; font-weight: 700; font-family: inherit; color: #fff; cursor: pointer; background: rgba(255,255,255,.17); backdrop-filter: blur(14px); box-shadow: 0 10px 30px rgba(31,38,135,.16); transition: transform .1s, box-shadow .2s, background .2s; }
.home-quick-btn.alt { background: rgba(255,255,255,.11); }
.home-quick-btn:active { transform: scale(.97); }
.home-quick-btn:hover { background: rgba(255,255,255,.26); box-shadow: 0 14px 40px rgba(31,38,135,.24); }

.home-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.home-card { padding: 24px 20px; border-radius: 22px; cursor: pointer; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); backdrop-filter: blur(14px); transition: transform .1s, background .2s, box-shadow .2s, border-color .2s; }
.home-card:hover { background: rgba(255,255,255,.22); border-color: rgba(255,255,255,.5); box-shadow: 0 14px 40px rgba(31,38,135,.22); }
.home-card:active { transform: scale(.97); }
.hc-icon { font-size: 30px; line-height: 1; filter: drop-shadow(0 3px 12px rgba(255,255,255,.4)); }
.hc-title { font-size: 17px; font-weight: 700; color: #fff; margin-top: 14px; letter-spacing: 1px; }
.hc-desc { font-size: 12.5px; color: rgba(255,255,255,.76); margin-top: 7px; line-height: 1.6; }

/* ==================================================================
   换色主题系统
   1) 每个主题只改 CSS 变量，所有界面颜色自动跟随；
   2) 浅色模式看 --t-*，黑暗模式看 --t-dk-*；
   3) 通过 <html data-theme="xxx"> 切换，默认（无属性）= 经典蓝紫。
   ================================================================== */

/* ---------- 主题配色表 ---------- */

/* 蜜桃粉 */
html[data-theme="rose"] {
  --t-acc: #e05575; --t-acc-d: #c03d5f; --t-acc-l: #f7a8b8; --t-rgb: 224,85,117;
  --t-g1: #f79bb0; --t-g2: #e0708f; --t-g3: #b04466; --t-solid: #e0708f;
  --t-o1: 255,196,214; --t-o2: 255,150,180; --t-o3: 224,85,117;
  --t-dk-acc: #fb7185; --t-dk-acc-d: #e11d48; --t-dk-acc-l: #fecdd3; --t-dk-rgb: 251,113,133;
}
/* 蓝紫晚霞 */
html[data-theme="dusk"] {
  --t-acc: #7c74d8; --t-acc-d: #6159c4; --t-acc-l: #b9b3f0; --t-rgb: 124,116,216;
  --t-g1: #a9c9f2; --t-g2: #c2aeea; --t-g3: #dba0e2; --t-solid: #c2aeea;
  --t-o1: 169,201,242; --t-o2: 219,160,226; --t-o3: 124,116,216;
  --t-dk-acc: #a78bfa; --t-dk-acc-d: #7c3aed; --t-dk-acc-l: #ddd6fe; --t-dk-rgb: 167,139,250;
}
/* 天空蓝 */
html[data-theme="sky"] {
  --t-acc: #2f8fe0; --t-acc-d: #1f76c4; --t-acc-l: #8cc6f7; --t-rgb: 47,143,224;
  --t-g1: #6fb0f5; --t-g2: #8cc6f7; --t-g3: #a9dcf8; --t-solid: #8cc6f7;
  --t-o1: 140,198,247; --t-o2: 169,220,248; --t-o3: 47,143,224;
  --t-dk-acc: #38bdf8; --t-dk-acc-d: #0284c7; --t-dk-acc-l: #bae6fd; --t-dk-rgb: 56,189,248;
}
/* 蜜桃紫 */
html[data-theme="peach"] {
  --t-acc: #c85fa8; --t-acc-d: #a5448a; --t-acc-l: #e9a6dc; --t-rgb: 200,95,168;
  --t-g1: #f3b98f; --t-g2: #d98ed8; --t-g3: #b06ac8; --t-solid: #d98ed8;
  --t-o1: 243,185,143; --t-o2: 230,140,210; --t-o3: 176,106,200;
  --t-dk-acc: #f0abfc; --t-dk-acc-d: #c026d3; --t-dk-acc-l: #f5d0fe; --t-dk-rgb: 240,171,252;
}
/* 深海青 */
html[data-theme="deep"] {
  --t-acc: #1f8fae; --t-acc-d: #157a96; --t-acc-l: #7fd3e6; --t-rgb: 31,143,174;
  --t-g1: #2b2a70; --t-g2: #2f6bb0; --t-g3: #35b0c8; --t-solid: #2f6bb0;
  --t-o1: 53,176,200; --t-o2: 43,42,112; --t-o3: 70,140,220;
  --t-dk-acc: #22d3ee; --t-dk-acc-d: #0891b2; --t-dk-acc-l: #a5f3fc; --t-dk-rgb: 34,211,238;
}
/* 薄荷紫 */
html[data-theme="mint"] {
  --t-acc: #5f7ddb; --t-acc-d: #4a63b8; --t-acc-l: #a8b8ef; --t-rgb: 95,125,219;
  --t-g1: #a9e2bc; --t-g2: #9bb8ef; --t-g3: #8e8fe2; --t-solid: #9bb8ef;
  --t-o1: 169,226,188; --t-o2: 142,143,226; --t-o3: 95,125,219;
  --t-dk-acc: #a5b4fc; --t-dk-acc-d: #6366f1; --t-dk-acc-l: #c7d2fe; --t-dk-rgb: 165,180,252;
}

/* ---------- 首页「换色」控件 ---------- */
/* 换色按钮钉在首页右上角（不占流，标题/黑暗开关位置不变） */
.home-themebox { position: absolute; top: 0; right: 0; margin: 0; text-align: right; z-index: 30; }
.home-theme-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px;
  border-radius: 999px; border: 1px solid rgba(255,255,255,.26);
  background: rgba(255,255,255,.12); backdrop-filter: blur(12px);
  color: #fff; font-size: 14px; font-weight: 600; letter-spacing: 1px;
  font-family: inherit; cursor: pointer; transition: background .18s, transform .1s;
}
.home-theme-btn:hover { background: rgba(255,255,255,.2); }
.home-theme-btn:active { transform: scale(.97); }
.home-theme-btn .htb-dot {
  width: 15px; height: 15px; border-radius: 50%; flex: none;
  background-image: linear-gradient(135deg, var(--t-g1), var(--t-g2), var(--t-g3));
  box-shadow: 0 0 0 2px rgba(255,255,255,.55) inset;
}

.theme-panel {
  position: absolute; top: calc(100% + 8px);
  /* 右缘对齐策略：
     · 窄屏 / 手机 → 贴着「换色」按钮右缘（right: 0）
     · 宽屏（首页内容两侧出现留白）→ 面板滑到窗口右侧，落在留白里，不再压住首页内容
     推导：首页内容永远水平居中（main 左右内边距 14px，#home 子元素 max-width 680px 居中）
           按钮右缘 = 50vw + 340px，窗口右缘留 14px = 100vw − 14px
           → right = (100vw − 14) − (50vw + 340) = 354px − 50vw
           外面套 min(0px, …)：窗口不够宽时不会把面板推出去，仍贴着按钮。
     注意：若以后改了 main / #home 的 max-width，这里的常数要一起改。 */
  right: min(0px, calc(354px - 50vw));
  /* 宽度：优先塞进右侧留白（可用 = 50vw − 364px，再留 10px 缝），太窄就用 320~430px 兜底 */
  width: min(calc(100vw - 36px), clamp(320px, calc(50vw - 364px), 430px));
  margin: 0; padding: 14px;
  max-height: min(80vh, 620px); overflow-y: auto; overscroll-behavior: contain;
  border-radius: 20px; text-align: left;
  /* 深色玻璃底：白字/彩色滑块都清晰，且不依赖 backdrop-filter 也能挡住背后内容 */
  background: rgba(26,24,64,.74);
  border: 1px solid rgba(255,255,255,.24);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  box-shadow: 0 20px 50px rgba(8,10,40,.5);
  animation: themePanelIn .22s ease-out;
}
@keyframes themePanelIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.theme-panel-title { color: #fff; font-size: 12.5px; font-weight: 700; letter-spacing: 1px; opacity: .92; margin: 0 0 10px 4px; }
.theme-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(122px, 1fr)); gap: 10px; }
.theme-pill {
  position: relative; height: 46px; border-radius: 999px; padding: 0 15px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 2px solid rgba(255,255,255,.55); font-family: inherit; cursor: pointer;
  color: #fff; font-size: 13.5px; font-weight: 700; letter-spacing: .5px;
  text-shadow: 0 1px 5px rgba(0,0,0,.4); box-shadow: 0 4px 14px rgba(0,0,0,.16);
  transition: transform .12s, box-shadow .15s, border-color .15s;
}
.theme-pill:active { transform: scale(.97); }
.theme-pill .tp-check { opacity: 0; font-size: 15px; transition: opacity .15s; }
.theme-pill.on { border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.75), 0 8px 20px rgba(0,0,0,.24); }
.theme-pill.on .tp-check { opacity: 1; }

/* 换色面板在黑暗模式下的底衬 */
html.dark .theme-panel { background: rgba(12,16,16,.80); border-color: rgba(255,255,255,.16); box-shadow: 0 20px 50px rgba(0,0,0,.62); }
html.dark .home-theme-btn { background: #0e1512; border-color: #1e2a26; }
html.dark .home-theme-btn:hover { background: #132019; }

/* ---------- 浅色模式：把硬编码的蓝色统一改成主题色 ---------- */
.home-orb.o1 { background: radial-gradient(circle, rgba(var(--t-o1),1), transparent 70%); }
.home-orb.o2 { background: radial-gradient(circle, rgba(var(--t-o2),1), transparent 70%); }
.mode-switch { background: rgba(var(--t-rgb),.08); }
.tag { background: rgba(var(--t-rgb),.10); color: var(--blue); }
.speak-btn { background: rgba(var(--t-rgb),.10); color: var(--blue); }
.rel-chip { background: rgba(var(--t-rgb),.10); color: var(--blue-d); }
.tag-filter-chip .chip-count { background: rgba(var(--t-rgb),.10); color: var(--blue); }
.dict-radio .dr-n { background: rgba(var(--t-rgb),.10); color: var(--blue); }
.chip:hover { border-color: var(--t-acc-l); color: var(--blue-d); }
.chip.on { background: var(--blue); border-color: var(--blue); }
.pos-tag.chosen { background: rgba(var(--t-rgb),.14); border-color: var(--t-acc-l); color: var(--blue-d); }
@keyframes searchHit { 0% { box-shadow: 0 0 0 0 rgba(var(--t-rgb),.55); border-color: var(--blue); } 70% { box-shadow: 0 0 0 8px rgba(var(--t-rgb),0); border-color: var(--blue); } 100% { box-shadow: 0 0 0 0 rgba(var(--t-rgb),0); } }
@keyframes rcFlash { 0% { box-shadow: 0 0 0 0 rgba(var(--t-rgb),.45); } 100% { box-shadow: 0 0 0 14px rgba(var(--t-rgb),0); } }

/* ---------- 黑暗模式：强调色跟随主题（默认主题仍是墨绿）---------- */
html.dark .tab.active { color: var(--t-dk-acc); border-bottom-color: var(--t-dk-acc); }
html.dark .home-title { text-shadow: 0 2px 24px rgba(var(--t-dk-rgb),.25); }
html.dark .home-chip { color: var(--t-dk-acc-l); background: rgba(var(--t-dk-rgb),.08); border-color: rgba(var(--t-dk-rgb),.28); }
html.dark .home-stat b { color: var(--t-dk-acc); text-shadow: 0 2px 18px rgba(var(--t-dk-rgb),.3); }
html.dark .home-card:hover, html.dark .home-quick-btn:hover { border-color: rgba(var(--t-dk-rgb),.5); }
html.dark .dark-switch[aria-checked="true"] { background: var(--t-dk-acc); border-color: var(--t-dk-acc); }
html.dark .home-orb.o1 { background: radial-gradient(circle, rgba(var(--t-dk-rgb),.30), transparent 70%); }
html.dark .home-orb.o2 { background: radial-gradient(circle, rgba(var(--t-dk-rgb),.22), transparent 70%); }
html.dark .btn.primary { background: var(--t-dk-acc-d); border-color: var(--t-dk-acc-d); }
html.dark .mode.active, html.dark .btn.active { background: var(--t-dk-acc-d); }
html.dark .chip.on, html.dark .pos-tag.chosen, html.dark .pos-done,
html.dark .pk-diff-btns button.on, html.dark .dict-counts button.on { background: var(--t-dk-acc-d); border-color: var(--t-dk-acc-d); }
html.dark .pk-round { color: var(--t-dk-acc); }
html.dark .home-stat-cta { color: var(--t-dk-acc-l); background: rgba(var(--t-dk-rgb),.10); border-color: rgba(var(--t-dk-rgb),.28); }
html.dark #homeStatWrong:hover .home-stat-cta { background: rgba(var(--t-dk-rgb),.2); color: var(--t-dk-acc-l); }
html.dark .dict-radio .dr-n { color: var(--t-dk-acc); background: rgba(var(--t-dk-rgb),.12); }

/* ---------- 自定义配色面板 ---------- */
.theme-custom { margin-top: 14px; padding-top: 14px; border-top: 1px dashed rgba(255,255,255,.28); }
.tc-title { color: #fff; font-size: 12.5px; font-weight: 700; letter-spacing: 1px; opacity: .92; margin-bottom: 10px; }
.tc-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.tc-row > label { color: #fff; font-size: 13px; width: 64px; flex: none; }
.tc-row input[type=color] {
  width: 42px; height: 30px; border: 1px solid rgba(255,255,255,.5); border-radius: 8px;
  background: none; cursor: pointer; padding: 2px;
}
.tc-row input[type=file] { color: #fff; font-size: 12px; max-width: 220px; }
.tc-actions { align-items: center; }
.tc-apply {
  background: rgba(255,255,255,.94); color: #222; border: none; border-radius: 10px;
  padding: 9px 18px; font-weight: 700; font-family: inherit; font-size: 14px; cursor: pointer;
  transition: transform .1s;
}
.tc-apply:active { transform: scale(.97); }
.tc-clear {
  background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.3);
  border-radius: 10px; padding: 8px 13px; font-family: inherit; font-size: 13px; cursor: pointer;
}
.tc-hint { color: rgba(255,255,255,.78); font-size: 11.5px; }
.theme-pill.theme-pill-custom { border-style: dashed; }
.theme-pill.theme-pill-custom .tp-plus { font-size: 17px; line-height: 1; transition: transform .2s; }
.theme-pill.theme-pill-custom.open .tp-plus { transform: rotate(45deg); }

/* 自定义配色面板头部：标题 + 收起按钮 */
.tc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.tc-head .tc-title { margin-bottom: 0; }
.tc-collapse {
  background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.3);
  border-radius: 999px; padding: 5px 12px; font-family: inherit; font-size: 12px; cursor: pointer;
}
.tc-collapse:active { transform: scale(.97); }
html.dark .theme-custom { border-top-color: rgba(255,255,255,.16); }

/* 换色面板的滚动条：细窄、半透明、无上下箭头按钮
   （Windows 原生滚动条又宽又带三角箭头，展开「自定义」后内容变高就会冒出来，很难看）
   两边都写：新 Chrome 认 scrollbar-width/scrollbar-color（会忽略 ::-webkit-*），老内核走 ::-webkit-* */
.theme-panel {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.30) transparent;
}
.theme-panel::-webkit-scrollbar { width: 6px; height: 6px; }
.theme-panel::-webkit-scrollbar-track { background: transparent; border: 0; }
.theme-panel::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.30); border-radius: 999px;
  border: 0; min-height: 32px;
}
.theme-panel::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.52); }
.theme-panel::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
.theme-panel::-webkit-scrollbar-corner { background: transparent; }

/* ==================================================================
   🗡 小剑模式彩蛋背景（点击首页 👋 开启）
   开启：整站换成 Minecraft 风景图 + 顶栏/标签栏变玻璃 + 标题上方出现 logo
   关闭：类名移除，自动还原为当前「换色」主题的渐变背景（无需额外记录）
   放在文件最末尾：确保持平特异性时能覆盖前面的浅色/黑暗/自定义主题规则
   ================================================================== */
html.cursor-sword,
html.cursor-sword[data-theme],
html.cursor-sword.dark { background-color: #0d1b2a !important; }

/* 黑暗模式的 body 是不透明的深色，会让背景图被盖住 → 必须置空 */
html.cursor-sword body,
html.cursor-sword.dark body { background: transparent !important; }

/* 风景图用「固定图层」实现，而不是 background-attachment:fixed
   （iOS Safari 对该属性支持很差，会把 cover 按整页高度拉伸导致变形）。
   放在 z-index:-2 最底层，body::before 的暗纱压在它上面。 */
html.cursor-sword body::after,
html.cursor-sword.dark body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image: url("./sword-bg.jpg");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  animation: swordBgIn .55s ease-out;
}
@keyframes swordBgIn { from { opacity: 0; } to { opacity: 1; } }
/* 首页的弥散光斑在风景图上会显脏 → 压暗处理 */
html.cursor-sword .home-orb { opacity: .3; }

/* 图片上方压一层淡暗纱：既是氛围，也保证首页白色文字清晰可读 */
html.cursor-sword body::before,
html.cursor-sword.dark body::before {
  background-image: linear-gradient(180deg, rgba(6,16,30,.36) 0%, rgba(6,16,30,.22) 40%, rgba(6,16,30,.48) 100%);
  background-size: 100% 100%;
}
/* 顶栏 + 标签栏半透明玻璃，让风景透出来，像游戏画面 */
html.cursor-sword .app-header,
html.cursor-sword.dark .app-header {
  background: rgba(8,18,32,.48);
  border-bottom: 1px solid rgba(255,255,255,.14);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
html.cursor-sword .tabs,
html.cursor-sword.dark .tabs {
  background: rgba(8,18,32,.36);
  border-bottom: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 2px 14px rgba(0,0,0,.32);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
html.cursor-sword .tab,
html.cursor-sword.dark .tab { color: rgba(255,255,255,.78); }
html.cursor-sword .tab.active,
html.cursor-sword.dark .tab.active { color: #fff; font-weight: 700; border-bottom-color: #fff; }

/* ============================================================
 * 放松小游戏（小剑彩蛋专属）：仅在 html.cursor-sword 下显示
 * ============================================================ */
.mini-game { display: none; }
html.cursor-sword .mini-game {
  display: block;
  max-width: 680px;
  margin: 22px auto 0;
  padding: 14px;
  border-radius: 16px;
  background: rgba(18, 16, 42, .46);
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .30);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.mg-head {
  display: flex; flex-wrap: wrap; gap: 6px 12px;
  align-items: baseline; justify-content: space-between;
  margin: 2px 4px 10px;
}
.mg-title { font-size: 15px; font-weight: 700; color: #fff; letter-spacing: .3px; }
.mg-tip { font-size: 11.5px; color: rgba(255, 255, 255, .62); }

.mg-stage {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #d8c69b;
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, .25);
}
.mg-stage canvas { display: block; width: 100%; }

.mg-hud {
  position: absolute; left: 0; right: 0; top: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 9px 11px;
  pointer-events: none;
}
.mg-hp {
  flex: 0 0 168px; height: 13px; border-radius: 999px;
  background: rgba(0, 0, 0, .48);
  border: 1px solid rgba(255, 255, 255, .30);
  overflow: hidden;
}
.mg-hp > i { display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, #5bd66a, #8ff29a);
  transition: width .12s linear; }
.mg-score { font-size: 12.5px; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); }
.mg-wave { color: #ffd766; font-weight: 700; }
.mg-score b { font-size: 15px; }
.mg-dot { margin: 0 5px; opacity: .6; }

.mg-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 9px; text-align: center; padding: 18px;
  background: rgba(6, 10, 22, .62);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.mg-overlay.hidden { display: none !important; }
.mg-ov-title { font-size: 19px; font-weight: 800; color: #fff; letter-spacing: 1px; text-shadow: 0 2px 8px rgba(0, 0, 0, .6); }
.mg-ov-sub { font-size: 12.5px; line-height: 1.7; color: rgba(255, 255, 255, .82); max-width: 470px; }
.mg-ov-sub b { color: #ffd766; }
.mg-overlay .btn { margin-top: 4px; }

@media (max-width: 480px) {
  .mg-hp { flex-basis: 110px; }
  .mg-tip { display: none; }
}
