/* ==========================================================================
   CET-6 Master · 全局样式
   设计原则：类 Notion 极简风、卡片化、响应式（手机 / iPad / 电脑）
   配色：低饱和蓝绿主色 + 中性灰，暗色模式通过 body.dark 切换
   ========================================================================== */

/* ---------- 设计令牌 ---------- */
:root {
  --bg: #f6f7f9;
  --bg-soft: #eef1f4;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e3e7ec;
  --text: #1f2430;
  --text-2: #5b6472;
  --text-3: #8b95a5;
  --brand: #2f6fd0;
  --brand-soft: #e8f1fd;
  --brand-deep: #1d4ea3;
  --ok: #2ea36a;
  --ok-soft: #e6f6ee;
  --warn: #d9822b;
  --warn-soft: #fdf1e2;
  --err: #d64b4b;
  --err-soft: #fdeaea;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 30, 50, .05), 0 6px 20px rgba(20, 30, 50, .06);
  --shadow-lg: 0 12px 40px rgba(20, 30, 50, .14);
  --sidebar-w: 236px;
  --header-h: 58px;
  --font: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Source Han Sans SC", system-ui, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

/* 暗色模式：仅覆盖令牌，组件无需改写 */
body.dark {
  --bg: #14171c;
  --bg-soft: #1b1f26;
  --surface: #1c212a;
  --surface-2: #222833;
  --border: #2c3441;
  --text: #e6eaf1;
  --text-2: #a5b0c0;
  --text-3: #77828f;
  --brand: #5c9bf0;
  --brand-soft: #1e2c40;
  --brand-deep: #8bb8f5;
  --ok-soft: #1b3027;
  --warn-soft: #33281a;
  --err-soft: #38201f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .28);
  --shadow-lg: 0 14px 44px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0 0 .5em; font-weight: 650; line-height: 1.3; }
h1 { font-size: 24px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p { margin: 0 0 .8em; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 密码门 ---------- */
.gate {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background:
    radial-gradient(1100px 520px at 12% -8%, rgba(47, 111, 208, .16), transparent 60%),
    radial-gradient(900px 500px at 108% 108%, rgba(46, 163, 106, .14), transparent 60%),
    var(--bg);
}
.gate.hidden { display: none; }

.gate-card {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 34px 30px 26px;
  text-align: center;
}
.gate-logo {
  width: 58px; height: 58px; margin: 0 auto 14px;
  display: grid; place-items: center;
  border-radius: 17px;
  background: linear-gradient(135deg, var(--brand), #56b39a);
  color: #fff; font-size: 25px; font-weight: 700;
  letter-spacing: .5px;
}
.gate-card h1 { font-size: 21px; margin-bottom: 6px; }
.gate-sub { color: var(--text-2); font-size: 13.5px; margin-bottom: 22px; }

.gate-form { text-align: left; }
.gate-hint {
  margin-top: 16px; padding-top: 14px;
  border-top: 1px dashed var(--border);
  font-size: 12.5px; color: var(--text-3); text-align: left;
}
.gate-hint code {
  font-family: var(--mono); background: var(--bg-soft);
  padding: 1px 5px; border-radius: 5px; color: var(--brand-deep);
}
.gate-err { color: var(--err); font-size: 13px; min-height: 20px; margin-top: 8px; }
.shake { animation: shake .35s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-7px); }
  40%, 80% { transform: translateX(7px); }
}

/* ---------- 应用骨架 ---------- */
.app { display: none; min-height: 100%; }
.app.ready { display: block; }

/* 侧边栏 */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 40;
  transition: transform .25s ease;
}
.sb-head {
  height: var(--header-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  flex: none;
}
.sb-logo {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px;
  background: linear-gradient(135deg, var(--brand), #56b39a);
}
.sb-title { font-weight: 650; font-size: 15px; line-height: 1.2; }
.sb-title small { display: block; font-weight: 400; font-size: 11px; color: var(--text-3); }

.sb-nav { flex: 1; overflow-y: auto; padding: 12px 10px 20px; }
.nav-group-label {
  font-size: 11px; color: var(--text-3); letter-spacing: .8px;
  padding: 12px 10px 6px; text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 14px;
  cursor: pointer; user-select: none;
  border: none; background: none; width: 100%; text-align: left;
  font-family: inherit;
}
.nav-item:hover { background: var(--bg-soft); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-deep); font-weight: 600; }
.nav-item .ico { width: 18px; text-align: center; font-size: 15px; flex: none; }
.nav-badge {
  margin-left: auto; font-size: 11px; color: var(--text-3);
  background: var(--bg-soft); border-radius: 20px; padding: 0 7px;
}

.sb-foot { flex: none; border-top: 1px solid var(--border); padding: 10px; }
.sb-user {
  display: flex; align-items: center; gap: 10px; padding: 8px;
  border-radius: var(--radius-sm); cursor: pointer;
}
.sb-user:hover { background: var(--bg-soft); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 13px; font-weight: 600;
  background: var(--brand-soft); color: var(--brand-deep);
}

/* 顶栏 */
.header {
  position: fixed; top: 0; left: var(--sidebar-w); right: 0; height: var(--header-h);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px; z-index: 30;
}
.hamburger {
  display: none; border: 1px solid var(--border); background: var(--surface);
  width: 34px; height: 34px; border-radius: 9px; cursor: pointer;
  color: var(--text-2); font-size: 16px;
}
.header .spacer { flex: 1; }
.search {
  position: relative; width: 260px;
}
.search input {
  width: 100%; height: 34px; padding: 0 12px 0 32px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg-soft); color: var(--text); font-size: 13.5px;
  font-family: inherit; outline: none;
}
.search input:focus { border-color: var(--brand); background: var(--surface); }
.search .ico { position: absolute; left: 11px; top: 8px; color: var(--text-3); font-size: 13px; }
.hdr-count {
  font-size: 12.5px; color: var(--text-2);
  background: var(--err-soft); color: var(--err);
  padding: 4px 10px; border-radius: 999px; font-weight: 600; white-space: nowrap;
}
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); cursor: pointer; font-size: 15px;
  display: grid; place-items: center;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--text); }

/* 主内容 */
.main {
  margin-left: var(--sidebar-w); padding: calc(var(--header-h) + 22px) 22px 90px;
  max-width: 1220px;
}
.page { display: none; animation: fade .22s ease; }
.page.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.page-head { margin-bottom: 18px; }
.page-head h1 { margin-bottom: 4px; }
.page-head .sub { color: var(--text-2); font-size: 13.5px; }

/* 卡片与网格 */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}
.card-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.card-head h2, .card-head h3 { margin: 0; }
.card-head .spacer { flex: 1; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

/* 统计块 */
.stat { display: flex; gap: 13px; align-items: center; }
.stat .num { font-size: 26px; font-weight: 700; line-height: 1.1; }
.stat .lbl { font-size: 12.5px; color: var(--text-2); }
.stat-ico {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  display: grid; place-items: center; font-size: 18px;
  background: var(--brand-soft); color: var(--brand-deep);
}
.stat-ico.green { background: var(--ok-soft); color: var(--ok); }
.stat-ico.orange { background: var(--warn-soft); color: var(--warn); }
.stat-ico.red { background: var(--err-soft); color: var(--err); }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 15px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-size: 13.5px; font-family: inherit; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: .15s;
}
.btn:hover { background: var(--bg-soft); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); }
.btn.ghost { background: none; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--bg-soft); }
.btn.danger { color: var(--err); border-color: var(--border); }
.btn.danger:hover { background: var(--err-soft); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; }
.btn.lg { height: 42px; padding: 0 20px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }

/* 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
input[type=text], input[type=password], input[type=number], input[type=date],
select, textarea {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text);
  font-size: 14px; font-family: inherit; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); background: var(--surface); }
textarea { resize: vertical; min-height: 96px; line-height: 1.7; }
.hint { font-size: 12px; color: var(--text-3); margin-top: 5px; }

/* 标签 */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; padding: 2px 8px; border-radius: 999px;
  background: var(--bg-soft); color: var(--text-2);
}
.tag.brand { background: var(--brand-soft); color: var(--brand-deep); }
.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); }

/* 进度条 / 环 */
.bar { height: 7px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width .35s; }
.bar > i.ok { background: var(--ok); }
.bar > i.warn { background: var(--warn); }
.bar > i.err { background: var(--err); }

.ring { --p: 0; --c: var(--brand); width: 108px; height: 108px; position: relative; flex: none; }
.ring::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--bg-soft) 0);
  mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 calc(100% - 9px));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 calc(100% - 9px));
}
.ring .mid {
  position: absolute; inset: 0; display: grid; place-items: center;
  text-align: center; line-height: 1.2;
}
.ring .mid b { font-size: 22px; }
.ring .mid span { font-size: 11px; color: var(--text-3); display: block; }

/* 番茄钟 */
.pomo {
  position: fixed; right: 20px; bottom: 20px; z-index: 35;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 12px 14px; width: 208px;
}
.pomo .t {
  font-family: var(--mono); font-size: 30px; font-weight: 600;
  text-align: center; letter-spacing: 1px; line-height: 1.2;
}
.pomo .t.run { color: var(--brand); }
.pomo .cap { text-align: center; font-size: 11.5px; color: var(--text-3); margin-bottom: 7px; }
.pomo .acts { display: flex; gap: 6px; }
.pomo .acts .btn { flex: 1; padding: 0; }

/* 模块卡片 */
.mod-card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  cursor: pointer; transition: .18s; text-align: left;
  font-family: inherit; color: inherit;
}
.mod-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--brand); }
.mod-card .ic {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; font-size: 18px;
  background: var(--brand-soft); color: var(--brand-deep);
}
.mod-card h3 { margin: 0; font-size: 15px; }
.mod-card p { margin: 0; font-size: 12.5px; color: var(--text-2); line-height: 1.55; }
.mod-card .meta { font-size: 11.5px; color: var(--text-3); margin-top: auto; padding-top: 4px; }

/* 题目 */
.q-stem { font-size: 15px; line-height: 1.75; margin-bottom: 14px; }
.opt {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; margin-bottom: 8px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); cursor: pointer; font-size: 14px;
  transition: .15s; line-height: 1.6;
}
.opt:hover { border-color: var(--brand); }
.opt .k {
  width: 21px; height: 21px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
}
.opt.sel { border-color: var(--brand); background: var(--brand-soft); }
.opt.sel .k { background: var(--brand); border-color: var(--brand); color: #fff; }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.wrong { border-color: var(--err); background: var(--err-soft); }
.passage { font-size: 14.5px; line-height: 1.9; }
.passage p { margin-bottom: .9em; }
.explain {
  margin-top: 12px; padding: 12px 14px;
  background: var(--bg-soft); border-radius: var(--radius-sm);
  font-size: 13.5px; line-height: 1.7; color: var(--text-2);
  border-left: 3px solid var(--brand);
}
.explain b { color: var(--text); }

/* 手写画板 */
.pad-wrap {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); padding: 8px;
}
.pad-tools {
  display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap;
}
#padCanvas, .pad-canvas {
  width: 100%; height: 320px; display: block;
  background: #fff; border-radius: 8px;
  border: 1px dashed var(--border);
  touch-action: none; cursor: crosshair;
}
body.dark .pad-canvas { background: #f7f8fa; }

/* 词卡 */
.word-card {
  min-height: 250px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: 26px 18px;
}
.word-card .w { font-size: 34px; font-weight: 700; letter-spacing: .5px; }
.word-card .ph { font-family: var(--mono); color: var(--text-3); font-size: 13.5px; margin: 4px 0 12px; }
.word-card .mean { font-size: 16px; margin-bottom: 14px; }
.word-card .extra {
  font-size: 13px; color: var(--text-2); line-height: 1.75;
  border-top: 1px dashed var(--border); padding-top: 12px; width: 100%;
}
.reveal-box { display: none; }
.reveal-box.show { display: block; }

/* 热力图 */
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; }
.heat i { width: 12px; height: 12px; border-radius: 3px; background: var(--bg-soft); display: block; }
.heat i[data-l="1"] { background: #cfe6d8; }
.heat i[data-l="2"] { background: #9ed0b3; }
.heat i[data-l="3"] { background: #5fb183; }
.heat i[data-l="4"] { background: #2ea36a; }
body.dark .heat i[data-l="1"] { background: #24402f; }
body.dark .heat i[data-l="2"] { background: #2f5c44; }
body.dark .heat i[data-l="3"] { background: #3d7d59; }
body.dark .heat i[data-l="4"] { background: #48a06e; }
.legend { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-3); margin-top: 8px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; background: var(--bg-soft); display: block; }

/* 列表 */
.list { display: flex; flex-direction: column; gap: 9px; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.list-item .grow { flex: 1; min-width: 0; }
.list-item .ttl { font-size: 14px; font-weight: 550; }
.list-item .dsc { font-size: 12px; color: var(--text-3); }
.empty { text-align: center; padding: 44px 16px; color: var(--text-3); font-size: 13.5px; }
.empty .big { font-size: 34px; margin-bottom: 10px; opacity: .55; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th, table.tbl td {
  text-align: left; padding: 9px 11px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.tbl th { color: var(--text-2); font-weight: 600; font-size: 12.5px; background: var(--surface-2); }
table.tbl tr:last-child td { border-bottom: none; }

/* 视频/资料库条目 */
.res-link {
  display: flex; gap: 12px; align-items: center;
  padding: 12px 13px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-2);
  transition: .15s;
}
.res-link:hover { border-color: var(--brand); background: var(--surface); }
.res-link .thumb {
  width: 46px; height: 34px; border-radius: 7px; flex: none;
  display: grid; place-items: center; font-size: 16px;
  background: var(--brand-soft); color: var(--brand-deep);
}
.res-link .grow { flex: 1; min-width: 0; }
.res-link .ttl { font-size: 14px; font-weight: 550; margin-bottom: 2px; }
.res-link .meta { font-size: 11.5px; color: var(--text-3); display: flex; gap: 8px; flex-wrap: wrap; }
.res-link .go { color: var(--text-3); font-size: 16px; }

/* 消消乐 */
.match-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.match-cell {
  aspect-ratio: 1; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  cursor: pointer; display: grid; place-items: center;
  font-size: 13px; font-weight: 600; text-align: center;
  padding: 4px; line-height: 1.3; transition: .15s; word-break: break-word;
}
.match-cell:hover { border-color: var(--brand); }
.match-cell.open { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-deep); }
.match-cell.gone { opacity: 0; pointer-events: none; transform: scale(.9); }
.match-cell.bad { animation: shake .3s; border-color: var(--err); }

/* Toast */
.toast-wrap {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--text); color: var(--bg);
  padding: 9px 16px; border-radius: 999px; font-size: 13.5px;
  box-shadow: var(--shadow-lg); animation: fade .2s;
  max-width: 88vw;
}

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 20, 30, .45);
  display: none; align-items: center; justify-content: center; z-index: 150; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 520px;
  max-height: 86vh; overflow-y: auto; padding: 22px;
}
.modal h3 { margin-bottom: 12px; }

/* 搜索结果下拉 */
.sr {
  position: absolute; top: 40px; left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  max-height: 320px; overflow-y: auto; display: none; z-index: 50;
}
.sr.show { display: block; }
.sr-item { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.sr-item:last-child { border-bottom: none; }
.sr-item:hover { background: var(--bg-soft); }
.sr-item .k { color: var(--text-3); font-size: 11.5px; }

/* 遮罩（移动端侧栏） */
.sb-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .4);
  z-index: 39; display: none;
}
.sb-mask.show { display: block; }

/* ---------- 响应式：iPad ---------- */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .search { width: 200px; }
}

/* ---------- 响应式：手机 ---------- */
@media (max-width: 820px) {
  :root { --header-h: 54px; }
  .hamburger { display: grid; place-items: center; }
  .sidebar { transform: translateX(-100%); width: 250px; box-shadow: var(--shadow-lg); }
  body.sb-open .sidebar { transform: none; }
  .header { left: 0; padding: 0 14px; }
  .main { margin-left: 0; padding: calc(var(--header-h) + 16px) 14px 100px; }
  .search { display: none; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .grid { gap: 12px; }
  .card { padding: 15px; }
  .pomo { right: 12px; bottom: 12px; left: 12px; width: auto; }
  .word-card .w { font-size: 28px; }
  .match-grid { grid-template-columns: repeat(3, 1fr); }
  h1 { font-size: 20px; }
  .hide-sm { display: none !important; }
}

@media (min-width: 821px) { .only-sm { display: none !important; } }

/* 打印：导出错题 / 生词本 */
@media print {
  .sidebar, .header, .pomo, .gate { display: none !important; }
  .main { margin: 0; padding: 0; }
  body { background: #fff; }
}
/* ==========================================================================
   词汇工坊（wordlab）扩展样式
   覆盖：标签页、拖拽上传、词条选择、对照例句卡、知识库、逐词对照、溯源
   ========================================================================== */

/* ---------- 标签页 ---------- */
.tabs {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin: 4px 0 16px; padding: 5px;
  background: var(--bg-soft); border-radius: 12px;
}
.tab {
  flex: 0 0 auto; padding: 8px 14px; border: 0; cursor: pointer;
  background: transparent; color: var(--text-2);
  font-size: 13.5px; font-weight: 600; border-radius: 9px;
  font-family: inherit; transition: all .16s;
}
.tab:hover { color: var(--text); background: var(--surface); }
.tab.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }

/* ---------- 拖拽上传区 ---------- */
.drop {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 26px 18px; text-align: center; background: var(--surface-2);
  transition: all .18s;
}
.drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop-ico { font-size: 30px; line-height: 1.2; }
.drop-main { font-weight: 700; margin-top: 6px; }
.drop-sub { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }

/* ---------- 材料列表 ---------- */
.wl-docs { display: grid; gap: 10px; }
.wl-doc {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; cursor: pointer; background: var(--surface-2);
  transition: all .16s;
}
.wl-doc:hover { border-color: var(--brand); background: var(--surface); }
.wl-doc.active { border-color: var(--brand); background: var(--brand-soft); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.desc { font-size: 12.5px; color: var(--text-3); margin-top: 3px; }
.tag-fmt {
  font-size: 11px; font-weight: 700; letter-spacing: .3px;
  background: var(--bg-soft); color: var(--text-2);
  padding: 2px 7px; border-radius: 6px; white-space: nowrap;
}
.hint.warn { color: var(--warn); background: var(--warn-soft); border-radius: 8px; padding: 6px 9px; margin-top: 6px; }

/* ---------- 原文预览 ---------- */
.wl-passage, .reader { max-height: 460px; overflow-y: auto; padding-right: 6px; }
.wl-para {
  display: flex; gap: 10px; padding: 7px 8px; border-radius: 8px;
  font-size: 14px; line-height: 1.75; cursor: pointer; transition: background .16s;
}
.wl-para:hover { background: var(--bg-soft); }
.wl-para .para-no {
  flex: 0 0 30px; text-align: right; color: var(--text-3);
  font-family: var(--mono); font-size: 11.5px; padding-top: 4px;
}
.wl-para.flash { background: var(--brand-soft); box-shadow: inset 0 0 0 2px var(--brand); }
.reader .wl-para { cursor: text; }

/* ---------- 选词区 ---------- */
.wl-filter { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.wl-filter input[type=text] {
  flex: 1 1 200px; min-width: 160px; padding: 8px 11px;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--text); font-size: 13.5px; font-family: inherit;
}
.ck { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.ck input[type=checkbox] { width: auto; }
.num, .sel {
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font-size: 12.5px; font-family: inherit;
}
.num { width: 58px; }
.wl-chips { display: flex; flex-wrap: wrap; gap: 7px; max-height: 320px; overflow-y: auto; padding: 4px 2px; }
.chip {
  padding: 5px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font-size: 12.5px; font-family: inherit; transition: all .14s;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip.core::after { content: "★"; font-size: 9px; margin-left: 3px; opacity: .75; }

/* ---------- 例句卡 ---------- */
.wl-group { border-top: 1px solid var(--border); padding: 12px 0 4px; }
.wl-group:first-child { border-top: 0; }
.wl-ghead { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.wl-ghead .big { font-size: 17px; }
.wl-ghead .mono { font-family: var(--mono); font-size: 12px; color: var(--text-3); }
.wl-ghead .mean { font-size: 13px; color: var(--text-2); }
.wl-pair {
  border: 1px solid var(--border); border-left: 3px solid var(--brand);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 9px; background: var(--surface-2);
}
.wl-en { font-size: 14.5px; line-height: 1.7; }
.wl-en mark, mark { background: #fff3bf; color: inherit; padding: 0 2px; border-radius: 3px; }
body.dark .wl-en mark, body.dark mark { background: #6b5a12; }
.wl-cn { font-size: 14px; line-height: 1.7; color: var(--text-2); margin-top: 4px; }
.wl-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 8px; font-size: 11.5px; }
.badge { padding: 2px 7px; border-radius: 999px; font-weight: 600; font-size: 11px; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.brand { background: var(--brand-soft); color: var(--brand-deep); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.mute { background: var(--bg-soft); color: var(--text-3); }
.src { color: var(--brand); cursor: pointer; text-decoration: underline dotted; }
.src.mute { color: var(--text-3); cursor: default; text-decoration: none; }
.mini {
  padding: 3px 8px; font-size: 11.5px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  font-family: inherit;
}
.mini:hover { border-color: var(--brand); color: var(--brand); }
.badge + .badge { margin-left: 0; }

/* ---------- 溯源弹窗 ---------- */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; margin-bottom: 10px; }
.kv .k { color: var(--text-3); }
.kv .v { color: var(--text); }
.trace-box {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px; font-size: 14px; line-height: 1.8;
}
.trace-box mark.hit { background: #ffe08a; box-shadow: 0 0 0 2px #ffe08a; }
body.dark .trace-box mark.hit { background: #7a6410; box-shadow: 0 0 0 2px #7a6410; }

/* ---------- 逐词对照 ---------- */
.gloss { display: flex; flex-wrap: wrap; gap: 6px; }
.g-item {
  display: inline-flex; flex-direction: column; align-items: center;
  border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px;
  background: var(--surface-2); min-width: 54px;
}
.g-item b { font-size: 12.5px; }
.g-item i { font-style: normal; font-size: 11px; color: var(--brand); }
.g-item.unknown i { color: var(--text-3); }

/* ---------- 知识库 ---------- */
.kb-upload { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.kb-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 4px; border-top: 1px solid var(--border);
}
.kb-row:first-child { border-top: 0; }
.kb-ico { font-size: 22px; }
.kb-hit { border-top: 1px solid var(--border); padding: 10px 2px; }
.kb-hit:first-child { border-top: 0; }
.hit-line {
  font-size: 13px; color: var(--text-2); padding: 5px 8px; margin-top: 5px;
  background: var(--surface-2); border-radius: 7px; cursor: pointer; line-height: 1.6;
}
.hit-line:hover { background: var(--brand-soft); }

/* ---------- 自检 ---------- */
.selfcheck { margin-top: 10px; }
.sc-row { display: flex; align-items: center; gap: 9px; padding: 6px 0; font-size: 13.5px; border-top: 1px dashed var(--border); }
.sc-row:first-child { border-top: 0; }
.sc-ico { width: 18px; text-align: center; font-weight: 700; }
.sc-ico.ok { color: var(--ok); }
.sc-ico.no { color: var(--err); }
.sc-line { font-family: var(--mono); font-size: 12px; padding: 3px 0; color: var(--text-2); }

/* ---------- 窄屏适配 ---------- */
@media (max-width: 820px) {
  .tabs { overflow-x: auto; flex-wrap: nowrap; }
  .wl-chips { max-height: 260px; }
  .wl-en { font-size: 14px; }
  .kb-row { flex-wrap: wrap; }
  .wl-filter input[type=text] { flex: 1 1 100%; }
}
