/* ============================================================
   Claude theme · 窄屏适配（手机版页面下线后，电脑版自己适配手机）
   只写 @media，不改页面自带的行内样式，也不动 css I / css II。
   断点跟原站自己的手机断点对齐：767px；文档目录单独跟到源码自己的 900px。
   ============================================================ */

/* ---------- 1. 全站：手指尺寸与窄屏留白 ---------- */
@media (max-width: 767px) {
  html {
    -webkit-text-size-adjust: 100%;
  }

  /* 顶栏里的图标按钮原本 36–38px，按手指标准抬到 40 */
  body.doc .pill-btn {
    min-width: 40px;
    min-height: 40px;
  }

  /* guide 两页的目录是侧滑抽屉（源码自己已经做了），只把行高抬到可点 */
  body.guide .toc-item {
    min-height: 44px;
  }
}

/* ============================================================
   2. 首页：扇形导航在触屏上不扇——它靠 hover 展开，触屏没有 hover，
   而且 7 个圆盘会横压在标题上。改成常驻的两列目录卡片。
   布局条件写成「窄 或 不能 hover」：平板横屏宽度够，但同样点不出 hover。
   ============================================================ */
@media (max-width: 767px), (hover: none) and (pointer: coarse) {
  body.home .hero {
    height: auto;
    min-height: 100vh;
    min-height: 100svh;
    overflow: visible;
    padding-bottom: 26px;
  }

  body.home .hero-inner {
    height: auto;
    max-width: none;
    transform: none;
    padding: 84px 20px 4px;
    justify-content: flex-start;
  }

  /* 「这里」那根竖排提示线只服务于 hover 展开，触屏没有意义 */
  body.home .side-line,
  body.home .side-text {
    display: none;
  }

  body.home .side-hint {
    position: static;
    transform: none;
    align-items: stretch;
    gap: 0;
    padding: 22px 20px 0;
  }

  body.home .side-hint .fan {
    position: static;
    width: auto;
    height: auto;
    perspective: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
  }

  body.home .side-hint .fan-item,
  body.home .side-hint:hover .fan-item,
  body.home .side-hint.open .fan-item,
  body.home .side-hint:hover .fan-item:hover,
  body.home .side-hint.open .fan-item:hover {
    position: static;
    opacity: 1;
    pointer-events: auto;
    transform: none !important;
    width: auto;
    height: auto;
    min-height: 56px;
    margin: 0;
    border-radius: 14px;
    padding: 10px 12px;
    justify-content: center;
    box-shadow:
      5px 5px 12px var(--neu-shadow-dark),
      -5px -5px 12px var(--neu-shadow-light) !important;
  }

  body.home .side-hint .fan-item span,
  body.home .side-hint .fan-item.sm span {
    font-size: 14px;
    line-height: 1.4;
    white-space: normal;
    text-align: center;
  }
}

/* ---------- 首页窄屏字号与弹窗 ---------- */
@media (max-width: 767px) {
  body.home .hero-title {
    font-size: 28px;
    line-height: 1.3;
  }

  body.home .hero-mid {
    font-size: 16px;
    margin-top: 16px;
  }

  body.home .hero-fine {
    margin-top: 16px;
  }

  /* 弹窗卡片在 390 上原本按 420px 宽算，左右各留 14px 更稳 */
  body.home .contact-pop {
    padding: 14px;
  }

  body.home .contact-card {
    padding: 26px 18px 20px;
    max-height: 82vh;
    overflow-y: auto;
  }

  body.home .welcome-card {
    font-size: 24px;
    padding: 26px 20px;
  }
}

/* ============================================================
   3. 文档三页：目录原本 <900px 直接 display:none，手机上等于没有目录。
   改成贴在顶栏下方的一条横向滚动目录。
   上界写 899 而不是 767：源码的侧栏目录是 @media(min-width:900px) 才亮，
   768–899 这一档两头都不管，正好是没目录的真空带。
   ============================================================ */
@media (max-width: 899px) {
  body.doc:not(.guide) .layout {
    display: block;
    padding: 18px 14px 60px;
  }

  body.doc:not(.guide) .toc {
    display: block;
    position: sticky;
    top: 61px;
    z-index: 6;
    width: auto;
    margin: 0 -14px 16px;
    padding: 8px 14px 9px;
    background: var(--c-paper);
    border-bottom: 1px solid var(--c-line);
  }

  body.doc:not(.guide) .toc-head {
    padding: 0 0 6px;
    font-size: 10.5px;
    letter-spacing: .26em;
    color: var(--c-muted);
  }

  body.doc:not(.guide) .toc-list {
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }

  body.doc:not(.guide) .toc-list::-webkit-scrollbar {
    display: none;
  }

  body.doc:not(.guide) .toc-item {
    flex: none;
    width: auto;
    min-height: 38px;
    white-space: nowrap;
    padding: 8px 13px;
    font-size: 12.5px;
  }

  /* 分组分隔线在横排里没有意义 */
  body.doc:not(.guide) .toc-sep {
    display: none;
  }

  /* 899 这一档源码本来就把文章铺满整个宽度，一行能排到一百字。
     收一个和桌面侧栏版最宽文章列相当的上限，手机端（347px）碰不到这条线。 */
  body.doc:not(.guide) .article {
    gap: 18px;
    max-width: 720px;
    margin-inline: auto;
  }
}

/* ============================================================
   4. 听音取向：量表 5 个圆在 375 上被挤成三行字，
   改成等宽五列的矮胶囊；雷达图画布 560×520，只压宽不压高会变形。
   ============================================================ */
@media (max-width: 767px) {
  body.taste .likert .opts {
    gap: 6px;
  }

  body.taste .likert .opt {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 2px 7px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
  }

  /* 数字撑住按钮，标签缩成一行小注——五列并排时也能一眼分清 */
  body.taste .likert .opt .on {
    font-size: 10px;
    font-weight: 400;
    line-height: 1.25;
    letter-spacing: 0;
    color: var(--c-muted);
  }

  body.taste .likert .opt.sel .on {
    color: inherit;
  }

  body.taste .q {
    padding: 13px 13px 15px;
  }

  body.taste .q .t {
    font-size: 14px;
    line-height: 1.85;
  }

  body.taste #radar {
    width: 100%;
    height: auto;
  }
}

/* ============================================================
   5. 声场图鉴：窄屏是「上目录 / 中舞台 / 下说明」三段叠在舞台上。
   原比例把目录放到 34vh、说明放到 40vh，中间只剩一条缝。
   这里把两块各自压矮并留出可见的舞台带。
   ============================================================ */
@media (max-width: 767px) {
  /* 原站把窄屏排成「上目录 / 下说明」两块，中间夹图例和按钮，
     但目录 34vh + 说明 41vh 之后舞台只剩一条缝。这里整体收矮一档，
     并把图例改成单行横滑、按钮横排在图例上方，舞台带能看见约 28% 屏高。 */
  body.stage #sidebar {
    max-height: 27vh;
    padding: 11px 11px 10px;
  }

  body.stage #sidebar .brand h1 {
    font-size: 18px;
  }

  body.stage #sidebar .brand {
    margin-bottom: 8px;
  }

  body.stage #info {
    left: 8px;
    right: 8px;
    bottom: 8px;
    max-height: 34vh;
    padding: 12px 13px 12px;
  }

  body.stage #info h2 {
    font-size: 18px;
  }

  body.stage #info .desc {
    font-size: 12.5px;
    line-height: 1.75;
  }

  body.stage #legend {
    left: 8px;
    right: 8px;
    bottom: calc(34vh + 14px);
    max-height: none;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 5px;
    scrollbar-width: none;
  }

  body.stage #legend::-webkit-scrollbar {
    display: none;
  }

  body.stage #legend .chip {
    flex: none;
    font-size: 10px;
    gap: 5px;
    padding: 6px 8px;
  }

  body.stage #controls {
    left: 8px;
    right: 8px;
    bottom: calc(34vh + 52px);
    flex-direction: row;
    justify-content: flex-start;
    gap: 6px;
  }

  body.stage #controls .ctl {
    flex: none;
    padding: 9px 12px;
    font-size: 11.5px;
  }
}
