/* =============================================================
   互相问卷 · 视觉系统 v2  「竞技终端 / ARENA TERMINAL」
   -------------------------------------------------------------
   设计语言：游戏官网 / 电竞终端。排版驱动、硬朗几何、克制的双主题。
   · 拒绝 AI 俗套：无渐变光晕 / 无玻璃拟态 / 无胶囊圆角 / 无彩色发光。
   · 语言特征：细网格底、等宽编号(01/02)、大写英文 kicker、切角、实线框。
   · THEME LIGHT  钴蓝粉 COBALT+PINK —— 冷白底 / 钴蓝主 / 品红强调
   · THEME DARK   黑金 OBSIDIAN+GOLD —— 近黑底 / 哑金主 / 米白字
   纯 CSS，浏览器直接加载；所有组件消费语义令牌。
   ============================================================= */

/* ============ 令牌 · 亮色（钴蓝粉 / 默认） ============ */
:root {
  color-scheme: light;

  /* 中性阶 —— 冷白灰，带极淡蓝味 */
  --n-0: #ffffff;
  --n-50: #f7f8fb;
  --n-100: #eef0f5;
  --n-200: #e2e6ee;
  --n-300: #c9cfdb;
  --n-500: #8b94a6;
  --n-700: #4a5366;
  --n-900: #1a2130;
  --n-950: #0e1420;

  /* 品牌：钴蓝 + 品红 */
  --brand: #2b4bd8;
  --brand-deep: #1d36a8;
  --brand-ink: #ffffff;
  --signal: #d81e5b;         /* 品红：强调 / 编号 / 激活标记 */
  --signal-ink: #ffffff;

  /* 语义 */
  --primary: var(--brand);
  --primary-hover: var(--brand-deep);
  --primary-ink: var(--brand-ink);
  --primary-soft: #e9edff;
  --accent: var(--signal);
  --accent-soft: #ffe9f0;

  --bg: #f4f6fa;
  --grid: rgba(30, 49, 92, .045);
  --surface: var(--n-0);
  --surface-2: var(--n-50);
  --surface-sunken: var(--n-100);

  --text: var(--n-900);
  --text-soft: var(--n-700);
  --muted: var(--n-500);

  --line: var(--n-200);
  --line-strong: var(--n-300);
  --line-ink: var(--n-900);

  --ok: #12855f;
  --ok-soft: #e3f6ee;
  --warn: #b47516;
  --warn-soft: #fbf1dc;
  --danger: #cc2347;
  --danger-soft: #fde9ee;

  /* 字体：系统无衬线 + 等宽（编号 / 标签 / 数据） */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Cascadia Code", Consolas, "Liberation Mono", monospace;

  /* 形状：小圆角，硬朗 */
  --r: 4px;
  --r-sm: 3px;
  --r-lg: 6px;
  --hair: 1px;

  --ease: cubic-bezier(.2, .7, .3, 1);
  --dur: .28s;

  --header-bg: #ffffff;
  --avatar-ring: var(--brand);
}

/* ============ 令牌 · 暗色（黑金 / 曜金） ============ */
:root[data-theme="dark"] {
  color-scheme: dark;

  --n-0: #1a1a1d;
  --n-50: #161619;
  --n-100: #131316;
  --n-200: #26262b;
  --n-300: #3a3932;
  --n-500: #7e7a6f;
  --n-700: #b8b2a2;
  --n-900: #efe9d9;
  --n-950: #f7f1e2;

  /* 品牌：哑光金 */
  --brand: #d9b25f;
  --brand-deep: #b89443;
  --brand-ink: #17130a;
  --signal: #e8cd91;
  --signal-ink: #17130a;

  --primary: var(--brand);
  --primary-hover: var(--brand-deep);
  --primary-ink: var(--brand-ink);
  --primary-soft: rgba(217, 178, 95, .13);
  --accent: var(--signal);
  --accent-soft: rgba(232, 205, 145, .10);

  --bg: #0c0c0e;
  --grid: rgba(217, 178, 95, .045);
  --surface: var(--n-0);
  --surface-2: var(--n-50);
  --surface-sunken: var(--n-100);

  --text: var(--n-900);
  --text-soft: var(--n-700);
  --muted: var(--n-500);

  --line: var(--n-200);
  --line-strong: var(--n-300);
  --line-ink: #8f7540;

  --ok: #5fc79b;
  --ok-soft: rgba(95, 199, 155, .12);
  --warn: #e0b45e;
  --warn-soft: rgba(224, 180, 94, .12);
  --danger: #ef6b79;
  --danger-soft: rgba(239, 107, 121, .12);

  --header-bg: #101013;
  --avatar-ring: var(--brand);
}

/* ============ 基础 ============ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.hidden { display: none !important; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--primary); color: var(--primary-ink); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* 等宽标签 / 编号 / kicker —— 竞技终端的核心语汇 */
.mono { font-family: var(--mono); }
.kicker {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.kicker::before { content: ""; width: 18px; height: 2px; background: var(--signal); flex: none; }

/* ============ 卡片：细实线框 + 极微过渡（无发光阴影） ============ */
.card {
  background: var(--surface);
  border: var(--hair) solid var(--line);
  border-radius: var(--r);
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

/* ============ 按钮：切角 / 实色 / 无渐变 ============ */
.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: var(--hair) solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 9px 16px;
  min-height: 40px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .3px;
  cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .12s ease;
}
.button:hover { border-color: var(--primary); color: var(--primary); }
.button:active { transform: translateY(1px); }
.button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
}
.button.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-ink); }

.button.ghost { background: transparent; border-color: transparent; }
.button.ghost:hover { background: var(--surface-sunken); border-color: transparent; }
.button.small { padding: 5px 11px; min-height: 32px; font-size: 12px; }
.button.danger { color: var(--danger); }
.button.danger:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.button.block { display: flex; width: 100%; }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.button[disabled]:hover { border-color: var(--line-strong); color: var(--text); }

/* ============ 表单 ============ */
.input, textarea.input, select.input {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: var(--hair) solid var(--line-strong);
  border-radius: var(--r-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.input::placeholder { color: var(--muted); }
.input:hover { border-color: var(--text-soft); }
.input:focus { border-color: var(--primary); box-shadow: inset 3px 0 0 var(--signal); }
textarea.input { resize: vertical; min-height: 84px; }
select.input { cursor: pointer; }
.field-label {
  display: block; margin: 14px 0 6px;
  font-family: var(--mono);
  font-size: 11px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-soft);
}
.form-error { color: var(--danger); min-height: 20px; margin-top: 8px; font-size: 13px; }
.muted { color: var(--muted); }
.right { text-align: right; }

/* ============ 登录页：左侧品牌排版 + 右侧接入框 ============ */
.login-view {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  overflow: hidden;
  background: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 44px 44px;
}
/* 顶部/底部实心装饰条 —— 游戏官网常见的框架感 */
.login-view::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px;
  background: var(--primary);
}
.login-view::after {
  content: "MUTUAL QUIZ  /  SECURE ACCESS  /  v1.0";
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 10px 24px; text-align: center;
  font-family: var(--mono); font-size: 10px; letter-spacing: 2px;
  color: var(--muted); border-top: var(--hair) solid var(--line);
  background: var(--surface);
}
.login-shell {
  position: relative; z-index: 1;
  width: 100%; max-width: 860px;
  display: grid; grid-template-columns: 1fr 400px;
  gap: 0;
  border: var(--hair) solid var(--line-strong);
  background: var(--surface);
}
.login-hero {
  padding: 48px 44px;
  display: flex; flex-direction: column;
  border-right: var(--hair) solid var(--line);
  position: relative;
  overflow: hidden;
}
/* 角落准星装饰 */
.login-hero::before {
  content: ""; position: absolute; right: -1px; top: -1px;
  width: 26px; height: 26px;
  border-right: 3px solid var(--signal); border-top: 3px solid var(--signal);
}
.login-hero::after {
  content: ""; position: absolute; left: -1px; bottom: -1px;
  width: 26px; height: 26px;
  border-left: 3px solid var(--primary); border-bottom: 3px solid var(--primary);
}

.login-hero .hero-mark {
  font-family: var(--mono); font-size: 11px; letter-spacing: 3px;
  color: var(--signal); font-weight: 700; text-transform: uppercase;
}
/* 镂空描边大标题 —— 游戏官网标志性的巨型排版 */
.login-hero .hero-title {
  margin: 22px 0 0;
  font-size: clamp(46px, 6.4vw, 74px);
  font-weight: 900;
  line-height: 1.02;
  letter-spacing: -2px;
  color: var(--text);
}
.login-hero .hero-title .solid { color: var(--text); }
.login-hero .hero-title .outline {
  color: transparent;
  -webkit-text-stroke: 1.5px var(--brand);
  text-stroke: 1.5px var(--brand);
}
.login-hero .hero-en {
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 2.5px;
  color: var(--muted); text-transform: uppercase;
  line-height: 1.9;
}
.login-hero .hero-rule {
  width: 56px; height: 3px; background: var(--signal);
  margin: 26px 0 20px;
}
.login-hero .hero-desc {
  color: var(--text-soft); font-size: 14px; line-height: 1.9;
  max-width: 320px;
}
.login-hero .hero-spec {
  margin-top: auto; padding-top: 36px;
  display: flex; gap: 28px; flex-wrap: wrap;
}
.spec-item { display: flex; flex-direction: column; gap: 3px; }
.spec-item .v { font-family: var(--mono); font-size: 18px; font-weight: 700; color: var(--text); }
.spec-item .k { font-family: var(--mono); font-size: 10px; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }

.login-box { padding: 40px 34px 30px; }
.login-box .box-kicker { margin-bottom: 20px; }
.login-box .login-logo {
  font-size: 24px; font-weight: 800; letter-spacing: .5px;
  color: var(--text);
}
.login-box .login-logo .tick { color: var(--signal); }
.login-sub { color: var(--muted); margin: 4px 0 26px; font-size: 13px; }
.login-tip {
  margin: 18px 0 0; padding-top: 14px;
  border-top: var(--hair) dashed var(--line);
  color: var(--muted); font-size: 12px; font-family: var(--mono); line-height: 1.7;
}
/* 登录页主题切换：直角小按钮 */
.theme-fab {
  position: absolute; top: 22px; right: 24px; z-index: 3;
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border: var(--hair) solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  transition: color .18s ease, border-color .18s ease, background-color .18s ease;
}
.theme-fab:hover { color: var(--primary); border-color: var(--primary); }
.theme-fab svg { width: 19px; height: 19px; }

/* ============ 顶部栏：实色、框架线、编号 ============ */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: 60px;
  background: var(--header-bg);
  border-bottom: var(--hair) solid var(--line-strong);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: var(--primary-ink);
  border-radius: var(--r-sm);
  font-size: 15px; font-weight: 900;
  clip-path: polygon(0 0, 100% 0, 100% 74%, 74% 100%, 0 100%);
}
.brand-name { font-size: 17px; font-weight: 800; letter-spacing: .5px; color: var(--text); }
.brand-name .sub { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-left: 8px; letter-spacing: 1px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

/* 头像 */
.avatar-button {
  position: relative; border: none; background: transparent; padding: 0;
  cursor: pointer; transition: transform .18s var(--ease);
}
.avatar-button:hover { transform: translateY(-1px); }
.avatar {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft);
  color: var(--primary);
  border: var(--hair) solid var(--primary);
  border-radius: var(--r-sm);
  font-family: var(--mono);
  font-size: 15px; font-weight: 700;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.status-dot {
  position: absolute; right: -2px; bottom: -2px;
  width: 9px; height: 9px; background: var(--ok);
  border: 2px solid var(--header-bg);
}
.username { font-weight: 600; margin: 0 4px 0 2px; color: var(--text); }

/* 三态主题切换：直角分段控件 */
.theme-switch {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 3px;
  border: var(--hair) solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface-sunken);
}
.theme-switch button {
  width: 30px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 2px;
  background: transparent; color: var(--muted);
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease;
}
.theme-switch button svg { width: 15px; height: 15px; }
.theme-switch button:hover { color: var(--text); }
.theme-switch button.active { background: var(--primary); color: var(--primary-ink); }

/* ============ Tab：方形、下划线为实心色条 ============ */
.tabs {
  display: flex; gap: 0;
  background: var(--surface);
  border-bottom: var(--hair) solid var(--line);
  padding: 0 24px;
  overflow-x: auto;
}
.tab {
  position: relative;
  border: none; background: transparent; cursor: pointer;
  padding: 14px 18px; min-height: 48px;
  font-family: var(--mono);
  font-size: 12px; font-weight: 600; letter-spacing: 1px;
  color: var(--muted);
  white-space: nowrap;
  transition: color .18s ease;
}
.tab::before {
  content: ""; position: absolute; left: 14px; top: 0;
  font-family: var(--mono); font-size: 9px; color: var(--signal);
}
.tab:nth-child(1)::before { content: "01"; }
.tab:nth-child(2)::before { content: "02"; }
.tab:nth-child(3)::before { content: "03"; }
.tab:nth-child(4)::before { content: "04"; }
.tab { padding-left: 32px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); }
.tab.active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px;
  height: 3px; background: var(--primary);
}

/* ============ 主体 ============ */
.main { max-width: 1000px; margin: 0 auto; padding: 34px 22px 80px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: rise .4s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-title {
  font-size: 23px; font-weight: 800; letter-spacing: .3px; margin: 0 0 20px;
  display: flex; align-items: center; gap: 12px;
}
.page-title::before {
  content: ""; width: 4px; height: 22px; background: var(--signal); flex: none;
}
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.toolbar .page-title { margin: 0; }

/* ============ 卡片列表 ============ */
.card-list { display: flex; flex-direction: column; gap: 12px; }
.list-card {
  padding: 18px 20px;
  border-left: 3px solid var(--line-strong);
  transition: border-color .18s ease, background-color .18s ease;
}
.list-card:hover { border-left-color: var(--signal); background: var(--surface-2); }
.list-card h3 { margin: 0 0 6px; font-size: 16px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.list-card .desc { color: var(--text-soft); margin-bottom: 10px; }
.list-card .meta { color: var(--muted); font-size: 12px; font-family: var(--mono); }
.list-card .actions { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.empty {
  padding: 52px 24px; text-align: center; color: var(--muted);
  border: var(--hair) dashed var(--line-strong);
  font-family: var(--mono); font-size: 13px;
  background: var(--surface-2);
}
.badge {
  display: inline-block; padding: 3px 9px;
  font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .5px;
  clip-path: polygon(0 0, 100% 0, 100% 72%, 92% 100%, 0 100%);
  background: var(--primary-soft); color: var(--primary); margin-left: 6px;
}
.badge.done { background: var(--ok-soft); color: var(--ok); }
.badge.wait { background: var(--surface-sunken); color: var(--muted); }

/* ============ 答题 ============ */
.answer-card { padding: 28px 30px; }
.progress-line { color: var(--muted); font-size: 12px; font-family: var(--mono); margin-bottom: 18px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.progress-bar {
  display: inline-block; width: 180px; height: 6px;
  background: var(--surface-sunken); vertical-align: middle; margin-left: 8px;
  border: var(--hair) solid var(--line);
}
.progress-bar i { display: block; height: 100%; background: var(--primary); transition: width .5s var(--ease); }
.answer-card h3 { font-size: 20px; margin: 0 0 22px; line-height: 1.55; }
.option-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.option {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 15px;
  border: var(--hair) solid var(--line-strong);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .18s ease, background-color .18s ease;
}
.option:hover { border-color: var(--primary); background: var(--surface-2); }
.option:has(input:checked) { border-color: var(--primary); border-left: 3px solid var(--signal); background: var(--primary-soft); }
.option input[type="radio"], .option input[type="checkbox"] { margin: 0; accent-color: var(--primary); width: 16px; height: 16px; }
.option .key { font-family: var(--mono); font-weight: 700; color: var(--signal); font-size: 15px; }
.option input.other-input { flex: 1; max-width: 280px; padding: 7px 10px; border: var(--hair) solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text); }

/* ============ 编辑器 ============ */
.editor-card { padding: 24px 26px; margin-bottom: 16px; }
.editor-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.question-editor {
  border: var(--hair) solid var(--line);
  border-left: 3px solid var(--line-strong);
  padding: 18px; margin-top: 16px;
  background: var(--surface-2);
}
.question-editor .q-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.question-editor .q-head strong { font-family: var(--mono); font-size: 12px; color: var(--signal); letter-spacing: 1px; }
.question-editor .row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.question-editor .row > * { flex: 1; min-width: 140px; }
.question-editor .row.flex-small > * { flex: 0 0 auto; min-width: 0; }
.option-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.option-row .input { flex: 1; }
.option-row .key { font-family: var(--mono); font-weight: 700; color: var(--signal); }
.sub-title { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 1px; color: var(--text-soft); margin: 16px 0 8px; text-transform: uppercase; }
.own-answer-box { background: var(--surface); border: var(--hair) dashed var(--line-strong); padding: 12px 14px; margin-top: 10px; }
.check-label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.check-label input { accent-color: var(--primary); width: 15px; height: 15px; }

/* ============ 历史 ============ */
.subtabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.subtab {
  border: var(--hair) solid var(--line-strong); background: var(--surface);
  padding: 7px 15px; min-height: 36px;
  cursor: pointer; color: var(--text-soft); font-size: 12px; font-family: var(--mono); letter-spacing: .5px;
  transition: all .18s ease;
}
.subtab:hover { border-color: var(--primary); color: var(--primary); }
.subtab.active { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); font-weight: 600; }
.history-card { padding: 18px 20px; margin-bottom: 14px; }
.history-card h3 { margin: 0; font-size: 16px; }
.history-card .meta { color: var(--muted); font-size: 12px; font-family: var(--mono); margin-bottom: 12px; }
.history-q { border-top: var(--hair) solid var(--line); padding: 14px 0 2px; }
.history-q .stem { font-weight: 600; margin-bottom: 6px; }
.history-q .options { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.answer-row { display: flex; gap: 10px; padding: 4px 0; }
.answer-row .label { flex: 0 0 130px; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.answer-row .value { flex: 1; word-break: break-word; }
.dwell { margin-top: 4px; font-size: 12px; font-family: var(--mono); color: var(--primary); }

/* ============ 弹窗 ============ */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-mask { position: absolute; inset: 0; background: rgba(6, 8, 14, .68); animation: fade .2s ease both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  position: relative; width: 100%; max-width: 440px;
  padding: 26px 28px;
  max-height: 90vh; overflow: auto;
  border: var(--hair) solid var(--line-strong);
  border-top: 3px solid var(--signal);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .32);
  animation: pop .32s var(--ease) both;
}
@keyframes pop { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.modal-box h3 { margin: 0 0 6px; font-size: 19px; }
.modal-box h4 { margin: 14px 0 4px; font-size: 12px; font-family: var(--mono); letter-spacing: 1px; text-transform: uppercase; color: var(--text-soft); }
.modal-box form { margin-bottom: 6px; }
.modal-box .button { margin-top: 12px; }
.modal-close {
  position: absolute; right: 10px; top: 8px; border: none; background: transparent;
  font-size: 24px; color: var(--muted); cursor: pointer; line-height: 1; padding: 4px;
}
.modal-close:hover { color: var(--signal); }
hr { border: none; border-top: var(--hair) solid var(--line); margin: 20px 0; }

/* ============ 头像编辑弹窗 ============ */
.avatar-editor { padding: 22px 26px 20px; text-align: center; }
.avatar-editor .editor-title { font-size: 19px; font-weight: 800; margin: 0 0 2px; }
.avatar-editor .editor-hint { color: var(--muted); font-size: 12px; font-family: var(--mono); margin: 0 0 14px; }
.avatar-preview-wrap { position: relative; display: inline-block; margin-bottom: 12px; }
.avatar-preview {
  width: 100px; height: 100px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary);
  border: var(--hair) solid var(--primary);
  font-size: 18px; font-family: var(--mono); font-weight: 700;
  overflow: hidden;
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-camera {
  position: absolute; right: -2px; bottom: 2px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary); color: var(--primary-ink);
  border: 2px solid var(--surface);
  cursor: pointer;
}
.avatar-camera svg { width: 15px; height: 15px; }
.avatar-section-label { text-align: left; font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 1px; color: var(--muted); margin: 14px 0 10px; text-transform: uppercase; }
.avatar-presets { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.avatar-preset {
  width: 40px; height: 40px;
  border: var(--hair) solid var(--line-strong);
  background: var(--surface-sunken); color: var(--text);
  font-family: var(--mono); font-size: 15px; font-weight: 700;
  cursor: pointer;
  transition: transform .18s var(--ease), border-color .18s ease;
}
.avatar-preset:hover { transform: translateY(-3px); border-color: var(--primary); }
.avatar-preset.selected { border-color: var(--primary); box-shadow: inset 0 0 0 2px var(--primary); }
.avatar-editor .editor-actions { display: flex; gap: 10px; margin-top: 18px; }
.avatar-editor .editor-actions .button { flex: 1; margin-top: 0; }
#avatarFileInput { display: none; }

/* ============ Toast：切角、实色 ============ */
.toast {
  position: fixed; left: 50%; top: 20px; transform: translateX(-50%);
  background: var(--n-900); color: var(--bg);
  padding: 11px 22px;
  border-left: 4px solid var(--signal);
  font-size: 13px; font-family: var(--mono); letter-spacing: .3px;
  z-index: 200; max-width: 86vw; text-align: center;
  animation: toastIn .3s var(--ease) both;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast.error { background: var(--danger); color: #fff; border-left-color: var(--n-950); }
.toast.success { background: var(--ok); color: #fff; border-left-color: var(--n-950); }
:root[data-theme="dark"] .toast { background: var(--brand); color: #17130a; }

/* ============ 小工具主页 ============ */
.tool-intro { color: var(--text-soft); margin: -8px 0 20px; font-size: 13px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.tool-card {
  display: block; width: 100%; text-align: left; cursor: pointer;
  padding: 26px 24px; font-family: inherit; color: var(--text);
  position: relative;
  transition: border-color .2s ease, background-color .2s ease, transform .2s var(--ease);
}
.tool-card::after {
  content: "↗"; position: absolute; right: 20px; top: 18px;
  font-family: var(--mono); font-size: 18px; color: var(--line-strong);
  transition: color .2s ease, transform .2s var(--ease);
}
.tool-card:hover { border-color: var(--primary); background: var(--surface-2); transform: translateY(-2px); }
.tool-card:hover::after { color: var(--signal); transform: translate(2px, -2px); }
.tool-icon {
  width: 46px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  border: var(--hair) solid var(--line-strong);
  border-left: 3px solid var(--signal);
  background: var(--surface-sunken);
  font-family: var(--mono); font-size: 14px; font-weight: 700; letter-spacing: -.5px; color: var(--primary);
  margin-bottom: 16px;
}
.tool-name { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.tool-desc { color: var(--text-soft); font-size: 13px; min-height: 44px; }
.tool-enter { color: var(--signal); font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 1px; margin-top: 14px; text-transform: uppercase; }
.tool-actions { display: flex; gap: 8px; align-items: center; }
.cd-sort { width: auto; min-width: 150px; }

/* ============ 倒计时 ============ */
.countdown-form { padding: 18px 20px; margin-bottom: 16px; }
.cd-form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.cd-form-row > div { flex: 1; min-width: 160px; }
.cd-form-row .cd-sort-cell { flex: 0 0 110px; min-width: 90px; }
.countdown-form .actions { margin-top: 14px; display: flex; gap: 8px; }
.countdown-item { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 16px 20px; border-left: 3px solid var(--line-strong); }
.countdown-item:hover { border-left-color: var(--signal); }
.cd-info { flex: 1; min-width: 180px; }
.cd-name { font-size: 16px; font-weight: 700; }
.cd-owner { font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--muted); margin-left: 10px; }
.cd-target { color: var(--muted); font-size: 12px; font-family: var(--mono); }
.cd-days {
  font-family: var(--mono); font-size: 14px; font-weight: 700; letter-spacing: .5px;
  padding: 6px 13px;
  border: var(--hair) solid var(--primary); color: var(--primary);
  background: var(--primary-soft);
  white-space: nowrap;
}
.cd-days.is-today { border-color: var(--ok); color: var(--ok); background: var(--ok-soft); }
.cd-days.is-past { border-color: var(--line-strong); color: var(--muted); background: var(--surface-sunken); }
.cd-actions { display: flex; gap: 8px; }

/* ============ 游客问卷管理 / 统计 ============ */
.guest-lock { background: var(--warn-soft); color: var(--warn); border-left: 3px solid var(--warn); padding: 10px 14px; margin: 12px 0; font-size: 13px; }
.guest-share-box { background: var(--surface-sunken); border: var(--hair) solid var(--line); padding: 12px 14px; margin: 14px 0 4px; }
.guest-share-row { display: flex; gap: 8px; }
.guest-share-row .input { flex: 1; font-size: 13px; }
.guest-share-box .muted { font-size: 12px; margin-top: 6px; }
.guest-active { display: flex; margin: 14px 0; font-size: 13px; }
.guest-readonly-stem { font-weight: 600; margin: 8px 0 4px; }
.editor-actions-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.stat-summary { padding: 16px 20px; margin-bottom: 16px; border-left: 3px solid var(--signal); }
.stat-summary strong { font-family: var(--mono); font-size: 20px; color: var(--primary); }
.stat-question { padding: 18px 20px; margin-bottom: 14px; }
.stat-question h3 { margin: 0 0 4px; font-size: 16px; }
.stat-question .meta { color: var(--muted); font-size: 12px; font-family: var(--mono); margin-bottom: 12px; }
.stat-option { margin: 12px 0; }
.stat-line { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 5px; }
.stat-line span:last-child { color: var(--text-soft); font-family: var(--mono); white-space: nowrap; }
.stat-bar { height: 8px; background: var(--surface-sunken); border: var(--hair) solid var(--line); }
.stat-bar i { display: block; height: 100%; background: var(--primary); transition: width .5s var(--ease); }
.stat-note { font-size: 12px; margin-top: 10px; }
.stat-other { padding: 6px 0; font-size: 13px; border-bottom: var(--hair) solid var(--line); }

/* ============ 历史折叠 ============ */
.history-card.history-item { padding: 0; overflow: hidden; }
.history-summary {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border: none; background: transparent;
  color: var(--text); font-family: inherit; text-align: left; cursor: pointer;
  transition: background-color .18s ease;
}
.history-summary:hover { background: var(--surface-2); }
.history-caret { color: var(--signal); font-family: var(--mono); font-size: 16px; transition: transform .2s var(--ease); flex: none; }
.history-card.is-open .history-caret { transform: rotate(90deg); }
.history-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.history-title { font-size: 16px; font-weight: 700; }
.history-meta { color: var(--muted); font-size: 12px; font-family: var(--mono); }
.history-detail { padding: 0 20px 14px; border-top: var(--hair) solid var(--line); }

/* ============ 游客分享页 ============ */
.guest-page { min-height: 100vh; display: flex; flex-direction: column; }
.guest-head {
  position: sticky; top: 0; z-index: 20;
  height: 60px; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--header-bg); border-bottom: var(--hair) solid var(--line-strong);
}
.guest-head .theme-fab { position: static; }
.guest-main { width: 100%; max-width: 760px; margin: 0 auto; padding: 32px 16px 56px; flex: 1; }
.guest-foot { text-align: center; color: var(--muted); font-size: 11px; font-family: var(--mono); letter-spacing: 1px; padding: 18px; border-top: var(--hair) solid var(--line); }
.guest-form-head { padding: 24px 26px; margin-bottom: 16px; border-top: 3px solid var(--signal); }
.guest-form-head h1 { font-size: 23px; }
.guest-form-head p { color: var(--text-soft); margin: 6px 0; }
.guest-form-head .muted { font-size: 12px; font-family: var(--mono); }
.guest-q { padding: 20px 24px; margin-bottom: 14px; border-left: 3px solid var(--line-strong); }
.guest-stem { font-weight: 700; font-size: 15px; margin-bottom: 14px; line-height: 1.6; }
.guest-submit-wrap { margin-top: 22px; text-align: center; }
.guest-submit-wrap .button { min-width: 200px; }
.guest-result { padding: 48px 24px; text-align: center; }
.guest-result h2 { margin: 10px 0; font-size: 22px; }
.guest-result p { color: var(--text-soft); margin: 0 0 16px; }
.guest-result-icon { font-family: var(--mono); font-size: 40px; font-weight: 700; color: var(--primary); }

/* ============ 小屏适配 ============ */
@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-hero { border-right: none; border-bottom: var(--hair) solid var(--line); padding: 34px 28px; }
  .login-hero .hero-spec { padding-top: 24px; }
  .login-box { padding: 30px 26px 24px; }
}
@media (max-width: 640px) {
  .topbar { padding: 0 14px; }
  .brand-name .sub { display: none; }
  .username { display: none; }
  .tabs { padding: 0 4px; }
  .tab { padding: 12px 12px 12px 30px; }
  .main { padding: 24px 14px 50px; }
  .answer-card, .editor-card { padding: 18px; }
  .answer-row { flex-direction: column; gap: 0; }
  .countdown-item { align-items: flex-start; }
  .cd-days { font-size: 13px; }
  .guest-share-row { flex-direction: column; }
  .guest-form-head, .guest-q { padding: 16px; }
  .history-summary { padding: 14px; }
  .history-detail { padding: 0 14px 12px; }
}

/* ============ 无障碍：减少动效 ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
