/* ================================================================
   《星都异闻录 · 神秘学协会》—— 移动端适配层
   ----------------------------------------------------------------
   加载在 style.css 之后，只在 ≤820px 生效；
   ≥821px 的桌面 / 平板横屏布局与原始版本完全一致。
   设计原则：
     1. 三栏工作台 → 单栏 + 底部标签栏（一次只看一件事）
     2. 信息检索框吸顶常驻「档案」页，读文本时不必来回切页
     3. 正文字号 / 行高按手机阅读重新标定，触控热区 ≥44px
     4. 刘海屏安全区、软键盘、下拉刷新、双击缩放全部处理
   ================================================================ */

/* ---------- 桌面端隐藏的移动端零件 ---------- */
#mobile-nav { display: none; }
#m-search-dock { display: none; }
#m-clue-chip { display: none; }
.dev-mb { display: none; }

@media (max-width: 820px) {

  /* ============================================================
     0. 基础：字体栈 / 排版 / 触摸行为
     ============================================================ */
  :root {
    /* 原版用 SimHei（Windows 专有），iOS / Android 会掉字重，
       这里换成各平台自带的中文黑体，避免字体缺失导致的字重跳变 */
    --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
                 "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC",
                 "Noto Sans CJK SC", "Heiti SC", sans-serif;
    --font-serif: var(--font-sans);
    --font-mono: var(--font-sans);
    /* 原版 style.css 里 .q-choice-btn / .tu-tip 引用了未定义的 --gold，导致选中态几乎看不出来 */
    --gold: #b08c2a;
    --gold-soft: rgba(212, 175, 55, .16);
    --m-nav-h: 58px;
    --m-safe-b: env(safe-area-inset-bottom, 0px);
    --m-safe-t: env(safe-area-inset-top, 0px);
    --m-safe-l: env(safe-area-inset-left, 0px);
    --m-safe-r: env(safe-area-inset-right, 0px);
  }

  html, body { height: 100%; }
  body {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    touch-action: manipulation;              /* 去除双击缩放与 300ms 点击延迟 */
    -webkit-tap-highlight-color: transparent;/* 去掉安卓点击时的蓝框 */
    overscroll-behavior: none;               /* 禁止滚动链 / 下拉刷新打断游戏 */
  }

  /* 所有可点元素统一取消双击缩放，并给出按下反馈 */
  .btn, .case-item, .class-opt, .wr-choice, .q-choice-btn, .diff-btn,
  .tx-search .btn, .wr-skip, .tu-skip, .toast .t-close, .intro-rec,
  .ending-survey, #mobile-nav button {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  /* ============================================================
     1. 通用控件
     ============================================================ */
  .btn {
    min-height: 44px;
    padding: 10px 18px;
    font-size: 15px;
    border-radius: 8px;
  }
  .btn-lg {
    width: 100%;
    min-height: 50px;
    padding: 13px 20px;
    font-size: 16px;
  }
  .btn:active { transform: translateY(1px) scale(.99); }

  /* ============================================================
     2. 全屏层（入职 / 问卷 / 教程 / 白房间 / 结局）
        原版 .fullscreen-layer 不滚动，手机上长内容会被裁掉
     ============================================================ */
  .fullscreen-layer {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    align-items: flex-start;                 /* 内容超出时从顶部开始，可滚动 */
    padding: var(--m-safe-t) 0 var(--m-safe-b);
  }
  /* margin:auto 让内容够高时垂直居中、超高时自动贴顶不留白 */
  .intro-card, .ending-inner, .afterword-inner { margin: auto; }
  /* 内容不满屏时也撑满一屏，避免上下露出黑边（手机上像"缺了一块"） */
  .intro-card, .ending-inner, .afterword-inner, .tu-card {
    min-height: calc(100vh - var(--m-safe-t) - var(--m-safe-b));
    min-height: calc(100dvh - var(--m-safe-t) - var(--m-safe-b));
  }

  /* —— 入职画面 —— */
  .intro-card {
    width: 100%;
    max-width: none;
    border-radius: 0;
    border-left: none;
    border-right: none;
    padding: 26px 20px 30px;
  }
  .intro-card::before { display: none; }     /* 手机上去掉内层虚线框，减少视觉噪音 */
  .intro-card h2 { font-size: 30px; letter-spacing: 6px; margin-bottom: 8px; }
  .intro-tag { font-size: 11.5px; letter-spacing: 2px; padding: 5px 14px; margin-bottom: 14px; }
  .intro-meta { font-size: 12.5px; margin-bottom: 18px; }
  .intro-body { font-size: 15.5px; line-height: 1.95; margin-bottom: 20px; }
  .intro-body p { margin-bottom: 12px; }
  .intro-quote { font-size: 15px; line-height: 1.9; padding: 12px 14px; margin: 12px 0; }
  .intro-device { font-size: 12.5px; padding: 10px 12px; margin-bottom: 16px; }
  .dev-pc { display: none; }
  .dev-mb { display: inline; }
  .intro-rec { font-size: 14px; padding: 12px 14px; margin-bottom: 16px; }
  .diff-row { flex-direction: column; gap: 10px; margin-bottom: 10px; }
  .diff-btn {
    width: 100%;
    max-width: none;
    min-height: 64px;
    padding: 15px 18px;
  }
  .diff-btn .diff-t { font-size: 16px; }
  .diff-btn .diff-d { font-size: 12.5px; }
  /* 简单难度用的是 btn-primary（红底），原来的深棕副标题几乎看不见 */
  .diff-btn.btn-primary .diff-t { color: #fdf6e8; }
  .diff-btn.btn-primary .diff-d { color: rgba(255, 246, 232, .78); }
  .diff-note { font-size: 12px; line-height: 1.6; }

  /* —— 入职问卷 —— */
  .q-container { margin: 14px 0 0; }
  .q-item {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 13px 14px;
    margin-bottom: 9px;
  }
  .q-label { font-size: 15px; }
  .q-answer { font-size: 15px; }
  .q-choices { gap: 8px; }
  .q-choice-btn {
    flex: 1 1 30%;
    min-height: 46px;
    padding: 10px 6px;
    font-size: 15px;
  }
  .q-choice-btn:active { transform: scale(.97); }
  .q-error { font-size: 13.5px; margin-top: 12px; }

  /* —— 新人教程 —— */
  .tu-card {
    width: 100%;
    max-width: none;
    padding: 26px 20px 24px;
    display: flex;
    flex-direction: column;
  }
  .tu-body {
    flex: 1 1 auto;                          /* 撑开剩余空间，把「下一步」推到拇指够得到的底部 */
    min-height: 0;
    font-size: 15.5px;
    line-height: 1.95;
    text-align: left;
  }
  .tu-body .tu-tip { font-size: 13.5px; padding: 11px 13px; line-height: 1.8; }
  .tu-list { padding-left: 20px; }
  .tu-list li { margin-bottom: 7px; }
  .tu-dots { margin: 16px 0 14px; }
  .tu-dot { width: 9px; height: 9px; }
  .tu-footer { gap: 10px; }
  .tu-footer .btn { min-height: 48px; }
  .tu-skip { font-size: 13.5px; padding: 10px 8px; }

  /* ============================================================
     3. 工作台：三栏 → 单栏 + 底部标签栏
     ============================================================ */
  #desk-screen {
    /* 手机浏览器地址栏会伸缩，100vh 会把底部标签栏顶到屏幕外，优先用 dvh */
    height: 100vh;
    height: 100dvh;
  }

  /* —— 顶栏 —— */
  #top-bar {
    height: auto;
    min-height: 50px;
    padding: calc(var(--m-safe-t) + 7px) calc(var(--m-safe-r) + 14px) 7px calc(var(--m-safe-l) + 14px);
    gap: 8px;
  }
  .tb-brand { gap: 7px; min-width: 0; }
  .tb-logo { font-size: 17px; }
  .tb-name {
    font-size: 13.5px;
    letter-spacing: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .tb-name-sub { display: none; }            /* 窄屏只留「神秘学协会」 */
  .tb-stats { gap: 10px; font-size: 11.5px; flex-shrink: 0; }
  .tb-employee { display: none; }            /* 「员工：温言」可省略，玩家就是温言 */
  .tb-stats b { font-size: 12.5px; }
  #bb-clock {
    font-size: 11px;
    color: var(--lamp);
    opacity: .8;
    white-space: nowrap;
    padding-left: 10px;
    border-left: 1px solid #4a3a26;
  }

  /* —— 面板容器 —— */
  #workbench {
    flex: 1;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
  }
  #case-list, #work-area, #tool-box {
    display: none;                           /* 默认全隐藏，由 .m-on 激活 */
    width: 100%;
    max-width: none;
    max-height: none;
    flex: 1 1 auto;
    min-height: 0;
    border: none;
    box-shadow: none;
  }
  #case-list.m-on { display: flex; }
  #work-area.m-on { display: block; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  #tool-box.m-on { display: flex; overflow-y: auto; -webkit-overflow-scrolling: touch; }

  /* 手机端隐藏细滚动条（触屏看不到，只会显得脏） */
  #work-area::-webkit-scrollbar,
  #tool-box::-webkit-scrollbar,
  #case-items::-webkit-scrollbar,
  .chat-log::-webkit-scrollbar { width: 0; height: 0; }

  /* —— 委托列表（整屏） —— */
  .cl-head {
    position: sticky;
    top: 0;
    z-index: 3;
    padding: 13px 16px;
    font-size: 13.5px;
    background: #241a11;
  }
  #case-items { padding: 10px; }
  .case-item {
    padding: 14px;
    margin-bottom: 9px;
    border-radius: 10px;
    min-height: 68px;
  }
  .case-item:active { transform: scale(.99); }
  .ci-num { font-size: 11.5px; letter-spacing: 1px; }
  .ci-title { font-size: 16.5px; line-height: 1.45; }
  .ci-meta { font-size: 12px; gap: 8px; }
  .case-item.done::after { top: 15px; right: 14px; font-size: 16px; }
  .case-item.locked::after { top: 14px; right: 13px; font-size: 14px; }
  /* title 属性在触屏上不可见，锁定原因直接写进卡片 */
  .case-item.locked .ci-meta::after { content: "· 完成上一份后解锁"; color: #b08070; }
  .cl-footer { padding: 12px 16px; font-size: 11.5px; }

  /* —— 档案（委托详情） —— */
  .case-detail { padding: 14px 16px 28px; max-width: none; }
  .cd-header { padding-bottom: 12px; margin-bottom: 18px; }
  .cd-num { font-size: 11.5px; letter-spacing: 1.5px; }
  .cd-title { font-size: 23px; letter-spacing: 2px; line-height: 1.35; }
  .cd-meta { font-size: 12.5px; gap: 10px; }
  .cd-section { margin-bottom: 20px; }
  .cd-sec-title { font-size: 16px; letter-spacing: 1px; padding-left: 9px; }
  .cd-text {
    font-size: 15.5px;
    line-height: 1.9;
    padding: 14px;
    text-align: left;                        /* 窄屏 justify 会出现字间距忽大忽小 */
  }
  .cd-text p { margin-bottom: 12px; }
  .cd-quote { font-size: 15px; line-height: 1.85; padding: 10px 12px; }
  .cd-hint { font-size: 12.5px; line-height: 1.7; padding: 10px 12px; }
  .cd-archived { font-size: 11.5px; }

  /* 线索卡 */
  .clue-list { gap: 9px; }
  .clue { font-size: 14.5px; line-height: 1.85; padding: 13px 14px; }
  .clue-source { font-size: 11px; }

  /* 分类器 */
  .classifier { margin-top: 20px; padding: 16px 14px 18px; border-radius: 12px; }
  .cl-title { font-size: 16px; }
  .cl-sub { font-size: 12.5px; line-height: 1.75; margin-bottom: 14px; }
  .class-opts { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .class-opt {
    min-height: 64px;
    padding: 13px 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .class-opt:nth-child(5) { grid-column: span 2; }   /* 5 个选项时最后一项占满整行，不留缺口 */
  .class-opt:active { transform: scale(.97); }
  .co-name { font-size: 15.5px; }
  .co-desc { font-size: 11.5px; }
  .classifier .btn-lg { margin-top: 4px; }

  /* —— 吸顶检索条：把右侧工具箱里的检索块搬到档案页顶部 —— */
  #m-search-dock {
    display: block;
    position: sticky;
    top: 0;
    z-index: 20;
    background: linear-gradient(180deg, #2a1f14, #241a11);
    border-bottom: 1px solid #0f0a06;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
    padding: 8px calc(var(--m-safe-r) + 12px) 8px calc(var(--m-safe-l) + 12px);
  }
  #m-search-dock.hidden { display: none; }
  #m-search-dock .tx-block {
    padding: 0;
    border: none;
  }
  #m-search-dock .tx-title,
  #m-search-dock .tx-hint { display: none; }  /* 手机上一行只放得下输入框 + 按钮 */
  #m-search-dock .tx-search { gap: 7px; }
  #m-search-dock .tx-search input {
    font-size: 16px;                          /* ≥16px：iOS 聚焦时不会自动放大页面 */
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 8px;
  }
  #m-search-dock .tx-search .btn {
    min-height: 44px;
    padding: 0 15px;
    font-size: 14.5px;
    letter-spacing: 1px;
  }
  #m-clue-chip { display: inline-flex; }
  .ms-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    align-self: center;
    min-width: 40px;
    height: 28px;
    padding: 0 7px;
    border-radius: 20px;
    border: 1px solid rgba(232, 185, 106, .35);
    background: rgba(232, 185, 106, .1);
    color: var(--lamp);
    font-size: 11px;
    letter-spacing: .5px;
  }
  .ms-chip.ok {
    border-color: rgba(120, 190, 120, .5);
    background: rgba(120, 190, 120, .14);
    color: #9fd08f;
  }

  /* 空状态 */
  .work-empty { padding: 0 24px; text-align: center; }
  .we-icon { font-size: 46px; }
  .we-title { font-size: 16px; }
  .we-sub { font-size: 12.5px; line-height: 1.7; }

  /* —— 通讯 / 判定卡 —— */
  #tool-box .tx-block { padding: 16px; }
  .tx-title { font-size: 14px; letter-spacing: 1px; }
  .chat-log { max-height: none; gap: 10px; }
  .chat-msg { font-size: 14.5px; line-height: 1.75; padding: 10px 12px; }
  .chat-msg.sys { font-size: 12px; }
  .chat-msg .cm-sender { font-size: 11.5px; }
  #judge-cards .jc-title { font-size: 15px; margin-bottom: 10px; }
  .jc-list { gap: 7px; }
  .jc-item { font-size: 13.5px; padding: 10px 11px; line-height: 1.5; }
  .jc-q { overflow: hidden; text-overflow: ellipsis; }

  /* —— 底部标签栏 —— */
  #mobile-nav {
    display: flex;
    flex-shrink: 0;
    width: 100%;
    height: calc(var(--m-nav-h) + var(--m-safe-b));
    padding-bottom: var(--m-safe-b);
    background: linear-gradient(180deg, #241a11, #180f08);
    border-top: 2px solid #0f0a06;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, .5);
  }
  #mobile-nav button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 44px;
    padding: 0;
    border: none;
    background: none;
    color: #8a7a60;
    font-size: 11.5px;
    letter-spacing: 1px;
    position: relative;
  }
  #mobile-nav button .mn-ic { font-size: 19px; line-height: 1; opacity: .75; }
  #mobile-nav button .mn-tx { line-height: 1; }
  #mobile-nav button.on { color: var(--lamp); }
  #mobile-nav button.on .mn-ic { opacity: 1; text-shadow: 0 0 10px var(--lamp-glow); }
  #mobile-nav button.on::before {
    content: "";
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 26px; height: 2px;
    border-radius: 2px;
    background: var(--lamp);
  }
  #mobile-nav button:active { background: rgba(232, 185, 106, .08); }

  #bottom-bar { display: none; }              /* 时钟已并入顶栏（由 mobile.js 迁移） */

  /* ============================================================
     4. Toast：抬到标签栏之上，左右留白，避免被挡住
     ============================================================ */
  #toast-area {
    left: calc(var(--m-safe-l) + 12px);
    right: calc(var(--m-safe-r) + 12px);
    bottom: calc(var(--m-nav-h) + var(--m-safe-b) + 12px);
    width: auto;
    max-width: none;
    gap: 8px;
  }
  .toast {
    font-size: 14px;
    padding: 12px 40px 12px 14px;
    transform: translateY(12px);
  }
  .toast.show, .toast:not(.out) { transform: translateY(0); }
  .toast.out { transform: translateY(12px); }
  .toast .t-title { font-size: 14.5px; }
  .toast .t-body { font-size: 13px; line-height: 1.65; }
  .toast .t-close {
    width: 30px; height: 30px;
    top: 50%; right: 6px;
    margin-top: -15px;
    font-size: 13px;
  }

  /* ============================================================
     5. 白色房间（反转播报）
     ============================================================ */
  #whiteroom-screen {
    align-items: flex-start;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: calc(var(--m-safe-t) + 46px) 0 calc(var(--m-safe-b) + 30px);
    overscroll-behavior: contain;
  }
  .wr-terminal {
    width: 100%;
    max-width: none;
    min-height: 0;
    max-height: none;
    overflow: visible;                        /* 由外层统一滚动，避免双层滚动 */
    margin: 0;
    padding: 0 calc(var(--m-safe-r) + 18px) 20px calc(var(--m-safe-l) + 18px);
    font-size: 16px;
    line-height: 1.95;
    word-break: break-word;
  }
  .wr-lines .wr-line { margin-bottom: 6px; }
  .wr-skip {
    position: fixed;
    right: calc(var(--m-safe-r) + 12px);
    top: calc(var(--m-safe-t) + 8px);
    z-index: 5;
    min-height: 40px;
    padding: 9px 15px;
    font-size: 13px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .08);
  }
  .wr-choices { grid-template-columns: 1fr; gap: 12px; margin-top: 24px; }
  .wr-choice { min-height: 66px; padding: 17px 14px; }
  .wr-choice:active { transform: scale(.985); }
  .wc-name { font-size: 17px; }
  .wc-desc { font-size: 12.5px; }
  .wr-pause { height: 16px; }

  /* ============================================================
     6. 辰天集团服务器（黑客界面）：三栏 → 单栏纵向
     ============================================================ */
  /* 黑客界面是深色终端，让整块工作区一起变深，避免下方露出纸张底纹 */
  #work-area.m-on.m-hack {
    display: flex;
    flex-direction: column;
    background: #0a0e1a;
    background-image: none;
    box-shadow: none;
  }
  #work-area.m-hack #work-content { flex: 1; min-height: 0; display: flex; }
  #work-area.m-hack .hack-interface { flex: 1; width: 100%; }
  #work-area.m-hack .hack-main { flex: 1; }

  .hack-interface { min-height: 0; }
  .hack-top { padding: calc(var(--m-safe-t) + 10px) 14px 10px; gap: 8px; }
  .hack-status-badge { font-size: 11.5px; padding: 4px 12px; }
  .hack-logo { font-size: 13px; letter-spacing: 2px; }
  .hack-logo-dim { font-size: 10px; }

  .hack-main {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }
  .hack-center { order: 1; }
  .hack-left { order: 2; }
  .hack-right { order: 3; }

  /* 启动日志：压成小格子横条 */
  .hack-left {
    border-right: none;
    border-top: 1px solid rgba(74, 240, 192, .15);
    padding: 10px 0 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
    gap: 7px 10px;
  }
  .hack-section-label, .hack-id { display: none; }
  .boot-line { margin: 0; font-size: 10px; }
  .boot-label { margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .boot-bar { height: 3px; }

  .hack-monitor { min-height: 0; }
  .mon-top { padding: 8px 12px; }
  .mon-badge { font-size: 11px; letter-spacing: 1px; }
  .mon-rec { font-size: 10px; }
  .mon-body { padding: 18px 12px 20px; }
  .mon-log-line { font-size: 12px; line-height: 1.6; }
  .mon-glitch-text { font-size: 18px; }

  .hack-right {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    border-left: none;
    border-top: 1px solid rgba(74, 240, 192, .15);
    padding: 10px 0 0;
  }
  .hack-brain { display: none; }             /* 纯装饰，手机端让位给进度条 */
  .hack-progress { flex: 1; }
  .hp-label { font-size: 10.5px; }
  .hp-bar { height: 5px; margin-bottom: 8px; }

  .cipher-label { font-size: 14.5px; letter-spacing: 1px; margin-bottom: 6px; }
  .cipher-hint { font-size: 12px; margin-bottom: 12px; line-height: 1.6; }
  .cipher-text { font-size: 25px; letter-spacing: 4px; margin-bottom: 14px; }
  .cipher-input {
    width: 100%;
    max-width: 320px;
    min-height: 46px;
    font-size: 16px;                          /* 防止 iOS 自动放大 */
    padding: 10px 14px;
    margin-bottom: 12px;
  }
  .btn-hacker { min-height: 44px; width: 100%; max-width: 320px; font-size: 15px; }
  .hack-bottom { padding: 9px 14px calc(var(--m-safe-b) + 9px); }
  .hack-status-line { font-size: 11px; }

  /* 前九份委托完成后的转场黑屏（内联样式，需 !important） */
  #hacked-screen { padding: calc(var(--m-safe-t) + 34px) 18px calc(var(--m-safe-b) + 34px) !important; }
  #hacked-text { font-size: 16px !important; line-height: 1.95 !important; }
  #hacked-screen .btn { width: 100%; margin-top: 28px !important; min-height: 48px; }

  /* ============================================================
     7. 结局 / 作者寄语
     ============================================================ */
  .ending-inner, .afterword-inner {
    width: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
    border-left: none;
    border-right: none;
    padding: 28px 20px 32px;
  }
  .ending-tag, .aw-tag { font-size: 11.5px; letter-spacing: 2px; margin-bottom: 14px; }
  .ending-inner h2 { font-size: 27px; letter-spacing: 5px; margin-bottom: 14px; }
  .ending-body { font-size: 15.5px; line-height: 1.95; margin: 18px 0; }
  .ending-body p { margin-bottom: 13px; }
  .ending-quote { font-size: 15px; line-height: 1.9; padding-left: 12px; margin: 20px 0; }
  .ending-survey { max-width: none; margin: 18px 0 16px; padding: 14px 16px; }
  .ending-survey .es-t { font-size: 16px; }
  .ending-survey .es-d { font-size: 12.5px; }
  .ending-inner .btn + .btn { margin-top: 10px; }
  .aw-body { font-size: 15px; line-height: 1.95; }
  .aw-body .aw-mono { font-size: 12.5px; padding: 11px 13px; }

  /* ============================================================
     8. 触屏：清楚 hover 残留，只保留 :active 反馈
     ============================================================ */
  @media (hover: none) {
    .btn:hover { border-color: var(--line-2); color: var(--ink-2); background: var(--paper-2); }
    .btn-primary, .btn-primary:hover {
      background: linear-gradient(180deg, var(--red-2), var(--red));
      border-color: var(--red);
      color: #fdf6e8;
    }
    .case-item:hover {
      border-color: #3a2a1a;
      background: linear-gradient(180deg, rgba(255, 220, 150, .02), rgba(0, 0, 0, .1));
    }
    .case-item.active:hover {
      border-color: var(--lamp);
      background: rgba(232, 185, 106, .14);
    }
    .case-item.hidden-case:hover { border-color: var(--red); }
    .class-opt:hover { border-color: var(--line); background: #fdf8ec; }
    .class-opt.selected, .class-opt.selected:hover {
      border-color: var(--red);
      background: var(--red);
      color: #fdf6e8;
    }
    .class-opt.selected .co-desc { color: rgba(255, 255, 255, .85); }
    .q-choice-btn:hover { border-color: var(--line); }
    .q-choice-btn.selected, .q-choice-btn.selected:hover {
      border-color: var(--gold);
      background: var(--gold-soft);
      color: var(--gold);
    }
    .wr-choice:hover { border-color: #ccc; background: #fff; }
    .wr-choice-hidden:hover { opacity: .25; }
    .diff-btn:hover { border-color: var(--line); background: #fdf8ec; }
    .intro-rec:hover {
      transform: none;
      box-shadow: none;
      background: rgba(138, 58, 42, .06);
      border-color: rgba(138, 58, 42, .35);
    }
    .ending-survey:hover {
      transform: none;
      box-shadow: none;
      background: rgba(212, 175, 55, .10);
      border-color: rgba(212, 175, 55, .55);
    }
    .ending-survey:hover .es-d { color: var(--ink-dim); }
    .tu-skip:hover { color: var(--ink-dim); }
    .wr-skip:hover { color: #999; border-color: #ddd; }
    .toast .t-close:hover { background: rgba(255, 255, 255, .08); color: #8a7a60; }
  }

  /* 检索命中时，新线索轻微高亮，配合自动滚动定位 */
  @keyframes mClueFlash {
    0%   { box-shadow: 0 0 0 0 rgba(74, 107, 58, .55); background: rgba(120, 170, 110, .22); }
    70%  { box-shadow: 0 0 0 10px rgba(74, 107, 58, 0); background: rgba(120, 170, 110, .12); }
    100% { box-shadow: 0 0 0 0 rgba(74, 107, 58, 0); background: rgba(255, 250, 235, .7); }
  }
  .clue.m-flash { animation: mClueFlash 1.5s ease-out; }

  /* 尊重系统「减弱动态效果」 */
  @media (prefers-reduced-motion: reduce) {
    .clue, .chat-msg, .toast, .case-item.done::after, .ending-body p, .wr-line { animation: none !important; }
    .clue.m-flash { animation-duration: .01s; }
    html { scroll-behavior: auto; }
  }

  /* ============================================================
     9. 平板竖屏（600–820px）：内容居中限宽
        单栏铺满 768px 会一行四五十个字，读起来太宽
     ============================================================ */
  @media (min-width: 600px) {
    .case-detail,
    #m-search-dock .tx-block,
    #tool-box .tx-block {
      max-width: 720px;
      margin-left: auto;
      margin-right: auto;
    }
    #case-items, .cl-head, .cl-footer {
      width: 100%;
      max-width: 720px;
      margin-left: auto;
      margin-right: auto;
    }
    .cd-title { font-size: 26px; }
  }
}

/* ================================================================
   低矮屏（手机横屏）：进一步压缩纵向留白
   ================================================================ */
@media (max-width: 820px) and (max-height: 470px) and (orientation: landscape) {
  :root { --m-nav-h: 48px; }
  #top-bar { min-height: 42px; padding-top: calc(var(--m-safe-t) + 4px) !important; padding-bottom: 4px !important; }
  #mobile-nav button .mn-ic { font-size: 16px; }
  #mobile-nav button { font-size: 10.5px; gap: 1px; }
  .case-detail { padding: 12px 18px 22px; }
  .cd-title { font-size: 20px; }
  .fullscreen-layer { padding: 6px 0 !important; }
  .intro-card, .ending-inner, .afterword-inner { padding: 20px 22px; }
  .intro-card h2 { font-size: 24px; margin-bottom: 6px; }
  .wr-terminal { font-size: 15px; line-height: 1.8; }
}
