/* プレイ画面
   - 上: 絵（.scene-view）。中の .scene は 9:16 の仮想画面で、当たり判定はこの % 座標。下 42% は見せない
   - 下: 会話パネル（.panel-talk）。文字は画面幅に比例させず px で決める（スマホで小さくならないように）
   - 絵の大きさは main.js の fitStage が「会話パネルの最低の高さ」を残して決める（--scene-w / --scene-h / --u） */
.play-screen { align-items: center; justify-content: flex-start; overflow: hidden; background: var(--ink); } /* overflow: 開幕の揺れ演出でページ幅を超えないように */ /* 上から詰める（見える高さで切ったとき、下に余りが出るように） */
.stagebox {
  --u: 4px; --scene-w: 400px; --scene-h: 412px;
  position: relative; overflow: hidden; background: #fff; display: flex; flex-direction: column;
  touch-action: manipulation;
}
.scene-view { position: relative; flex: none; height: var(--scene-h); overflow: hidden; display: flex; justify-content: center; background: var(--ink); }
.scene { position: relative; flex: none; width: var(--scene-w); height: calc(var(--scene-w) * 16 / 9); }
.backdrop, .hud-title, .probe-btn, .chip kbd, .reply-btn kbd, .probe-btn kbd, .layer-bg .bg-wide { display: none; } /* PC 配置だけ（css/wide.css） */

/* ---- レイヤー ---- */
.layer { position: absolute; inset: 0; }
.layer-bg { background: var(--scene-color, #cfe8c8); }
.layer-bg::before { /* 仮の背景: 棚の縞 */
  content: ""; position: absolute; inset: 0 0 42% 0;
  background: repeating-linear-gradient(180deg, transparent 0 calc(var(--u) * 11), rgba(30, 35, 64, .12) calc(var(--u) * 11) calc(var(--u) * 12.2));
}
.layer-bg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.scene-name {
  position: absolute; left: calc(var(--u) * 3); top: 7.5%; font: calc(var(--u) * 3) var(--font-display);
  color: rgba(30, 35, 64, .35);
}

/* 仮の立ち絵（画像が無いとき）。顔は faceRect の位置 */
.char-ph { position: absolute; inset: 0; pointer-events: none; }
.char-body {
  position: absolute; left: 30%; width: 40%; top: 25%; bottom: 0;
  background: var(--char-color, #f2a65a); border: var(--line); border-radius: 40% 40% 0 0;
}
.char-head {
  position: absolute; background: #FFE0C7; border: var(--line); border-radius: 50%;
  transition: transform .15s;
}
.eye {
  position: absolute; top: 40%; width: 14%; height: 20%; background: var(--paper); border: 2px solid var(--ink); border-radius: 50%;
  overflow: hidden;
}
.eye.l { left: 24%; } .eye.r { right: 24%; }
.eye::after { /* 黒目。よそ見中は横を向く */
  content: ""; position: absolute; top: 25%; left: 50%; width: 55%; height: 55%; background: var(--ink); border-radius: 50%;
  transform: translateX(10%); transition: transform .12s;
}
.mouth {
  position: absolute; left: 50%; bottom: 18%; width: 30%; height: 14%; transform: translateX(-50%);
  border: 3px solid var(--ink); border-top: 0; border-radius: 0 0 99px 99px;
}
.char-tag { position: absolute; left: 50%; transform: translateX(-50%); bottom: 2%; font: calc(var(--u) * 2.6) var(--font-display); color: var(--ink); opacity: .5; }

/* 視線ステート */
.stagebox[data-gaze="warn"] .eye::after { animation: twitch .18s 3; }
@keyframes twitch { 50% { transform: translateX(-40%); } }
.stagebox[data-gaze="B"] .eye::after { transform: translateX(-50%) scale(1.15); }
.stagebox[data-gaze="B"] .eye { height: 24%; }
.stagebox[data-gaze="B"] .layer-fx::before { opacity: 1; }
.layer-fx { pointer-events: none; }
.layer-fx::before { /* 凝視中の赤いふちと集中線 */
  content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity .2s;
  box-shadow: inset 0 0 0 calc(var(--u) * 1.2) var(--alarm), inset 0 0 calc(var(--u) * 12) rgba(255, 59, 48, .45);
  background: repeating-conic-gradient(from 0deg at 50% 22%, transparent 0 4deg, rgba(30, 35, 64, .07) 4deg 5deg);
}

/* 表情（data-face） */
.stagebox[data-face="happy"] .mouth { height: 20%; background: #ff8fa8; }
.stagebox[data-face="happy"] .eye { height: 6%; top: 48%; border-radius: 99px 99px 0 0; border-bottom: 0; }
.stagebox[data-face="happy"] .eye::after { display: none; }
.stagebox[data-face="suspicious"] .eye { height: 9%; top: 46%; border-radius: 0; }
.stagebox[data-face="suspicious"] .mouth { border: 0; border-top: 3px solid var(--ink); border-radius: 0; height: 2%; }
.stagebox[data-face="shock"] .eye { height: 26%; }
.stagebox[data-face="shock"] .eye::after { transform: translateX(-50%) scale(.45); }
.stagebox[data-face="shock"] .mouth { border: 3px solid var(--ink); border-radius: 50%; height: 22%; width: 22%; background: #7a1f2b; }
.stagebox[data-face="shock"] .char-head { background: #c9d6ff; }

/* ---- ホットスポット ---- */
.hotspot {
  position: absolute; min-width: 44px; min-height: 44px; padding: 0;
  border: 2px dashed rgba(30, 35, 64, .55); border-radius: calc(var(--u) * 2); background: rgba(255, 255, 255, .55);
  color: var(--ink); font: 800 max(12px, calc(var(--u) * 2.8))/1.15 var(--font-body); cursor: pointer; touch-action: manipulation;
  display: flex; align-items: center; justify-content: center; text-align: center;
  transition: opacity .2s, background .2s;
}
.hotspot:hover { background: rgba(255, 255, 255, .85); }
.hotspot.found { border-style: solid; border-color: var(--ok); background: rgba(43, 182, 115, .15); }
.hotspot.found::after { content: "✓"; position: absolute; top: -.6em; right: -.4em; background: var(--ok); color: #fff; border-radius: 50%; width: 1.3em; height: 1.3em; line-height: 1.3em; font-size: .9em; }
/* 無数の目（Stage 19）。よそ見中は閉じる・予兆で半開きと痙攣・凝視で全部開く */
.eyes { position: absolute; inset: 0; pointer-events: none; }
.char-ph.faceless .char-head { visibility: hidden; }
.eye-dot {
  position: absolute; width: calc(var(--u) * 6 * var(--s, 1)); aspect-ratio: 1; translate: -50% -50%; border-radius: 50%;
  background: radial-gradient(circle, #120018 0 26%, #ffe95a 29% 60%, #ff7ad9 63%); box-shadow: 0 0 calc(var(--u) * 2) #ff7ad9;
  transform: scaleY(.08); transition: transform .12s ease-out;
}
.stagebox[data-gaze="warn"] .eye-dot { transform: scaleY(.45); }
.stagebox[data-gaze="B"] .eye-dot { transform: scaleY(1); }
.stagebox[data-gaze="A"] .eye-dot.noise { animation: eye-noise 2.3s infinite var(--d, 0s); }
.stagebox[data-gaze="warn"] .eyes { animation: eyes-twitch .1s steps(2) infinite; }
@keyframes eye-noise { 0%, 86%, 100% { transform: scaleY(.08); } 90%, 94% { transform: scaleY(1); } }
@keyframes eyes-twitch { 50% { translate: 1.5% -1%; } }
@media (prefers-reduced-motion: reduce) { .eye-dot.noise, .stagebox[data-gaze="warn"] .eyes { animation: none !important; } }
/* 見つけた瞬間のスポットライト（2026-10-28。2026-10-30 に拡大・自分で閉じるまで出したまま）。
   画面全体を暗くし、調べた所の拡大（レンズ）と脳内メモを大きなカードで。押すと閉じる */
.spot-layer {
  position: absolute; inset: 0; z-index: 80; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 16px;
  background: rgba(10, 12, 28, .86); animation: spot-in .18s ease-out;
}
.stagebox.spotting .thoughts { visibility: hidden; }
.spot-lens {
  position: relative; flex: none; overflow: hidden; border-radius: 18px; background: #111;
  border: 4px solid #ffe95a; box-shadow: 0 0 0 4px rgba(255, 233, 90, .3), 0 0 32px rgba(255, 233, 90, .55);
  animation: spot-lens .3s ease-out;
}
.spot-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; }
.spot-prop { position: absolute; }
.spot-prop img { width: 100%; height: 100%; object-fit: contain; }
.spot-card {
  width: min(100%, 920px); padding: 14px 18px; border-radius: 16px;
  background: #fffdf2; color: #1e2340; border: 3px solid #1e2340; box-shadow: 0 6px 0 rgba(0, 0, 0, .35);
  animation: spot-card .22s ease-out;
}
.spot-card.frag { background: #f5f0ff; border-color: #5b3ea6; }
.spot-label { font: 800 13px/1.2 var(--font-body); color: #a0700b; letter-spacing: .08em; }
.spot-card.frag .spot-label { color: #5b3ea6; }
.spot-name { font: 800 15px/1.3 var(--font-body); margin: 2px 0 4px; opacity: .75; }
.spot-text { font: 800 21px/1.5 var(--font-body); }
.spot-debunk { margin-top: 6px; font: 800 17px/1.4 var(--font-body); color: #c0392b; }
.spot-close { color: rgba(255, 255, 255, .75); font: 800 13px/1 var(--font-body); }
@keyframes spot-in { from { opacity: 0; } }
@keyframes spot-lens { from { transform: scale(.6); opacity: 0; } }
@keyframes spot-card { from { transform: translateY(12px) scale(.96); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .spot-layer, .spot-lens, .spot-card { animation: none; } }
/* 書いてもらう間だけ現れる手元（Stage 10）。押せるように、動かさずに光らせる */
.hotspot.writing:not(.found) { border-style: solid; border-color: var(--warn, #ffb703); animation: writing-glow .8s ease-in-out infinite alternate; }
@keyframes writing-glow { to { box-shadow: 0 0 0 4px rgba(255, 183, 3, .55), 0 0 18px rgba(255, 183, 3, .6); } }
/* 記憶のかけら: 見つかった変装の誰かは、慌てて画面の外へ逃げる（ストーリー v2。メモだけが残る） */
.hotspot.fled { pointer-events: none; animation: flee .7s ease-in forwards; }
.hotspot.fled::after { content: none; }
@keyframes flee { 20% { transform: translateY(-6%) rotate(-4deg); } 100% { transform: translateX(160%) rotate(12deg); opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .hotspot.fled { animation: none; opacity: 0; visibility: hidden; } }
.hotspot.own { border-color: var(--sky); background: rgba(124, 200, 255, .35); }
.hotspot.frag { border-color: rgba(30, 35, 64, .18); background: rgba(255, 255, 255, .18); color: rgba(30, 35, 64, .45); }
.hotspot.gone { opacity: 0; pointer-events: none; }
/* 探索を探索らしく（2026-10-30）: 絵が読めたステージでは、調べる場所の枠と名前を隠す（絵を見て自分で探す）。
   自分の持ち物・調べ終わった所・絵が読めなかった小道具・絵がまだ無い物（no-art）・書いている手元は今までどおり見せる */
.probe-floor { position: absolute; inset: 0; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.stagebox.has-bg .hotspot:not(.own):not(.found):not(.img-missing):not(.no-art):not(.writing),
.stagebox.has-bg .hotspot:not(.own):not(.found):not(.img-missing):not(.no-art):not(.writing):hover { border-color: transparent; background: transparent; color: transparent; box-shadow: none; }
.stagebox.has-bg .hotspot { cursor: zoom-in; }
/* 調べている間（じっと見る）: 下に進み具合の帯。終わるまでほかは調べられない */
.hotspot.examining { border: 3px solid #ffe95a !important; background: rgba(255, 233, 90, .18) !important; }
.hotspot.examining::before, .exam-lens::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: -10px; height: 6px; border-radius: 3px; background: #ffe95a;
  box-shadow: 0 0 0 2px rgba(30, 35, 64, .6); transform-origin: left; animation: exam-bar var(--exam-ms, 1000ms) linear forwards;
}
.exam-lens { position: absolute; width: 48px; height: 48px; translate: -50% -50%; border: 3px solid #ffe95a; border-radius: 50%; background: rgba(255, 233, 90, .15); pointer-events: none; }
@keyframes exam-bar { from { transform: scaleX(0); } }

.face-hit { position: absolute; border: 0; background: transparent; border-radius: 50%; cursor: pointer; touch-action: manipulation; }

/* ---- HUD ---- */
.hud { position: absolute; left: 0; right: 0; top: 0; height: max(46px, calc(var(--scene-w) * 16 / 9 * .06)); display: flex; align-items: center; gap: calc(var(--u) * 1.5); padding: 0 calc(var(--u) * 2); z-index: 3; }
.hud .icon-btn { width: max(44px, calc(var(--u) * 10)); height: max(36px, calc(var(--u) * 8)); font-size: max(18px, calc(var(--u) * 3.6)); }
.gauge { flex: 1; position: relative; height: max(24px, calc(var(--u) * 6)); border: var(--line); border-radius: 99px; background: var(--paper); overflow: hidden; }
.gauge-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, var(--sky), var(--blush) 60%, var(--alarm)); transition: width .25s; }
.gauge-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 calc(var(--u) * 2.5); font: max(12px, calc(var(--u) * 2.8)) var(--font-display); }
.gauge-label span { -webkit-text-stroke: 3px var(--paper); paint-order: stroke fill; } /* たまって色が濃くなっても読める（ux-review F9） */
.gauge.hot { animation: gauge-hot .5s infinite alternate; }
@keyframes gauge-hot { to { border-color: var(--alarm); } }
.memo-btn { width: auto !important; padding: 0 calc(var(--u) * 2); font: 800 max(13px, calc(var(--u) * 3))/1 var(--font-body) !important; white-space: nowrap; }

/* 視線の状態（絵と会話パネルの境目に出す。目が両方を行き来する場所なので見落としにくい）
   絵には 4px だけ掛けて、右に寄せる。残りは会話パネル側へ（絵の下の方の小道具を隠さない。ux-review F7） */
.gaze-badge {
  position: absolute; right: 12px; top: calc(var(--scene-h) - 4px); z-index: 6; pointer-events: none; /* 右寄せ: 左の話し手の名前と重ねない */
  display: flex; align-items: center; gap: 6px; padding: 6px 14px 8px; border: var(--line); border-radius: 14px;
  background: #DDF7E8; color: var(--ink); font: 800 15px/1 var(--font-body); white-space: nowrap;
  transition: background .15s, color .15s;
}
.gaze-badge::before { content: "👀"; }
.stagebox[data-gaze="warn"] .gaze-badge { background: var(--flyer); animation: badge-warn .25s infinite alternate; }
.stagebox[data-gaze="warn"] .gaze-badge::before { content: "❗"; }
.stagebox[data-gaze="B"] .gaze-badge { background: var(--alarm); color: #fff; padding: 8px 18px 10px; font-size: 17px; }
.stagebox[data-gaze="B"] .gaze-badge::before { content: "👁"; }
@keyframes badge-warn { to { transform: translateY(-3px); } }

/* ---- 脳内のつぶやき・擬音 ---- */
/* 顔を隠さないよう、絵の下端（視線の札の上）に出す。最大 2 件まで積む（新しい方が下。ux-review F2） */
.thoughts { position: absolute; left: 3%; right: 3%; bottom: 44px; z-index: 5; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.thoughts .thought { position: relative; padding-right: 44px; } /* × で閉じるまで残る。吹き出しの上は下の絵へ素通し */
.thought-close { pointer-events: auto; }
.thought-close { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: var(--ink); font: 800 1.2rem var(--font-body); cursor: pointer; }
.thought-close:hover { background: rgba(30, 35, 64, .08); }
.thoughts:empty { display: none; }
.thought.old { opacity: .85; font-size: .9em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* 古い方は 1 行に縮める（絵を隠しすぎない） */
.thought {
  padding: 8px 12px;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 14px; box-shadow: 2px 2px 0 var(--ink);
  font-weight: 800; font-size: 15px; line-height: 1.45;
  animation: pop-in .18s ease-out;
}
.thought::before { content: "🧠 "; }
.thought.alert { background: #FFF1F0; border-color: var(--alarm); }
.thought.alert::before { content: "💦 "; }
.thought.frag { background: #F2F0FF; }
.thought.frag::before { content: "✨ "; }
@keyframes pop-in { from { transform: scale(.85); opacity: 0; } }
.sfx {
  position: absolute; z-index: 4; pointer-events: none; white-space: nowrap;
  font: max(26px, calc(var(--u) * 9)) var(--font-display); color: var(--paper); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill;
  text-shadow: 3px 3px 0 var(--ink); transform: rotate(-10deg); animation: sfx 1s ease-out forwards;
}
.sfx.red { color: var(--alarm); }
.sfx.pink { color: var(--blush); }
@keyframes sfx { 0% { transform: rotate(-10deg) scale(.4); opacity: 0; } 15% { transform: rotate(-10deg) scale(1.15); opacity: 1; } 30% { transform: rotate(-10deg) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: rotate(-10deg) translateY(calc(var(--u) * -3)); } }
.shake { animation: shake .4s; }
/* 揺れるのは絵だけ（HUD・会話パネルは動かさない。ボタンが画面の外に出たり、押しそこねたりしないように） */
.stagebox.shake { animation: none; }
.stagebox.shake .scene { animation: shake .4s; }
@keyframes shake { 20% { transform: translateX(-2%); } 40% { transform: translateX(2%); } 60% { transform: translateX(-1%); } 80% { transform: translateX(1%); } }

/* ---- 会話パネル ---- */
.panel-talk {
  position: relative; flex: 1 1 auto; min-height: 0; z-index: 2; overflow-y: auto; /* 収まらない極端に小さい画面だけスクロール */
  background: var(--paper); border-top: var(--line);
  display: flex; flex-direction: column; gap: 8px; padding: 12px 14px;
}
.speech { position: relative; flex: 0 1 auto; min-height: 76px; overflow-y: auto; cursor: pointer; } /* 名前＋セリフ 2 行は必ず見せる */
/* 選択肢・「返事する」はセリフのすぐ下に置き、余りはパネルの一番下に回す（下端が画面の外に切れても、操作する物が残るように） */
.speaker { display: inline-block; font: 13px var(--font-display); background: var(--ink); color: var(--paper); padding: .15em .7em; border-radius: 99px; margin-bottom: .35em; }
.speech-text { font-weight: 800; line-height: 1.5; font-size: 17px; }
/* 声の調子（Stage 9 の「ウェーイ」だけの会話。台詞の頭の〔大〕〔震〕〔小〕〔泣〕） */
.speech-text[data-tone] { transform-origin: left center; }
.speech-text[data-tone="shout"] { font-size: 1.9em; letter-spacing: .04em; line-height: 1.2; animation: tone-shout .12s steps(2) 6; }
.speech-text[data-tone="tremble"] { animation: tone-tremble .09s linear infinite alternate; }
.speech-text[data-tone="whisper"] { font-size: .82em; opacity: .65; letter-spacing: .12em; }
.speech-text[data-tone="sob"] { color: #3d6fb5; animation: tone-sob 1.1s ease-in-out infinite; }
@keyframes tone-shout { 50% { transform: translate(2px, -2px) rotate(-1deg); } }
@keyframes tone-tremble { to { transform: translateX(1.5px); } }
@keyframes tone-sob { 50% { transform: translateY(2px) skewX(-3deg); } }
@media (prefers-reduced-motion: reduce) { .speech-text[data-tone] { animation: none; } }
.speech.mine .speaker { background: var(--sky); color: var(--ink); }
.speech .tap-hint { position: absolute; right: 0; bottom: 0; font-size: 12px; color: var(--muted); animation: blink 1s infinite; background: var(--paper); padding-left: 6px; }
@keyframes blink { 50% { opacity: .2; } }

.answer { display: contents; } /* 縦配置では中身をパネルに直に並べる（PC 配置では右の列） */
.speech { order: 0; } .hint-line { order: 1; } .tools { order: 2; } .choices { order: 3; } .reply-btn { order: 4; }
.tools { flex: none; display: flex; align-items: center; gap: 8px; }
.chip {
  flex: none; min-height: 44px; padding: 0 14px; border: 2px solid var(--ink); border-radius: 99px; background: var(--flyer);
  font: 800 15px/1 var(--font-body); color: var(--ink); cursor: pointer; touch-action: manipulation; box-shadow: 2px 2px 0 var(--ink);
}
.chip.distract { background: var(--sky); }
.chip[disabled] { opacity: .4; box-shadow: none; cursor: default; }

/* 選択肢は全幅 1 列・16px。鍵付きは低く・薄く（読まなくてよいものは目立たせない） */
.choices { flex: none; display: flex; flex-direction: column; gap: 6px; }
.choice {
  position: relative; min-height: 44px; padding: 9px 14px 9px 44px;
  border: 2px solid var(--ink); border-radius: 14px; background: var(--paper); box-shadow: 2px 2px 0 var(--ink);
  font: 800 16px/1.35 var(--font-body); color: var(--ink); text-align: left; cursor: pointer; touch-action: manipulation;
}
.choice .key {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border-radius: 50%;
  background: var(--ink); color: var(--paper); font: 12px/24px var(--font-display); text-align: center;
}
.choice:active:not([disabled]) { transform: translate(2px, 2px); box-shadow: none; }
.choice.locked { min-height: 40px; padding-top: 6px; padding-bottom: 6px; font-size: 14px; background: repeating-linear-gradient(-45deg, #F1F2F6 0 8px, #E6E8EF 8px 16px); color: var(--muted); border-style: dashed; cursor: default; box-shadow: none; }
.choice.locked .key { background: #B9BDCC; }
.choice.unlocked { animation: unlock .9s ease-out; box-shadow: 0 0 0 3px var(--flyer), 2px 2px 0 var(--ink); }
@keyframes unlock { 0% { transform: scale(.92); filter: brightness(1.6); } 40% { transform: scale(1.04); } 70% { transform: scale(.99); } }
.choices.busy .choice { opacity: .5; pointer-events: none; }

/* ---- 脳内メモ（シーン部分だけを覆う） ---- */
.memo { /* 絵の部分だけを覆う（会話パネルは操作できるまま） */
  position: absolute; left: 3%; right: 3%; top: max(44px, calc(var(--u) * 11)); bottom: 10px; z-index: 7;
  background: var(--paper); border: var(--line); border-radius: 14px; box-shadow: var(--shadow);
  padding: 12px 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px;
}
.memo[hidden] { display: none; }
.memo h3 { font: 16px var(--font-display); font-weight: normal; }
.memo ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.memo li { font-size: 15px; line-height: 1.5; border-bottom: 1px dashed #C9CCD8; padding-bottom: 8px; }
.memo li b { display: block; font-size: 12px; color: var(--muted); }
.memo li.debunked { text-decoration: line-through; color: var(--muted); }
.memo li.debunked b::after { content: "（……違うかも）"; text-decoration: none; display: inline-block; margin-left: .3em; color: var(--alarm); }
.memo .empty { color: var(--muted); }

/* ---- チュートリアル・シナプス演出（ゲーム領域内のカード） ---- */
.card-layer { position: absolute; inset: 0; z-index: 8; display: flex; align-items: center; justify-content: center; padding: 6%; background: rgba(30, 35, 64, .6); }
.card-layer[hidden] { display: none; }
/* その場の説明は上に寄せて、背景も薄く（説明している札・メーターが見えるように） */
.card-layer.moment { align-items: flex-start; background: rgba(30, 35, 64, .25); }
.card { width: min(100%, 420px); background: var(--paper); border: var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 20px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.card h3 { font: 22px var(--font-display); font-weight: normal; }
.card p { line-height: 1.7; font-weight: 800; font-size: 16px; }
.card .step { font-size: 12px; color: var(--muted); }
.synapse { position: absolute; inset: 0; z-index: 7; display: flex; align-items: center; justify-content: center; pointer-events: none; padding: 8%; }
.synapse p {
  background: var(--ink); color: var(--flyer); border-radius: 14px; padding: 14px 16px; font-weight: 800; font-size: 16px; line-height: 1.6; text-align: center;
  animation: synapse 2.6s ease-out forwards; box-shadow: 0 0 0 calc(var(--u) * 1) var(--flyer);
}
@keyframes synapse { 0% { transform: scale(.6); opacity: 0; } 12% { transform: scale(1.05); opacity: 1; } 20% { transform: scale(1); } 85% { opacity: 1; } 100% { opacity: 0; } }

/* ---- ギミック: 湯気（js/gimmicks/steam.js） ---- */
.steam { position: absolute; z-index: 1; touch-action: none; cursor: grab; }
.steam-canvas {
  /* メガネの縁をくっきり描くため、ぼかしはかけない（曇りの粒はもともとやわらかい） */
  position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
}

/* 画風の切り替えの閃光 */
.skin-flash { position: absolute; inset: 0; z-index: 9; background: #fff; pointer-events: none; animation: flash .7s ease-out forwards; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }

/* 画像があるとき */
.layer-char .char-img { position: absolute; inset: 0 0 42% 0; width: 100%; height: 58%; object-fit: contain; object-position: center bottom; pointer-events: none; }
.char-ph[hidden] { display: none; }
.hotspot.has-image { border-color: transparent; background: transparent; }
.hotspot.has-image img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.hotspot.has-image.found { border-color: var(--ok); }

/* 絵があるステージ: 絵に描かれている物（inArt）は、絵を隠さないよう名前なしの控えめな枠にする（見つけるのも遊びのうち）。
   絵がまだ無い小道具は、名前入りの枠のまま */
.stagebox.has-art .hotspot.in-art { background: transparent; border-color: rgba(255, 255, 255, .8); color: transparent; box-shadow: 0 0 0 1px rgba(30, 35, 64, .25); }
.stagebox.has-art .hotspot.in-art:hover { background: rgba(255, 255, 255, .25); }
.stagebox.has-art .hotspot.in-art.found { border-color: var(--ok); }
.stagebox.has-art .scene-name, .stagebox.has-art .char-tag { display: none; }

/* 幅 360px 未満（iPhone SE 初代など）: 文字を 1 段だけ下げて、選択肢を 1 行・4 つとも画面内に収める */
@media (max-width: 359px) {
  .panel-talk { padding: 10px 12px; gap: 6px; }
  .speech-text { font-size: 16px; }
  .choice { font-size: 15px; padding-left: 40px; }
  .choice .key { left: 8px; }
  .chip { font-size: 14px; padding: 0 12px; }
  .thought { font-size: 14px; padding: 6px 10px; }
}

/* ---- フェーズ 3 で足した部品 ---- */
/* 記憶のかけらのヒント（Stage 18） */
.hint-line { flex: none; font-size: 14px; font-weight: 800; line-height: 1.45; color: #4B3BB0; background: #F2F0FF; border: 2px solid #8E7CF0; border-radius: 10px; padding: 6px 10px; }
.hint-line[hidden] { display: none; }
/* 脳内パズルのボタンとモーダル（Stage 7） */
.chip.puzzle { background: #E9E2FF; animation: badge-warn .5s infinite alternate; }
.chip.puzzle[hidden] { display: none; }
.puzzle-slots { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.puzzle-slot { min-width: 40px; height: 44px; padding: 0 6px; border: 2px dashed var(--ink); border-radius: 10px; display: flex; align-items: center; justify-content: center; font: 20px var(--font-display); }
.puzzle-pieces { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.puzzle-piece { min-width: 56px; font-size: 18px; }
.puzzle-actions { display: flex; gap: 8px; justify-content: center; }
.puzzle-actions .btn { flex: 1; }
/* カウントダウン（Stage 10） */
.countdown {
  position: absolute; right: 8px; top: max(52px, calc(var(--u) * 12)); z-index: 6; pointer-events: none;
  font: 20px var(--font-display); color: #fff; background: var(--ink); border: 2px solid #fff; border-radius: 10px; padding: 4px 10px;
}
.countdown.urgent { background: var(--alarm); animation: badge-warn .25s infinite alternate; }
/* 伏せ字の選択肢（Stage 11・14） */
.choice.obscured { letter-spacing: .08em; color: #555; background: repeating-linear-gradient(90deg, #fff 0 10px, #F4F4F8 10px 20px); }
/* タイミングで一瞬だけ出る小道具（Stage 2 など） */
.hotspot.flash { animation: hs-flash .5s ease-out; }
@keyframes hs-flash { 0% { box-shadow: 0 0 0 0 var(--flyer); } 50% { box-shadow: 0 0 0 8px var(--flyer); } 100% { box-shadow: 0 0 0 0 transparent; } }
/* 順番タップ（Stage 19）: 触った順番を表示 */
.hotspot.seq-done { border-style: solid; border-color: #8E7CF0; background: rgba(142, 124, 240, .25); }
.hotspot.seq-done::before { content: attr(data-step); position: absolute; top: -.7em; left: -.4em; width: 1.4em; height: 1.4em; line-height: 1.4em; border-radius: 50%; background: #8E7CF0; color: #fff; font-size: .95em; }

/* ---- 会話（時間が止まる）と探る（時間が動く）。data-phase: talk | probe | react ----
   会話: 絵を薄く覆い、選択肢を出す。絵をタップすると「探る」へ
   探る: 選択肢をしまい、道具（相づち・話題そらし・沈黙メーター）と「返事する」を出す
   反応: 相手の反応（オチ）を読む。どこをタップしても次へ */
.talk-cover { /* HUD（メニュー・ゲージ）の下から */
  position: absolute; inset: max(46px, calc(var(--scene-w) * 16 / 9 * .06)) 0 0 0; z-index: 2; display: none; border: 0; padding: 0; background: rgba(30, 35, 64, .16); cursor: pointer; touch-action: manipulation; }
.stagebox[data-phase="talk"] .talk-cover, .stagebox[data-phase="react"] .talk-cover { display: block; }
.stagebox[data-phase="react"] .talk-cover { background: transparent; }
.stagebox[data-phase="talk"] .gaze-badge { background: var(--flyer); padding: 9px 20px 11px; font-size: 17px; animation: badge-warn .6s infinite alternate; }
.stagebox[data-phase="talk"] .gaze-badge::before { content: "👀"; }
.stagebox[data-phase="react"] .gaze-badge { display: none; }
.stagebox[data-phase="probe"] .choices { display: none; }
.stagebox:not([data-phase="probe"]) .tools, .stagebox:not([data-phase="probe"]) .reply-btn { display: none; }
.reply-btn {
  flex: none; min-height: 52px; padding: 8px 14px; border: var(--line); border-radius: 14px; background: var(--paper); box-shadow: 2px 2px 0 var(--ink);
  font: 800 17px/1.25 var(--font-body); color: var(--ink); cursor: pointer; touch-action: manipulation;
}
.reply-btn:active { transform: translate(2px, 2px); box-shadow: none; }
.reply-btn.new { background: #FFF4C2; animation: unlock .9s ease-out; box-shadow: 0 0 0 3px var(--flyer), 2px 2px 0 var(--ink); }
/* 使いどきの道具だけ光らせる */
.chip.ready { animation: chip-ready .45s infinite alternate; }
/* Stage 1 の最初のターン: 相づち・話題そらしはまだ出さない（ターン 2 で説明と一緒に。ux-review F3） */
.stagebox.tut-basic .tools .chip:not(.puzzle) { display: none !important; }
@keyframes chip-ready { to { box-shadow: 0 0 0 4px var(--flyer), 2px 2px 0 var(--ink); } } /* 光るだけで動かさない（押しにくくなる） */

/* 気まずさは数字を出さず、段階（40%・70%）ごとの画面の色で伝える */
.gauge-label { justify-content: flex-start; z-index: 2; }
.heat { position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: 0; transition: opacity .4s; }
.stagebox[data-heat="1"] .heat { opacity: 1; box-shadow: inset 0 0 calc(var(--u) * 10) rgba(90, 120, 255, .45); }
.stagebox[data-heat="2"] .heat { opacity: 1; box-shadow: inset 0 0 calc(var(--u) * 16) rgba(70, 40, 200, .65); animation: heat 1s infinite alternate; }
@keyframes heat { to { opacity: .55; } }

/* ---- 導入（毎回の「おひさしぶり → 誰……？ → カットイン」。js/ui/play.js の playOpening）---- */
.opening { position: absolute; inset: 0; z-index: 9; cursor: pointer; touch-action: manipulation; }
.opening[data-step="narration"] { background: rgba(30, 35, 64, .35); }
.op-stage { position: absolute; inset: 0; pointer-events: none; }
.stagebox[data-opening] :is(.answer, .tools, .reply-btn, .probe-btn, .talk-cover, .gaze-badge, .memo, .thoughts, .hud) { visibility: hidden; }
.speaker:empty { display: none; }
/* 小道具の枠と名前は導入の間は消す（画像の小道具は場面の一部なので残す） */
.stagebox[data-opening] .hotspot { border-color: transparent !important; background: transparent !important; color: transparent !important; box-shadow: none !important; }
/* 相手の立ち絵が入ってくる */
.layer-char { transition: opacity .35s ease-out, transform .35s ease-out; }
.stagebox.char-out .layer-char { opacity: 0; transform: translateX(25%); }
.op-narration {
  position: absolute; left: 4%; right: 4%; top: calc(var(--scene-h) * .3); padding: 12px 16px; border-radius: 12px;
  background: rgba(30, 35, 64, .9); color: #fff; font: 800 16px/1.65 var(--font-body); animation: pop-in .25s ease-out;
}
.op-who {
  position: absolute; left: 0; right: 0; margin: 0 auto; width: fit-content; top: max(62px, calc(var(--scene-h) * .16)); text-align: center;
  font: min(48px, 13vw)/1.1 var(--font-display); color: var(--alarm); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill;
  text-shadow: 4px 4px 0 var(--ink); animation: who-pop .55s cubic-bezier(.3, 1.6, .5, 1) both;
}
@keyframes who-pop { 0% { transform: rotate(-6deg) scale(2.2); opacity: 0; } 60% { transform: rotate(-6deg) scale(.92); opacity: 1; } 100% { transform: rotate(-6deg) scale(1); } }
.op-aside {
  position: absolute; left: 4%; right: 4%; top: calc(var(--scene-h) * .5); padding: 8px 12px;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 14px; box-shadow: 2px 2px 0 var(--ink);
  font: 800 15px/1.5 var(--font-body); color: var(--ink); animation: pop-in .25s .35s ease-out both;
}
.op-aside::before { content: "🧠 "; }
.op-cutin {
  position: absolute; left: -4%; right: -4%; top: calc(var(--scene-h) * .32); padding: 14px 6%;
  background: var(--ink); border-top: 5px solid var(--flyer); border-bottom: 5px solid var(--flyer); transform: skewY(-4deg);
  text-align: center; animation: cutin .45s cubic-bezier(.2, .9, .3, 1) both;
}
@keyframes cutin { from { transform: skewY(-4deg) translateX(-110%); } }
.op-cutin-main { font: min(24px, 6.4vw)/1.3 var(--font-display); color: var(--flyer); white-space: nowrap; }
.op-cutin-sub { margin-top: 4px; font: 800 13px/1.4 var(--font-body); color: #fff; }
.op-cutin-broken { margin-top: 10px; font: min(20px, 5.4vw)/1.35 var(--font-display); color: #fff; animation: pop-in .3s 1.4s ease-out both; }
/* お約束を崩すとき（Stage 20）: いつもの文言に線が引かれる */
.op-cutin.broken .op-cutin-main, .op-cutin.broken .op-cutin-sub { animation: strike .3s 1.3s ease-out forwards; }
@keyframes strike { to { opacity: .45; text-decoration: line-through; text-decoration-thickness: .12em; text-decoration-color: var(--alarm); } }
.op-hint { position: absolute; right: 14px; top: calc(var(--scene-h) + 96px); font: 800 12px var(--font-body); color: var(--muted); background: var(--paper); padding: 2px 8px; border-radius: 99px; animation: blink 1s infinite; pointer-events: none; }
.opening[data-step="cutin"] .op-hint { display: none; }
.op-skip {
  position: absolute; right: 8px; top: 8px; min-height: 36px; padding: 0 14px; border: 2px solid var(--ink); border-radius: 99px;
  background: var(--paper); color: var(--ink); font: 800 13px var(--font-body); cursor: pointer; opacity: .9;
}
@media (prefers-reduced-motion: reduce) { .layer-char { transition: none; } }

/* 探る間ずっと出ている心の声（2026-11-04） */
.probe-mono { display: none; position: absolute; top: 52px; left: 50%; transform: translateX(-50%); z-index: 5; max-width: 92%; padding: 4px 14px; border-radius: 99px; background: rgba(30, 35, 64, .72); color: var(--paper); font-weight: 800; font-size: 13px; text-align: center; pointer-events: none; }
.stagebox[data-phase="probe"] .probe-mono { display: block; }
.stagebox.spotting .probe-mono { visibility: hidden; }

/* 長押しで調べる（2026-11-04）: 指で押し続けてもスクロール・長押しメニュー・文字選択が出ないように */
.hotspot, .probe-floor { touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
