:root {
  --bg: #f3f3f3;
  --panel: #ffffff;
  --panel-soft: #f7f7f7;
  --rail: #f0f0f0;
  --hover: #ececec;
  --ink: #1f1f1f;
  --muted: #616161;
  --line: #dedede;
  --line-strong: #c6c6c6;
  --accent: #1f8f5f;
  --accent-2: #12704a;
  --accent-soft: #e8f5ee;
  --good: #1f8f5f;
  --good-soft: #e8f5ee;
  --bad: #b44343;
  --bad-soft: #fbeceb;
  --warn: #8a6a1f;
  --warn-soft: #fbf3dc;
  --skip: #5d6b63;
  --skip-soft: #eef0ef;
  --overlay: rgba(0, 0, 0, 0.45);
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
  --toast-bg: #1f1f1f;
  --toast-ink: #ffffff;
  --keyhint-bg: #eef6f1;
  --keyhint-line: #cfe0d6;
  --radius: 3px;
  --topbar-h: 56px;
  --page-max: 1440px;
  /* 按练习页解析区左边界推导：≤page-max 时 46vw-3px；≥page-max 时 50vw-60px */
  --agent-drawer-w: max(420px, calc(46vw - 3px));
  --font: "Segoe UI", ui-sans-serif, system-ui, -apple-system, "Microsoft YaHei",
    "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", sans-serif;
  --mono: "Cascadia Code", "SF Mono", Consolas, monospace;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #1c1c1c;
  --panel: #252525;
  --panel-soft: #2d2d2d;
  --rail: #202020;
  --hover: #333333;
  --ink: #e8e8e8;
  --muted: #a3a3a3;
  --line: #3a3a3a;
  --line-strong: #4d4d4d;
  --accent: #6fcf97;
  --accent-2: #9be7b9;
  --accent-soft: #24382d;
  --good: #6fcf97;
  --good-soft: #22352a;
  --bad: #f08a8a;
  --bad-soft: #3a2222;
  --warn: #e6c36a;
  --warn-soft: #3a321f;
  --skip: #a8b0ac;
  --skip-soft: #2f3532;
  --overlay: rgba(0, 0, 0, 0.7);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  --toast-bg: #e8e8e8;
  --toast-ink: #1c1c1c;
  --keyhint-bg: #2b3a30;
  --keyhint-line: #46564b;
  color-scheme: dark;
}

/* ---------- themes (5 light / 5 dark) ---------- */

[data-theme-id="light-paper"] {
  --bg: #f3f3f3;
  --panel: #ffffff;
  --panel-soft: #f7f7f7;
  --rail: #f0f0f0;
  --hover: #ececec;
  --ink: #1f1f1f;
  --muted: #616161;
  --line: #dedede;
  --line-strong: #c6c6c6;
  --accent: #1f8f5f;
  --accent-2: #12704a;
  --accent-soft: #e8f5ee;
  --good: #1f8f5f;
  --good-soft: #e8f5ee;
  --bad: #b44343;
  --bad-soft: #fbeceb;
  --warn: #8a6a1f;
  --warn-soft: #fbf3dc;
  --skip: #5d6b63;
  --skip-soft: #eef0ef;
  --overlay: rgba(0, 0, 0, 0.45);
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
  --toast-bg: #1f1f1f;
  --toast-ink: #ffffff;
  --keyhint-bg: #eef6f1;
  --keyhint-line: #cfe0d6;
}

[data-theme-id="light-mist"] {
  --bg: #e1eaf4;
  --panel: #eef4fb;
  --panel-soft: #e5edf7;
  --rail: #e9f1f9;
  --hover: #d9e5f2;
  --ink: #1d2633;
  --muted: #5c6b7d;
  --line: #cbd9e8;
  --line-strong: #b0c3d5;
  --accent: #2f6fb0;
  --accent-2: #22578c;
  --accent-soft: #dfecfa;
  --good: #2f7d5c;
  --good-soft: #e3f2ea;
  --bad: #b54a4a;
  --bad-soft: #fbecec;
  --warn: #8a6a1f;
  --warn-soft: #fbf3dc;
  --skip: #5f6b78;
  --skip-soft: #eef1f4;
  --overlay: rgba(15, 23, 42, 0.45);
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  --toast-bg: #1d2633;
  --toast-ink: #ffffff;
  --keyhint-bg: #e1eefb;
  --keyhint-line: #c2d8ee;
}

[data-theme-id="light-sand"] {
  --bg: #f2e7d3;
  --panel: #fbf5e8;
  --panel-soft: #f5ebd8;
  --rail: #f8f0df;
  --hover: #eddfc7;
  --ink: #2b2620;
  --muted: #6f6457;
  --line: #e0d0b6;
  --line-strong: #cbb798;
  --accent: #9a6b2f;
  --accent-2: #7a5220;
  --accent-soft: #f6ead6;
  --good: #3f7d57;
  --good-soft: #e6f2ea;
  --bad: #ad4b3f;
  --bad-soft: #f9e9e5;
  --warn: #8a6a1f;
  --warn-soft: #fbf3dc;
  --skip: #6d655b;
  --skip-soft: #f1ece4;
  --overlay: rgba(43, 38, 32, 0.45);
  --shadow: 0 10px 28px rgba(43, 38, 32, 0.16);
  --toast-bg: #2b2620;
  --toast-ink: #ffffff;
  --keyhint-bg: #f8eedc;
  --keyhint-line: #e2cfb3;
}

[data-theme-id="light-mint"] {
  --bg: #e4efe8;
  --panel: #f0f9f4;
  --panel-soft: #e4f2ea;
  --rail: #e9f6ef;
  --hover: #d9ece2;
  --ink: #1b2a24;
  --muted: #5a6f64;
  --line: #cde2d6;
  --line-strong: #b0ccbd;
  --accent: #1a7d5e;
  --accent-2: #146d50;
  --accent-soft: #ddf0e7;
  --good: #1f8f6b;
  --good-soft: #e1f4eb;
  --bad: #b04a4a;
  --bad-soft: #fbecec;
  --warn: #8a6a1f;
  --warn-soft: #fbf3dc;
  --skip: #5d6b63;
  --skip-soft: #edf2ef;
  --overlay: rgba(19, 45, 35, 0.45);
  --shadow: 0 10px 28px rgba(19, 45, 35, 0.15);
  --toast-bg: #16241e;
  --toast-ink: #ffffff;
  --keyhint-bg: #e3f4ec;
  --keyhint-line: #c0ddcf;
}

[data-theme-id="light-rose"] {
  --bg: #f3e2e7;
  --panel: #fcf0f2;
  --panel-soft: #f7e3e8;
  --rail: #faebee;
  --hover: #efdce3;
  --ink: #2c2226;
  --muted: #75636a;
  --line: #e5ced6;
  --line-strong: #d0b2bc;
  --accent: #a64b63;
  --accent-2: #85384d;
  --accent-soft: #f7e3ea;
  --good: #3f7d5c;
  --good-soft: #e6f2ea;
  --bad: #b44343;
  --bad-soft: #fbeceb;
  --warn: #8a6a1f;
  --warn-soft: #fbf3dc;
  --skip: #6d6267;
  --skip-soft: #f2eaed;
  --overlay: rgba(44, 34, 38, 0.45);
  --shadow: 0 10px 28px rgba(44, 34, 38, 0.15);
  --toast-bg: #2c2226;
  --toast-ink: #ffffff;
  --keyhint-bg: #f8e6ec;
  --keyhint-line: #e6cad4;
}

[data-theme-id="light-peach"] {
  --bg: #f5e2d0;
  --panel: #fdf4ec;
  --panel-soft: #f8e8da;
  --rail: #fbefe4;
  --hover: #f1dac8;
  --ink: #2d211b;
  --muted: #7a6559;
  --line: #e8cfbb;
  --line-strong: #d4b59d;
  --accent: #b0522a;
  --accent-2: #8a3d1f;
  --accent-soft: #fae3d4;
  --good: #3f7d57;
  --good-soft: #e6f2ea;
  --bad: #b44343;
  --bad-soft: #fbeceb;
  --warn: #8a6a1f;
  --warn-soft: #fbf3dc;
  --skip: #6d5f57;
  --skip-soft: #f3eae2;
  --overlay: rgba(45, 33, 27, 0.45);
  --shadow: 0 10px 28px rgba(45, 33, 27, 0.16);
  --toast-bg: #2d211b;
  --toast-ink: #ffffff;
  --keyhint-bg: #fae5d6;
  --keyhint-line: #eac8b3;
}

[data-theme-id="dark-graphite"] {
  --bg: #1c1c1c;
  --panel: #252525;
  --panel-soft: #2d2d2d;
  --rail: #202020;
  --hover: #333333;
  --ink: #e8e8e8;
  --muted: #a3a3a3;
  --line: #3a3a3a;
  --line-strong: #4d4d4d;
  --accent: #6fcf97;
  --accent-2: #9be7b9;
  --accent-soft: #24382d;
  --good: #6fcf97;
  --good-soft: #22352a;
  --bad: #f08a8a;
  --bad-soft: #3a2222;
  --warn: #e6c36a;
  --warn-soft: #3a321f;
  --skip: #a8b0ac;
  --skip-soft: #2f3532;
  --overlay: rgba(0, 0, 0, 0.7);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  --toast-bg: #e8e8e8;
  --toast-ink: #1c1c1c;
  --keyhint-bg: #2b3a30;
  --keyhint-line: #46564b;
}

[data-theme-id="dark-midnight"] {
  --bg: #121924;
  --panel: #1a2433;
  --panel-soft: #202c3d;
  --rail: #151f2c;
  --hover: #26364b;
  --ink: #e3eaf3;
  --muted: #93a4b8;
  --line: #2b3a4d;
  --line-strong: #40536a;
  --accent: #5aa7e8;
  --accent-2: #8cc8f5;
  --accent-soft: #1c3348;
  --good: #5fd0a0;
  --good-soft: #1b3a30;
  --bad: #f08a8a;
  --bad-soft: #3a2228;
  --warn: #e6c36a;
  --warn-soft: #3a321f;
  --skip: #9faab8;
  --skip-soft: #26313f;
  --overlay: rgba(0, 0, 0, 0.72);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  --toast-bg: #e3eaf3;
  --toast-ink: #121924;
  --keyhint-bg: #1e3248;
  --keyhint-line: #34506b;
}

[data-theme-id="dark-forest"] {
  --bg: #121b17;
  --panel: #1a2621;
  --panel-soft: #202e28;
  --rail: #151f1b;
  --hover: #2a3b33;
  --ink: #e1ebe5;
  --muted: #93a89c;
  --line: #2b3b33;
  --line-strong: #40564a;
  --accent: #6fcf97;
  --accent-2: #a3e8bd;
  --accent-soft: #223a2d;
  --good: #6fcf97;
  --good-soft: #223a2d;
  --bad: #e38b8b;
  --bad-soft: #3a2424;
  --warn: #e0c06a;
  --warn-soft: #3a321f;
  --skip: #9faea5;
  --skip-soft: #26332c;
  --overlay: rgba(0, 0, 0, 0.72);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  --toast-bg: #e1ebe5;
  --toast-ink: #121b17;
  --keyhint-bg: #223a2d;
  --keyhint-line: #3d5a49;
}

[data-theme-id="dark-wine"] {
  --bg: #1b1215;
  --panel: #261a1e;
  --panel-soft: #2e2025;
  --rail: #1f1519;
  --hover: #3a2a30;
  --ink: #f0e3e7;
  --muted: #b39aa3;
  --line: #3e2b32;
  --line-strong: #5a414a;
  --accent: #e08aa3;
  --accent-2: #f2b3c6;
  --accent-soft: #3a222b;
  --good: #6fcf97;
  --good-soft: #22352a;
  --bad: #f08a8a;
  --bad-soft: #3a2222;
  --warn: #e6c36a;
  --warn-soft: #3a321f;
  --skip: #b3a3a9;
  --skip-soft: #33272c;
  --overlay: rgba(0, 0, 0, 0.72);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  --toast-bg: #f0e3e7;
  --toast-ink: #1b1215;
  --keyhint-bg: #3a222b;
  --keyhint-line: #5c3b47;
}

[data-theme-id="dark-dusk"] {
  --bg: #17151f;
  --panel: #211e2b;
  --panel-soft: #292536;
  --rail: #1a1724;
  --hover: #332e42;
  --ink: #e9e5f2;
  --muted: #a79fb7;
  --line: #353043;
  --line-strong: #4d455f;
  --accent: #b39ddb;
  --accent-2: #d0c1ee;
  --accent-soft: #2c2740;
  --good: #6fcf97;
  --good-soft: #22352a;
  --bad: #f08a8a;
  --bad-soft: #3a2228;
  --warn: #e6c36a;
  --warn-soft: #3a321f;
  --skip: #aaa4b5;
  --skip-soft: #2c2937;
  --overlay: rgba(0, 0, 0, 0.72);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  --toast-bg: #e9e5f2;
  --toast-ink: #17151f;
  --keyhint-bg: #2c2740;
  --keyhint-line: #494065;
}
[data-theme-id="dark-teal"] {
  --bg: #0f1a1c;
  --panel: #172629;
  --panel-soft: #1d2f33;
  --rail: #122022;
  --hover: #263b3f;
  --ink: #dfecee;
  --muted: #93aeb3;
  --line: #293e42;
  --line-strong: #3d575c;
  --accent: #57c7c9;
  --accent-2: #8fe4e4;
  --accent-soft: #1b383b;
  --good: #6fcf97;
  --good-soft: #22352a;
  --bad: #f08a8a;
  --bad-soft: #3a2222;
  --warn: #e6c36a;
  --warn-soft: #3a321f;
  --skip: #9fb7ba;
  --skip-soft: #25383b;
  --overlay: rgba(0, 0, 0, 0.72);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  --toast-bg: #dfecee;
  --toast-ink: #0f1a1c;
  --keyhint-bg: #1b383b;
  --keyhint-line: #31565a;
}

/* ---------- brand tokens ---------- */
:root {
  --brand-tile: #1a583f;
  --brand-accent: #c7e3d7;
}

[data-theme-id="light-paper"] {
  --brand-tile: #1a583f;
  --brand-accent: #c7e3d7;
}
[data-theme-id="light-mist"] {
  --brand-tile: #25476a;
  --brand-accent: #cbdbeb;
}
[data-theme-id="light-sand"] {
  --brand-tile: #5e4424;
  --brand-accent: #e6dacb;
}
[data-theme-id="light-mint"] {
  --brand-tile: #1c5643;
  --brand-accent: #c6ded7;
}
[data-theme-id="light-rose"] {
  --brand-tile: #653341;
  --brand-accent: #e9d2d8;
}
[data-theme-id="light-peach"] {
  --brand-tile: #683623;
  --brand-accent: #ebd4ca;
}
[data-theme-id="dark-graphite"] {
  --brand-tile: #32443a;
  --brand-accent: #6fcf97;
}
[data-theme-id="dark-midnight"] {
  --brand-tile: #263c54;
  --brand-accent: #5aa7e8;
}
[data-theme-id="dark-forest"] {
  --brand-tile: #294436;
  --brand-accent: #6fcf97;
}
[data-theme-id="dark-wine"] {
  --brand-tile: #472e36;
  --brand-accent: #e08aa3;
}
[data-theme-id="dark-dusk"] {
  --brand-tile: #3b354b;
  --brand-accent: #b39ddb;
}
[data-theme-id="dark-teal"] {
  --brand-tile: #234346;
  --brand-accent: #57c7c9;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

#app {
  flex: 1 0 auto;
}

/* 首屏 JS 还没渲染时不要把页脚顶到页面顶部；渲染出内容后自动恢复。 */
#app:empty + .site-footer {
  visibility: hidden;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--accent);
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.skip-link {
  position: absolute;
  left: 10px;
  top: -60px;
  z-index: 200;
  padding: 7px 12px;
  background: var(--ink);
  color: var(--bg);
}

.skip-link:focus {
  top: 10px;
}

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.boot-mark {
  padding: 18px 22px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
}

/* ---------- primitives ---------- */

.muted {
  color: var(--muted);
}

.hint {
  font-size: 11.5px;
  color: var(--muted);
}

.head-sub {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

[data-theme="dark"] .btn-primary {
  color: #0b1512;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-2);
}

.btn-soft {
  background: var(--accent-soft);
  color: var(--accent-2);
  border-color: var(--line);
}

.btn-soft:hover:not(:disabled) {
  background: var(--hover);
}

.btn-ghost {
  color: var(--muted);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--panel-soft);
  color: var(--ink);
}

.btn-danger {
  background: var(--bad-soft);
  color: var(--bad);
}

.btn-sm {
  min-height: 28px;
  padding: 3px 8px;
  font-size: 12px;
}

.btn-lg {
  min-height: 40px;
  padding: 9px 16px;
  font-size: 14px;
}

.icon-btn {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel);
  color: var(--muted);
}

.icon-btn:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--panel-soft);
}

.icon-btn.tiny {
  width: 26px;
  height: 26px;
  border-color: transparent;
  background: transparent;
}

.icon-btn.tiny.is-active {
  color: var(--accent);
  background: var(--accent-soft);
}

.text-btn {
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.text-btn:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.back-link:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.6;
  white-space: nowrap;
}

.tag-accent {
  border-color: var(--line);
  background: var(--accent-soft);
  color: var(--accent-2);
}

.badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 2px;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
}

.badge-all {
  border-color: var(--line-strong);
  color: var(--ink);
}

.badge-preset {
  background: var(--accent-soft);
  color: var(--accent-2);
  border-color: transparent;
}

.badge-custom {
  background: var(--good-soft);
  color: var(--good);
  border-color: transparent;
}

.badge-default {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: transparent;
}

.badge-child {
  background: var(--skip-soft);
  color: var(--skip);
  border-color: transparent;
}

.kw-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  padding: 1px 5px;
  border: 1px solid var(--keyhint-line);
  border-radius: 2px;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-size: 10.5px;
  line-height: 1.6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kw-chip button {
  display: inline-grid;
  place-items: center;
  width: 14px;
  height: 14px;
  padding: 0;
  border: none;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
}

.kw-chip button:hover {
  background: var(--bad-soft);
  color: var(--bad);
}

.kw-more {
  background: var(--panel-soft);
  color: var(--muted);
}

.kw-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 24px;
}

.kw-add-row {
  display: flex;
  gap: 6px;
}

.kw-add-row input {
  flex: 1;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel);
  color: var(--ink);
  font-size: 12.5px;
  outline: none;
}

.kw-add-row input:focus {
  border-color: var(--accent);
}

.manual-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 4px;
  border-radius: 2px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 9.5px;
  line-height: 1.6;
}

.warn-text {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--warn);
  font-style: normal;
}

.mark-on {
  display: inline-flex;
  color: var(--accent);
  vertical-align: middle;
  margin-right: 2px;
}

.danger-text {
  color: var(--bad);
}

.keyhint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  margin-left: 6px;
  border: 1px solid var(--keyhint-line);
  border-radius: 3px;
  background: var(--keyhint-bg);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  line-height: 1;
  white-space: nowrap;
  vertical-align: middle;
}

kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--keyhint-line);
  border-radius: 2px;
  background: var(--keyhint-bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
  white-space: nowrap;
}

/* ---------- shell / topbar ---------- */

.page-shell {
  min-height: 100vh;
  background: var(--panel);
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 14px;
  padding: 18px 24px 22px;
  border-top: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.site-footer-sep {
  color: var(--line);
}

body.is-immersive .site-footer {
  display: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 20px;
  height: var(--topbar-h);
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  flex: none;
}

.brand-logo {
  position: relative;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 3px;
  overflow: hidden;
}

[data-theme="light"] .brand-logo {
  background: var(--brand-tile);
}

.brand-logo img {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.brand-green {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  shape-rendering: crispEdges;
}

.brand-green .g0 {
  fill: var(--brand-accent);
  fill: color-mix(in srgb, var(--brand-accent) 65%, #101614);
}
.brand-green .g1 {
  fill: var(--brand-accent);
}
.brand-green .g2 {
  fill: var(--brand-accent);
  fill: color-mix(in srgb, var(--brand-accent) 82%, #fff);
}
.brand-green .g3 {
  fill: var(--brand-accent);
  fill: color-mix(in srgb, var(--brand-accent) 62%, #fff);
}
.brand-green .g4 {
  fill: var(--brand-accent);
  fill: color-mix(in srgb, var(--brand-accent) 42%, #fff);
}
.brand-green .g5 {
  fill: var(--brand-accent);
  fill: color-mix(in srgb, var(--brand-accent) 25%, #fff);
}

@font-face {
  font-family: "Fusion Pixel Brand";
  src: url("brand/fonts/fusion-pixel-4chars.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

.brand-text strong {
  display: block;
  font-family: "Fusion Pixel Brand", var(--font);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.25;
}

.brand-text small {
  display: block;
  font-size: 10px;
  color: var(--muted);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.topnav a {
  padding: 6px 10px;
  border-radius: 3px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}

.topnav a:hover {
  background: var(--panel-soft);
  color: var(--ink);
}

.topnav a.is-active {
  background: var(--accent-soft);
  color: var(--accent-2);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-main {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 20px 24px 64px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 14px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.page-head h1 {
  font-size: clamp(19px, 2vw, 24px);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.head-left {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 0;
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.notice-line {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 8px 10px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
}

.state-panel {
  max-width: 600px;
  margin: 8vh auto 0;
  padding: 24px;
  border: 1px solid var(--line);
  background: var(--panel);
  text-align: center;
}

.state-panel h1,
.state-panel h2 {
  margin: 4px 0 6px;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.state-panel p {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

.state-icon {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 6px;
  border: 1px solid var(--line);
  color: var(--accent);
  background: var(--accent-soft);
}

.error-detail {
  margin: 8px 0 12px;
  text-align: left;
  color: var(--muted);
  font-size: 11.5px;
}

.error-detail summary {
  cursor: pointer;
  color: var(--accent);
}

.error-detail pre {
  max-height: 220px;
  overflow: auto;
  margin: 6px 0 0;
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------- progress ---------- */

.seg-bar {
  display: flex;
  height: 6px;
  margin: 8px 0 6px;
  background: var(--line);
  overflow: hidden;
}

.seg {
  display: block;
  height: 100%;
}

.seg-correct {
  background: var(--good);
}

.seg-wrong {
  background: var(--bad);
}

.seg-skipped {
  background: var(--warn);
}

.seg-unseen {
  background: var(--line-strong);
  opacity: 0.45;
}

.count-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.count-inline.good {
  color: var(--good);
}

.count-inline.bad {
  color: var(--bad);
}

.count-inline.skip {
  color: var(--skip);
}

.status-chip {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
}

.status-unseen {
  background: var(--panel-soft);
  color: var(--muted);
  border: 1px solid var(--line);
}

.status-correct {
  background: var(--good-soft);
  color: var(--good);
}

.status-wrong {
  background: var(--bad-soft);
  color: var(--bad);
}

.status-skipped {
  background: var(--skip-soft);
  color: var(--skip);
}

/* ---------- workspace ---------- */

.workspace {
  display: grid;
  grid-template-columns: 262px minmax(0, 1fr);
  max-width: 1680px;
  margin: 0 auto;
  min-height: calc(100vh - var(--topbar-h));
}

.bank-rail {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 10px;
  background: var(--rail);
  border-right: 1px solid var(--line);
}

.bank-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 6px 10px;
  border-bottom: 1px solid var(--line);
}

.bank-rail-head strong {
  display: block;
  font-size: 13px;
}

.bank-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bank-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 8px;
  border-left: 2px solid transparent;
  border-radius: 3px;
  color: var(--ink);
}

.bank-item:hover {
  background: var(--panel);
}

.bank-item.is-active {
  background: var(--panel);
  border-left-color: var(--accent);
}

.bank-item-main {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.bank-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 600;
}

.bank-item-meta {
  padding-left: 2px;
  color: var(--muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.bank-rail-foot {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.rail-link {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  color: var(--muted);
  font-size: 12px;
  border-radius: 3px;
}

.rail-link:hover {
  background: var(--panel);
  color: var(--ink);
}

.bank-rail-foot .hint {
  padding: 6px 4px 0;
  line-height: 1.5;
}

.workspace-main {
  min-width: 0;
  padding: 16px 20px 72px;
}

.workspace-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.workspace-title h1 {
  margin-top: 2px;
  font-size: clamp(19px, 2vw, 25px);
  letter-spacing: -0.02em;
}

.workspace-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.workspace-hint {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 11.5px;
}

.seq-list {
  border: 1px solid var(--line);
  background: var(--panel);
}

.seq-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px minmax(170px, auto) auto;
  gap: 8px 14px;
  align-items: center;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}

.seq-row:last-child {
  border-bottom: none;
}

.seq-row:hover {
  background: var(--hover);
}

.seq-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  color: var(--ink);
}

.seq-name-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.seq-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 650;
}

.seq-meta {
  color: var(--muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.seq-branch {
  display: inline-flex;
  color: var(--muted);
  flex: none;
}

.seq-progress .seg-bar {
  margin: 0;
}

.seq-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.seq-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
}

.seq-depth-1 {
  padding-left: 32px;
  background: var(--panel-soft);
}

.seq-depth-2 {
  padding-left: 52px;
  background: var(--panel-soft);
}

.seq-depth-3 {
  padding-left: 72px;
  background: var(--panel-soft);
}

.children-panel {
  border: 1px solid var(--line);
  margin-bottom: 12px;
  background: var(--panel);
}

.children-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.children-head > div {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.children-head strong {
  font-size: 12.5px;
}

.children-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 11.5px;
}

.child-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px auto;
  gap: 6px 12px;
  align-items: center;
  padding: 9px 12px;
  border-bottom: 1px dashed var(--line);
}

.child-row:last-child {
  border-bottom: none;
}

.child-main {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--ink);
}

.child-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 600;
}

.child-progress .seg-bar {
  margin: 0;
  height: 4px;
}

.child-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
}

.child-depth-1 {
  padding-left: 34px;
  background: var(--panel-soft);
}

.child-depth-2 {
  padding-left: 54px;
  background: var(--panel-soft);
}

/* ---------- tables ---------- */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--panel);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  background: var(--panel);
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: var(--hover);
}

.data-table .strong {
  font-weight: 650;
}

.data-table .num {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.muted-cell {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11.5px;
}

.col-actions {
  text-align: right;
  white-space: nowrap;
}

.col-actions .btn + .btn,
.col-actions .btn + .icon-btn {
  margin-left: 4px;
}

.bank-q-table .col-check,
.q-table .col-check {
  width: 30px;
  text-align: center;
}

.bank-q-table .col-index,
.q-table .col-index {
  width: 36px;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.bank-q-table .col-type,
.q-table .col-type {
  width: 72px;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

.bank-q-table .col-source {
  width: 150px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.bank-q-table .col-core {
  width: 230px;
}

.bank-q-table .col-keywords {
  width: 190px;
}

.core-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding-left: 6px;
  border-left: 2px solid var(--accent);
  color: var(--ink);
  font-size: 11.5px;
  line-height: 1.5;
}

.kw-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.bank-q-table .col-flags,
.bank-q-table .col-note {
  width: 76px;
  white-space: nowrap;
}

.q-table .col-status {
  width: 78px;
  white-space: nowrap;
}

.q-table .col-stem {
  min-width: 260px;
}

.q-table .col-marks {
  width: 78px;
  white-space: nowrap;
}

.q-table .col-open {
  width: 30px;
  color: var(--line-strong);
}

.q-table tbody tr,
.bank-q-table tbody tr {
  cursor: pointer;
}

.q-table tbody tr.is-selected,
.bank-q-table tbody tr.is-selected {
  background: var(--accent-soft);
}

.stem-text {
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.row-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 10px;
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--muted);
}

.row-keywords {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
}

.check-box {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--panel);
  color: #fff;
  vertical-align: middle;
}

[data-theme="dark"] .check-box {
  color: #0b1512;
}

.check-box.is-checked {
  border-color: var(--accent);
  background: var(--accent);
}

.empty-cell {
  padding: 28px 10px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.table-note {
  padding: 7px 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

/* ---------- filters ---------- */

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 10px 0 8px;
  flex-wrap: wrap;
}

.filter-scroll {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-scroll::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.filter-btn b {
  margin-left: 2px;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.filter-btn:hover {
  background: var(--panel-soft);
  color: var(--ink);
}

.filter-btn.is-active {
  border-color: var(--line);
  background: var(--accent-soft);
  color: var(--accent-2);
}

.filter-btn.is-active b {
  color: var(--accent);
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search-box {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel);
  color: var(--muted);
}

.search-box input {
  width: 170px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 11.5px;
}

.type-select {
  min-height: 28px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel);
  color: var(--ink);
  font-size: 11.5px;
}

/* ---------- detail status / guidance ---------- */

.status-panel {
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  margin-bottom: 8px;
}

.status-panel .seg-bar {
  margin: 0 0 6px;
}

.status-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.status-progress {
  margin-left: auto;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.guide-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  background: var(--panel-soft);
  font-size: 12.5px;
  color: var(--muted);
}

.guide-line.warn {
  border-left-color: var(--warn);
  background: var(--warn-soft);
  color: var(--warn);
}

.guide-line b {
  color: var(--ink);
}

.guide-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ---------- action bar ---------- */

.has-selection {
  padding-bottom: 104px;
}

.action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  border-top: 1px solid var(--line);
  background: var(--panel);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
}

.action-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 1680px;
  margin: 0 auto;
  padding: 8px 16px;
}

.action-summary {
  display: flex;
  flex-direction: column;
  min-width: 125px;
  flex: none;
}

.action-summary strong {
  font-size: 12.5px;
}

.action-summary span {
  font-size: 10.5px;
  color: var(--muted);
}

.action-scroll {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.action-scroll::-webkit-scrollbar {
  display: none;
}

.action-label {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.action-divider {
  width: 1px;
  height: 18px;
  background: var(--line);
  margin: 0 2px;
}

/* ---------- practice ---------- */

.practice-shell {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 22px 108px;
}

.practice-head {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: center;
  padding: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.practice-head-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.practice-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.practice-title h1 {
  font-size: 14px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.practice-title span {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.version-chip {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  border-radius: 2px;
  padding: 1px 6px;
  font-size: 10px;
  line-height: 16px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.version-chip:hover { border-color: var(--accent); color: var(--accent-2); }
.version-list { display: grid; gap: 6px; }
.version-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  padding: 8px 10px;
  background: var(--panel);
}
.version-row.is-default { border-color: var(--accent); background: var(--accent-soft); }
.version-row strong { font-size: 12px; }

.practice-head-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.practice-counts {
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.practice-progress {
  grid-column: 1 / -1;
}

.practice-progress .seg-bar {
  height: 4px;
  margin: 0;
}

.practice-main {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(330px, 0.92fr);
  gap: 10px;
  align-items: start;
}

.question-pane,
.result-pane {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
}

.question-pane {
  padding: 20px 20px 16px;
}

.q-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-bottom: 10px;
}

.q-keywords {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 4px;
  margin-left: 4px;
}

.q-stem {
  font-size: clamp(18px, 1.7vw, 21px);
  line-height: 1.65;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: pre-wrap;
}

.blank {
  display: inline-block;
  min-width: 2.6em;
  height: 0.9em;
  border-bottom: 1px solid var(--line-strong);
  vertical-align: -0.05em;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 16px;
}

.option-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel);
  text-align: left;
  line-height: 1.55;
  touch-action: manipulation;
  user-select: none;
  -webkit-touch-callout: none;
  transition: border-color 0.1s, background 0.1s, opacity 0.1s;
}

.option:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--hover);
}

.option.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.option.is-correct {
  border-color: var(--good);
  background: var(--good-soft);
  box-shadow: inset 0 0 0 1px var(--good);
}

.option.is-wrong {
  border-color: var(--bad);
  background: var(--bad-soft);
  box-shadow: inset 0 0 0 1px var(--bad);
}

.option.is-missed {
  border-style: dashed;
  border-color: var(--good);
}

.option.is-dim {
  opacity: 0.5;
}

.option-letter {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.option.is-selected .option-letter {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

[data-theme="dark"] .option.is-selected .option-letter {
  color: #0b1512;
}

.option.is-correct .option-letter {
  border-color: var(--good);
  background: var(--good);
  color: #fff;
}

[data-theme="dark"] .option.is-correct .option-letter {
  color: #0b1512;
}

.option.is-wrong .option-letter {
  border-color: var(--bad);
  background: var(--bad);
  color: #fff;
}

.option.is-missed .option-letter {
  border-color: var(--good);
  background: var(--good-soft);
  color: var(--good);
}

.option-text {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.option-mark {
  min-width: 16px;
  padding-top: 2px;
  color: var(--muted);
}

.option.is-correct .option-mark,
.option.is-missed .option-mark {
  color: var(--good);
}

.option.is-wrong .option-mark {
  color: var(--bad);
}

.option.is-locked {
  cursor: default;
}

.option.is-excluded {
  opacity: 0.55;
  border-style: dashed;
}

.option.is-excluded .option-text {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.option-analysis-hint {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: none;
  padding-top: 3px;
  color: var(--accent-2);
  font-size: 10.5px;
  white-space: nowrap;
}

.option-block.is-open .option {
  border-color: var(--accent);
}

.option-analysis {
  margin: 0 0 4px 36px;
  padding: 8px 10px;
  border-left: 2px solid var(--accent);
  background: var(--panel-soft);
  font-size: 12.5px;
  line-height: 1.65;
}

.option-analysis p:last-child {
  margin-bottom: 0;
}

.option-analysis h2,
.option-analysis h3,
.option-analysis h4,
.option-analysis h5,
.option-analysis h6 {
  margin: 8px 0 4px;
  font-size: 12.5px;
  color: var(--accent-2);
}

.option-analysis ul,
.option-analysis ol {
  margin: 0 0 6px;
  padding-left: 1.2em;
}

.q-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 11.5px;
}

.link-btn:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auto-note {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent);
  font-size: 11.5px;
}

.auto-note button {
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 11.5px;
  text-decoration: underline;
}

.result-pane {
  padding: 16px 18px;
  min-height: 160px;
}

.result-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 260px;
  text-align: center;
  color: var(--muted);
}

.placeholder-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  margin-bottom: 2px;
}

.result-placeholder strong {
  color: var(--ink);
  font-size: 13.5px;
}

.result-placeholder p {
  max-width: 30ch;
  font-size: 11.5px;
}

.verdict {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.verdict-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: none;
  border: 1px solid transparent;
}

.verdict.is-good .verdict-icon {
  background: var(--good-soft);
  color: var(--good);
}

.verdict.is-bad .verdict-icon {
  background: var(--bad-soft);
  color: var(--bad);
}

.verdict strong {
  font-size: 13.5px;
}

.verdict p {
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--muted);
}

.conflict-line {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  margin-top: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 11.5px;
}

.shuffle-note {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  margin-top: 8px;
  padding: 6px 8px;
  border-left: 2px solid var(--accent);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 11.5px;
}

.tag.level { border-style: dashed; }
.tag.level.unknown { opacity: .65; }
.tag.level.l4 { border-color: var(--ok, #2f7d4f); }
.tag.level.l3 { border-color: var(--accent, #4a7); }
.tag.level.l2 { border-color: var(--warn, #b8873a); }
.tag.level.l1 { border-color: var(--danger, #b04a4a); }

.core-point {
  margin: 10px 0;
  padding: 8px 10px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
}

.core-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 3px;
  color: var(--accent-2);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.core-point p {
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.65;
}

.analysis {
  padding-top: 10px;
  font-size: 14px;
  line-height: 1.7;
}

.analysis h2,
.analysis h3,
.analysis h4,
.analysis h5,
.analysis h6 {
  margin: 16px 0 6px;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 700;
  color: var(--accent-2);
}

.analysis h2 {
  font-size: 15.5px;
}

.analysis h4 {
  font-size: 13px;
}

/* 专有词只作中性标记：正文色 + 中性虚线，hover 才出现强调色。
   术语密集时不会把整段染成强调色，也不与解析标题抢视线；
   只用主题已有的 ink/line-strong 两档，12 套配色无需单独调色。 */
.term {
  border-bottom: 1px dashed var(--line-strong);
  color: inherit;
  cursor: help;
  transition: color 120ms ease, border-color 120ms ease;
}

.term:hover {
  border-bottom-color: var(--accent);
  color: var(--accent);
}

.term-summary {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12.5px;
}

.term-analysis {
  padding-top: 0;
}

.analysis p {
  margin: 0 0 8px;
}

.analysis ul,
.analysis ol {
  margin: 0 0 9px;
  padding-left: 1.25em;
}

.analysis li {
  margin: 2px 0;
}

.analysis blockquote {
  margin: 8px 0;
  padding: 6px 10px;
  border-left: 2px solid var(--line-strong);
  background: var(--panel-soft);
  color: var(--muted);
}

.analysis code {
  padding: 1px 3px;
  background: var(--panel-soft);
  font-family: var(--mono);
  font-size: 0.9em;
}

.md-table {
  overflow-x: auto;
  margin: 8px 0 12px;
  border: 1px solid var(--line);
}

.analysis table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
}

.analysis th,
.analysis td {
  padding: 5px 7px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.analysis th {
  background: var(--panel-soft);
}

.analysis tr:last-child td {
  border-bottom: none;
}

.answer-note {
  margin-top: 8px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  background: var(--warn-soft);
  font-size: 12px;
}

.answer-note strong {
  display: block;
  margin-bottom: 2px;
  font-size: 10.5px;
  color: var(--warn);
}

.answer-note p:last-child {
  margin-bottom: 0;
}

.preview-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preview-stem {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
}

.preview-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.preview-option-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.preview-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel-soft);
  font-size: 12.5px;
  line-height: 1.5;
  cursor: pointer;
}

.preview-option.is-correct {
  border-color: var(--good);
  background: var(--good-soft);
}

.preview-option .option-letter {
  width: 22px;
  height: 22px;
  font-size: 10px;
}

.preview-option-analysis {
  margin-left: 28px;
  font-size: 12px;
}

.preview-option-analysis summary {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  color: var(--accent-2);
  font-size: 10.5px;
  list-style: none;
}

.preview-option-analysis summary::-webkit-details-marker {
  display: none;
}

.preview-option-analysis .analysis {
  padding-top: 4px;
  font-size: 12px;
}

.preview-answer {
  padding: 6px 8px;
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  font-size: 12.5px;
}

.preview-answer strong {
  display: block;
  margin-bottom: 2px;
  color: var(--accent-2);
  font-size: 10.5px;
}

.preview-keywords {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.preview-analysis {
  padding-top: 4px;
}

.source-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 10px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10.5px;
}

.source-line > span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.practice-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  border-top: 1px solid var(--line);
  background: var(--panel);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
}

.practice-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 7px 16px;
}

.tool-row {
  display: flex;
  align-items: center;
  gap: 2px;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 52px;
  height: 36px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}

.tool-btn:hover:not(:disabled) {
  background: var(--panel-soft);
  color: var(--ink);
}

.tool-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.tool-btn.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-2);
}

.primary-row {
  display: flex;
  justify-content: flex-end;
  flex: 1;
}

.primary-row .btn {
  min-width: 140px;
}

.correct-flash {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.correct-flash-circle {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--good);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  animation: correct-flash 520ms ease-out forwards;
}

[data-theme="dark"] .correct-flash-circle {
  color: #14211a;
}

@keyframes correct-flash {
  0% {
    opacity: 0;
    transform: scale(0.72);
  }
  18% {
    opacity: 1;
    transform: scale(1);
  }
  72% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.08);
  }
}

.done-panel {
  max-width: 560px;
  margin: 8vh auto 0;
  padding: 28px 24px;
  border: 1px solid var(--line);
  text-align: center;
  background: var(--panel-soft);
}

.done-icon {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 8px;
}

.done-panel h2 {
  font-size: 20px;
  letter-spacing: -0.02em;
}

.done-panel p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12.5px;
}

.done-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

/* ---------- modals ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: var(--overlay);
}

.modal {
  width: min(620px, 100%);
  max-height: 92vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 4px 4px 0 0;
  background: var(--panel);
  box-shadow: var(--shadow);
  animation: modal-in 0.15s ease-out;
}

.modal-wide {
  width: min(860px, 100%);
}

.settings-modal {
  width: min(520px, 100%);
}

@keyframes modal-in {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px 0;
}

.modal-head h2 {
  font-size: 17px;
  letter-spacing: -0.02em;
}

.modal-head p {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
}

.modal-body {
  padding: 12px 18px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding: 0 18px 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  color: var(--muted);
}

.field > span:first-child {
  font-weight: 600;
}

.field input,
.field select {
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel);
  color: var(--ink);
  font-size: 12.5px;
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
}

.inline-field {
  display: grid;
  grid-template-columns: 1fr 110px;
  align-items: center;
  gap: 10px;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
  width: fit-content;
}

.segmented button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: none;
  border-right: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 11.5px;
}

.segmented button:last-child {
  border-right: none;
}

.segmented button.is-active {
  background: var(--accent-soft);
  color: var(--accent-2);
}

.segmented button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.check-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel);
  font-size: 11.5px;
  color: var(--ink);
  white-space: nowrap;
}

.check-pill span {
  color: var(--muted);
  font-size: 10px;
}

.check-pill input {
  accent-color: var(--accent);
}

.check-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  font-size: 12px;
  color: var(--muted);
}

.check-row label,
label.check-row {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.check-row input {
  accent-color: var(--accent);
}

.preview-line {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.preview-line strong {
  color: var(--ink);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.kv-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.kv-line strong {
  color: var(--ink);
  margin-left: auto;
}

.menu-list {
  display: flex;
  flex-direction: column;
  padding: 4px 0;
}

.menu-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 7px 18px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  text-align: left;
}

.menu-row:hover {
  background: var(--panel-soft);
}

.menu-note {
  padding: 8px 18px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
}

.confirm-text {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
}

.note-input {
  width: 100%;
  min-height: 160px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel-soft);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.7;
  resize: vertical;
  outline: none;
}

.note-input:focus {
  border-color: var(--accent);
  background: var(--panel);
}

.ai-modal-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-context {
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  font-size: 12px;
}

.ai-context-label {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10.5px;
}

.ai-bubble {
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.ai-input {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.ai-input textarea {
  flex: 1;
  min-height: 46px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12.5px;
  resize: none;
  opacity: 0.7;
}

.agent-modal {
  width: min(760px, calc(100vw - 24px));
}

/* 练习页 AI 抽屉：桌面右侧 420，手机全屏 */
@media (min-width: 1440px) {
  :root {
    --agent-drawer-w: calc(50vw - 60px);
  }
}

.agent-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  width: var(--agent-drawer-w);
  border-left: 1px solid var(--line);
  background: var(--panel);
  box-shadow: -14px 0 36px rgba(0, 0, 0, 0.16);
  animation: agent-drawer-in 0.16s ease-out;
}

@keyframes agent-drawer-in {
  from {
    transform: translateX(18px);
    opacity: 0.6;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.agent-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}

.agent-head-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.agent-head h2 {
  font-size: 15px;
  letter-spacing: -0.01em;
}

.agent-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
}

.agent-tools-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.agent-mode-seg button {
  padding: 4px 9px;
}

.agent-more-wrap {
  position: relative;
}

.agent-more {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 3;
  min-width: 150px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.agent-more button {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 6px 9px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-size: 12.5px;
  text-align: left;
}

.agent-more button:hover {
  background: var(--hover);
}

.agent-more button.danger {
  color: var(--bad);
}

.agent-drawer .agent-messages {
  flex: 1;
  min-height: 0;
  max-height: none;
  border: 0;
  border-radius: 0;
  padding: 16px;
  background: var(--panel);
  overscroll-behavior: contain;
}

.agent-drawer .agent-input-row textarea {
  resize: none;
}

.agent-scroll {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.agent-jump {
  position: absolute;
  right: 14px;
  bottom: 10px;
  z-index: 2;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.agent-jump:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.agent-composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}

.agent-samples {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.agent-samples button {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 11.5px;
}

.agent-samples button:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.agent-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 10.5px;
}

.agent-msg-user .agent-foot {
  justify-content: flex-end;
}

.agent-foot-acts {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.agent-msg-user .agent-foot-acts {
  margin-left: 0;
}

.agent-act {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 4px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.6;
}

.agent-act:hover {
  border-color: var(--line);
  background: var(--panel-soft);
  color: var(--ink);
}

.agent-act-text {
  padding: 1px 6px;
}

/* 桌面抽屉打开时把底栏内容让到左侧，避免盖住提交/下一题 */
@media (min-width: 900px) {
  body.agent-open .practice-bar {
    padding-right: var(--agent-drawer-w);
  }
}

@media (max-width: 899px) {
  body.agent-open {
    overflow: hidden;
  }
  .agent-drawer {
    inset: 0;
    width: auto;
    height: 100vh;
    height: 100dvh;
    padding-top: env(safe-area-inset-top);
    border-left: 0;
    box-shadow: none;
  }
  .agent-drawer .agent-messages {
    padding: 12px;
  }
}

.agent-panel {
  gap: 8px;
}

.agent-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.agent-modes,
.agent-top-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.agent-modes .is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft, var(--panel-soft));
}

.agent-status {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.7;
  white-space: nowrap;
}

.agent-notice {
  padding: 7px 9px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
}

.agent-messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 56vh;
  min-height: 180px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.agent-empty {
  padding: 16px 10px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

.agent-msg {
  max-width: 100%;
  font-size: 13.5px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.agent-msg-assistant {
  align-self: stretch;
  padding: 0 0 0 12px;
  border-left: 2px solid var(--line-strong);
  background: transparent;
}

.agent-msg-user {
  align-self: flex-end;
  max-width: 82%;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--accent-soft, var(--panel-soft));
}

.agent-tags {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.agent-tag {
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 10.5px;
  line-height: 1.7;
}

.agent-tag.is-error {
  background: var(--bad-soft);
  color: var(--bad);
}

.agent-msg.is-error {
  border-left-color: var(--bad);
}

/* 对话正文排版：只作用于 .agent-body，解析区 .analysis 仍用原样式 */
.agent-body {
  color: var(--ink);
}

.agent-body > :first-child {
  margin-top: 0;
}

.agent-body > :last-child {
  margin-bottom: 0;
}

.agent-body p {
  margin: 0 0 9px;
}

.agent-body h2,
.agent-body h3,
.agent-body h4,
.agent-body h5,
.agent-body h6 {
  margin: 16px 0 7px;
  font-weight: 600;
  line-height: 1.45;
}

.agent-body h2 {
  font-size: 16.5px;
}

.agent-body h3 {
  font-size: 15px;
}

.agent-body h4 {
  font-size: 14px;
}

.agent-body h5,
.agent-body h6 {
  font-size: 13.5px;
  color: var(--muted);
}

.agent-body strong {
  font-weight: 650;
}

.agent-body ul,
.agent-body ol {
  margin: 5px 0 9px;
  padding-left: 22px;
}

.agent-body li {
  margin: 2px 0;
}

.agent-body li > p {
  margin: 0 0 4px;
}

.agent-body li > ul,
.agent-body li > ol {
  margin: 2px 0;
}

.agent-body blockquote {
  margin: 9px 0;
  padding: 7px 11px;
  border-left: 3px solid var(--line-strong);
  border-radius: 0 2px 2px 0;
  background: var(--panel-soft);
  color: var(--muted);
}

.agent-body blockquote > :last-child {
  margin-bottom: 0;
}

.agent-body hr {
  margin: 14px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.agent-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.agent-body code {
  padding: 1px 4px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel-soft);
  font-family: var(--mono);
  font-size: 0.9em;
}

.agent-body pre {
  margin: 9px 0;
  padding: 9px 11px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel-soft);
  font-size: 12.5px;
  line-height: 1.6;
}

.agent-body pre code {
  padding: 0;
  border: 0;
  background: transparent;
  font-size: inherit;
}

.agent-body .md-code {
  margin: 9px 0;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel-soft);
}

.agent-body .md-code pre {
  margin: 0;
  border: 0;
  background: transparent;
}

.md-code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.md-code-lang {
  font-family: var(--mono);
}

.md-code-copy {
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.md-code-copy:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.md-code-copy.is-done {
  border-color: var(--good);
  color: var(--good);
}

.agent-body .md-table {
  margin: 9px 0;
  overflow-x: auto;
  border: 0;
}

.agent-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  line-height: 1.6;
}

.agent-body th,
.agent-body td {
  padding: 5px 8px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.agent-body thead th {
  background: var(--panel-soft);
  font-weight: 600;
  color: var(--ink);
}

.agent-body tbody tr:nth-child(even) td {
  background: var(--panel-soft);
}

.agent-body .md-math {
  display: inline;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel-soft);
  font-family: var(--mono);
  font-size: 0.92em;
  white-space: pre-wrap;
}

.agent-body .md-math-block {
  display: block;
  margin: 9px 0;
  padding: 8px 10px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel-soft);
  font-family: var(--mono);
  font-size: 12.5px;
  white-space: pre;
}

.agent-body .md-task {
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  vertical-align: -1px;
}

.agent-body .md-task.is-done {
  border-color: var(--accent);
  background: var(--accent);
}

.agent-body .md-caret {
  display: inline-block;
  width: 7px;
  height: 1.02em;
  margin-left: 2px;
  background: var(--accent);
  vertical-align: -0.18em;
  animation: md-caret-blink 1s steps(2, start) infinite;
}

@keyframes md-caret-blink {
  to {
    visibility: hidden;
  }
}

.agent-input-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.agent-input-row textarea {
  flex: 1;
  min-height: 50px;
  max-height: 160px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 13px;
  resize: vertical;
}

.agent-input-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
}

.question-list {
  max-height: 62vh;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.question-row {
  display: grid;
  grid-template-columns: 34px 52px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 18px;
  border: none;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  font-size: 12.5px;
}

.question-row:hover {
  background: var(--panel-soft);
}

.question-row.is-current {
  background: var(--accent-soft);
}

.q-list-index {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.q-list-stem {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.q-list-open {
  color: var(--line-strong);
}

.diff-list {
  margin: 0;
  padding-left: 1.2em;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
}

.pick-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pick-list {
  max-height: 46vh;
  overflow: auto;
  border: 1px solid var(--line);
}

.pick-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 150px;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.pick-row:last-child {
  border-bottom: none;
}

.pick-row:hover {
  background: var(--panel-soft);
}

.pick-stem {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pick-meta {
  color: var(--muted);
  font-size: 10.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.help-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px 22px;
}

.help-group strong {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.help-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.help-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  justify-content: flex-end;
}

.capture-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 22px 18px;
  text-align: center;
}

.capture-ring {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 1px dashed var(--accent);
  border-radius: 50%;
  color: var(--accent);
  background: var(--accent-soft);
  animation: capture-pulse 1.4s ease-in-out infinite;
}

@keyframes capture-pulse {
  0%,
  100% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
}

.capture-text {
  font-size: 13px;
  color: var(--ink);
}

.settings-page {
  max-width: 860px;
}

.settings-page-head {
  align-items: baseline;
  padding-bottom: 4px;
  margin-bottom: 8px;
  border-bottom: none;
}

.settings-section {
  padding: 14px 0 18px;
  border-bottom: 1px solid var(--line);
}

.settings-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.settings-head h2 {
  font-size: 15px;
  letter-spacing: -0.01em;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 18px;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.settings-build {
  padding-top: 10px;
  margin-top: 0;
}

.theme-segmented button {
  min-height: 34px;
}
.theme-segmented button {
  min-height: 34px;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.theme-grid + .theme-grid {
  margin-top: 8px;
}

.theme-card {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
}

.theme-card:hover {
  border-color: var(--line-strong);
  background: var(--panel-soft);
}

.theme-card.is-active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.theme-preview {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: none;
  width: 64px;
  height: 44px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--bg);
}

.theme-preview-top {
  display: flex;
  gap: 2px;
}

.theme-preview-top i {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.theme-preview-top i:nth-child(2) {
  background: var(--muted);
}

.theme-preview-top i:nth-child(3) {
  background: var(--line-strong);
}

.theme-preview-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  flex: 1;
  padding: 3px 4px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.theme-preview-line {
  display: block;
  height: 3px;
  border-radius: 1px;
  background: var(--ink);
  opacity: 0.8;
}

.theme-preview-line.is-muted {
  background: var(--muted);
  opacity: 0.6;
}

.theme-preview-line.is-accent {
  background: var(--accent);
  opacity: 1;
}

.theme-card-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 600;
}

.settings-fold {
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel);
  overflow: hidden;
}

.settings-fold > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  list-style: none;
  cursor: pointer;
  user-select: none;
  background: var(--panel-soft);
}

.settings-fold > summary:hover {
  background: var(--hover);
}

.settings-fold[open] > summary {
  border-bottom: 1px solid var(--line);
}

.settings-fold > summary:focus-visible {
  outline-offset: -2px;
}

.settings-fold > summary::-webkit-details-marker {
  display: none;
}

.settings-fold > summary::marker {
  content: "";
}

.settings-fold-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--accent-2);
}

.settings-fold-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  font-size: 11.5px;
  color: var(--muted);
}

.settings-chevron {
  width: 16px;
  height: 16px;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.settings-fold[open] .settings-chevron {
  transform: rotate(90deg);
}

.settings-fold-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 12px 14px 14px;
}

.settings-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-subhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.settings-subhead h3 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.settings-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}

.settings-row:last-child {
  border-bottom: none;
  padding-bottom: 4px;
}

.settings-row-main {
  min-width: 0;
}

.settings-row-label {
  font-size: 14px;
  color: var(--ink);
}

.settings-row-control {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.settings-row-control input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.settings-check-group {
  gap: 14px;
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--ink);
  cursor: pointer;
}

.check-inline input {
  accent-color: var(--accent);
}

.number-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
}

.number-field input {
  width: 84px;
  min-height: 30px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel);
  color: var(--ink);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

.number-field input:focus {
  border-color: var(--accent);
  outline: none;
}

.number-field input:disabled {
  opacity: 0.45;
}

.profile-edit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.profile-edit-grid .field {
  font-size: 12.5px;
}

.profile-edit-grid .field input {
  min-height: 36px;
  font-size: 14px;
}

.avatar-choice-grid {
  display: grid;
  grid-template-columns: repeat(5, 50px);
  gap: 8px;
  margin-top: 4px;
}

.avatar-choice {
  border: 2px solid transparent;
  border-radius: 50%;
  padding: 2px;
  background: transparent;
}

.avatar-choice.is-active {
  border-color: var(--accent);
}

.avatar-choice .avatar {
  width: 42px;
  height: 42px;
  font-size: 17px;
}

.settings-inline-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-gamepad {
  font-size: 12px;
  color: var(--muted);
}

.settings-block-actions {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 2px;
}

.settings-reset-row {
  margin: 0;
  padding-top: 2px;
}

.bindings {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bind-group h3 {
  margin-bottom: 2px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.bind-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 0 32px;
}

.bind-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.bind-label {
  color: var(--ink);
}

.bind-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.bind-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 4px 1px 6px;
  border: 1px solid var(--keyhint-line);
  border-radius: 3px;
  background: var(--keyhint-bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10.5px;
  white-space: nowrap;
}

.bind-chip button {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  padding: 0;
  border: none;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
}

.bind-chip button:hover {
  background: var(--bad-soft);
  color: var(--bad);
}

.bind-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.bind-actions .btn {
  padding: 3px 6px;
  font-size: 11px;
}

.settings-row-control .segmented button {
  padding: 6px 10px;
  font-size: 13px;
}

@media (max-width: 719px) {
  .settings-page-head {
    flex-direction: column;
    gap: 4px;
  }

  .settings-fold {
    margin-bottom: 8px;
  }

  .settings-fold > summary {
    padding: 12px;
  }

  .settings-fold-meta {
    font-size: 11px;
  }

  .settings-fold-body {
    gap: 12px;
    padding: 10px 12px 12px;
  }

  .theme-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .theme-preview {
    width: 54px;
    height: 40px;
  }

  .theme-card {
    gap: 7px;
    padding: 6px;
  }

  .settings-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 8px 0;
  }

  .settings-row-control {
    justify-content: flex-start;
  }

  .settings-row-control .segmented {
    width: 100%;
  }

  .settings-row-control .segmented button {
    flex: 1;
    justify-content: center;
  }

  .settings-check-group {
    flex-wrap: wrap;
  }

  .profile-edit-grid {
    grid-template-columns: 1fr;
  }

  .bind-grid {
    grid-template-columns: 1fr;
  }

  .bind-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "label actions"
      "chips chips";
  }

  .bind-label {
    grid-area: label;
  }

  .bind-chips {
    grid-area: chips;
  }

  .bind-actions {
    grid-area: actions;
  }
}

html[data-layout-mode="mobile"] .settings-page-head {
  flex-direction: column;
  gap: 4px;
}

html[data-layout-mode="mobile"] .settings-fold {
  margin-bottom: 8px;
}

html[data-layout-mode="mobile"] .settings-fold > summary {
  padding: 12px;
}

html[data-layout-mode="mobile"] .settings-fold-body {
  gap: 12px;
  padding: 10px 12px 12px;
}

html[data-layout-mode="mobile"] .theme-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

html[data-layout-mode="mobile"] .theme-preview {
  width: 54px;
  height: 40px;
}

html[data-layout-mode="mobile"] .theme-card {
  gap: 7px;
  padding: 6px;
}

html[data-layout-mode="mobile"] .settings-row {
  grid-template-columns: 1fr;
  gap: 6px;
}

html[data-layout-mode="mobile"] .settings-row-control {
  justify-content: flex-start;
}

html[data-layout-mode="mobile"] .settings-row-control .segmented {
  width: 100%;
}

html[data-layout-mode="mobile"] .settings-row-control .segmented button {
  flex: 1;
  justify-content: center;
}

html[data-layout-mode="mobile"] .profile-edit-grid,
html[data-layout-mode="mobile"] .bind-grid {
  grid-template-columns: 1fr;
}

html[data-layout-mode="mobile"] .bind-row {
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "label actions"
    "chips chips";
}

html[data-layout-mode="mobile"] .bind-label {
  grid-area: label;
}

html[data-layout-mode="mobile"] .bind-chips {
  grid-area: chips;
}

html[data-layout-mode="mobile"] .bind-actions {
  grid-area: actions;
}

/* ---------- toast ---------- */

#toast {
  position: fixed;
  left: 50%;
  bottom: 72px;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.toast {
  max-width: min(88vw, 520px);
  padding: 8px 12px;
  border-radius: 2px;
  background: var(--toast-bg);
  color: var(--toast-ink);
  font-size: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
  animation: toast-in 0.15s ease-out;
}

.toast a { color: inherit; margin-left: 6px; text-decoration: underline; text-underline-offset: 2px; pointer-events: auto; cursor: pointer; }
.toast-error {
  background: var(--bad);
  color: #fff;
}

.toast.is-out {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s, transform 0.2s;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- responsive ---------- */

@media (min-width: 720px) {
  .modal-backdrop {
    align-items: center;
    padding: 20px;
  }

  .modal {
    border-radius: 4px;
  }

  .help-grid {
    grid-template-columns: 1fr 1fr;
  }

  .result-pane {
    position: sticky;
    top: 64px;
    max-height: calc(100vh - 140px);
    overflow: auto;
  }
}

@media (max-width: 1099px) {
  .workspace {
    display: block;
  }

  .bank-rail {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
  }

  .bank-list {
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    scrollbar-width: none;
  }

  .bank-list::-webkit-scrollbar {
    display: none;
  }

  .bank-item {
    min-width: 160px;
    border-left: none;
    border-bottom: 2px solid transparent;
  }

  .bank-item.is-active {
    border-left-color: transparent;
    border-bottom-color: var(--accent);
  }

  .bank-rail-foot {
    display: none;
  }

  .workspace-main {
    padding: 16px 18px 90px;
  }

  .seq-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "main actions"
      "progress progress"
      "counts counts";
  }

  .seq-main {
    grid-area: main;
  }

  .seq-progress {
    grid-area: progress;
  }

  .seq-counts {
    grid-area: counts;
  }

  .seq-actions {
    grid-area: actions;
  }
}

@media (max-width: 719px) {
  .topbar {
    height: 50px;
    padding: 0 10px;
    gap: 10px;
  }

  .brand-text small {
    display: none;
  }

  .brand-text strong {
    font-size: 16px;
  }

  .topnav a {
    padding: 5px 7px;
    font-size: 12px;
  }

  .page-main,
  .workspace-main {
    padding: 12px 10px 90px;
  }

  .page-head {
    flex-direction: column;
    gap: 8px;
  }

  .head-actions,
  .workspace-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .workspace-head {
    flex-direction: column;
  }

  .bank-rail {
    top: 50px;
  }

  .seq-row {
    padding: 10px;
  }

  .seq-actions .btn {
    min-height: 28px;
    padding: 3px 7px;
  }

  .child-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "main actions"
      "progress progress";
  }

  .child-main {
    grid-area: main;
  }

  .child-progress {
    grid-area: progress;
  }

  .child-actions {
    grid-area: actions;
  }

  .search-box {
    width: 100%;
  }

  .search-box input {
    width: 100%;
  }

  .filter-bar {
    align-items: flex-start;
  }

  .filter-scroll,
  .filter-actions {
    width: 100%;
  }

  /* mobile: q tables become blocks */
  .q-table thead,
  .bank-q-table thead {
    display: none;
  }

  .q-table,
  .q-table tbody,
  .bank-q-table,
  .bank-q-table tbody {
    display: block;
  }

  .q-table tr {
    display: grid;
    grid-template-columns: 26px 30px 1fr auto;
    grid-template-areas:
      "check index status marks"
      "stem stem stem stem";
    gap: 4px 6px;
    padding: 9px 10px;
    border-bottom: 1px solid var(--line);
  }

  .q-table td,
  .bank-q-table td {
    display: block;
    width: auto;
    padding: 0;
    border: none;
  }

  .q-table .col-check {
    grid-area: check;
  }

  .q-table .col-index {
    grid-area: index;
    align-self: center;
  }

  .q-table .col-status {
    grid-area: status;
    align-self: center;
  }

  .q-table .col-stem {
    grid-area: stem;
    min-width: 0;
  }

  .q-table .col-marks {
    grid-area: marks;
    text-align: right;
  }

  .q-table .col-type,
  .q-table .col-open {
    display: none;
  }

  .q-table .stem-text {
    -webkit-line-clamp: 3;
    font-size: 13.5px;
  }

  .bank-q-table tr {
    display: grid;
    grid-template-columns: 26px 30px 1fr auto;
    grid-template-areas:
      "check index stem note"
      "check index stem note";
    gap: 4px 6px;
    padding: 9px 10px;
    border-bottom: 1px solid var(--line);
  }

  .bank-q-table .col-check {
    grid-area: check;
  }

  .bank-q-table .col-index {
    grid-area: index;
    align-self: start;
  }

  .bank-q-table .col-stem {
    grid-area: stem;
    min-width: 0;
  }

  .bank-q-table .col-note {
    grid-area: note;
    text-align: right;
    align-self: start;
  }

  .bank-q-table .col-type,
  .bank-q-table .col-source,
  .bank-q-table .col-flags,
  .bank-q-table .col-core,
  .bank-q-table .col-keywords {
    display: none;
  }

  /* mobile: bank index table */
  .bank-table thead {
    display: none;
  }

  .bank-table,
  .bank-table tbody {
    display: block;
  }

  .bank-table tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 8px;
    padding: 10px;
    border-bottom: 1px solid var(--line);
  }

  .bank-table td {
    display: block;
    width: auto;
    padding: 0;
    border: none;
  }

  .bank-table td:nth-child(2),
  .bank-table td:nth-child(5) {
    display: none;
  }

  .bank-table td.col-actions {
    grid-column: 1 / -1;
    text-align: left;
    margin-top: 4px;
  }

  .bank-table td.num {
    color: var(--muted);
    font-size: 11px;
  }

  /* practice */
  .practice-shell {
    padding: 0 14px 146px;
  }

  .practice-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .practice-head {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
    top: 0;
    padding: 8px 4px;
  }

  .practice-head-right {
    justify-content: flex-start;
    gap: 6px;
  }

  .practice-counts {
    display: none;
  }

  .practice-title h1 {
    font-size: 13px;
  }

  .question-pane {
    padding: 14px 12px 12px;
  }

  .q-stem {
    font-size: 17.5px;
  }

  .option {
    min-height: 44px;
  }

  .result-pane.is-placeholder {
    display: none;
  }

  .practice-main.has-result .result-pane {
    display: block;
  }

  .practice-bar-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  }

  /* 手机底栏：按按钮数量等分单行（5/6 个都自适应），不换行 */
  .tool-row {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .tool-btn {
    min-width: 0;
    height: 34px;
  }

  /* 窄屏电脑模式也收成纯图标，避免标签在 6 等分里逐字换行 */
  html[data-layout-mode="desktop"] .practice-bar .tool-btn > span:not(.keyhint) {
    display: none;
  }

  .primary-row {
    width: 100%;
    flex: none;
    display: block;
  }

  .primary-row .btn {
    width: 100%;
    min-height: 42px;
  }

  .action-inner {
    flex-wrap: wrap;
    gap: 5px;
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  }

  .action-summary {
    min-width: 0;
    flex: 1;
  }

  .action-scroll {
    width: 100%;
    flex-basis: 100%;
  }

  .has-selection {
    padding-bottom: 146px;
  }

  #toast {
    bottom: 150px;
  }

  .source-line {
    font-size: 10px;
  }

  .form-row,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .inline-field {
    grid-template-columns: 1fr;
  }

  .bind-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "label actions"
      "chips chips";
  }

  .bind-label {
    grid-area: label;
  }

  .bind-chips {
    grid-area: chips;
  }

  .bind-actions {
    grid-area: actions;
  }

  .question-row {
    padding: 8px 12px;
  }

  .pick-row {
    grid-template-columns: 20px minmax(0, 1fr);
  }

  .pick-meta {
    display: none;
  }

  .modal-head {
    padding: 14px 14px 0;
  }

  .modal-body {
    padding: 10px 14px;
  }

  .modal-foot {
    padding: 0 14px 14px;
  }
}

/* Phase 2: auth, user chip, pager */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 22px;
  padding: 32px 18px;
  background: var(--bg);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-brand .brand-logo {
  width: 64px;
  height: 64px;
}

.auth-brand strong {
  display: block;
  font-family: "Fusion Pixel Brand", var(--font);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.2;
}

.auth-brand small {
  color: var(--muted);
}

.auth-panel {
  width: min(420px, calc(100vw - 36px));
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 18px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.auth-tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.auth-tabs button.is-active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form .btn {
  width: 100%;
  justify-content: center;
}

.auth-consent {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 2px 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.auth-consent input {
  flex: none;
  margin: 3px 0 0;
}

.auth-consent a {
  color: var(--accent);
  text-decoration: none;
}

.auth-consent a:hover {
  text-decoration: underline;
}

.auth-error {
  color: var(--bad);
  font-size: 0.86rem;
  margin: 0;
}

.auth-error.is-hint {
  color: var(--muted);
}

.auth-hint {
  margin: 12px 0 0;
}

.user-chip {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 4px 8px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.pager-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pager {
  display: inline-flex;
  gap: 6px;
}

.badge-test {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}

/* ---------- home / profile ---------- */

.home-page {
  max-width: 1120px;
}

.home-head {
  align-items: flex-end;
}

.home-head h1 {
  margin-top: 2px;
}

.home-date {
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.home-today {
  flex: none;
  padding-bottom: 3px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.home-today strong {
  color: var(--ink);
  font-size: 17px;
  font-weight: 650;
}

.home-today i {
  display: inline-block;
  width: 1px;
  height: 11px;
  margin: 0 8px;
  background: var(--line);
  vertical-align: -1px;
}

.home-feature {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 2px;
  background: var(--panel);
  color: var(--ink);
}

.home-feature:hover {
  border-color: var(--line-strong);
  border-left-color: var(--accent);
  background: var(--panel-soft);
}

.home-feature-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.home-feature-time {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.home-feature h2 {
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.home-feature-sub {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.home-feature-main {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.home-feature-copy {
  min-width: 0;
}

.home-feature-pct {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: flex-end;
  color: var(--accent-2);
}

.home-feature-pct-label {
  color: var(--muted);
  font-size: 10.5px;
}

.home-feature-pct-value {
  font-family: "Times New Roman", "Songti SC", "SimSun", serif;
  font-size: 32px;
  font-variant-numeric: lining-nums;
  font-weight: 400;
  line-height: 0.95;
}

.home-feature-pct-value i {
  margin-left: 1px;
  font-family: var(--font);
  font-size: 13px;
  font-style: normal;
  font-weight: 600;
}

.home-progress {
  height: 3px;
  margin-top: 4px;
  background: var(--line);
}

.home-progress i {
  display: block;
  height: 100%;
  background: var(--accent);
}

.home-feature-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.home-feature-enter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  color: var(--accent-2);
  font-weight: 650;
  white-space: nowrap;
}

.home-guide {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.home-guide-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  background: var(--accent-soft);
  color: var(--accent-2);
}

.home-guide-copy {
  min-width: 0;
}

.home-guide-copy h2 {
  font-size: 16px;
  font-weight: 700;
}

.home-guide-copy p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.home-guide .btn {
  margin-left: auto;
}

.home-section {
  margin-top: 18px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.section-head h2 {
  font-size: 15px;
  font-weight: 700;
}

.home-bank-list {
  border: 1px solid var(--line);
  background: var(--panel);
}

.home-bank-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.35fr) minmax(130px, 1fr) 128px 78px 16px;
  gap: 14px;
  align-items: center;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.home-bank-row:last-child {
  border-bottom: 0;
}

.home-bank-row:hover {
  background: var(--hover);
}

.home-bank-name strong {
  font-size: 13px;
  line-height: 1.35;
}

.home-bank-name .tag {
  margin-left: 6px;
  vertical-align: 1px;
}

.home-bank-name small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 10.5px;
}

.home-bank-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}

.home-bar {
  flex: 1;
  height: 3px;
  min-width: 40px;
  background: var(--line);
}

.home-bar i {
  display: block;
  height: 100%;
  background: var(--accent);
}

.home-bank-progress em {
  width: 28px;
  color: var(--muted);
  font-size: 10.5px;
  font-style: normal;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.home-week {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 14px;
}

.home-week i {
  display: block;
  width: 7px;
  height: var(--h);
  min-height: 2px;
  border-radius: 1px;
  background: var(--line);
}

.home-week i.is-on {
  background: color-mix(in srgb, var(--accent) 45%, var(--line));
}

.home-week i.is-today.is-on {
  background: var(--accent);
}

.home-week i.is-today:not(.is-on) {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.home-bank-last {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.home-bank-row > .icon {
  color: var(--muted);
}

html[data-layout-mode="mobile"] .home-head {
  align-items: flex-start;
  flex-direction: column;
  gap: 8px;
}

html[data-layout-mode="mobile"] .home-today {
  padding-bottom: 0;
}

html[data-layout-mode="mobile"] .home-feature-meta {
  flex-wrap: wrap;
  gap: 4px 12px;
}

html[data-layout-mode="mobile"] .home-feature-enter {
  margin-left: 0;
}

html[data-layout-mode="mobile"] .home-guide {
  flex-wrap: wrap;
}

html[data-layout-mode="mobile"] .home-guide-copy {
  flex: 1;
}

html[data-layout-mode="mobile"] .home-guide .btn {
  width: 100%;
  margin-left: 0;
}

html[data-layout-mode="mobile"] .home-bank-row {
  grid-template-areas:
    "name last"
    "progress progress"
    "week week";
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
  padding: 10px 12px;
}

html[data-layout-mode="mobile"] .home-bank-name {
  grid-area: name;
}

html[data-layout-mode="mobile"] .home-bank-progress {
  grid-area: progress;
}

html[data-layout-mode="mobile"] .home-week {
  grid-area: week;
}

html[data-layout-mode="mobile"] .home-bank-last {
  grid-area: last;
}

html[data-layout-mode="mobile"] .home-bank-row > .icon {
  display: none;
}

.profile-page {
  max-width: 1120px;
}

.profile-head {
  min-width: 0;
}

.profile-head-text {
  min-width: 0;
}

.profile-head-text h1 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-head .avatar {
  flex: none;
}

.profile-section {
  margin-top: 20px;
}

.profile-section .section-head {
  margin-bottom: 10px;
}

.profile-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  background: var(--panel);
}

.profile-kpi {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 14px 16px 15px;
  border-left: 1px solid var(--line);
}

.profile-kpi:first-child {
  border-left: none;
}

.profile-kpi-label {
  font-size: 11px;
  color: var(--muted);
}

.profile-kpi-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 4px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  vertical-align: -4px;
}

.profile-kpi-toggle:hover {
  color: var(--ink);
  background: var(--hover);
}

.profile-kpi strong {
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}

.profile-kpi.is-primary strong {
  color: var(--accent-2);
  font-size: 30px;
}

.profile-kpi-sub {
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
}

.profile-rate-bar {
  display: block;
  height: 5px;
  margin-top: 6px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.profile-rate-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.profile-chart {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 132px;
  padding-top: 10px;
  border-bottom: 1px solid var(--line);
}

.profile-chart-col {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.profile-chart-bar {
  display: block;
  width: 100%;
  max-width: 28px;
  min-height: 2px;
  background: var(--accent);
  opacity: 0.72;
}

.profile-chart-bar.is-today {
  background: var(--accent-2);
  opacity: 1;
}

.profile-chart-bar.is-empty {
  min-height: 2px;
  background: var(--line);
  opacity: 1;
}

.profile-chart-labels {
  display: flex;
  gap: 5px;
  margin-top: 6px;
}

.profile-chart-label {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: 9.5px;
  color: var(--muted);
  white-space: nowrap;
}

.profile-chart-label.is-hidden {
  visibility: hidden;
}

.profile-chart-empty {
  padding: 30px 16px;
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.profile-banks {
  border-top: none;
}

.profile-bank-row {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(80px, 1.8fr) 64px 48px;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.profile-bank-name {
  min-width: 0;
}

.profile-bank-name strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
}

.profile-bank-name span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10.5px;
  color: var(--muted);
}

.profile-bank-bar {
  height: 6px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.profile-bank-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  opacity: 0.8;
}

.profile-bank-meta {
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.profile-bank-rate {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.profile-bank-more {
  padding-top: 9px;
  font-size: 11px;
  color: var(--muted);
}

.profile-empty {
  margin-top: 20px;
  padding: 28px 22px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.profile-empty h2 {
  font-size: 16px;
  margin-bottom: 4px;
}

/* ---------- user menu ---------- */

.user-menu {
  position: relative;
}

.user-menu .user-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 12px;
}

.user-menu .user-chip:hover {
  background: var(--panel-soft);
}

.user-menu-panel {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 50;
  min-width: 132px;
  padding: 4px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.user-menu-panel a,
.user-menu-panel button {
  display: block;
  width: 100%;
  padding: 7px 9px;
  border: none;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: 12px;
  text-decoration: none;
}

.user-menu-panel a:hover,
.user-menu-panel button:hover {
  background: var(--panel-soft);
}

@media (max-width: 719px) {
  .profile-head {
    align-items: flex-start;
  }

  .profile-head .avatar-xl {
    width: 56px;
    height: 56px;
    font-size: 22px;
  }

  .profile-head-text h1 {
    white-space: normal;
  }

  .profile-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-kpi {
    padding: 12px;
  }

  .profile-kpi:nth-child(3) {
    border-left: none;
    border-top: 1px solid var(--line);
  }

  .profile-kpi:nth-child(4) {
    border-top: 1px solid var(--line);
  }

  .profile-kpi.is-primary strong {
    font-size: 26px;
  }

  .profile-chart {
    height: 108px;
    gap: 3px;
  }

  .profile-chart-labels {
    gap: 3px;
  }

  .profile-chart-label {
    font-size: 9px;
  }

  .profile-bank-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "name rate"
      "bar bar"
      "meta meta";
    gap: 6px 10px;
  }

  .profile-bank-name {
    grid-area: name;
  }

  .profile-bank-bar {
    grid-area: bar;
  }

  .profile-bank-meta {
    grid-area: meta;
    text-align: left;
  }

  .profile-bank-rate {
    grid-area: rate;
  }
}

html[data-layout-mode="mobile"] .profile-head {
  align-items: flex-start;
}

html[data-layout-mode="mobile"] .profile-head .avatar-xl {
  width: 56px;
  height: 56px;
  font-size: 22px;
}

html[data-layout-mode="mobile"] .profile-head-text h1 {
  white-space: normal;
}

html[data-layout-mode="mobile"] .profile-kpis {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

html[data-layout-mode="mobile"] .profile-kpi:nth-child(3) {
  border-left: none;
  border-top: 1px solid var(--line);
}

html[data-layout-mode="mobile"] .profile-kpi:nth-child(4) {
  border-top: 1px solid var(--line);
}

html[data-layout-mode="mobile"] .profile-chart {
  height: 108px;
  gap: 3px;
}

html[data-layout-mode="mobile"] .profile-chart-labels {
  gap: 3px;
}

html[data-layout-mode="mobile"] .profile-bank-row {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "name rate"
    "bar bar"
    "meta meta";
  gap: 6px 10px;
}

html[data-layout-mode="mobile"] .profile-bank-name {
  grid-area: name;
}

html[data-layout-mode="mobile"] .profile-bank-bar {
  grid-area: bar;
}

html[data-layout-mode="mobile"] .profile-bank-meta {
  grid-area: meta;
  text-align: left;
}

html[data-layout-mode="mobile"] .profile-bank-rate {
  grid-area: rate;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 720px) {
  .agent-modal { width: calc(100vw - 12px); }
  .agent-msg { max-width: 100%; }
  .agent-msg-user { max-width: 88%; }
  .agent-messages { max-height: 52vh; gap: 12px; padding: 10px; }
  .agent-body { font-size: 13px; }
  .agent-body h2 { font-size: 16px; }
  .agent-body h3 { font-size: 14.5px; }
  .agent-body table { font-size: 12px; }
  .agent-body th,
  .agent-body td { padding: 4px 6px; }
  .agent-input-row { align-items: stretch; flex-direction: column; }
  .agent-input-actions { flex-direction: row; justify-content: flex-end; }
}

/* ---------- 2026-11-19: layout modes, banks, builder, threads ---------- */

.layout-toggle { flex: none; }
.layout-toggle .layout-icon-desktop { display: none; }
.layout-toggle .layout-icon-mobile { display: inline-flex; }
html[data-layout-mode="mobile"] .layout-toggle .layout-icon-desktop { display: inline-flex; }
html[data-layout-mode="mobile"] .layout-toggle .layout-icon-mobile { display: none; }

html[data-layout-mode="desktop"] .topbar {
  height: var(--topbar-h);
  padding: 0 28px;
  gap: 20px;
}
html[data-layout-mode="desktop"] .brand-text small { display: block; }
html[data-layout-mode="desktop"] .page-main {
  max-width: var(--page-max);
  padding: 20px 24px 64px;
}
html[data-layout-mode="desktop"] .practice-shell { max-width: var(--page-max); }
html[data-layout-mode="desktop"] .practice-bar-inner { max-width: var(--page-max); }
html[data-layout-mode="desktop"] .practice-main { grid-template-columns: minmax(0, 1.08fr) minmax(330px, 0.92fr); }
@media (min-width: 720px) {
  html[data-layout-mode="desktop"] .practice-bar-inner { flex-direction: row; align-items: center; }
}
html[data-layout-mode="desktop"] .practice-bar .tool-row { flex-wrap: wrap; }
html[data-layout-mode="desktop"] .bank-detail-page {
  display: grid;
  grid-template-columns: minmax(0, 0.384fr) minmax(0, 0.616fr);
}
html[data-layout-mode="desktop"] .builder-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); }
html[data-layout-mode="desktop"] .builder-filter-toggle { display: none; }
html[data-layout-mode="desktop"] .thread-row { align-items: center; }

html[data-layout-mode="mobile"] { --topbar-h: 52px; }
html[data-layout-mode="mobile"] .topbar {
  height: 52px;
  padding: 0 max(12px, calc((100vw - 760px) / 2));
  gap: 10px;
}
html[data-layout-mode="mobile"] .banks-search { flex-basis: 100%; max-width: none; }
html[data-layout-mode="mobile"] .brand-text small { display: none; }
html[data-layout-mode="mobile"] .brand-text strong { font-size: 16px; }
html[data-layout-mode="mobile"] .topnav a { padding: 5px 7px; font-size: 12px; }
html[data-layout-mode="mobile"] .page-main {
  max-width: 760px;
  padding: 12px 12px 88px;
}
html[data-layout-mode="mobile"] .page-head { flex-direction: column; gap: 8px; }
html[data-layout-mode="mobile"] .head-actions { width: 100%; justify-content: flex-start; }
html[data-layout-mode="mobile"] .bank-detail-page {
  display: grid;
  grid-template-rows: minmax(0, 0.382fr) minmax(0, 0.618fr);
  gap: 10px;
  height: calc(100vh - var(--topbar-h));
  height: calc(100dvh - var(--topbar-h));
  padding: 12px;
}
html[data-layout-mode="mobile"] .bank-info-panel { position: static; max-height: none; height: 100%; }
html[data-layout-mode="mobile"] .bank-info-toggle { display: none !important; }
html[data-layout-mode="mobile"] .builder-layout { display: block; }
html[data-layout-mode="mobile"] .builder-filter-toggle { display: inline-flex; }
html[data-layout-mode="mobile"] .builder-filters { display: none; }
html[data-layout-mode="mobile"] .builder-filters.is-open {
  display: block;
  position: fixed;
  left: max(12px, calc((100vw - 760px) / 2));
  right: max(12px, calc((100vw - 760px) / 2));
  top: calc(var(--topbar-h) + 8px);
  bottom: 12px;
  z-index: 60;
  max-height: none;
  overflow: auto;
  box-shadow: var(--shadow);
}
html[data-layout-mode="mobile"] .builder-filter-close { display: inline-flex; }
html[data-layout-mode="mobile"] .builder-create-bar {
  width: min(760px, calc(100vw - 24px));
  align-items: center;
  gap: 8px 10px;
  padding: 8px 10px;
}
html[data-layout-mode="desktop"] .builder-page {
  padding-bottom: calc(var(--builder-bar-h, 96px) + 28px);
}
html[data-layout-mode="mobile"] .builder-page {
  padding-bottom: calc(var(--builder-bar-h, 210px) + 28px);
}
html[data-layout-mode="mobile"] .builder-name { flex: 1 1 150px; min-width: 0; }
html[data-layout-mode="mobile"] .builder-compact { min-width: 104px; }
html[data-layout-mode="mobile"] .builder-create-actions { width: auto; margin-left: auto; }
html[data-layout-mode="mobile"] .builder-create-actions .btn { flex: 0 0 auto; }
html[data-layout-mode="mobile"] .threads-toolbar { display: block; }
html[data-layout-mode="mobile"] .threads-filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
  align-items: stretch;
}
html[data-layout-mode="mobile"] .threads-filter { display: flex; gap: 4px; min-width: 0; }
html[data-layout-mode="mobile"] .threads-filter > span { font-size: 10.5px; }
html[data-layout-mode="mobile"] .threads-filter select {
  flex: 1;
  min-width: 0;
  width: auto;
  padding: 0 4px;
}
html[data-layout-mode="mobile"] .threads-search {
  grid-column: 1 / -1;
  min-width: 0;
}
html[data-layout-mode="mobile"] .threads-toolbar-meta {
  justify-content: flex-end;
  margin-top: 6px;
}
html[data-layout-mode="mobile"] .thread-row {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 9px 10px;
}
html[data-layout-mode="mobile"] .thread-title { font-size: 13px; }
html[data-layout-mode="mobile"] .thread-meta { gap: 3px 8px; margin-top: 3px; font-size: 10.5px; }
html[data-layout-mode="mobile"] .thread-last { margin-top: 4px; font-size: 11.5px; }
html[data-layout-mode="mobile"] .thread-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 4px;
}
html[data-layout-mode="mobile"] .thread-actions .btn {
  min-height: 26px;
  padding: 4px 7px;
  font-size: 12px;
}
html[data-layout-mode="mobile"] .practice-main { grid-template-columns: minmax(0, 1fr); }
html[data-layout-mode="mobile"] .practice-shell { max-width: 760px; padding: 0 14px 146px; }
html[data-layout-mode="mobile"] .practice-bar-inner { max-width: 760px; }
html[data-layout-mode="mobile"] .practice-head { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; padding: 6px; }
html[data-layout-mode="mobile"] .practice-head-right { flex-wrap: nowrap; gap: 4px; }
html[data-layout-mode="mobile"] .practice-counts { display: none; }
html[data-layout-mode="mobile"] .back-label,
html[data-layout-mode="mobile"] .practice-head .btn-label { display: none; }
html[data-layout-mode="mobile"] .back-label-mobile { display: inline; }
html[data-layout-mode="mobile"] .back-link .keyhint { display: none; }
html[data-layout-mode="mobile"] .practice-head .btn { padding: 4px 7px; }
html[data-layout-mode="mobile"] .practice-title { gap: 6px; }
html[data-layout-mode="mobile"] .practice-bar .tool-btn > span:not(.keyhint) { display: none; }
html[data-layout-mode="mobile"] .practice-bar .tool-btn { gap: 2px; height: 34px; }
html[data-layout-mode="mobile"] .result-pane.is-placeholder { display: none; }
html[data-layout-mode="mobile"] .practice-main.has-result .result-pane { display: block; }
/* 手机端：结果区收紧，判定信息排成一行，核心考点标签不单独占行 */
html[data-layout-mode="mobile"] .practice-main { gap: 6px; }
html[data-layout-mode="mobile"] .question-pane { padding: 12px 12px 10px; }
html[data-layout-mode="mobile"] .q-meta { margin-bottom: 6px; }
html[data-layout-mode="mobile"] .q-stem { font-size: 16.5px; line-height: 1.55; }
html[data-layout-mode="mobile"] .result-pane { min-height: 0; padding: 10px 12px; }
html[data-layout-mode="mobile"] .verdict { gap: 6px; padding-bottom: 6px; }
html[data-layout-mode="mobile"] .verdict-icon { width: 24px; height: 24px; }
html[data-layout-mode="mobile"] .verdict strong { display: block; font-size: 13px; line-height: 1.4; }
html[data-layout-mode="mobile"] .verdict p { display: inline; margin: 0; font-size: 11px; line-height: 1.5; }
html[data-layout-mode="mobile"] .verdict p + p::before { content: "·"; margin: 0 5px; color: var(--line-strong); }
html[data-layout-mode="mobile"] .core-point { display: flex; align-items: flex-start; gap: 6px; margin: 6px 0; padding: 6px 8px; }
html[data-layout-mode="mobile"] .core-label { flex: none; margin: 0; padding-top: 2px; }
html[data-layout-mode="mobile"] .core-point p { display: block; flex: 1; min-width: 0; font-size: 12px; line-height: 1.55; }
html[data-layout-mode="mobile"] .analysis { padding-top: 6px; }
html[data-layout-mode="mobile"] .practice-bar-inner { flex-direction: column; align-items: stretch; gap: 4px; }
html[data-layout-mode="mobile"] .seq-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main actions" "progress progress" "counts counts"; }
html[data-layout-mode="mobile"] .seq-main { grid-area: main; }
html[data-layout-mode="mobile"] .seq-progress { grid-area: progress; }
html[data-layout-mode="mobile"] .seq-counts { grid-area: counts; }
html[data-layout-mode="mobile"] .seq-actions { grid-area: actions; }

/* banks index */
.banks-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.banks-search {
  flex: 1 1 300px;
  min-height: 34px;
  max-width: none;
  padding: 3px 10px;
}

.banks-search input {
  width: 100%;
  font-size: 12.5px;
}

.banks-reset {
  flex: none;
}

.banks-sort {
  display: flex;
  flex: none;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.banks-sort select {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
}

.banks-mobile-subject {
  display: none;
  flex: none;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.banks-mobile-subject select {
  height: 32px;
  max-width: 150px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
}

.banks-layout {
  display: grid;
  grid-template-columns: 204px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.banks-rail {
  position: sticky;
  top: calc(var(--topbar-h) + 12px);
  max-height: calc(100vh - var(--topbar-h) - 24px);
  overflow-y: auto;
  padding: 10px 10px 12px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.banks-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.banks-rail-head > span {
  font-weight: 600;
}

.banks-facet {
  margin-top: 12px;
}

.banks-facet h2 {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.banks-facet-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.banks-facet-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 4px 6px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  text-align: left;
}

.banks-facet-option:hover {
  background: var(--hover);
}

.banks-facet-option.is-active {
  background: var(--accent-soft);
  color: var(--accent-2);
  font-weight: 600;
}

.banks-facet-option > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.banks-facet-count {
  flex: none;
  color: var(--muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.bank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
}

.bank-grid[aria-busy="true"] {
  opacity: 0.55;
  pointer-events: none;
}

.banks-pager {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.banks-pager-pages {
  display: flex;
  align-items: center;
  gap: 2px;
}

.banks-pager-num {
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.banks-pager-num:hover {
  border-color: var(--line);
  color: var(--ink);
}

.banks-pager-num.is-active {
  border-color: var(--line-strong);
  background: var(--panel);
  color: var(--ink);
  font-weight: 650;
}

.banks-pager-gap {
  display: inline-grid;
  place-items: center;
  width: 20px;
  color: var(--muted);
  font-size: 11px;
}

.banks-pager-info {
  margin-left: auto;
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.bank-card {
  position: relative;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  transition: border-color 0.12s ease, background 0.12s ease;
}

.bank-card:hover {
  border-color: var(--line-strong);
  background: var(--panel-soft);
}

.bank-card.is-pinned {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.bank-card-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  padding: 12px 14px 11px;
  color: var(--ink);
}

.bank-card-title {
  margin: 0;
  padding-right: 26px;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bank-card-sub {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.bank-card-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.bank-card-progress .bank-completion {
  flex: 1;
  height: 3px;
  overflow: hidden;
  border: 0;
  border-radius: 1px;
  background: var(--line);
}

.bank-completion i {
  display: block;
  height: 100%;
  background: var(--accent);
}

.bank-card-pct {
  flex: none;
  width: 30px;
  color: var(--muted);
  font-size: 10.5px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bank-card-progress > .icon {
  flex: none;
  color: var(--muted);
}

.bank-card:hover .bank-card-progress > .icon {
  color: var(--accent-2);
}

.bank-pin {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
}

.bank-pin:hover {
  background: var(--hover);
  color: var(--ink);
}

.bank-pin.is-active {
  color: var(--accent);
  background: var(--accent-soft);
}

html[data-layout-mode="mobile"] .banks-rail {
  display: none;
}

html[data-layout-mode="mobile"] .banks-layout {
  grid-template-columns: minmax(0, 1fr);
}

html[data-layout-mode="mobile"] .banks-mobile-subject {
  display: flex;
}

html[data-layout-mode="mobile"] .bank-grid {
  grid-template-columns: minmax(0, 1fr);
}

@media (max-width: 920px) {
  .banks-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .banks-rail {
    display: none;
  }

  .banks-mobile-subject {
    display: flex;
  }

  .bank-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .bank-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .banks-search {
    flex-basis: 100%;
  }

}

/* bank detail layout */
.bank-detail-page {
  gap: 20px;
  align-items: stretch;
  height: calc(100vh - var(--topbar-h));
  height: calc(100dvh - var(--topbar-h));
  padding-bottom: 20px;
}
.bank-info-panel {
  min-height: 0;
  height: 100%;
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
}
.bank-detail-title { margin: 4px 0 8px; font-size: clamp(20px, 2vw, 26px); line-height: 1.3; }
.bank-detail-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 16px; color: var(--muted); font-size: 12px; }
.bank-info-desc { color: var(--ink); font-size: 13px; line-height: 1.7; }
.bank-info-desc > :first-child { margin-top: 0; }
.bank-info-desc > :last-child { margin-bottom: 0; }
.bank-info-desc h1, .bank-info-desc h2, .bank-info-desc h3 { margin: 16px 0 8px; font-size: 15px; }
.bank-info-desc p { margin: 8px 0; }
.bank-info-desc ul, .bank-info-desc ol { margin: 8px 0; padding-left: 22px; }
.bank-info-toggle {
  display: none;
  width: 100%;
  margin: 6px 0 12px;
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--accent-2);
  border-radius: var(--radius);
  font-size: 12px;
}
.bank-info-panel.is-collapsed { max-height: 40vh; overflow: hidden; }
.bank-seq-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.bank-seq-head h2 { margin: 0 0 3px; font-size: 17px; }
.bank-sequence-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.bank-sequence-panel > .bank-seq-head,
.bank-sequence-panel > .notice-line { flex: none; }
.bank-sequence-panel .seq-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--panel);
}

/* new sequence builder */
.builder-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.builder-head .back-link { margin-top: 3px; }
.builder-layout { gap: 16px; align-items: start; }
.builder-filters {
  position: sticky;
  top: calc(var(--topbar-h) + 12px);
  max-height: calc(100vh - var(--topbar-h) - var(--builder-bar-h, 96px) - 48px);
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
}
.builder-filter-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.builder-filter-close { display: none; }
.filter-head-actions { display: flex; align-items: center; gap: 8px; }
.builder-filter-grid { display: grid; gap: 9px; margin-top: 10px; }
.builder-source-filters { display: grid; gap: 8px; margin: 10px 0; }
.filter-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel);
  color: var(--muted);
  font-size: 11.5px;
}
.filter-chip b { color: var(--ink); font-weight: 600; }
.filter-chip:hover { border-color: var(--line-strong); color: var(--ink); }
.filter-chip.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-2); }
.filter-chip:disabled { opacity: 0.45; cursor: not-allowed; }
.filter-chip.is-done { border-style: dashed; }
.feedback-cats { margin-bottom: 4px; }
.builder-results { min-width: 0; }
.builder-result-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-bottom: none;
  background: var(--panel-soft);
}
.builder-table { border: 1px solid var(--line); background: var(--panel); }
.builder-table-inner { width: 100%; }
.builder-row-sub { display: none; margin-top: 3px; color: var(--muted); font-size: 11px; }
html[data-layout-mode="mobile"] .builder-table .col-type,
html[data-layout-mode="mobile"] .builder-table .col-section { display: none; }
html[data-layout-mode="mobile"] .builder-row-sub { display: block; }
html[data-layout-mode="mobile"] .builder-result-head { gap: 6px; }
html[data-layout-mode="mobile"] .builder-result-head .text-btn { font-size: 11px; }
.builder-table .col-type { width: 140px; white-space: nowrap; }
.builder-table .col-section { width: 140px; max-width: 140px; color: var(--muted); }
.builder-table .col-status { width: 92px; }
.builder-table .col-marks { width: 52px; white-space: nowrap; }
.builder-table tbody tr { cursor: pointer; }
.builder-create-bar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(var(--page-max), calc(100vw - 24px));
  z-index: 45;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-bottom: none;
  background: var(--panel);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.12);
  border-radius: var(--radius) var(--radius) 0 0;
}
.builder-create-count { display: flex; align-items: baseline; gap: 4px; min-width: 74px; }
.builder-create-count strong { font-size: 22px; line-height: 1; }
.builder-create-count span { color: var(--muted); font-size: 11px; }
.builder-name { flex: 1 1 230px; min-width: 180px; }
.builder-compact { min-width: 120px; }
.builder-create-actions { display: flex; gap: 8px; margin-left: auto; }
.builder-filter-toggle { display: none; }

.settings-head.compact-head { margin-top: 18px; }
.back-label-mobile { display: none; }

/* conversation history */
.threads-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.threads-filters {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1 1 auto;
  min-width: 0;
}

.threads-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.threads-filter > span {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.threads-filter select {
  height: 30px;
  min-width: 96px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 0 7px;
  border-radius: var(--radius);
}

.threads-filter select:focus,
.threads-search input:focus {
  border-color: var(--accent);
  outline: none;
}

.threads-search {
  display: flex;
  flex: 1 1 180px;
  min-width: 150px;
}

.threads-search input {
  width: 100%;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  font-size: 12px;
}

.threads-toolbar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.threads-toolbar-meta .muted {
  font-size: 11px;
  white-space: nowrap;
}

.thread-list { border: 1px solid var(--line); background: var(--panel); }

.thread-row {
  display: flex;
  gap: 16px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.thread-row:last-child { border-bottom: none; }
.thread-row:hover { background: var(--hover); }

.thread-main { min-width: 0; flex: 1; }

.thread-title {
  display: -webkit-box;
  overflow: hidden;
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.thread-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.thread-status {
  display: inline-flex;
  align-items: center;
  padding: 0 5px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.thread-status.is-correct {
  border-color: var(--keyhint-line);
  background: var(--accent-soft);
  color: var(--accent-2);
}

.thread-status.is-wrong {
  border-color: var(--bad);
  background: var(--bad-soft);
  color: var(--bad);
}

.thread-status.is-skipped {
  border-color: var(--line);
  background: var(--skip-soft);
  color: var(--skip);
}

.thread-last {
  display: -webkit-box;
  overflow: hidden;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.thread-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.threads-filter-empty {
  padding: 28px 16px;
  text-align: center;
}

.threads-filter-empty p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.agent-history {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 62vh;
  overflow: auto;
}
.agent-history .agent-msg { max-width: 100%; }
.agent-history .agent-msg-user { max-width: 82%; }

/* practice navigation */
.nav-modal {
  display: flex;
  flex-direction: column;
  height: min(760px, 82vh);
  height: min(760px, 82dvh);
  overflow: hidden;
}
.nav-modal .modal-head,
.nav-modal .nav-toolbar,
.nav-modal .pager-line { flex: none; }
.nav-pager { justify-content: flex-end; }
.nav-modal .nav-list {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow: auto;
}
.nav-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.nav-tabs { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.nav-list .question-row {
  display: grid;
  grid-template-columns: 44px auto minmax(0, 1fr) auto 42px;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.nav-list .question-row:last-child { border-bottom: none; }
.nav-list .question-row:hover { background: var(--hover); }
.nav-list .question-row.is-current { background: var(--accent-soft); }
.nav-list .q-list-stem { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-list .q-list-marks { display: flex; align-items: center; gap: 2px; }
.nav-list .q-list-open { color: var(--muted); font-size: 11px; text-align: right; }
.nav-list .icon-btn.tiny { border-color: transparent; background: transparent; }
.nav-list .icon-btn.tiny.is-active { color: var(--accent); background: var(--accent-soft); }


/* ---------- avatars / billing / invite ---------- */
.avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  overflow: hidden;
  background: hsl(var(--avatar-hue, 160) 38% 78%);
  color: #1f2a28;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}
.avatar-image img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-fallback { position: relative; z-index: 0; }
.avatar-image img { z-index: 1; }
.avatar-lg { width: 56px; height: 56px; font-size: 22px; }
.avatar-xl { width: 72px; height: 72px; font-size: 28px; }
.avatar-sm { width: 22px; height: 22px; font-size: 11px; }
.user-chip .avatar { margin-right: 6px; }
/* 邀请与搭子（2026-11-26） */

.invite-page { max-width: 1120px; }

.invite-top {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 12px;
  margin-top: 16px;
}

.invite-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 16px 18px;
}

.invite-share {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.invite-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.invite-code-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.invite-code {
  display: block;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: 0.06em;
}

.invite-code-row .btn { flex: none; }

.invite-link-block { margin-top: 16px; }

.invite-link-row {
  display: flex;
  gap: 6px;
  margin-top: 5px;
}

.invite-link-input {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 11.5px;
  outline: none;
}

.invite-link-input:focus { border-color: var(--accent); }

.invite-progress-panel .section-head { margin-bottom: 14px; }

.invite-steps {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding-top: 2px;
}

.invite-steps-track {
  position: absolute;
  top: 12px;
  left: 10%;
  right: 10%;
  height: 2px;
  background: var(--line);
}

.invite-steps-track > span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.invite-step {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  text-align: center;
}

.invite-step-dot {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.invite-step-reward {
  margin-top: 6px;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
}

.invite-step-state {
  margin-top: 1px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.35;
}

.invite-step-condition {
  margin-top: 3px;
  max-width: 150px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

.invite-step.is-pending .invite-step-condition { color: var(--warn); }

.invite-step.is-done .invite-step-dot {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

[data-theme="dark"] .invite-step.is-done .invite-step-dot { color: #0b1512; }

.invite-step.is-current .invite-step-dot {
  border-color: var(--accent);
  color: var(--accent-2);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.invite-step.is-pending .invite-step-dot {
  border-color: var(--warn);
  background: var(--warn-soft);
  color: var(--warn);
}

.invite-step.is-unlocked .invite-step-dot {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

[data-theme="dark"] .invite-step.is-unlocked .invite-step-dot { color: #0b1512; }

.invite-step.is-done .invite-step-reward,
.invite-step.is-unlocked .invite-step-reward { color: var(--accent-2); }

.invite-step.is-pending .invite-step-state { color: var(--warn); }

.invite-partner { margin-top: 12px; }

.partner-status {
  flex: none;
  padding: 1px 7px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 11px;
}

.partner-status.is-on {
  border-color: var(--keyhint-line);
  background: var(--accent-soft);
  color: var(--accent-2);
}

.partner-status.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-2);
}

.partner-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 18px;
}

.partner-desc {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.65;
}

.partner-active {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.partner-active .grow {
  flex: 1;
  min-width: 0;
}

.partner-active .name-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.partner-active .name-line strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.partner-active .name-line span {
  color: var(--muted);
  font-size: 11px;
}

.partner-active small {
  color: var(--muted);
  font-size: 10.5px;
}

.partner-unlock {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.partner-unlock-title {
  font-size: 12px;
  font-weight: 600;
}

.partner-unlock-row { margin-top: 9px; }

.partner-unlock-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.partner-unlock-label b {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.partner-unlock-track {
  height: 5px;
  margin-top: 4px;
  background: var(--line);
}

.partner-unlock-track > span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.partner-unlock-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 10.5px;
}

.partner-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.partner-form .btn { width: 100%; }

.partner-requests {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.partner-request-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.partner-request-head h3 {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.partner-request-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}

.partner-request-head + .partner-request-row { border-top: none; }

.partner-request-main {
  flex: 1;
  min-width: 0;
}

.partner-request-main .name-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.partner-request-main .name-line strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.partner-request-main .name-line span {
  color: var(--muted);
  font-size: 10.5px;
}

.partner-request-main small {
  color: var(--muted);
  font-size: 10px;
}

.partner-request-state {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.partner-request-empty {
  padding: 8px 0 2px;
  color: var(--muted);
  font-size: 11px;
}

.invite-invitees { margin-top: 12px; }

.invitee-list { border-top: 1px solid var(--line); }

.invitee-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.invitee-row:last-child { border-bottom: none; }

.invitee-main { min-width: 0; }

.invitee-name {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.invitee-name strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
}

.invitee-name span:not(.invitee-tag) {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.invitee-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.invitee-progress-track {
  flex: 1;
  max-width: 220px;
  height: 4px;
  background: var(--line);
}

.invitee-progress-track > span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.invitee-progress small {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.invitee-side {
  display: flex;
  align-items: center;
  gap: 6px;
}

.invitee-tag {
  flex: none;
  padding: 1px 6px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.invitee-tag.is-qualified {
  border-color: var(--keyhint-line);
  background: var(--accent-soft);
  color: var(--accent-2);
}

.invitee-tag.is-current {
  border-color: var(--accent);
  color: var(--accent-2);
}

.invitee-tag.is-incoming {
  border-color: var(--warn);
  background: var(--warn-soft);
  color: var(--warn);
}

.invite-empty {
  padding: 24px 16px;
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 860px) {
  .invite-top { grid-template-columns: minmax(0, 1fr); }
  .partner-layout { grid-template-columns: minmax(0, 1fr); }
  .partner-form {
    border-left: none;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 12px;
  }
}

@media (max-width: 719px) {
  .invite-panel { padding: 14px; }
  .invite-code { font-size: 22px; }
  .invite-step-reward { font-size: 10.5px; }
  .invite-step-state { font-size: 9px; }
  .invite-step-condition { max-width: 120px; font-size: 8.5px; }
  .invitee-row {
    grid-template-columns: 22px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 8px 0;
  }
  .invitee-progress-track { max-width: none; }
  .invitee-side .btn { padding: 4px 7px; }
  .partner-active .avatar-lg {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }
}

html[data-layout-mode="mobile"] .invite-top {
  grid-template-columns: minmax(0, 1fr);
}

html[data-layout-mode="mobile"] .partner-layout {
  grid-template-columns: minmax(0, 1fr);
}

html[data-layout-mode="mobile"] .partner-form {
  border-left: none;
  border-top: 1px solid var(--line);
  padding-left: 0;
  padding-top: 12px;
}

html[data-layout-mode="mobile"] .invite-step-reward { font-size: 10.5px; }
html[data-layout-mode="mobile"] .invite-step-state { font-size: 9px; }
html[data-layout-mode="mobile"] .invite-step-condition { max-width: 120px; font-size: 8.5px; }

html[data-layout-mode="mobile"] .invitee-row {
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 8px;
  padding: 8px 0;
}

html[data-layout-mode="mobile"] .invitee-progress-track { max-width: none; }
html[data-layout-mode="mobile"] .invitee-side .btn { padding: 4px 7px; }
html[data-layout-mode="mobile"] .partner-active .avatar-lg {
  width: 44px;
  height: 44px;
  font-size: 18px;
}

.paywall-panel { max-width: 560px; margin: 40px auto; border: 1px solid var(--line); border-radius: 6px; padding: 24px; background: var(--panel); text-align: center; }
.paywall-panel h2 { margin: 10px 0; }
.paywall-panel .wallet-inline { color: var(--muted); margin: 8px 0 18px; }
.paywall-panel .btn { margin: 4px; }
.payment-state { border: 1px solid var(--line); border-radius: 4px; padding: 12px; margin-top: 12px; }
.payment-state .hint { word-break: break-all; }
.order-link { word-break: break-all; }
.profile-head { display: flex; align-items: center; gap: 14px; }
.profile-head h1 { margin: 2px 0; }
/* 余额与消费（2026-11-25） */

.wallet-page { max-width: 1120px; }

.wallet-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr);
  gap: 12px;
  margin-top: 16px;
}

.wallet-balance-card,
.wallet-recharge-card {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 18px 20px;
}

.wallet-balance-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.wallet-balance-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.wallet-kicker {
  font-size: 12px;
  color: var(--muted);
}

.wallet-rate {
  flex: none;
  padding: 1px 6px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.wallet-balance-value {
  margin-top: 10px;
  font-size: 44px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.wallet-balance-value .wallet-currency {
  margin-right: 3px;
  color: var(--muted);
  font-size: 23px;
  font-weight: 500;
}

.wallet-balance-value.is-negative {
  color: var(--bad);
}

.wallet-recharge-head {
  display: flex;
  align-items: baseline;
}

.wallet-recharge-head h2 {
  font-size: 14px;
  font-weight: 700;
}

.wallet-presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
}

.wallet-preset {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel-soft);
  color: var(--ink);
}

.wallet-preset span {
  font-size: 15px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.wallet-preset:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--hover);
}

.wallet-preset:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.wallet-custom {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.wallet-custom > label {
  flex: none;
  color: var(--muted);
  font-size: 12px;
}

.wallet-custom-input {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--panel);
}

.wallet-custom-input:focus-within {
  border-color: var(--accent);
}

.wallet-custom-input input {
  width: 100%;
  min-width: 0;
  padding: 7px 8px;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.wallet-custom-input span {
  padding: 0 8px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
}

.wallet-hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
}

.wallet-section {
  margin-top: 20px;
}

.wallet-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  background: var(--panel);
}

.wallet-kpi {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 14px 16px 15px;
  border-left: 1px solid var(--line);
}

.wallet-kpi:first-child {
  border-left: none;
}

.wallet-kpi-label {
  color: var(--muted);
  font-size: 11px;
}

.wallet-kpi strong {
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.wallet-kpi.is-primary strong {
  color: var(--accent-2);
  font-size: 28px;
}

.wallet-kpi small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.wallet-unit {
  margin-left: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.wallet-chart {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 132px;
  padding-top: 10px;
  border-bottom: 1px solid var(--line);
}

.wallet-chart-col {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.wallet-chart-stack {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-start;
  width: 100%;
  max-width: 28px;
  height: 100%;
}

.wallet-bar {
  display: block;
  width: 100%;
  min-height: 1px;
}

.wallet-bar.paid {
  background: var(--accent);
  opacity: 0.82;
}

.wallet-bar.llm {
  background: #9aa7b5;
  opacity: 0.9;
}

.wallet-chart-labels {
  display: flex;
  gap: 5px;
  margin-top: 6px;
}

.wallet-chart-label {
  flex: 1;
  min-width: 0;
  text-align: center;
  color: var(--muted);
  font-size: 9.5px;
  white-space: nowrap;
}

.wallet-chart-label.is-hidden {
  visibility: hidden;
}

.wallet-chart-empty {
  padding: 30px 16px;
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.wallet-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
}

.wallet-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.wallet-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
}

.wallet-legend .paid {
  background: var(--accent);
}

.wallet-legend .llm {
  background: #9aa7b5;
}

.wallet-ledger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
}

.wallet-ledger-row:last-child {
  border-bottom: none;
}

.wallet-ledger-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.wallet-ledger-kind {
  font-size: 12px;
  font-weight: 600;
}

.wallet-ledger-time {
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.wallet-ledger-amount {
  flex: none;
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

.wallet-ledger-amount .money-amount {
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.wallet-ledger-amount .money-amount.is-credit {
  color: var(--accent-2);
}

.wallet-ledger-amount small {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.wallet-qty {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.wallet-qty.is-plus {
  color: var(--accent-2);
}

.money-amount {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.wallet-notes {
  max-width: 760px;
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.wallet-notes p + p {
  margin-top: 4px;
}

@media (max-width: 860px) {
  .wallet-hero {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 719px) {
  .wallet-balance-card,
  .wallet-recharge-card {
    padding: 16px;
  }

  .wallet-balance-value {
    font-size: 38px;
  }

  .wallet-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wallet-kpi {
    padding: 12px;
  }

  .wallet-kpi:nth-child(3) {
    border-left: none;
    border-top: 1px solid var(--line);
  }

  .wallet-kpi:nth-child(4) {
    border-top: 1px solid var(--line);
  }

  .wallet-kpi.is-primary strong {
    font-size: 24px;
  }

  .wallet-chart {
    height: 108px;
    gap: 3px;
  }

  .wallet-chart-labels {
    gap: 3px;
  }

  .wallet-chart-label {
    font-size: 9px;
  }

  .wallet-custom {
    flex-wrap: wrap;
  }

  .wallet-custom .btn {
    flex: 1 1 auto;
  }

  .wallet-ledger-row {
    gap: 10px;
  }
}

html[data-layout-mode="mobile"] .wallet-hero {
  grid-template-columns: minmax(0, 1fr);
}

html[data-layout-mode="mobile"] .wallet-kpis {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

html[data-layout-mode="mobile"] .wallet-kpi:nth-child(3) {
  border-left: none;
  border-top: 1px solid var(--line);
}

html[data-layout-mode="mobile"] .wallet-kpi:nth-child(4) {
  border-top: 1px solid var(--line);
}

html[data-layout-mode="mobile"] .wallet-chart {
  height: 108px;
  gap: 3px;
}

html[data-layout-mode="mobile"] .wallet-chart-labels {
  gap: 3px;
}

html[data-layout-mode="mobile"] .wallet-custom {
  flex-wrap: wrap;
}

html[data-layout-mode="mobile"] .wallet-custom .btn {
  flex: 1 1 auto;
}

/* ---------- 自建题库 / 题库广场 / 搜索 / 制作器（2026-11-22） ---------- */

.page-head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bank-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 14px 0 16px; }
.bank-tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; font-size: 13px; }
.bank-tabs a:hover { color: var(--ink); background: var(--hover); }
.bank-tabs a.is-active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.tag-row { display: flex; gap: 4px; flex-wrap: wrap; }
.tag-chip { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 2px; padding: 1px 6px; font-size: 11px; color: var(--muted); background: var(--panel-soft); }
button.tag-chip { cursor: pointer; }
button.tag-chip.is-active { border-color: var(--accent); color: var(--accent-2); background: var(--accent-soft); }
.tag-cloud { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 16px; }
.warn-text { color: var(--warn); font-size: 12px; }
.danger-text { color: var(--bad) !important; }
.badge-public { background: var(--accent-soft); color: var(--accent-2); border: 1px solid var(--keyhint-line); }
.badge-private { background: var(--panel-soft); color: var(--muted); border: 1px solid var(--line); }
.badge-imported { background: var(--skip-soft); color: var(--skip); border: 1px solid var(--line); }
.badge-update { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--line); }
.badge-danger { background: var(--bad-soft); color: var(--bad); border: 1px solid var(--line); }
.source-line { color: var(--muted); font-size: 12px; margin-top: 8px; }
.mine-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.library-card { border: 1px solid var(--line); border-radius: 4px; background: var(--panel); padding: 14px; display: flex; flex-direction: column; gap: 8px; min-height: 190px; }
.library-card:hover { border-color: var(--line-strong); }
.library-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.library-card-title { font-size: 16px; font-weight: 600; color: var(--ink); }
.library-badges { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.library-desc { color: var(--muted); font-size: 12px; line-height: 1.55; min-height: 36px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.library-meta { display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.library-meta strong { color: var(--ink); }
.library-actions { margin-top: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.square-page { max-width: 1240px; }
.square-hero { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 18px; align-items: stretch; border: 1px solid var(--line); border-radius: 6px; padding: 18px; background: linear-gradient(135deg, var(--panel), var(--panel-soft)); margin-bottom: 16px; }
.square-hero-copy { display: flex; flex-direction: column; justify-content: center; }
.square-hero-copy h1 { font-size: 34px; margin: 4px 0 8px; letter-spacing: -0.02em; }
.square-hero-card { min-width: 0; }
.square-hero-empty { border: 1px dashed var(--line); border-radius: 4px; padding: 24px; color: var(--muted); text-align: center; }
.square-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; margin-bottom: 8px; }
.square-toolbar .search-box { flex: 1; min-width: 220px; }
.square-sorts { display: flex; gap: 2px; }
.square-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 18px 0 10px; }
.square-section-head h2 { margin: 0; font-size: 17px; }
.square-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.square-card { border: 1px solid var(--line); border-radius: 4px; background: var(--panel); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.square-card:hover { border-color: var(--line-strong); }
.square-card.is-featured { padding: 14px; background: var(--panel-soft); }
.square-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.square-card-tools { display: flex; align-items: center; gap: 6px; flex: none; }
.square-author { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; min-width: 0; }
.avatar-fallback { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-2); font-size: 11px; font-weight: 600; flex: none; }
.like-btn { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 2px; background: var(--panel); color: var(--muted); padding: 3px 7px; cursor: pointer; font-size: 12px; }
.like-btn:hover { border-color: var(--accent); color: var(--accent-2); }
.like-btn.is-liked { background: var(--accent-soft); border-color: var(--keyhint-line); color: var(--accent-2); }
.fav-btn { padding: 3px 6px; }
.bank-source-support { margin: 12px 0 0; }
.square-card-main { display: flex; flex-direction: column; gap: 6px; color: var(--ink); }
.square-card-main h3 { margin: 0; font-size: 16px; }
.square-card-main p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; min-height: 36px; }
.square-card-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 11px; border-top: 1px solid var(--line); padding-top: 8px; }
.square-card-foot .text-btn { margin-left: auto; color: var(--accent-2); }

.square-detail-page { max-width: 1120px; }
.square-detail-head { display: grid; grid-template-columns: 1fr auto; gap: 18px; border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 16px; }
.square-detail-copy h1 { margin: 8px 0; }
.square-detail-desc { color: var(--muted); line-height: 1.7; margin: 10px 0; }
.square-detail-stats { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.square-detail-stats strong { color: var(--ink); }
.square-detail-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; min-width: 150px; }
.support-section { display: flex; justify-content: space-between; align-items: center; gap: 16px; border: 1px solid var(--line); border-radius: 4px; padding: 14px; background: var(--panel-soft); margin: 16px 0; }
.support-section h2 { margin: 2px 0 6px; font-size: 16px; }
.support-section .muted { max-width: 560px; font-size: 12px; line-height: 1.6; }
.support-qr { width: 132px; height: 132px; border: 1px solid var(--line); background: #fff; padding: 6px; border-radius: 3px; image-rendering: pixelated; }
.support-editor { border: 1px solid var(--line); border-radius: 4px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.support-editor-head { display: flex; justify-content: space-between; align-items: center; }
.support-file-row { display: flex; align-items: center; gap: 8px; }
.support-file-row label { cursor: pointer; }
.support-file-name { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.question-preview-list { border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.preview-row { display: flex; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--panel); }
.preview-row:first-child { border-top: none; }
.preview-index { color: var(--muted); font-family: var(--mono); font-size: 12px; min-width: 24px; }
.preview-stem { color: var(--ink); line-height: 1.6; }
.preview-meta { color: var(--muted); font-size: 11px; margin-top: 4px; }
.version-list { border: 1px solid var(--line); border-radius: 4px; }
.version-row { display: flex; gap: 16px; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 12px; }
.version-row:first-child { border-top: none; }
.square-detail-layout { display: grid; gap: 16px; align-items: start; }
.square-info-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.square-info-card h1 { margin: 0; font-size: clamp(21px, 2.2vw, 28px); line-height: 1.3; }
.square-info-card .square-detail-actions { flex-direction: row; flex-wrap: wrap; align-items: center; min-width: 0; }
.square-info-desc { border-top: 1px solid var(--line); padding-top: 14px; }
.square-info-desc h2 { margin: 0 0 8px; font-size: 14px; color: var(--muted); font-weight: 600; }
.square-info-desc .bank-info-desc { min-height: 140px; font-size: 14px; line-height: 1.8; }
.square-info-card .square-support { flex-direction: row; align-items: center; justify-content: space-between; margin: 0; gap: 16px; }
.square-info-card .square-support .support-qr { width: 128px; height: 128px; flex: none; }
.square-detail-layout:not(.is-preview-open) .square-info-card { width: 100%; max-width: 920px; margin: 0 auto; }
.square-version-section .square-section-head { margin: 0 0 8px; }
.square-preview-panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 14px; min-width: 0; }
.square-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.square-preview-head h2 { margin: 0; font-size: 16px; }
.square-preview-list { border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
html[data-layout-mode="desktop"] .square-detail-layout.is-preview-open { grid-template-columns: minmax(0, 0.384fr) minmax(0, 0.616fr); }
html[data-layout-mode="desktop"] .square-detail-layout.is-preview-open .square-info-card { position: sticky; top: calc(var(--topbar-h) + 14px); max-height: calc(100vh - var(--topbar-h) - 28px); overflow: auto; }
html[data-layout-mode="desktop"] .square-preview-list { max-height: calc(100vh - var(--topbar-h) - 120px); overflow: auto; }
html[data-layout-mode="mobile"] .square-detail-layout.is-preview-open { grid-template-columns: minmax(0, 1fr); }
html[data-layout-mode="mobile"] .square-preview-list { max-height: 60vh; overflow: auto; }

.search-page { max-width: 1000px; }
.search-panel { border: 1px solid var(--line); border-radius: 4px; padding: 12px; background: var(--panel); margin-bottom: 14px; }
.search-main-row { display: flex; gap: 8px; }
.search-large { flex: 1; min-width: 0; min-height: 40px; padding: 4px 10px; }
.search-large input { flex: 1; width: auto; min-width: 0; font-size: 14px; }
.search-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.search-filters select, .search-filters input { height: 30px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 0 8px; border-radius: 2px; }
.search-results { display: grid; gap: 8px; }
.search-result { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; background: var(--panel); }
.search-result-check { flex: none; display: flex; align-items: center; padding: 0 2px; cursor: pointer; }
.search-result-check input { width: 16px; height: 16px; accent-color: var(--accent-2); cursor: pointer; }
.search-result.is-selected { border-color: var(--accent-2); background: var(--accent-soft); }
.search-selection { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }
.search-selection[hidden] { display: none; }
.search-result-main { flex: 1; min-width: 0; }
.search-result-stem { line-height: 1.6; }
.search-result-meta { display: flex; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 11px; margin-top: 4px; align-items: center; }
.search-result-stem mark { background: var(--accent-soft); color: var(--accent-2); padding: 0 1px; border-radius: 2px; }
.search-badge { display: inline-block; margin-right: 6px; padding: 0 5px; border: 1px solid var(--line); border-radius: 2px; font-size: 11px; color: var(--accent-2); background: var(--accent-soft); vertical-align: 1px; }
.search-hint { color: var(--muted); font-size: 11px; }
.search-result-actions { display: flex; gap: 6px; flex: none; }
.similar-list { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; }
.similar-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 12px; }
.similar-row:first-of-type { border-top: none; }

.compose-page { max-width: 1280px; }
.compose-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
.compose-main { min-width: 0; }
.compose-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; border: 1px solid var(--line); border-radius: 4px; padding: 10px; background: var(--panel); }
.compose-filters select, .compose-filters input { height: 30px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 0 8px; border-radius: 2px; }
.compose-filters .search-box { flex: 1; min-width: 180px; }
.compose-result-head { display: flex; align-items: center; justify-content: space-between; margin: 12px 0 8px; }
.compose-results { display: grid; gap: 6px; }
.compose-row { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 3px; padding: 8px 10px; background: var(--panel); cursor: pointer; }
.compose-row:hover { border-color: var(--line-strong); }
.compose-row input { margin-top: 4px; }
.compose-row-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.compose-stem { line-height: 1.5; font-size: 13px; }
.compose-meta { color: var(--muted); font-size: 11px; }
.compose-basket { border: 1px solid var(--line); border-radius: 4px; background: var(--panel); padding: 12px; position: sticky; top: calc(var(--topbar-h) + 12px); max-height: calc(100vh - var(--topbar-h) - 24px); display: flex; flex-direction: column; gap: 10px; }
.basket-head { display: flex; justify-content: space-between; align-items: center; }
.basket-head h2 { margin: 0; font-size: 15px; }
.basket-list { overflow: auto; max-height: 260px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.basket-row { display: flex; gap: 6px; align-items: center; padding: 5px 0; border-top: 1px solid var(--line); font-size: 12px; }
.basket-row:first-child { border-top: none; }
.basket-row span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.basket-form { display: flex; flex-direction: column; gap: 8px; }
.btn-block { width: 100%; justify-content: center; }
.report-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.share-page { max-width: 720px; }
.share-card { border: 1px solid var(--line); border-radius: 6px; padding: 22px; background: var(--panel); display: flex; flex-direction: column; gap: 10px; }
.share-card h1 { margin: 0; }
.share-desc { color: var(--muted); line-height: 1.7; }
.share-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

@media (max-width: 900px) {
  .square-hero { grid-template-columns: 1fr; }
  .square-detail-head { grid-template-columns: 1fr; }
  .square-detail-actions { flex-direction: row; flex-wrap: wrap; }
  .compose-layout { grid-template-columns: 1fr; }
  .compose-basket { position: static; max-height: none; }
  .library-grid, .square-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .page-head-actions { width: 100%; }
  .page-head-actions .btn { flex: 1; justify-content: center; }
  .search-result { align-items: flex-start; flex-direction: column; position: relative; }
  .search-result-check { position: absolute; top: 10px; right: 12px; }
  .search-result-stem { padding-right: 26px; }
  .search-result-actions { width: 100%; }
  .search-result-actions .btn { flex: 1; }
  .support-section { flex-direction: column; align-items: flex-start; }
  .bank-head-actions .btn { flex: 1; }
  .report-options { grid-template-columns: 1fr; }
}

/* square sort tabs must not inherit the 6px progress-bar height */
.square-sorts { height: auto; margin: 0; background: none; overflow: visible; gap: 4px; }
.square-sorts button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 2px;
  cursor: pointer;
  white-space: nowrap;
}
.square-sorts button:hover { border-color: var(--line-strong); color: var(--ink); }
.square-sorts button.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-2); }

@media (max-width: 719px) {
  .topbar { gap: 6px; padding-left: 8px; padding-right: 8px; }
  .topbar .brand { min-width: 0; flex: 0 1 auto; }
  .topbar .brand-text { min-width: 0; }
  .topbar .brand-text strong { font-size: 16px; }
  .topbar .brand-text small { display: none; }
  .topbar .topnav { flex: 1 1 auto; min-width: 0; gap: 1px; overflow-x: auto; scrollbar-width: none; }
  .topbar .topnav a { padding: 4px 5px; font-size: 12px; white-space: nowrap; }
  .topbar .user-chip span { max-width: 52px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .square-toolbar { align-items: stretch; }
  .square-sorts { overflow-x: auto; }
}

@media (max-width: 719px) {
  .topbar .brand-text { display: none; }
  .topbar .brand { flex: none; }
  .topbar .user-chip span:not(.avatar) { display: none; }
  .topbar .user-chip { padding: 3px 5px; }
  .topbar .topnav { justify-content: center; }
}

.search-mode { display: inline-flex; border: 1px solid var(--line); border-radius: 2px; overflow: hidden; }
.search-mode button { border: 0; background: var(--panel); color: var(--muted); padding: 5px 9px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.search-mode button + button { border-left: 1px solid var(--line); }
.search-mode button.is-active { background: var(--accent-soft); color: var(--accent-2); }
.search-mode button:disabled { opacity: .45; cursor: not-allowed; }


/* 解析区内的选项解析折叠列表（v20261123e） */
.opt-analysis-list {
  margin: 12px 0 0;
  border-top: 1px solid var(--line);
}

.opt-analysis-head {
  margin: 6px 0 2px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent-2);
}

.opt-analysis-item {
  margin: 0;
}

.opt-analysis-item + .opt-analysis-item {
  border-top: 1px dashed var(--line);
}

.opt-analysis-toggle {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  width: 100%;
  padding: 4px 6px;
  border: 0;
  border-radius: 2px;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
}

.opt-analysis-toggle:hover {
  background: var(--hover);
}

.opt-analysis-arrow {
  flex: none;
  width: 0;
  height: 0;
  margin-top: 7px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--muted);
  transition: transform 0.15s ease;
}

.opt-analysis-item.is-open .opt-analysis-arrow {
  transform: rotate(180deg);
}

.opt-analysis-label {
  min-width: 0;
}

.opt-analysis-body {
  margin: 0 0 2px 19px;
  padding: 2px 6px 6px;
  border-left: 2px solid var(--accent-2);
  font-size: 12.5px;
  line-height: 1.65;
}

.opt-analysis-body p:last-child {
  margin-bottom: 0;
}


/* ---------- practice quick settings (global) ---------- */

.practice-settings-modal {
  width: min(560px, 100%);
}

.practice-settings-modal .modal-head h2 {
  font-size: 18px;
}

.practice-settings-modal .modal-head p {
  font-size: 12.5px;
}

.practice-settings {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 20px 6px;
}

.practice-settings .settings-row {
  padding: 8px 0;
}

.practice-settings .settings-row.is-disabled {
  opacity: 0.45;
}

.practice-settings .settings-row:last-child {
  padding-bottom: 2px;
}

.ps-section {
  padding: 2px 0 4px;
  border-top: 1px solid var(--line);
}

.ps-section:first-child {
  border-top: none;
}

.ps-section h3 {
  margin: 6px 0 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ps-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 46px;
  padding: 8px 0;
  border-top: 1px dashed var(--line);
}

.ps-section h3 + .ps-row {
  border-top: none;
}

.ps-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ps-copy strong {
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
}

.ps-copy small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.ps-check {
  flex: none;
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

.ps-select {
  flex: none;
  min-width: 108px;
  min-height: 34px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel);
  color: var(--ink);
  font-size: 13px;
}

.ps-row-sub {
  padding-left: 14px;
}

.ps-row.is-disabled {
  opacity: 0.45;
}

.ps-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding: 11px 0 2px;
  border-top: 1px solid var(--line);
}

.practice-settings-modal .text-btn {
  font-size: 12.5px;
}

/* ---------- question source banks ---------- */

.q-banks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.q-banks-label {
  flex: none;
}

.q-bank-link {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel-soft);
  color: var(--ink);
  font-size: 12px;
}

.q-bank-link:hover {
  border-color: var(--accent);
  color: var(--accent-2);
}

/* ---------- related banks modal ---------- */

.related-banks {
  display: grid;
  gap: 6px;
}

.related-bank {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel);
  color: var(--ink);
}

.related-bank:hover {
  border-color: var(--accent);
  background: var(--hover);
}

.related-bank-name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
}

.related-bank-kind {
  flex: none;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--muted);
  font-size: 10.5px;
}

.related-bank .icon {
  flex: none;
  color: var(--muted);
}

@media (max-width: 719px) {
  .practice-settings {
    padding: 12px 14px 4px;
  }

  .ps-row {
    gap: 10px;
  }

  .ps-copy small {
    font-size: 11.5px;
  }
}

/* ---------- announcements ---------- */

.announcement-btn {
  position: relative;
}

.announcement-badge {
  position: absolute;
  top: 2px;
  right: 1px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 7px;
  background: var(--bad);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
}

.announcement-modal {
  width: min(600px, 100%);
}

.announcement-list {
  max-height: min(62vh, 620px);
  overflow: auto;
  padding-top: 4px;
  padding-bottom: 4px;
}

.announcement-item {
  border-top: 1px solid var(--line);
}

.announcement-item:first-child {
  border-top: none;
}

.announcement-row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 10px 2px;
  border: 0;
  background: none;
  color: var(--ink);
  text-align: left;
}

.announcement-row:hover {
  background: var(--hover);
}

.announcement-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: transparent;
}

.announcement-item.is-unread .announcement-dot {
  background: var(--bad);
}

.announcement-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.announcement-copy strong {
  font-size: 13.5px;
  font-weight: 600;
}

.announcement-copy small {
  color: var(--muted);
  font-size: 11.5px;
}

.announcement-row .icon {
  flex: none;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.announcement-item.is-open .announcement-row .icon {
  transform: rotate(180deg);
}

.announcement-body {
  padding: 0 2px 12px 18px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.7;
}

.announcement-popup-body {
  max-height: 60vh;
  overflow: auto;
  font-size: 13.5px;
  line-height: 1.75;
}

/* ---------- feedback & contributions ---------- */

.contribute-page {
  max-width: 980px;
}

.contribute-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.contribute-tabs button {
  padding: 7px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font-size: 13px;
}

.contribute-tabs button.is-active {
  border-bottom-color: var(--accent);
  color: var(--ink);
  font-weight: 600;
}

.contribute-form {
  max-width: 760px;
}

.contribute-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.contribute-card textarea {
  resize: vertical;
}

.contribute-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 2px;
}

.file-list {
  display: grid;
  gap: 5px;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  font-size: 12px;
}

.file-row span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row small {
  color: var(--muted);
  font-size: 11px;
}

.contribute-mine {
  display: grid;
  gap: 8px;
}

.contribute-item {
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.contribute-item-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.contribute-item-head strong {
  font-size: 13.5px;
}

.contribute-item-head .muted {
  margin-left: auto;
  font-size: 11px;
}

.contribute-item-body {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.contribute-links {
  display: grid;
  gap: 2px;
  margin-top: 6px;
  font-size: 12px;
  word-break: break-all;
}

.contribute-reply {
  margin-top: 8px;
  padding: 7px 9px;
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  font-size: 12.5px;
}

.contribute-reply span {
  color: var(--accent-2);
  font-weight: 600;
}

.contribute-reply p {
  margin-top: 2px;
  white-space: pre-wrap;
}

@media (max-width: 719px) {
  .contribute-tabs button {
    flex: 1;
    padding: 8px 4px;
  }

  .contribute-card {
    padding: 12px;
  }

  .contribute-item-head .muted {
    width: 100%;
    margin-left: 0;
  }
}

/* ---------- 非选择题：文本作答 + 判断题 ---------- */

.options.is-judge {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.option-judge {
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 62px;
  padding: 12px;
  font-weight: 600;
}

.option-judge .option-text {
  flex: none;
  font-size: 15px;
}

.option-judge-icon {
  display: inline-flex;
  color: var(--muted);
}

.option-judge.is-selected .option-judge-icon {
  color: var(--accent);
}

.option-judge.is-correct .option-judge-icon {
  color: var(--good);
}

.option-judge.is-wrong .option-judge-icon {
  color: var(--bad);
}

.text-answer {
  margin-top: 14px;
}

.text-draft {
  display: block;
}

.text-draft-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.text-draft textarea {
  width: 100%;
  min-height: 78px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
}

.text-draft textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.text-reveal-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.text-reveal-row .hint {
  margin: 0;
}

.text-result {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.text-verdict {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.text-verdict.is-good {
  border-color: var(--good);
  background: var(--good-soft);
}

.text-verdict.is-bad {
  border-color: var(--bad);
  background: var(--bad-soft);
}

.text-verdict .verdict-icon {
  display: inline-flex;
  margin-top: 1px;
}

.text-verdict strong {
  display: block;
  font-size: 13px;
}

.text-verdict p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.text-mark-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.text-mark {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.text-mark:hover {
  border-color: var(--line-strong);
  background: var(--hover);
}

.text-mark.is-good,
.text-mark.is-active.is-good {
  border-color: var(--good);
  background: var(--good-soft);
  color: var(--good);
}

.text-mark.is-bad,
.text-mark.is-active.is-bad {
  border-color: var(--bad);
  background: var(--bad-soft);
  color: var(--bad);
}

.text-mark.is-active:not(.is-good):not(.is-bad) {
  border-color: var(--skip);
  background: var(--skip-soft);
  color: var(--skip);
}

.text-answer-block {
  border: 1px solid var(--line);
  background: var(--panel);
}

.text-answer-head {
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}

.text-answer-body {
  padding: 9px 11px;
  font-size: 13px;
  line-height: 1.7;
}

.text-answer-body p:first-child {
  margin-top: 0;
}

.text-answer-body p:last-child {
  margin-bottom: 0;
}

/* ---------- 对话内的事件标记与评分须知 ---------- */

.agent-event {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: stretch;
  padding: 4px 0;
  color: var(--muted);
  font-size: 11.5px;
}

.agent-event-line {
  flex: 1;
  height: 1px;
  background: var(--line);
}

.agent-event-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.agent-panel {
  position: relative;
}

.agent-grade-notice {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: var(--overlay);
}

.grade-notice-card {
  width: min(420px, 100%);
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.grade-notice-card h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.grade-notice-list {
  margin: 0 0 10px;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.grade-notice-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

/* 首页宽度固定为 1120，避免桌面布局模式下的 1440 覆盖 */
html[data-layout-mode="desktop"] .home-page {
  max-width: 1120px;
}

/* 桌面模式但窄视口（例如手机比例直接打开）：首页按单列排，避免 7 天柱状图溢出列表 */
@media (max-width: 760px) {
  .home-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .home-today {
    padding-bottom: 0;
  }

  .home-feature-main {
    gap: 12px;
  }

  .home-feature-copy {
    min-width: 0;
  }

  .home-feature-meta {
    flex-wrap: wrap;
    gap: 4px 12px;
  }

  .home-feature-enter {
    margin-left: 0;
  }

  .home-guide {
    flex-wrap: wrap;
  }

  .home-guide-copy {
    flex: 1;
  }

  .home-guide .btn {
    width: 100%;
    margin-left: 0;
  }

  .home-bank-row {
    grid-template-areas:
      "name last"
      "progress progress"
      "week week";
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 10px;
    padding: 10px 12px;
  }

  .home-bank-name {
    grid-area: name;
    min-width: 0;
  }

  .home-bank-progress {
    grid-area: progress;
    min-width: 0;
  }

  .home-week {
    grid-area: week;
  }

  .home-bank-last {
    grid-area: last;
  }

  .home-bank-row > .icon {
    display: none;
  }
}
.library-moderation { color: var(--bad); font-size: 11px; line-height: 1.5; }
.moderation-notice { border: 1px solid var(--line-strong); background: var(--bad-soft); color: var(--bad); padding: 8px 10px; border-radius: 4px; font-size: 12px; line-height: 1.6; margin: 8px 0; }

/* 手机端：我的题库 / 广场卡片压缩（参考官方题库卡） */
html[data-layout-mode="mobile"] .library-grid,
html[data-layout-mode="mobile"] .square-grid { gap: 8px; }
html[data-layout-mode="mobile"] .library-card {
  min-height: 0;
  padding: 10px 11px;
  gap: 5px;
}
html[data-layout-mode="mobile"] .library-card-head { gap: 6px; align-items: center; }
html[data-layout-mode="mobile"] .library-card-title {
  min-width: 0;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html[data-layout-mode="mobile"] .library-desc { display: none; }
html[data-layout-mode="mobile"] .library-meta { gap: 8px; font-size: 11px; }
html[data-layout-mode="mobile"] .library-seq-count { display: none; }
html[data-layout-mode="mobile"] .library-card .source-line { font-size: 11px; }
html[data-layout-mode="mobile"] .library-actions { gap: 4px; margin-top: 0; }
html[data-layout-mode="mobile"] .library-actions .btn { padding: 4px 8px; font-size: 11px; }
html[data-layout-mode="mobile"] .library-moderation { font-size: 11px; }

html[data-layout-mode="mobile"] .square-card { padding: 10px 11px; gap: 5px; }
html[data-layout-mode="mobile"] .square-card-top { gap: 6px; }
html[data-layout-mode="mobile"] .square-author { font-size: 11px; }
html[data-layout-mode="mobile"] .like-btn { padding: 2px 6px; font-size: 11px; }
html[data-layout-mode="mobile"] .square-card-main { gap: 3px; }
html[data-layout-mode="mobile"] .square-card-main h3 {
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html[data-layout-mode="mobile"] .square-card-main p {
  min-height: 0;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html[data-layout-mode="mobile"] .square-card-foot { padding-top: 6px; gap: 6px; font-size: 10.5px; }
html[data-layout-mode="mobile"] .square-card-foot .text-btn { font-size: 11px; }

@media (max-width: 719px) {
  .library-grid, .square-grid { gap: 8px; }
  .library-card { min-height: 0; padding: 10px 11px; gap: 5px; }
  .library-card-head { gap: 6px; align-items: center; }
  .library-card-title { min-width: 0; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .library-desc { display: none; }
  .library-meta { gap: 8px; font-size: 11px; }
  .library-seq-count { display: none; }
  .library-actions { gap: 4px; margin-top: 0; }
  .library-actions .btn { padding: 4px 8px; font-size: 11px; }
  .square-card { padding: 10px 11px; gap: 5px; }
  .square-author { font-size: 11px; }
  .like-btn { padding: 2px 6px; font-size: 11px; }
  .square-card-main { gap: 3px; }
  .square-card-main h3 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .square-card-main p { min-height: 0; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .square-card-foot { padding-top: 6px; gap: 6px; font-size: 10.5px; }
}

html[data-layout-mode="mobile"] .mine-toolbar { gap: 8px; }
html[data-layout-mode="mobile"] .mine-toolbar .search-box { flex: 1; min-width: 0; }
html[data-layout-mode="mobile"] .mine-toolbar [data-count] { flex: none; white-space: nowrap; font-size: 11px; }

/* ---------- compose editor rebuild (v20261129a) ---------- */
.compose-page { max-width: 1440px; }
.compose-source { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); padding: 10px; margin-bottom: 12px; }
.compose-bank-select { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-width: 270px; max-width: min(460px, 100%); padding: 7px 10px; border: 1px solid var(--line); border-radius: 3px; background: var(--panel-soft); color: var(--ink); text-align: left; cursor: pointer; }
.compose-bank-select:hover { border-color: var(--accent); }
.compose-bank-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.compose-bank-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compose-bank-meta { font-size: 11.5px; color: var(--muted); }
.compose-bank-action { flex: none; color: var(--accent-2); font-size: 12px; }
.compose-source-field { min-width: 200px; }
.compose-status-field { min-width: 130px; }
.compose-filter-toggle { display: none; }
.compose-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.compose-filters { display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); padding: 12px; position: sticky; top: calc(var(--topbar-h) + 12px); }
.compose-filter-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.compose-filter-head strong { font-size: 13px; }
.compose-filter-grid { display: flex; flex-direction: column; gap: 8px; }
.compose-filter-grid .field { font-size: 12px; }
.compose-filter-grid select, .compose-filter-grid input { width: 100%; height: 30px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 0 8px; border-radius: 2px; font-size: 12.5px; }
.compose-main { min-width: 0; }
.compose-result-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 8px; flex-wrap: wrap; }
.compose-results { display: grid; gap: 6px; }
.compose-row { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 3px; padding: 8px 10px; background: var(--panel); cursor: pointer; }
.compose-row:hover { border-color: var(--line-strong); }
.compose-row input { margin-top: 4px; }
.compose-row-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.compose-stem { line-height: 1.5; font-size: 13px; }
.compose-meta { color: var(--muted); font-size: 11px; }
.compose-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: calc(var(--topbar-h) + 12px); max-height: calc(100vh - var(--topbar-h) - 24px); overflow: auto; }
.compose-meta-panel, .compose-basket { border: 1px solid var(--line); border-radius: 4px; background: var(--panel); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.compose-basket { position: static; max-height: none; }
.compose-basket .basket-list { max-height: 220px; }
.bank-picker-modal { width: min(760px, 100%); }
.bank-picker-body { display: flex; flex-direction: column; gap: 10px; }
.bank-picker-body .segmented { width: fit-content; }
.bank-picker-list { max-height: 55vh; overflow: auto; border-top: 1px solid var(--line); }
.bank-picker-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 9px 6px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); text-align: left; cursor: pointer; }
.bank-picker-row:last-child { border-bottom: none; }
.bank-picker-row:hover { background: var(--panel-soft); }
.bank-picker-row.is-current { background: var(--accent-soft); }
.bank-picker-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bank-picker-name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bank-picker-meta { font-size: 11.5px; color: var(--muted); }
.bank-picker-side { flex: none; color: var(--accent-2); font-size: 11.5px; }
@media (max-width: 1100px) {
  .compose-layout { display: flex; flex-direction: column; }
  .compose-filters { display: none; position: static; width: 100%; order: 1; }
  .compose-filters.is-open { display: flex; }
  .compose-filter-toggle { display: inline-flex; }
  .compose-side { display: contents; }
  .compose-meta-panel { order: 2; }
  .compose-main { order: 3; }
  .compose-basket { order: 4; }
  .compose-bank-select { flex: 1 1 100%; min-width: 0; max-width: none; }
  .compose-source-field { flex: 1 1 180px; }
}
@media (max-width: 719px) {
  .compose-source { align-items: stretch; }
  .compose-source-field, .compose-status-field { min-width: 0; }
  .compose-result-head { align-items: flex-start; }
  .compose-result-head .settings-actions { flex-wrap: wrap; }
  .compose-meta-panel, .compose-basket { padding: 10px; }
  .compose-basket .basket-list { max-height: 200px; }
  .bank-picker-list { max-height: 60vh; }
}

/* ---------- anonymous preview (2026-11-30) ---------- */
.auth-reason {
  margin: 0 0 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  background: var(--panel-soft);
  color: var(--ink);
  font-size: 12.5px;
}

.auth-back {
  display: inline-block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.auth-back:hover {
  color: var(--accent-2);
}

.guest-home {
  max-width: 1120px;
}

.guest-hero {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  background: var(--panel);
  padding: 26px 24px;
}

.guest-hero h1 {
  margin-top: 4px;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.guest-lead {
  max-width: 640px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.guest-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.guest-bank-list {
  border: 1px solid var(--line);
  background: var(--panel);
}

.guest-bank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.guest-bank-row:last-child {
  border-bottom: 0;
}

.guest-bank-row:hover {
  background: var(--hover);
}

.guest-bank-name {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.guest-bank-name strong {
  font-size: 13px;
  line-height: 1.35;
}

.guest-bank-name small {
  color: var(--muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.guest-bank-row > .icon {
  color: var(--muted);
}

.guest-bank-cta {
  max-width: 560px;
}

html[data-layout-mode="mobile"] .guest-hero {
  padding: 20px 16px;
}

html[data-layout-mode="mobile"] .guest-hero h1 {
  font-size: 23px;
}

.captcha-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.captcha-row img {
  width: 138px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}

.captcha-row .btn {
  width: auto;
  white-space: nowrap;
}

.hp-field {
  position: absolute !important;
  left: -10000px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
