/* ============================================================
   大可刷题 —— 全局样式系统
   ============================================================ */
*,*::before,*::after { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }

:root {
  --primary: #3B82F6;
  --primary-dark: #2563EB;
  --primary-light: #EFF6FF;
  --success: #10B981;
  --success-light: #ECFDF5;
  --danger: #EF4444;
  --danger-light: #FEF2F2;
  --warning: #F59E0B;
  --warning-light: #FFFBEB;
  --bg: #F1F5F9;
  --bg-card: #FFFFFF;
  --text: #0F172A;
  --text-sub: #475569;
  --text-muted: #94A3B8;
  --border: #E2E8F0;
  --border-lt: #EDF2F7;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.10);
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius: 20px;
  --radius-lg: 28px;
  --radius-full: 48px;
  --nav-h: 64px;
}

html { font-size: 16px; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh; overflow-x: hidden;
}

/* 冷启动加载指示器（CDN 脚本加载期间占位） */
.loading-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, #EFF6FF, #F1F5F9);
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  z-index: 9999;
  transition: opacity 0.3s ease;
}
.loading-overlay.hidden { opacity: 0; pointer-events: none; }
.loading-spinner {
  width: 36px; height: 36px;
  border: 3px solid #E2E8F0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  font-size: 14px; color: var(--text-muted);
  letter-spacing: 1px;
}

/* Layout */
.app-wrap { max-width:750px; margin:0 auto; min-height:100vh; display:flex; flex-direction:column; }
.main-scroll { flex:1; padding:12px 0 calc(var(--nav-h) + 20px + env(safe-area-inset-bottom, 0px)); overflow-y:auto; }

/* Header */
.header {
  background:var(--bg-card); padding:12px 18px; position:sticky; top:0; z-index:99;
  display:flex; justify-content:space-between; align-items:center;
  border-bottom:1px solid var(--border-lt); box-shadow:var(--shadow-sm);
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
}
.header-title { font-size:15px; font-weight:700; }
.header-right { display:flex; gap:10px; align-items:center; }
.role-tag {
  padding:3px 12px; border-radius:var(--radius-full); font-size:11px; font-weight:600;
  background:var(--primary-light); color:var(--primary);
}
.role-tag.child { }
.icon-btn { background:none; border:none; font-size:20px; cursor:pointer; color:var(--text-sub); padding:4px; border-radius:var(--radius-xs); }
.icon-btn:hover { background:var(--bg); }

/* Bottom Nav */
.bottom-nav {
  background:rgba(255,255,255,0.96); backdrop-filter:blur(10px);
  border-top:1px solid var(--border-lt); position:fixed; bottom: 0; left:0; right:0; z-index:99;
  display:flex; justify-content:space-around; align-items:center;
  padding:4px 16px calc(8px + env(safe-area-inset-bottom, 0px)); max-width:750px; margin:0 auto; height:var(--nav-h);
}
.bottom-nav.hidden { display:none !important; }
.nav-item {
  display:flex; flex-direction:column; align-items:center; gap:2px;
  font-size:11px; color:var(--text-muted); cursor:pointer;
  background:none; border:none; font-weight:500; padding:5px 10px; border-radius:var(--radius-sm); transition:all .2s;
}
.nav-item .nav-icon { font-size:19px; }
.nav-item.active { color:var(--primary); }

/* Cards — 全宽紧凑风格（默认），贴边不留空隙 */
.card {
  background:var(--bg-card); border-radius:0; padding:10px 12px;
  margin-bottom:6px; border:1px solid var(--border-lt); box-shadow:none;
}
.card-spacious {
  border-radius:0; padding:10px 12px; margin-bottom:6px; box-shadow:none;
}
.card-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; }
.card-title { font-size:14px; font-weight:600; }
.card-sub { font-size:11px; color:var(--text-muted); }

.card-points {
  background:linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color:#fff; border:none; box-shadow:var(--shadow-sm);
}

/* 重要提示卡片 — 紧凑醒目风格 */
.card-notice {
  background: linear-gradient(135deg, #FFF7ED 0%, #FFEDD5 100%);
  border: 1px solid #FDBA74;
  line-height: 1.35;
  padding: 10px 14px;
  border-radius: 0;
  margin-bottom: 6px;
}
.card-notice .notice-body {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.card-notice .notice-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}
.card-notice .notice-text {
  font-size: 13px;
  color: #C2410C;
  font-weight: 600;
}

/* 规则卡片通用规范 */
.rule-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.35;
}
.rule-rate-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-align: right;
  line-height: 1.35;
}

/* 单位标签（分钟等）— 小号灰色 */
.unit-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

/* 亮屏阈值 — 纵向两行各两字 */
.threshold-line {
  display: block;
  font-size: 12px;
  line-height: 1.3;
}
.pts-big { font-size:42px; font-weight:800; line-height:1.05; }
.pts-sub { font-size:12px; opacity:0.85; display:flex; justify-content:space-between; margin-top:6px; }
/* 借支积分卡片 */
.card-borrow {
  background: linear-gradient(135deg, #EFF6FF 0%, #F5F3FF 100%);
  border: 1px solid #C7D2FE;
}
.borrow-stats { display:flex; gap:10px; margin:10px 0; }
.borrow-stat {
  flex:1; text-align:center; padding:10px 6px; border-radius:10px; background:#fff;
  box-shadow:var(--shadow-sm, 0 1px 2px rgba(0,0,0,0.05));
}
.borrow-num { font-size:26px; font-weight:800; color:var(--primary); line-height:1.1; }
.borrow-label { font-size:11px; color:var(--text-muted); margin-top:2px; }
/* card-compact 已废弃，.card 默认即为紧凑风格 */

/* Buttons */
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  padding:11px 20px; border-radius:var(--radius-full); font-weight:600;
  font-size:13px; cursor:pointer; border:none; transition:all .15s; white-space:nowrap; min-width:80px;
}
.btn:active { transform:scale(.97); }
.btn-primary { background:var(--primary); color:#fff; }
.btn-success { background:var(--success); color:#fff; }
.btn-danger { background:var(--danger); color:#fff; }
.btn-outline { background:transparent; border:1.5px solid var(--border); color:var(--text); }
.btn-outline-success { background:#ECFDF5; border:1.5px solid #6EE7B7; color:#059669; }
.btn-outline-warning { background:#FFF7ED; border:1.5px solid #FDBA74; color:#EA580C; }
.btn-sm { padding:7px 14px; font-size:12px; min-width:unset; }
.btn-ghost { background:#f8fafc; border:1px solid var(--border); color:var(--primary); }
.btn-pg { padding:4px 8px; font-size:14px; min-width:unset; line-height:1; border-radius:6px; }
.btn-close-sm { padding:4px 10px; font-size:13px; min-width:unset; line-height:1; border-radius:6px; color:var(--text-muted); }
.btn-block { width:100%; }
.btn-group { display:flex; gap:10px; }
.btn-group .btn { flex:1; }

/* Forms */
input, select, textarea {
  width:100%; padding:11px 14px; border:1.5px solid var(--border);
  border-radius:var(--radius); font-size:14px; outline:none;
  background:var(--bg-card); font-family:inherit;
}
input:focus, select:focus { border-color:var(--primary); box-shadow:0 0 0 3px rgba(59,130,246,0.12); }
input.inp-sm { width:65px; padding:7px 8px; text-align:center; }
/* 复选框/单选框豁免上面的全局表单样式：否则会被 width:100% 撑成整行，把说明文字挤成竖排 */
input[type="checkbox"], input[type="radio"] {
  width:16px; height:16px; min-width:16px; padding:0; margin:0;
  border-radius:4px; flex-shrink:0; cursor:pointer; accent-color:var(--primary);
}
.label { font-size:13px; color:var(--text-sub); font-weight:500; }
.form-row { display:flex; align-items:center; gap:8px; margin:8px 0; }
.form-row .label { min-width:48px; }

/* Lists */
.list-row {
  display:flex; justify-content:space-between; align-items:center;
  padding:13px 0; border-bottom:1px solid var(--border-lt);
}
.list-row:last-child { border-bottom:none; }
.list-left { display:flex; align-items:center; gap:10px; flex:1; }
.list-icon { width:34px; height:34px; background:var(--bg); border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:18px; }
.list-title { font-weight:500; font-size:14px; }
.txt-positive { color:var(--success); font-weight:600; }
.txt-negative { color:var(--danger); font-weight:600; }

/* Badges */
.badge {
  display:inline-block; padding:3px 9px; border-radius:var(--radius-full);
  font-size:11px; font-weight:600; background:var(--primary-light); color:var(--primary);
  cursor:pointer;
  touch-action:manipulation;
}
/* 错题本"查看全部"按钮 - 增大触控区域 */
#btnOpenMistakeBook {
  padding:6px 12px; font-size:12px;
  min-height:32px; line-height:20px;
}
.badge.green { background:var(--success-light); color:var(--success); }
.badge.red { background:var(--danger-light); color:var(--danger); }
.tag { display:inline-block; padding:2px 8px; border-radius:20px; font-size:11px; background:var(--bg); color:var(--text-sub); margin:1px 3px; }

/* Modal */
.modal-mask {
  position:fixed; top:0; left:0; width:100%; height:100%;
  background:rgba(0,0,0,0.45); z-index:1000; display:none;
  justify-content:center; align-items:center;
}
.modal-mask.show { display:flex; }
/* 纠错弹窗（rpt-modal）、密码弹窗（kb-avoid）上移，避让输入法 */
.modal-mask.rpt-modal,
.modal-mask.kb-avoid { align-items: flex-start; padding-top: 8vh; }
.modal-box {
  background:#fff; border-radius:var(--radius-lg); padding:22px;
  width:90%; max-width:360px; max-height:82vh; overflow-y:auto; box-shadow:var(--shadow-lg);
}
.modal-hd { font-size:17px; font-weight:700; margin-bottom:14px; white-space:pre-line; line-height:1.5; }
.modal-ft { display:flex; gap:10px; margin-top:18px; }
.modal-ft .btn { flex:1; }
.modal-ft .btn-pg,
.modal-ft .btn-close-sm { flex:none; }
/* 按钮禁用态（如密码校验中） */
.btn:disabled { opacity:.6; cursor:not-allowed; }

/* 通用弹窗（咨询建议等） */
.modal-overlay {
  position:fixed; top:0; left:0; right:0; bottom:0;
  z-index:1000;
}
.modal {
  background:#fff; border-radius:var(--radius-lg); padding:22px;
  box-shadow:var(--shadow-lg); max-height:85vh; overflow-y:auto;
}
.modal-wide { max-width:900px; width:96%; }

/* 词典弹窗 */
.dict-popup {
  background:#fff; border-radius:var(--radius-lg);
  width:90%; max-width:380px; max-height:85vh; overflow-y:auto;
  box-shadow:var(--shadow-lg); padding:20px 22px 16px;
  animation:dictFadeIn .2s ease;
}
@keyframes dictFadeIn { from{opacity:0;transform:translateY(10px) scale(0.97)} to{opacity:1;transform:translateY(0) scale(1)} }

.dict-popup-head { display:flex; justify-content:flex-end; margin-bottom:2px; }
.dict-popup-close { font-size:12px; color:var(--text-muted); cursor:pointer; padding:4px 6px; border-radius:8px; transition:background .15s; }
.dict-popup-close:hover { background:var(--bg); }

.dict-popup-word { font-size:24px; font-weight:700; line-height:1.3; }
.dict-popup-phonetic { font-size:14px; color:var(--text-muted); margin:4px 0 6px; }

.dict-popup-speak { font-size:13px; color:var(--primary); cursor:pointer; display:inline-block; padding:4px 10px; border-radius:8px; transition:background .15s; margin-bottom:12px; user-select:none; }
.dict-popup-speak:hover { background:var(--primary-light); }

.dict-popup-section { margin-top:12px; }
.dict-section-title { font-size:12px; font-weight:600; color:var(--text-muted); margin-bottom:6px; text-transform:uppercase; letter-spacing:0.5px; }

.dict-sense { margin-bottom:8px; }
.dict-sense-pos { font-size:12px; color:var(--text-muted); margin-bottom:2px; }
.dict-tag { display:inline-block; padding:1px 8px; border-radius:10px; font-size:11px; font-weight:600; background:var(--primary-light); color:var(--primary); margin-right:4px; }
.dict-sense-defs { font-size:15px; line-height:1.6; color:var(--text); }

.dict-compound-header { margin-bottom:10px; padding:6px 12px; background:var(--primary-light); border-radius:8px; display:flex; align-items:center; gap:8px; }
.dict-tag-compound { background:var(--primary) !important; color:#fff !important; font-size:12px !important; padding:2px 10px !important; }
.dict-compound-parts { font-size:13px; color:var(--text-sub); font-weight:500; }

.dict-forms { display:flex; flex-wrap:wrap; gap:6px; }
.dict-form-item { font-size:13px; background:var(--bg); padding:4px 10px; border-radius:8px; color:var(--text-sub); }
.dict-form-item em { font-style:normal; font-weight:600; color:var(--text-muted); margin-right:4px; }

.dict-popup-level { display:inline-block; font-size:11px; font-weight:600; color:var(--success); background:var(--success-light); padding:2px 10px; border-radius:10px; margin-top:10px; }

/* 原形速查区域 */
.dict-original-section {
  margin-top:14px;
  padding:12px;
  background:var(--bg);
  border-radius:12px;
  border-left:3px solid var(--primary);
}
.dict-original-word {
  font-weight:700;
  color:var(--primary);
  text-decoration:underline;
  text-underline-offset:3px;
}
.dict-original-phonetic {
  font-size:14px;
  color:var(--text-muted);
  margin:4px 0 8px;
}
.dict-original-senses {
  font-size:14px;
  line-height:1.6;
  color:var(--text-sub);
}
.dict-original-tags {
  margin-top:8px;
  display:flex;
  flex-wrap:wrap;
  gap:4px;
}
.dict-tag-level {
  background:#e8f5e9 !important;
  color:#2e7d32 !important;
}
.dict-tag-exams {
  background:#e3f2fd !important;
  color:#1565c0 !important;
}
.dict-original-forms {
  margin-top:10px;
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}
.dict-form-current {
  background:var(--primary-light) !important;
  color:var(--primary) !important;
  font-weight:600;
}
.dict-form-cur-marker {
  font-size:11px;
  color:var(--primary);
  font-weight:600;
}

.dict-popup-none { font-size:13px; color:var(--text-muted); font-style:italic; }

.dict-popup-btn {
  display:block; width:100%; margin-top:14px; padding:12px; font-size:15px; font-weight:600;
  background:var(--primary); color:#fff; border:none; border-radius:var(--radius-sm);
  cursor:pointer; transition:all .2s; text-align:center;
}
.dict-popup-btn:hover { background:var(--primary-dark); }
.dict-popup-btn:disabled { opacity:0.7; cursor:default; }
.dict-popup-btn-done { background:var(--success) !important; }



/* Tabs */
.tab-bar { display:flex; gap:4px; background:var(--bg); border-radius:var(--radius-full); padding:4px; margin-bottom:14px; }
.tab {
  flex:1; text-align:center; padding:9px 14px; border-radius:var(--radius-full);
  font-size:13px; font-weight:600; cursor:pointer; border:none; background:transparent;
  color:var(--text-muted); transition:all .2s;
}
.tab.active { background:#fff; color:var(--primary); box-shadow:var(--shadow-sm); }
.tab-disabled, .tab:disabled { opacity:0.4; cursor:not-allowed; pointer-events:none; }

/* Quiz */
.quiz-bar {
  background:var(--bg-card); border-radius:var(--radius); padding:10px 14px;
  display:flex; justify-content:space-between; flex-wrap:wrap; gap:6px; box-shadow:var(--shadow-sm); margin-bottom:10px;
}
.chip {
  background:var(--primary-light); padding:5px 12px; border-radius:var(--radius-full);
  font-size:12px; font-weight:500; white-space:nowrap;
}
.chip strong { font-size:15px; margin-right:2px; }
.chip.timer { background:#1E293B; color:#fff; font-family:monospace; }

.quiz-qcard {
  background:var(--bg-card); border-radius:var(--radius-lg); padding:22px 16px;
  box-shadow:var(--shadow-md); margin-bottom:14px;
}
.q-source { font-size:11px; color:var(--text-sub); background:var(--bg); display:inline-block; padding:3px 11px; border-radius:var(--radius-full); margin-bottom:12px; }
.q-text { font-size:15px; font-weight:500; line-height:1.5; margin-bottom:18px; }
/* ===== 题库富文本：题干/材料/解析内嵌图片与表格（道法等学科） ===== */
.q-img { display:block; max-width:100%; height:auto; margin:10px auto; border-radius:8px; }
.q-table { width:100%; border-collapse:collapse; font-size:13px; margin:10px 0; }
.q-table th, .q-table td {
  border:1px solid var(--border); padding:6px 8px; vertical-align:top; word-break:break-word;
}
.q-table th { background:var(--bg); font-weight:600; }
.q-table img { max-width:100%; height:auto; }
/* 文字极多的宽表：外层包 <div class="q-table-wrap"> 局部允许横向滚动（不动 body） */
.q-table-wrap { width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch; }
.q-opts { display:flex; flex-direction:column; gap:4px; margin-bottom:8px; }
/* 选项紧凑布局：短文字 2×2 网格 */
.q-opts-compact { display:grid; grid-template-columns:1fr 1fr; gap:4px; }
@media (min-width:600px) {
  .q-opts-compact { display:flex; flex-direction:row; gap:4px; }
  .q-opts-compact .q-opt { flex:1; min-width:0; }
}
/* 选项一行横排：极短单词，平板一行/手机自动折行 */
.q-opts-inline { display:flex; flex-direction:row; flex-wrap:wrap; gap:4px; }
@media (min-width:600px) {
  .q-opts-inline { flex-wrap:nowrap; }
  .q-opts-inline .q-opt { flex:1; min-width:0; }
}
.q-opt {
  background:#F8FAFC; border:1.5px solid var(--border); border-radius:var(--radius-full);
  padding:6px 14px; cursor:pointer; display:flex; align-items:center; gap:8px; transition:all .15s; font-size:13px;
}
.q-opt:hover { border-color:var(--primary); background:#EFF6FF; }
.q-opt.sel { background:#DBEAFE; border-color:var(--primary); }
.q-opt-ltr { font-weight:700; width:20px; height:20px; background:var(--border); border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:11px; flex-shrink:0; }
.q-fill { width:100%; padding:13px 16px; font-size:15px; border:1.5px solid var(--border); border-radius:var(--radius-full); margin-bottom:14px; }
.q-acts { display:flex; gap:8px; flex-wrap:wrap; }
.q-acts .btn { flex:1; min-width:90px; }
.q-fb { padding:12px 14px; border-radius:var(--radius-sm); margin:12px 0; font-size:13px; line-height:1.5; }
.q-fb.ok { background:var(--success-light); border-left:4px solid var(--success); }
.q-fb.err { background:var(--danger-light); border-left:4px solid var(--danger); }
.q-expl { background:#F0F9FF; border-radius:var(--radius-sm); padding:12px 14px; margin-top:8px; font-size:13px; line-height:1.5; color:#075985; }
.q-ext { background:#FFFBEB; border:1px solid #FDE68A; border-radius:var(--radius-sm); padding:12px 14px; margin-top:8px; font-size:13px; line-height:1.6; color:#92400E; }
.q-prog { font-size:11px; color:var(--text-muted); text-align:right; margin-top:8px; }

/* Panel */
.panel-box { background:var(--bg-card); border-radius:var(--radius-lg); padding:18px; margin-bottom:14px; max-height:60vh; overflow-y:auto; box-shadow:var(--shadow-md); }
.m-item { background:var(--danger-light); padding:10px 12px; border-radius:var(--radius-sm); margin-bottom:8px; font-size:13px; line-height:1.5; }
.m-item .m-hd { font-weight:600; margin-bottom:3px; }
.sim-badge { display:inline-block; background:#E0E7FF; color:#3730A3; padding:3px 9px; border-radius:var(--radius-full); font-size:11px; cursor:pointer; margin:2px; }
.sim-badge:hover { background:#C7D2FE; }

/* Recommend */
.rec-card {
  background:var(--bg-card); border-radius:0; padding:10px 12px;
  margin-bottom:6px; border:1px solid var(--border-lt); display:flex; gap:10px; align-items:center;
}
.rec-img { width:56px; height:56px; background:var(--bg); border-radius:8px; display:flex; align-items:center; justify-content:center; font-size:26px; flex-shrink:0; }
.rec-body { flex:1; min-width:0; }
.rec-title { font-weight:600; font-size:14px; margin-bottom:3px; }
.rec-meta { font-size:11px; color:var(--text-muted); display:flex; gap:6px; flex-wrap:wrap; }

/* Task */
.task-card { background:#F8FAFC; border-radius:0; padding:10px 12px; margin-bottom:6px; border:1px solid var(--border-lt); }
.task-hd { display:flex; justify-content:space-between; align-items:center; margin-bottom:6px; }
.task-name { font-weight:600; font-size:14px; }
.tier-row { display:flex; justify-content:space-between; font-size:13px; padding:3px 0; }

/* Device */
.device-card { background:var(--bg-card); border-radius:0; padding:10px 12px; margin-bottom:6px; border:1px solid var(--border-lt); display:flex; justify-content:space-between; align-items:center; }
.d-info { display:flex; align-items:center; gap:10px; }
.d-icon { font-size:26px; }
.d-status { font-size:11px; font-weight:600; }
.d-status.on { color:var(--success); }
.d-status.off { color:var(--danger); }

/* Settings */
.settings-overlay {
  position:fixed; top:0; left:0; width:100%; height:100%; z-index:1100;
  background:var(--bg); display:none; flex-direction:column;
}
.settings-overlay.show { display:flex; }
.s-hd { padding:14px 18px; background:#fff; border-bottom:1px solid var(--border-lt); display:flex; align-items:center; gap:14px; font-size:17px; font-weight:600; }
.s-body { flex:1; padding:14px; overflow-y:auto; }
.s-item {
  background:#fff; border-radius:0; padding:12px 14px; margin-bottom:6px;
  display:flex; justify-content:space-between; align-items:center; cursor:pointer; border:1px solid var(--border-lt);
}

/* Quiz History */
.qh-table { width:100%; font-size:12px; border-collapse:collapse; }
.qh-table th { text-align:left; padding:7px 5px; border-bottom:2px solid var(--border); color:var(--text-sub); font-weight:600; }
.qh-table td { padding:7px 5px; border-bottom:1px solid var(--border-lt); }

/* Unified Log Table — 紧窄手机表格 */
.ut-table { width:100%; font-size:11px; border-collapse:collapse; table-layout:fixed; }
.ut-table th { text-align:left; padding:5px 3px; border-bottom:2px solid var(--border); color:var(--text-sub); font-weight:600; font-size:10px; white-space:nowrap; }
.ut-table td { padding:5px 3px; border-bottom:1px solid var(--border-lt); vertical-align:top; line-height:1.4; }
.ut-th-time { width:44px; }
.ut-td-time { font-size:10px; color:var(--text-sub); white-space:nowrap; }
.ut-time-sub { font-size:9px; color:var(--text-muted); }
.ut-th-content { width:80px; }
.ut-td-content { font-size:11px; word-break:break-all; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:80px; padding-left:4px; }
.ut-th-acc { width:38px; text-align:center; }
.ut-td-acc { text-align:center; font-size:11px; }
.ut-th-dur { width:38px; text-align:center; }
.ut-td-dur { font-size:10px; color:var(--text-muted); text-align:center; }
.ut-th-wrong { width:38px; text-align:center; }
.ut-td-wrong { text-align:center; }
.ut-th-pts { width:28px; text-align:right; }
.ut-td-pts { text-align:right; font-size:12px; font-weight:600; padding-right:3px; }

/* Empty */
.empty { text-align:center; padding:36px 20px; color:var(--text-muted); }
.empty-icon { font-size:44px; margin-bottom:8px; }

/* Toast */
.toast {
  position:fixed; top:16px; left:50%; transform:translateX(-50%);
  background:#1E293B; color:#fff; padding:11px 22px; border-radius:var(--radius-full);
  font-size:13px; font-weight:500; z-index:2000; opacity:0; transition:opacity .3s; pointer-events:none;
}
.toast.show { opacity:1; }

/* Network Banner */
.network-banner {
  display: none;
  background: #FFF3CD; color: #856404;
  text-align: center; padding: 6px 12px;
  font-size: 12px; line-height: 1.5;
  border-bottom: 1px solid #FFEEBA;
  animation: bannerSlide .3s ease;
}
.network-banner.show { display: block; }
@keyframes bannerSlide {
  from { opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; }
  to { opacity: 1; max-height: 40px; padding-top: 6px; padding-bottom: 6px; }
}
.network-banner.recovering {
  background: #D4EDDA; color: #155724;
  border-bottom-color: #C3E6CB;
}

/* Role Selector */
.role-page {
  display:flex; flex-direction:column; align-items:center; justify-content:flex-start;
  min-height:100vh; gap:20px; padding:60px 20px 20px;
}
.role-page h1 { font-size:26px; font-weight:800; }
.role-cards { display:flex; gap:14px; flex-wrap:wrap; justify-content:center; margin-top:8px; }
.role-card {
  width:140px; padding:28px 18px; border-radius:var(--radius-lg);
  background:var(--bg-card); border:2px solid var(--border);
  text-align:center; cursor:pointer; transition:all .2s; box-shadow:var(--shadow-sm);
}
.role-card:hover { border-color:var(--primary); transform:translateY(-2px); box-shadow:var(--shadow-md); }
.role-card .rc-icon { font-size:42px; display:block; margin-bottom:10px; }
.role-card .rc-name { font-weight:700; font-size:17px; }

/* Page */
.page { display:none; }
.page.active { display:block; }

/* Responsive */
/* Quiz Entry List */
.quiz-entry-list { display:flex; flex-direction:column; gap:4px; }
.quiz-entry {
  display:flex; align-items:center; gap:8px; padding:8px 10px;
  background:var(--bg-card); border:1px solid var(--border-lt); border-radius:0;
  cursor:pointer; transition:all .2s;
}
.quiz-entry:hover { border-color:var(--primary); background:#EFF6FF; }
.quiz-entry:active { transform:scale(0.98); }
.qe-icon { font-size:22px; flex-shrink:0; width:28px; text-align:center; }
.qe-body { flex:1; min-width:0; }
.qe-title { font-weight:600; font-size:14px; margin-bottom:1px; }
.qe-desc { font-size:11px; color:var(--text-muted); }

/* Mistake Book */
.mb-item {
  background:var(--bg-card); border:1px solid var(--border-lt); border-radius:var(--radius-sm);
  padding:12px; margin-bottom:10px;
}
.mb-hd { display:flex; align-items:center; gap:6px; margin-bottom:6px; }
.mb-detail { font-size:12px; margin-bottom:4px; }
.mb-expl { font-size:11px; color:var(--text-sub); margin-bottom:4px; }
.mb-note { font-size:11px; color:#B45309; background:#FEF3C7; padding:4px 8px; border-radius:8px; margin-bottom:4px; }
.mb-acts { display:flex; gap:6px; margin-top:6px; }

@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
.quiz-entry { animation:fadeIn .3s ease both; }
.quiz-entry:nth-child(2) { animation-delay:0.05s; }
.quiz-entry:nth-child(3) { animation-delay:0.1s; }

/* ========== 短文选词/填空样式 ========== */
.pw-blank {
  display:inline-block; padding:2px 8px; margin:0 2px; border-radius:6px;
  font-weight:600; font-size:14px; border:2px dashed var(--border);
  background:#F8FAFC; color:var(--text-muted);
}
.pw-blank.active {
  border-color:#8B5CF6; background:#F3E8FF; color:#7C3AED;
  animation:blankPulse 1.5s ease-in-out infinite;
}
.pw-blank.done {
  border-color:var(--success); background:var(--success-light); color:var(--success);
  border-style:solid;
}
@keyframes blankPulse {
  0%,100% { box-shadow:0 0 0 0 rgba(139,92,246,0.3); }
  50% { box-shadow:0 0 0 6px rgba(139,92,246,0); }
}
.pw-opt {
  cursor:pointer; transition:all 0.2s ease;
}
.pw-opt:hover { transform:translateY(-2px); box-shadow:0 4px 12px rgba(139,92,246,0.15); }
.pw-opt.sel { border-color:#8B5CF6 !important; background:#F3E8FF !important; }
.pw-opt-pool { display:flex; flex-wrap:wrap; gap:8px; }

@media (max-width:500px) {
  .pts-big { font-size:38px; }
  .q-text { font-size:14px; }
  .role-cards { flex-direction:column; align-items:center; }
  .pw-opt { min-width:48px !important; padding:8px 10px !important; font-size:12px !important; }
}
@media (min-width:751px) {
  .app-wrap { border-left:1px solid var(--border); border-right:1px solid var(--border); }
}

/* ========== 积分消费管控样式 ========== */

/* 积分不足卡片 */
.card-points.pts-empty { background:linear-gradient(135deg, #DC2626, #B91C1C); }
.card-points.pts-low { background:linear-gradient(135deg, #F59E0B, #D97706); }
.pts-warn {
  font-size:12px; padding:8px 12px; margin-top:10px;
  background:rgba(255,255,255,0.2); border-radius:var(--radius-xs);
  text-align:center; font-weight:600;
}
.pts-fill-empty { background:#FCA5A5 !important; }

/* 赚积分行 */
.earn-row {
  display:flex; justify-content:space-between; align-items:center;
  padding:8px 10px; background:#F0FDF4; border-radius:var(--radius-xs);
  margin-bottom:4px; font-size:13px;
}

/* 计时器 */
.timer-display {
  text-align:center; font-size:48px; font-weight:800; font-family:monospace;
  color:var(--primary); padding:10px 0; letter-spacing:4px;
}
.timer-minutes, .timer-seconds { display:inline-block; min-width:70px; }
.timer-info {
  text-align:center; font-size:13px; color:var(--text-sub);
  padding:4px 0; font-weight:500;
}

/* 任务审核行 */
.review-row {
  display:flex; justify-content:space-between; align-items:flex-start;
  padding:12px; background:#F8FAFC; border-radius:var(--radius-sm);
  margin-bottom:8px; gap:10px; border:1px solid var(--border-lt);
}
.review-info { flex:1; min-width:0; }
.review-name { font-weight:600; font-size:14px; margin-bottom:3px; }
.review-tier { font-size:12px; color:var(--primary); margin-bottom:2px; }
.review-note { font-size:12px; color:var(--text-sub); margin-bottom:2px; }
.review-time { font-size:11px; color:var(--text-muted); }
.review-acts { display:flex; flex-direction:column; gap:4px; flex-shrink:0; }

/* ========== 查词交互样式 ========== */
/* pan-y: 只允许垂直滚动，禁用水平手势（防止侧边返回误触） */
/* contain: 阻止滚动链到祖先元素，防止边缘滑动穿透 */
#mainScroll { touch-action: pan-y; overscroll-behavior: contain; }

.dict-word {
  cursor: pointer;
  border-bottom: 1px dotted #94A3B8;
  transition: background 0.15s, border-color 0.15s;
  position: relative;
}
.dict-word:hover {
  background: #DBEAFE;
  border-bottom-color: var(--primary);
}
.dict-word-active {
  background: #BFDBFE !important;
  border-bottom-color: var(--primary-dark) !important;
  border-radius: 2px;
}

/* ========== 生词本样式 ========== */

/* 生词本弹窗按钮三态 */
.dict-popup-btn-disabled {
  background: #E2E8F0 !important;
  color: #94A3B8 !important;
  cursor: default !important;
}
.dict-popup-btn-disabled:hover { background: #E2E8F0 !important; }
.dict-popup-btn-revive {
  background: linear-gradient(135deg, #F59E0B, #F97316) !important;
  color: #fff !important;
}
.dict-popup-btn-revive:hover {
  background: linear-gradient(135deg, #D97706, #EA580C) !important;
}

/* 生词本网格（两列自适应） */
.wordbook-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 0 8px;
}

/* 生词本筛选按钮 */
.wb-filter-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 7px 14px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 600; cursor: pointer;
  background: transparent; color: var(--text-sub);
  border: 1.5px solid var(--border);
  transition: all 0.15s; white-space: nowrap;
}
.wb-filter-btn:active { transform: scale(0.97); }

/* 生词卡片 */
.wb-card {
  background: var(--bg-card);
  border: 1px solid var(--border-lt);
  border-radius: 10px;
  padding: 8px 10px;
  transition: all .15s;
}
.wb-card-mastered {
  background: #F0FDF4;
  border-color: #BBF7D0;
}

/* 单词行 */
.wb-word-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}
.wb-word {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  transition: color .15s;
}
.wb-word:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* 来源句（小号） */
.wb-source {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  margin-bottom: 2px;
}

/* 来源信息 */
.wb-info {
  font-size: 9px;
  color: var(--text-muted);
  opacity: 0.7;
}

/* ========== 消灭生词游戏样式 ========== */

.wordgame-wrap {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1100;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.wordgame-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(14px + env(safe-area-inset-top, 28px)) 16px 14px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-lt);
  position: sticky;
  top: 0;
  z-index: 10;
}
.wordgame-title {
  font-size: 18px;
  font-weight: 700;
}
.wordgame-close {
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 8px;
  transition: background .15s;
}
.wordgame-close:hover {
  background: var(--bg);
  color: var(--text);
}

/* 操作引导 + 进度 统一卡片 */
.wg-info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  margin: 0 12px 10px;
  box-shadow: var(--shadow-sm);
}

/* 引导文字（一行） */
.wg-guide-line {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}
.wg-guide-emoji {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}
.wg-guide-emoji--right {
  margin-left: 12px;
}
.wg-guide-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* 分隔线 */
.wg-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 12px 0 10px;
}

/* 进度区域 */
.wg-progress-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 进度头部：标签 + 数字 */
.wg-progress-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.wg-progress-label {
  font-size: 12px;
  color: var(--text-muted);
}
.wg-progress-num {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

/* 进度条 */
.wg-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.wg-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3B82F6, #10B981);
  border-radius: 99px;
  transition: width 0.3s ease;
}

/* 游戏面板：左右两列 */
.wordgame-board {
  display: flex;
  gap: 8px;
  padding: 0 10px;
  flex: 1;
  align-items: center;
}

.wordgame-left,
.wordgame-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wordgame-arrow-col {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0 3px;
}
.wg-arrow-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 900;
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(59,130,246,0.2);
}

/* 左边单词卡片 */
.wg-left-item {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 11px 10px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}
.wg-left-item:active {
  transform: scale(0.97);
}
.wg-left-item:hover:not(.wg-matched):not(.wg-blocked) {
  border-color: var(--primary);
  background: #EFF6FF;
}
.wg-word-text {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}

/* 左边选中态 */
.wg-left-item.wg-selected {
  border-color: var(--primary);
  background: #DBEAFE;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

/* 右边释义卡片 */
.wg-right-item {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 11px 10px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}
.wg-right-item:active {
  transform: scale(0.97);
}
.wg-right-item:hover:not(.wg-matched) {
  border-color: var(--primary);
}
.wg-def-text {
  font-size: 13px;
  color: var(--text-sub);
  font-weight: 500;
}

/* 匹配成功 */
.wg-left-item.wg-matched,
.wg-right-item.wg-matched {
  background: #DCFCE7;
  border-color: #4ADE80;
  cursor: default;
  opacity: 0.85;
}

/* 匹配失败（左边锁死变红） */
.wg-left-item.wg-blocked {
  background: #FEE2E2;
  border-color: #F87171;
  cursor: default;
  opacity: 0.8;
}

/* 抖动动画（右边错误时） */
.wg-shake {
  animation: wgShake 0.4s ease;
}
@keyframes wgShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* 游戏结束结果页 */
.wordgame-result {
  text-align: center;
  padding: 40px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.wordgame-result-icon {
  font-size: 56px;
  margin-bottom: 12px;
}
.wordgame-result-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}
.wordgame-result-stats {
  display: flex;
  gap: 32px;
  margin-bottom: 8px;
}
.wg-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.wg-stat-num {
  font-size: 36px;
  font-weight: 800;
}
.wg-stat-label {
  font-size: 13px;
  color: var(--text-muted);
}

.wordgame-footer {
  text-align: center;
  padding: 8px 12px 16px;
}

/* ======== 信息匹配题布局 ======== */
.match-layout {
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
}
.match-items {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.match-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #FAFBFC;
  border-radius: 10px;
}
.match-no {
  font-weight: 700;
  font-size: 14px;
  color: #6366F1;
  min-width: 28px;
  flex-shrink: 0;
}
.match-label {
  flex: 1;
  font-size: 13px;
  line-height: 1.5;
  color: #334155;
  min-width: 0;
}
.match-options {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.match-opt-card {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  background: #F1F5F9;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
}
.match-opt-key {
  font-weight: 700;
  font-size: 13px;
  color: #6366F1;
  min-width: 18px;
  flex-shrink: 0;
}
.match-opt-text {
  color: #475569;
}

@media (max-width: 640px) {
  .match-layout {
    flex-direction: column;
  }
}

/* ====== 纠错按钮 ====== */
.q-report-btn {
  display: block;
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px 0 2px;
  user-select: none;
  transition: color .15s;
}
.q-report-btn:hover { color: var(--primary); }

/* 纠错弹窗 - 描述框 */
#rptDesc {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
  background: var(--bg-card);
  font-family: inherit;
  resize: none;
  line-height: 1.5;
}
#rptDesc:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.rpt-char-count {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  margin-top: 4px;
}

.rpt-qid-tag {
  display: inline-block;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 10px;
  font-family: monospace;
}

.modal-box .form-group {
  margin-bottom: 14px;
}
.modal-box .form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 6px;
  display: block;
}

/* ========== 下拉刷新指示器（仅 App 壳启用，浏览器用原生 PIR） ========== */
#pullRefreshIndicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg, #F1F5F9);
  color: var(--text-sub, #475569);
  font-size: 13px;
  z-index: 999;
  pointer-events: none;
  box-shadow: 0 1px 0 var(--border, #E2E8F0);
}
#pullRefreshIndicator .pr-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}
#pullRefreshIndicator.loading .pr-icon {
  width: 16px;
  height: 16px;
  border: 2px solid #CBD5E1;
  border-top-color: var(--primary, #3B82F6);
  border-radius: 50%;
  animation: prSpin 0.8s linear infinite;
}
@keyframes prSpin { to { transform: rotate(360deg); } }
