/* expedition.css —— 07 远征模式 #expedition 与 html[data-scene="expedition"] 质询室转场（任务 8）。
   选择器只写本节的；静态标记即终态：牌 .is-flipped、笔录 .is-done、收尾印 .is-in，
   expedition.js 在非减弱动效时把它们倒回起点，再随视口推进。 */

/* ── 质询室场景：本节在视口内时 <html data-scene="expedition">（JS 写，减弱动效时不写） ── */
html[data-scene="expedition"] body { background: var(--stage); transition: background-color var(--t-l) var(--ease-io); }
body { transition: background-color var(--t-l) var(--ease-io); }

/* 暗角 + 聚光 + 视口四角 HUD（场景伪元素，z-index 低于导航 50 / 火花 60） */
body::before, body::after { content: ""; position: fixed; inset: 0; pointer-events: none; opacity: 0; }
body::before { z-index: 40; background: radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(0,0,0,.5) 100%); transition: opacity var(--t-l) var(--ease-io); }
body::after { z-index: 41; background: radial-gradient(52% 44% at 50% -6%, rgba(251,241,220,.07), transparent 70%); transition: opacity var(--t-l) var(--ease-io); }
html[data-scene="expedition"] body::before, html[data-scene="expedition"] body::after { opacity: 1; }
/* 聚光随滚动缓慢下移：--xq-spot 0–1 由 JS 写，聚光中心从 -6% 走到 10% */
html[data-scene="expedition"] body::after { background: radial-gradient(52% 44% at 50% calc(-6% + var(--xq-spot, 0) * 16%), rgba(251,241,220,.07), transparent 70%); }

/* 视口四角角标：scene 期间从外向内合拢（同 .hud 语言，线 12px） */
.xq-corner { position: fixed; z-index: 45; width: 16px; height: 16px; pointer-events: none; opacity: 0;
  background-image: linear-gradient(var(--line-3), var(--line-3)), linear-gradient(var(--line-3), var(--line-3));
  background-size: 12px 1px, 1px 12px; background-repeat: no-repeat;
  transition: opacity var(--t-m) var(--ease-out), transform var(--t-m) var(--ease-out); }
.xq-corner.tl { top: 64px; left: 12px; background-position: 0 0, 0 0; transform: translate(-8px, -8px); }
.xq-corner.tr { top: 64px; right: 12px; background-position: 100% 0, 100% 0; transform: translate(8px, -8px); }
.xq-corner.bl { bottom: 12px; left: 12px; background-position: 0 100%, 0 0; transform: translate(-8px, 8px); }
.xq-corner.br { bottom: 12px; right: 12px; background-position: 100% 100%, 100% 0; transform: translate(8px, 8px); }
html[data-scene="expedition"] .xq-corner { opacity: 1; transform: none; }

/* 居中容器在奇数视口宽下 margin auto 会算成 x.5px；全局 .wrap 的 round() 取整已提升到 base.css */

/* ── 转场条：像素字一行，JS 用 steps(8) 逐字揭开（静态即完整显示） ── */
.xq-bar { display: flex; justify-content: center; margin: 48px 0 0; }
.xq-bar > span { display: inline-block; padding: 4px 12px; border: 1px solid var(--line-2); color: var(--brass); }
@media (prefers-reduced-motion: no-preference) {
  html.js #expedition.xq-live .xq-bar > span { clip-path: inset(0 100% 0 0); }
}

/* ── 像素页签（装饰）：画面顶部一条远征外壳导航 ── */
.xq-tabs { display: flex; flex-wrap: wrap; gap: 0; margin: 24px 0 0; }
.xq-tabs > span { display: block; padding: 6px 18px; border: 1px solid var(--line-1); border-left-width: 0; color: var(--text-3); }
.xq-tabs > span:first-child { border-left-width: 1px; }
.xq-tabs > span:nth-child(2) { color: var(--brass); border-color: var(--line-2); }

/* ── 类比牌 ×6：3 栏（<1024 两栏、<640 一栏）；翻面 rotateY 180°，正面黄铜像素词，背面正规术语 ── */
/* 列宽累计取整（步长 2px：牌正面像素词居中依赖偶数宽；用 nearest，奇数总宽下末列不会差 3px），末列 1fr 吃余数；
   不支持 round() 时退回 1fr（JS 兜底平移）。 */
.xq-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 64px; padding-left: 0; list-style: none; }
@supports (grid-template-columns: round(1px, 1px)) {
  .xq-cards {
    --s: calc(100% - 48px);
    --c1: round(nearest, calc(var(--s) * 1 / 3), 2px);
    --c2: round(nearest, calc(var(--s) * 2 / 3), 2px);
    grid-template-columns: var(--c1) calc(var(--c2) - var(--c1)) minmax(0, 1fr);
  }
}
@media (max-width: 1023px) {
  .xq-cards { grid-template-columns: repeat(2, 1fr); }
  @supports (grid-template-columns: round(1px, 1px)) {
    .xq-cards {
      --s: calc(100% - 24px);
      --c1: round(nearest, calc(var(--s) * 1 / 2), 2px);
      grid-template-columns: var(--c1) minmax(0, 1fr);
    }
  }
}
@media (max-width: 639px) { .xq-cards { grid-template-columns: 1fr; } }
.xcard { perspective: 1200px; min-height: 200px; }
.xcard-in { position: relative; height: 100%; min-height: 200px; transform-style: preserve-3d; }
@media (prefers-reduced-motion: no-preference) {
  .xcard-in { transition: transform 600ms var(--ease-io); }
}
.xcard.is-flipped .xcard-in { transform: rotateY(180deg); }
.xcard-face { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 24px; border: 1px solid var(--line-1); border-radius: 12px; background: var(--surface); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.xcard-front { justify-content: center; gap: 12px; align-items: center; }
/* 正面文字：小字里的分数宽度无伤大雅，只要求元素框落整数——把词与小字的宽度
   钉成 16 的倍数（像素字整数倍宽），居中两侧均分，rect 恒为整数。 */
.xcard-front .xcard-word { width: 160px; text-align: center; white-space: nowrap; }
.xcard-front .xcard-sub { width: 288px; text-align: center; white-space: nowrap; }
@media (max-width: 1279px) { .xcard-front .xcard-sub { width: 240px; } }
.xcard-back { transform: rotateY(180deg); gap: 10px; }
.xcard-word { color: var(--brass); font-size: 32px; line-height: 48px; }
.xcard-sub { color: var(--text-3); }
.xcard-term { font-size: 20px; line-height: 28px; font-weight: 600; }
.xcard-ev { display: flex; flex-wrap: wrap; gap: 6px; }
.xcard-note { margin-top: auto; color: var(--text-2); font-size: 15px; line-height: 24px; }
/* 悬停翻回正面看一眼（JS 加 .xq-peek，松手回背面） */
.xcard.is-flipped.xq-peek .xcard-in { transform: none; }

/* ── 质询笔录 ×8 ── */
.xq-qa { margin-top: 96px; padding-left: 0; list-style: none; }
.qa { position: relative; padding: 40px 0 40px 88px; border-top: 1px solid var(--line-1); }
.qa:first-child { border-top: 0; }
.qa-q { position: relative; font-size: clamp(26px, 3.2vw, 40px); line-height: 1.35; line-height: round(up, 1.35em, 1px); color: var(--text-1); }
/* 序号：等宽小字，排在问句左侧 */
.qa::before { content: attr(data-n); position: absolute; left: 0; top: 46px; width: 64px; text-align: right; color: var(--text-4); font-family: var(--f-pxm); font-size: 12px; line-height: 16px; }
.qa-a { margin-top: 20px; }
.qa-a-text { position: relative; font-size: 24px; line-height: 40px; color: var(--text-1); overflow-wrap: anywhere; }
/* 答句里的标识符：同一款像素字换 --brass（<i> 语义下被脚本换成 .qa-id） */
.qa-a-text i, .qa-a-text .qa-id { font-style: normal; color: var(--brass); }
/* 「答」前缀：黄铜色小签，浮在答句段前 */
.qa-tag { display: inline-block; margin-right: 12px; color: var(--brass); }
/* 逐字揭开：JS 在 init 里把每个字包进 <span class="c">（文字一开始就在 DOM 里），
   逐字把 opacity 揭开；打完 .is-typed 后光标藏在句末。光标 ::after 是末尾闪烁的 12×24 像素块。 */
.qa-a-text .c { white-space: pre-wrap; }
.qa-a-text::after { content: ""; display: none; width: 12px; height: 24px; margin-left: 4px; vertical-align: -4px; background: var(--brass); }
@media (prefers-reduced-motion: no-preference) {
  html.js #expedition.xq-live .qa.is-typing .qa-a-text::after { display: inline-block; animation: xq-caret .8s steps(2) infinite; }
}
@keyframes xq-caret { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }
.qa-ev { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
@media (prefers-reduced-motion: no-preference) {
  html.js #expedition.xq-live .qa-ev .ev { opacity: 0; transform: translateY(8px); transition: opacity var(--t-s) var(--ease-out), transform var(--t-s) var(--ease-out); }
  html.js #expedition.xq-live .qa.is-done .qa-ev .ev { opacity: 1; transform: none; }
}
/* 问句落下：JS 态下先 1.4 倍 + 8px 模糊 + 透明，260ms --ease-in 落到原样；
   放大态是「落下前」的预备帧，contain 在元素盒上防止 layout overflow（撑出横向滚动条）。 */
@media (prefers-reduced-motion: no-preference) {
  html.js #expedition.xq-live .qa { contain: layout; }
  html.js #expedition.xq-live .qa-q { opacity: 0; transform: scale(1.4); filter: blur(8px); transform-origin: 0 100%; }
  html.js #expedition.xq-live .qa.is-q-in .qa-q { opacity: 1; transform: none; filter: none; transition: opacity 260ms var(--ease-in), transform 260ms var(--ease-in), filter 260ms var(--ease-in); }
}
@media (max-width: 767px) {
  .qa { padding: 32px 0 32px 48px; }
  .qa::before { width: 36px; top: 38px; }
  .qa-q { font-size: 24px; }
  .qa-a-text { font-size: 24px; line-height: 40px; }
}
@media (max-width: 479px) {
  /* 360 视口内容宽 320：问句 24px 后每行约 13 字，答句 24px 像素字每行约 13 格 */
  .qa { padding-left: 0; }
  .qa::before { position: static; display: block; width: auto; text-align: left; margin-bottom: 8px; }
}
/* 答句行高钉在 40px 整倍数：行盒顶不被行内块基线推理带偏 */
.qa-a-text .c, .qa-a-text .qa-tag { line-height: 40px; }
/* 答句里 22 字符的标识符（CONTEXT_WINDOW_EXCEEDED）在 24px 像素字下 528px，
   360 视口一行放不下；允许标识符内部按字符断行（像素字每个字一格，断开不损可读）。 */
.qa-a-text .c { display: inline; }
/* 整节轻震（问句落地瞬间 160ms，±2px）：挂在节上的短动画 */
@media (prefers-reduced-motion: no-preference) {
  #expedition.is-shake { animation: xq-shake 160ms steps(1, end); }
}
@keyframes xq-shake {
  0% { transform: translate(0, 0); }
  25% { transform: translate(2px, -1px); }
  50% { transform: translate(-2px, 1px); }
  75% { transform: translate(1px, 1px); }
  100% { transform: translate(0, 0); }
}

/* ── 对照条：同一轮两套叫法 ── */
.xq-compare { width: 100%; margin-top: 96px; border-collapse: collapse; border: 1px solid var(--line-1); border-radius: 12px; overflow: hidden; display: block; }
.xq-compare thead, .xq-compare tbody { display: contents; }
.xq-compare tr { display: grid; grid-template-columns: 1fr 120px 1fr; align-items: baseline; }
/* 奇数内容宽下两侧 1fr 分出 .5 会把中列顶到半像素：首列取整，末列吃余量（两侧最多差 1px，同 .wrap 的取舍） */
@supports (grid-template-columns: round(1px, 1px)) {
  .xq-compare tr { grid-template-columns: round(down, calc((100% - 120px) / 2), 1px) 120px 1fr; }
}
.xq-compare thead tr { border-bottom: 1px solid var(--line-1); }
.xq-compare th { padding: 12px 20px; color: var(--text-3); font-size: 13px; font-weight: 400; line-height: 20px; text-align: left; }
.xq-compare th:last-child, .xq-compare td:last-child { text-align: right; }
.xq-compare td { padding: 14px 20px; border-top: 1px solid var(--line-1); font-size: 16px; line-height: 24px; color: var(--text-2); }
.xq-compare tbody tr:first-child td { border-top: 0; }
.xq-compare td:last-child { color: var(--brass); }
.xq-compare td[data-pxm] { color: var(--text-1); font-size: 16px; line-height: 24px; text-align: center; padding-inline: 8px; }
@media (max-width: 639px) {
  .xq-compare tr { grid-template-columns: 1fr 80px 1fr; }
  @supports (grid-template-columns: round(1px, 1px)) {
    .xq-compare tr { grid-template-columns: round(down, calc((100% - 80px) / 2), 1px) 80px 1fr; }
  }
  .xq-compare th, .xq-compare td { padding-inline: 12px; font-size: 14px; line-height: 22px; }
  .xq-compare td[data-pxm] { font-size: 14px; }
  /* 对照条数字（14px 时位宽 7px 是奇数，居中落在 .5）：≤639 静态右移半像素；
     有 JS 时 main.js 按实测字形覆盖；≥640 是 16px、位宽 8px，本落整数 */
  .xq-compare td[data-pxm] .snap-in { translate: .5px 0; }
}

/* ── 收尾：封蜡印盖在笔录右下方向，像素字 + 一行结论；节末留白在后面「模式」小块下面 ── */
.xq-end { position: relative; margin-top: 96px; text-align: center; }
.xq-seal { display: inline-block; }
.xq-seal img { width: 128px; height: 128px; }
.xq-ok { margin-top: 24px; color: var(--brass); }
.xq-note { margin: 20px auto 0; max-width: 560px; color: var(--text-3); font-size: 16px; line-height: 26px; }
/* 盖印：静态就是 .is-in（R10 终态，印已落）；JS 态下 init 里撤掉 .is-in 藏起，
   最后一问打完加回 .is-in + .is-falling，关键帧落定的同时 .is-in 也是检查钩子。 */
@media (prefers-reduced-motion: no-preference) {
  html.js #expedition.xq-live .xq-seal:not(.is-in) { opacity: 0; }
  html.js #expedition.xq-live .xq-seal.is-falling { animation: xq-stamp 330ms steps(1, end) both; }
}
@keyframes xq-stamp {
  0%      { transform: scale(3) translateY(-2px); opacity: .35; }
  33.333% { transform: scale(2) translateY(-1px); opacity: .7; }
  66.667% { transform: scale(1) translateY(1px);  opacity: 1; }
  100%    { transform: none; opacity: 1; }
}
/* 媒体查询从宽到窄排：后面的窄断点覆盖前面的 */
@media (max-width: 767px) { .xq-seal img { width: 96px; height: 96px; } }

/* ── 模式：经典是底座，远征内置，会议按需加入（§3.9.5；只是一小块排版，不做仿真界面）。
   离收尾 96px（各宽度一致），节末留白 160 / 120 / 96 挪到这一块下面，让它读作 07 的一部分 ── */
.xq-modes { margin-top: 96px; padding-bottom: 160px; }
.xq-modes-h { margin: 0; color: var(--text-3); }
.xq-modes-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px;
  margin: 20px 0 0; padding: 0; list-style: none;
}
/* 三列累计取整 + 末列 1fr 吃余数（内容左对齐，步长 1px）；
   不支持 round() 时退回 1fr（main.js 的字形取整兜底平移）。 */
@supports (grid-template-columns: round(1px, 1px)) {
  .xq-modes-grid {
    --s: calc(100% - 48px);
    --c1: round(down, calc(var(--s) * 1 / 3 + .05px), 1px);
    --c2: round(down, calc(var(--s) * 2 / 3 + .05px), 1px);
    grid-template-columns: var(--c1) calc(var(--c2) - var(--c1)) minmax(0, 1fr);
  }
}
.xq-mode { border: 1px solid var(--line-1); border-radius: 12px; background: var(--surface); padding: 20px 24px; }
.xq-mode-hd { display: flex; align-items: baseline; gap: 10px; margin: 0; }
.xq-mode-name { color: var(--brass); }
.xq-mode-d { margin: 10px 0 0; color: var(--text-2); font-size: 15px; line-height: 24px; }
.xq-modes-note { margin: 20px 0 0; color: var(--text-4); font-size: 14px; line-height: 22px; }
@media (max-width: 600px) {
  .xq-modes-grid { grid-template-columns: 1fr; gap: 12px; }
  .xq-mode { padding: 16px 20px; }
}
@media (max-width: 1023px) { .xq-modes { padding-bottom: 120px; } }
@media (max-width: 767px) { .xq-modes { padding-bottom: 96px; } }
