/* 旧第三病棟 四人脱出 — 画面全体に WebGL、四隅にビデオカメラ風 HUD、タイトルは病棟の掲示板のような縦書き */
:root {
  --sa-t: env(safe-area-inset-top, 0px); --sa-r: env(safe-area-inset-right, 0px);
  --sa-b: env(safe-area-inset-bottom, 0px); --sa-l: env(safe-area-inset-left, 0px);
  --vw: 1vw; --vh: 1vh;
  --void: #050606;
  --bone: #d6d0bf;
  --dim: #8a8e86;
  --blood: #8f1d15;
  --rec: #d43b2b;
  --f-display: "Shippori Mincho B1", "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", "Noto Serif CJK JP", serif;
  --f-body: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", "Noto Sans CJK JP", sans-serif;
  --f-hud: "DotGothic16", "Osaka-Mono", "MS Gothic", ui-monospace, monospace;
  --safe-t: var(--sa-t);
  --safe-b: var(--sa-b);
  --gut-l: max(16px, var(--sa-l));
  --gut-r: max(16px, var(--sa-r));
  color-scheme: dark;
}
@supports (width: 1svmin) { :root { --vw: 1svw; --vh: 1svh; } }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--void); color: var(--bone); font-family: var(--f-body); overflow: hidden; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; background: var(--void); }

/* ---------- HUD ---------- */
.hud { position: fixed; inset: 0; pointer-events: none; font-family: var(--f-hud); color: var(--bone); font-size: clamp(12px, calc(2.8 * var(--vw)), 16px); letter-spacing: .08em; text-shadow: 0 0 6px rgba(0,0,0,.85); font-variant-numeric: tabular-nums; }
.hud > div { position: absolute; display: flex; align-items: center; gap: .7em; }
.hud-tl { top: calc(var(--safe-t) + 14px); left: var(--gut-l); }
.hud-tr { top: calc(var(--safe-t) + 14px); right: var(--gut-r); }
.hud-bl { bottom: calc(var(--safe-b) + 14px); left: var(--gut-l); }
.hud-br { bottom: calc(var(--safe-b) + 14px); right: var(--gut-r); color: var(--bone); flex-direction: column; align-items: flex-end !important; gap: .45em !important; text-align: right; max-width: 46vw; }
.hud-bl { flex-direction: column; align-items: flex-start !important; gap: .3em !important; }
#loc { color: var(--dim); }
#inv { display: flex; gap: .5em; flex-wrap: wrap; justify-content: flex-end; }
#inv span { border: 1px solid rgba(214,208,191,.45); padding: 2px 7px; font-size: .85em; background: rgba(5,6,6,.5); }
#objective::before { content: "目的　"; color: var(--dim); }
.rec { display: inline-flex; align-items: center; gap: .5em; }
.rec-dot { width: .72em; height: .72em; border-radius: 50%; background: var(--rec); box-shadow: 0 0 8px var(--rec); animation: blink 1.1s steps(2) infinite; }
.bat-wrap { display: inline-flex; align-items: center; gap: .55em; }
.bat { width: 2.7em; height: 1.05em; border: 1.5px solid var(--bone); position: relative; padding: 2px; }
.bat::after { content: ""; position: absolute; right: -5px; top: 28%; width: 3px; height: 44%; background: var(--bone); }
.bat i { display: block; height: 100%; width: 34%; background: var(--bone); }
.bat.low i { background: var(--rec); }
.bat.low { animation: blink .7s steps(2) infinite; }
@keyframes blink { 50% { opacity: .15; } }
.hud.glitch { animation: hudjit .07s steps(2) infinite; }
@keyframes hudjit { 0% { transform: translate(4px,-3px); } 50% { transform: translate(-5px,2px); } 100% { transform: none; } }

#hub, .chip { pointer-events: auto; font-family: var(--f-hud); font-size: 13px; letter-spacing: .08em; color: var(--bone); text-decoration: none; padding: 6px 10px; border: 1px solid rgba(214,208,191,.45); background: rgba(5,6,6,.55); border-radius: 0; cursor: pointer; }
#hub:hover, .chip:hover { border-color: var(--bone); background: rgba(143,29,21,.55); }
#hub:focus-visible, .chip:focus-visible, .btn:focus-visible { outline: 2px solid var(--rec); outline-offset: 3px; }

/* モードごとの出し分け */
body:not([data-mode="demo"]) #hub, body:not([data-mode="demo"]) #demo-tag { display: none; }
body[data-panel="menu"] #demo-tag, body[data-panel="lobby"] #demo-tag, body[data-panel="menu"] #hub, body[data-panel="lobby"] #hub { display: none; }
body[data-mode="demo"] .rec, body[data-mode="demo"] #abort, body[data-mode="demo"] .hud-br, body[data-mode="demo"] #loc { display: none; }
body:not([data-mode="play"]) #mini, body:not([data-mode="play"]) #team, body:not([data-mode="play"]) #feed, body:not([data-mode="play"]) #guide, body:not([data-mode="play"]) #hideArrow, body:not([data-mode="play"]) #prog, body:not([data-mode="play"]) #down, body:not([data-mode="play"]) #outbox, body:not([data-mode="play"]) #lives,
body:not([data-mode="play"]) #msg, body:not([data-mode="play"]) #prompt, body:not([data-mode="play"]) #stam, body:not([data-mode="play"]) #breath, body:not([data-mode="play"]) #tbtns, body:not([data-mode="play"]) #noise, body:not([data-mode="play"]) #map { display: none !important; }
body[data-mode="end"] #pulse, body[data-mode="loading"] #pulse { display: none; }
body:not(.touch) #abort { display: none; }
body[data-mode="end"] .hud, body[data-mode="loading"] .hud { display: none; }
body:not([data-mode="end"]) #end { display: none; }
body:not([data-mode="loading"]) #loading { display: none; }

/* ---------- デモ表示（小さく） ---------- */
#demo-tag { position: fixed; left: 50%; bottom: calc(var(--safe-b) + 18px); transform: translateX(-50%); display: flex; align-items: center; gap: .6em; font-family: var(--f-hud); font-size: 14px; letter-spacing: .2em; color: var(--bone); text-shadow: 0 0 6px #000; pointer-events: none; white-space: nowrap; }
#demo-tag i { width: .6em; height: .6em; background: var(--bone); clip-path: polygon(0 0, 100% 50%, 0 100%); }
#demo-tag em { font-style: normal; animation: blink 1.4s steps(2) infinite; }
body.touch #demo-tag .pc, body:not(.touch) #demo-tag .tc { display: none; }

/* ---------- 演出の文字 ---------- */
#cue { position: fixed; inset: var(--sa-t) var(--sa-r) var(--sa-b) var(--sa-l); display: grid; place-items: center; pointer-events: none; font-family: var(--f-display); font-weight: 800; font-size: clamp(44px, calc(13 * var(--vw)), 128px); letter-spacing: .32em; padding-left: .32em; color: var(--blood); text-shadow: 0 0 22px rgba(143,29,21,.7), 2px 0 0 rgba(30,80,90,.4); opacity: 0; }
#cue.on { animation: cue 3.6s linear forwards; }
@keyframes cue { 0% { opacity: 0; } 5% { opacity: .85; } 7% { opacity: 0; } 10% { opacity: 1; transform: translateX(-4px); } 12% { transform: none; } 38% { opacity: .9; } 40% { opacity: .05; } 43% { opacity: 1; } 74% { opacity: 1; } 76% { opacity: 0; } 79% { opacity: .6; } 100% { opacity: 0; } }

#joy { position: fixed; width: 112px; height: 112px; margin: -56px 0 0 -56px; border: 1.5px solid rgba(214,208,191,.32); border-radius: 50%; pointer-events: none; }
#joy i { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(214,208,191,.22); }

/* ---------- プレイ開始直後のタイトル ---------- */
#intro { position: fixed; inset: 0; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: clamp(14px, calc(4 * var(--vw)), 56px); pointer-events: none;
  padding-block: calc(var(--safe-t) + clamp(56px, calc(9 * var(--vh)), 90px)) calc(var(--safe-b) + clamp(40px, calc(7 * var(--vh)), 70px));
  padding-left: var(--gut-l); padding-right: var(--gut-r);
  background: linear-gradient(90deg, rgba(5,6,6,.82) 0%, rgba(5,6,6,.45) 46%, rgba(5,6,6,0) 68%, rgba(5,6,6,.55) 100%);
  opacity: 0; visibility: hidden; transition: opacity 1.4s ease, visibility 0s linear 1.4s; }
#intro.on { opacity: 1; visibility: visible; transition: opacity .6s ease; }
.mast { grid-column: 2; grid-row: 1; align-self: start; display: flex; flex-direction: column; gap: clamp(10px, calc(2 * var(--vw)), 22px); writing-mode: vertical-rl; margin-right: clamp(0px, calc(3 * var(--vw)), 40px); }
.mast h1 { margin: 0; font-family: var(--f-display); font-weight: 800; font-size: clamp(50px, calc(11.5 * var(--vh)), 124px); line-height: 1.1; letter-spacing: .16em; white-space: nowrap; color: var(--bone); text-shadow: 0 0 30px rgba(0,0,0,.9); }
.mast p { margin: 0; font-family: var(--f-display); font-weight: 500; font-size: clamp(12px, calc(1.9 * var(--vh)), 15px); line-height: 1.4; letter-spacing: .42em; white-space: nowrap; color: var(--dim); padding-top: .6em; }
.mast p b { color: var(--blood); font-weight: 500; }
.info { grid-column: 1; grid-row: 1; align-self: end; max-width: 36ch; min-width: 0; display: flex; flex-direction: column; gap: 18px; margin-left: clamp(0px, calc(4 * var(--vw)), 48px); }
.lede { margin: 0; font-family: var(--f-display); font-weight: 500; font-size: clamp(20px, calc(3.2 * var(--vh)), 28px); line-height: 1.5; letter-spacing: .08em; text-wrap: balance; text-shadow: 0 0 12px #000; }
.notes { margin: 0; display: grid; grid-template-columns: auto minmax(0,1fr); gap: 10px 14px; font-size: 13.5px; line-height: 1.65; text-shadow: 0 0 8px #000; }
.notes dt { font-family: var(--f-hud); color: var(--dim); letter-spacing: .12em; padding-top: 1px; }
.notes dd { margin: 0; }
.notes dd.warn { color: #e6b3aa; }
body.touch .desk, body:not(.touch) .tch { display: none; }

/* ---------- 終わり ---------- */
#end { position: fixed; inset: 0; overflow-y: auto; background: #000; display: grid; place-content: center; align-content: safe center; justify-items: center; gap: 30px; text-align: center; padding-block: calc(var(--sa-t) + 40px) calc(var(--sa-b) + 40px); padding-left: var(--gut-l); padding-right: var(--gut-r); opacity: 0; transition: opacity 2.4s ease; }
#end.in { opacity: 1; }
#end .stamp { font-family: var(--f-hud); color: var(--dim); letter-spacing: .14em; font-size: 14px; }
#end h2 { margin: 0; font-family: var(--f-display); font-weight: 500; font-size: clamp(22px, calc(5.4 * var(--vw)), 40px); line-height: 1.7; letter-spacing: .22em; text-wrap: balance; }
#end .sub { margin: 0; color: var(--dim); font-size: 14px; line-height: 1.8; }
#end .end-hint { margin: 0; max-width: 34ch; font-family: var(--f-hud); font-size: 13px; line-height: 1.8; letter-spacing: .08em; color: #c9a59e; border-top: 1px solid rgba(214,208,191,.18); padding-top: 14px; }
#end.clear { background: radial-gradient(120% 90% at 50% 100%, #3b4756 0%, #141b23 55%, #06080b 100%); }
#end.clear .stamp { color: #a9b6c2; }
.end-btns { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.btn { appearance: none; display: inline-flex; align-items: center; gap: .9em; font-family: var(--f-display); font-weight: 800; font-size: 20px; letter-spacing: .4em; padding: 13px 20px 13px 26px; color: var(--bone); background: transparent; border: 1px solid var(--bone); border-radius: 0; cursor: pointer; transition: background .25s, border-color .25s; }
.btn::before { content: ""; width: .5em; height: .5em; background: var(--rec); border-radius: 50%; box-shadow: 0 0 10px var(--rec); }
.btn.ghost { font-size: 15px; letter-spacing: .2em; border-color: rgba(214,208,191,.4); color: var(--dim); }
.btn.ghost::before { display: none; }
.btn:hover { background: var(--blood); border-color: var(--blood); color: var(--bone); }

#loading { position: fixed; inset: 0; display: grid; place-items: center; background: var(--void); font-family: var(--f-hud); color: var(--dim); letter-spacing: .14em; padding-block: var(--sa-t) var(--sa-b); padding-left: var(--gut-l); padding-right: var(--gut-r); text-align: center; }

@media (max-width: 640px) {
  #intro { grid-template-columns: minmax(0,1fr); grid-template-rows: auto 1fr; background: linear-gradient(180deg, rgba(5,6,6,.5) 0%, rgba(5,6,6,0) 40%, rgba(5,6,6,.85) 100%); }
  .mast { grid-column: 1; grid-row: 1; justify-self: end; margin-right: 0; }
  .mast h1 { font-size: clamp(40px, calc(7.2 * var(--vh)), 84px); }
  .info { grid-column: 1; grid-row: 2; margin-left: 0; max-width: none; gap: 14px; }
  .notes { font-size: 12.5px; }
  #demo-tag { bottom: calc(var(--safe-b) + 46px); }
}
/* 短い横画面では縦書きと注意書きを、HUD の上下の間に収める。 */
@media (max-height: 500px) and (orientation: landscape) {
  #intro { padding-block: calc(var(--sa-t) + 40px) calc(var(--sa-b) + 28px); }
  .mast h1 { font-size: clamp(28px, calc(11.5 * var(--vh)), 50px); }
  .info { gap: 12px; }
  .notes { font-size: 12px; gap: 6px 10px; line-height: 1.55; }
  #end { gap: 14px; padding-block: calc(var(--sa-t) + 24px) calc(var(--sa-b) + 24px); }
  #end h2 { font-size: clamp(22px, calc(5.4 * var(--vw)), 30px); }
  #end .end-hint { max-width: 50ch; }
}
@media (prefers-reduced-motion: reduce) {
  .hud.glitch { animation: none; }
}

/* ---------- 脱出編の HUD：短い文・調べる・スタミナ・息・物音・案内図・タッチのボタン ---------- */
#msg { position: fixed; left: 50%; top: calc(var(--safe-t) + 25%); transform: translateX(-50%); max-width: min(88vw, 40em); text-align: center; font-family: var(--f-display); font-weight: 500; font-size: clamp(15px, calc(2.2 * var(--vh) + 6px), 21px); line-height: 1.6; letter-spacing: .08em; color: var(--bone); text-shadow: 0 0 10px #000, 0 0 3px #000; pointer-events: none; opacity: 0; transition: opacity .5s; }
#msg.on { opacity: 1; transition: opacity .15s; }
#prompt { position: fixed; left: 50%; top: 58%; transform: translateX(-50%); font-family: var(--f-hud); font-size: 15px; letter-spacing: .12em; color: var(--bone); text-shadow: 0 0 6px #000; pointer-events: none; opacity: 0; transition: opacity .15s; white-space: nowrap; display: flex; align-items: center; gap: .6em; }
#prompt.on { opacity: .92; }
#prompt kbd { font-family: var(--f-hud); border: 1px solid var(--bone); padding: 1px 7px; font-size: 13px; }
body.touch #prompt { display: none; }
#stam { position: fixed; left: 50%; bottom: calc(var(--safe-b) + 54px); width: min(220px, 40vw); height: 4px; transform: translateX(-50%); background: rgba(214,208,191,.18); opacity: 0; transition: opacity .4s; pointer-events: none; }
#stam.on { opacity: 1; }
#stam i { display: block; height: 100%; width: 100%; background: var(--bone); }
#stam.tired i { background: var(--rec); }
#breath { position: fixed; left: 50%; top: calc(var(--safe-t) + 9%); transform: translateX(-50%); display: none; flex-direction: column; align-items: center; gap: 8px; font-family: var(--f-hud); font-size: 13px; letter-spacing: .12em; color: var(--dim); text-shadow: 0 0 6px #000; pointer-events: none; }
#breath.on { display: flex; }
#breath.hold { color: var(--bone); }
#breath b { display: block; width: min(180px, 40vw); height: 4px; background: rgba(214,208,191,.18); }
#breath i { display: block; height: 100%; background: #9fb8bd; }
body.touch #breath .pc, body:not(.touch) #breath .tc { display: none; }
#noise { position: fixed; left: 50%; bottom: calc(var(--safe-b) + 64px); width: 40px; height: 40px; margin-left: -20px; border-radius: 50%; border: 1.5px solid rgba(214,208,191,.6); opacity: 0; pointer-events: none; }
#noise.on { animation: noise .6s ease-out forwards; }
@keyframes noise { 0% { opacity: .8; transform: scale(.4); } 100% { opacity: 0; transform: scale(calc(.8 + var(--s, .5) * 3)); } }

#map { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(3,4,4,.78); padding-block: calc(var(--sa-t) + 12px) calc(var(--sa-b) + 12px); padding-left: var(--gut-l); padding-right: var(--gut-r); z-index: 5; }
.map-box { width: min(980px, 100%); max-height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(170px, 260px); grid-template-rows: auto minmax(0, 1fr); gap: 10px 16px; background: rgba(12,14,14,.92); border: 1px solid rgba(214,208,191,.3); padding: 14px; }
.map-head { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; font-family: var(--f-hud); letter-spacing: .1em; }
#mapCv { width: 100%; height: min(66vh, 62vw); min-height: 0; }
#mapList { margin: 0; padding-left: 1.4em; display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; line-height: 1.5; color: var(--dim); }
#mapList li.done { text-decoration: line-through; opacity: .55; }
#mapList li.now { color: var(--bone); }
#mapList li span { display: block; font-size: 12px; color: var(--dim); }
@media (max-width: 720px) {
  .map-box { grid-template-columns: minmax(0, 1fr); }
  #mapList { font-size: 12px; gap: 4px; }
  #mapList li:not(.now) { display: none; }
  #mapCv { height: 52vh; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .map-box { padding: 10px; grid-template-columns: minmax(0, 1fr) minmax(150px, 210px); }
  #mapCv { height: calc(var(--vh) * 100 - 96px - var(--sa-t) - var(--sa-b)); }
  #mapList { font-size: 12px; gap: 6px; }
}

#tbtns { display: none; }
body.touch #tbtns { display: grid; position: fixed; right: max(12px, var(--sa-r)); bottom: calc(var(--safe-b) + 44px); grid-template-columns: repeat(3, auto); gap: 8px; justify-items: end; align-items: end; pointer-events: none; }
.tb { pointer-events: auto; appearance: none; font-family: var(--f-hud); font-size: 13px; letter-spacing: .06em; color: var(--bone); background: rgba(5,6,6,.45); border: 1.5px solid rgba(214,208,191,.42); border-radius: 50%; width: 62px; height: 62px; padding: 0; touch-action: none; -webkit-user-select: none; user-select: none; line-height: 1.15; }
.tb.small { width: 50px; height: 50px; font-size: 11px; }
.tb.big { grid-column: 2 / span 2; width: 132px; height: 64px; border-radius: 32px; font-size: 14px; }
.tb.dim { opacity: .5; }
.tb.press { background: rgba(143,29,21,.6); border-color: var(--bone); }
#bBreath { display: none; }
body[data-hide]:not([data-hide=""]) #bBreath { display: block; }
body[data-hide]:not([data-hide=""]) #bRun, body[data-hide]:not([data-hide=""]) #bCrouch { visibility: hidden; }
body.touch .hud-br { bottom: calc(var(--safe-b) + 14px); right: auto; left: 50%; transform: translateX(-50%); align-items: center !important; text-align: center; max-width: 60vw; font-size: 12px; }
body.touch .hud-bl { display: none; }

/* タイトルの「脱出」は、病棟名の左に赤い小さな列で */
.mast h1 .ex { display: block; font-size: .5em; color: var(--blood); padding-top: 3.2em; letter-spacing: .3em; text-shadow: 0 0 18px rgba(143,29,21,.5); }

#pulse { position: fixed; inset: 0; pointer-events: none; opacity: 0; box-shadow: inset 0 0 12vmin 3vmin rgba(150,12,8,.85); }
#breath em { display: none; font-style: normal; font-size: 15px; font-weight: 700; color: #ff9b8f; animation: blink .5s steps(2) infinite; }
#breath.warn em { display: block; }
#breath.warn .pc, #breath.warn .tc { display: none; }
#breath u { display: none; width: min(180px, 40vw); height: 3px; background: rgba(214,208,191,.12); }
#breath.warn u, #breath.sus u { display: block; }
#breath u i { display: block; height: 100%; width: 0; background: #d43b2b; }
@media (prefers-reduced-motion: reduce) { #breath em { animation: none; } }


/* ---------- 四人脱出の HUD ---------- */
#blood { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0; }
#mini { position: fixed; top: calc(var(--safe-t) + 48px); left: var(--gut-l); width: clamp(92px, 15vmin, 140px); height: clamp(92px, 15vmin, 140px); pointer-events: none; }
#lives { display: inline-flex; align-items: center; gap: 4px; color: #e6b3aa; }
#lives i { width: .78em; height: .78em; border-radius: 50%; background: #d43b2b; box-shadow: 0 0 6px #d43b2b; }
#lives.flash { animation: lflash 1.2s ease-out; }
@keyframes lflash { 0%, 30% { transform: scale(1.35); filter: brightness(2); } 100% { transform: none; } }
#team { position: fixed; top: calc(var(--safe-t) + 48px); right: var(--gut-r); display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-family: var(--f-hud); font-size: 12.5px; letter-spacing: .06em; pointer-events: none; text-shadow: 0 0 6px #000; }
#team span { border-right: 4px solid var(--c); padding: 1px 7px; background: rgba(5,6,6,.5); color: var(--c); }
#team em { font-style: normal; color: var(--bone); margin-left: .6em; font-size: .9em; }
#feed { position: fixed; top: calc(var(--safe-t) + 150px); right: var(--gut-r); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; pointer-events: none; max-width: min(46vw, 22em); }
#feed div { font-family: var(--f-body); font-weight: 700; font-size: 13px; line-height: 1.4; color: #fff; background: rgba(5,6,6,.66); border-left: 4px solid var(--c, #fff); padding: 5px 10px; text-shadow: 0 0 4px #000; animation: feedin .25s ease-out; transition: opacity .8s; }
#feed div.out { opacity: 0; }
@keyframes feedin { from { transform: translateX(30px); opacity: 0; } }
#keys { display: flex; gap: 6px; }
#keys span { min-width: 2.1em; text-align: center; padding: 2px 6px; border: 2px solid var(--c); color: var(--c); background: rgba(5,6,6,.6); opacity: .55; font-family: var(--f-body); font-weight: 700; }
#keys span::before { content: "鍵 "; font-size: .8em; }
#keys span.got { background: var(--c); color: #111; opacity: 1; box-shadow: 0 0 10px var(--c); }
#keys span.flash { animation: kflash 1.4s ease-out; }
@keyframes kflash { 0%, 25% { transform: scale(1.6); } 100% { transform: none; } }

#guide { position: fixed; left: 50%; top: calc(var(--safe-t) + 12%); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; pointer-events: none; opacity: 0; max-width: min(94vw, 40em); padding: 12px 22px; background: rgba(5,6,6,.72); border-top: 2px solid #46e68c; border-bottom: 2px solid #46e68c; }
#guide.on { animation: guide 5.5s ease forwards; }
@keyframes guide { 0% { opacity: 0; transform: translate(-50%, -10px); } 6% { opacity: 1; transform: translate(-50%, 0); } 88% { opacity: 1; } 100% { opacity: 0; } }
#guide b { font-family: var(--f-display); font-weight: 800; font-size: clamp(20px, calc(3.2 * var(--vh) + 8px), 30px); letter-spacing: .1em; color: #fff; }
#guide span { font-family: var(--f-body); font-weight: 700; font-size: clamp(13px, calc(1.6 * var(--vh) + 6px), 17px); line-height: 1.5; color: #a6f2c6; }
#hideArrow { --r: 0rad; position: fixed; left: 50%; bottom: calc(var(--safe-b) + 92px); transform: translateX(-50%); display: none; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; color: #6ff0a4; font-family: var(--f-body); font-weight: 700; font-size: 13px; text-shadow: 0 0 6px #000; }
#hideArrow.on { display: flex; }
#hideArrow i { width: 44px; height: 44px; transform: rotate(var(--r)); background: radial-gradient(closest-side, rgba(70,230,140,.25), transparent); position: relative; }
#hideArrow i::before { content: ""; position: absolute; left: 50%; top: 2px; transform: translateX(-50%); border: 11px solid transparent; border-bottom: 22px solid #46e68c; border-top: 0; filter: drop-shadow(0 0 6px rgba(70,230,140,.9)); }
#hideArrow span::before { content: "隠れ場所 "; color: #a6f2c6; }
body.touch #hideArrow { bottom: calc(var(--safe-b) + 118px); }
#guide b, #guide span { text-wrap: balance; }
#prog { position: fixed; left: 50%; top: 64%; transform: translateX(-50%); display: none; flex-direction: column; align-items: center; gap: 8px; font-family: var(--f-hud); color: var(--bone); text-shadow: 0 0 6px #000; pointer-events: none; }
#prog.on { display: flex; }
#prog b { width: min(240px, 50vw); height: 6px; background: rgba(214,208,191,.2); }
#prog i { display: block; height: 100%; width: 0; background: #2bd77a; box-shadow: 0 0 8px #2bd77a; }
#down { position: fixed; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; pointer-events: none; padding: 0 var(--gut-r) 0 var(--gut-l); }
#down.on { display: flex; }
#down b { font-family: var(--f-display); font-weight: 500; font-size: clamp(22px, calc(5 * var(--vw)), 36px); letter-spacing: .2em; color: var(--bone); }
#down span { font-family: var(--f-hud); font-size: 14px; letter-spacing: .1em; color: #e6b3aa; }
#outbox { position: fixed; left: 50%; bottom: calc(var(--safe-b) + 24px); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px 18px; background: rgba(5,6,6,.7); border: 1px solid rgba(214,208,191,.35); text-align: center; font-family: var(--f-body); font-weight: 700; font-size: 14px; max-width: 92vw; }
#outbox div { display: flex; gap: 10px; }
body[data-mode="play"] .hud-br { pointer-events: none; }

/* ---------- はじめ方・部屋 ---------- */
#menu, #lobby { position: fixed; inset: 0; z-index: 6; display: grid; place-items: center; overflow-y: auto; background: radial-gradient(120% 90% at 50% 40%, rgba(5,6,6,.55), rgba(5,6,6,.9)); padding-block: calc(var(--sa-t) + 16px) calc(var(--sa-b) + 16px); padding-left: var(--gut-l); padding-right: var(--gut-r); }
.menu-box, .lb-box { display: flex; flex-direction: column; align-items: stretch; gap: 14px; width: min(440px, 100%); }
.menu-box h1 { margin: 0 0 4px; font-family: var(--f-display); font-weight: 800; font-size: clamp(32px, calc(6 * var(--vh) + 10px), 54px); letter-spacing: .14em; text-align: center; text-shadow: 0 0 20px #000; }
.menu-box h1 span { display: block; font-size: .46em; color: var(--rec); letter-spacing: .5em; padding-left: .5em; }
.m-lede { margin: 0 0 8px; text-align: center; color: var(--dim); font-size: 14px; }
.menu-box .btn, .lb-box .btn { justify-content: center; flex-wrap: wrap; }
.btn small { display: block; width: 100%; font-family: var(--f-body); font-weight: 400; font-size: 12px; letter-spacing: .1em; color: var(--dim); }
.btn:disabled { opacity: .45; cursor: default; background: transparent; border-color: rgba(214,208,191,.4); }
.lb-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-family: var(--f-hud); letter-spacing: .1em; }
.lb-head b { font-size: 18px; } #lbNote { font-size: 11px; color: var(--dim); }
#lbMake { display: flex; flex-direction: column; gap: 12px; }
.join { display: flex; gap: 8px; }
.join input { flex: 1; min-width: 0; font-family: var(--f-hud); font-size: 20px; letter-spacing: .3em; text-transform: uppercase; color: var(--bone); background: rgba(5,6,6,.7); border: 1px solid rgba(214,208,191,.5); padding: 8px 10px; }
.join .chip { font-size: 14px; }
#lbIn { display: flex; flex-direction: column; gap: 12px; align-items: center; }
#lbRoom { font-family: var(--f-hud); font-size: clamp(28px, 7vmin, 44px); letter-spacing: .3em; color: #fff; }
#lbQrBox { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--dim); line-height: 1.6; }
#lbQr { background: #fff; image-rendering: pixelated; }
#lbSeats { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#lbSeats li { border-left: 5px solid var(--c); background: rgba(5,6,6,.6); padding: 6px 10px; font-size: 13.5px; }
#lbSeats li.dim { opacity: .45; }
#lbStatus { min-height: 1.4em; text-align: center; font-size: 13.5px; color: var(--dim); }
#lbStatus.ok { color: #6ff0a4; } #lbStatus.err { color: #ff8f80; } #lbStatus.wait { color: var(--bone); }
#mapList li.legend { list-style: none; margin-left: -1.4em; font-size: 12px; color: var(--dim); }
#mapList li.legend i { display: inline-block; width: .8em; height: .8em; border-radius: 50%; background: var(--c); margin: 0 .3em 0 .2em; vertical-align: -.05em; }
@media (max-height: 500px) and (orientation: landscape) {
  .menu-box, .lb-box { gap: 8px; }
  #lbQrBox canvas { max-height: 30vh; }
  #mini { width: 84px; height: 84px; top: calc(var(--safe-t) + 40px); }
  #feed { top: calc(var(--safe-t) + 110px); }
}


/* ---------- 1.1：彼女が近いときの画面 ---------- */
#pulse { box-shadow: none; background: radial-gradient(ellipse at center, rgba(120,0,0,0) 30%, rgba(150,8,6,.55) 70%, rgba(170,10,8,.85) 100%); filter: blur(6px); }
#chaseVig { position: fixed; inset: 0; pointer-events: none; opacity: 0; --r: 70%; --r2: 92%;
  -webkit-mask-image: radial-gradient(ellipse 72% 72% at center, transparent var(--r), #000 var(--r2)); mask-image: radial-gradient(ellipse 72% 72% at center, transparent var(--r), #000 var(--r2)); }
#chaseVig[data-m="seen"] { background: radial-gradient(ellipse at center, rgba(255,40,20,.85), rgba(200,0,0,.95) 60%, rgba(120,0,0,1)); }
#chaseVig[data-m="lost"] { background: repeating-linear-gradient(135deg, rgba(60,6,10,.92) 0 10px, rgba(20,2,6,.75) 10px 22px); }
#chaseTag { position: fixed; left: 50%; top: calc(var(--safe-t) + 54px); transform: translateX(-50%); padding: 4px 16px; font-family: var(--f-body); font-weight: 700; font-size: 16px; white-space: nowrap; pointer-events: none; display: none; text-shadow: 0 0 6px #000; }
#chaseTag.seen { display: block; color: #fff; background: rgba(200,0,0,.75); border: 2px solid #ff6a5a; animation: blink .4s steps(2) infinite; }
#chaseTag.lost { display: block; color: #e9c9d0; background: rgba(30,4,10,.75); border: 2px dashed rgba(200,120,140,.8); }
body:not([data-mode="play"]) #chaseTag, body:not([data-mode="play"]) #chaseVig { display: none; }
#mapList li.legend b.x { color: #d65040; margin: 0 .25em 0 .4em; }
@media (prefers-reduced-motion: reduce) { #chaseTag.seen { animation: none; } }
