/* ============================================================
   桌游规则助手 · 设计系统 v2.0（详见 frontend/DESIGN.md）
   风格：Warm Ink —— 暖纸墨编辑部风
   所有视觉令牌定义在 :root，组件内禁止写裸色值。
   ============================================================ */

/* ---------- 设计令牌 ---------- */
:root {
    /* 表面与文字（暖纸 + 暖墨） */
    --bg: #f6f3ec;
    --card: #ffffff;
    --text: #221e19;
    --muted: #7a7266;
    --border: #e8e2d5;          /* 发丝线：卡片 / 分隔 */
    --border-strong: #d3c9b8;   /* 控件边框：输入框 / 选择器 */
    --hairline: #efeae0;        /* 卡片内部的行分隔线 */

    /* 主色（全站唯一强调色：赤陶） */
    --primary: #b4501e;
    --primary-hover: #963f14;
    --primary-soft: #f8ede4;    /* 主色浅底 */
    --primary-ring: rgba(180, 80, 30, 0.16);
    --gold: #d97706;            /* 琥珀点缀：仅深墨底上使用 */
    --gradient-brand: linear-gradient(135deg, #c25a22, #d97706);

    /* 深墨面（Hero / 页脚 / 阅读器基调） */
    --ink-900: #1b1712;
    --ink-800: #26211a;
    --ink-soft: rgba(246, 240, 228, 0.12);
    --cream: #f6f0e4;
    --cream-muted: #a89d8c;

    /* 语义色（浅底深字体系） */
    --ok: #15803d;
    --ok-soft: #e9f4ec;
    --warn: #b45309;
    --warn-soft: #fbf0de;
    --danger: #b91c1c;
    --danger-soft: #faecea;
    /* 中性：其他语言徽章（浅暖灰底 + 深暖灰字，对比度 ≈ 6:1，小字号也清晰） */
    --neutral: #5c5346;
    --neutral-soft: #ece6da;

    /* 查找命中高亮（译文阅读器；运行时由 JS 读取令牌注入 iframe） */
    --hit-bg: #fbe5b8;
    --hit-current: #b45309;
    --hit-current-fg: #ffffff;

    /* 字体 */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --font-display: Georgia, "Times New Roman", "Noto Serif SC", "SimSun", serif;

    /* 圆角 */
    --radius-s: 8px;   /* 徽章 / 缩略图 / 导航 pill */
    --radius-m: 10px;  /* 按钮 / 输入框 / 气泡 */
    --radius-l: 14px;  /* 卡片 / 弹层 */

    /* 阴影（暖环境光） */
    --shadow-1: 0 1px 2px rgba(48, 38, 26, 0.05);
    --shadow-2: 0 2px 6px rgba(48, 38, 26, 0.06),
                0 14px 36px -14px rgba(48, 38, 26, 0.16);
    --shadow-primary: 0 6px 16px -6px rgba(180, 80, 30, 0.4);

    /* 动效 */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

/* 全局隐藏工具类：JS 切换显示 / 隐藏（阅读器、流式回答区、支付弹层等） */
.hidden { display: none !important; }

body {
    margin: 0;
    font-family: var(--font-sans);
    background:
        radial-gradient(1100px 460px at 88% -12%, rgba(217, 119, 6, 0.05), transparent 60%),
        radial-gradient(900px 420px at -5% -10%, rgba(180, 80, 30, 0.04), transparent 55%),
        var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* 键盘可达性：Tab 聚焦时给主色描边 */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

::selection { background: rgba(180, 80, 30, 0.2); }

a { color: var(--primary); }
a:hover { color: var(--primary-hover); }

/* SVG 线性图标基类 */
.ic { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.18em; }

/* ---------- 顶部导航：暖纸毛玻璃 + 发丝线 ---------- */
header {
    position: sticky;
    top: 0;
    z-index: 600;
    background: rgba(246, 243, 236, 0.88);
    -webkit-backdrop-filter: blur(10px) saturate(1.3);
    backdrop-filter: blur(10px) saturate(1.3);
    border-bottom: 1px solid var(--border);
}

nav {
    max-width: 1080px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

/* 链接 pill hover：底色反馈，不用下划线 */
nav > a:not(.brand) {
    color: #4a443b;
    text-decoration: none;
    padding: 7px 12px;
    border-radius: var(--radius-s);
    font-size: 0.95rem;
    transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
nav > a:not(.brand):hover {
    background: #efeae0;
    color: var(--primary);
}

nav .brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
    color: var(--text);
    text-decoration: none;
    margin-right: auto;
}
nav .brand:hover { color: var(--text); }

/* 品牌 logo：渐变圆角方块 + 白色骰子 SVG */
.brand-mark {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #fff;
    border-radius: 9px;
    background: var(--gradient-brand);
    box-shadow: var(--shadow-primary), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.brand-mark .ic { width: 17px; height: 17px; }

/* ---------- 语言切换器（导航常驻）：中 / EN 分段胶囊 ----------
   与 .doc-switch 同一套语言（浅暖底 + 白底激活片 + 主色字），保证全站观感统一。 */
.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: 6px;
    padding: 2px;
    background: #f1ece2;
    border: 1px solid var(--border);
    border-radius: 999px;
}
.lang-switch .lang-opt {
    padding: 4px 11px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.6;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s var(--ease), color 0.15s var(--ease),
                box-shadow 0.15s var(--ease);
}
.lang-switch .lang-opt:hover { color: var(--text); }
.lang-switch .lang-opt.active {
    background: #fff;
    color: var(--primary);
    box-shadow: 0 1px 4px rgba(34, 30, 25, 0.12);
}
.lang-switch .lang-opt:focus-visible {
    outline: 2px solid var(--primary-ring);
    outline-offset: 1px;
}

/* ---------- 徽章：浅底深字胶囊 ---------- */
.badge {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 999px;
    white-space: nowrap;
}
/* 每个变体显式声明文字色：后面的 .warn { color: var(--warn) } 与 .badge 同特异性，
   若徽章只挂 .badge 不带变体会被覆盖，故逐变体写死浅底深字。 */
.badge.ok     { background: var(--ok-soft);     color: var(--ok); }
.badge.warn   { background: var(--warn-soft);   color: #8a4508; }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.ghost  { background: #efeae0;            color: var(--muted); }
/* 其他语言（fr/de/ja/…）：统一一种中性色，仅文案不同；字色比 ghost 更深，保证小字号可读 */
.badge.other  { background: var(--neutral-soft); color: var(--neutral); }

/* ---------- 布局 ---------- */
main {
    max-width: 1080px;
    margin: 32px auto 48px;
    padding: 0 20px;
}

/* 卡片：白底 + 发丝线 + 浅阴影 */
section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-l);
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-1);
}

h1 { margin-top: 0; font-size: 1.65rem; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.2rem; font-weight: 600; }
.lead { color: var(--muted); margin-top: 4px; }

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

label {
    display: flex;
    flex-direction: column;
    font-size: 0.9rem;
    color: var(--muted);
    gap: 4px;
}

/* ---------- 输入控件：focus 主色焦点环 ---------- */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 9px 12px;
    font-size: 1rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-m);
    background: #fff;
    color: var(--text);
    font-family: inherit;
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="file"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-ring);
}

textarea { resize: vertical; }

/* button 与表单控件一样不继承字体，UA 默认会落到 Arial：显式继承，保证与全站
   字体栈一致；否则 Arial 的行度偏差会让按钮文字在盒内比同排元素低约 1.5px，
   看起来像"没居中"（.btn / .askp-close / .reader-find-btn 等均受影响）。 */
button { font-family: inherit; }

.grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

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

/* ---------- 按钮 ---------- */
.btn {
    /* inline-flex + 居中：按钮常被赋予固定 height（吸底提问框、侧栏输入区等），
       而 body 继承的 line-height 1.7 会让单行文本的行盒高于内容盒——inline-block
       下文字贴顶排布（甚至溢出 padding 区），与其他按钮不在同一水平线上。 */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 16px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-m);
    background: #fff;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    width: fit-content;
    box-shadow: 0 1px 2px rgba(48, 38, 26, 0.06);
    transition: background 0.15s var(--ease), border-color 0.15s var(--ease),
                box-shadow 0.15s var(--ease), color 0.15s var(--ease);
}
.btn:hover { background: #fbf9f4; border-color: #c0b39c; color: var(--text); }

/* 主按钮：赤陶实底 + 主色投影 */
.btn.primary {
    background: var(--primary);
    color: #fff;
    border-color: transparent;
    font-weight: 600;
    box-shadow: var(--shadow-primary), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.btn.primary:hover {
    background: var(--primary-hover);
    color: #fff;
}
.btn.warn { background: var(--warn); color: #fff; border-color: var(--warn); font-weight: 600; }
.btn.warn:hover { background: #93430a; border-color: #93430a; color: #fff; }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); font-weight: 600; }
.btn.danger:hover { background: #991717; border-color: #991717; color: #fff; }
.btn.ok { background: var(--ok); color: #fff; border-color: var(--ok); font-weight: 600; }
.btn.ok:hover { background: #116632; border-color: #116632; color: #fff; }

.form-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 0;
    font-size: 0.9rem;
    font-family: inherit;
}
.btn-link:hover { color: var(--primary-hover); }
.btn-link.danger { color: var(--danger); }
.btn-link.danger:hover { color: #991717; }

/* ---------- 表格 ---------- */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 0.92rem;
    font-variant-numeric: tabular-nums;
}
th, td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--hairline);
}
th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.03em;
    border-bottom: 1.5px solid var(--border);
}
tbody tr { transition: background 0.15s var(--ease); }
tbody tr:hover { background: #faf7f0; }

/* ---------- Flash 消息：浅底深字 ---------- */
.flashes { list-style: none; padding: 0; margin: 0 0 16px 0; }
.flash {
    padding: 10px 14px;
    border-radius: var(--radius-m);
    margin-bottom: 6px;
    font-size: 0.92rem;
    border: 1px solid #ecd9c8;
    background: var(--primary-soft);
    color: #8a4508;
}
.flash-success { background: var(--ok-soft); border-color: #cde5d4; color: #116632; }
.flash-error   { background: var(--danger-soft); border-color: #f0cdca; color: #991717; }

.game-info h2 { margin: 4px 0; }

/* 翻译结果卡：主色浅底 */
.answer {
    background: var(--primary-soft);
    border: 1px solid #ecd9c8;
    border-radius: var(--radius-l);
    padding: 20px;
    margin-top: 16px;
}
.answer h3 { margin: 0 0 8px 0; color: var(--primary); }
.answer-text { white-space: pre-wrap; }

/* ---------- Markdown 渲染样式 ---------- */
.md {
    line-height: 1.75;
    color: var(--text);
    word-wrap: break-word;
    white-space: normal;
}
.md h1,
.md h2,
.md h3,
.md h4,
.md h5,
.md h6 {
    margin: 1em 0 0.5em;
    line-height: 1.3;
}
.md h1 {
    font-size: 1.6em;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.3em;
}
.md h2 {
    font-size: 1.35em;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.3em;
}
.md h3 { font-size: 1.15em; }
.md h4 { font-size: 1em; }
.md p { margin: 0.6em 0; }
.md ul,
.md ol {
    margin: 0.6em 0;
    padding-left: 1.5em;
}
.md li { margin: 0.2em 0; }
.md blockquote {
    margin: 0.8em 0;
    padding: 0.4em 1em;
    border-left: 3px solid var(--primary);
    background: #f7f3ea;
    color: var(--muted);
    border-radius: 0 var(--radius-s) var(--radius-s) 0;
}
.md code {
    background: var(--primary-soft);
    color: #8a4508;
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 0.9em;
}
.md pre {
    background: #221e19;
    color: #ece5d8;
    padding: 12px 14px;
    border-radius: var(--radius-m);
    overflow: auto;
    font-size: 0.85rem;
    line-height: 1.5;
}
.md pre code {
    background: transparent;
    padding: 0;
    color: inherit;
    font-size: inherit;
}
.md table {
    border-collapse: collapse;
    margin: 0.8em 0;
    width: 100%;
    font-variant-numeric: normal;
}
.md th,
.md td {
    border: 1px solid var(--border);
    padding: 6px 10px;
}
.md th { background: #f7f4ed; }
.md img { max-width: 100%; }
.md a { color: var(--primary); }
.md hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.2em 0;
}

.tips { margin-top: 24px; }
.muted { color: var(--muted); font-size: 0.85rem; }
.empty { color: var(--muted); }
.warn { color: var(--warn); font-weight: 600; }
code {
    background: var(--primary-soft);
    color: #8a4508;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.9em;
}

/* ---------- 深墨页脚（书的封底） ---------- */
footer.site-foot {
    background:
        radial-gradient(800px 300px at 70% 0%, rgba(217, 119, 6, 0.08), transparent 60%),
        var(--ink-900);
    color: var(--cream-muted);
    padding: 36px 20px 44px;
    font-size: 0.8rem;
    text-align: center;
    margin-top: 8px;
}
footer.site-foot .foot-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--cream);
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 10px;
}
footer.site-foot small { display: block; }

/* 管理端浅色页脚 */
.admin-foot {
    text-align: center;
    color: #8a8072;
    padding: 24px 16px 36px;
    font-size: 0.8rem;
}

/* ---------- 状态栏：表单提交后顶部 fixed 提示 ---------- */
.status-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: linear-gradient(135deg, var(--primary), #a04b1a);
    color: #fff;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 0.95rem;
    box-shadow: 0 4px 16px rgba(48, 38, 26, 0.22);
}
.status-bar.hidden { display: none; }

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

button:disabled { opacity: 0.55; cursor: not-allowed; }

@media (max-width: 640px) {
    .grid2 { grid-template-columns: 1fr; }
    nav { gap: 6px; }
    section { padding: 20px; }
}

/* ============================================================
   首页：深墨 Hero 横幅（书的封面）
   ============================================================ */
.hero-band {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(900px 420px at 78% -10%, rgba(217, 119, 6, 0.16), transparent 62%),
        radial-gradient(700px 380px at 8% 108%, rgba(180, 80, 30, 0.12), transparent 60%),
        var(--ink-900);
    color: var(--cream);
    border-radius: var(--radius-l);
    margin: 0 0 24px;
    padding: 64px 24px 56px;
    text-align: center;
}
/* 极浅的骰点纹理（右上角一枚纸面骰子的视错觉） */
.hero-band::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(246, 240, 228, 0.045) 1px, transparent 1.6px);
    background-size: 26px 26px;
    pointer-events: none;
}
.hero-band > * { position: relative; }

.hero-eyebrow {
    margin: 0 0 16px;
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gold);
}
.hero-title {
    margin: 0 auto;
    max-width: 640px;
    font-size: 2.75rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.22;
    color: var(--cream);
}
/* 渐变文字：仅首页 Hero 关键词（琥珀烛光） */
.hero-title .grad {
    background: linear-gradient(120deg, #e8934a, #f2b45c);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.hero-desc {
    color: var(--cream-muted);
    font-size: 1.02rem;
    line-height: 1.8;
    max-width: 560px;
    margin: 18px auto 28px;
}
.hero-desc strong { color: var(--cream); font-weight: 600; }

/* Hero 大号搜索框：白卡胶囊，与导航栏同一个搜索组件（服务端搜全库 + 下拉结果） */
.hero-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    width: min(620px, 100%);
    margin: 0 auto 14px;
    padding: 6px 6px 6px 18px;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 999px;
    box-shadow: 0 18px 44px -16px rgba(0, 0, 0, 0.55);
}
.hero-search .ic { color: var(--muted); }
.hero-search input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1rem;
    padding: 10px 0;
    box-shadow: none;
}
.hero-search input:focus { outline: none; box-shadow: none; }
.hero-search .btn { flex: none; border-radius: 999px; padding: 10px 20px; }
/* Hero 搜索下拉：与胶囊等宽，贴在胶囊正下方 */
.hero-search .rule-results { left: 0; right: 0; width: auto; }
.hero-search-hint {
    font-size: 0.78rem;
    color: var(--cream-muted);
    margin: 0 0 26px;
}
.hero-search-hint kbd {
    font-family: inherit;
    font-size: 0.72rem;
    padding: 1px 6px;
    border: 1px solid rgba(246, 240, 228, 0.25);
    border-bottom-width: 2px;
    border-radius: 5px;
    color: var(--cream);
}

/* Hero CTA（无搜索框的降级态）：主按钮 + 深底幽灵按钮 */
.hero-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0 0 26px;
}
.btn.ghost-dark {
    background: rgba(246, 240, 228, 0.07);
    border-color: rgba(246, 240, 228, 0.3);
    color: var(--cream);
    box-shadow: none;
}
.btn.ghost-dark:hover {
    background: rgba(246, 240, 228, 0.14);
    border-color: rgba(246, 240, 228, 0.45);
    color: #fff;
}

/* Hero 统计行：衬线大数字 */
.hero-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
    margin: 0;
    padding-top: 22px;
    border-top: 1px solid rgba(246, 240, 228, 0.12);
}
.hero-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 96px;
}
.hero-stat b {
    font-family: var(--font-display);
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--cream);
    font-variant-numeric: tabular-nums;
}
.hero-stat span {
    font-size: 0.78rem;
    color: var(--cream-muted);
    letter-spacing: 0.04em;
}
@media (max-width: 640px) {
    .hero-band { padding: 44px 18px 40px; border-radius: var(--radius-m); }
    .hero-title { font-size: 1.85rem; }
    .hero-stats { gap: 24px; }
}

/* ---------- 首页功能三卡 ---------- */
.lib-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.feature-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 24px 22px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-1);
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.feature-card:hover {
    border-color: #d9b599;
    box-shadow: var(--shadow-2);
    color: var(--text);
}
.feature-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: var(--radius-m);
}
.feature-icon .ic { width: 22px; height: 22px; }
.feature-card h3 { margin: 0; font-size: 1.02rem; font-weight: 600; }
.feature-card p { margin: 0; color: var(--muted); font-size: 0.86rem; line-height: 1.65; }
.feature-card .feature-more {
    margin-top: auto;
    font-size: 0.82rem;
    color: var(--primary);
    font-weight: 500;
}
/* 三步上手的衬线大编号（编辑部风的章节号） */
.how-num {
    font-family: var(--font-display);
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1;
    color: var(--primary);
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
}

/* ---------- 首页底部：翻译引导条 ---------- */
.translate-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin: 24px 0 0;
    padding: 22px 24px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-1);
}
.translate-strip .ts-body strong { font-size: 1.02rem; }
.translate-strip .ts-body p { margin: 4px 0 0; font-size: 0.88rem; }
.translate-strip .btn { flex: none; }

/* ---------- 首页规则库：工具条 + 卡片网格 ---------- */
.lib-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.lib-count { font-size: 0.85rem; color: var(--muted); }
.lib-count b { color: var(--text); font-variant-numeric: tabular-nums; }

.lib-head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: none;
}
.lib-head-actions .btn.ghost {
    padding: 7px 16px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
}
.lib-head-actions .btn.ghost:disabled { opacity: .5; cursor: wait; }

.lib-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 10px 0 18px;
}
.lib-toolbar .muted { font-size: 0.82rem; }

.lib-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}
.lib-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 18px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    box-shadow: var(--shadow-1);
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.lib-card:hover {
    border-color: #d9b599;
    box-shadow: var(--shadow-2);
}
.lib-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}
.lib-name {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.4;
    word-break: break-word;
}
/* 拉伸链接：标题覆盖整卡可点击 */
.lib-name::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.lib-card:hover .lib-name { color: var(--primary); }
.lib-ask {
    position: relative;
    z-index: 2;
    flex: none;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    padding: 3px 10px;
    border: 1px solid #e3c9b5;
    border-radius: 999px;
    background: #fdf9f4;
    transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.lib-ask:hover { background: var(--primary-soft); border-color: #d9a07f; color: var(--primary); }
.lib-en {
    font-size: 0.8rem;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lib-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.78rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}
.lib-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.lib-none {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--muted);
    padding: 28px 0;
}

/* ---------- Chips：反馈分类 / 语言筛选 ---------- */
.chip {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s var(--ease), border-color 0.15s var(--ease),
                color 0.15s var(--ease);
}
.chip:hover {
    background: var(--primary-soft);
    border-color: #d9a07f;
    color: var(--primary);
}
.chip.active {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

/* ---------- 规则搜索选择器（导航常驻搜索框） ---------- */
.nav-search { position: relative; display: flex; align-items: center; margin-right: 6px; }
.nav-search-icon {
    position: absolute;
    left: 11px;
    color: var(--muted);
    pointer-events: none;
    z-index: 1;
    display: inline-flex;
}
#rule-search {
    width: 230px;
    padding: 7px 14px 7px 34px;
    border-radius: 999px;
    font-size: 0.9rem;
    background: #efece5;
    border-color: var(--border-strong);
}
#rule-search:focus {
    background: #fff;
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-ring);
}
.nav-search .rule-results {
    left: auto;
    right: 0;
    width: min(420px, 90vw);
}
@media (max-width: 640px) {
    #rule-search { width: 100%; }
    .nav-search { flex: 1 1 160px; }
}

/* 搜索结果下拉：悬浮层（shadow-2）
   注意：它会出现在深墨 Hero 内，必须显式复位文字色与对齐，
   否则会继承 .hero-band 的 --cream / center，白底上游戏名发白看不清 */
.rule-results {
    position: absolute;
    top: 100%;
    z-index: 500;
    max-height: 320px;
    overflow: auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-2);
    margin-top: 6px;
    color: var(--text);
    text-align: left;
}
.rule-results.hidden { display: none; }

/* 结果行：中文名 → 英文名 + BGG# → 语言徽章靠右 */
.rule-result {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--hairline);
    cursor: pointer;
    transition: background-color 0.15s var(--ease);
}
.rule-result:last-child { border-bottom: none; }
.rule-result:hover { background: var(--primary-soft); }
.rule-name {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}
.rule-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    font-size: 0.8rem;
    color: var(--muted);
}
.rule-en { overflow: hidden; text-overflow: ellipsis; }
.rule-sep { color: var(--border-strong); }
.rule-bgg {
    font-family: var(--font-display);
    font-variant-numeric: tabular-nums;
}
.rule-badges {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: none;
    margin-left: auto;
}
.rule-result.empty {
    justify-content: center;
    cursor: default;
    color: var(--muted);
}
.rule-result.empty:hover { background: transparent; }

/* 搜索记录下拉：与结果下拉同规格的悬浮层，独立类名避免与结果行样式耦合 */
.rule-history {
    position: absolute;
    top: 100%;
    z-index: 500;
    min-width: 220px;
    max-height: 320px;
    overflow: auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-2);
    margin-top: 6px;
    color: var(--text);
    text-align: left;
}
.rule-history.hidden { display: none; }
.rule-history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--hairline);
    font-size: 0.78rem;
    color: var(--muted);
}
.rule-history-clear {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--primary);
    font: inherit;
    font-size: 0.78rem;
}
.rule-history-clear:hover { text-decoration: underline; }
.rule-history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-bottom: 1px solid var(--hairline);
    cursor: pointer;
    transition: background-color 0.15s var(--ease);
}
.rule-history-item:last-child { border-bottom: none; }
.rule-history-item:hover { background: var(--primary-soft); }
.rule-history-icon { flex: none; display: inline-flex; color: var(--muted); }
.rule-history-icon svg { width: 15px; height: 15px; }
.rule-history-term {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
    color: var(--text);
}
.rule-history-game {
    flex: none;
    max-width: 45%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.78rem;
    color: var(--muted);
}
/* 记录下拉与结果下拉在各搜索容器内保持同一对齐方式 */
.nav-search .rule-history { left: auto; right: 0; width: min(420px, 90vw); }
.hero-search .rule-history { left: 0; right: 0; width: auto; }

/* ---------- 规则图片网格 ---------- */
.rule-imgs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 12px;
}
.rule-imgs a { display: block; }
/* PDF 分册卡：横排文件卡（图标 + 册名 + 类型说明） */
.rule-imgs .rule-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    background: #fff;
    color: var(--text);
    text-decoration: none;
    transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.rule-imgs .rule-file:hover { background: #fdfaf4; border-color: #d9b599; color: var(--text); }
.rule-imgs .rule-file .ic { width: 22px; height: 22px; color: var(--primary); }
.rule-file-body { display: flex; flex-direction: column; min-width: 0; }
.rule-file-body strong { font-size: 0.95rem; font-weight: 600; }
.rule-file-body small { color: var(--muted); font-size: 0.8rem; margin-top: 1px; }

/* 图片型规则（多页）：收成一张入口卡，背后叠两层纸片示意「一叠页」。
   首张 anchor 承载图标与文案，其余 anchor 只作阅读器分页数据（display:none，
   仍会被 JS 的 querySelectorAll 收集，故阅读器内可逐页翻阅）。 */
.rule-imgs.is-stack {
    position: relative;
    isolation: isolate;   /* 隔离层叠上下文，伪元素不穿到底层背景之下 */
    display: block;
}
.rule-imgs.is-stack .rule-stack-extra { display: none; }
.rule-imgs.is-stack > .rule-file {
    position: relative;
    z-index: 3;
    box-shadow: var(--shadow-1);
}
.rule-imgs.is-stack::before,
.rule-imgs.is-stack::after {
    content: "";
    position: absolute;
    height: 100%;
    background: #f6f1e8;
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
}
.rule-imgs.is-stack::before { top: 6px; left: 10px; right: 10px; z-index: 2; }
.rule-imgs.is-stack::after { top: 12px; left: 20px; right: 20px; z-index: 1; }

/* ---------- 规则阅读器：全屏沉浸式（深墨例外区） ----------
   顶部标题栏与两侧翻页箭头均悬浮在画面上（不占布局空间），
   图片/PDF/翻译文档占满整个视口；点击画面可隐藏全部工具栏（沉浸模式）。 */
.reader {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(18, 15, 12, 0.96);
    display: flex;
    flex-direction: column;
}
.reader.hidden { display: none; }
/* 遮罩层（全屏阅读器 / 反馈弹窗）打开期间锁定背景页面滚动：
   背景页面滚动条被遮罩盖住却依然存在——既滚不动（滚动看不到任何变化），
   又会与遮罩内译文文档 / 图片自带的滚动条并列显示，形成"两层滚动条"。
   由 JS（window.bgScrollLock / bgScrollUnlock）加 / 去此类。 */
html.scroll-locked,
html.scroll-locked body { overflow: hidden; }
.reader-head {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--cream);
    background: linear-gradient(rgba(18, 15, 12, 0.85), rgba(18, 15, 12, 0));
    transition: opacity 0.2s;
}
.reader-head .btn-link { color: var(--cream); font-size: 0.95rem; margin-left: auto; }
.reader-head .btn-link:hover { color: #fff; text-decoration: underline; }
.reader-count { color: rgba(246, 240, 228, 0.6); font-size: 0.85rem; }
.reader-tip {
    color: rgba(246, 240, 228, 0.4);
    font-size: 0.78rem;
    margin-left: 8px;
}
/* 译文正文查找（仅译文文档 HTML 显示）：胶囊形深色输入条 + 命中计数 + 上/下一处 + 关闭。
   margin-left: auto 把它推到工具栏右侧（与反馈/关闭按钮同侧）。 */
.reader-find {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    padding: 3px 6px 3px 12px;
    background: rgba(246, 240, 228, 0.1);
    border: 1px solid rgba(246, 240, 228, 0.22);
    border-radius: 999px;
}
.reader-find input {
    width: 190px;
    padding: 4px 0;
    color: var(--cream);
    background: transparent;
    border: 0;
    font-size: 0.9rem;
    line-height: 1.3;
}
.reader-find input:focus { outline: none; box-shadow: none; }
.reader-find input::placeholder { color: rgba(246, 240, 228, 0.45); }
/* 关掉 type=search 的原生清除按钮，避免与自绘的「关闭」重复 */
.reader-find input::-webkit-search-cancel-button { display: none; }
.reader-find-count {
    min-width: 54px;
    text-align: center;
    color: rgba(246, 240, 228, 0.62);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.reader-find-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: var(--cream);
    background: rgba(246, 240, 228, 0.14);
    border: 0;
    border-radius: 50%;
    font-size: 0.78rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.reader-find-btn:hover { background: rgba(246, 240, 228, 0.3); }
.reader-find-btn:disabled { opacity: 0.45; cursor: default; }
/* 译文版本切换（完整版 ⇄ 速查版）：深墨底分段胶囊，与查找栏同一质感；
   仅译文文档且两版本都在时由 JS 显示。 */
.reader-docver {
    display: flex;
    gap: 3px;
    padding: 3px;
    background: rgba(246, 240, 228, 0.1);
    border: 1px solid rgba(246, 240, 228, 0.22);
    border-radius: 999px;
}
.reader-docver button {
    padding: 2px 12px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: rgba(246, 240, 228, 0.62);
    font-family: inherit;
    font-size: 0.8rem;
    line-height: 1.55;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.reader-docver button:hover { color: #fff; }
.reader-docver button.active {
    background: rgba(246, 240, 228, 0.92);
    color: var(--text);
    font-weight: 600;
}
.reader-docver button:focus-visible {
    outline: 2px solid rgba(246, 240, 228, 0.7);
    outline-offset: -2px;
}
@media (max-width: 700px) {
    .reader-find input { width: 110px; }
    .reader-find-count { min-width: 44px; }
    /* 译文文档计数恒为 1/1 无信息量：窄屏让位给版本切换控件 */
    .reader.has-docver #reader-count { display: none; }
    .reader-docver button { padding: 2px 9px; font-size: 0.75rem; }
}
/* 查找栏在场时收掉「反馈问题」的自动左边距：否则两个自动边距会把空白对半分 */
.reader.has-find .reader-head #reader-feedback { margin-left: 16px; }
.reader-body {
    position: relative;
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.reader-body img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
    /* Ctrl+滚轮缩放 / 拖拽平移：显示抓手并禁用原生拖拽/选中 */
    cursor: grab;
    user-select: none;
    -webkit-user-drag: none;
}
.reader-body img:active { cursor: grabbing; }
.reader-zoom {
    color: #f2b45c;
    font-weight: 600;
}
.reader-body iframe {
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}
/* PDF 内嵌加载兜底提示：悬浮在画面底部，不参与 flex 布局、不拦截点击 */
.reader-pdf-hint {
    position: absolute;
    left: 0; right: 0; bottom: 14px;
    margin: 0 auto;
    width: max-content;
    max-width: 92%;
    padding: 6px 14px;
    background: rgba(27, 23, 18, 0.78);
    color: var(--cream);
    font-size: 0.82rem;
    line-height: 1.5;
    border-radius: 999px;
    text-align: center;
    pointer-events: none;
    z-index: 2;
}
/* PDF：pdf.js 在 canvas 上逐页渲染（不触发浏览器原生 PDF 查看器） */
.reader-body .reader-pdf-wrap {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    overflow-x: hidden;
    background: #26221c;
}
.reader-pdf-pages {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 18px 0 44px;
    min-height: 100%;
}
.reader-pdf-pages canvas {
    background: #fff;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
    max-width: 100%;
    height: auto;
}
.reader-pdf-loading {
    position: absolute;
    left: 0; right: 0; top: 38%;
    text-align: center;
    color: var(--cream);
    font-size: 0.9rem;
    z-index: 2;
    pointer-events: none;
}
/* 翻译文档：左侧目录 + 右侧正文（阅读器 iframe 内嵌时），浅色阅读风格 */
.reader-doc-wrap {
    --toc-w: 230px;
    flex: 1;
    align-self: stretch;
    min-width: 0;
    position: relative;
    display: flex;
    align-items: stretch;
}
.reader-toc {
    flex: none;
    width: var(--toc-w);
    overflow-y: auto;
    padding: 16px 12px 28px;
    background: #f6f4ee;
    border-right: 1px solid #e5e0d2;
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.06);
    transition: width 0.25s ease, padding 0.25s ease, opacity 0.25s ease,
                border-color 0.25s ease, box-shadow 0.25s ease;
}
.reader-doc-wrap.toc-hidden .reader-toc {
    width: 0;
    padding-left: 0;
    padding-right: 0;
    overflow: hidden;
    opacity: 0;
    border-right-color: transparent;
    box-shadow: none;
}
.reader-toc h4 {
    margin: 0 0 10px;
    padding: 0 10px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 3px;
    color: #a09787;
    border-bottom: 1px solid #ebe6da;
}
.reader-toc ul {
    margin: 0;
    padding: 0;
    list-style: none;
}
.reader-toc a {
    display: block;
    margin: 1px 0;
    padding: 7px 10px;
    border-left: 3px solid transparent;
    border-radius: 0 6px 6px 0;
    color: #57503f;
    font-size: 0.85rem;
    line-height: 1.45;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.reader-toc a:hover { color: #221e19; background: #eeeade; }
.reader-toc a.lv2 { padding-left: 24px; }
.reader-toc a.lv3 { padding-left: 38px; }
.reader-toc a.lv4 { padding-left: 52px; }
.reader-toc a.active {
    color: var(--primary);
    border-left-color: var(--primary);
    background: var(--primary-soft);
    font-weight: 600;
}
/* 目录折叠/展开按钮：吸附在侧栏右边缘，收起后回到屏幕左边缘 */
.reader-toc-toggle {
    position: absolute;
    top: 50%;
    left: var(--toc-w);
    z-index: 6;
    transform: translateY(-50%);
    width: 26px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 0.95rem;
    line-height: 1;
    color: #57503f;
    background: #fff;
    border: 1px solid #e5e0d2;
    border-left: 0;
    border-radius: 0 8px 8px 0;
    box-shadow: 3px 0 8px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: left 0.25s ease, color 0.15s, background 0.15s;
}
.reader-toc-toggle:hover { color: #221e19; background: #f3f0e8; }
.reader-doc-wrap.toc-hidden .reader-toc-toggle { left: 0; }
.reader-doc-main {
    flex: 1;
    min-width: 0;
    position: relative;
}
.reader-doc-main iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}
/* 窄屏时目录收窄，避免挤压正文 */
@media (max-width: 900px) {
    .reader-doc-wrap { --toc-w: 160px; }
}
/* 两侧悬浮翻页箭头：圆形半透明按钮，单页时自动隐藏 */
.reader-nav {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    padding: 0 12px;
    transform: translateY(-50%);
    pointer-events: none;
    transition: opacity 0.2s;
}
.reader-nav .btn {
    pointer-events: auto;
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--cream);
    background: rgba(24, 20, 16, 0.55);
    border: 1px solid rgba(246, 240, 228, 0.28);
    border-radius: 50%;
    box-shadow: none;
    backdrop-filter: blur(4px);
}
.reader-nav .btn:hover { background: rgba(246, 240, 228, 0.18); color: #fff; border-color: rgba(246, 240, 228, 0.28); }
.reader-nav .btn:disabled { opacity: 0; cursor: default; pointer-events: none; }
/* 沉浸模式：点击画面后隐藏全部悬浮工具栏，画面 100% 展示
   （「问 AI」拉签随工具栏一并隐藏，见 .ask-panel.reader-immersive .ask-tab） */
.reader.chrome-off .reader-head,
.reader.chrome-off .reader-nav { opacity: 0; pointer-events: none; }

/* ---------- 问答页（游戏专属页） ---------- */
/* 游戏头部：暖纸渐变卡 + 渐变图标块（只放身份信息，资料入口在下方规则资料区） */
.game-hero {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    flex-wrap: wrap;
    background: linear-gradient(135deg, #faf6ee 0%, #ffffff 60%);
    border: 1px solid #ece2cf;
}
.game-hero-icon {
    flex: none;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--gradient-brand);
    border-radius: 18px;
    box-shadow: var(--shadow-primary), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.game-hero-icon .ic { width: 32px; height: 32px; }
.game-hero-main { flex: 1; min-width: 240px; }
.game-hero h1 { margin: 0; font-size: 1.6rem; }
.game-hero .game-meta { margin: 6px 0 0; }

/* ---------- 规则资料区：译文 / 原文统一入口（详见 DESIGN.md §4.12） ---------- */
.rule-materials-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.rule-materials-head h2 { margin: 0; }
.rule-materials-more { font-size: 0.85rem; white-space: nowrap; }

.material-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 16px;
}
.material-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.material-card::after {
    content: "›";
    margin-left: auto;
    flex: none;
    color: var(--muted);
    font-size: 1.15rem;
    line-height: 1;
    transition: color 0.15s var(--ease);
}
.material-card:hover {
    border-color: #d9b599;
    background: #fdfbf7;
    color: var(--text);
}
.material-card:hover::after { color: var(--primary); }
.material-icon {
    flex: none;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: var(--radius-s);
}
.material-icon .ic { width: 20px; height: 20px; }
.material-body { display: flex; flex-direction: column; min-width: 0; }
.material-body strong { font-size: 0.95rem; font-weight: 600; }
.material-body small { color: var(--muted); font-size: 0.8rem; margin-top: 1px; }

/* 译文版本切换（完整版 ⇄ 速查版）：入口卡内的分段胶囊（chat / rule 页共用）。
   卡片本体是 div（内嵌按钮不能套 a），由 .doc-btn 统一补手型与焦点态。 */
.doc-btn { cursor: pointer; }
.doc-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.doc-switch {
    display: inline-flex;
    gap: 2px;
    width: max-content;
    margin: 5px 0 2px;
    padding: 2px;
    background: #f1ece2;
    border: 1px solid var(--border);
    border-radius: 999px;
}
.doc-switch-btn {
    padding: 2px 13px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-family: inherit;
    font-size: 0.78rem;
    line-height: 1.6;
    cursor: pointer;
    transition: background 0.15s var(--ease), color 0.15s var(--ease),
                box-shadow 0.15s var(--ease);
}
.doc-switch-btn:hover { color: var(--text); }
.doc-switch-btn.active {
    background: #fff;
    color: var(--primary);
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(34, 30, 25, 0.12);
}
.doc-switch-btn:focus-visible {
    outline: 2px solid var(--primary-ring);
    outline-offset: 1px;
}

/* 原文页面缩略图：手风琴（默认折叠，点卡片可直接打开阅读器第 1 页） */
.materials-thumbs { margin-top: 18px; border-top: 1px solid var(--hairline); }
.materials-thumbs summary {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    padding: 12px 2px;
    cursor: pointer;
    list-style: none;
    color: var(--muted);
    font-size: 0.9rem;
    transition: color 0.15s var(--ease);
}
.materials-thumbs summary::-webkit-details-marker { display: none; }
.materials-thumbs summary:hover { color: var(--text); }
.materials-thumbs .mt-count { font-size: 0.8rem; }
.materials-thumbs .mt-chevron {
    margin-left: auto;
    font-size: 0.85rem;
    transition: transform 0.2s var(--ease);
}
.materials-thumbs[open] .mt-chevron { transform: rotate(180deg); }
.mt-group-label {
    margin: 14px 0 0;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--muted);
}
.materials-thumbs .rule-imgs { margin-top: 10px; }

/* 聊天气泡（问答侧栏 _ask_panel.html / 规则页内联问答 _chat_inline.html 共用）：
   用户提问右对齐赤陶渐变，AI 回答左对齐白卡 */
.chat-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.chat-q {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}
.chat-bubble {
    border-radius: 16px;
    padding: 12px 16px;
    max-width: 88%;
    word-break: break-word;
}
.chat-bubble.q {
    background: linear-gradient(180deg, #c25a22, var(--primary));
    color: #fff;
    border-bottom-right-radius: 4px;
    white-space: pre-wrap;
}
.chat-bubble.a {
    background: #fff;
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
    max-width: 100%;
    box-shadow: var(--shadow-1);
}
/* 刚生成的答案：浅赤陶底标识 */
.chat-item.latest .chat-bubble.a {
    background: #fbf4ec;
    border-color: #ecd9c8;
}
/* 流式生成中：主色调边框 */
.chat-item.live .chat-bubble.a {
    border-color: #dcae8b;
    background: #fdf9f4;
}
.chat-meta { font-size: 0.78rem; text-align: right; }

/* 思考中占位：首 token 前显示在 AI 气泡内（spinner 同 .field-msg.checking） */
.chat-thinking {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    line-height: 1.5;
}
.chat-thinking::before {
    content: "";
    flex: none;
    width: 13px;
    height: 13px;
    border: 2px solid #d6cec0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* 提问 / 回答列：气泡 + 「复制」按钮纵排（提问右对齐、回答左对齐） */
.chat-a {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}
/* 正文可自由框选 / 复制（显式声明，避免被上层禁选样式波及） */
.chat-bubble,
.chat-meta {
    user-select: text;
    -webkit-user-select: text;
}
/* 气泡下方「复制」按钮（提问 / 回答都有）；流式生成中隐藏，复制成功后短暂变为「已复制」 */
.chat-copy {
    padding: 3px 11px;
    font-family: inherit;
    font-size: 0.76rem;
    line-height: 1.6;
    color: var(--muted);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.chat-copy:hover {
    color: var(--primary);
    border-color: #dcae8b;
    background: var(--primary-soft);
}
.chat-copy.done {
    color: #2f7d4f;
    border-color: #9ccfae;
    background: #eef7f1;
}
.chat-item.live .chat-copy { display: none; }

/* ---------- 规则页内联问答区（_chat_inline.html，页尾平铺） ---------- */
.chat-section { padding-bottom: 8px; }
.chat-stream {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 16px;
}
.chat-empty { text-align: center; padding: 28px 0; color: var(--muted); }

/* 提问输入框：白卡（内联形态，随页面排布，不吸底） */
.ask-box {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-l);
    padding: 10px 12px;
    box-shadow: var(--shadow-2);
}
.ask-box-main { display: flex; gap: 10px; align-items: flex-end; }
.ask-box-main textarea {
    flex: 1;
    resize: none;
    border: none;
    background: transparent;
    padding: 10px 2px;
}
.ask-box-main textarea:focus {
    border: none;
    box-shadow: none;
}
.ask-btn { flex: none; height: 42px; padding: 0 22px; }
.ask-box-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    font-size: 0.82rem;
}
.ask-box-meta select {
    width: auto;
    padding: 3px 10px;
    font-size: 0.82rem;
    border-radius: 999px;
}

/* 游戏信息区：中英文名 / 年份 / BGG 评分 / 排名 / 复杂度 */
.game-info h2 { margin-bottom: 4px; }
.en-name { font-size: 0.9em; font-weight: 400; }
.game-meta { margin: 6px 0; }
.game-meta strong { color: var(--primary); font-variant-numeric: tabular-nums; }

/* ---------- 独立规则页（/rule/<id>）：档案式布局 ----------
   ① 档案头：左侧衬线标题 + 数据带，右侧提问 CTA 面板
   ② 内容区：译文阅读卡 / PDF 分册卡 / 图片缩略图网格
   ③ 反馈条：页尾静置入口（不悬浮） */
.rule-hero {
    display: flex;
    align-items: stretch;
    gap: 28px;
    flex-wrap: wrap;
    background:
        radial-gradient(520px 220px at 100% 0%, rgba(217, 119, 6, 0.06), transparent 60%),
        linear-gradient(160deg, #fdfbf7 0%, #ffffff 55%);
}
.rule-hero-main { flex: 1 1 420px; min-width: 0; }
.rule-eyebrow {
    margin: 0 0 10px;
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--primary);
}
.rule-hero-title {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.25;
}
.rule-hero-en {
    margin: 4px 0 0;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.02rem;
    color: var(--muted);
}
/* 数据带：衬线大数字，发丝线分隔 */
.rule-stats {
    display: flex;
    flex-wrap: wrap;
    margin: 22px 0 0;
    padding: 0;
}
.rule-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 22px;
    border-left: 1px solid var(--hairline);
}
.rule-stat:first-child { padding-left: 0; border-left: none; }
.rule-stat dt { font-size: 0.72rem; letter-spacing: 0.08em; color: var(--muted); }
.rule-stat dd {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}
.rule-stat dd.is-primary { color: var(--primary); }
.rule-stat dd small { font-size: 0.78rem; font-weight: 400; color: var(--muted); }

/* 提问 CTA 面板：暖底小卡，状态化按钮 + 单行说明（替代旧版右上散排文字） */
.rule-cta {
    flex: 0 1 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    padding: 20px 22px;
    background: linear-gradient(150deg, var(--primary-soft), #fdf9f2);
    border: 1px solid #ecdcc9;
    border-radius: var(--radius-m);
}
.rule-cta-head { display: flex; align-items: center; gap: 10px; }
.rule-cta-icon {
    flex: none;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--gradient-brand);
    border-radius: 10px;
    box-shadow: var(--shadow-primary);
}
.rule-cta-icon .ic { width: 19px; height: 19px; }
.rule-cta-title { margin: 0; font-weight: 600; font-size: 0.98rem; }
.rule-cta-btn { flex: 1; text-align: center; white-space: nowrap; }
.rule-cta-note { margin: 0; font-size: 0.8rem; color: var(--muted); line-height: 1.5; }

/* 内容区小节标题：赤陶短杠 + 小节名 + 类型/操作说明 */
.rule-sec-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.rule-sec-head h2 { margin: 0; display: flex; align-items: center; gap: 9px; }
.rule-sec-head h2::before {
    content: "";
    width: 4px;
    height: 15px;
    border-radius: 2px;
    background: var(--primary);
}
.rule-sec-sub { margin: 0; font-size: 0.82rem; color: var(--muted); }

/* 译文阅读卡：主要内容入口（图标 + 标题 + 说明 + 滑动箭头） */
.rule-docs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    margin-top: 16px;
}
.rule-doc-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    background: linear-gradient(150deg, #ffffff, #fdfaf4);
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.rule-doc-card:hover { border-color: #d9b599; box-shadow: var(--shadow-2); color: var(--text); }
.rule-doc-icon {
    flex: none;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: var(--radius-s);
}
.rule-doc-icon .ic { width: 22px; height: 22px; }
.rule-doc-body { display: flex; flex-direction: column; min-width: 0; }
.rule-doc-body strong { font-size: 1.02rem; font-weight: 600; }
.rule-doc-body small { color: var(--muted); font-size: 0.82rem; margin-top: 2px; }
.rule-doc-arrow {
    margin-left: auto;
    flex: none;
    color: var(--muted);
    font-size: 1.1rem;
    line-height: 1;
    transition: transform 0.15s var(--ease), color 0.15s var(--ease);
}
.rule-doc-card:hover .rule-doc-arrow { color: var(--primary); transform: translateX(3px); }

/* 空状态：无任何规则文件 */
.rule-none { text-align: center; padding: 40px 20px; }
.rule-none-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    background: #f4efe5;
    border-radius: 16px;
}
.rule-none-icon .ic { width: 26px; height: 26px; }
.rule-none-title { margin: 0 0 4px; font-weight: 600; }
.rule-none-sub { margin: 0; color: var(--muted); font-size: 0.92rem; }

/* 反馈条：页尾静置入口（发丝虚线框），反馈问题按钮不再悬浮 */
.rule-feedback {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    margin: 4px 0 24px;
    padding: 16px 20px;
    background: #faf7f0;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-l);
}
.rule-feedback-icon {
    flex: none;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 50%;
}
.rule-feedback-icon .ic { width: 17px; height: 17px; }
.rule-feedback-text { margin: 0; font-size: 0.92rem; color: var(--muted); }
.rule-feedback-text em { font-style: normal; color: var(--text); }
.rule-feedback-btn { flex: none; }

/* 档案头响应式：窄屏时 CTA 面板铺满、数据带收紧 */
@media (max-width: 720px) {
    .rule-hero { gap: 20px; }
    .rule-hero-title { font-size: 1.55rem; }
    .rule-cta { flex-basis: 100%; }
    .rule-stat { padding: 0 14px; }
    .rule-stat dd { font-size: 1.12rem; }
}
/* 右下角悬浮提问按钮：打开 AI 问答侧栏（button 元素，重置原生边框） */
.ask-float {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border: 0;
    border-radius: 999px;
    background: var(--gradient-brand);
    color: #fff;
    font-family: inherit;
    font-size: 0.98rem;
    cursor: pointer;
    box-shadow: var(--shadow-primary), 0 8px 24px -6px rgba(217, 119, 6, 0.35);
}
.ask-float:hover { color: #fff; filter: brightness(1.08); }
.ask-float .ic { width: 17px; height: 17px; }
@media (max-width: 640px) {
    .ask-float { right: 16px; bottom: 16px; padding: 10px 18px; font-size: 0.9rem; }
}

/* ---------- 会员系统 / 管理控制台 ---------- */
.inline-form { display: inline-flex; align-items: center; gap: 6px; }
.inline-form .btn-link { font-size: 0.9rem; }
.nav-user { font-size: 0.9rem; }

/* 门卡：引导登录 / 购买（主色浅底 + 虚线） */
.gate-card {
    margin: 16px 0;
    padding: 22px 24px;
    border: 1px dashed #dcae8b;
    border-radius: var(--radius-l);
    background: var(--primary-soft);
    text-align: center;
}
.gate-card h3 { margin: 0 0 6px 0; }
.gate-card .btn { margin-top: 6px; }

/* 账户页：余额卡 */
.balance-card {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 18px 22px;
    background: linear-gradient(135deg, #faf6ee, var(--primary-soft));
    border: 1px solid #ecd9c8;
    border-radius: var(--radius-l);
}
.balance-num {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

/* 套餐卡片：hover 上浮（全站唯一允许位移的卡片） */
.packages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-top: 8px;
}
.package {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 20px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-l);
    background: #fff;
    text-align: center;
    transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease),
                border-color 0.15s var(--ease);
}
.package:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-2);
    border-color: #d9b599;
}
.package h3 { margin: 0; font-size: 1.05rem; }
.package-qty { color: var(--muted); }
.package-price {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.package .btn { align-self: center; }

/* 支付弹层：居中白卡 */
.pay-box {
    margin: 16px 0;
    padding: 24px;
    border: 1px solid #e8d9c4;
    border-radius: var(--radius-l);
    background: #fff;
    box-shadow: var(--shadow-2);
    text-align: center;
}
.pay-box.hidden { display: none; }
.pay-qr { margin: 12px auto; }
.pay-qr svg { width: 220px; height: 220px; }
.pay-box .btn, .pay-box .btn-link { margin-top: 6px; }

/* 管理控制台：统计卡 */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 8px;
}
.stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}
.stat strong {
    font-size: 1.4rem;
    font-variant-numeric: tabular-nums;
}
.user-balance { font-variant-numeric: tabular-nums; font-weight: 600; }

.table-scroll { overflow-x: auto; }
.adj-input { width: 90px; padding: 5px 8px; font-size: 0.9rem; }
.adj-btn { padding: 5px 10px; font-size: 0.85rem; }

/* 管理控制台（独立于用户前台）：独立登录页（深墨例外区） */
.admin-login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(800px 400px at 85% 0%, rgba(217, 119, 6, 0.14), transparent 60%),
        linear-gradient(160deg, #171310, #241d14);
}
.admin-login-card {
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-l);
    padding: 36px 32px;
    width: min(400px, 92vw);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.admin-login-card h1 { margin-bottom: 4px; }
.admin-login-card .flashes { margin: 12px 0 0 0; }

/* ---------- 表单字段提示 / 实时校验（注册 / 绑定邮箱 / 找回向导共用） ---------- */
.field-msg {
    display: block;
    min-height: 1.3em;
    margin: 2px 0 0;
    font-size: 0.83rem;
    line-height: 1.5;
}
.field-msg.ok-msg   { color: var(--ok); font-weight: 500; }
.field-msg.err-msg  { color: var(--danger); font-weight: 500; }
.field-msg.warn-msg { color: var(--warn); font-weight: 500; }
.field-msg.checking {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-weight: 400;
}
.field-msg.checking::before {
    content: "";
    flex: none;
    width: 12px;
    height: 12px;
    border: 2px solid #d6cec0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ---------- 登录 / 注册 / 翻译：居中窄卡 ---------- */
.auth-wrap {
    max-width: 460px;
    margin: 24px auto 0;
}
.auth-wrap section { padding: 32px 30px; }
.auth-wrap h1 { font-size: 1.5rem; }

/* ---------- 账户页：账号信息卡 / 邮箱绑定 ---------- */
.profile-card { padding: 0; }
.profile-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 13px 28px;
}
.profile-row + .profile-row { border-top: 1px solid var(--border); }
.profile-label {
    flex: none;
    width: 96px;
    color: var(--muted);
    font-size: 0.9rem;
}
.profile-value {
    flex: 1;
    min-width: 0;
    word-break: break-word;
}
.divider {
    height: 1px;
    margin: 2px 0;
    background: var(--border);
}
.email-bound {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-weight: 500;
}
.email-col .field-msg { margin: 6px 0 8px; }
.icon-ok {
    width: 18px;
    height: 18px;
    flex: none;
    fill: var(--ok);
}
.icon-ok.big {
    width: 46px;
    height: 46px;
    display: block;
    margin: 0 auto;
}

.bind-box {
    max-width: 520px;
    margin-top: 8px;
    padding: 16px 18px 12px;
    border: 1px dashed #dcae8b;
    border-radius: var(--radius-l);
    background: #faf7f0;
}
.bind-box.hidden { display: none; }
.bind-title { font-weight: 600; font-size: 1rem; }
.bind-sub { margin: 2px 0 14px; }
.bind-box .field { margin-bottom: 10px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.code-row { display: flex; align-items: center; gap: 10px; }
.code-row input {
    flex: 1;
    letter-spacing: 3px;
    font-variant-numeric: tabular-nums;
}

/* ---------- 找回账号向导（forgot.html） ---------- */
.forgot-progress {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin: 2px 0 22px;
}
.prog-dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border);
    background: #fff;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
    transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.prog-dot.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.prog-text {
    font-size: 0.86rem;
    color: var(--muted);
    margin-right: 10px;
}
.prog-line {
    flex: 1;
    min-width: 18px;
    max-width: 56px;
    height: 2px;
    border-radius: 1px;
    background: var(--border);
}

.forgot-step { max-width: 560px; }
.username-found {
    text-align: center;
    padding: 18px 14px;
    margin-bottom: 16px;
    border: 1px solid #ecd9c8;
    border-radius: var(--radius-l);
    background: var(--primary-soft);
}
.found-username {
    margin: 6px 0;
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--primary);
    word-break: break-all;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
}
.found-hint { font-size: 0.82rem; margin-top: 2px; }
.reset-done {
    max-width: 480px;
    margin: 0 auto;
    text-align: center;
    padding: 26px 16px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.reset-done p { margin: 0; }
.reset-done .btn { margin-top: 4px; }

/* ================= 上传中文规则（用户端 + 管理审核） ================= */
/* 游戏候选列表 */
.cand-list {
    border: 1px solid var(--border);
    border-radius: var(--radius-l);
    background: var(--card);
    overflow: hidden;
    margin-top: 10px;
}
.cand-item {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 14px;
    border-bottom: 1px solid var(--hairline);
    cursor: pointer;
    line-height: 1.4;
    transition: background 0.15s var(--ease);
}
.cand-item:last-child { border-bottom: none; }
.cand-item:hover { background: #f7f3ea; }
.cand-item.selected {
    background: var(--primary-soft);
    box-shadow: inset 3px 0 0 var(--primary);
}
.cand-item.disabled {
    cursor: not-allowed;
    opacity: 0.55;
    background: #f7f5ef;
}
.cand-item.disabled:hover { background: #f7f5ef; }
.cand-name { font-weight: 600; }
.cand-empty {
    padding: 14px;
    color: var(--muted);
    font-size: 0.9rem;
}

/* 文件选择面板与提示 */
.file-panel {
    border: 1px dashed #dcae8b;
    border-radius: var(--radius-l);
    padding: 14px 16px;
    margin-top: 8px;
    background: var(--card);
}
.upload-note {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.82rem;
    max-width: 420px;
}

/* 缩略图预览（用户端 + 管理后台共用） */
.thumb-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    max-width: 280px;
}
.thumb-row a { display: flex; }
.thumb-row img {
    width: 58px;
    height: 58px;
    object-fit: contain;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    background: #fff;
    padding: 2px;
}
a.thumb {
    display: inline-block;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    background: var(--card);
    color: var(--primary);
    font-size: 0.85rem;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
a.thumb:hover { border-color: #d9a07f; background: var(--primary-soft); }

table td .inline-form { flex-wrap: wrap; }

/* ================= 规则反馈（用户端弹窗 + 管理端审核） ================= */
/* 入口：规则页页尾反馈条（.rule-feedback）+ 阅读器工具栏 */
.reader-head #reader-feedback { margin-left: auto; color: rgba(246, 240, 228, 0.92); }
.reader-head #reader-download,
.reader-head #reader-close { margin-left: 16px; }

/* 弹窗（层级高于全屏阅读器 z-index:2000） */
.fb-mask {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(27, 23, 18, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: auto;
}
.fb-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-2);
    width: 100%;
    max-width: 560px;
    padding: 24px;
    text-align: left;
}
.fb-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.fb-head strong { font-size: 1.1rem; color: var(--text); }
.fb-target { font-size: 0.85rem; margin: 4px 0 14px; }
.fb-field { margin-bottom: 12px; }
.fb-field > label {
    display: block;
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 6px;
}
.fb-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.fb-card input[type="text"],
.fb-card textarea { width: 100%; }
.fb-card textarea { resize: vertical; min-height: 88px; line-height: 1.6; }
.fb-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
}
.fb-msg { flex: 1; font-size: 0.85rem; color: var(--muted); }
.fb-msg.ok { color: var(--ok); font-weight: 500; }
.fb-msg.err { color: var(--danger); font-weight: 500; }
.fb-tip { font-size: 0.78rem; margin: 10px 0 0; }
.fb-login-title { font-weight: 600; font-size: 0.95rem; margin: 2px 0 6px; }
#fb-login-required .fb-actions { margin-top: 20px; }

/* 管理端：反馈内容与差异预览 */
.feedback-table-wrap { margin-top: 14px; }
.feedback-table {
    display: block;
    min-width: 0;
}
.feedback-table thead { display: none; }
.feedback-table tbody {
    display: grid;
    gap: 14px;
}
.feedback-table tr {
    display: grid;
    grid-template-columns: minmax(190px, 1.05fr) minmax(250px, 1.2fr) minmax(300px, 1.45fr);
    align-items: stretch;
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    background: var(--card);
    box-shadow: 0 2px 8px rgba(48, 38, 26, 0.04);
    overflow: hidden;
}
.feedback-table td {
    display: block;
    width: auto !important;
    min-width: 0;
    padding: 16px;
    vertical-align: top;
    border-right: 1px solid var(--border);
}
.feedback-table td:nth-child(3) {
    grid-column: 3;
    grid-row: 1 / span 2;
    border-right: 0;
}
.feedback-table td:nth-child(4) {
    grid-column: 1;
    grid-row: 2;
}
.feedback-table td:nth-child(5) {
    grid-column: 2;
    grid-row: 2;
    border-right: 0;
}
.feedback-table td:nth-child(1) { grid-column: 1; grid-row: 1; }
.feedback-table td:nth-child(2) { grid-column: 2; grid-row: 1; }
.feedback-table .fb-cell { max-width: none; }
.fb-row-title {
    display: flex;
    align-items: baseline;
    gap: 8px;
    line-height: 1.4;
}
.fb-id {
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}
.fb-meta-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 7px;
    color: var(--muted);
    font-size: 0.8rem;
}
.fb-subline {
    margin-top: 5px;
    font-size: 0.78rem;
    line-height: 1.45;
}
.fb-verdict {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}
.fb-verdict-reason {
    margin-top: 7px;
    line-height: 1.5;
}
.fb-suggestion-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 8px;
}
.fb-suggestion-summary {
    font-weight: 600;
    line-height: 1.55;
}
.fb-model-note {
    margin-top: 9px;
    padding: 8px 10px;
    border-left: 3px solid var(--primary);
    background: var(--primary-soft);
    color: var(--text);
    font-size: 0.82rem;
    line-height: 1.5;
    word-break: break-word;
}
.fb-detail-box { margin-top: 10px; }
.fb-status-cell { line-height: 1.5; }
.fb-actions-cell { line-height: 1.4; }
.fb-content { white-space: pre-wrap; word-break: break-word; }
.fb-quote { margin-top: 4px; word-break: break-word; }
.fb-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}
.fb-diff {
    margin: 6px 0 0;
    padding: 8px 10px;
    background: #f7f4ed;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.78rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 260px;
    overflow: auto;
    color: var(--text);
}
.fb-cell summary { cursor: pointer; }
.fb-action-stack {
    min-width: 240px;
    max-width: 340px;
}
.fb-action-stack .fb-ops {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
}
.fb-action-stack .fb-ops .btn { width: 100%; }
.fb-action-stack .fb-ops .fb-scope { grid-column: 1 / -1; width: 100%; }
.fb-op-hint {
    margin-top: 7px;
    font-size: 0.74rem;
    line-height: 1.45;
}
.fb-editor-card { max-width: 680px; }
.fb-editor-desc { margin: 6px 0 14px; }
.fb-editor-card textarea { min-height: 180px; }
.fb-html-card {
    width: 100%;
    max-width: none;
    height: calc(100vh - 40px);
    height: calc(100dvh - 40px);
    display: flex;
    flex-direction: column;
    padding: 18px 22px;
}
.fb-mask-fullscreen {
    padding: 20px;
    background: rgba(27, 23, 18, 0.72);
}
.fb-mask-fullscreen .fb-html-card {
    max-width: none;
    border-radius: var(--radius-m);
}
.fb-mask-fullscreen .fb-head,
.fb-mask-fullscreen .fb-html-toolbar,
.fb-mask-fullscreen .fb-msg,
.fb-mask-fullscreen .fb-tip,
.fb-mask-fullscreen .fb-actions {
    flex: 0 0 auto;
}
.fb-mask-fullscreen .fb-html-source {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    height: auto;
}
.fb-html-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.fb-html-toolbar label {
    color: var(--muted);
    font-size: 0.85rem;
}
.fb-find-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    background: #f7f4ed;
}
.fb-find-bar label {
    color: var(--muted);
    font-size: 0.82rem;
    white-space: nowrap;
}
.fb-find-bar input {
    flex: 1;
    min-width: 120px;
    padding: 7px 9px;
}
.fb-find-bar .btn {
    padding: 6px 9px;
    white-space: nowrap;
}
.fb-find-bar .btn-link {
    white-space: nowrap;
}
.fb-find-bar .muted {
    min-width: 48px;
    text-align: center;
    font-size: 0.78rem;
    white-space: nowrap;
}
.fb-html-source {
    min-height: 58vh;
    max-height: 70vh;
    overflow: auto;
    white-space: pre;
    tab-size: 2;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.78rem;
    line-height: 1.5;
}
.fb-ops { align-items: center; }
.fb-ops .fb-scope {
    padding: 5px 8px;
    font-size: 0.85rem;
    border-radius: var(--radius-m);
    border: 1px solid var(--border-strong);
    background: #fff;
    color: var(--text);
}

@media (max-width: 900px) {
    .feedback-table-wrap { overflow: visible; }
    .feedback-table {
        display: block;
        min-width: 0;
    }
    .feedback-table thead { display: none; }
    .feedback-table tbody { display: grid; gap: 12px; }
    .feedback-table tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        border: 1px solid var(--border);
        border-radius: var(--radius-m);
        background: var(--card);
        overflow: hidden;
    }
    .feedback-table td {
        display: block;
        width: auto !important;
        padding: 14px 16px;
        border-bottom: 1px solid var(--border);
    }
    .feedback-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 7px;
        color: var(--muted);
        font-size: 0.72rem;
        font-weight: 700;
        letter-spacing: 0.04em;
    }
    .feedback-table td:nth-child(1),
    .feedback-table td:nth-child(3),
    .feedback-table td:nth-child(4),
    .feedback-table td:nth-child(5) { grid-column: 1 / -1; grid-row: auto; }
    .feedback-table td:nth-child(2) { grid-column: 1 / -1; grid-row: auto; }
    .feedback-table td:nth-child(3) {
        border-top: 1px solid var(--border);
        border-right: 0;
    }
    .feedback-table td:nth-child(4),
    .feedback-table td:nth-child(5) { border-top: 1px solid var(--border); }
    .feedback-table td:last-child { border-bottom: 0; }
    .feedback-table .fb-cell { max-width: none; }
    .fb-action-stack { max-width: none; }
}

@media (max-width: 640px) {
    .fb-card { padding: 20px; }
    .fb-actions { flex-wrap: wrap; }
    .fb-msg { flex-basis: 100%; }
    .feedback-table tr { display: block; }
    .feedback-table td {
        width: auto !important;
        border-right: 0 !important;
    }
    .feedback-table td:nth-child(1),
    .feedback-table td:nth-child(2),
    .feedback-table td:nth-child(3),
    .feedback-table td:nth-child(4),
    .feedback-table td:nth-child(5) { grid-column: auto; grid-row: auto; }
    .feedback-table td:not(:first-child) { border-top: 1px solid var(--border); }
    .fb-action-stack { min-width: 210px; }
    .fb-html-toolbar { align-items: stretch; flex-wrap: wrap; }
    .fb-html-toolbar select { flex: 1; }
    .fb-find-bar { flex-wrap: wrap; }
    .fb-find-bar input { flex-basis: 100%; order: -1; }
    .fb-html-source { min-height: 50vh; font-size: 0.74rem; }
    .fb-mask-fullscreen { padding: 0; }
    .fb-mask-fullscreen .fb-html-card {
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
        padding: 14px;
    }
    .profile-row { padding: 13px 20px; }
}

/* ================= AI 问答侧栏（_ask_panel.html，详见 DESIGN.md §4.13） =================
   入口：规则页 CTA / 右下角悬浮按钮 / 阅读器工具栏「问 AI」（统一 data-ask-open，只开不关）+
   左缘拉签（.ask-tab，面板子元素，data-ask-toggle 开合双向）。
   右侧滑入；阅读器在场时其内容区同步左移让位（#reader.ask-open），边看规则边问。 */
:root {
    --askp-w: min(400px, 92vw);
    --askp-tab: 44px;        /* 拉签完整宽（关态挂签凸出量） */
    --askp-tab-slim: 22px;   /* 拉签细把手宽（开态凸出量＝阅读器让位槽宽） */
}

.ask-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 2100; /* 高于全屏阅读器(2000)，低于反馈弹窗(3000) */
    width: var(--askp-w);
    display: flex;
    flex-direction: column;
    background: var(--card);
    border-left: 1px solid var(--border);
    border-radius: var(--radius-l) 0 0 var(--radius-l);
    box-shadow: -18px 0 48px -12px rgba(48, 38, 26, 0.28);
    /* 滑入动画：transform + visibility（关闭时移出视口且不可聚焦/命中）。
       位移取 100% 而非 105%：面板本体恰好出屏，左缘拉签（凸出 --askp-tab）恰好齐平视口右缘 */
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.28s var(--ease), visibility 0.28s;
}
.ask-panel.open { transform: translateX(0); visibility: visible; }

/* 头部：深墨底 + 品牌渐变 logo（与阅读器工具栏同一基调） */
.askp-head {
    flex: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 14px;
    background: linear-gradient(135deg, var(--ink-900), var(--ink-800));
    color: var(--cream);
    border-radius: var(--radius-l) 0 0 0;
}
.askp-logo {
    flex: none;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    border-radius: 10px;
    background: var(--gradient-brand);
    box-shadow: var(--shadow-primary), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.askp-logo .ic { width: 18px; height: 18px; }
.askp-title {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.4;
}
.askp-title strong { font-size: 0.95rem; letter-spacing: 0.01em; }
.askp-game {
    font-size: 0.78rem;
    color: var(--cream-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* 深墨底上的余额徽章：半透明奶油描边胶囊 */
.askp-balance {
    flex: none;
    background: rgba(246, 240, 228, 0.12);
    border: 1px solid rgba(246, 240, 228, 0.22);
    color: var(--cream);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.askp-close {
    flex: none;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: var(--cream-muted);
    background: transparent;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.askp-close:hover { color: #fff; background: rgba(246, 240, 228, 0.14); }
.askp-close .ic { width: 15px; height: 15px; }

/* 消息流：暖纸底 + 复用问答页气泡体系（窄面板内略收紧） */
.askp-stream {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px 14px 10px;
    background: var(--bg);
}
.askp-stream .chat-bubble {
    font-size: 0.92rem;
    padding: 10px 13px;
    max-width: 92%;
}
.askp-stream .chat-bubble.q { max-width: 85%; }
.askp-stream .chat-meta { font-size: 0.72rem; }
/* 出错提示：红字气泡（不改气泡结构，仅字色） */
.chat-bubble.askp-err { color: var(--danger); }

/* 空态：居中引导 + 建议问题（点击填入输入框，不直接发送） */
.askp-empty {
    margin: auto;
    max-width: 300px;
    text-align: center;
    padding: 24px 10px;
}
.askp-empty-title { margin: 0 0 4px; font-weight: 600; font-size: 1.02rem; }
.askp-empty-sub {
    margin: 0 0 16px;
    font-size: 0.84rem;
    color: var(--muted);
    line-height: 1.65;
}
.askp-suggest { display: flex; flex-direction: column; gap: 8px; }
.askp-suggest button {
    padding: 9px 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.88rem;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.askp-suggest button:hover {
    border-color: #d9b599;
    color: var(--primary);
    background: var(--primary-soft);
}

/* 状态引导：未登录 / 次数不足（虚线门卡，与问答页 gate-card 同语言） */
.askp-gate {
    flex: none;
    margin: 10px 14px 14px;
    padding: 18px 16px;
    text-align: center;
    border: 1px dashed #dcae8b;
    border-radius: var(--radius-l);
    background: var(--primary-soft);
}
.askp-gate-title { margin: 0 0 4px; font-weight: 600; }
.askp-gate-sub {
    margin: 0 0 10px;
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.6;
}

/* 输入区：吸底白卡，与问答页 ask-box 同构 */
.askp-form {
    flex: none;
    padding: 10px 12px 12px;
    background: var(--card);
    border-top: 1px solid var(--border);
    border-radius: 0 0 0 var(--radius-l);
}
.askp-input-row { display: flex; gap: 8px; align-items: flex-end; }
.askp-input-row textarea {
    flex: 1;
    resize: none;
    border: 0;
    background: transparent;
    padding: 8px 2px;
    font-size: 0.92rem;
    line-height: 1.55;
    min-height: 58px;
    max-height: 132px;
}
.askp-input-row textarea:focus { outline: none; box-shadow: none; }
#askp-send { flex: none; height: 38px; padding: 0 16px; }
#askp-stop { flex: none; height: 38px; padding: 0 16px; }
.askp-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--muted);
}
.askp-meta select {
    width: auto;
    padding: 2px 8px;
    font-size: 0.78rem;
    border-radius: 999px;
}
.askp-meta-note { line-height: 1.5; }

/* 阅读器工具栏「问 AI」按钮：琥珀胶囊（--gold 仅用于深墨底的约定），
   在场时承担 margin-left:auto 推右职责，查找栏 / 反馈按钮退让为常规间距 */
.reader-ask {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 13px;
    color: #f2b45c;
    background: rgba(217, 119, 6, 0.16);
    border: 1px solid rgba(217, 119, 6, 0.45);
    border-radius: 999px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.reader-ask:hover {
    background: rgba(217, 119, 6, 0.3);
    border-color: rgba(217, 119, 6, 0.65);
    color: #ffd28f;
}
.reader-ask .ic { width: 15px; height: 15px; }
#reader-ask:not(.hidden) ~ #reader-find { margin-left: 0; }
#reader-ask:not(.hidden) ~ #reader-feedback { margin-left: 16px; }

/* 侧栏在场时：阅读器内容 / 翻页箭头 / 工具栏同步左移让位，再多让一条拉签凹槽
   （--askp-tab-slim）——开态细把手正好落在槽里，不压正文（面板悬浮其上，
   不关面板也能操作工具栏右侧的下载 / 反馈 / 关闭） */
#reader .reader-body { transition: padding-right 0.28s var(--ease); }
#reader .reader-head { transition: right 0.28s var(--ease); }
#reader .reader-nav { transition: right 0.28s var(--ease); }
#reader.ask-open .reader-body { padding-right: calc(var(--askp-w) + var(--askp-tab-slim)); }
#reader.ask-open .reader-head { right: calc(var(--askp-w) + var(--askp-tab-slim)); }
#reader.ask-open .reader-nav { right: calc(var(--askp-w) + var(--askp-tab-slim)); }

/* 窄屏：侧栏全屏覆盖（无圆角），阅读器不让位；操作提示让位给「问 AI」按钮。
   宽度改用 left/right 双锚点铺满（width:auto）：经典滚动条占宽时，100vw 与 100%
   （初始包含块）都比可视区宽约一条滚动条，会把左缘拉签推出视口
   （开态把手悬空、关态挂签离缝）；双锚点精确贴合可视区，无此歧义 */
@media (max-width: 720px) {
    .ask-panel {
        left: 0;
        right: 0;
        width: auto;
        border-left: 0;
        border-radius: 0;
    }
    .askp-head { border-radius: 0; }
    .askp-form { border-radius: 0; }
    #reader.ask-open .reader-body { padding-right: 0; }
    #reader.ask-open .reader-head { right: 0; }
    #reader.ask-open .reader-nav { right: 0; }
    .reader-tip { display: none; }
}

/* ================= 「问 AI」拉签（.ask-tab，#ask-panel 左缘子元素） =================
   隐喻：精装手册书口的索引绸签。关：贴视口右缘的完整挂签（气泡星芒图标 + 竖排「问 AI」），
   品牌渐变底在浅色规则页与深墨阅读器上皆可读；开：随面板滑入，收窄为凸在面板左缘的
   细把手（»，hover 展开「收起」），再按一下整个收回——开合都走 data-ask-toggle。
   遮挡对策：开态仅凸出 --askp-tab-slim（22px）；阅读器在场时正文 / 工具栏 / 翻页箭头
   多让位同宽（见上方 #reader.ask-open 规则），把手恰好落在让位槽里，零遮挡；
   规则页为浮层不开槽，22px 压在面板投影边缘，可忽略。
   实现要点：面板子元素随其 transform 同进同退（关态面板 translateX(100%) 恰把挂签
   推到视口右缘）；visibility 单独覆写，面板关态挂签仍露出可点。层级继承面板（2100）。
   阅读器协同（_reader.html syncAskTab 维护）：in-reader 下移让位翻页圆钮；
   reader-immersive 随工具栏一并隐藏。 */

.ask-tab {
    position: absolute;
    top: 50%;
    left: calc(0px - var(--askp-tab));
    transform: translateY(-50%);
    z-index: 2;
    width: var(--askp-tab);
    min-height: 122px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: var(--radius-m) 0 0 var(--radius-m);
    background: var(--gradient-brand);
    color: var(--cream);
    font-family: inherit;
    cursor: pointer;
    visibility: visible; /* 覆写面板关态的 visibility:hidden：挂签仍露出视口右缘 */
    box-shadow: -12px 0 28px -12px rgba(48, 38, 26, 0.5),
                inset 2px 0 0 rgba(255, 255, 255, 0.22),
                inset 0 1px 0 rgba(255, 255, 255, 0.18);
    transition: left 0.28s var(--ease), width 0.28s var(--ease),
                top 0.28s var(--ease), min-height 0.28s var(--ease),
                border-radius 0.28s var(--ease), box-shadow 0.2s var(--ease),
                filter 0.15s var(--ease), transform 0.18s var(--ease),
                opacity 0.2s var(--ease);
}
.ask-tab:hover { filter: brightness(1.07); }
.ask-tab:active { filter: brightness(0.96); }
.ask-tab:focus-visible { outline-color: rgba(246, 240, 228, 0.9); }

/* 关态悬停：向内容方向轻轻一拉，暗示「拉出侧栏」 */
@media (hover: hover) {
    .ask-panel:not(.open) .ask-tab:hover { transform: translateY(-50%) translateX(-3px); }
}

/* ---- 开态：收窄为面板左缘细把手（凸出量 = 阅读器让位槽宽） ---- */
.ask-panel.open .ask-tab {
    left: calc(0px - var(--askp-tab-slim));
    width: var(--askp-tab-slim);
    min-height: 96px;
    border-radius: var(--radius-s) 0 0 var(--radius-s);
    box-shadow: -8px 0 20px -10px rgba(48, 38, 26, 0.45),
                inset 2px 0 0 rgba(255, 255, 255, 0.22);
}
/* 悬停 / 键盘聚焦：展开成宽把手，露出「收起」文案（触屏无 hover，细条保持可点即可） */
@media (hover: hover) and (min-width: 721px) {
    .ask-panel.open .ask-tab:hover,
    .ask-panel.open .ask-tab:focus-visible {
        left: calc(0px - var(--askp-tab) - 14px);
        width: calc(var(--askp-tab) + 14px);
    }
}

/* ---- 内容双层：关态「问 AI」挂签面 ⇄ 开态「»收起」把手面（透明度交叉切换；
        关态面留在文档流里撑住拉签高度，开态面绝对定位居中） ---- */
.ask-tab-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    transition: opacity 0.18s var(--ease);
}
.ask-tab-ic { width: 20px; height: 20px; }
.ask-tab-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.1;
    font-weight: 650;
}
.ask-tab-zh { font-size: 1.04rem; }
.ask-tab-ai {
    margin-top: 3px;
    font-family: var(--font-display);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    padding-left: 0.16em;
    color: rgba(255, 240, 214, 0.95);
}
.ask-tab-fold {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    opacity: 0;
    transition: opacity 0.18s var(--ease);
}
.ask-tab-fold .ic { width: 15px; height: 15px; }
.ask-tab-fold-text {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    padding-left: 0.18em;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(-3px);
    transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
}
.ask-panel.open .ask-tab-cta { opacity: 0; }
.ask-panel.open .ask-tab-fold { opacity: 1; }
@media (hover: hover) and (min-width: 721px) {
    .ask-panel.open .ask-tab:hover .ask-tab-fold-text,
    .ask-panel.open .ask-tab:focus-visible .ask-tab-fold-text {
        opacity: 1;
        transform: none;
    }
}

/* ---- 阅读器协同（类由 _reader.html syncAskTab 维护） ---- */
/* 阅读器在场：拉签下移，让位垂直居中的右侧翻页圆钮（44px @ 50%） */
.ask-panel.in-reader .ask-tab { top: calc(50% + 58px); }
/* 沉浸模式：拉签随工具栏一并隐去（面板若开着，头部 × 与 Esc 仍可收起） */
.ask-panel.reader-immersive .ask-tab { opacity: 0; pointer-events: none; }

/* ---- 响应式 ---- */
@media (max-width: 640px) {
    :root { --askp-tab: 38px; }
    .ask-tab { min-height: 108px; }
    .ask-tab-ic { width: 18px; height: 18px; }
}
/* 窄屏面板全屏覆盖：开态凸出会跑到视口外，把手翻进面板内缘，收窄为 26px 细条；
   消息流左侧预留让位内边距（26px 把手 + 8px 间隙），空态建议按钮 / 聊天气泡不压把手下 */
@media (max-width: 720px) {
    .ask-panel.open .ask-tab {
        left: 0;
        width: 26px;
        border-radius: 0 var(--radius-s) var(--radius-s) 0;
        box-shadow: 8px 0 20px -10px rgba(48, 38, 26, 0.4),
                    inset -2px 0 0 rgba(255, 255, 255, 0.22);
    }
    /* 触屏无 hover：「收起」常显；把手面为纵向布局，文案竖排（与关态竖排「问 AI」呼应） */
    .ask-panel.open .ask-tab-fold-text {
        writing-mode: vertical-rl;
        letter-spacing: 0.22em;
        padding-left: 0;
        opacity: 1;
        transform: none;
    }
    .askp-stream { padding-left: 34px; }
    /* 全屏面板盖住阅读器，开态把手无需再让位翻页圆钮，回到垂直居中 */
    .ask-panel.in-reader.open .ask-tab { top: 50%; }
}
