/* ============================================================
       全站统一：滚动定位页（每模式一屏 · scroll-snap）
       桌面 = 左图右列极简分流页；移动端 = 上图下卡片轨
       目标：高效传递信息 · 快速分流
       ============================================================ */
    .dock, .capsule-dock, .readouts, .viz { display: none; }
    .m-pages {
      grid-area: main; display: block; position: relative;
      overflow-y: auto; overflow-x: clip; scroll-snap-type: y proximity;
      overscroll-behavior-y: contain;
      scrollbar-width: none;
    }
    .m-pages::-webkit-scrollbar { display: none; }
    .m-page {
      min-height: 100%;
      display: flex; flex-direction: row;
      scroll-snap-align: start end;
      scroll-snap-stop: normal;
      position: relative;
    }
    .mp-stage {
      position: sticky; top: 0; flex: 0 0 46%; overflow: hidden;
      /* 一屏 = 滚动视口。顶栏为悬浮叠层(hero-bg.css 将导航网格行归零,
         非 hero 页以 padding-top 让位),故 stage 须为 dvh 现值扣除顶栏高。
         iOS Safari 裸 100vh 是"大视口",文档不滚动时工具栏永不收起,
         会比可视区域高约 90-110px,把每页顶出一屏之外 */
      height: calc(100vh - var(--site-nav-h, 52px));
      height: calc(100dvh - var(--site-nav-h, 52px));
      border-right: 0.5px solid var(--hairline);
      align-self: flex-start;
    }
    .mp-stage img { width: 100%; height: 100%; object-fit: cover; display: block; }
    .mp-stage .mp-scrim {
      position: absolute; inset: 0;
      background: var(--scrim-d);
      pointer-events: none;
    }
    .mp-stage .mp-tint { position: absolute; inset: 0; pointer-events: none; }
    .mp-idx {
      position: absolute; top: 16px; left: 18px;
      font-family: var(--font-mono); font-size: var(--fs-2xs); letter-spacing: 0.16em;
      color: var(--text); background: var(--chip-bg);
      border: 0.5px solid var(--rim);
      border-radius: 3px; padding: 4px 9px;
      pointer-events: none;
    }
    .mp-idx b { color: var(--pa, var(--gold)); font-weight: 500; }
    .mp-body {
      flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-start;
      padding: 9vh clamp(32px, 5vw, 88px) 5vh;
      padding: 9dvh clamp(32px, 5vw, 88px) 5dvh;
      min-height: 0;
    }
    .mp-title {
      font-family: var(--font-dis); font-weight: 600;
      font-size: clamp(1.7rem, 2.5vw, 2.25rem); letter-spacing: 0.1em; line-height: 1.1;
      color: var(--text);
    }
    .mp-title em {
      display: block; font-style: normal; font-family: var(--font-cn);
      font-size: var(--fs-md); font-weight: 400; letter-spacing: 0.16em;
      text-transform: none;
      color: var(--dim); margin-top: 10px;
    }
    .mp-desc {
      font-size: var(--fs-md); line-height: 1.85; color: var(--dim);
      margin-top: 18px; max-width: 620px;
      display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
      max-height: 5.57em; /* clamp 失效兜底：3 行 × 1.85 行高 */
    }
    /* 桌面：行式分流列表（名称 · 一句话 · ↗）+ 悬停向下展开预览 */
    .mp-items {
      margin-top: 26px; display: flex; flex-direction: column;
      max-width: 620px;
    }
    .mp-item {
      display: flex; flex-direction: column; align-items: stretch;
      padding: 14px 2px; text-align: left; color: var(--text);
      border-bottom: 0.5px solid var(--hairline-soft);
      transition: opacity 0.2s ease;
    }
    .mp-item:first-child { border-top: 0.5px solid var(--hairline-soft); }
    .mp-item:active { opacity: 0.55; }
    .mp-item.mute { opacity: 0.45; }
    .mi-row { display: flex; align-items: center; gap: 18px; min-width: 0; }
    .mi-arrow { color: var(--pa, var(--gold)); flex-shrink: 0; margin-left: auto; transition: transform 0.3s var(--ease-out); }
    .mp-item:hover .mi-name, .mp-item.open .mi-name, .mp-item:focus-visible .mi-name { color: var(--pa, var(--gold)); }
    .mp-item:hover .mi-arrow, .mp-item.open .mi-arrow { transform: translate(2px, -2px); }
    .mi-thumb { display: none; }
    .mi-name {
      font-family: var(--font-dis); font-weight: 600; font-size: var(--fs-lg);
      letter-spacing: 0.06em; flex-shrink: 0; white-space: nowrap;
      transition: color 0.25s ease;
    }
    .mi-cn {
      font-family: var(--font-cn); font-size: var(--fs-md); color: var(--dim);
      letter-spacing: 0.03em; flex: 1; min-width: 0;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .mi-expand {
      display: flex; gap: 20px; align-items: flex-start;
      max-height: 0; opacity: 0; overflow: hidden;
      transition: max-height 0.5s var(--ease-out), opacity 0.35s ease, margin 0.4s var(--ease-out);
    }
    .mp-item:hover .mi-expand, .mp-item.open .mi-expand, .mp-item:focus-visible .mi-expand {
      max-height: 260px; opacity: 1; margin: 10px 0 4px;
    }
    .mi-preview {
      flex: 0 0 218px; height: 136px; border-radius: 5px; overflow: hidden;
      border: 0.5px solid var(--rim);
    }
    .mi-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
    .mi-intro {
      flex: 1; font-size: var(--fs-sm); line-height: 1.75; color: var(--dim);
      padding-top: 2px; max-width: 380px;
    }
    /* GitHub 开源仓库卡片墙：桌面五卡竖向并列 */
    .mp-items.gh { gap: 10px; }
    .mp-items.gh .mp-item {
      border-top: none; border-bottom: none;
      border: 0.5px solid var(--hairline);
      border-radius: 7px; background: var(--deck);
      flex-direction: row; align-items: center; gap: 16px;
      padding: 12px 16px;
      transition: border-color 0.2s ease, opacity 0.2s ease;
    }
    .mp-items.gh .mp-item:hover { border-color: rgba(var(--pa-rgb, 45, 212, 191), 0.55); }
    .mp-items.gh .mp-item:hover {
      background-image: radial-gradient(var(--microdot) 0.8px, transparent 0.9px);
      background-size: 7px 7px;
    }
    .gh-card .mi-thumb {
      display: flex; align-items: center; justify-content: center;
      flex: 0 0 56px; height: 56px; padding: 6px;
      border-radius: 6px; overflow: hidden;
      background: rgba(255, 255, 255, 0.05);
      border: 0.5px solid var(--hairline-soft);
    }
    .gh-card .mi-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
    .gh-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
    .gh-top { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; min-width: 0; }
    .gh-card .mi-name { font-size: var(--fs-lg); }
    .gh-meta {
      font-family: var(--font-mono); font-size: var(--fs-2xs); letter-spacing: 0.1em;
      color: var(--faint); white-space: nowrap;
    }
    .gh-card .mi-cn {
      flex: 0 1 auto; min-width: 0;
      font-size: var(--fs-xs); white-space: nowrap;
      overflow: hidden; text-overflow: ellipsis;
    }
    /* 卡片 3D 环绕跟随：透视倾斜 + 光泽高光 + 深度投影 */
    .gh-card {
      transform-style: preserve-3d;
      transition: transform 0.16s ease-out, border-color 0.2s ease, box-shadow 0.25s ease;
      will-change: transform;
      position: relative;
    }
    .gh-card::after {
      content: ""; position: absolute; inset: 0; border-radius: 7px;
      pointer-events: none; opacity: 0;
      background: radial-gradient(180px circle at var(--mx, 50%) var(--my, 50%),
        rgba(255, 255, 255, 0.09), transparent 65%);
      transition: opacity 0.25s ease;
    }
    html[data-theme="light"] .gh-card::after {
      background: radial-gradient(180px circle at var(--mx, 50%) var(--my, 50%),
        rgba(15, 23, 42, 0.06), transparent 65%);
    }
    .gh-card:hover::after { opacity: 1; }
    .gh-card.tilting {
      box-shadow: 0 18px 40px -14px rgba(0, 0, 0, 0.55), 0 0 24px rgba(var(--pa-rgb, 45, 212, 191), 0.12);
    }
    html[data-theme="light"] .gh-card.tilting {
      box-shadow: 0 18px 40px -16px rgba(15, 23, 42, 0.3), 0 0 24px rgba(var(--pa-rgb, 45, 212, 191), 0.1);
    }
    .gh-card .mi-thumb, .gh-card .gh-main { transform: translateZ(18px); }

    /* ============================================================
       宗门宝藏 (Archives) · 纯双分栏架构 (隐藏左侧大图舞台，全宽沉浸呈现)
       ============================================================ */
    .m-page[data-mode="archives"] {
      display: flex; flex-direction: column; width: 100%;
      min-height: 100%; box-sizing: border-box;
      scroll-snap-align: start;
    }
    .m-page[data-mode="archives"] .mp-stage {
      display: none !important;
    }
    .m-page[data-mode="archives"] .mp-body {
      flex: 1; max-width: 1400px; width: 100%; margin: 0 auto;
      padding: clamp(40px, 5vh, 56px) clamp(24px, 4vw, 56px) 76px;
      box-sizing: border-box; display: flex; flex-direction: column; justify-content: flex-start;
    }
    .archives-wrapper {
      margin-top: 14px; display: flex; flex-direction: column; gap: 12px;
      width: 100%; max-width: 100%;
    }
    .archives-switcher {
      display: none; align-items: center; gap: 6px;
      padding: 4px; border-radius: 999px;
      background: rgba(255, 255, 255, 0.05);
      border: 0.5px solid var(--hairline);
      width: fit-content;
    }
    html[data-theme="light"] .archives-switcher { background: rgba(15, 23, 42, 0.05); }
    .as-btn {
      font-family: var(--font-dis); font-size: var(--fs-xs); font-weight: 600;
      letter-spacing: 0.08em; padding: 6px 16px; border-radius: 999px;
      color: var(--dim); background: transparent; border: none; cursor: pointer;
      transition: all 0.2s ease;
    }
    .as-btn.active {
      color: var(--text); background: var(--deck);
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    }
    html[data-theme="light"] .as-btn.active { box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08); }
    .archives-columns {
      /* auto-fit 预排版：可用宽 ≥2×520+栏距 自动并排双栏，否则堆叠上下两段（段距独立调大） */
      display: grid; grid-template-columns: repeat(auto-fit, minmax(520px, 1fr));
      column-gap: clamp(20px, 3vw, 36px); row-gap: 44px; width: 100%;
    }
    .archives-col {
      display: flex; flex-direction: row; gap: 10px; min-width: 0;
    }
    .ac-stack {
      display: flex; flex-direction: column; gap: 10px; flex: 1 1 auto; min-width: 0;
    }
    /* 左侧竖排标题：无外框、文字顶对齐、左侧粉色粗线 */
    .ac-rail {
      flex: 0 0 auto;
      display: flex; align-items: flex-start; justify-content: flex-start;
      padding-left: 9px;
      user-select: none;
      position: relative;
    }
    .ac-rail::before {
      content: ""; position: absolute; left: 0; top: 0; width: 4px; height: 68px;
      background: #f43f5e; border-radius: 2px;
    }
    .ac-rail b {
      writing-mode: vertical-rl;
      color: var(--text); font-family: var(--font-cn); font-size: var(--fs-sm);
      letter-spacing: 0.3em; font-weight: 600;
    }
    .ac-more {
      display: flex; align-items: center; justify-content: center;
      font-family: var(--font-cn); font-size: var(--fs-sm); letter-spacing: 0.14em;
      color: var(--accent); font-weight: 600;
      padding: 12px 16px; border-radius: 6px;
      background: rgba(var(--accent-rgb), 0.1);
      border: 0.5px solid rgba(var(--accent-rgb), 0.25);
      text-decoration: none;
      transition: all 0.2s ease;
    }
    .ac-more:hover {
      background: var(--accent); color: #fff;
      border-color: var(--accent);
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
    }
    /* 双栏各 2×2 网格：卡片改紧凑竖版（缩略图横幅 + 两行标题/描述 + 底部价格行）
       auto-fill 预排版：列表宽 ≥2×260+列距 自动两列，不足自动单列；≤639 手机档覆盖为横排行卡 */
    .ac-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
    .archives-col .codex-card,
    .archives-col .vault-card {
      flex-direction: column; align-items: stretch; justify-content: flex-start;
      gap: 7px; height: auto; padding: 10px;
    }
    .archives-col .cc-thumb,
    .archives-col .vc-thumb { flex: 0 0 auto; width: 100%; height: 84px; }
    .archives-col .cc-main,
    .archives-col .vc-main { flex: 1 1 auto; min-height: 76px; justify-content: space-between; }
    .archives-col .vc-top { flex-wrap: nowrap; row-gap: 2px; }
    /* 标题单行截断，省出的高度让给缩略图横幅 */
    .archives-col .vc-title,
    .archives-col .cc-title {
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    /* 规格 tag 单行排布，超出宽度直接裁掉不折行 */
    .archives-col .vc-specs,
    .archives-col .cc-specs { flex-wrap: nowrap; overflow: hidden; }
    .archives-col .vc-action,
    .archives-col .cc-action {
      flex-direction: row; align-items: center; justify-content: space-between;
      width: 100%;
    }

    /* 功法阁 (Vault) & 教程集 (Codex) · 统一水平对齐规格卡片 (严格同高 84px) */
    .mp-items.vault-list,
    .mp-items.codex-list { gap: 10px; }
    .vault-card,
    .codex-card {
      border: 0.5px solid var(--hairline);
      border-radius: 7px; background: var(--deck);
      display: flex; flex-direction: row; align-items: center; gap: 14px;
      padding: 10px 14px; text-align: left;
      height: 84px; box-sizing: border-box;
      transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
      cursor: pointer; position: relative;
    }
    .vault-card:hover {
      border-color: rgba(var(--pa-rgb, 244, 63, 94), 0.55);
      background-image: radial-gradient(var(--microdot) 0.8px, transparent 0.9px);
      background-size: 7px 7px;
      transform: translateY(-1px);
    }
    .codex-card:hover {
      border-color: rgba(var(--pa-rgb, 99, 102, 241), 0.55);
      background-image: radial-gradient(var(--microdot) 0.8px, transparent 0.9px);
      background-size: 7px 7px;
      transform: translateY(-1px);
    }
    .vc-thumb {
      flex: 0 0 52px; height: 52px; border-radius: 6px; overflow: hidden;
      border: 0.5px solid var(--hairline-soft);
      background: rgba(255, 255, 255, 0.04);
      position: relative;
    }
    .vc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.3s ease; }
    .vault-card:hover .vc-thumb img { transform: scale(1.06); }
    .cc-thumb {
      flex: 0 0 52px; height: 52px; border-radius: 6px; overflow: hidden;
      border: 0.5px solid var(--hairline-soft);
      background: rgba(255, 255, 255, 0.04);
      position: relative;
    }
    .cc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.3s ease; }
    .codex-card:hover .cc-thumb img { transform: scale(1.06); }
    .cc-thumb .cc-vol-tag {
      position: absolute; bottom: 2px; right: 2px;
      font-family: var(--font-dis); font-size: var(--fs-2xs); font-weight: 700;
      letter-spacing: 0.04em; padding: 1px 4px; border-radius: 2px;
      background: rgba(9, 12, 18, 0.88); color: #fff;
      border: 0.5px solid rgba(255, 255, 255, 0.2);
    }
    .cc-badge {
      flex: 0 0 52px; height: 52px; border-radius: 6px;
      background: rgba(var(--pa-rgb, 99, 102, 241), 0.1);
      border: 0.5px solid rgba(var(--pa-rgb, 99, 102, 241), 0.3);
      color: var(--pa, #6366f1);
      display: flex; flex-direction: column; align-items: center; justify-content: center;
      font-family: var(--font-dis); font-weight: 700; font-size: var(--fs-xs); letter-spacing: 0.06em;
    }
    .vc-main,
    .cc-main {
      flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px;
    }
    .vc-top,
    .cc-top {
      display: flex; align-items: center; gap: 7px; flex-wrap: nowrap; min-width: 0;
    }
    .vc-badges {
      position: absolute; top: 4px; left: 4px; z-index: 1;
      display: flex; flex-wrap: nowrap; gap: 4px; pointer-events: none;
      max-width: calc(100% - 8px);
      overflow: hidden;
      -webkit-mask-image: linear-gradient(90deg, #000 78%, transparent);
      mask-image: linear-gradient(90deg, #000 78%, transparent);
    }
    .vc-badges .vc-badge {
      position: static;
    }
    /* 徽标叠加在缩略图上（主题红 90% 不透明底 + 白字），标题行只留标题 */
    .vc-badge {
      position: absolute; top: 4px; left: 4px; z-index: 1;
      font-family: var(--font-mono); font-size: var(--fs-2xs); font-weight: 600; letter-spacing: 0.06em;
      padding: 2px 7px; border-radius: 4px; flex-shrink: 0;
      background: rgba(var(--pa-rgb, 244, 63, 94), 0.9);
      color: #ffffff;
      white-space: nowrap; pointer-events: none;
    }
    .vc-title,
    .cc-title {
      font-family: var(--font-dis); font-weight: 600; font-size: var(--fs-md);
      letter-spacing: 0.02em; color: var(--text);
      transition: color 0.2s ease;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .vault-card:hover .vc-title { color: var(--pa, #f43f5e); }
    .codex-card:hover .cc-title { color: var(--pa, #6366f1); }
    .vc-desc,
    .cc-desc {
      font-size: var(--fs-xs); color: var(--dim); line-height: 1.38;
      display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
      max-height: 2.78em; /* clamp 失效兜底：2 行 × 1.38 行高 */
    }
    .vc-specs,
    .cc-specs {
      display: flex; flex-wrap: nowrap; gap: 5px; margin-top: 1px; overflow: hidden;
    }
    .vc-spec,
    .cc-spec {
      font-family: var(--font-mono); font-size: var(--fs-2xs); letter-spacing: 0.04em;
      color: var(--faint); background: rgba(255, 255, 255, 0.04);
      padding: 1px 5px; border-radius: 2px; border: 0.5px solid var(--line-soft);
      white-space: nowrap; flex-shrink: 0;
    }
    html[data-theme="light"] .vc-spec,
    html[data-theme="light"] .cc-spec { background: rgba(15, 23, 42, 0.04); }
    .vc-action,
    .cc-action {
      flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
    }
    .vc-price,
    .cc-price {
      font-family: var(--font-dis); font-weight: 700; font-size: var(--fs-lg);
      letter-spacing: 0.02em;
    }
    .vc-price { color: var(--pa, #f43f5e); }
    .cc-price { color: var(--pa, #6366f1); }
    .vc-btn,
    .cc-btn {
      font-family: var(--font-cn); font-size: var(--fs-xs); letter-spacing: 0.05em;
      padding: 4px 10px; border-radius: 4px;
      display: inline-flex; align-items: center; gap: 3px; cursor: pointer;
      transition: background 0.2s ease, transform 0.15s ease, color 0.2s ease;
      white-space: nowrap;
    }
    .vc-btn {
      border: 0.5px solid rgba(var(--pa-rgb, 244, 63, 94), 0.5);
      background: rgba(var(--pa-rgb, 244, 63, 94), 0.1); color: var(--text);
    }
    .cc-btn {
      border: 0.5px solid rgba(var(--pa-rgb, 99, 102, 241), 0.5);
      background: rgba(var(--pa-rgb, 99, 102, 241), 0.1); color: var(--text);
    }
    .vault-card:hover .vc-btn { background: var(--pa, #f43f5e); color: #fff; }
    .codex-card:hover .cc-btn { background: var(--pa, #6366f1); color: #fff; }
