/* ============================================================
 * lecture2.css — 初期講習 3Dビュー
 *
 * 唯一にして最大の制約: **どの画面もスクロールしない**。
 * そのために守っていること:
 *   ・伸縮する 1fr は .stage だけ。他は全部 clamp() で床を持つ
 *   ・グリッドの子には必ず min-width:0 / min-height:0
 *     （これが無いと中身のサイズより小さくなれず no-scroll が破綻する）
 *   ・文字は必ず overflow:hidden ＋ 行数クランプ
 *     （和文の長文がレイアウトを押し広げるのを防ぐ）
 *   ・それでも入らない極小画面は JS が .tiny / .too-small に切り替える
 *
 * 色とコンポーネントの見た目は lecture.css と揃えてあるが、
 * @import はしない（リクエストが増え、カスケードが絡むため）。
 * ============================================================ */

@font-face {
  font-family: 'Fredoka';
  src: url('../fonts/fredoka-var.woff2') format('woff2');
  font-weight: 300 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-var.woff2') format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
}

:root {
  --blue: #3860a8;
  --blue-soft: #9dbcfb;
  --red: #e85058;
  --yellow: #f0b810;
  --cream: #f0f0d8;
  --navy: #141b2e;
  --navy-card: #1e2745;
  --ink: #161d2a;
  --muted: #55607a;

  --accent: var(--blue-soft);
  --accent-ink: #0e1424;

  --head: 'Fredoka', 'Hiragino Maru Gothic ProN', 'Hiragino Kaku Gothic ProN',
          'Yu Gothic Medium', 'Yu Gothic', 'Noto Sans JP', sans-serif;
  --body: 'Inter', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Noto Sans JP',
          system-ui, sans-serif;

  --hdr-h: clamp(40px, 6vh, 58px);
  --nav-h: clamp(48px, 7vh, 62px);
  --gap: clamp(6px, 1.2vh, 14px);
  --pad: clamp(8px, 1.6vw, 18px);
  --rail-w: clamp(230px, 22vw, 300px);
  --chip-fs: clamp(11px, calc(1.35vh + .4vw), 13px);
  --label-gutter: 0px;      /* glcore がカメラのフィット幅として読む */
  --radius: 14px;
}

.screen[data-accent="cover"] { --accent: var(--blue-soft); --accent-ink: #0e1424; }
.screen[data-accent="ray"] { --accent: #c9a6ff; --accent-ink: #17102e; }
.screen[data-accent="det"] { --accent: #cfe0ff; --accent-ink: #0e1424; }
.screen[data-accent="sig"] { --accent: var(--yellow); --accent-ink: #2b2000; }
.screen[data-accent="intro"] { --accent: var(--blue-soft); --accent-ink: #0e1424; }
.screen[data-accent="a"] { --accent: #ff7a80; --accent-ink: #2a0d10; }
.screen[data-accent="b"] { --accent: #8fb6ff; --accent-ink: #0d1730; }
.screen[data-accent="c"] { --accent: var(--yellow); --accent-ink: #2b2000; }
.screen[data-accent="d"] { --accent: #55d8c4; --accent-ink: #062a25; }

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;               /* 縦にも横にもスクロールさせない */
  overscroll-behavior: none;      /* 引っぱり更新でドラッグが奪われないように */
}
body {
  height: 100svh;                 /* 順番が大事: svh を先に、dvh で上書き */
  height: 100dvh;
  display: grid;
  grid-template-rows: var(--hdr-h) 1fr var(--nav-h);
  background: var(--navy);
  color: #e6ecfa;
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  font-feature-settings: "palt" 1;
}
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
:focus-visible { outline: 2.5px solid var(--yellow); outline-offset: 2px; border-radius: 6px; }
button { font: inherit; color: inherit; }

/* ─── ヘッダー ─────────────────────────────────────── */
.hdr {
  display: grid;
  grid-template-columns: auto 1fr auto auto;   /* ブランド / 見出し / 手順 / 言語 */
  align-items: center;
  gap: var(--pad);
  padding: 0 var(--pad);
  min-width: 0;
  background: #101728;
  border-bottom: 1px solid rgba(157, 188, 251, .16);
}
.brand { display: flex; align-items: center; gap: .4rem; text-decoration: none; color: inherit; min-width: 0; }
.brand-mark { font-size: 1.1rem; line-height: 1; }
.brand-txt {
  font-family: var(--head); font-weight: 600; font-size: .9rem;
  display: flex; flex-direction: column; line-height: 1.15; white-space: nowrap;
}
.brand-txt i { font-style: normal; font-size: .62rem; font-weight: 400; color: #8fa2c8; letter-spacing: .1em; }
.ttl {
  margin: 0; min-width: 0;
  font-family: var(--head); font-weight: 600;
  font-size: clamp(.95rem, 2.2vh, 1.2rem);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.manual {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .3rem .7rem; border-radius: 999px;
  border: 1px solid rgba(157, 188, 251, .3);
  color: #cdd8ef; text-decoration: none; white-space: nowrap;
  font-size: .78rem; transition: background .16s, border-color .16s;
}
.manual:hover { background: rgba(157, 188, 251, .12); border-color: var(--blue-soft); }
.manual b { font-family: var(--head); }

/* ─── 言語切り替え（右上の国旗） ─────────────────────
   絵文字の国旗は Windows で表示されないので旗はSVGで描いてある。
   選んでいない方は薄く落とすだけにして、幅は変えない（揺れを防ぐ）。 */
.langsw {
  display: flex; align-items: center; gap: 3px;
  padding: 2px; border-radius: 999px;
  background: rgba(157, 188, 251, .07);
  border: 1px solid rgba(157, 188, 251, .18);
}
.langsw button {
  display: grid; place-items: center;
  width: 32px; height: 22px; padding: 0;
  border: 0; border-radius: 999px; background: none;
  cursor: pointer; opacity: .42;
  transition: opacity .16s, background .16s;
}
.langsw button:hover { opacity: .85; background: rgba(157, 188, 251, .14); }
.langsw button[aria-pressed="true"] {
  opacity: 1;
  background: rgba(157, 188, 251, .2);
  box-shadow: inset 0 0 0 1px rgba(157, 188, 251, .5);
}
.langsw svg {
  display: block; width: 21px; height: 14px; border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .3);
}

/* ─── デッキと画面 ─────────────────────────────────── */
.deck { position: relative; min-height: 0; min-width: 0; }
.screen { position: absolute; inset: 0; display: none; }
.screen.on {
  display: grid;
  grid-template-columns: 1fr var(--rail-w);
  grid-template-rows: auto 1fr;
  gap: var(--gap);
  padding: var(--gap) var(--pad);
  min-height: 0; min-width: 0;
}
.premise {
  grid-column: 1 / -1;
  margin: 0; min-width: 0;
  color: #b9c6e2;
  font-size: clamp(.8rem, 1.9vh, 1rem);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.premise b { color: #fff; font-family: var(--head); font-weight: 600; }

.stage {
  position: relative;
  min-width: 0; min-height: 140px;
  border-radius: var(--radius);
  background: radial-gradient(120% 90% at 50% 0%, #27324f 0%, #161f38 60%, #121a2f 100%);
  overflow: hidden;
}
.rail {
  min-width: 0; min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: var(--gap);
  overflow: hidden;
}

/* ─── HUD（読み出し） ──────────────────────────────── */
.hud { display: grid; gap: 5px; min-height: 0; min-width: 0; overflow: hidden; align-content: start; }
.ro {
  background: rgba(255, 255, 255, .06);
  border-left: 3px solid var(--roc, var(--accent));
  border-radius: 10px;
  padding: .35rem .6rem;
  min-width: 0; min-height: 0; overflow: hidden;
}
.ro-h {
  margin: 0; font-family: var(--head); font-size: .66rem; letter-spacing: .08em;
  color: #93a3c4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ro-v {
  margin: 0; font-family: var(--head); font-size: clamp(.95rem, 2.1vh, 1.15rem);
  font-weight: 600; color: #fff; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ro-v small { font-size: .62em; font-weight: 400; color: #b6c4e2; margin-left: .25em; }
.ro-s {
  margin: 0; font-size: .7rem; color: #93a3c4; line-height: 1.35;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

.chartbox { min-height: 0; min-width: 0; overflow: hidden; display: grid; align-content: start; }
.chartbox svg { display: block; width: 100%; height: auto; max-height: 100%; }

/* ENGINE.Chart（課題A〜Dの予測グラフ）が吐く SVG。
   engine.js は class を付けるだけで色を持たないので、指定はここだけ。
   これが無いと text は SVG 既定の黒、line は stroke:none で消える。
   viewBox 300×205 が幅230〜300pxのレールに入る＝ほぼ等倍。
   font-size は最終的な見え方が10〜14px になる値。 */
.chart .ax { stroke: rgba(157, 188, 251, .34); stroke-width: 1.2; }
.chart .grid { stroke: rgba(157, 188, 251, .12); stroke-width: 1; }
.chart .axtxt { fill: #a3b4d8; font-family: var(--body); font-size: 13px; }
.chart .axname { fill: #c3d0ea; font-family: var(--head); font-size: 14px; font-weight: 500; }
.chart .hint { fill: #93a3c4; font-family: var(--body); font-size: 12.5px; }

/* ─── コントロール ─────────────────────────────────── */
.ctlbox { display: grid; gap: 5px; min-width: 0; min-height: 0; align-content: end; }
.ctl-row { display: flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; }
.ctl-label {
  font-family: var(--head); font-size: .62rem; letter-spacing: .1em;
  color: #8fa2c8; white-space: nowrap;
}
.ctl-group {
  display: inline-flex; background: rgba(255, 255, 255, .07);
  border-radius: 999px; padding: 2px; gap: 2px; min-width: 0; flex-wrap: wrap;
}
.ctl-group button {
  min-height: 30px; padding: .2rem .62rem;
  font-family: var(--head); font-size: .8rem; font-weight: 500;
  color: #cdd8ef; background: transparent; border: 0; border-radius: 999px;
  cursor: pointer; white-space: nowrap;
  transition: background .14s, color .14s;
}
.ctl-group button:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.ctl-group button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-main {
  flex: 1 1 auto; min-height: 34px; padding: .3rem 1rem;
  font-family: var(--head); font-size: .88rem; font-weight: 600;
  background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: 999px; cursor: pointer;
  transition: filter .14s;
}
.btn-main:hover { filter: brightness(1.08); }
.btn-main[disabled] { opacity: .45; cursor: default; filter: none; }
.btn-ghost {
  min-height: 30px; padding: .2rem .7rem;
  font-family: var(--head); font-size: .78rem;
  background: transparent; color: #b9c6e2;
  border: 1px solid rgba(255, 255, 255, .22); border-radius: 999px; cursor: pointer;
}
.btn-ghost:hover { border-color: rgba(255, 255, 255, .45); color: #fff; }
.ctl-toggle {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .74rem; color: #cdd8ef; cursor: pointer; white-space: nowrap;
}
.ctl-toggle input { width: 1em; height: 1em; accent-color: var(--accent); cursor: pointer; }
.meter { height: 4px; border-radius: 999px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; }
.simlog {
  margin: 0; font-size: .7rem; color: #93a3c4; line-height: 1.3;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* ─── 扉（課題一覧） ───────────────────────────────
   s-cover だけの専用レイアウト。WebGL は使わない（data-scene なし）。
   ここでも no-scroll の約束は同じ: 伸縮する 1fr はカードグリッドだけ。 */
.screen.cover.on {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr);   /* 前提文 / ステップ行 / カード */
}
.cover-steps,
.cover-grid { justify-self: center; width: min(100%, 940px); min-width: 0; }
/* 「まず、しくみを知る」の3ステップ。課題カードの上に横一列で置き、
   順番そのものが「理解 → 測定」の道筋になっている。 */
.cover-steps {
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 6px;
}
.cover-steps-lead {
  font-family: var(--head); font-weight: 600; font-size: .7rem;
  letter-spacing: .1em; color: #8fa2c8; white-space: nowrap;
  margin-right: .2rem;
}
.cover-step {
  display: inline-flex; align-items: center; gap: .45rem;
  min-height: clamp(32px, 5.2vh, 42px); padding: .3rem 1rem;
  min-width: 0; max-width: 100%;
  background: var(--blue-soft); color: #0e1424;
  border: 0; border-radius: 999px; cursor: pointer;
  font-family: var(--head); font-weight: 600; font-size: clamp(.82rem, 1.9vh, .98rem);
  transition: filter .14s, transform .16s;
}
.cover-step:hover { filter: brightness(1.08); transform: translateY(-1px); }
.cover-step em {
  display: grid; place-items: center; flex: 0 0 auto;
  width: 1.35em; height: 1.35em; border-radius: 50%;
  font-style: normal; font-size: .78em; line-height: 1;
  background: #0e1424; color: var(--blue-soft);
}
.cover-step span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 宇宙線＝紫、信号処理＝黄。ナビと画面のアクセントに合わせておく */
.cover-step[data-go="s-cosmic"] { background: #c9a6ff; color: #17102e; }
.cover-step[data-go="s-cosmic"] em { background: #17102e; color: #c9a6ff; }
.cover-step[data-go="s-sig"] { background: var(--yellow); color: #2b2000; }
.cover-step[data-go="s-sig"] em { background: #2b2000; color: var(--yellow); }

.cover-grid {
  display: grid; gap: var(--gap); min-height: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}
/* カード = 絵が全面、その上に文字。
   絵は xMidYMid slice で容器を覆う（縦横比が変わったら中央基準で切れる）。 */
.cover-card {
  position: relative;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 0; min-width: 0; min-height: 0; overflow: hidden;
  text-align: left;
  background: var(--navy-card);
  border: 1px solid rgba(157, 188, 251, .16);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius); cursor: pointer;
  transition: transform .16s, border-color .16s, box-shadow .16s;
}
.cover-card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 6px 22px rgba(0, 0, 0, .35); }
.cover-card[data-accent="a"] { --accent: #ff7a80; }
.cover-card[data-accent="b"] { --accent: #8fb6ff; }
.cover-card[data-accent="c"] { --accent: var(--yellow); }
.cover-card[data-accent="d"] { --accent: #55d8c4; }
.cover-ico {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; pointer-events: none;
  transform-origin: 50% 50%;
  transition: transform .5s ease;
}
.cover-card:hover .cover-ico { transform: scale(1.05); }
.cover-txt {
  position: relative; z-index: 1;
  display: grid; gap: 2px; min-width: 0;
  padding: clamp(18px, 3.5vh, 30px) var(--pad) clamp(8px, 1.6vh, 14px);
  background: linear-gradient(to top,
    rgba(13, 18, 33, .96) 0%, rgba(13, 18, 33, .62) 55%, rgba(13, 18, 33, 0) 100%);
}
.cover-txt em {
  font-style: normal; font-family: var(--head); font-size: .62rem;
  letter-spacing: .14em; color: var(--accent);
}
.cover-ttl {
  font-family: var(--head); font-weight: 600; color: #fff;
  font-size: clamp(1.05rem, 2.8vh, 1.4rem);
  text-shadow: 0 1px 6px rgba(0, 0, 0, .55);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cover-sub {
  font-size: clamp(.72rem, 1.7vh, .85rem); color: #b9c6e2; line-height: 1.45;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .5);
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* ─── 扉カードのアニメ ─────────────────────────────
   絵の要素は「静止画として成立する位置」に置いてあり、キーフレームは
   そこからの相対移動だけを持つ。?static（.no-anim）や動き抑制で
   アニメが切れると、素の配置がそのまま説明図になる。
   フラッシュのピーク % は、対応する粒子が検出器を横切る時刻に合わせてある。 */
.cover-ico .tb { transform-box: fill-box; transform-origin: center; }
.cover-ico .cov-mu    { animation: cov-fall 2.6s linear infinite; }
.cover-ico .cova-flash { animation: cova-flash 2.6s linear infinite; }
.cover-ico .covb-mu   { animation: covb-fly 2.8s linear infinite; }
.cover-ico .covb-flash { animation: covb-flash 2.8s linear infinite; }
.cover-ico .covc-beta  { animation: covc-beta 2s linear infinite; }
.cover-ico .covc-stop  { animation: covc-stop 2s linear infinite; }
.cover-ico .covc-gamma { animation: covc-gamma 2s linear infinite; }
.cover-ico .covc-flash { animation: covc-flash 2s linear infinite; }
.cover-ico .covc-glow  { animation: cov-glow 3.2s ease-in-out infinite; }
.cover-ico .covd-ring  { animation: covd-ring 2.7s linear infinite; }
.cover-ico .covd-p     { animation: covd-p 2.4s linear infinite; }
.cover-ico .covd-hit   { animation: covd-hit 2.4s linear infinite; }
.cover-ico .covd-flash { animation: covd-flash 2.4s linear infinite; }
.no-anim .cover-ico, .no-anim .cover-ico * { animation: none !important; }

@keyframes cov-fall { from { transform: translateY(-210px); } to { transform: translateY(230px); } }
@keyframes covb-fly { from { transform: translate(77px, -151px); } to { transform: translate(-93px, 182px); } }
@keyframes cova-flash {
  0%, 38%   { opacity: 0; transform: scale(.5); }
  46%       { opacity: .95; transform: scale(1.15); }
  60%       { opacity: .15; transform: scale(1.3); }
  66%, 100% { opacity: 0; transform: scale(.5); }
}
@keyframes covb-flash {
  0%        { opacity: 0; transform: scale(.5); }
  6%        { opacity: .9; transform: scale(1.1); }
  16%       { opacity: 0; transform: scale(.6); }
  50%       { opacity: 0; transform: scale(.5); }
  56%       { opacity: .9; transform: scale(1.1); }
  66%, 100% { opacity: 0; transform: scale(.6); }
}
@keyframes covc-beta {
  0%   { transform: translateX(-30px); opacity: .95; }
  46%  { transform: translateX(30px); opacity: .95; }
  54%  { transform: translateX(36px); opacity: 0; }
  100% { transform: translateX(36px); opacity: 0; }
}
@keyframes covc-stop {
  0%   { opacity: .6; transform: scale(1.1); }
  10%  { opacity: 0; transform: scale(1.5); }
  42%  { opacity: 0; transform: scale(.5); }
  50%  { opacity: .6; transform: scale(1.1); }
  60%  { opacity: 0; transform: scale(1.5); }
  92%  { opacity: 0; transform: scale(.5); }
  100% { opacity: .6; transform: scale(1.1); }
}
@keyframes covc-gamma {
  0%   { transform: translateX(-38px); opacity: .95; }
  76%  { transform: translateX(94px); opacity: .95; }
  82%  { transform: translateX(102px); opacity: 0; }
  100% { transform: translateX(102px); opacity: 0; }
}
@keyframes covc-flash {
  0%, 22%   { opacity: 0; transform: scale(.5); }
  28%       { opacity: .9; transform: scale(1.1); }
  38%       { opacity: 0; transform: scale(.6); }
  72%       { opacity: 0; transform: scale(.5); }
  78%       { opacity: .9; transform: scale(1.1); }
  88%, 100% { opacity: 0; transform: scale(.6); }
}
@keyframes cov-glow {
  0%, 100% { opacity: .14; transform: scale(.9); }
  50%      { opacity: .3; transform: scale(1.1); }
}
@keyframes covd-ring {
  from { transform: scale(.22); opacity: .85; }
  to   { transform: scale(3); opacity: 0; }
}
@keyframes covd-p {
  0%   { transform: translateX(-30px); opacity: .85; }
  55%  { transform: translateX(55px); opacity: 0; }
  100% { transform: translateX(55px); opacity: 0; }
}
@keyframes covd-hit {
  0%   { transform: translateX(-30px); opacity: .95; }
  80%  { transform: translateX(105px); opacity: .95; }
  85%  { transform: translateX(112px); opacity: 0; }
  100% { transform: translateX(112px); opacity: 0; }
}
@keyframes covd-flash {
  0%, 26%   { opacity: 0; transform: scale(.5); }
  32%       { opacity: .9; transform: scale(1.1); }
  42%       { opacity: 0; transform: scale(.6); }
  76%       { opacity: 0; transform: scale(.5); }
  82%       { opacity: .9; transform: scale(1.1); }
  92%, 100% { opacity: 0; transform: scale(.6); }
}

/* ═══ 準備1・2 のレール共通: 段カード ═══════════════
   4段の解説カード。演出が進むにつれて JS が .is-on を付け、
   「いま何が起きているか」が絵と言葉で同時に光る。
   消えている段も読める明るさは残す（先の見通しが立つように）。 */
.ro.step {
  border-left-color: var(--roc, rgba(157, 188, 251, .35));
  opacity: .55;
  transition: opacity .25s, background .25s, border-left-color .25s;
}
.ro.step.is-on { opacity: 1; background: rgba(255, 255, 255, .11); }
.ro.step .ro-v { font-size: clamp(.86rem, 1.9vh, 1.02rem); }
.ro.step .ro-s { -webkit-line-clamp: 3; }
.ro.step[data-fx="muon"],    .ro.step[data-sg="raw"]    { --roc: #ffffff; }
.ro.step[data-fx="photons"], .ro.step[data-sg="amp"]    { --roc: #cfe0ff; }
.ro.step[data-fx="pulse"],   .ro.step[data-sg="hold"]   { --roc: var(--yellow); }
.ro.step[data-fx="oled"]                                { --roc: var(--yellow); }
.ro.step[data-sg="detect"]                              { --roc: var(--red); }
/* 準備1: 幕の色と揃える（起源＝紫、届く＝青、砕ける＝黄、残る＝ミュオンの青） */
.ro.step[data-cs="born"]   { --roc: #c9a6ff; }
.ro.step[data-cs="reach"]  { --roc: var(--blue-soft); }
.ro.step[data-cs="shower"] { --roc: var(--yellow); }
.ro.step[data-cs="ground"] { --roc: #8fb6ff; }
/* 段カードのあとに置く一言。レールの 1fr 行に入るので必ず行数を切る */
.railnote {
  margin: 0; align-self: start;
  font-size: .72rem; line-height: 1.45; color: #93a3c4;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical;
}
.railnote b { color: #dfe7f8; font-family: var(--head); font-weight: 600; }

/* ═══ 準備1: 宇宙線とは（cosmic2.js）═══════════════
   超新星で生まれた粒子1個を、手のひらまで**切らずに**追う1枚の <svg>。
   viewBox は実ピクセル（円がつぶれない）。場面の切り替えは無く、
   カメラの倍率が 20 桁ぶん連続で変わるだけ。
   レールは4行 — 行程表 / いまの解説 / 成分比グラフ / つまみ。 */
#s-cosmic .rail { grid-template-rows: auto auto minmax(0, 1fr) auto; }
/* グラフは「余った高さに収める」。viewBox 固定＋meet なので、
   狭ければ縮むだけで切れない（.chartbox の共通ルールだと縦にはみ出す） */
#chart-cosmic { align-content: stretch; }
#chart-cosmic svg { width: 100%; height: 100%; max-height: none; }
#cosmicray {
  /* いちばん外側は宇宙の闇。地球も大気も svg 側が描く */
  background: #05070f;
}
#cosmicray > svg { position: absolute; inset: 0; display: block; }

/* ── 旅の行程表 ──
   縦に6章。済んだ章は点が埋まり、現在地が光る。行を押すとそこへ飛ぶ。
   点と点は縦線でつながっていて、これ自体が「1本の旅」の絵になっている。 */
.cos-track {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 0; min-width: 0;
}
.cos-track li { position: relative; min-width: 0; }
/* 連結線。最後の行の下には引かない */
.cos-track li:not(:last-child)::before {
  content: ''; position: absolute; left: 5px; top: 50%; bottom: -50%;
  width: 2px; background: rgba(157, 188, 251, .22);
}
.cos-track button {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: .5em;
  width: 100%; min-width: 0; padding: .18em .3em;
  background: none; border: 0; border-radius: 7px; cursor: pointer;
  text-align: left; color: #8fa2c8;
  font-family: var(--head); font-weight: 600;
  font-size: clamp(.68rem, 1.6vh, .82rem); line-height: 1.25;
  transition: color .2s, background .2s;
}
.cos-track button i {
  flex: 0 0 auto; width: 12px; height: 12px; border-radius: 50%;
  background: var(--navy); box-shadow: inset 0 0 0 2px rgba(157, 188, 251, .35);
  transition: background .25s, box-shadow .25s, transform .25s;
}
.cos-track button span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cos-track button:hover { color: #dfe7f8; background: rgba(157, 188, 251, .08); }
.cos-track .done { color: #b8c6e4; }
.cos-track .done i { background: #7d6bb0; box-shadow: inset 0 0 0 2px #7d6bb0; }
.cos-track .on { color: #fff; background: rgba(201, 166, 255, .14); }
.cos-track .on i { background: #c9a6ff; box-shadow: inset 0 0 0 2px #c9a6ff, 0 0 0 3px rgba(201, 166, 255, .25); transform: scale(1.15); }
.no-anim .cos-track button, .no-anim .cos-track button i { transition: none; }

/* いまの章の解説。章が変わると入れ替わる */
.cos-now {
  margin: 0; align-self: start;
  font-size: .74rem; line-height: 1.45; color: #a9b7d4;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.cos-now b { color: #dfe7f8; font-family: var(--head); font-weight: 600; }

/* キャプション。旅の該当区間だけ出る（.on は cosmic2.js が付ける） */
.cos-cap {
  position: absolute; top: 0; left: 0; margin: 0;
  pointer-events: none; opacity: 0; max-width: 17ch;
  font-family: var(--head); font-weight: 700;
  font-size: clamp(.6rem, 1.5vh, .8rem); line-height: 1.25;
  padding: 1px 6px; border-radius: 6px;
  color: #eef2fc; background: rgba(6, 10, 20, .74);
  transition: opacity .45s;
}
.cos-cap.on { opacity: 1; }
.cos-cap.k-em { color: var(--yellow); }
.cos-cap.k-mu { color: #8fb6ff; }
.cos-cap.k-au { color: #7df0c0; }
.cos-cap.k-hot { color: #ffd9a0; }
.no-anim .cos-cap { transition: none; }

/* ── 宇宙 ── */
.cr-star { fill: #dbe4fb; }
.cr-milky { fill: url(#cr-milky-grad); }
.cr-sn-core { fill: #f4ecff; }
.cr-sn-glow { fill: url(#cr-glow-sn); }
.cr-sn-ring { fill: none; stroke: #c9a6ff; stroke-width: 1.4; }
/* 加速が起きている面。ここを何度も横切ることで速くなる */
.cr-shock { fill: none; stroke: #ffd9a0; stroke-width: 2.6; }
/* 行ったり来たりの軌跡。往復のたびに振れ幅が大きくなる＝速くなっている */
.cr-fermi { fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cr-snhit { fill: #ffb454; stroke: #2a1c0a; stroke-width: 1.2; }
.cr-gauge-bg { fill: rgba(255, 255, 255, .14); }
.cr-gauge-fill { fill: #ffd9a0; }
.cr-gauge-l { fill: #b8c6e4; font-family: var(--head); }
.cr-gauge-t { fill: #ffd9a0; font-family: var(--head); font-weight: 700; }
.cr-field { fill: none; stroke: #6a7ba6; stroke-width: 1; stroke-dasharray: 3 7; }
.cr-sun { fill: #ffcf5a; }
.cr-sun-glow { fill: url(#cr-glow-sun); }
.cr-wind { stroke: #ffcf5a; stroke-width: 1.4; stroke-linecap: round; }
/* フレアで噴き出すぶんは、太陽風より速く・明るく */
.cr-wind.k-flare { stroke: #fff0c0; stroke-width: 2.4; }
.cr-flare-arc { fill: none; stroke: #fff0c0; stroke-linecap: round; }

/* ── 地球と大気。点 → 球 → 地面と、同じものが育つ ── */
.cr-earth { fill: url(#cr-earth-grad); }
.cr-ground { fill: #1d2740; }
.cr-atm { fill: url(#cr-air-grad); stroke: url(#cr-air-grad); }
.cr-limb { fill: none; stroke: rgba(157, 188, 251, .45); stroke-width: 1.4; }

/* ── 磁気圏 ── */
.cr-dip { fill: none; stroke: #9dbcfb; stroke-width: 1.2; }
.cr-bow { fill: none; stroke: #7df0c0; stroke-width: 1.6; stroke-dasharray: 6 5; }
.cr-aur { fill: none; stroke: #7df0c0; stroke-width: 3.4; stroke-linecap: round; }
.cr-defl { stroke: #9dbcfb; stroke-width: 1.6; stroke-linecap: round; }
.cr-defl.k-pole { stroke: #7df0c0; }

/* ── 大気の中 ── */
.cr-axis line { stroke: rgba(157, 188, 251, .13); stroke-width: 1; }
.cr-axis text { fill: #8fa2c8; font-family: var(--head); }
/* 枝。色は成分そのもの — ハドロン白、e・γ 黄、ミュオン青、ν 緑の点線 */
.cr-seg { fill: none; stroke-linecap: round; }
.cr-k-pri { stroke: #ffffff; }
.cr-k-had { stroke: #dfe7f8; }
.cr-k-em { stroke: #f0b810; opacity: .92; }
.cr-k-mu { stroke: #8fb6ff; }
.cr-k-nu { stroke: #55d8c4; opacity: .45; stroke-dasharray: 2 5; }
.cr-hit { fill: #fff3c4; }
/* 追っている粒子の高さに敷く「その高度の成分比」。
   レールのグラフが落ちる縦長画面でも、これがあるので情報は消えない。 */
.cr-cursor rect { opacity: .92; }
.cr-cursor text { font-family: var(--head); font-weight: 700; }

/* ── 地表 ── */
.cr-palm { fill: rgba(201, 166, 255, .1); stroke: #c9a6ff; stroke-width: 1.6; stroke-dasharray: 6 4; }
.cr-dim { fill: none; stroke: #8fa2c8; stroke-width: 1.2; }
.cr-dim-t { fill: #8fa2c8; font-family: var(--head); }
.cr-flash { fill: #cfe0ff; }

/* ── 追っている粒子。これだけは最初から最後まで消えない ── */
.cr-trail { fill: none; stroke-width: 2.2; stroke-linecap: round; }
.cr-head { filter: drop-shadow(0 0 4px rgba(255, 255, 255, .8)); }

/* ── 成分比グラフ（レール） ── */
.cr-chart { overflow: visible; }
/* 入れ替えは cosmic2.js が毎フレーム opacity を書く。CSS の transition を
   足すと二重に効いて、重なったまま両方見える瞬間ができる。 */
.cr-ch-h { fill: #8fa2c8; font-family: var(--head); font-size: 22px; letter-spacing: .06em; }
.cr-ch-l { fill: #dfe7f8; font-family: var(--body); font-size: 22px; }
.cr-ch-v { font-family: var(--head); font-weight: 700; font-size: 24px; }
.cr-ch-t { fill: #7f8db0; font-family: var(--head); font-size: 18px; }
.cr-ch-n { fill: #0e1424; font-family: var(--head); font-weight: 700; font-size: 20px; }
.cr-ch-grid { stroke: rgba(255, 255, 255, .18); stroke-width: 1; }
.cr-ch-cur line { stroke: #fff; stroke-width: 2; }
.cr-ch-cur text { font-family: var(--head); font-weight: 700; font-size: 19px; }

/* ── 旅のつまみ ──
   .sig-amp と同じ組み方。距離の読み出しを大きく置くのがこの画面の要で、
   「いまどれくらい遠いか」が 1000光年 → au → km → cm と連続で変わる。 */
.cos-alt {
  display: grid; grid-template-columns: auto 1fr;
  align-items: baseline; column-gap: .5em; row-gap: 1px;
  padding: .3em .55em; border-radius: 12px;
  background: rgba(201, 166, 255, .1);
  border: 1px solid rgba(201, 166, 255, .3);
}
.cos-lab {
  margin: 0; font-family: var(--head); font-weight: 600;
  font-size: .72rem; line-height: 1.2; color: #d9c8ff; white-space: nowrap;
}
.cos-alt .cos-slider { grid-column: 1 / -1; }
.cos-slider::-webkit-slider-thumb { background: #c9a6ff; }
.cos-slider::-moz-range-thumb { background: #c9a6ff; }
.cos-out {
  margin: 0; min-width: 0; text-align: right;
  font-size: .72rem; line-height: 1.25; color: #93a3c4;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.cos-out b {
  font-family: var(--head); font-weight: 700;
  font-size: 1.02rem; color: #eadcff;
}
#s-cosmic .btn-main { flex: 0 1 auto; min-width: 6.5em; }

/* ═══ 準備2: 検出器のしくみ（exploded2.js）═══════════
   ステージいっぱいのキャンバス＋SVGのリーダー線＋HTMLのラベル。
   キャンバスは透過なので、背景は .stage のグラデーションがそのまま出る。 */
.xv-wrap { position: relative; }
#xv-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.xv-leaders {
  position: absolute; inset: 0; width: 100%; height: 100%;
  /* hidden: 宇宙線の軌跡はモデルより長く、はみ出したぶんは切る */
  pointer-events: none; overflow: hidden; color: var(--blue-soft);
}
/* 左右の余白はここで決める。exploded2.js が offsetLeft で読み直すので、
   数値を JS 側に書き写す必要はない */
.xv-caps { position: absolute; inset: 0 10px; pointer-events: none; }
.xv-cap {
  position: absolute; top: 0; margin: 0;
  font-family: var(--head); font-weight: 600;
  font-size: clamp(.6rem, 1.5vh, .8rem); line-height: 1.25;
  /* 和文は1文字 ≒ 2ch。狭すぎると「同時計測ポー／ト」のように割れる */
  color: #eef2fc; max-width: 15ch;
  text-shadow: 0 1px 6px rgba(10, 14, 26, .9);
  opacity: 0;                       /* exploded2.js が毎フレーム動かす */
  will-change: transform, opacity;
}
.xv-cap[data-side="L"] { left: 0;  text-align: right; }
.xv-cap[data-side="R"] { right: 0; text-align: left; }
.xv-cap.on { opacity: 1; }          /* ?static / JS なしの経路 */

/* 検出の実況。3D 上の「そこで起きている場所」に毎フレーム貼り直されるので
   left/top は 0 のまま、transform だけで動く */
.xv-steps { position: absolute; inset: 0; pointer-events: none; }
.xv-step {
  position: absolute; left: 0; top: 0; margin: 0; white-space: nowrap;
  font-family: var(--head); font-weight: 600;
  font-size: clamp(.62rem, 1.6vh, .84rem); line-height: 1; opacity: 0;
  text-shadow: 0 2px 10px rgba(10, 14, 26, .95), 0 0 22px rgba(10, 14, 26, .8);
  will-change: transform, opacity;
}
.s-muon { color: #ffffff; }
.s-light { color: #cfe0ff; }
.s-sig, .s-count { color: var(--yellow); }

/* 検出アニメ: 宇宙線 → シンチ光 → SiPM → Arduino。
   青は光、黄は電気。センサーから先は光ではなく信号、という色分け。
   線は必ず2度描く（太くて淡いハロー＋細くて明るい芯）＝安いグロー。 */
.xv-fx { pointer-events: none; }
.xv-fx path { stroke-linecap: round; stroke-linejoin: round; }
.fx-muon.fx-halo { stroke: #cfe0ff; stroke-width: 12; }
.fx-muon.fx-core { stroke: #ffffff; stroke-width: 3; }
.fx-ray.fx-halo { stroke: #7fa8ff; stroke-width: 11; }
.fx-ray.fx-core { stroke: #dbe8ff; stroke-width: 2.6; }
.fx-sig.fx-halo { stroke: var(--yellow); stroke-width: 14; }
.fx-sig.fx-core { stroke: #ffe89a; stroke-width: 3.6; }
.fx-head { fill: #fff3c4; stroke: var(--yellow); stroke-width: 5; stroke-opacity: .35; }
.fx-muon-head { fill: #ffffff; stroke: #cfe0ff; stroke-width: 7; stroke-opacity: .35; }
.fx-burst { fill: none; stroke: #dbe8ff; stroke-width: 3; }

/* WebGL が無い端末だけ（exploded2.js が .xv-fallback を付ける） */
.xv-poster { display: none; }
.xv-fallback .xv-poster {
  display: block; position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: contain;
}
.xv-fallback .xv-caps, .xv-fallback .xv-steps { display: none; }
/* 静止画には「もう一度」も「ドラッグで回せます」も無い（JSが .xv-nogl を付ける） */
.xv-nogl .ctlbox { display: none; }

/* ═══ 準備3: 信号処理（sigchain2.js）═══════════════
   1枚の <svg> に上段レーンと下段ヒストグラムを縦積みしてある。
   取れたピーク値がレーンからビンへ「落ちる」ので、2つを別々の SVG には
   できない。意味を持つラベルだけ HTML のオーバーレイにして、viewBox の
   非等方スケールで文字が潰れないようにしている。 */
/* viewBox は 300×300 を preserveAspectRatio="none" で引き伸ばす作りなので、
   ステージいっぱいに広げると横に伸びすぎて波形の形が嘘になる。
   高さを基準に 4:3 までで頭打ちにし、余った横は地のまま残す
   （グラフ自身が下敷きを持つので、計測器の画面が嵌まって見える）。 */
#sigchain { display: grid; justify-items: center; align-items: stretch; }
.sig-graph {
  position: relative; width: auto; aspect-ratio: 4 / 3; max-width: 100%;
  border-radius: var(--radius);
  /* 平らな地のほうがグラフは読みやすい。真っ黒にはしない（地続きに見せる） */
  background: rgba(10, 14, 26, .5);
  box-shadow: inset 0 0 0 1px rgba(157, 188, 251, .1);
  overflow: hidden;
}
.sig-graph svg { display: block; width: 100%; height: 100%; }
.sig-ov {
  position: absolute; margin: 0; pointer-events: none; white-space: nowrap;
  font-family: var(--head); font-weight: 600;
  font-size: clamp(.62rem, 1.6vh, .82rem); line-height: 1;
  text-shadow: 0 1px 6px rgba(10, 14, 26, .9);
}
/* レーンの天井。増幅率を上げるとパルスがここまで伸びる、という目盛り */
.sig-ov-full { top: 1.2%; left: 8px; color: #7f8db0; font-weight: 500; }
.sig-ov-hist { top: 51.5%; left: 8px; color: #eef2fc; }
/* 2つの領域ラベルは山の真下に付き、増幅率と一緒に動く（位置は JS） */
.sig-ov-gamma, .sig-ov-cosmic { transform: translateX(-50%); font-weight: 700; }
.sig-ov-gamma { color: var(--yellow); }
.sig-ov-cosmic { color: var(--blue-soft); }

/* 各線のキャプション。線が描かれる順に1つずつ出る（不透明度は JS が毎フレーム）。
   後ろの線に重なっても読めるよう、薄い下敷きを敷く。 */
.sig-cap {
  position: absolute; top: 0; left: 0; margin: 0;
  pointer-events: none; white-space: nowrap; opacity: 0;
  font-family: var(--head); font-weight: 700;
  font-size: clamp(.6rem, 1.5vh, .8rem); line-height: 1;
  padding: 1px 5px; border-radius: 5px;
  background: rgba(10, 14, 26, .68);
  will-change: transform, opacity;
}
.sig-cap-raw    { color: var(--blue-soft); }
.sig-cap-amp    { color: var(--yellow); }
.sig-cap-hold   { color: #6ee7a8; }
.sig-cap-detect { color: #f6979d; }

/* 線とバー。すべて vector-effect="non-scaling-stroke" が付いているので
   （sigchain2.js 参照）、箱の縦横比が変わっても線幅は実 px のまま。 */
.sg-axis  { stroke: rgba(157, 188, 251, .28); stroke-width: 1; }
.sg-full  { stroke: rgba(157, 188, 251, .2); stroke-width: 1; stroke-dasharray: 2 5; }
.sg-div   { stroke: rgba(157, 188, 251, .16); stroke-width: 1; stroke-dasharray: 2 4; }
.sg-tick  { stroke: rgba(157, 188, 251, .35); stroke-width: 1; }
/* .sg-bar の fill はビンごとに JS が決める（γ/β=黄・宇宙線=青・他=灰） */
.sg-raw   { stroke: var(--blue-soft); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.sg-amp   { stroke: var(--yellow); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.sg-hold  { stroke: #6ee7a8; stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }
.sg-peak  { stroke: #fff3c4; stroke-width: 6.5; }
.sg-thr   { stroke: var(--red); stroke-width: 1.8; stroke-dasharray: 7 6; }   /* レーン: 横 */
.sg-thr-v { stroke: var(--red); stroke-width: 1.6; stroke-dasharray: 5 5; opacity: .6; }  /* ヒスト: 縦 */
.sg-token { stroke: #fff3c4; stroke-width: 7; }   /* ビンへ落ちるピーク */

/* 増幅率がこの画面の主役のつまみ。大きな ×N とスライダーで一組。 */
.sig-amp {
  display: grid; grid-template-columns: auto 1fr;
  align-items: center; column-gap: .5em; row-gap: 3px;
  padding: .3em .55em; border-radius: 12px;
  background: rgba(240, 184, 16, .1);
  border: 1px solid rgba(240, 184, 16, .3);
}
.sig-gain-chip {
  grid-row: 1 / span 2;
  font-family: var(--head); font-weight: 600;
  font-size: clamp(1.1rem, 2.6vh, 1.4rem); line-height: 1;
  color: var(--yellow); white-space: nowrap;
}
.sig-hint {
  grid-column: 2; font-size: .68rem; line-height: 1.25; color: var(--yellow); opacity: .9;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.sig-thr {
  display: grid; grid-template-columns: 1fr auto;
  align-items: baseline; column-gap: .5em; row-gap: 1px;
}
.sig-lab {
  margin: 0; font-family: var(--head); font-weight: 600;
  font-size: .78rem; line-height: 1.2; color: #f6c7ca;
}
.sig-thr-val { font-family: var(--head); font-size: .9rem; color: var(--red); }
.sig-thr .sig-slider { grid-column: 1 / -1; }
/* em 指定なので、まわりの文字サイズに素直について来る。
   つまみ（1.25em）は 0.36em の溝から上下に 0.45em はみ出すので、
   マージンはそれより広く取る。詰めると下の行に食い込む。 */
.sig-slider, .cos-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: .36em; margin: .58em 0;
  border-radius: 999px; background: rgba(157, 188, 251, .22);
  outline: none; cursor: pointer;
}
.sig-slider::-webkit-slider-thumb, .cos-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 1.25em; height: 1.25em; border-radius: 50%;
  background: var(--yellow); border: 2px solid rgba(20, 27, 46, .75); cursor: pointer;
}
.sig-slider::-moz-range-thumb, .cos-slider::-moz-range-thumb {
  width: 1.25em; height: 1.25em; border-radius: 50%; border: 2px solid rgba(20, 27, 46, .75);
  background: var(--yellow); cursor: pointer;
}
#sig-thr { font-size: 1rem; }
#sig-thr::-webkit-slider-thumb { background: var(--red); }
#sig-thr::-moz-range-thumb { background: var(--red); }
.sig-slider:focus-visible, .cos-slider:focus-visible { box-shadow: 0 0 0 3px rgba(157, 188, 251, .4); }

.sig-out {
  margin: 0; flex: 1 1 auto; min-width: 0;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .35em;
  font-family: var(--head); font-size: .76rem; color: #b9c6e2;
}
.sig-count { font-size: clamp(1rem, 2.4vh, 1.25rem); line-height: 1; color: #fff; }
/* 増幅率を上げすぎて満スケールに積み上がったときだけ出る */
.sig-state { font-style: normal; color: var(--red); }
.sig.is-sat .sig-count, #sigchain.is-sat ~ .rail .sig-count { color: var(--red); }

/* ─── ステージ内のオーバーレイ（glcore が生成） ───── */
.g3-host { position: absolute; inset: 0; }
.g3-host canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.g3-leaders { position: absolute; inset: 0; pointer-events: none; overflow: hidden; color: var(--blue-soft); }
.g3-chips { position: absolute; inset: 0; pointer-events: none; }
.chip {
  position: absolute; top: 0; left: 0; will-change: transform;
  background: rgba(20, 27, 46, .86);
  border: 1px solid rgba(157, 188, 251, .35);
  border-radius: 999px;
  padding: .18em .62em;
  font-family: var(--head); font-weight: 600;
  font-size: var(--chip-fs);
  font-feature-settings: "palt" 0;   /* 小さい和文では palt が詰まりすぎる */
  line-height: 1.45; white-space: nowrap;
  color: #eaf0fd;
}
@supports (backdrop-filter: blur(6px)) {
  .chip { background: rgba(20, 27, 46, .7); backdrop-filter: blur(6px); }
}
.chip.k-hot { border-color: var(--yellow); color: #ffeec2; }
.chip.k-cool { border-color: var(--blue-soft); }
.chip.k-warn { border-color: var(--red); color: #ffd9db; }
.hintchip {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  background: rgba(240, 184, 16, .92); color: #2b2000;
  font-family: var(--head); font-weight: 600; font-size: .8rem;
  padding: .3rem .9rem; border-radius: 999px;
  pointer-events: none; opacity: 0; transition: opacity .5s;
}
.hintchip.on { opacity: 1; }
.stage-fallback { position: absolute; inset: 0; display: none; place-items: center; padding: var(--pad); }
.stage-skel {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: .8rem; color: #7f8db0; font-family: var(--head);
}

/* WebGL が無いとき */
.no-gl .stage-fallback { display: grid; }
.no-gl .g3-host { display: none; }
.stage-fallback svg { width: 100%; height: 100%; max-height: 100%; }
.gl-note {
  text-align: center; max-width: 22rem;
}
.gl-note p { margin: 0 0 .6rem; font-size: .85rem; color: #b9c6e2; }
.gl-note a {
  display: inline-block; padding: .4rem 1rem; border-radius: 999px;
  background: var(--blue-soft); color: #0e1424; text-decoration: none;
  font-family: var(--head); font-weight: 600; font-size: .82rem;
}

/* ─── 下部ナビ ─────────────────────────────────────── */
.deckn {
  display: flex; align-items: stretch; gap: 2px;
  padding: 4px var(--pad);
  background: #101728;
  border-top: 1px solid rgba(157, 188, 251, .16);
  min-width: 0;
}
.deckn button {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0; padding: 2px 4px;
  background: transparent; border: 0; border-radius: 10px;
  cursor: pointer; color: #8fa2c8;
  transition: background .16s, color .16s;
}
.deckn button em {
  font-style: normal; font-family: var(--head); font-size: .58rem;
  letter-spacing: .1em; opacity: .8; white-space: nowrap;
}
.deckn button span {
  font-family: var(--head); font-size: .82rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.deckn button:hover { background: rgba(157, 188, 251, .1); color: #dfe7f8; }
.deckn button[aria-selected="true"] { color: #fff; background: rgba(157, 188, 251, .16); }
.deckn button[data-accent="cover"][aria-selected="true"] { box-shadow: inset 0 -3px 0 var(--cream); }
.deckn button[data-accent="ray"][aria-selected="true"] { box-shadow: inset 0 -3px 0 #c9a6ff; }
.deckn button[data-accent="det"][aria-selected="true"] { box-shadow: inset 0 -3px 0 #cfe0ff; }
.deckn button[data-accent="sig"][aria-selected="true"] { box-shadow: inset 0 -3px 0 var(--yellow); }
.deckn button[data-accent="intro"][aria-selected="true"] { box-shadow: inset 0 -3px 0 var(--blue-soft); }
.deckn button[data-accent="a"][aria-selected="true"] { box-shadow: inset 0 -3px 0 #ff7a80; }
.deckn button[data-accent="b"][aria-selected="true"] { box-shadow: inset 0 -3px 0 #8fb6ff; }
.deckn button[data-accent="c"][aria-selected="true"] { box-shadow: inset 0 -3px 0 var(--yellow); }
.deckn button[data-accent="d"][aria-selected="true"] { box-shadow: inset 0 -3px 0 #55d8c4; }

/* ─── 極小画面の逃げ道 ─────────────────────────────── */
.toosmall {
  position: fixed; inset: 0; z-index: 90;
  display: none; place-content: center; text-align: center;
  padding: 2rem; background: var(--navy);
}
.toosmall p { margin: 0 0 1rem; font-size: .9rem; color: #b9c6e2; }
.toosmall b { display: block; font-family: var(--head); font-size: 1.1rem; color: #fff; margin-bottom: .3rem; }
.toosmall a {
  display: inline-block; padding: .5rem 1.2rem; border-radius: 999px;
  background: var(--blue-soft); color: #0e1424; text-decoration: none;
  font-family: var(--head); font-weight: 600;
}
.too-small .toosmall { display: grid; }
.too-small .hdr, .too-small .deck, .too-small .deckn { display: none; }

/* ─── 縦長（タブレット・スマホ縦） ───────────────────
   帯の高さは有限なので、中身を「詰めて入れる」のではなく
   **入る数だけ見せる**。読み出しは上位4つ、補足行と測定ログは落とす。
   落とした情報はシーン上のチップ側に必ず出ている。 */
@media (max-aspect-ratio: 1/1) {
  .screen.on {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }
  .rail {
    grid-template-rows: auto auto;
    grid-template-columns: 1fr;
    max-height: clamp(150px, 26vh, 250px);
  }
  .chartbox { display: none; }          /* 3Dシーンが主役。チャートから落とす */
  .hud { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ro-s { display: none; }
  .ro:nth-child(n+5) { display: none; }
  .simlog { display: none; }
  /* 準備1: 帯が狭いので部品名のレールは畳む。部品の役割は右レールが担う。
     exploded2.js も同じ (max-aspect-ratio:1/1) を見てレール幅を 0 にする */
  .xv-caps { display: none; }
  .xv-leaders > path { display: none; }   /* 検出アニメ (.xv-fx) は残す */
  .railnote { display: none; }
  /* 準備1: グラフは落ちるが、成分比はステージの帯が持っているので情報は消えない。
     行程表は縦に6行も置けないので、横一列の点に畳む（現在地は色で分かる）。 */
  #s-cosmic .rail { grid-template-rows: auto auto; }
  #cosmicray { min-height: clamp(220px, 38vh, 380px); }
  .cos-track { grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
  .cos-track li:not(:last-child)::before {
    left: 50%; right: -50%; top: 5px; bottom: auto; width: auto; height: 2px;
  }
  .cos-track button { flex-direction: column; gap: 2px; padding: 0; text-align: center; }
  /* 6つ横に並べると名前は入らない。いまいる章の名前だけ出す */
  .cos-track button span { display: none; }
  .cos-track .on { background: none; }
  .cos-track .on span {
    display: block; position: absolute; left: 50%; transform: translateX(-50%);
    top: 15px; font-size: .62rem; white-space: nowrap;
  }
  .cos-track li { padding-bottom: 1.1em; }
  .cos-now { display: none; }
  /* 準備3: グラフは縦に潰れると読めないので床を持たせる */
  #sigchain { min-height: clamp(200px, 34vh, 330px); }
  .cover-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: repeat(4, minmax(0, 1fr));
  }
  /* 横長の帯になるので、絵は中央の帯だけ見える（要素はそこに置いてある） */
  .cover-sub { -webkit-line-clamp: 1; }
  .cover-txt { padding-top: clamp(10px, 2vh, 18px); }
}
@media (max-aspect-ratio: 1/1) and (max-width: 480px) {
  .hud { gap: 4px; }
  .ro { padding: .28rem .5rem; }
  .ro-v { font-size: clamp(.88rem, 1.9vh, 1rem); }
  .deckn button span { font-size: .74rem; }
  .manual span { display: none; }
  .manual { padding: .3rem .5rem; }
  .langsw button { width: 28px; }
}

/* ─── 横向きスマホ（最悪ケース: 740×360） ──────────── */
@media (max-height: 420px) {
  :root { --hdr-h: 32px; --nav-h: 34px; --gap: 4px; --rail-w: clamp(190px, 30vw, 230px); }
  .screen.on {
    grid-template-columns: 1fr var(--rail-w);
    grid-template-rows: 1fr;            /* 前提文は出さない — チップが担う */
    padding: 4px var(--pad);
  }
  .premise { display: none; }
  .rail { grid-template-rows: auto 1fr; max-height: none; }
  .chartbox { display: none; }
  .hud { grid-template-columns: 1fr; }
  .ro:nth-child(n+3) { display: none; }  /* 読み出しは2つまで */
  .ro-s { display: none; }
  .simlog { display: none; }
  .brand-txt i { display: none; }
  .ttl { font-size: .78rem; }
  .manual span { display: none; }
  .langsw button { width: 26px; height: 18px; }
  .langsw svg { width: 18px; height: 12px; }
  .deckn button em { display: none; }
  .deckn button span { font-size: .72rem; }
  .stage { min-height: 120px; }
  /* 準備1〜3: 高さが無い。段カードは2枚まで（.ro:nth-child(n+3) の既存ルール）、
     補足と一言は落とし、つまみと読み出しだけ残す */
  .railnote, .sig-hint { display: none; }
  /* 準備1: 行程表は点だけの横一列に。解説とグラフは落とす */
  #s-cosmic .rail { grid-template-rows: auto 1fr; }
  .cos-now { display: none; }
  .cos-track { grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; }
  .cos-track li:not(:last-child)::before {
    left: 50%; right: -50%; top: 5px; bottom: auto; width: auto; height: 2px;
  }
  .cos-track button { flex-direction: column; gap: 1px; padding: 0; text-align: center; }
  .cos-track button span { display: none; }
  /* キャプションは重なると読めない。要のものだけ残す */
  .cos-cap { font-size: .58rem; max-width: 13ch; }
  .cos-cap[data-cap="mag0"], .cos-cap[data-cap="aurora"], .cos-cap[data-cap="live"] { display: none; }
  .xv-cap { font-size: .58rem; }
  .cover-steps-lead { display: none; }
  .cover-step { min-height: 28px; padding: .2rem .7rem; font-size: .76rem; }
  /* 扉: 前提文が消えるぶん行テンプレートを組み直す（組み直さないと
     自動配置が繰り上がって 1fr 行が空になる） */
  .screen.cover.on { grid-template-rows: auto minmax(0, 1fr); }
  .cover-sub { display: none; }
  .cover-txt { padding-top: 10px; padding-bottom: 6px; }
  .cover-start { min-height: 30px; padding: .2rem 1rem; }
  .cover-start em { display: none; }
}

/* ─── レールも入らないほど低い場合（JSが付ける） ───── */
.tiny .rail { display: none; }
.tiny .screen.on { grid-template-columns: 1fr; }
.tiny .ctlbox {
  position: absolute; left: var(--pad); right: var(--pad); bottom: 4px; z-index: 5;
  background: rgba(16, 23, 40, .9); border-radius: 999px; padding: 3px 6px;
}
.tiny .ctl-row { flex-wrap: nowrap; overflow: hidden; }
.tiny .cover-sub, .tiny .cover-ico, .tiny .cover-steps-lead { display: none; }
/* レールごと消える高さなので、つまみだけはステージの下端に浮かせて残す */
.tiny #s-cosmic .ctlbox { display: flex; gap: 6px; align-items: center; }
.tiny #s-cosmic .cos-alt { flex: 1 1 0; min-width: 0; background: none; border: 0; padding: 0; }
.tiny #s-cosmic .cos-lab { display: none; }
.tiny #s-cosmic .cos-out { text-align: left; }
.tiny #s-sig .ctlbox { display: flex; gap: 6px; align-items: center; }
.tiny #s-sig .sig-amp, .tiny #s-sig .sig-thr { flex: 1 1 0; min-width: 0; background: none; border: 0; padding: 0; }
.tiny #s-sig .sig-hint, .tiny #s-sig .sig-lab { display: none; }

/* ─── 動き抑制 ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* 画像の width/height 属性は縦横比（CLS 対策）にだけ使い、表示サイズは CSS に任せる */
:where(img){height:auto}
