/* ==========================================================================
   荆州初中全科AI智能刷题 · 学生端
   浅色简约主题 · 参考国家中小学智慧教育平台
   顶部横向文字导航 | 中：会话式卡片流 | 右：答题卡 + 学习进度
   ========================================================================== */

/* ---------------- 设计令牌（默认浅色） ---------------- */
:root {
  --bg: #f5f7fa;            /* 页面浅灰底 */
  --bg-soft: #eef1f6;
  --panel: #ffffff;         /* 导航/悬浮面板 */
  --card: #ffffff;          /* 卡片 */
  --card-2: #f3f5f9;        /* 嵌套底 */
  --border: #e6eaf1;
  --text-1: #222b38;        /* 主文字 */
  --text-2: #5b6675;
  --text-3: #97a1af;
  --brand: #3a7afe;         /* 主蓝（智慧教育风） */
  --brand-soft: rgba(58, 122, 254, 0.09);
  --sel: #3a7afe;           /* 选中高亮 */
  --sel-soft: rgba(58, 122, 254, 0.10);
  --ok: #2fa46c;
  --ok-soft: rgba(47, 164, 108, 0.10);
  --err: #e05a5a;
  --err-soft: rgba(224, 90, 90, 0.09);
  --warn: #d8902f;
  --warn-soft: rgba(216, 144, 47, 0.12);
  --shadow: 0 1px 4px rgba(30, 45, 70, 0.05);
  --shadow-lift: 0 6px 20px rgba(30, 45, 70, 0.12);
  --r-card: 12px;
  --r-bubble: 14px;
  --rightbar-w: 264px;
}
[data-theme='night'] {
  --bg: #1b1e24;
  --bg-soft: #20242b;
  --panel: #242830;
  --card: #2a2f38;
  --card-2: #303642;
  --border: #363c47;
  --text-1: #e9ecf1;
  --text-2: #aab3bf;
  --text-3: #7d8794;
  --brand: #5b9dd9;
  --brand-soft: rgba(91, 157, 217, 0.16);
  --sel: #6fb1e8;
  --sel-soft: rgba(111, 177, 232, 0.14);
  --ok: #62b58a;
  --ok-soft: rgba(98, 181, 138, 0.14);
  --err: #d97b7b;
  --err-soft: rgba(217, 123, 123, 0.14);
  --warn: #d9a862;
  --warn-soft: rgba(217, 168, 98, 0.14);
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
  --shadow-lift: 0 6px 20px rgba(0, 0, 0, 0.30);
}

/* ---------------- 基础 ---------------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text-1);
  font-family: 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.scroll-locked { position: fixed; left: 0; right: 0; overflow: hidden; }
button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
.hidden { display: none !important; }
.grow { flex: 1; }
.center { text-align: center; }
.muted { color: var(--text-2); font-size: 14px; }
.muted-sm { color: var(--text-3); font-size: 12.5px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 顶部主导航 ---------------- */
#topnav {
  position: sticky; top: 0; z-index: 50;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.tn-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
}
.tn-main { height: 54px; }
.tn-pagebar { height: 42px; border-top: 1px solid var(--border); }
.tn-logo {
  font-size: 17px; font-weight: 700; color: var(--brand);
  letter-spacing: 1px; flex: 0 1 auto;
  max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#tn-nav { display: none; align-items: center; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; }
body.authed #tn-nav { display: flex; }
.tn-item {
  flex: 0 0 auto;
  border: none; background: transparent;
  padding: 7px 14px; border-radius: 8px;
  color: var(--text-2); font-size: 14.5px;
  position: relative;
  transition: background .15s, color .15s;
}
.tn-item:hover { background: var(--card-2); color: var(--text-1); }
.tn-item.active { background: var(--sel-soft); color: var(--brand); font-weight: 600; }
.tn-badge {
  min-width: 17px; height: 17px; padding: 0 5px;
  border-radius: 9px; background: var(--err); color: #fff;
  font-size: 10.5px; line-height: 17px; text-align: center;
  display: inline-block; margin-left: 5px; vertical-align: 1px;
}
.tn-points { flex: 0 0 auto; font-size: 13.5px; font-weight: 600; color: var(--warn); display: none; }
body.authed .tn-points { display: inline-block; }
.tb-left { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; }
#tb-title { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }

#shell { display: flex; align-items: stretch; min-height: calc(100vh - 96px); }
#topnav .icon-btn { width: 30px; height: 30px; flex: 0 0 30px; border: none; border-radius: 8px; background: transparent; color: var(--text-1); font-size: 20px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
#topnav .icon-btn:hover { background: var(--card-2); }
/* 二级页顶栏返回按钮：带文字更醒目（所有二级页共用）；特异性需压过 #topnav .icon-btn */
#topnav #btn-back { width: auto; flex: 0 0 auto; height: 30px; padding: 0 12px; font-size: 13.5px; gap: 2px; border: 1px solid var(--border); background: var(--panel); color: var(--text-1); font-weight: 600; }
#topnav #btn-back:hover { background: var(--card-2); }

/* 主内容滚动区 */
#view {
  flex: 1;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 16px 20px 48px;
}

/* 右侧悬浮面板 */
#rightbar {
  width: var(--rightbar-w);
  flex: 0 0 var(--rightbar-w);
  position: sticky;
  top: 96px;
  height: calc(100vh - 96px);
  overflow-y: auto;
  padding: 16px 14px 24px 4px;
  display: none;
}
body.authed #rightbar { display: block; }
.rightcard {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
}
.rightcard h3 { font-size: 13.5px; color: var(--text-2); font-weight: 600; margin-bottom: 10px; }

/* 答题卡格子 */
.ansgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.ag-cell {
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  transition: transform .1s;
}
.ag-cell:active { transform: scale(0.94); }
.ag-cell.cur { background: var(--sel-soft); border-color: var(--sel); color: var(--sel); }
.ag-cell.done { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.ag-cell.bad { background: var(--err-soft); border-color: transparent; color: var(--err); }
.ansgrid-legend { display: flex; gap: 12px; margin-top: 10px; font-size: 11.5px; color: var(--text-3); }
.ansgrid-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

/* 窄屏底部 tab（纯文字） */
#tabbar {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: var(--panel);
  border-top: 1px solid var(--border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tab {
  flex: 1; border: none; background: transparent;
  display: flex; flex-direction: column; align-items: center;
  color: var(--text-3); font-size: 15.5px; padding: 13px 0;
  position: relative;
}
.tab.active { color: var(--brand); font-weight: 600; }
.dot {
  position: absolute; top: 4px; right: calc(50% - 24px);
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--err); color: #fff;
  font-size: 10px; line-height: 16px; text-align: center;
}

/* ---------------- 通用卡片 ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.card.tight { padding: 12px 14px; }
.card.center { text-align: center; }
.card h2 { font-size: 15.5px; margin-bottom: 10px; }
.card-row { display: flex; align-items: center; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.stat { background: var(--card-2); border-radius: 10px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 18px; }
.stat span { font-size: 12px; color: var(--text-3); }
.stat.ok b { color: var(--ok); }
.stat.err b { color: var(--err); }
.stat.warn b { color: var(--warn); }

.progress { height: 7px; border-radius: 4px; background: var(--card-2); overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; background: var(--brand); border-radius: 4px; transition: width .3s; }
.progress.ok i { background: var(--ok); }

.tag {
  display: inline-block; padding: 2px 9px;
  border-radius: 999px;
  background: var(--brand-soft); color: var(--brand);
  font-size: 12px; white-space: nowrap;
}
.tag.gray { background: var(--card-2); color: var(--text-3); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.err { background: var(--err-soft); color: var(--err); }

/* 按钮：主按钮实心蓝，次按钮轻量描边 */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 42px; padding: 8px 20px;
  border: none; border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-size: 15px; font-weight: 600;
  white-space: nowrap;
  transition: filter .15s, opacity .15s;
}
[data-theme='night'] .btn { color: #16202b; }
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.ok { background: var(--ok); }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text-2); }
.btn.ghost:hover { background: var(--card-2); color: var(--text-1); filter: none; }
.btn.outline { background: transparent; border: 1px solid var(--brand); color: var(--brand); }
.btn.outline:hover { background: var(--sel-soft); filter: none; }
.btn.sm { min-height: 32px; padding: 4px 12px; font-size: 13px; border-radius: 8px; }
.feedback-btn { border: none; background: transparent; color: var(--text-3); font-size: 12.5px; padding: 4px 8px; }
.feedback-btn:hover { color: var(--brand); }

/* 选择行 */
.selrow {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.selrow:last-child { border-bottom: none; }
.selrow .k { color: var(--text-2); font-size: 14px; flex: 0 0 auto; }
.selrow .v { flex: 1; text-align: right; font-size: 14px; }
.selrow .v.ph { color: var(--text-3); }
.selrow .arrow { color: var(--text-3); }

.hscroll { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 6px; }
.pill {
  flex: 0 0 auto;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text-2);
  font-size: 13.5px;
}
.pill.active { background: var(--sel-soft); border-color: var(--sel); color: var(--sel); font-weight: 600; }
.pill.blocked { opacity: 0.4; cursor: not-allowed; }

/* 家长绑定：绑定码展示块 */
.bind-code-box { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.bind-code {
  display: inline-block;
  padding: 8px 20px;
  margin-bottom: 6px;
  border-radius: 10px;
  background: var(--sel-soft);
  color: var(--sel);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 6px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}

.optlist { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.opt {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text-1);
  font-size: 14px;
  text-align: left;
}
.opt.active { background: var(--sel-soft); border-color: var(--sel); color: var(--sel); font-weight: 600; }
.opt.locked { opacity: 0.85; cursor: default; }

.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border); background: var(--card-2); color: var(--text-1); font-size: 15px; }
.stepper span { min-width: 22px; text-align: center; font-weight: 600; }

.blank-input {
  width: 100%;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-1);
  padding: 10px 12px;
  font-size: 14.5px;
  margin-bottom: 8px;
}
.blank-input:focus { outline: none; border-color: var(--sel); }
textarea.blank-input { min-height: 96px; resize: vertical; }

/* 空状态 */
.empty { text-align: center; padding: 36px 12px; color: var(--text-2); }
.empty .big { font-size: 44px; display: block; margin-bottom: 8px; }

/* 列表项 */
.list-item { padding: 12px 4px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: none; }
.li-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.li-stem { font-size: 14px; }
/* 积分兑换：折叠式选项 */
.shop-fold { border-bottom: 1px solid var(--border); }
.shop-fold:last-child { border-bottom: none; }
.shop-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 4px; cursor: pointer; }
.shop-head:active { background: var(--bg-soft); }
.sh-right { display: flex; align-items: center; gap: 8px; }
.sh-arrow { color: var(--text-3); font-size: 12.5px; white-space: nowrap; }
.shop-body { padding: 2px 4px 14px; }
/* 首页时间显示 */
.home-clock { color: var(--text-2); font-size: 13.5px; font-weight: 500; letter-spacing: 0.3px; }
.home-logout { width: 100%; margin-top: 12px; color: var(--err); }
.ledger-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.ledger-item:last-child { border-bottom: none; }
.amt.in { color: var(--ok); font-weight: 600; }
.amt.out { color: var(--err); font-weight: 600; }

.badge-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.badge-card { background: var(--card-2); border-radius: 12px; padding: 12px 6px; text-align: center; cursor: pointer; }
.badge-card.locked { opacity: 0.45; filter: grayscale(0.6); }
.badge-card .bi { font-size: 26px; display: block; }
.badge-card .bn { font-size: 12px; margin-top: 4px; }
.badge-card .bd { font-size: 11px; color: var(--text-3); }

.chart-wrap { background: var(--card-2); border-radius: 10px; padding: 10px 6px 4px; }
.chart-wrap svg { width: 100%; height: auto; display: block; }

.me-avatar {
  width: 52px; height: 52px; flex: 0 0 52px;
  border-radius: 50%;
  background: var(--sel-soft); color: var(--brand);
  font-size: 22px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* 骨架屏 */
.skeleton-wrap { padding: 4px 0; }
.skeleton { height: 84px; border-radius: var(--r-card); background: linear-gradient(100deg, var(--card) 40%, var(--card-2) 50%, var(--card) 60%); background-size: 200% 100%; animation: sk 1.2s infinite; margin-bottom: 14px; border: 1px solid var(--border); }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------------- 会话式刷题流 ---------------- */
.chat-stream { display: flex; flex-direction: column; gap: 14px; }
.chat-day {
  align-self: center;
  font-size: 12px; color: var(--text-3);
  background: var(--card-2);
  padding: 3px 14px; border-radius: 999px;
  margin: 4px 0;
}
.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg.me { flex-direction: row-reverse; justify-content: flex-start; }
/* 无头像后：题目卡片水平居中、最大宽度限死，宽屏不留大白边 */
.msg-body { width: 100%; max-width: 720px; min-width: 0; margin: 0 auto; }
.msg.me .msg-body { width: auto; max-width: 80%; margin: 0 0 0 auto; }

/* 题目消息卡片（圆角） */
.qcard {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}
.qmeta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.qmeta .muted-sm { margin-left: auto; }
.qstem { font-size: 15.5px; line-height: 1.75; margin-bottom: 10px; white-space: pre-wrap; word-break: break-word; }

/* 选项：聊天气泡 */
.opt-bubble {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: var(--r-bubble);
  border-top-left-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  font-size: 14.5px;
  transition: background .12s, border-color .12s;
  max-width: 92%;
}
.opt-bubble:hover { background: var(--sel-soft); }
.opt-bubble .key {
  flex: 0 0 22px; height: 22px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 12.5px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
}
.opt-bubble .txt { flex: 1; word-break: break-word; }
.opt-bubble.sel { background: var(--sel-soft); border-color: var(--sel); }
.opt-bubble.sel .key { background: var(--sel); border-color: var(--sel); color: #fff; }
.opt-bubble.right { background: var(--ok-soft); border-color: var(--ok); }
.opt-bubble.right .key { background: var(--ok); border-color: var(--ok); color: #fff; }
.opt-bubble.wrong { background: var(--err-soft); border-color: var(--err); }
.opt-bubble.wrong .key { background: var(--err); border-color: var(--err); color: #fff; }
.opt-bubble.locked { cursor: default; }

/* 我方答案气泡 */
.myans {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: var(--r-bubble);
  border-top-right-radius: 6px;
  padding: 8px 14px;
  font-size: 14px;
  color: var(--text-1);
  max-width: 70%;
  margin-left: auto;
}
.myans.ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.myans.bad { background: var(--err-soft); border-color: var(--err); color: var(--err); }

/* 答题区与题干/配图保持呼吸距离 */
.q-opts { margin-top: 26px; }
.qstem { margin-bottom: 2px; }

/* 题目配图（折叠交互与解析一致） */
.figbox { background: var(--card-2); border-radius: 12px; padding: 12px 14px; margin-top: 10px; }
.figbox h4 { font-size: 13.5px; margin-bottom: 0; }
.fig-body { margin-top: 8px; }
.fig-body svg { display: block; width: 100%; height: auto; background: #fff; border-radius: 8px; border: 1px solid var(--border); }
.fig-note { font-size: 11.5px; color: var(--text-3); margin-top: 6px; text-align: center; }

/* 解析块（可折叠：结果行 + 查看解析开关） */
.explain { background: var(--card-2); border-radius: 12px; padding: 12px 14px; margin-top: 10px; }
.ex-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.explain h4 { font-size: 13.5px; margin-bottom: 0; }
.ex-toggle {
  flex: 0 0 auto; border: 1px solid var(--border); background: var(--card);
  color: var(--brand); font-size: 12.5px; font-weight: 600;
  padding: 5px 12px; border-radius: 999px; cursor: pointer;
}
.ex-toggle:hover { background: var(--sel-soft); }
.ex-body.hidden { display: none; }
.ex-body { margin-top: 8px; }
.explain .ans { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.explain .ans.my { color: var(--text-2); font-weight: 500; }
.explain .ana { font-size: 13.5px; color: var(--text-2); white-space: pre-wrap; }
.ai-hit { font-size: 12.5px; color: var(--ok); margin-top: 4px; }
.ai-miss { font-size: 12.5px; color: var(--err); margin-top: 4px; }

/* 刷题顶部实时条 */
.quiz-top { margin-bottom: 12px; }
.quiz-live {
  display: flex; gap: 8px; justify-content: space-between;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 10px 16px;
}
.quiz-live .li { font-size: 12.5px; color: var(--text-3); }
.quiz-live .li b { color: var(--text-1); font-size: 14px; }

/* 会话流底部操作条：上一题 / 提交 / 下一题（无底板，按钮裸放） */
.quiz-actions {
  display: flex; gap: 10px; align-items: center;
  position: sticky; bottom: 12px;
  padding: 4px 0 0;
}
.quiz-actions .btn { flex: 1; min-height: 44px; padding-left: 8px; padding-right: 8px; font-size: 14.5px; }
.quiz-actions .btn.ghost { background: var(--card); }

/* ---------------- 弹层 ---------------- */
.sheet-mask, .modal-mask {
  position: fixed; inset: 0;
  background: rgba(20, 28, 40, 0.45);
  opacity: 0; transition: opacity .2s;
  z-index: 100;
}
.modal-mask { z-index: 110; }
.sheet-mask.show, .modal-mask.show { opacity: 1; }
.sheet, .modal, .alert-modal {
  position: fixed; left: 50%; transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--border);
  z-index: 101;
}
.sheet {
  bottom: 0; width: 100%; max-width: 640px;
  border-radius: 18px 18px 0 0;
  max-height: 82vh; display: flex; flex-direction: column;
  transform: translate(-50%, 105%);
  transition: transform .24s;
  box-shadow: var(--shadow-lift);
}
.sheet.show { transform: translate(-50%, 0); }
.sheet-grab { width: 40px; height: 4px; border-radius: 2px; background: var(--border); margin: 8px auto 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; }
.sheet-head h3 { font-size: 15px; }
.sheet-body { padding: 4px 16px 20px; overflow-y: auto; overscroll-behavior: contain; }
.sheet-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
.sheet-foot .btn { width: 100%; }

.modal, .alert-modal {
  top: 50%; transform: translate(-50%, -50%);
  width: min(92vw, 460px);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-lift);
  z-index: 111;
}
#modal-root, #alert-root { display: none; }
#modal-root.show, #alert-root.show { display: block; }
.mbody { padding: 14px 18px; max-height: 60vh; overflow-y: auto; overscroll-behavior: contain; white-space: pre-wrap; }
.mfoot { display: flex; gap: 10px; padding: 0 18px 16px; }
.mfoot .btn { flex: 1; }
.alert-modal .ac { padding: 14px 18px; max-height: 60vh; overflow-y: auto; overscroll-behavior: contain; white-space: pre-wrap; font-size: 13.5px; color: var(--text-2); }

/* 轻提示：屏幕居中、纯文字（无背景/边框/阴影），类型只体现在字色 */
#toast-root { position: fixed; top: 46%; left: 50%; transform: translate(-50%, -50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  max-width: 80vw;
}
.toast.ok { color: var(--ok); }
.toast.err { color: var(--err); }
.toast.warn { color: var(--warn); }
/* 出题等待等长任务提示：同为纯文字，仅字号加大 */
.toast.big {
  position: fixed;
  top: 46%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 260;
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
  animation: toast-big-in .18s ease-out;
}
@keyframes toast-big-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 离线条 */
#offline-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 300;
  background: var(--warn); color: #fff;
  font-size: 12.5px; text-align: center; padding: 4px;
}

/* ---------------- 响应式：窄屏回退为手机布局 ---------------- */
@media (max-width: 1023px) {
  #shell { display: block; min-height: 0; }
  body.authed #tn-nav, body.authed .tn-points { display: none; }
  body.authed #rightbar { display: none; }
  body.authed #tabbar { display: flex; }
  /* 8 个 tab（加了背单词）在窄屏要收一点字号才放得下 */
  body.authed #tabbar .tab { font-size: 13.5px; padding: 11px 0; letter-spacing: -0.2px; }
  /* 注意：body 的 padding-bottom 不计入文档滚动高度（浏览器怪癖），
     预留空间必须放在 #view 自身 padding 上，否则最后的内容仍会被底部导航盖住 */
  body.authed #view { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  /* 吸底操作条要让出底部 tab 导航的高度，否则被盖住显示不完整 */
  body.authed .quiz-actions { bottom: calc(64px + env(safe-area-inset-bottom)); }
  .tn-inner { padding: 0 14px; }
  .tn-main { height: 48px; }
  /* 窄屏导航收到屏幕底部，顶栏整行留给标题并居中显示 */
  .tn-logo { flex: 1 1 auto; max-width: none; text-align: center; font-size: 16.5px; padding: 0 4px; }
  .tn-pagebar { height: 40px; }
  #view { padding: 12px 14px 24px; }
  .optlist { grid-template-columns: 1fr 1fr; }
  .badge-grid { grid-template-columns: repeat(3, 1fr); }
  .msg-body { max-width: 100%; }
}
@media (max-width: 480px) {
  .grid3 { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .stat b { font-size: 15px; }
  .optlist { grid-template-columns: 1fr; }
}

/* ==========================================================================
   登录 / 注册页（现代教育风：柔和渐变底 + 品牌区 + 分段切换 + 圆角输入）
   ========================================================================== */
body.gate {
  background:
    radial-gradient(760px 420px at 8% -12%, #dbe9ff 0%, rgba(219, 233, 255, 0) 62%),
    radial-gradient(680px 380px at 96% 4%, #e2e6ff 0%, rgba(226, 230, 255, 0) 58%),
    radial-gradient(720px 420px at 50% 108%, #dff1f6 0%, rgba(223, 241, 246, 0) 60%),
    linear-gradient(180deg, #f7f9fd 0%, #eef3fb 100%);
  background-attachment: fixed;
}
[data-theme='night'] body.gate {
  background:
    radial-gradient(760px 420px at 8% -12%, rgba(91, 157, 217, 0.16) 0%, rgba(91, 157, 217, 0) 62%),
    radial-gradient(680px 380px at 96% 4%, rgba(129, 140, 248, 0.14) 0%, rgba(129, 140, 248, 0) 58%),
    linear-gradient(180deg, #1b1e24 0%, #171a20 100%);
}
body.gate #shell { display: block; min-height: 0; }
body.gate #view {
  max-width: 440px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 40px 22px 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
body.gate #rightbar { display: none; }
body.gate #topnav { display: none; }

.gate-hero { text-align: center; margin-bottom: 22px; }
.gate-logo {
  width: 62px; height: 62px; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 19px;
  background: linear-gradient(135deg, #3a7afe 0%, #5b8dff 55%, #6fc9e0 100%);
  box-shadow: 0 12px 26px rgba(58, 122, 254, 0.30);
}
.gate-name { font-size: 19px; font-weight: 700; letter-spacing: 0.4px; color: var(--text-1); }
.gate-slogan { font-size: 13px; color: var(--text-3); margin-top: 5px; }

.gate-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px 18px 16px;
  box-shadow: 0 18px 44px rgba(31, 54, 94, 0.10), 0 2px 8px rgba(31, 54, 94, 0.04);
}
[data-theme='night'] .gate-card { box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34); }

.gate-seg {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--card-2);
  border-radius: 13px; padding: 4px; margin-bottom: 18px;
}
.gate-seg-btn {
  border: none; background: transparent; cursor: pointer;
  padding: 9px 0; border-radius: 10px;
  font-size: 14.5px; font-weight: 600; color: var(--text-2);
  transition: background .18s, color .18s, box-shadow .18s;
}
.gate-seg-btn.on { background: var(--card); color: var(--brand); box-shadow: 0 2px 8px rgba(31, 54, 94, 0.10); }
[data-theme='night'] .gate-seg-btn.on { background: #343b47; color: var(--brand); }

.gate-field { margin-bottom: 13px; }
.gate-field > label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.gate-label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.gate-input-wrap { position: relative; display: flex; align-items: center; }
.gate-input {
  width: 100%; height: 46px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--card-2); color: var(--text-1);
  font-size: 15px; font-family: inherit;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.gate-input::placeholder { color: var(--text-3); }
.gate-input:focus { outline: none; border-color: var(--brand); background: var(--card); box-shadow: 0 0 0 4px var(--brand-soft); }
.gate-input-wrap:has(.gate-eye) .gate-input { padding-right: 62px; }
.gate-eye {
  position: absolute; right: 7px;
  border: none; background: transparent; cursor: pointer;
  color: var(--text-2); font-size: 12.5px; padding: 6px 9px; border-radius: 8px;
}
.gate-eye:hover { color: var(--brand); background: var(--brand-soft); }

.gate-grade { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gate-pill {
  padding: 10px 0; text-align: center; cursor: pointer;
  border: 1px solid var(--border); border-radius: 11px;
  background: var(--card-2); color: var(--text-1);
  font-size: 14px; font-family: inherit;
  transition: border-color .16s, background .16s, color .16s;
}
.gate-pill.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600; }

.gate-agree {
  display: flex; align-items: flex-start; gap: 9px;
  margin: 14px 0 2px; font-size: 13px; line-height: 1.55; color: var(--text-2); cursor: pointer;
}
.gate-agree input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--brand); flex: 0 0 17px; }

.gate-err { color: var(--err); font-size: 13px; margin-top: 10px; }
.gate-err:not(:empty) { background: var(--err-soft); border-radius: 10px; padding: 8px 11px; }

.gate-submit {
  width: 100%; height: 48px; margin-top: 14px;
  border: none; border-radius: 13px; cursor: pointer;
  background: linear-gradient(135deg, #3a7afe 0%, #5b8dff 100%);
  color: #fff; font-size: 16px; font-weight: 600; font-family: inherit;
  box-shadow: 0 10px 22px rgba(58, 122, 254, 0.28);
  transition: filter .16s, transform .12s, box-shadow .16s;
}
.gate-submit:hover { filter: brightness(1.06); }
.gate-submit:active { transform: translateY(1px); }
.gate-submit:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; filter: grayscale(0.15); }

.gate-links { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; }
.gate-link { border: none; background: transparent; cursor: pointer; color: var(--text-3); font-size: 13px; font-family: inherit; padding: 6px 2px; }
.gate-link:hover { color: var(--brand); }
.gate-note { text-align: center; color: var(--text-3); font-size: 13px; margin-top: 14px; }

@media (max-height: 720px) {
  body.gate #view { justify-content: flex-start; padding-top: 28px; }
}

/* ---------------- 视频课堂（国家平台风格 · 站内播放） ---------------- */
/* 推荐卡已按用户要求移除（2026-09-21 晚） */

/* ---- 视频课堂 · Windows 11 风格纵向逐级面板 ---- */
.vid-pgtitle { margin: 2px 0 12px; }
.vid-pgtitle-t { font-size: 22px; font-weight: 700; color: var(--text-1); }
.vid-pgtitle-s { font-size: 12.5px; color: var(--text-3); margin-top: 3px; }

.w11-panel { padding: 10px; margin-bottom: 12px; }
.w11-grouptitle { font-size: 12.5px; font-weight: 600; color: var(--text-3); padding: 8px 12px 6px; }
.w11-list { display: flex; flex-direction: column; gap: 2px; }

/* 下拉式菜单：点开选、选中即收回 */
.w11-dd { margin: 2px 0 4px; }
.w11-dd-head {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 1px solid var(--border); background: var(--card); border-radius: 8px;
  padding: 10px 14px; cursor: pointer; font-family: inherit; font-size: 14px;
  color: var(--text-1); text-align: left; transition: border-color 0.12s, box-shadow 0.12s;
}
.w11-dd-head:hover, .w11-dd-head.open { border-color: var(--brand); }
.w11-dd-head.open { box-shadow: inset 0 -2px 0 var(--brand); }
.w11-dd-val { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.w11-dd-val.ph { color: var(--text-3); font-weight: 400; }
.w11-dd-head .w11-chev::before { transform: rotate(90deg); }
.w11-dd-head.open .w11-chev::before { transform: rotate(270deg); }
.w11-dd-list {
  display: flex; flex-direction: column; gap: 2px; margin-top: 6px; padding: 6px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--card);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.10);
}
.w11-item {
  position: relative; display: flex; align-items: center; gap: 8px; width: 100%;
  border: 0; background: transparent; border-radius: 8px; padding: 10px 14px;
  cursor: pointer; font-family: inherit; font-size: 14px; color: var(--text-1);
  text-align: left; transition: background 0.1s;
}
.w11-item:hover { background: rgba(0, 0, 0, 0.05); }
.w11-item.on { background: var(--brand-soft); font-weight: 600; }
.w11-item.on::before {
  content: ''; position: absolute; left: 4px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 16px; border-radius: 2px; background: var(--brand);
}
.w11-item-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w11-item-meta { font-size: 12px; color: var(--text-3); flex-shrink: 0; font-weight: 400; }
.w11-chev { width: 14px; height: 14px; flex-shrink: 0; position: relative; }
.w11-chev::before {
  content: '›'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 15px; transform: rotate(90deg); transition: transform 0.15s;
}
.w11-item.open .w11-chev::before { transform: rotate(270deg); }
/* 缩进用 padding-left（不用 margin：width:100% + margin 会撑出容器） */
.w11-item.lvl1 { padding-left: 36px; }
.w11-item.lvl2 { padding-left: 58px; }
.w11-item.vid-lesson { font-weight: 400; }
.w11-item.vid-lesson .lesson-title { flex: 1; min-width: 0; font-size: 13.5px; color: var(--text-1); line-height: 1.45; }
.w11-item.vid-lesson .lesson-go { font-size: 12px; color: var(--brand); background: var(--brand-soft); border-radius: 999px; padding: 3px 12px; flex-shrink: 0; }
.vid-all { display: block; margin: 4px auto 0; }

/* 站内播放层 */
.vid-player {
  position: fixed; inset: 0; z-index: 220; background: rgba(8, 12, 20, 0.96);
  display: flex; flex-direction: column; padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
}
.vp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #fff; flex-shrink: 0; }
.vp-title { font-size: 14.5px; font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vp-close {
  border: 1px solid rgba(255, 255, 255, 0.3); background: transparent; color: #fff;
  font-size: 12.5px; padding: 6px 14px; border-radius: 999px; cursor: pointer; flex-shrink: 0; font-family: inherit;
}
.vp-close:hover { background: rgba(255, 255, 255, 0.12); }
.vp-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; margin: 10px 0; }
.vp-stage video {
  width: 100%; max-width: 1100px; max-height: 100%; background: #000; border-radius: 10px;
  aspect-ratio: 16 / 9; height: auto; object-fit: contain;
}
.vp-tip { text-align: center; color: rgba(255, 255, 255, 0.45); font-size: 11.5px; flex-shrink: 0; }
.vp-foot { display: flex; justify-content: center; flex-shrink: 0; margin-bottom: 8px; min-height: 0; }
.vp-quals { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.vp-qual {
  border: 1px solid rgba(255, 255, 255, 0.28); background: transparent; color: rgba(255, 255, 255, 0.82);
  font-size: 12px; padding: 5px 13px; border-radius: 999px; cursor: pointer; font-family: inherit;
}
.vp-qual:hover { background: rgba(255, 255, 255, 0.12); }
.vp-qual.on { background: #fff; border-color: #fff; color: #0f172a; font-weight: 500; }


/* ======================== 背单词 ======================== */
.w-hero { display: flex; align-items: center; gap: 14px; }
.w-hero-ico { font-size: 34px; line-height: 1; }
.w-hero-main { flex: 1; min-width: 0; }
.w-hero-main b { font-size: 16px; display: block; }
.w-hero-main span { font-size: 12.5px; color: var(--text-3); }
/* 今日任务双按钮：主文字 + 小字副行（副行放按钮内部下方，避免括号文案撑破布局） */
.w-actions { display: flex; gap: 10px; margin-top: 12px; }
.w-act { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 6px; line-height: 1.25; }
/* 复习按钮上的「待复习」红角标（仿微信未读消息）：右上角红圆点 + 数量 */
.w-badge-dot { position: absolute; top: 4px; right: 10px; min-width: 18px; height: 18px; padding: 0 5px; background: var(--err); color: #fff; border-radius: 9px; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--card); }
.w-act .t { font-size: 15px; font-weight: 600; }
.w-act .sub { font-size: 11px; font-weight: 400; opacity: .72; }
.w-act:disabled .sub { opacity: .55; }

.wcard { text-align: center; padding: 26px 16px 20px; }
/* 单词一律单行显示：字号由 JS 按长度自适应（见 wordsview.js fitSize），长词缩小不转行 */
.wcard .w-word { font-size: 34px; font-weight: 700; color: var(--text-1); letter-spacing: .5px; white-space: nowrap; display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.wcard .w-ph { font-size: 14.5px; color: var(--text-3); margin-top: 4px; }
.wcard .w-pos { font-size: 13px; color: var(--brand); margin-top: 2px; font-style: italic; }
.wcard .w-meaning { font-size: 17px; margin-top: 10px; font-weight: 600; }
.wcard .w-example { margin-top: 14px; padding: 10px 12px; background: var(--card-2); border-radius: 10px; font-size: 13.5px; }
.wcard .w-example .en { color: var(--text-1); }
.wcard .w-example .zh { color: var(--text-3); font-size: 12.5px; margin-top: 2px; }
.w-speak { border: none; background: transparent; color: var(--brand); width: 1em; height: 1em; font-size: 1em; line-height: 1; padding: 0; margin-left: .22em; cursor: pointer; vertical-align: -0.14em; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; box-sizing: content-box; }
.w-speak:active { opacity: .55; }
.w-speak svg { width: 1em; height: 1em; display: block; }
.w-self { display: flex; gap: 10px; margin-top: 18px; }
.w-self .btn { flex: 1; }
.w-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.w-option { border: 1.5px solid var(--border); background: var(--panel); border-radius: 12px; padding: 13px 8px; font-size: 14.5px; color: var(--text-1); text-align: center; cursor: pointer; word-break: break-all; }
.w-option.picked-ok { border-color: var(--ok); background: var(--ok-soft, #e6f6ec); }
.w-option.picked-bad { border-color: var(--err); background: var(--err-soft, #fdeaea); }
.w-option:disabled { cursor: default; opacity: .85; }
.w-spell-row { display: flex; gap: 8px; margin-top: 16px; }
.w-spell-row input { flex: 1; font-size: 16.5px; text-align: center; letter-spacing: 1px; padding: 11px 10px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--panel); color: var(--text-1); }
.w-spell-row input:focus { outline: none; border-color: var(--brand); }
.w-feedback { margin-top: 14px; border-radius: 10px; padding: 10px 12px; font-size: 13.5px; text-align: left; }
.w-feedback.ok { background: #e6f6ec; color: #157a3e; }
.w-feedback.bad { background: #fdeaea; color: #b3362d; }
.w-progress-line { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 12.5px; color: var(--text-3); }
/* 闯关顶部行：返回按钮左上角 + 进度文字 + 步骤点 */
.w-topline { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12.5px; color: var(--text-3); }
.w-topline .w-exit { flex: 0 0 auto; border: none; background: none; padding: 2px 4px; font-size: 13.5px; color: var(--text-2); cursor: pointer; font-weight: 600; }
.w-topline .w-where { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 默写提示模块 */
.w-hint-row { margin-top: 10px; display: flex; justify-content: center; }
.w-hint { min-height: 0; }
.w-hint-mask { margin-top: 8px; font-size: 20px; letter-spacing: 3px; color: var(--brand); font-weight: 600; white-space: nowrap; display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
/* 单词挖空：字母格逐格输入（提示字母固定显示，空格点击后直接打字，填满自动判分） */
.w-slots { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 7px; margin: 16px 0 6px; cursor: text; }

/* 学习难度模块：词库多选 chips + 教材章节手风琴（自定义控件） */
.w-libs { display: flex; flex-wrap: wrap; gap: 8px; }
.w-lib-chip { border: 1px solid var(--border); background: var(--panel); color: var(--text-2); border-radius: 999px; padding: 8px 15px; font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 3px; }
.w-lib-chip span { font-size: 12px; opacity: .75; }
.w-lib-chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.w-lib-chip.dis { opacity: .5; }
.w-lib-chip.sm { padding: 5px 11px; font-size: 12.5px; }
.w-term-list { margin-top: 4px; }
.w-term-row { display: flex; justify-content: space-between; align-items: center; padding: 11px 4px; border-bottom: 1px solid var(--border); font-size: 14.5px; color: var(--text-1); cursor: pointer; }
.w-term-row.sub { padding-left: 16px; font-size: 13.5px; color: var(--text-2); }
.w-caret { color: var(--text-3); font-style: normal; transition: transform .15s; display: inline-block; }
.w-caret.open { transform: rotate(90deg); }
.w-unit-row { display: flex; justify-content: space-between; gap: 8px; padding: 9px 4px 9px 30px; border-bottom: 1px dashed var(--border); font-size: 13px; color: var(--text-2); cursor: pointer; }
.w-unit-row.on { color: var(--brand); font-weight: 600; }
/* 自定义下拉（词库/主题选择）：不用安卓原生 select，风格与工具一致 */
.w-sel { position: relative; }
.w-sel-trigger { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--card-2); border: 1px solid var(--border); border-radius: 10px; padding: 11px 13px; font-size: 15px; color: var(--text-1); cursor: pointer; text-align: left; }
.w-sel-trigger.ph .w-sel-val { color: var(--text-3); }
.w-sel-trigger.open { border-color: var(--brand); }
.w-sel-val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-sel-caret { font-style: normal; color: var(--text-3); font-size: 12px; transition: transform .15s; }
.w-sel-caret.open { transform: rotate(180deg); }
.w-sel-panel { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30; background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 26px rgba(0, 0, 0, .14); padding: 6px; max-height: 62vh; overflow-y: auto; }
.w-sel-opt { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; border-radius: 9px; padding: 11px 10px; font-size: 14.5px; color: var(--text-1); cursor: pointer; text-align: left; }
.w-sel-opt:active { background: var(--card-2); }
.w-sel-opt.on { background: var(--card-2); color: var(--brand); font-weight: 600; }
.w-sel-opt.dis { opacity: .45; }
/* 面板内的层级：年级(group) → 册次(sub) → 单元(sub2) */
.w-sel-opt.group { font-weight: 600; }
.w-sel-opt.sub { padding-left: 22px; font-size: 14px; color: var(--text-2); }
.w-sel-opt.sub2 { padding-left: 34px; font-size: 13.5px; color: var(--text-2); }
.w-sel-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-sel-hint { font-size: 12px; color: var(--text-3); }
.w-sel-tick { font-style: normal; color: var(--brand); width: 14px; text-align: center; font-size: 14px; }
.w-sel-foot { display: flex; gap: 8px; padding: 6px 2px 2px; margin-top: 4px; border-top: 1px solid var(--border); }
.w-sel-mini { flex: 1; background: var(--card-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.w-sel-mini.ok { background: var(--brand); border-color: var(--brand); color: #fff; }
.w-sel-empty { padding: 12px; font-size: 13px; color: var(--text-3); }
.w-sel-mask { position: fixed; inset: 0; z-index: 29; background: transparent; }
.w-unit-n { flex: none; opacity: .65; font-size: 12px; }
.w-slot { min-width: 30px; height: 42px; line-height: 42px; padding: 0 5px; text-align: center; font-size: 21px; font-weight: 700; border-radius: 8px; }
.w-slot.fix { color: var(--brand); border-bottom: 2.5px solid var(--brand); }
.w-slot.fix.punct { color: var(--text-2); border-bottom-color: var(--border); }
.w-slot.blank { min-width: 34px; color: var(--text-1); background: var(--card-2); border-bottom: 2.5px solid var(--border); }
.w-slot.blank.has { border-bottom-color: var(--brand); }
.w-slot.blank.cur { border-bottom-color: var(--brand); animation: wslot-blink 1.1s step-end infinite; }
/* 长单词字母格：三档压缩 + 强制单行，避免转到第二行 */
.w-slots.fit { flex-wrap: nowrap; gap: 5px; }
.w-slots.fit .w-slot { min-width: 24px; height: 38px; line-height: 38px; padding: 0 3px; font-size: 18px; }
.w-slots.fit2 { gap: 4px; }
.w-slots.fit2 .w-slot { min-width: 20px; height: 34px; line-height: 34px; padding: 0 2px; font-size: 16px; }
.w-slots.fit3 { gap: 3px; }
.w-slots.fit3 .w-slot { min-width: 16px; height: 30px; line-height: 30px; padding: 0 1px; font-size: 14px; }
@keyframes wslot-blink { 50% { border-bottom-color: transparent; } }
.w-hidden-input { position: absolute; opacity: 0; width: 2px; height: 2px; border: 0; padding: 0; background: transparent; }
/* 例句学习：目标词高亮 + 例句发音 */
.w-example .en b.w-hl { color: var(--brand); font-weight: 700; }
.w-example-speak { margin-top: 6px; text-align: right; }
.w-example .w-speak { vertical-align: middle; margin-left: .35em; }
/* 例句填空（变形关）：所给原形词 */
.w-given { margin-top: 12px; font-size: 14px; color: var(--text-2); }
.w-given .w-given-word { font-size: 22px; font-weight: 700; color: var(--text-1); margin-right: 2px; }
.w-steps { display: flex; gap: 6px; }
.w-steps i { width: 26px; height: 5px; border-radius: 3px; background: var(--border); }
.w-steps i.on { background: var(--brand); }
.w-listen { margin-top: 14px; }
.w-listen.big { text-align: center; font-size: 2.8em; padding: 10px 0; }
.w-listen.big .w-speak { margin-left: 0; vertical-align: middle; }
.w-unit-pill { border: 1px solid var(--border); background: var(--panel); border-radius: 10px; padding: 8px 12px; font-size: 13px; color: var(--text-2); display: flex; justify-content: space-between; align-items: center; }

/* 单元下拉选择（替代原横向滚动 pill 列表） */
.w-unit-select { width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--text-1); font-size: 14px; appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.w-unit-select:focus { outline: none; border-color: var(--brand); }

/* 手势切换页面：滑入方向动画（右滑返回 = 新内容从左进入；左滑切下一页 = 从右进入） */
@keyframes viewInL { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
@keyframes viewInR { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
#view.slide-in-l { animation: viewInL .24s ease; }
#view.slide-in-r { animation: viewInR .24s ease; }

/* ---------------- 工具箱 · 出处查询 ---------------- */
.tool-bar { display: flex; gap: 8px; align-items: stretch; margin: 4px 0 2px; }
.tool-input { flex: 1; min-width: 0; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 11px; font-size: 15px; background: var(--panel); color: var(--text-1); }
.tool-input:focus { outline: none; border-color: var(--brand); }
.tool-bar .btn { flex: 0 0 auto; padding-left: 18px; padding-right: 18px; }
.tool-hint { margin: 8px 2px 4px; }
.tool-results { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.tool-item { padding: 12px 2px; border-bottom: 1px solid var(--border); }
.tool-item:last-child { border-bottom: none; }
.ti-top { display: flex; align-items: center; gap: 10px; }
.ti-term { font-size: 22px; font-weight: 700; color: var(--text-1); line-height: 1.1; }
.ti-py { font-size: 14px; color: var(--text-3); }
.ti-top .tag { margin-left: auto; }
.ti-src { margin-top: 8px; font-size: 14px; color: var(--brand); font-weight: 600; }
.ti-note { margin-top: 4px; font-size: 13px; color: var(--text-2); }
/* 工具箱 · 图标宫格 */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 10px; margin-top: 6px; }
.tool-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 6px 12px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: transform .12s ease, border-color .12s ease; }
.tool-tile:active { transform: scale(.96); }
.tool-ico { width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center; background: rgba(58,122,254,.1); color: var(--brand); }
.tool-ico svg { width: 24px; height: 24px; }
.tool-name { font-size: 13px; font-weight: 600; color: var(--text-1); }

/* ICP 备案号（法律要求：备案通过后网站须展示备案号并链接工信部备案系统） */
#site-foot {
  position: fixed;
  left: 0; right: 0; bottom: 6px;
  text-align: center;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-3, #9aa7b8);
  z-index: 35;
  pointer-events: none;
  padding: 0 10px;
}
#site-foot a { display: block; color: var(--text-3, #9aa7b8); text-decoration: none; pointer-events: auto; }
#site-foot a:hover { color: var(--brand, #2f7dd1); }
@media (max-width: 1023px) {
  /* 窄屏让出底部固定导航的高度 */
  #site-foot { bottom: calc(78px + env(safe-area-inset-bottom) + 4px); }
}
