/* ============================================================
   EbinGo 克隆版主题 —— 橄榄绿 × 米黄纸张（对照原版视觉风格还原）
   ============================================================ */

:root {
  --olive-deep: #46552f;      /* 应用底色/外框 */
  --olive-frame: #55653a;     /* 顶栏、侧栏 */
  --olive: #6b7c4a;           /* 主绿 */
  --olive-soft: #7d8f57;      /* 按钮/选中 */
  --olive-line: #a8b183;      /* 格线 */
  --paper: #f4f1e2;           /* 内容纸面 */
  --paper-deep: #ebe7d2;      /* 纸面加深 */
  --card-white: #fdfcf4;      /* 白卡 */
  --ink: #3b3a2f;
  --ink-soft: #7a7767;
  --ink-faint: #a5a294;
  --gold: #d3a950;
  --red: #c94f4c;
  --red-dot: #d9534f;
  --btn-forgot: #57544a;
  --btn-fuzzy: #98937f;
  --radius: 14px;
  --serif: Georgia, "Times New Roman", "Songti SC", "STSong", serif;
  --sans: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--sans);
  background: var(--olive-deep);
  color: var(--ink);
  overscroll-behavior: none;
}
button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 15px; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: #0002; border-radius: 2px; }

#app { max-width: 520px; margin: 0 auto; height: 100%; display: flex; flex-direction: column; position: relative; background: var(--paper); }
#viewRoot { flex: 1; overflow: hidden auto; position: relative; }
#pageRoot { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
#pageRoot > * { pointer-events: auto; }

/* ---------- 底部导航 ---------- */
#bottomNav {
  display: flex; background: var(--card-white); border-top: 1px solid #e4e0cd;
  padding-bottom: env(safe-area-inset-bottom); z-index: 50;
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 0 6px; color: #7d7a68; font-size: 11.5px;
}
.nav-btn .nav-ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.nav-btn.active { color: var(--olive); }
.nav-btn.active span { font-weight: 600; }

/* ---------- 通用 ---------- */
.page { min-height: 100%; display: flex; flex-direction: column; }
.page-pad { padding: 14px 16px 24px; }
.page-title { font-size: 20px; font-weight: 700; margin: 4px 0 12px; color: var(--ink); }
.ic { width: 18px; height: 18px; }
.btn {
  border-radius: 10px; padding: 10px 18px; font-size: 15px; font-weight: 500;
}
.btn-primary { background: var(--olive-soft); color: #fff; }
.btn-primary:active { background: var(--olive); }
.btn-plain { background: var(--paper-deep); color: #4e4b3a; font-weight: 600; }
.btn-danger { background: var(--red); color: #fff; }
.btn-outline { border: 1px solid var(--olive-line); color: var(--olive); background: transparent; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.hint { color: var(--ink-soft); font-size: 12.5px; line-height: 1.6; }

/* toast */
#toastBox { position: fixed; top: 14px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 200; pointer-events: none; }
.toast {
  background: rgba(40,42,30,.92); color: #fff; font-size: 13.5px; padding: 9px 16px;
  border-radius: 20px; opacity: 0; transform: translateY(-8px); transition: all .25s ease-out; max-width: 80%;
}
.toast.show { opacity: 1; transform: none; }
.toast-error { background: rgba(160,52,50,.94); }
.toast-success { background: rgba(84,104,58,.95); }

/* 弹窗 */
.dlg-mask {
  position: fixed; inset: 0; background: rgba(30,32,20,.45); z-index: 120;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.dlg {
  background: var(--card-white); border-radius: 16px; padding: 20px 18px 14px; width: 100%; max-width: 340px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.dlg-title { font-weight: 700; font-size: 16px; margin-bottom: 10px; }
.dlg-msg { font-size: 14px; line-height: 1.7; color: var(--ink-soft); white-space: pre-wrap; }
.dlg-btns { display: flex; gap: 10px; margin-top: 18px; }
.dlg-btns .btn { flex: 1; }

/* 底部抽屉 */
.sheet-mask {
  position: fixed; inset: 0; background: rgba(30,32,20,.4); z-index: 110;
  display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .2s;
}
.sheet-mask.open { opacity: 1; }
.sheet-mask.closing { opacity: 0; }
.sheet {
  background: var(--card-white); width: 100%; max-width: 520px; border-radius: 18px 18px 0 0;
  max-height: 78vh; display: flex; flex-direction: column; transform: translateY(30px); transition: transform .22s ease-out;
}
.sheet-mask.open .sheet { transform: none; }
.sheet-bar { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; }
.sheet-title { font-weight: 700; font-size: 16px; }
.sheet-close { font-size: 22px; color: var(--ink-faint); padding: 0 6px; }
.sheet-body { overflow-y: auto; padding: 6px 16px calc(18px + env(safe-area-inset-bottom)); }
.sheet-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 8px; font-size: 15px;
  border-bottom: 1px solid #f0eddd; width: 100%; text-align: left;
}
.sheet-item:active { background: var(--paper-deep); }
.sheet-item .ic { color: var(--olive); }

/* 加载遮罩 */
.loading-mask {
  position: fixed; inset: 0; background: rgba(40,42,28,.5); z-index: 150;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}
.loading-spin {
  width: 34px; height: 34px; border-radius: 50%; border: 3px solid #fff3;
  border-top-color: #fff; animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: #fff; font-size: 14px; }

/* ============================================================
   词书 Tab（书架）
   ============================================================ */
.shelf { padding: 18px 16px 90px; }
.shelf-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.shelf-head h1 { font-size: 22px; margin: 0; font-weight: 800; }
.shelf-head-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft); background: transparent;
}
.icon-btn:active { background: var(--paper-deep); }

.fixed-books { display: flex; gap: 12px; margin-bottom: 20px; }
.fixed-book {
  flex: 1; border-radius: 12px; padding: 12px; color: #fff; text-align: left; position: relative;
  min-height: 96px; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden;
  box-shadow: 0 4px 12px rgba(40,50,25,.25);
}
.fixed-book .fb-name { font-family: var(--serif); font-size: 15px; line-height: 1.25; }
.fixed-book .fb-count { font-size: 11px; opacity: .85; margin-top: 4px; }
.fixed-book::after { content: ""; position: absolute; right: 10px; top: 10px; width: 14px; height: 14px; border-radius: 50%; border: 1.4px solid rgba(255,255,255,.6); }
.fb-familiar { background: linear-gradient(145deg, #5a6c40, #47562f); }
.fb-wrong { background: linear-gradient(145deg, #3d4a63, #2f3a4f); }
.fb-new { background: linear-gradient(145deg, #a85f70, #8e4f5e); }

/* 行快捷菜单 */
.row-act-btn {
  width: 26px; height: 26px; border-radius: 50%; color: var(--ink-faint); font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.row-act-btn:active { background: var(--paper-deep); color: var(--olive); }

/* 自绘键盘 */
.custom-kb {
  flex-shrink: 0; background: var(--paper-deep); padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 6px; user-select: none;
}
.kb-row { display: flex; justify-content: center; gap: 5px; }
.kb-key {
  min-width: 30px; height: 40px; padding: 0 6px; border-radius: 7px; background: var(--card-white);
  box-shadow: 0 1px 2px rgba(60,60,40,.25); font-size: 16px; font-family: var(--serif); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
}
.kb-key:active { background: var(--olive-line); }
.kb-key.wide { min-width: 46px; font-size: 12px; color: var(--ink-soft); }
.kb-key.space { flex: 1; font-size: 11px; color: var(--ink-faint); }

/* 卡片排版预设 */
.card-mode-body.layout-focus .cm-word { font-size: 50px; margin: 22px 0 10px; }
.card-mode-body.layout-focus .cm-sec { background: transparent; box-shadow: none; padding: 8px 4px; }
.card-mode-body.layout-focus .cm-sec-title { display: none; }
.card-mode-body.layout-compact { flex-direction: row; flex-wrap: wrap; align-content: flex-start; }
.card-mode-body.layout-compact .cm-card-area { flex: 1 1 58%; }
.card-mode-body.layout-compact .cm-sidecol { flex: 1 1 40%; display: flex; flex-direction: column; justify-content: center; }
.card-mode-body.layout-compact .cm-status-row { flex-direction: column; width: 84px; padding: 8px; }
.card-mode-body.layout-compact .cm-status-row .status-btn { padding: 14px 0; font-size: 14px; }
.card-mode-body.layout-compact .cm-status-row .status-btn + .status-btn { margin-top: 12px; }
.card-mode-body.layout-compact .cm-nav-row { position: absolute; top: 6px; right: 8px; padding: 0; width: auto; gap: 4px; }
.card-mode-body.layout-compact .cm-count-row { position: absolute; top: 10px; left: 14px; right: 110px; z-index: 2; padding: 0; }
.cm-nav-underline { display: flex; gap: 5px; justify-content: center; padding: 2px 0 6px; }
.cm-nav-underline i { width: 18px; height: 3px; border-radius: 2px; background: #d8d4bf; transition: background .2s; }
.cm-nav-underline i.on { background: var(--olive); width: 26px; }
.card-mode-body.nav-underline .cm-nav { background: transparent; box-shadow: none; width: 34px; }

/* 横屏变体（卡片左右分栏） */
@media (orientation: landscape) {
  .card-mode-body.landscape-split { flex-direction: row; }
  .card-mode-body.landscape-split .cm-card-area { flex: 1.1; }
  .card-mode-body.landscape-split .cm-sidecol { flex: 1; display: flex; flex-direction: column; justify-content: center; }
  .card-mode-body.landscape-split .cm-word { font-size: 38px; margin-top: 4px; }
}

/* 打印纸（导出） */
.print-doc { background: #fff; color: #222; font-family: Georgia, "Songti SC", serif; }
.print-doc h1 { font-size: 18px; margin: 0 0 4px; }
.print-doc .p-sub { font-size: 11px; color: #777; margin-bottom: 12px; }
.print-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.print-table th, .print-table td { border: 1px solid #bbb; padding: 6px 8px; text-align: left; }
.print-table th { background: #f0eee2; }
.print-table .num { width: 34px; color: #666; }
.print-lines td { height: 44px; }
.write-line { border-bottom: 1px solid #999; height: 30px; margin: 0 6px; }
@media print { body * { visibility: hidden; } .print-doc, .print-doc * { visibility: visible; } .print-doc { position: absolute; inset: 0; } }

.book-cards { display: flex; flex-direction: column; gap: 18px; }
.book-card { display: flex; gap: 14px; }
.book-cover {
  width: 108px; height: 152px; border-radius: 8px 14px 14px 8px; position: relative; flex-shrink: 0;
  box-shadow: 0 6px 14px rgba(40,50,25,.3); color: var(--bc-ink, #eee);
  display: flex; flex-direction: column; justify-content: center; padding: 12px 10px 12px 16px; text-align: left;
}
.book-cover::before { /* 书脊 */
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 7px;
  background: rgba(0,0,0,.18); border-radius: 8px 0 0 8px;
}
.book-cover::after { /* 金色书签丝带 */
  content: ""; position: absolute; right: 14px; bottom: 0; width: 12px; height: 26px;
  background: var(--gold); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 74%, 0 100%);
}
.bc-title { font-family: var(--serif); font-size: 16px; line-height: 1.3; word-break: break-all; }
.bc-sub { font-family: var(--serif); font-size: 11px; opacity: .75; margin-top: 3px; }
.bc-menu { position: absolute; left: 12px; top: 8px; font-size: 16px; opacity: .8; letter-spacing: 1px; }
.book-meta { flex: 1; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.bm-name { font-size: 16px; font-weight: 700; margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-progress-row { display: flex; align-items: baseline; gap: 6px; margin-bottom: 5px; }
.bm-progress { font-size: 13px; color: var(--ink-soft); }
.bm-progress b { color: var(--olive); font-size: 15px; }
.bm-bar { height: 5px; border-radius: 3px; background: #e2dec8; overflow: hidden; margin-bottom: 9px; }
.bm-bar i { display: block; height: 100%; background: var(--olive-soft); border-radius: 3px; transition: width .4s; }
.bm-counts { display: flex; gap: 14px; }
.bm-count { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 34px; }
.bm-count b { font-size: 15px; color: var(--ink); }
.bm-count span { font-size: 10.5px; color: var(--ink-faint); }
.bm-count.warn b { color: var(--red); }

.fab {
  position: fixed; right: max(20px, calc(50% - 240px)); bottom: 86px; width: 54px; height: 54px; border-radius: 50%;
  background: var(--olive-soft); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(70,85,47,.4); z-index: 40; font-size: 10px; line-height: 1;
}
.fab .ic { width: 20px; height: 20px; }
.fab span { margin-top: 2px; }

.empty-shelf { text-align: center; padding: 60px 30px; color: var(--ink-faint); }
.empty-shelf .big { font-size: 15px; color: var(--ink-soft); margin-bottom: 8px; }

/* ============================================================
   新建计划（BookSetup）
   ============================================================ */
.setup-page { position: fixed; inset: 0; z-index: 70; background: var(--paper); display: flex; flex-direction: column; overflow-y: auto; }
.setup-head {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px; position: sticky; top: 0;
  background: var(--paper); z-index: 5; border-bottom: 1px solid #e7e3cf;
}
.setup-head h2 { font-size: 16px; margin: 0; flex: 1; text-align: center; }
.setup-body { padding: 16px; padding-bottom: 90px; }
.sec-label { font-size: 13px; font-weight: 700; color: var(--ink-soft); margin: 18px 0 8px; }
.sec-label:first-child { margin-top: 0; }
.type-cards { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.type-card {
  border: 1.6px solid var(--olive-line); border-radius: 12px; padding: 10px 6px; text-align: center; background: var(--card-white);
}
.type-card.sel { border-color: var(--olive); background: #eef0dd; }
.type-card .t-name { font-weight: 700; font-size: 14px; color: var(--olive); margin-bottom: 4px; }
.type-card .t-desc { font-size: 10.5px; color: var(--ink-soft); line-height: 1.45; }
.type-table { width: 100%; border-collapse: collapse; font-size: 11.5px; margin-top: 10px; background: var(--card-white); border-radius: 10px; overflow: hidden; }
.type-table th, .type-table td { border: 1px solid #e6e2ce; padding: 6px 8px; text-align: left; line-height: 1.5; }
.type-table th { background: var(--paper-deep); color: var(--ink-soft); font-weight: 600; white-space: nowrap; }
.seg { display: flex; background: var(--paper-deep); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; padding: 8px 0; border-radius: 8px; font-size: 13.5px; color: var(--ink-soft); }
.seg button.sel { background: var(--card-white); color: var(--olive); font-weight: 700; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.field { display: flex; align-items: center; gap: 10px; background: var(--card-white); border: 1px solid #e6e2ce; border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.field label { font-size: 13.5px; color: var(--ink-soft); flex-shrink: 0; }
.field input, .field select { flex: 1; border: none; outline: none; background: transparent; font-size: 15px; color: var(--ink); min-width: 0; }
.field .unit { font-size: 12px; color: var(--ink-faint); }
.setup-tip { font-size: 12px; color: var(--ink-soft); line-height: 1.6; background: #efedda; border-radius: 10px; padding: 10px 12px; }
.setup-foot { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--paper) 30%); max-width: 520px; margin: 0 auto; }
.setup-foot .btn { width: 100%; padding: 13px; font-size: 16px; }
.import-area { width: 100%; min-height: 120px; border: 1.4px dashed var(--olive-line); border-radius: 12px; background: var(--card-white); padding: 12px; font-size: 14px; resize: vertical; }

/* ============================================================
   计划表页（Grid）
   ============================================================ */
.full-page { position: fixed; inset: 0; z-index: 70; display: flex; background: var(--paper); }
.grid-wrap { display: flex; width: 100%; max-width: 520px; margin: 0 auto; }
.grid-side {
  width: 96px; flex-shrink: 0; background: var(--olive-frame); color: #e9e6d5;
  display: flex; flex-direction: column; padding: 10px 0 12px;
}
.gs-back { display: flex; align-items: center; gap: 2px; padding: 8px 10px; color: #f7f4e6; font-size: 13px; }
.gs-back .ic { width: 16px; height: 16px; }
.gs-groups { flex: 1; overflow-y: auto; padding: 6px 0; }
.gs-group {
  display: block; width: 100%; text-align: center; padding: 9px 0; font-size: 13px; color: #e6e9cc;
}
.gs-group.sel { color: #fff; font-weight: 700; background: var(--olive-soft); border-radius: 8px; margin: 0 8px; width: calc(100% - 16px); }
.gs-bottom { padding: 10px 10px 0; border-top: 1px solid #ffffff22; font-size: 11px; }
.gs-adjust {
  width: 100%; border: 1px solid #ffffff55; color: #fff; border-radius: 8px; padding: 7px 0;
  font-size: 12px; margin-bottom: 10px; display: flex; align-items: center; justify-content: center; gap: 4px;
}
.gs-stat { margin-top: 10px; }
.gs-stat .lbl { color: #e6e9cc; margin-bottom: 3px; }
.gs-stat .val { font-size: 16px; font-weight: 800; color: #fff; }
.gs-bar { height: 4px; background: #ffffff2e; border-radius: 2px; margin-top: 5px; overflow: hidden; }
.gs-bar i { display: block; height: 100%; background: #e5dfa8; }
.gs-pct { font-size: 13px; color: #fff; font-weight: 700; }

.grid-main { flex: 1; overflow: auto; background: var(--paper); }
.grid-table { border-collapse: separate; border-spacing: 0 6px; min-width: 100%; padding: 12px 10px 40px; }
.grid-table th { font-size: 12px; color: var(--ink-soft); padding: 4px 6px; font-weight: 600; white-space: nowrap; }
.grid-table th .h-pill {
  background: var(--olive-frame); color: #fff; border-radius: 14px; padding: 4px 12px; font-size: 12px; display: inline-block;
}
.grid-table th:first-child .h-pill { background: var(--olive); }
.grid-table td { background: var(--card-white); text-align: center; font-size: 13px; padding: 0 5px; height: 44px; }
.grid-table td:first-child { border-radius: 10px 0 0 10px; color: var(--ink-faint); font-size: 12px; }
.grid-table td:last-child { border-radius: 0 10px 10px 0; }
.grid-table tr.today td { background: #f0eed6; }
.grid-table tr.today td.td-date { color: var(--olive); font-weight: 700; }
.td-date { color: var(--ink-soft); font-size: 12px; white-space: nowrap; }
.td-cell { padding: 0 !important; }
.cell-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 1.6px dashed var(--olive-line); color: var(--olive);
  font-size: 11.5px; display: inline-flex; align-items: center; justify-content: center; position: relative; background: transparent;
  padding: 0; line-height: 1.05;
}
.cell-btn.done { background: var(--olive-soft); border: none; color: #fff; }
.cell-btn.doing { border-style: solid; border-color: var(--olive); font-weight: 700; }
.cell-btn .dot {
  position: absolute; top: -1px; right: -1px; width: 9px; height: 9px; border-radius: 50%; background: var(--red-dot);
  border: 1.5px solid var(--card-white);
}
.cell-slash { color: #c8c5b2; }
.cell-lock { color: #d8d4bf; }
.row-done-mark { color: var(--olive); font-size: 15px; font-weight: 700; }
.free-cell-btn { border-style: solid; }
.list-name-cell { font-weight: 600; color: var(--ink); font-size: 12.5px; }

/* ============================================================
   学习页公共（列表/卡片模式共用外壳：橄榄绿顶栏 + 米黄内容）
   ============================================================ */
.study-page { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; background: var(--olive-frame); }
.study-shell { flex: 1; display: flex; flex-direction: column; max-width: 520px; margin: 0 auto; width: 100%; background: var(--paper); border-radius: 0; overflow: hidden; }
.study-top {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; flex-shrink: 0;
  background: var(--olive-frame); color: #f7f4e6;
}
.study-top .st-back { display: flex; align-items: center; }
.study-top .st-title { flex: 1; text-align: center; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.study-top .st-actions { display: flex; gap: 4px; }
.study-top .icon-btn { color: #f7f4e6; width: 32px; height: 32px; }
.study-chips {
  display: flex; gap: 6px; padding: 6px 12px 10px; overflow-x: auto; flex-shrink: 0; scrollbar-width: none;
  background: var(--olive-frame);
}
.study-chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; border: 1px solid rgba(255,255,255,.48); color: #f9f6e8; border-radius: 15px; padding: 5px 12px; font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 4px; background: rgba(255,255,255,.14);
}
.chip.on { background: var(--gold); border-color: var(--gold); color: #4a3d1c; font-weight: 700; }
.study-body { flex: 1; overflow: hidden; display: flex; background: var(--paper); position: relative; }
.study-bottom {
  flex-shrink: 0; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 12px calc(7px + env(safe-area-inset-bottom)); color: #eef0da; font-size: 12.5px; background: var(--olive-frame);
}
.study-bottom .ic { width: 14px; height: 14px; }

/* ---------- 列表模式 ---------- */
.list-layout { display: flex; width: 100%; height: 100%; }
.list-tools {
  width: 44px; flex-shrink: 0; background: var(--olive-frame); display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding-top: 8px; overflow-y: auto; scrollbar-width: none;
}
.list-tools::-webkit-scrollbar { display: none; }
.tool-btn {
  width: 36px; height: 36px; border-radius: 50%; color: #f9f6e8; display: flex; align-items: center; justify-content: center; position: relative;
  background: rgba(255,255,255,.14);
}
.tool-btn.on { background: var(--gold); color: #4a3d1c; }
.tool-btn:active { background: rgba(255,255,255,.30); }
.list-scroll { flex: 1; overflow: auto; background: var(--paper); }
.word-table { width: 100%; border-collapse: collapse; }
.word-table th {
  position: sticky; top: 0; background: var(--paper); z-index: 3; font-size: 11px; color: var(--ink-soft);
  padding: 8px 4px 6px; border-bottom: 1px solid var(--olive-line); white-space: nowrap; font-weight: 600;
}
.word-table th.rev-h { padding: 2px 2px; min-width: 26px; }
.word-table td { padding: 9px 6px; border-bottom: 1px solid #e6e2cc; font-size: 14px; vertical-align: middle; }
.td-no { color: var(--ink-faint); font-size: 11.5px; width: 26px; text-align: center; }
.td-word { min-width: 86px; }
.td-word .w { font-family: var(--serif); font-size: 15.5px; color: #4c5a33; display: inline-flex; align-items: center; gap: 5px; }
.td-word .w-ic { color: var(--olive); width: 13px; height: 13px; flex-shrink: 0; }
.td-def { color: var(--ink-soft); font-size: 12px; line-height: 1.5; min-width: 120px; }
.td-def .pos { color: var(--olive); font-style: italic; margin-right: 3px; }
.td-ipa { color: var(--ink-faint); font-size: 11.5px; white-space: nowrap; }
.rev-cell { width: 26px; text-align: center; }
.rev-dot {
  width: 17px; height: 17px; border-radius: 50%; border: 1.4px solid #c9c5ac; display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; color: #b4b099; background: transparent; padding: 0;
}
.rev-dot.s1 { background: #e4e0c4; border-color: #cbc7a8; color: #7d8f57; }
.rev-dot.s2 { background: #d9c86e66; border-color: #c0ae55; color: #8a742f; }
.rev-dot.s3 { background: #d98b8b66; border-color: #c06a6a; color: #a03c3c; }
.rev-dot.cur { border-color: var(--olive); border-width: 1.8px; color: var(--olive); }
.masked { filter: blur(7px); user-select: none; cursor: pointer; transition: filter .18s; }
.dict-input {
  width: 100%; border: none; border-bottom: 1.6px solid var(--olive-line); background: transparent; font-size: 15px;
  font-family: var(--serif); color: var(--ink); padding: 3px 2px; outline: none;
}
.dict-input.ok { color: #5b7a3a; border-color: #5b7a3a; background: #eaf0da; }
.dict-input.bad { color: var(--red); border-color: var(--red); animation: shake .25s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.dict-stats-bar {
  display: flex; gap: 14px; justify-content: center; padding: 8px; font-size: 12.5px; color: var(--ink-soft);
  background: var(--paper-deep); border-radius: 10px; margin: 8px 10px;
}
.dict-stats-bar b { color: var(--olive); }

/* ---------- 卡片模式 ---------- */
.card-mode-body { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.cm-count-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px 0; font-size: 12px; color: var(--ink-soft); }
.cm-card-area {
  flex: 1; overflow-y: auto; padding: 8px 18px 12px; display: flex; flex-direction: column; touch-action: pan-y;
}
.cm-word {
  font-family: var(--serif); font-weight: 400; text-align: center; color: #55663a;
  font-size: 42px; line-height: 1.15; margin: 10px 0 8px; word-break: break-word;
}
.cm-phon-row { display: flex; justify-content: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.phon-pill {
  display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--olive-line); border-radius: 16px;
  padding: 4px 12px; font-size: 13px; color: var(--ink-soft); background: var(--card-white); font-family: var(--serif);
}
.phon-pill .ic { width: 14px; height: 14px; color: var(--olive); }
.cm-sec { background: var(--card-white); border-radius: 14px; padding: 13px 15px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(60,70,40,.06); }
.cm-sec-title { font-size: 12.5px; font-weight: 700; color: var(--olive); margin-bottom: 8px; display: flex; align-items: center; gap: 5px; }
.cm-sec-title::before { content: ""; width: 4px; height: 13px; background: var(--olive-soft); border-radius: 2px; }
.def-line { display: flex; gap: 8px; font-size: 14px; line-height: 1.65; }
.def-line .pos { color: var(--olive); font-style: italic; flex-shrink: 0; min-width: 22px; }
.def-line + .def-line { margin-top: 3px; }
.forms-grid { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.forms-grid .frow { display: flex; gap: 10px; }
.forms-grid .fk { color: var(--ink-faint); flex-shrink: 0; width: 58px; }
.forms-grid .fv { font-family: var(--serif); color: #4c5a33; }
.cm-tabs { display: flex; gap: 4px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.cm-tabs::-webkit-scrollbar { display: none; }
.cm-tab { flex-shrink: 0; padding: 5px 11px; border-radius: 14px; font-size: 12.5px; color: var(--ink-soft); background: var(--paper-deep); }
.cm-tab.on { background: var(--olive-soft); color: #fff; font-weight: 600; }
.ex-line { font-size: 13.5px; line-height: 1.7; color: var(--ink); }
.ex-line + .ex-line { margin-top: 8px; }
.ex-line mark { background: linear-gradient(transparent 55%, #d9c86e88 55%); color: inherit; padding: 0 1px; border-radius: 2px; }
.ex-line .zh { color: var(--ink-soft); font-size: 12.5px; display: block; margin-top: 2px; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip { background: #eef0dd; color: #5b6a3c; font-size: 12px; border-radius: 8px; padding: 4px 9px; }
.cm-masked .maskable { filter: blur(8px); user-select: none; }

.cm-status-row {
  flex-shrink: 0; display: flex; gap: 10px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--paper);
}
.status-btn {
  flex: 1; padding: 12px 0; border-radius: 12px; font-size: 15.5px; font-weight: 600; color: #fff;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.status-btn.forgot { background: var(--btn-forgot); }
.status-btn.fuzzy { background: var(--btn-fuzzy); }
.status-btn.known { background: var(--olive-soft); }
.status-btn .ic { width: 16px; height: 16px; }
.cm-side-btns { flex-direction: column; height: auto; justify-content: center; width: 76px; padding: 10px 12px; }
.cm-side-btns .status-btn { flex: none; padding: 12px 0; }
.cm-side-btns .status-btn + .status-btn { margin-top: 10px; }
.cm-nav-row { display: flex; align-items: center; justify-content: space-between; padding: 0 16px 6px; }
.cm-nav { width: 40px; height: 32px; border-radius: 16px; background: var(--paper-deep); color: var(--ink-soft); display: flex; align-items: center; justify-content: center; }
.cm-nav[disabled] { opacity: .35; }
.cm-nav .ic { transform: rotate(180deg); }
.cm-nav.next .ic { transform: none; }

/* ---------- 练习模式 ---------- */
.practice-body { flex: 1; overflow-y: auto; padding: 18px 20px 110px; }
.pq-progress { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.pq-progress .bar { flex: 1; height: 6px; background: var(--paper-deep); border-radius: 3px; overflow: hidden; }
.pq-progress .bar i { display: block; height: 100%; background: var(--olive-soft); }
.pq-progress .num { font-size: 12px; color: var(--ink-soft); }
.pq-type-tag { display: inline-block; font-size: 11px; color: var(--olive); border: 1px solid var(--olive-line); border-radius: 10px; padding: 2px 8px; margin-bottom: 12px; }
.pq-stem { font-family: var(--serif); font-size: 30px; text-align: center; color: #4c5a33; margin: 14px 0 24px; word-break: break-word; }
.pq-stem-small { font-size: 16px; font-family: var(--sans); text-align: center; color: var(--ink); margin: 14px 0 20px; line-height: 1.7; }
.pq-stem-small .blank { display: inline-block; min-width: 90px; border-bottom: 1.6px solid var(--olive); margin: 0 4px; }
.pq-option {
  display: flex; align-items: center; gap: 10px; width: 100%; background: var(--card-white); border: 1.4px solid #e4e0ca;
  border-radius: 12px; padding: 13px 14px; margin-bottom: 10px; font-size: 14.5px; text-align: left; transition: all .15s;
}
.pq-option .idx { width: 22px; height: 22px; border-radius: 50%; background: var(--paper-deep); color: var(--ink-soft); font-size: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pq-option.right { border-color: #6f9c4b; background: #eaf2da; }
.pq-option.wrong { border-color: var(--red); background: #f7e4e2; }
.pq-option[disabled] { opacity: .8; }
.pq-listen-row { display: flex; justify-content: center; margin-bottom: 8px; }
.pq-listen-btn { width: 64px; height: 64px; border-radius: 50%; background: var(--olive-soft); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 10px rgba(70,85,47,.3); }
.pq-listen-btn .ic { width: 26px; height: 26px; }
.pq-blank-input {
  display: block; width: 100%; margin: 10px auto 4px; max-width: 300px; text-align: center; font-size: 18px; font-family: var(--serif);
  border: none; border-bottom: 2px solid var(--olive); background: transparent; padding: 8px; outline: none;
}
.pq-feedback { text-align: center; font-size: 13.5px; margin: 12px 0; min-height: 20px; }
.pq-feedback.ok { color: #5b7a3a; }
.pq-feedback.bad { color: var(--red); }
.practice-foot {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--paper) 40%);
}
.practice-foot .btn { width: 100%; }
.practice-done { text-align: center; padding: 50px 20px; }
.practice-done .num { font-size: 44px; font-family: var(--serif); color: var(--olive); }
.practice-done .sub { color: var(--ink-soft); margin: 8px 0 24px; }

/* ---------- 统计 Tab ---------- */
.stats-page { padding: 18px 16px 90px; }
.stat-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.stat-card { background: var(--card-white); border-radius: 14px; padding: 13px 14px; box-shadow: 0 1px 3px rgba(60,70,40,.06); }
.stat-card .sc-num { font-size: 22px; font-weight: 800; color: var(--ink); }
.stat-card .sc-num small { font-size: 12px; font-weight: 500; color: var(--ink-faint); margin-left: 2px; }
.stat-card .sc-lbl { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.panel { background: var(--card-white); border-radius: 14px; padding: 14px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(60,70,40,.06); }
.panel h3 { margin: 0 0 12px; font-size: 14.5px; display: flex; align-items: center; gap: 6px; }
.panel h3 .ic { color: var(--olive); width: 16px; height: 16px; }
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 6px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; height: 100%; justify-content: flex-end; }
.bar-pair { display: flex; gap: 3px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.bar-i { width: 8px; border-radius: 3px 3px 0 0; background: var(--olive-soft); min-height: 2px; }
.bar-i.rev { background: #d9c86e; }
.bar-x { font-size: 9px; color: var(--ink-faint); white-space: nowrap; }
.chart-legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--ink-soft); margin-top: 8px; }
.chart-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.checkin-row { display: flex; align-items: center; gap: 12px; }
.checkin-info { flex: 1; }
.checkin-info .ck-days { font-size: 15px; font-weight: 700; }
.checkin-info .ck-sub { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.checkin-btn { background: var(--olive-soft); color: #fff; border-radius: 18px; padding: 9px 18px; font-size: 14px; font-weight: 600; }
.checkin-btn[disabled] { background: var(--paper-deep); color: var(--ink-faint); }
.curve-svg { width: 100%; height: auto; }

/* ---------- 我的 Tab ---------- */
.mine-page { padding: 18px 16px 90px; }
.mine-user { display: flex; align-items: center; gap: 14px; background: var(--card-white); border-radius: 16px; padding: 16px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(60,70,40,.06); }
.mine-avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--olive-soft); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; }
.mine-name { font-size: 16.5px; font-weight: 700; }
.mine-sub { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.mine-group { background: var(--card-white); border-radius: 14px; margin-bottom: 14px; overflow: hidden; box-shadow: 0 1px 3px rgba(60,70,40,.06); }
.mine-group h4 { margin: 0; padding: 12px 15px 4px; font-size: 12px; color: var(--ink-faint); font-weight: 600; }
.mine-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 15px; font-size: 15px; text-align: left; border-bottom: 1px solid #f2efdf; }
.mine-row:last-child { border-bottom: none; }
.mine-row:active { background: var(--paper-deep); }
.mine-row .ic { color: var(--olive); flex-shrink: 0; }
.mine-row .mr-label { flex: 1; }
.mine-row .mr-val { color: var(--ink-faint); font-size: 13px; }
.mine-row .arrow { color: #d0cdb9; }
.switch { position: relative; width: 44px; height: 26px; background: #d8d4bf; border-radius: 13px; transition: background .2s; flex-shrink: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch.on { background: var(--olive-soft); }
.switch.on::after { left: 21px; }
.about-logo { text-align: center; padding: 26px 0 6px; }
.about-logo .lg { font-family: var(--serif); font-size: 26px; color: var(--olive-deep); }
.about-logo .sub { font-size: 12px; color: var(--ink-faint); margin-top: 4px; }

/* ---------- 固定词书（熟词/错词） ---------- */
.fixed-page { position: fixed; inset: 0; z-index: 70; background: var(--paper); display: flex; flex-direction: column; }
.fixed-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; background: var(--olive-frame); color: #f7f4e6; }
.fixed-head h2 { margin: 0; font-size: 16px; flex: 1; text-align: center; }
.fixed-head .icon-btn { color: #f7f4e6; }
.fixed-list { flex: 1; overflow-y: auto; padding: 12px 14px 30px; }
.fw-row { display: flex; align-items: center; gap: 10px; background: var(--card-white); border-radius: 12px; padding: 12px 14px; margin-bottom: 9px; box-shadow: 0 1px 3px rgba(60,70,40,.05); }
.fw-word { font-family: var(--serif); font-size: 16px; color: #4c5a33; flex: 1; display: flex; align-items: center; gap: 7px; }
.fw-word .ic { width: 14px; height: 14px; color: var(--olive); }
.fw-meta { font-size: 11.5px; color: var(--ink-faint); }
.fw-act { font-size: 12px; color: var(--ink-soft); border: 1px solid #e0dcc4; border-radius: 12px; padding: 4px 10px; }
.fw-act.danger { color: var(--red); border-color: #e5c2c0; }

/* ---------- 串词成文 ---------- */
.article-body { flex: 1; overflow-y: auto; padding: 16px 18px 30px; }
.article-text { background: var(--card-white); border-radius: 14px; padding: 16px; font-size: 14.5px; line-height: 1.9; margin-bottom: 12px; }
.article-text mark { background: linear-gradient(transparent 55%, #d9c86e88 55%); padding: 0 1px; }
.word-block { background: var(--card-white); border-radius: 12px; padding: 11px 14px; margin-bottom: 8px; }
.word-block .wb-w { font-family: var(--serif); font-size: 15px; color: #4c5a33; }
.word-block .wb-d { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.gen-opt-row { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }

/* ---------- 行和字号 ---------- */
.range-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; }
.range-row label { width: 76px; font-size: 13.5px; color: var(--ink-soft); flex-shrink: 0; }
.range-row input[type="range"] { flex: 1; accent-color: var(--olive-soft); }

/* ---------- 涂鸦画板 ---------- */
.doodle-canvas-wrap {
  flex: 1; position: relative; background: var(--paper); overflow: hidden;
  background-image: linear-gradient(#00000008 1px, transparent 1px), linear-gradient(90deg, #00000008 1px, transparent 1px);
  background-size: 28px 28px;
}
#ddCanvas { display: block; touch-action: none; cursor: crosshair; }
.doodle-hint {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  text-align: center; color: var(--ink-faint); font-size: 13.5px; line-height: 1.9; pointer-events: none;
}
.doodle-foot {
  flex-shrink: 0; display: flex; align-items: center; gap: 14px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--card-white); border-top: 1px solid #e7e3cf;
}
.dcolors { display: flex; gap: 10px; }
.dcolor { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; box-shadow: inset 0 0 0 2px #fff; }
.dcolor.sel { border-color: var(--olive); transform: scale(1.12); }
.dwidths { display: flex; gap: 8px; }
.dwidth {
  width: 32px; height: 32px; border-radius: 50%; background: var(--paper-deep);
  display: flex; align-items: center; justify-content: center;
}
.dwidth.sel { background: var(--olive-soft); }
.dwidth i { background: var(--ink); border-radius: 50%; display: block; }
.dwidth.sel i { background: #fff; }
.doodle-foot .hint { flex: 1; text-align: right; }

/* 横屏/宽屏适配 */
@media (min-width: 640px) {
  .grid-side { width: 150px; }
  .grid-side .gs-group { font-size: 14px; padding: 11px 0; }
  .word-table td { padding: 11px 10px; }
  #app { box-shadow: 0 0 60px rgba(0,0,0,.35); }
}
