/* ============================================================
   看见 ≠ 理解 · 设计系统 V3
   ------------------------------------------------------------
   概念：错位叠印（misregistration）
         你看到的「TA」，和 TA 本人，从来不是同一件事。

   V3 相对 V2 的根本变化：
   1. 视觉语言从「暗色艺术展签」换成「明亮卡片体系」。
      V2 的深色 + 展签式排版在手机上信息密度过高、
      阅读负担重；V3 以浅色为默认，深色为可切换主题。
   2. 引入真正的设计令牌分层（原始色 → 语义令牌），
      主题切换只换令牌值，不重写任何组件规则。
   3. 圆角、阴影、间距全部成体系（8pt 网格 + 三档阴影）。
   4. 新增底部标签栏（移动）与侧栏（桌面）双形态导航。
   ============================================================ */

/* ============================================================
   1. 原始调色板（Primitive）
   —— 组件永远不直接引用这一层
   ============================================================ */
:root {
  /* 暖中性：不用纯白纯黑，避免屏幕刺眼 */
  --p-0:  #ffffff;
  --p-25: #fdfcfa;
  --p-50: #faf8f5;
  --p-100:#f4f1ec;
  --p-150:#ede9e2;
  --p-200:#e5e0d7;
  --p-300:#d6cfc3;
  --p-400:#b3aa9c;
  --p-500:#8d8578;
  --p-600:#6b6459;
  --p-700:#4d4740;
  --p-800:#332f29;
  --p-900:#1f1c18;
  --p-950:#141210;

  /* 朱红：唯一强调色 */
  --r-300:#ff9d8a;
  --r-400:#ff735c;
  --r-500:#ff3b1f;   /* 主 */
  --r-600:#e02a10;
  --r-700:#b31e0b;

  /* 辅助：暖绿（正确）与琥珀（提示） */
  --g-400:#5cb894;
  --g-500:#3a9a75;
  --g-600:#2b7d5e;
  --a-500:#e0a132;

  /* 蓝：仅用于「房间号/链接」这类信息态 */
  --b-400:#5b9bd5;
  --b-500:#3a7fc1;
  --b-600:#2b649b;

  /* 圆角阶梯 */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --r-xl: 26px;
  --r-2xl: 32px;
  --r-full: 999px;

  /* 间距（8pt 网格） */
  --s-1: 4px;   --s-2: 8px;   --s-3: 12px;  --s-4: 16px;
  --s-5: 20px;  --s-6: 24px;  --s-7: 32px;  --s-8: 40px;
  --s-9: 48px;  --s-10: 64px;  --s-11: 80px;  --s-12: 104px;

  /* 字号 */
  --t-xs:  12px;   /* 原 11px —— 中文在小字号下发糊 */
  --t-sm:  13px;
  --t-base:15px;
  --t-md:  16.5px;
  --t-lg:  19px;
  --t-xl:  23px;
  --t-2xl: 28px;
  --t-3xl: 36px;
  --t-4xl: 46px;

  /* 动效：spring / smooth / out 三条曲线 */
  --sp-spring: cubic-bezier(.34, 1.56, .64, 1);
  --sp-smooth: cubic-bezier(.32, .72, 0, 1);
  --sp-out:    cubic-bezier(.4, 0, 1, 1);
  --d-fast: 160ms;
  --d-mid:  280ms;
  --d-slow: 460ms;

  /* 布局 */
  --nav-h: 62px;
  --rail-w: 244px;
  --content-max: 560px;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  --z-nav: 30;
  --z-float: 60;
  --z-toast: 70;
  --z-sheet: 80;
}

/* ============================================================
   2. 语义令牌（Semantic）—— 主题切换只改这一层
   ============================================================ */
:root,
[data-theme="light"] {
  --bg:          var(--p-50);      /* 页面底 */
  --bg-elev:     var(--p-0);       /* 卡片面 */
  --bg-sunken:   var(--p-100);     /* 凹陷区（代码框、输入框） */
  --bg-hover:    #f0ece5;
  --bg-active:   var(--p-150);

  --fg:          var(--p-900);     /* 主文字 */
  /* 这三级原来整体偏浅：faint 只有 2.17:1（AA 要求 4.5:1），
     而它不是装饰 —— 「猜错」标签、答卷时间、功能说明都靠它，
     结果页要靠它们传达落差。现在整体上调一档，
     层级关系保留（900 > 700 > 600 > 500）。 */
  --fg-muted:    var(--p-700);     /* 次级  → 7.7:1 */
  --fg-subtle:   var(--p-600);     /* 弱    → 5.51:1 */
  --fg-faint:    var(--p-500);     /* 极弱  → 3.44:1 */
  --fg-on-accent:#ffffff;

  --line:        var(--p-200);     /* 常规描边 */
  --line-strong: var(--p-300);
  --line-hair:   rgba(31, 28, 24, .06); /* 内高光 */

  --accent:      var(--r-500);
  --accent-fg:   var(--r-600);
  --accent-bg:   rgba(255, 59, 31, .09);
  --accent-bg-2: rgba(255, 59, 31, .16);
  --accent-line: rgba(255, 59, 31, .30);

  --ok:          var(--g-500);
  --ok-bg:       rgba(58, 154, 117, .10);
  --ok-line:     rgba(58, 154, 117, .28);
  --info:        var(--b-500);
  --info-bg:     rgba(58, 127, 193, .09);
  --warn:        var(--a-500);
  --warn-bg:     rgba(224, 161, 50, .12);

  /* 阴影：三层，随元素抬升程度选择 */
  --sh-1: 0 1px 2px rgba(31,28,24,.05), 0 1px 3px rgba(31,28,24,.04);
  --sh-2: 0 2px 4px rgba(31,28,24,.04), 0 6px 16px rgba(31,28,24,.07);
  --sh-3: 0 4px 8px rgba(31,28,24,.04), 0 16px 40px rgba(31,28,24,.10);
  --sh-accent: 0 6px 20px rgba(255,59,31,.24);

  /* 顶栏玻璃：浅色下用白 + 高模糊 */
  --glass: rgba(250, 248, 245, .82);
  --scrim: rgba(31, 28, 24, .42);
}

[data-theme="dark"] {
  --bg:          #17140f;
  --bg-elev:     #201c17;
  --bg-sunken:   #14110d;
  --bg-hover:    #2a251f;
  --bg-active:   #332c25;

  --fg:          #f5f1ea;
  --fg-muted:    #b5ada0;
  --fg-subtle:   #8d8578;
  --fg-faint:    #8d8578;   /* 3.14 → 5.04:1 */
  --fg-on-accent:#ffffff;

  --line:        #2e2820;
  --line-strong: #423a30;
  --line-hair:   rgba(255, 255, 255, .05);

  --accent:      var(--r-400);
  --accent-fg:   var(--r-300);
  --accent-bg:   rgba(255, 115, 92, .12);
  --accent-bg-2: rgba(255, 115, 92, .20);
  --accent-line: rgba(255, 115, 92, .34);

  --ok:          #4fae88;
  --ok-bg:       rgba(79, 174, 136, .13);
  --ok-line:     rgba(79, 174, 136, .30);
  --info:        #5b9bd5;
  --info-bg:     rgba(91, 155, 213, .12);
  --warn:        #e0a132;
  --warn-bg:     rgba(224, 161, 50, .14);

  --sh-1: 0 1px 2px rgba(0,0,0,.30);
  --sh-2: 0 2px 6px rgba(0,0,0,.32), 0 8px 20px rgba(0,0,0,.26);
  --sh-3: 0 4px 10px rgba(0,0,0,.34), 0 18px 44px rgba(0,0,0,.40);
  --sh-accent: 0 6px 22px rgba(255,59,31,.22);

  --glass: rgba(23, 20, 15, .84);
  --scrim: rgba(0, 0, 0, .58);
}

/* 跟随系统（用户选「自动」时生效） */
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    --bg: #17140f;  --bg-elev: #201c17;  --bg-sunken: #14110d;
    --bg-hover: #2a251f;  --bg-active: #332c25;
    --fg: #f5f1ea;  --fg-muted: #b5ada0;  --fg-subtle: #8d8578;  --fg-faint: #6b6459;
    --line: #2e2820;  --line-strong: #423a30;  --line-hair: rgba(255,255,255,.05);
    --accent: var(--r-400);  --accent-fg: var(--r-300);
    --accent-bg: rgba(255,115,92,.12);  --accent-bg-2: rgba(255,115,92,.20);
    --accent-line: rgba(255,115,92,.34);
    --ok: #4fae88;  --ok-bg: rgba(79,174,136,.13);  --ok-line: rgba(79,174,136,.30);
    --info: #5b9bd5;  --info-bg: rgba(91,155,213,.12);
    --warn: #e0a132;  --warn-bg: rgba(224,161,50,.14);
    --sh-1: 0 1px 2px rgba(0,0,0,.30);
    --sh-2: 0 2px 6px rgba(0,0,0,.32), 0 8px 20px rgba(0,0,0,.26);
    --sh-3: 0 4px 10px rgba(0,0,0,.34), 0 18px 44px rgba(0,0,0,.40);
    --sh-accent: 0 6px 22px rgba(255,59,31,.22);
    --glass: rgba(23,20,15,.84);  --scrim: rgba(0,0,0,.58);
  }
}

/* ============================================================
   3. 基础重置
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html { height: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei",
               "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
  font-size: var(--t-base);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  /* 主题切换的兜底：禁用过渡，避免整页闪一下 */
  transition: background-color var(--d-mid) var(--sp-smooth),
              color var(--d-mid) var(--sp-smooth);
}
body.no-anim, body.no-anim * { transition: none !important; animation: none !important; }

button, input, textarea, select {
  font: inherit; color: inherit; margin: 0; padding: 0;
  border: none; background: none; border-radius: 0;
  appearance: none; -webkit-appearance: none;
}
button { cursor: pointer; touch-action: manipulation; }
img { max-width: 100%; display: block; }
a { color: var(--accent-fg); text-decoration: none; }
::selection { background: var(--accent); color: #fff; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* 顶部氛围光：给纯色底一点纵深 */
.ambient {
  position: fixed; top: 0; left: 0; right: 0; height: 60vh;
  pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%,
      var(--accent-bg), transparent 70%);
}

/* 点击波纹容器 */
.ripples { position: fixed; inset: 0; pointer-events: none; z-index: var(--z-float); }
.ripple {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-bg-2), transparent 70%);
  transform: scale(0); opacity: 1;
  transition: transform 520ms var(--sp-smooth), opacity 420ms var(--sp-out);
}

/* ============================================================
   4. 骨架布局
   ============================================================ */
.app {
  position: relative; z-index: 1;
  min-height: 100dvh;
  display: flex; flex-direction: column;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex; flex-direction: column;
}

.screen {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--s-4) var(--s-5) calc(var(--s-8) + var(--safe-b));
}
.screen.with-tabbar { padding-bottom: calc(var(--nav-h) + var(--s-9) + var(--safe-b)); }
.screen.flush { padding-left: 0; padding-right: 0; }

/* ============================================================
   5. 顶栏
   ============================================================ */
.topbar {
  position: sticky; top: 0;
  z-index: var(--z-nav);
  padding-top: var(--safe-t);
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.topbar.hidden { display: none; }
.topbar-inner {
  max-width: var(--content-max); margin: 0 auto;
  padding: var(--s-3) var(--s-5);
  min-height: 56px;
  display: grid; grid-template-columns: 40px 1fr 40px;
  align-items: center; gap: var(--s-2);
}
.topbar-title {
  text-align: center;
  font-size: var(--t-sm); font-weight: 650;
  letter-spacing: .01em;
  color: var(--fg-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-actions { display: flex; gap: var(--s-1); justify-self: end; }

/* 图标按钮：40×40 触控区 */
.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  color: var(--fg-muted);
  font-size: 20px; line-height: 1;
  position: relative;
  transition: background var(--d-fast), color var(--d-fast),
              transform var(--d-fast) var(--sp-spring);
}
/* 40px 差一点点到 44px 标准值。用伪元素把热区补齐，
   视觉大小不动 —— 顶栏放 44px 的图标会挤掉标题。 */
.icon-btn::after {
  content: "";
  position: absolute;
  left: -2px; right: -2px;
  top: -2px; bottom: -2px;
  border-radius: var(--r-full);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--fg); }
.icon-btn:active { transform: scale(.88); }
.icon-btn.ghost { visibility: hidden; pointer-events: none; }
.icon-btn svg { width: 20px; height: 20px; }

/* ============================================================
   6. 底部标签栏（移动端）
   ============================================================ */
.rail { display: none; }

/* 沉浸模式（出题/答题中）：桌面侧栏与移动底栏一并隐藏 */
.rail.hidden, .tabbar.hidden { display: none !important; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: var(--z-nav);
  display: flex;
  padding-bottom: var(--safe-b);
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
  transition: transform var(--d-mid) var(--sp-smooth);
}
@media (min-width: 1024px) { .tabbar { display: none; } }

.tab {
  flex: 1;
  min-height: var(--nav-h);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  color: var(--fg-faint);
  font-size: var(--t-xs); font-weight: 550;
  letter-spacing: .02em;
  position: relative;
  transition: color var(--d-fast);
  -webkit-user-select: none; user-select: none;
}
.tab svg { width: 23px; height: 23px; }
.tab:active { transform: scale(.93); }
.tab.on { color: var(--accent); }
.tab.on .tab-ic { animation: tabPop 420ms var(--sp-spring); }
@keyframes tabPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.22); }
  100% { transform: scale(1); }
}
/* 选中态的小圆点 */
.tab.on::after {
  content: "";
  position: absolute; top: 8px;
  width: 4px; height: 4px;
  border-radius: var(--r-full);
  background: var(--accent);
  animation: fadeIn var(--d-fast) both;
}
.tab-badge {
  position: absolute; top: 8px; right: 50%;
  transform: translateX(16px);
  min-width: 16px; height: 16px; padding: 0 4px;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700;
}

/* ============================================================
   7. 通用元件
   ============================================================ */

/* —— 按钮 —— */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  width: 100%;
  min-height: 52px;
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r-md);
  background: var(--bg-elev);
  color: var(--fg);
  font-size: var(--t-md); font-weight: 650;
  letter-spacing: .01em;
  text-align: center;
  box-shadow: var(--sh-1), inset 0 1px 0 var(--line-hair);
  transition: transform var(--d-fast) var(--sp-spring),
              background var(--d-fast), box-shadow var(--d-fast),
              opacity var(--d-fast);
}
.btn:hover { background: var(--bg-hover); box-shadow: var(--sh-2), inset 0 1px 0 var(--line-hair); }
.btn:active { transform: scale(.972); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn svg { width: 19px; height: 19px; flex: none; }

.btn.primary {
  background: var(--accent); color: var(--fg-on-accent);
  box-shadow: var(--sh-accent), inset 0 1px 0 rgba(255,255,255,.22);
}
.btn.primary:hover { background: var(--r-600); }
[data-theme="dark"] .btn.primary:hover { background: var(--r-300); }
[data-theme="auto"] .btn.primary:hover { background: var(--r-300); }

.btn.soft { background: var(--accent-bg); color: var(--accent-fg); box-shadow: none; }
.btn.soft:hover { background: var(--accent-bg-2); }

.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.ghost:hover { background: var(--bg-hover); box-shadow: inset 0 0 0 1.5px var(--line-strong); }

.btn.sm { min-height: 42px; padding: var(--s-2) var(--s-4); font-size: var(--t-base); }
.btn.danger { color: var(--accent-fg); }

/* —— 卡片 —— */
.card {
  background: var(--bg-elev);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1), inset 0 1px 0 var(--line-hair);
  padding: var(--s-5);
}
.card.pad-sm { padding: var(--s-4); }

/* —— 分区标题 —— */
.sec-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s-3);
  margin: var(--s-7) 0 var(--s-3);
}
.sec-title {
  margin: 0;
  font-size: var(--t-lg); font-weight: 700;
  letter-spacing: -.01em;
}
.sec-sub { font-size: var(--t-sm); color: var(--fg-subtle); }
.sec-label {
  margin: var(--s-6) 0 var(--s-3);
  font-size: var(--t-xs); font-weight: 700;
  letter-spacing: .1em;
  color: var(--fg-faint);
  text-transform: uppercase;
}

/* —— 徽章 —— */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  background: var(--bg-sunken);
  color: var(--fg-muted);
  font-size: var(--t-xs); font-weight: 600;
  white-space: nowrap;
}
.badge.accent { background: var(--accent-bg); color: var(--accent-fg); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* —— 房间号 —— */
.room-code {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700;
  letter-spacing: .18em;
  font-variant-numeric: tabular-nums;
}

/* —— 空状态 —— */
.empty {
  padding: var(--s-10) var(--s-5);
  text-align: center;
}
.empty-ic {
  width: 62px; height: 62px; margin: 0 auto var(--s-4);
  display: grid; place-items: center;
  border-radius: var(--r-xl);
  background: var(--bg-sunken);
  color: var(--fg-faint);
}
.empty-ic svg { width: 30px; height: 30px; }
.empty h3 { margin: 0 0 var(--s-2); font-size: var(--t-lg); font-weight: 700; }
.empty p { margin: 0 auto var(--s-5); color: var(--fg-subtle); font-size: var(--t-base); max-width: 22em; }

/* —— 骨架屏 —— */
.skel {
  background: linear-gradient(90deg, var(--bg-sunken) 25%, var(--bg-hover) 50%, var(--bg-sunken) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ============================================================
   8. 首页
   ============================================================ */
.home { padding-top: var(--s-2); }

.home-hero {
  position: relative;
  padding: var(--s-6) 0 var(--s-7);
}
.home-mark {
  position: relative;
  margin: 0;
  font-size: clamp(58px, 20vw, 96px);
  font-weight: 800;
  line-height: .98;
  letter-spacing: -.045em;
  height: 1em;
  user-select: none;
  /* ⚠️ 必须不参与命中测试。
     这个标题是纯展示，里面没有任何可点元素（只有两个 span）。
     但它的问题不小：父盒被 height:1em 锁死，里面的 96px 大字却是
     `white-space: nowrap` —— 字形直接溢出到下方，
     再叠加 .hm.ghost 的 filter: blur(2px) 扩大渲染区域，
     结果整个「关于这个工具」按钮都被它罩住。
     实测（1280 宽，按钮 119×38 居中在 x=703）：
       纵向按钮中心线上 dy=-28 / +28 处命中的都是 SPAN.hm.main
     表现就是：按钮周围一圈点了没反应，手指稍偏就「点不到按钮」。
     （之前误判成「热区太小」，真因是这个遮挡层。） */
  pointer-events: none;
}
.hm {
  display: block; position: absolute; left: 0; top: 0;
  white-space: nowrap;
}
/* 错位叠印：底层朱红偏移 —— 概念的内核 */
.hm.ghost {
  color: var(--accent);
  transform: translate3d(.04em, .035em, 0);
  filter: blur(2px);
  opacity: .85;
  animation: hmDrift 9s var(--sp-smooth) infinite;
  will-change: transform;
}
.hm.main { position: relative; will-change: transform; }
@keyframes hmDrift {
  0%, 100% { transform: translate3d(.04em, .035em, 0); }
  50%      { transform: translate3d(.026em, .046em, 0); }
}

.home-sub {
  margin: var(--s-4) 0 0;
  font-size: var(--t-base);
  line-height: 1.7;
  color: var(--fg-muted);
  max-width: 24em;
}
.home-tag {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: var(--s-4);
  padding: 5px 12px;
  border-radius: var(--r-full);
  background: var(--bg-sunken);
  color: var(--fg-subtle);
  font-size: var(--t-sm);
}

.home-art {
  position: relative;
  margin: var(--s-6) 0 0;
  border-radius: var(--r-xl);
  overflow: hidden;
  background: var(--p-950);
  box-shadow: var(--sh-3);
}
.home-art img {
  width: 100%; height: auto; display: block;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  object-position: center 42%;
}
.home-art-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: var(--s-5) var(--s-4) var(--s-3);
  background: linear-gradient(to top, rgba(0,0,0,.72), transparent);
  color: rgba(255,255,255,.9);
  font-size: var(--t-xs);
  letter-spacing: .06em;
}

/* —— 入口卡片 —— */
.entry-list { display: flex; flex-direction: column; gap: var(--s-3); }

.entry {
  position: relative;
  display: flex; align-items: center; gap: var(--s-4);
  width: 100%;
  padding: var(--s-4) var(--s-4);
  text-align: left;
  background: var(--bg-elev);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1), inset 0 1px 0 var(--line-hair);
  overflow: hidden;
  animation: entryIn 520ms var(--sp-smooth) both;
  transition: transform var(--d-fast) var(--sp-spring),
              box-shadow var(--d-fast), background var(--d-fast);
}
.entry:nth-child(1) { animation-delay: 60ms; }
.entry:nth-child(2) { animation-delay: 130ms; }
.entry:nth-child(3) { animation-delay: 200ms; }
@keyframes entryIn {
  from { opacity: 0; transform: translate3d(0, 16px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
.entry:hover { background: var(--bg-hover); box-shadow: var(--sh-2), inset 0 1px 0 var(--line-hair); }
.entry:active { transform: scale(.978); }
.entry-ic {
  flex: none;
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: var(--bg-sunken);
  color: var(--fg-muted);
}
.entry-ic svg { width: 24px; height: 24px; }
.entry.accent .entry-ic { background: var(--accent-bg); color: var(--accent); }
.entry-txt { flex: 1; min-width: 0; }
.entry-t {
  font-size: var(--t-md); font-weight: 700;
  letter-spacing: -.005em;
  margin-bottom: 2px;
}
.entry-d { font-size: var(--t-sm); color: var(--fg-subtle); line-height: 1.5; }
.entry-go { flex: none; color: var(--fg-faint); }
.entry-go svg { width: 18px; height: 18px; }

/* span 默认 inline，块级排版必须显式声明 */
.entry-txt, .entry-t, .entry-d,
.tier-b, .tier-n, .tier-d,
.room-b, .room-d,
.sub-b, .sub-n, .sub-t,
.profile-b, .profile-n, .profile-i,
.row-b, .row-t, .row-d,
.rail-nm, .rail-nm-t, .rail-nm-s,
.step-t, .guide-t, .guide-b { display: block; }
.entry-t { margin-bottom: 2px; }
.entry-d, .tier-d, .room-d, .row-d { line-height: 1.5; }
.tier-n, .room-t, .profile-n, .sub-n, .row-t, .step-t { margin-bottom: 1px; }
.profile-i { line-height: 1.5; }

/* ============================================================
   9. 新手引导
   ============================================================ */
.guide {
  display: flex; gap: var(--s-3);
  padding: var(--s-4);
  border-radius: var(--r-md);
  background: var(--info-bg);
  animation: entryIn 460ms var(--sp-smooth) both;
}
.guide-ic { flex: none; color: var(--info); }
.guide-ic svg { width: 20px; height: 20px; }
.guide-b { flex: 1; min-width: 0; }
.guide-t {
  font-size: var(--t-base); font-weight: 700;
  margin-bottom: 4px;
  color: var(--fg);
}
.guide-p {
  margin: 0;
  font-size: var(--t-sm);
  line-height: 1.68;
  color: var(--fg-muted);
}
.guide-p b { color: var(--fg); font-weight: 650; }
.guide-x {
  flex: none; align-self: flex-start;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  color: var(--fg-faint);
  font-size: 15px;
  transition: background var(--d-fast);
}
.guide-x:hover { background: var(--bg-hover); color: var(--fg); }

/* 分步指引 */
.steps { display: flex; flex-direction: column; gap: var(--s-3); margin: 0; padding: 0; list-style: none; }
.step { display: flex; gap: var(--s-3); align-items: flex-start; }
.step-n {
  flex: none;
  width: 24px; height: 24px; margin-top: 1px;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  background: var(--accent); color: #fff;
  font-size: var(--t-xs); font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.step-t { flex: 1; min-width: 0; font-size: var(--t-base); line-height: 1.62; color: var(--fg-muted); }
.step-t b { color: var(--fg); font-weight: 650; }

/* ============================================================
   10. 档位选择
   ============================================================ */
.tier-list { display: flex; flex-direction: column; gap: var(--s-3); }
.tier {
  position: relative;
  display: flex; align-items: center; gap: var(--s-4);
  width: 100%;
  padding: var(--s-4);
  text-align: left;
  background: var(--bg-elev);
  border-radius: var(--r-lg);
  box-shadow: inset 0 0 0 1.5px var(--line);
  transition: transform var(--d-fast) var(--sp-spring),
              box-shadow var(--d-fast), background var(--d-fast);
  animation: entryIn 500ms var(--sp-smooth) both;
}
.tier:nth-child(1) { animation-delay: 80ms; }
.tier:nth-child(2) { animation-delay: 150ms; }
.tier:nth-child(3) { animation-delay: 220ms; }
.tier:hover { background: var(--bg-hover); }
.tier:active { transform: scale(.98); }
.tier.on {
  background: var(--accent-bg);
  box-shadow: inset 0 0 0 2px var(--accent), var(--sh-2);
}
.tier-tick {
  flex: none;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
  color: transparent;
  transition: all var(--d-fast) var(--sp-spring);
}
.tier.on .tier-tick { background: var(--accent); box-shadow: none; color: #fff; transform: scale(1.08); }
.tier-tick svg { width: 13px; height: 13px; }
.tier-b { flex: 1; min-width: 0; }
.tier-n { font-size: var(--t-md); font-weight: 700; margin-bottom: 1px; }
.tier-d { font-size: var(--t-sm); color: var(--fg-subtle); }
.tier-c { flex: none; text-align: right; }
.tier-num {
  display: block;
  font-size: var(--t-2xl); font-weight: 750; line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
}
.tier-time { display: block; }
.tier.on .tier-num { color: var(--accent); }
.tier-num small { font-size: var(--t-sm); font-weight: 500; color: var(--fg-subtle); margin-left: 2px; }
.tier-time { font-size: var(--t-xs); color: var(--fg-faint); margin-top: 3px; display: block; }

/* ============================================================
   11. 答题页
   ============================================================ */
.q-head {
  display: flex; align-items: center; gap: var(--s-2);
  margin-bottom: var(--s-5);
}
.q-prog { flex: 1; height: 5px; border-radius: var(--r-full); background: var(--bg-sunken); overflow: hidden; }
.q-prog-f {
  height: 100%; border-radius: var(--r-full);
  background: var(--accent);
  transform-origin: left center;
  transition: transform var(--d-slow) var(--sp-smooth);
  will-change: transform;
}

/* 进度条两侧的小翻题按钮 */
.q-nav {
  position: relative;
  flex: none;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  box-shadow: inset 0 0 0 1.5px var(--line);
  background: var(--bg-elev);
  color: var(--fg-subtle);
  transition: transform var(--d-fast) var(--sp-spring),
              background var(--d-fast), color var(--d-fast),
              box-shadow var(--d-fast), opacity var(--d-fast);
}
/* 视觉 36px，用伪元素把可点区域撑到 44px（满足最小触控目标） */
.q-nav::before {
  content: "";
  position: absolute;
  width: 44px; height: 44px;
  border-radius: var(--r-full);
}
.q-nav svg { width: 17px; height: 17px; }
.q-nav:hover { color: var(--fg); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.q-nav:active { transform: scale(.88); }
.q-nav[disabled] { opacity: .3; pointer-events: none; }

/* 未作答就点下一题：轻微摇头提示 */
.opts.shake { animation: shakeX 380ms cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shakeX {
  0%, 100% { transform: translate3d(0, 0, 0); }
  20%      { transform: translate3d(-7px, 0, 0); }
  45%      { transform: translate3d(5px, 0, 0); }
  70%      { transform: translate3d(-3px, 0, 0); }
}

.q-card { animation: qIn 480ms var(--sp-smooth) both; }
@keyframes qIn {
  from { opacity: 0; transform: translate3d(0, 18px, 0) scale(.99); }
  to   { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}
.q-text {
  margin: 0 0 var(--s-5);
  font-size: var(--t-xl);
  font-weight: 700;
  line-height: 1.48;
  letter-spacing: -.018em;
  text-wrap: pretty;
}

.opts { display: flex; flex-direction: column; gap: var(--s-2); }
.opt {
  position: relative;
  display: flex; align-items: center; gap: var(--s-3);
  width: 100%;
  min-height: 58px;
  padding: var(--s-3) var(--s-4);
  text-align: left;
  background: var(--bg-elev);
  border-radius: var(--r-md);
  box-shadow: inset 0 0 0 1.5px var(--line);
  font-size: var(--t-base); line-height: 1.5;
  color: var(--fg);
  overflow: hidden;
  animation: entryIn 480ms var(--sp-smooth) both;
  transition: transform var(--d-fast) var(--sp-spring),
              background var(--d-fast), box-shadow var(--d-fast);
}
.opt:nth-child(1) { animation-delay: 120ms; }
.opt:nth-child(2) { animation-delay: 180ms; }
.opt:nth-child(3) { animation-delay: 240ms; }
.opt:nth-child(4) { animation-delay: 300ms; }
.opt:hover { background: var(--bg-hover); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.opt:active { transform: scale(.975); background: var(--bg-active); }

/* 被自定义替换的那个选项：加个角标说明 */
.opt.custom { box-shadow: inset 0 0 0 1.5px var(--accent-line); }
.opt-flag {
  flex: none;
  align-self: flex-start;
  margin-left: auto;
  padding: 1px 6px;
  border-radius: var(--r-full);
  background: var(--accent-bg);
  color: var(--accent-fg);
  font-size: 10px; font-weight: 650;
  letter-spacing: .04em;
}

/* E · 自定义入口（仅出题模式） */
.opt-e {
  border-style: dashed;
  color: var(--fg-subtle);
}
.opt-e .opt-val { font-size: var(--t-sm); }
.opt-e:hover { color: var(--fg-muted); }
.opt-e.on { color: var(--accent-fg); border-style: solid; }
.opt-e.open .opt-val { color: var(--fg); }

/* 自定义输入区 */
.opt-custombox {
  margin-top: calc(-1 * var(--s-2));
  padding: var(--s-3);
  background: var(--bg-sunken);
  border-radius: var(--r-md);
  box-shadow: inset 0 0 0 1.5px var(--line);
  animation: customIn 320ms var(--sp-smooth) both;
}
.opt-custombox[hidden] { display: none; }
@keyframes customIn {
  from { opacity: 0; transform: translate3d(0, -8px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
.opt-customin {
  width: 100%;
  padding: var(--s-3);
  background: var(--bg-elev);
  border: none;
  border-radius: var(--r-sm);
  box-shadow: inset 0 0 0 1.5px var(--line);
  color: var(--fg);
  font-family: inherit;
  font-size: var(--t-base); line-height: 1.6;
  resize: none;
}
.opt-customin:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--accent);
}
.opt-customin::placeholder { color: var(--fg-faint); }
.opt-customrow {
  display: flex; align-items: center; justify-content: flex-end;
  margin-top: var(--s-3);
}

/* 换题按钮 */
.q-swap {
  display: inline-flex; align-items: center; gap: var(--s-2);
  margin-top: var(--s-4);
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-full);
  box-shadow: inset 0 0 0 1.5px var(--line);
  color: var(--fg-subtle);
  font-size: var(--t-sm); font-weight: 600;
  transition: all var(--d-fast) var(--sp-spring);
}
.q-swap svg { width: 15px; height: 15px; }
.q-swap:hover {
  color: var(--fg);
  background: var(--bg-hover);
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
}
.q-swap:active { transform: scale(.94); }
.q-swap svg { transition: transform var(--d-slow) var(--sp-smooth); }
.q-swap:hover svg { transform: rotate(180deg); }

/* 答题提示：说明是「挑最符合的」 */
.q-hint {
  margin: 0 0 var(--s-4);
  font-size: var(--t-sm);
  color: var(--fg-subtle);
  line-height: 1.6;
}

.opt-key {
  flex: none;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: var(--r-xs);
  background: var(--bg-sunken);
  color: var(--fg-subtle);
  font-size: var(--t-sm); font-weight: 700;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  transition: all var(--d-fast) var(--sp-spring);
}
.opt-val { flex: 1; min-width: 0; text-wrap: pretty; }

.opt.on {
  background: var(--accent-bg);
  box-shadow: inset 0 0 0 2px var(--accent), var(--sh-accent);
  transform: scale(1.008);
}
.opt.on .opt-key {
  background: var(--accent); color: #fff;
  transform: scale(1.06);
}
.opt.on::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 32%, var(--accent-bg-2) 50%, transparent 68%);
  transform: translate3d(-100%, 0, 0);
  animation: sheen 600ms var(--sp-smooth) forwards;
  pointer-events: none;
}
@keyframes sheen { to { transform: translate3d(100%, 0, 0); } }

/* ============================================================
   12. 房间号输入
   ============================================================ */
.code-input {
  display: flex; gap: var(--s-2); justify-content: center;
  margin: var(--s-5) 0 var(--s-3);
}
.code-cell {
  flex: 1;
  max-width: 52px;
  aspect-ratio: 3 / 4;
  display: grid; place-items: center;
  background: var(--bg-elev);
  border-radius: var(--r-sm);
  box-shadow: inset 0 0 0 1.5px var(--line);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: var(--t-2xl); font-weight: 700;
  color: var(--fg);
  transition: all var(--d-fast) var(--sp-spring);
}
.code-cell.filled { box-shadow: inset 0 0 0 2px var(--accent); }
.code-cell.cur { box-shadow: inset 0 0 0 2px var(--accent); transform: scale(1.05); }
.code-hint {
  text-align: center;
  font-size: var(--t-sm);
  color: var(--fg-subtle);
  margin: 0 0 var(--s-5);
}
.code-real {
  position: absolute;
  opacity: 0; pointer-events: none;
  left: -9999px; width: 100%; height: 100%;
}
.code-wrap { position: relative; }

/* ============================================================
   12.5 邀请函（答题入口）
   ------------------------------------------------------------
   一张「还没拆封的邀请函」：
   - 未拆封：双圆交叠的封口标记 + 封面文案 + 房间号钥匙
   - 拆封中：双圆分开（= 看见 ≠ 理解 的字面动作）、封面淡出、内容浮起
   - 全部动效走 transform / opacity
   ============================================================ */
.invite {
  position: relative;
  padding: var(--s-8) var(--s-6) var(--s-6);
  /* 先给不支持 color-mix 的浏览器一个纯色/双色兜底 */
  background: linear-gradient(168deg, var(--bg-elev), var(--bg-sunken));
  background:
    linear-gradient(168deg,
      color-mix(in srgb, var(--bg-elev) 92%, var(--accent) 8%),
      var(--bg-elev) 42%,
      var(--bg-sunken));
  border-radius: var(--r-xl);
  box-shadow:
    0 0 0 1px var(--line) inset,
    0 1px 0 var(--line-hair) inset,
    0 24px 60px rgba(0, 0, 0, .42);
  text-align: center;
  overflow: hidden;
  animation: inviteIn 620ms var(--sp-smooth) both;
}
@keyframes inviteIn {
  from { opacity: 0; transform: translate3d(0, 22px, 0) scale(.97); }
  to   { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

/* 四角折角：让卡片像一张纸 */
.invite-corner {
  position: absolute;
  width: 26px; height: 26px;
  border: 1.5px solid var(--line-strong);
  opacity: .55;
  transition: opacity var(--d-slow), border-color var(--d-slow);
}
.invite-corner.tl { top: 12px; left: 12px;  border-right: 0; border-bottom: 0; border-radius: 8px 0 0 0; }
.invite-corner.tr { top: 12px; right: 12px; border-left: 0;  border-bottom: 0; border-radius: 0 8px 0 0; }
.invite-corner.bl { bottom: 12px; left: 12px;  border-right: 0; border-top: 0;    border-radius: 0 0 0 8px; }
.invite-corner.br { bottom: 12px; right: 12px; border-left: 0;  border-top: 0;    border-radius: 0 0 8px 0; }
.invite.opening .invite-corner { opacity: .9; border-color: var(--accent-line); }

/* 封口标记：错位双圆 */
.invite-seal {
  width: 60px; height: 60px;
  margin: 0 auto var(--s-4);
  color: var(--fg-subtle);
}
.invite-seal svg { width: 100%; height: 100%; overflow: visible; }
.invite-seal .s-c1,
.invite-seal .s-c2 {
  transition: transform 900ms var(--sp-spring), opacity var(--d-slow);
  transform-origin: center;
}
.invite.opening .invite-seal { color: var(--fg); }
.invite.opening .invite-seal .s-c1 { transform: translate3d(-13px, -7px, 0); }
.invite.opening .invite-seal .s-c2 { transform: translate3d(13px, 7px, 0); }

.invite-kicker {
  margin: 0 0 var(--s-5);
  font-size: var(--t-xs); font-weight: 700;
  letter-spacing: .34em; text-indent: .34em;
  color: var(--accent);
}

/* 封面 */
.invite-cover {
  transition: opacity 420ms var(--sp-out), transform 620ms var(--sp-out);
}
.invite.opening .invite-cover {
  opacity: 0;
  transform: translate3d(0, -14px, 0);
}
.invite-t {
  margin: 0 0 var(--s-3);
  font-size: var(--t-2xl); font-weight: 800;
  line-height: 1.38;
  letter-spacing: -.02em;
}
.invite-d {
  margin: 0 auto;
  max-width: 20em;
  font-size: var(--t-base);
  line-height: 1.72;
  color: var(--fg-muted);
}

/* 钥匙区（房间号） */
.invite-key {
  margin-top: var(--s-6);
  padding-top: var(--s-5);
  border-top: 1px dashed var(--line-strong);
  transition: opacity 380ms var(--sp-out), transform 520ms var(--sp-out);
}
.invite.opening .invite-key {
  opacity: 0;
  transform: translate3d(0, 10px, 0);
  pointer-events: none;
}
.invite-key .code-input { margin: 0 0 var(--s-3); }
.invite-keyhint {
  margin: 0;
  font-size: var(--t-sm);
  letter-spacing: .04em;
  color: var(--fg-subtle);
}

/* 房间号不对：钥匙区左右推一下 */
.invite-key.nope { animation: shakeX 400ms cubic-bezier(.36, .07, .19, .97); }
.invite-key.nope .code-cell { border-color: var(--accent); }

/* 开启按钮 */
.invite-open {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s-2);
  margin-top: var(--s-5);
  padding: var(--s-3) var(--s-6);
  border-radius: var(--r-full);
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
  color: var(--fg-muted);
  font-size: var(--t-sm); font-weight: 650;
  letter-spacing: .16em; text-indent: .16em;
  transition: all var(--d-fast) var(--sp-spring);
}
.invite-open svg { width: 15px; height: 15px; transition: transform var(--d-fast) var(--sp-spring); }
.invite-open:hover {
  color: var(--accent-fg);
  box-shadow: inset 0 0 0 1.5px var(--accent-line);
  background: var(--accent-bg);
}
.invite-open:hover svg { transform: translateX(3px); }
.invite-open:active { transform: scale(.95); }
.invite.opening .invite-open { opacity: 0; pointer-events: none; }

/* 拆封后浮现的内容 */
.invite-inside {
  position: absolute;
  left: 0; right: 0;
  bottom: var(--s-6);
  padding: 0 var(--s-6);
  opacity: 0;
  transform: translate3d(0, 16px, 0);
  transition: opacity 520ms var(--sp-smooth) 380ms,
              transform 620ms var(--sp-spring) 380ms;
}
.invite.opening .invite-inside { opacity: 1; transform: translate3d(0, 0, 0); }

.invite-from {
  margin: 0 0 var(--s-3);
  font-size: var(--t-xl); font-weight: 750;
  letter-spacing: -.01em;
}
.invite-from-label {
  display: block;
  margin-bottom: 4px;
  font-size: var(--t-xs); font-weight: 700;
  letter-spacing: .26em;
  color: var(--fg-faint);
}
/* 名字可能长达 12 字，别把邀请函撑破 */
.invite-from-name {
  display: block;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.invite-tell {
  margin: 0 0 var(--s-3);
  font-size: var(--t-sm);
  color: var(--fg-subtle);
  line-height: 1.7;
}
.invite-meta {
  display: flex; justify-content: center; gap: var(--s-2);
  margin-bottom: var(--s-4);
  flex-wrap: wrap;
}
.invite-welcome {
  margin: 0;
  font-size: var(--t-base);
  line-height: 1.7;
  color: var(--fg-muted);
}


/* ============================================================
   13. 房间展示（分享 / 已出题）
   ============================================================ */
.room-hero {
  text-align: center;
  padding: var(--s-6) var(--s-5);
  border-radius: var(--r-xl);
  background: var(--bg-elev);
  box-shadow: var(--sh-2), inset 0 1px 0 var(--line-hair);
  animation: entryIn 520ms var(--sp-smooth) both;
}
.room-hero-t { font-size: var(--t-sm); color: var(--fg-subtle); margin-bottom: var(--s-3); }
.room-code-big {
  font-size: clamp(38px, 12vw, 54px);
  letter-spacing: .14em;
  color: var(--accent);
  margin: 0 0 var(--s-2);
  padding-left: .14em;   /* 抵消末字符的字距，保持视觉居中 */
  animation: codeIn 620ms var(--sp-spring) both 120ms;
}
@keyframes codeIn {
  from { opacity: 0; transform: scale(.86); }
  to   { opacity: 1; transform: scale(1); }
}
.room-hero-d { font-size: var(--t-sm); color: var(--fg-subtle); }

.room-item {
  display: flex; align-items: center; gap: var(--s-3);
  width: 100%;
  padding: var(--s-4);
  text-align: left;
  background: var(--bg-elev);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1), inset 0 1px 0 var(--line-hair);
  animation: entryIn 460ms var(--sp-smooth) both;
  transition: transform var(--d-fast) var(--sp-spring),
              background var(--d-fast), box-shadow var(--d-fast);
}
.room-item:hover { background: var(--bg-hover); box-shadow: var(--sh-2); }
.room-item:active { transform: scale(.98); }
.room-ic {
  flex: none;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  background: var(--accent-bg);
  color: var(--accent);
  font-size: var(--t-sm); font-weight: 700;
  letter-spacing: .06em;
}
.room-b { flex: 1; min-width: 0; }
.room-t {
  font-size: var(--t-base); font-weight: 650;
  display: flex; align-items: center; gap: var(--s-2);
  margin-bottom: 3px;
}
.room-d { font-size: var(--t-sm); color: var(--fg-subtle); }
.room-stats {
  flex: none; text-align: right;
  font-size: var(--t-xs); color: var(--fg-subtle);
  line-height: 1.5;
}
.room-stats b { display: block; font-size: var(--t-lg); color: var(--fg); font-variant-numeric: tabular-nums; }

/* 答卷条目 */
.sub-item {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) 0;
}
.sub-item + .sub-item { border-top: 1px solid var(--line); }
.sub-av {
  flex: none;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  background: var(--bg-sunken);
  color: var(--fg-muted);
  font-size: var(--t-sm); font-weight: 700;
}
.sub-b { flex: 1; min-width: 0; }
.sub-n { font-size: var(--t-base); font-weight: 600; }
.sub-t { font-size: var(--t-xs); color: var(--fg-faint); }
.sub-sc {
  flex: none;
  font-size: var(--t-lg); font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.sub-sc small { font-size: var(--t-xs); font-weight: 500; color: var(--fg-faint); }

/* ---------- 逐题分歧（房主可见） ----------
   出题人光看到「3/5」是没法开口的 —— 得看见错在哪几题。 */
.sub-peek {
  flex: none;
  font-size: var(--t-xs);
  font-weight: 500;
  color: var(--accent-fg);
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  padding: 3px 9px;
  min-height: 26px;
  position: relative;
  transition: background var(--d-fast) var(--sp-smooth),
              border-color var(--d-fast) var(--sp-smooth),
              color var(--d-fast) var(--sp-smooth);
/* 26px 的热区在手机上几乎点不准（跟着答卷卡片走，错一次就要点第二次）。
   视觉保持紧凑，热区扩到 44px。 */
.sub-peek::after {
  content: "";
  position: absolute;
  left: -9px; right: -9px;
  top: -9px; bottom: -9px;
}
}
.sub-peek.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--fg-on-accent);
}

.sub-diff {
  padding: 0 0 var(--s-3) 46px;
  display: flex; flex-direction: column; gap: var(--s-3);
}
.sub-diff[hidden] { display: none; }
.diff-row {
  background: var(--bg-sunken);
  border-radius: var(--r-md);
  padding: var(--s-3);
}
.diff-q {
  font-size: var(--t-sm);
  color: var(--fg-muted);
  margin-bottom: var(--s-2);
  line-height: 1.5;
}
.diff-pick {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2);
  font-size: var(--t-sm);
}
.diff-arrow { color: var(--fg-faint); font-size: var(--t-xs); }
.diff-tag {
  border-radius: var(--r-sm);
  padding: 2px 8px;
  /* 长选项不能把布局撑破 */
  overflow-wrap: anywhere;
  max-width: 100%;
}
.diff-tag.mine    { background: var(--bg-elev); color: var(--fg); font-weight: 500; }
.diff-tag.theirs  { background: var(--accent-bg); color: var(--accent-fg); font-weight: 500; }
.diff-empty {
  font-size: var(--t-sm);
  color: var(--fg-faint);
  padding: var(--s-2) 0;
}

/* ============================================================
   14. 结果页
   ============================================================ */
.score-hero {
  text-align: center;
  padding: var(--s-7) var(--s-5);
  border-radius: var(--r-xl);
  background: var(--bg-elev);
  box-shadow: var(--sh-2), inset 0 1px 0 var(--line-hair);
  animation: entryIn 520ms var(--sp-smooth) both;
}
.score-num {
  font-size: clamp(54px, 17vw, 76px);
  font-weight: 800; line-height: 1;
  letter-spacing: -.05em;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.score-num small {
  font-size: var(--t-xl); font-weight: 600;
  color: var(--fg-faint);
  margin-left: 6px;
  letter-spacing: 0;
}
.score-line {
  margin: var(--s-4) auto 0;
  font-size: var(--t-md);
  line-height: 1.68;
  color: var(--fg-muted);
  max-width: 22em;
}
.score-line b { color: var(--fg); font-weight: 700; }

.rcard {
  position: relative;
  padding: var(--s-4);
  margin-bottom: var(--s-3);
  background: var(--bg-elev);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1), inset 0 1px 0 var(--line-hair);
  overflow: hidden;
  animation: entryIn 460ms var(--sp-smooth) both;
}
.rcard-q {
  margin: 0 0 var(--s-3);
  font-size: var(--t-base); font-weight: 700; line-height: 1.55;
  letter-spacing: -.008em;
  text-wrap: pretty;
}
.rrow {
  display: flex; gap: var(--s-3); align-items: flex-start;
  padding: 3px 0;
  font-size: var(--t-base); line-height: 1.55;
}
.rrow-k {
  flex: none; width: 62px;
  font-size: var(--t-xs);
  color: var(--fg-faint);
  padding-top: 3px;
  line-height: 1.45;
}
.rrow-v { flex: 1; min-width: 0; text-wrap: pretty; }

/* 猜中/猜错小标记 —— 只给反馈，不透露对方选了什么 */
.rmark {
  flex: none;
  margin-left: auto;
  padding: 1px 7px;
  border-radius: var(--r-full);
  font-size: var(--t-xs); font-weight: 650;
  letter-spacing: .04em;
}
.rmark.ok   { color: var(--ok);   box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ok) 40%, transparent); }
/* 「猜错」标签单独用 muted 色 —— 它是结果页传达落差的核心视觉元素，
   不该跟着 faint 一起弱到读不清。字号也从 10.5 提到 11。 */
.rmark.miss { color: var(--fg-muted); box-shadow: inset 0 0 0 1px var(--line); }

/* 中立追问 —— 替代 V1 的「坑点」 */
.ask {
  display: flex; align-items: center; gap: var(--s-2);
  width: 100%;
  margin-top: var(--s-3); padding-top: var(--s-3);
  border-top: 1px solid var(--line);
  font-size: var(--t-sm); font-weight: 600;
  color: var(--fg-subtle);
  text-align: left;
  transition: color var(--d-fast), transform var(--d-fast) var(--sp-spring);
}
.ask:hover { color: var(--accent-fg); }
.ask:active { transform: scale(.985); }
.ask svg { width: 15px; height: 15px; flex: none; }
.ask-tx {
  flex: 1; min-width: 0;
  /* 名字最长 12 字，长了就省略，别把卡片撑变形 */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ask.done { color: var(--ok); }

.note {
  margin-top: var(--s-5);
  padding: var(--s-4);
  border-radius: var(--r-md);
  background: var(--bg-sunken);
  font-size: var(--t-sm);
  line-height: 1.72;
  color: var(--fg-muted);
}
.note b { color: var(--fg); font-weight: 650; }

/* 首页「关于这个工具」入口 —— 一行小字，不抢主流程 */
.about-wrap {
  margin-top: var(--s-3);
  text-align: center;
}
.about-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  /* 原来的 `margin: 0 auto` 对 inline-flex 是**无效**的 ——
     auto margin 只在块级盒子上起作用。这里靠父容器的 text-align:center 居中，
     那行 margin 属于误导性代码，删掉免得以后有人以为它负责居中。 */
  padding: var(--s-2) var(--s-3);
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--fg-subtle);
  font: inherit;
  font-size: var(--t-sm);
  line-height: 1.5;
  cursor: pointer;
  position: relative;
  transition: color var(--d-fast), background var(--d-fast);
}
/* 触控热区扩到 44px，视觉尺寸不变。
   这个按钮实际高度只有 13×1.5 + 8×2 ≈ 35px，低于移动端 44px 的最小可点区域 ——
   手指点不准就会「点了没反应」，看起来像按钮坏了。
   手法和 .q-nav::before 一样：伪元素撑热区，不动视觉。 */
.about-link::after {
  content: "";
  position: absolute;
  left: -10px; right: -10px;
  top: -5px; bottom: -5px;
}
.about-link span {
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 1px;
}
.about-link svg { width: 13px; height: 13px; opacity: .7; }
.about-link:hover { color: var(--fg); background: var(--bg-hover); }
.about-link:active { background: var(--bg-active); }
.about-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 关于弹窗正文 */
/* 长文案弹层（关于 / 声明）：正文区滚动，按钮永远露在外面。
   加 .tall 修饰而不是改 .sheet-card 本体 —— 避免影响已有的短弹层。 */
.sheet-card.tall {
  display: flex;
  flex-direction: column;
  max-height: min(86vh, 620px);
}
.sheet-card.tall .sheet-in.scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.sheet-in.scroll {
  max-height: min(56vh, 380px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.about { padding-right: 2px; }
.about-p {
  margin: 0 0 var(--s-4);
  font-size: var(--t-base);
  line-height: 1.85;
  color: var(--fg-muted);
}
.about-p:last-child { margin-bottom: 0; }
.about-quote {
  padding: var(--s-3) var(--s-4);
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--bg-sunken);
  color: var(--fg);
  font-weight: 600;
}
.about-sep {
  height: 1px;
  margin: var(--s-5) 0;
  background: var(--line);
}
.about-wish {
  color: var(--fg);
  font-weight: 600;
}

/* ============================================================
   15. 我的
   ============================================================ */
.profile-head {
  display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-5);
  border-radius: var(--r-lg);
  background: var(--bg-elev);
  box-shadow: var(--sh-1), inset 0 1px 0 var(--line-hair);
}
.avatar {
  flex: none;
  width: 64px; height: 64px;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  background: var(--accent);
  color: #fff;
  font-size: var(--t-2xl); font-weight: 700;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-edit {
  position: absolute;
  right: 0; bottom: 0;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  background: var(--bg-elev);
  box-shadow: var(--sh-1);
  color: var(--fg-muted);
}
.avatar-wrap { position: relative; flex: none; }
.avatar-wrap .avatar { cursor: pointer; }
.avatar-wrap .avatar-edit svg { width: 13px; height: 13px; }
.profile-b { flex: 1; min-width: 0; }
.profile-n {
  font-size: var(--t-lg); font-weight: 700;
  margin-bottom: 2px;
  display: flex; align-items: center; gap: var(--s-2);
}
.profile-i { font-size: var(--t-sm); color: var(--fg-subtle); }

.field { margin-bottom: var(--s-4); }
.field-l {
  display: block;
  margin-bottom: var(--s-2);
  font-size: var(--t-sm); font-weight: 650;
  color: var(--fg-muted);
}
.input {
  width: 100%;
  min-height: 50px;
  padding: var(--s-3) var(--s-4);
  background: var(--bg-sunken);
  border-radius: var(--r-sm);
  box-shadow: inset 0 0 0 1.5px var(--line);
  color: var(--fg);
  font-size: var(--t-md);
  transition: box-shadow var(--d-fast), background var(--d-fast);
}
.input::placeholder { color: var(--fg-faint); }
.input:focus {
  background: var(--bg-elev);
  box-shadow: inset 0 0 0 2px var(--accent);
  outline: none;
}

/* 主题切换 */
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-3); }
.theme-opt {
  padding: var(--s-3);
  border-radius: var(--r-md);
  box-shadow: inset 0 0 0 1.5px var(--line);
  background: var(--bg-elev);
  transition: all var(--d-fast) var(--sp-spring);
}
.theme-opt:active { transform: scale(.97); }
.theme-opt.on { box-shadow: inset 0 0 0 2px var(--accent); }
/* 预览图背景写死为中性色，标签必须跟着当前主题走 */
.theme-t { display: block; font-size: var(--t-sm); font-weight: 600; text-align: center; color: var(--fg); }
.theme-opt:not(.on) .theme-t { color: var(--fg-subtle); }
.theme-prev {
  height: 52px;
  border-radius: var(--r-sm);
  margin-bottom: var(--s-2);
  overflow: hidden;
  display: flex;
  box-shadow: inset 0 0 0 1px var(--line);
}
.theme-prev .tp-bar { width: 22%; height: 100%; }
.theme-prev .tp-main { flex: 1; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.theme-prev .tp-l { height: 5px; border-radius: 3px; }
.theme-prev.light .tp-bar { background: #e5e0d7; }
.theme-prev.light .tp-main { background: #faf8f5; }
.theme-prev.light .tp-l { background: #e5e0d7; }
.theme-prev.dark .tp-bar { background: #2e2820; }
.theme-prev.dark .tp-main { background: #17140f; }
.theme-prev.dark .tp-l { background: #423a30; }
.theme-prev.auto .tp-bar { background: linear-gradient(180deg, #e5e0d7 50%, #2e2820 50%); }
.theme-prev.auto .tp-main { background: linear-gradient(135deg, #faf8f5 50%, #17140f 50%); }
.theme-prev.auto .tp-l { background: linear-gradient(90deg, #e5e0d7 50%, #423a30 50%); }

/* 设置行 */
.rows { border-radius: var(--r-md); overflow: hidden; background: var(--bg-elev); box-shadow: var(--sh-1); }
.row {
  display: flex; align-items: center; gap: var(--s-3);
  width: 100%;
  padding: var(--s-4);
  text-align: left;
  color: var(--fg);
  font-size: var(--t-base);
}
.row + .row { border-top: 1px solid var(--line); }
button.row:hover { background: var(--bg-hover); }
button.row:active { background: var(--bg-active); }
.row-ic { flex: none; width: 20px; height: 20px; color: var(--fg-subtle); }
.row-ic svg { width: 20px; height: 20px; }
.row-b { flex: 1; min-width: 0; }
.row-t { font-weight: 550; }
.row-d { font-size: var(--t-xs); color: var(--fg-faint); margin-top: 1px; }
.row-go { flex: none; color: var(--fg-faint); }
.row-go svg { width: 17px; height: 17px; }

.switch {
  flex: none;
  width: 46px; height: 28px;
  border-radius: var(--r-full);
  background: var(--bg-active);
  position: relative;
  transition: background var(--d-mid) var(--sp-smooth);
}
.switch.on { background: var(--ok); }
.switch::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px;
  border-radius: var(--r-full);
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform var(--d-mid) var(--sp-spring);
}
.switch.on::after { transform: translate3d(18px, 0, 0); }

/* ============================================================
   16. 浮层：toast / sheet / noscript
   ============================================================ */
.toast {
  position: fixed; left: 50%;
  /* 答题流程里导航栏是隐藏的，这里不依赖 nav-h，
     固定悬在底部偏上，任何页面观感一致 */
  bottom: calc(var(--s-8) + var(--safe-b));
  z-index: var(--z-toast);
  display: flex; align-items: center; gap: var(--s-2);
  max-width: min(90vw, 420px);
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r-full);
  background: var(--p-900); color: var(--p-50);
  font-size: var(--t-base); font-weight: 550;
  text-align: left;
  opacity: 0; pointer-events: none;
  transform: translate3d(-50%, 14px, 0) scale(.94);
  box-shadow: var(--sh-3);
  transition: opacity var(--d-mid) var(--sp-smooth),
              transform var(--d-mid) var(--sp-spring);
}
[data-theme="dark"] .toast { background: var(--p-100); color: var(--p-900); }
.toast.on { opacity: 1; transform: translate3d(-50%, 0, 0) scale(1); }
.toast svg { width: 17px; height: 17px; flex: none; }

.sheet {
  position: fixed; inset: 0;
  z-index: var(--z-sheet);
  display: flex; align-items: flex-end; justify-content: center;
  background: var(--scrim);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  transition: opacity var(--d-mid) var(--sp-smooth);
}
.sheet.on { opacity: 1; pointer-events: auto; }
.sheet-card {
  width: min(100%, 460px);
  margin: 0 auto calc(var(--s-3) + var(--safe-b));
  padding: var(--s-5);
  border-radius: var(--r-2xl);
  background: var(--bg-elev);
  box-shadow: var(--sh-3);
  transform: translate3d(0, 100%, 0);
  transition: transform var(--d-slow) var(--sp-smooth);
}
.sheet.on .sheet-card { transform: translate3d(0, 0, 0); }
.sheet-t { margin: 0 0 var(--s-2); font-size: var(--t-lg); font-weight: 700; }
.sheet-d { margin: 0 0 var(--s-5); font-size: var(--t-base); color: var(--fg-muted); line-height: 1.7; }
.sheet-in { margin-bottom: var(--s-4); }

/* 入口声明 / 提交确认：把话先说清楚 */
.notice {
  margin: var(--s-4) 0 0;          /* 到底部按钮的间距交给 .sheet-in */
  padding: var(--s-4) var(--s-4);
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--bg-sunken);
}
.notice-lead {
  margin: 0 0 var(--s-3);
  font-size: var(--t-lg);
  font-weight: 700;
  line-height: 1.5;
}
.notice-p {
  margin: 0 0 var(--s-3);
  font-size: var(--t-base);
  color: var(--fg-muted);
  line-height: 1.8;
}
.notice-strong {
  margin-bottom: 0;
  color: var(--fg);
  font-weight: 600;
}

/* 结算页/已答页：这是谁出的题 */
.score-from {
  margin: 0 0 var(--s-2);
  font-size: var(--t-sm);
  color: var(--fg-subtle);
  letter-spacing: .01em;
}
.score-from b {
  color: var(--fg);
  font-weight: 650;
}

/* 已答过（同一房间再进入） */
.done-hero {
  padding: var(--s-7) var(--s-4) var(--s-2);
  text-align: center;
}
.done-ic {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 0 auto var(--s-4);
  border-radius: 50%;
  background: var(--accent-bg);
  color: var(--accent-fg);
}
.done-ic svg { width: 26px; height: 26px; }
.done-t {
  margin: 0 0 var(--s-3);
  font-size: var(--t-xl);
  font-weight: 700;
  line-height: 1.4;
}
.done-score {
  margin: 0 0 var(--s-4);
  font-size: var(--t-base);
  color: var(--fg-muted);
}
.done-score b { color: var(--fg); font-weight: 700; }
.done-d {
  margin: 0;
  font-size: var(--t-sm);
  color: var(--fg-subtle);
  line-height: 1.8;
}

/* 首次出题：昵称设置 */
.nick-in {
  width: 100%;
  text-align: center;
  font-size: var(--t-lg);
  font-weight: 650;
  letter-spacing: .01em;
}
.nick-err {
  margin: var(--s-2) 0 0;
  font-size: var(--t-sm);
  color: var(--accent-fg);
  text-align: center;
  line-height: 1.5;
}
.nick-tip {
  margin: var(--s-3) 0 0;
  font-size: var(--t-xs);
  color: var(--fg-faint);
  line-height: 1.6;
  text-align: center;
}

/* 答题侧的自愿署名入口 */
.invite-nick {
  display: block;
  width: 100%;
  margin-top: var(--s-3);
  padding: var(--s-2);
  font-size: var(--t-xs);
  color: var(--fg-faint);
  text-align: center;
  transition: color var(--d-fast);
}
.invite-nick:hover { color: var(--fg-subtle); }

/* 居中型对话框（桌面端） */
@media (min-width: 640px) {
  .sheet { align-items: center; }
  .sheet-card { margin: auto; }
}

.noscript {
  padding: var(--s-11) var(--s-6);
  text-align: center;
  color: var(--fg);
  font-family: -apple-system, "PingFang SC", sans-serif;
}
.noscript h1 { font-size: var(--t-2xl); margin-bottom: var(--s-3); }
.noscript p { color: var(--fg-muted); line-height: 1.8; }

/* ============================================================
   17. 页面转场
   ============================================================ */
.view { will-change: transform, opacity; }
.view.v-fwd  { animation: vInFwd  340ms var(--sp-smooth) both; }
.view.v-back { animation: vInBack 340ms var(--sp-smooth) both; }
/* 淡出中的旧视图一律不接收点击。
   render() 里也加了 inline 的 pointerEvents，这里是第二道保险 ——
   换题动画期间点到上一题的选项，会把答案写进下一题。 */
.view.out-fwd,
.view.out-back { pointer-events: none; }
.view.out-fwd  { animation: vOutFwd  140ms var(--sp-out) both; }
.view.out-back { animation: vOutBack 120ms var(--sp-out) both; }
@keyframes vInFwd  { from { opacity: 0; transform: translate3d(22px,0,0); } to { opacity: 1; transform: none; } }
@keyframes vInBack { from { opacity: 0; transform: translate3d(-22px,0,0); } to { opacity: 1; transform: none; } }
@keyframes vOutFwd  { from { opacity: 1; } to { opacity: 0; transform: translate3d(-14px,0,0); } }
@keyframes vOutBack { from { opacity: 1; } to { opacity: 0; transform: translate3d(14px,0,0); } }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

@keyframes entryIn { from { opacity: 0; transform: translate3d(0,16px,0); } to { opacity: 1; transform: none; } }
@keyframes qIn { from { opacity: 0; transform: translate3d(0,18px,0) scale(.99); } to { opacity: 1; transform: none; } }

/* ============================================================
   18. 响应式
   ============================================================ */

/* —— 小屏 iPhone SE —— */
@media (max-width: 360px) {
  :root { --t-xl: 21px; --t-2xl: 25px; }
  .screen { padding-left: var(--s-4); padding-right: var(--s-4); }
  .topbar-inner { padding-left: var(--s-4); padding-right: var(--s-4); }
  .home-mark { font-size: clamp(50px, 19vw, 72px); }
  .q-text { font-size: var(--t-lg); }
  .opt { padding: var(--s-3); gap: var(--s-3); }
  .code-cell { max-width: 44px; font-size: var(--t-xl); }
  .entry { padding: var(--s-3); gap: var(--s-3); }
  .entry-ic { width: 42px; height: 42px; }

  /* 邀请函在小屏收紧留白 */
  .invite { padding: var(--s-7) var(--s-4) var(--s-5); border-radius: var(--r-lg); }
  .invite-seal { width: 50px; height: 50px; margin-bottom: var(--s-3); }
  .invite-t { font-size: var(--t-xl); }
  .invite-d { font-size: var(--t-sm); }
  .invite-key { margin-top: var(--s-5); padding-top: var(--s-4); }
  .invite-inside { padding: 0 var(--s-4); }
  .invite-from { font-size: var(--t-lg); }
}

/* —— 大屏手机 / 小平板 —— */
@media (min-width: 600px) {
  :root { --content-max: 600px; --t-base: 15.5px; --t-xl: 24px; }
  .screen, .topbar-inner { max-width: var(--content-max); }
}

/* —— 平板：单列居中，但顶栏留白更舒展 —— */
@media (min-width: 768px) {
  :root { --t-base: 16px; --t-xl: 26px; --t-2xl: 30px; }
  .screen { padding-top: var(--s-6); }
  .topbar-inner { padding-top: var(--s-4); padding-bottom: var(--s-4); }

  .opt:hover { background: var(--bg-hover); box-shadow: inset 0 0 0 1.5px var(--line-strong); transform: translateY(-1px); }
  .entry:hover, .room-item:hover, .tier:hover { transform: translateY(-2px); }
}

/* —— 桌面：侧栏 + 主区 —— */
@media (min-width: 1024px) {
  :root { --content-max: 640px; --t-base: 16.5px; --t-xl: 28px; --t-2xl: 32px; }

  .app { flex-direction: row; }

  .rail {
    display: flex; flex-direction: column; flex: none;
    width: var(--rail-w);
    padding: var(--s-7) var(--s-4) var(--s-5) var(--s-6);
    border-right: 1px solid var(--line);
    background: var(--bg-elev);
    position: sticky; top: 0;
    height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .rail-brand {
    display: flex; align-items: center; gap: var(--s-3);
    margin-bottom: var(--s-7);
    padding: 0 var(--s-2);
  }
  .rail-logo {
    width: 34px; height: 34px; flex: none;
    display: grid; place-items: center;
  }
  .rail-logo svg { width: 100%; height: 100%; }
  .rail-nm { min-width: 0; }
  .rail-nm-t { font-size: var(--t-base); font-weight: 750; letter-spacing: -.01em; }
  .rail-nm-s {
    font-size: var(--t-xs);
    color: var(--fg-faint);
    letter-spacing: .04em;   /* 别加太多字距，侧栏宽度有限 */
    white-space: nowrap;
  }

  .rail-nav { display: flex; flex-direction: column; gap: 2px; }
  .rail-nav .tab {
    flex-direction: row; justify-content: flex-start;
    gap: var(--s-3);
    min-height: 46px;
    padding: 0 var(--s-3);
    border-radius: var(--r-sm);
    font-size: var(--t-base); font-weight: 550;
    color: var(--fg-subtle);
    transition: background var(--d-fast), color var(--d-fast);
  }
  .rail-nav .tab:hover { background: var(--bg-hover); color: var(--fg); }
  .rail-nav .tab.on { background: var(--accent-bg); color: var(--accent-fg); font-weight: 650; }
  .rail-nav .tab.on::after { display: none; }
  .rail-nav .tab.on .tab-ic { animation: none; }
  .rail-nav .tab-badge {
    position: static; transform: none;
    margin-left: auto;
  }

  /* 主区垂直居中 */
  .main { min-height: 100dvh; justify-content: center; }
  .screen { flex: none; padding: var(--s-6) var(--s-8) var(--s-8); }
  .screen.with-tabbar { padding-bottom: var(--s-8); }

  .topbar { position: static; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .topbar-inner { max-width: var(--content-max); }

  /* 桌面端隐藏底部标签栏 */
  .tabbar { display: none; }
  .toast { bottom: var(--s-7); }

  /* 首页双栏 */
  /* 首页双栏：左列文字+入口，右列主视觉。
     guide / entry-list / note 都在 .home 之下，需要各自指定落位。 */
  .home {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, .78fr);
    grid-template-areas:
      "hero  art"
      "guide art"
      "entry art"
      "note  art";
    gap: var(--s-6) var(--s-9);
    align-items: start;
  }
  .home-hero  { grid-area: hero; }
  .home-art   { grid-area: art; align-self: center; margin: 0; }
  .home .guide     { grid-area: guide; margin-bottom: 0 !important; }
  .home .entry-list { grid-area: entry; }
  .home .note       { grid-area: note; margin-top: 0 !important; }
}

/* —— 超宽屏 —— */
@media (min-width: 1440px) {
  :root { --rail-w: 264px; --content-max: 680px; }
  .app { max-width: 1520px; margin: 0 auto; }
}

/* —— 横屏矮屏 —— */
@media (max-height: 560px) and (orientation: landscape) {
  .home-mark { font-size: clamp(42px, 11vw, 62px); }
  .home-hero { padding: var(--s-4) 0; }
  .home-art { max-height: 42vh; }
  .tier { min-height: 64px; padding: var(--s-3); }
  .opt { min-height: 50px; padding: var(--s-2) var(--s-3); }
  .q-text { font-size: var(--t-lg); margin-bottom: var(--s-3); }
  .code-cell { aspect-ratio: 4 / 3; }
}

/* ============================================================
   19. 动效降级
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .view, .card, .opt, .q-card, .rcard, .entry, .room-hero, .score-hero, .guide {
    animation: fadeIn 100ms linear both !important;
  }
  .ripples { display: none; }
  .hm.ghost, .hm.main, .tab.on .tab-ic { animation: none !important; }
  .opt.on::after { animation: none !important; }
}
