:root {
  color-scheme: dark;
  --ink: #f2e9df;
  --muted: #ccbbad;
  --panel: #1a1118;
  --line: #80636c;
  --accent: #f0be91;
  font-family: 'Yu Gothic', 'Meiryo', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #0d090f; color: var(--ink); }
[hidden] { display: none !important; }
a { color: #f3cfac; }
button, input { font: inherit; }
button { color: inherit; background: #271b24; border: 1px solid #87697499; border-radius: 6px; padding: 10px 15px; min-height: 44px; cursor: pointer; touch-action: manipulation; }
button:not(:disabled):hover { border-color: var(--accent); background: #392434; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid #ffdeab; outline-offset: 3px; }
button:disabled { opacity: .6; cursor: default; }
button.primary { background: var(--accent); color: #271820; border-color: var(--accent); font-weight: 700; }
button.primary:not(:disabled):hover { background: #ffdbb9; }
#game, #view, .vignette, #title, #hud { position: absolute; inset: 0; width: 100%; height: 100%; }
#view { display: block; touch-action: none; }
.vignette { box-shadow: inset 0 0 13vw #060409aa; pointer-events: none; }
#title { overflow: auto; padding: max(25px, env(safe-area-inset-top)) 7vw 28px; background: linear-gradient(90deg,#130a13fa,#180d17c9 40%,#120a123a 76%); }
.brand { font-size: 14px; letter-spacing: .08em; text-decoration: none; }
.title-copy { margin-top: clamp(42px, 9vh, 110px); max-width: 820px; text-shadow: 0 2px 12px #000; }
.eyebrow { letter-spacing: .14em; font-size: 12px; color: #e0b69e; margin: 0 0 8px; }
h1, h2 { font-family: 'Yu Mincho', 'Hiragino Mincho ProN', serif; font-weight: 600; }
h1 { line-height: 1.29; font-size: clamp(32px, 5.4vw, 75px); margin: 0 0 19px; }
h1 em { color: #efb092; font-style: normal; }
.lead { font-size: clamp(15px, 1.5vw, 20px); line-height: 1.85; }
.note { line-height: 1.75; color: var(--muted); font-size: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 9px; margin: 18px 0; }
#error { color: #ffc9b4; }
#hud { pointer-events: none; }
#hud button, #stick { pointer-events: auto; }
.top { position: absolute; top: max(14px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left)); right: max(14px, env(safe-area-inset-right)); display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.task { padding: 11px 15px; max-width: min(56%, 470px); background: #140e17e8; border-left: 2px solid #d49c82; }
.task p:last-child { margin: 0; font-size: 15px; line-height: 1.55; }
.tools { display: flex; gap: 6px; }
.tools button { font-size: 13px; padding-inline: 10px; }
#light[aria-pressed=true] { border-color: #e9b88c; }
.crosshair { position: absolute; top: 50%; left: 50%; width: 4px; height: 4px; border-radius: 50%; background: #fff9dfbb; box-shadow: 0 0 5px #161018; }
#cue { position: absolute; top: 110px; left: max(15px, env(safe-area-inset-left)); padding: 7px 11px; background: #18111ad9; color: #ffe1be; border-radius: 5px; font-size: 13px; }
#cue:empty, #subtitle:empty { display: none; }
#subtitle { position: absolute; bottom: 18%; left: 50%; width: min(760px, 76vw); transform: translateX(-50%); margin: 0; padding: 10px 14px; background: #120911e9; line-height: 1.65; text-align: center; border: 1px solid #684955; border-radius: 5px; }
#interaction { position: absolute; bottom: 55px; left: 50%; transform: translateX(-50%); text-align: center; max-width: 54vw; }
#interaction p { margin: 0 0 5px; font-size: 12px; color: #fff0d9; text-shadow: 0 1px 4px #000, 0 1px 4px #000; }
#desktop-hint { position: absolute; bottom: 6px; width: 100%; text-align: center; color: #d4c0b9; font-size: 12px; text-shadow: 0 2px 5px #000; }
#touch { display: none; }
#touch button, #stick, #view { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#stick { position: absolute; bottom: max(22px, env(safe-area-inset-bottom)); left: max(22px, env(safe-area-inset-left)); width: 100px; height: 100px; border: 1px solid #c29a9c91; border-radius: 50%; background: #28182190; touch-action: none; }
#stick i { position: absolute; left: 33px; top: 33px; width: 32px; height: 32px; border-radius: 50%; background: #ffdbc4a0; pointer-events: none; }
#stick span { position: absolute; bottom: 7px; inset-inline: 0; text-align: center; font-size: 11px; }
#run, #turn-left, #turn-right { position: absolute; bottom: max(23px, env(safe-area-inset-bottom)); padding: 6px 9px; min-width: 44px; touch-action: none; }
#run { left: max(35px, env(safe-area-inset-left)); bottom: 132px; }
#turn-left { right: max(71px, calc(env(safe-area-inset-right) + 50px)); }
#turn-right { right: max(20px, env(safe-area-inset-right)); }
#modal { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 12px; background: #09060cd9; }
#modal section { width: min(590px, 100%); max-height: 94dvh; overflow: auto; padding: clamp(17px, 4vw, 32px); border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
#modal h2 { margin: 0 0 12px; font-size: clamp(21px, 4.4vw, 30px); }
#dialog-body { line-height: 1.75; font-size: 15px; }
#dialog-body p { margin: 7px 0; }
#dialog-body label { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-block: 8px; }
#dialog-body input[type=range] { width: 45%; }
#dialog-actions { margin-bottom: 0; }
.screen { text-align: center; background: #392a37; border-radius: 4px; font-size: 12px; }
.seat-map { display: grid; grid-template-columns: 19px repeat(8, minmax(10px, 1fr)); gap: 4px; margin: 10px 0; }
.seat-map span { text-align: center; font-size: 10px; min-width: 0; padding-block: 3px; border-radius: 2px; }
.seat { background: #392331; border: 1px solid #624653; }
.seat.down { background: #8e524a; }
.seat.item { outline: 1px solid #ffc498; }
.map-footer { font-size: 12px; color: var(--muted); }
@media (pointer: coarse), (max-width: 880px) {
  #touch { display: block; }
  #desktop-hint { display: none; }
  #subtitle { bottom: 125px; width: min(690px, 90vw); font-size: 13px; }
  #interaction { bottom: 37px; }
  #cue { top: 88px; font-size: 11px; max-width: 85vw; }
  .task { padding: 7px 9px; }
  .task p:last-child { font-size: 12px; }
  .tools button { font-size: 11px; padding-inline: 6px; }
}
@media (max-height: 520px) {
  #title { padding-top: 12px; }
  .title-copy { margin-top: 18px; }
  h1 { font-size: clamp(26px, 4.6vw, 48px); margin-bottom: 6px; }
  .lead { margin-block: 6px; font-size: 13px; }
  .actions { margin-block: 9px; }
  #stick { width: 76px; height: 76px; bottom: 13px; }
  #stick i { left: 25px; top: 25px; width: 24px; height: 24px; }
  #run { bottom: 94px; }
  #subtitle { bottom: 83px; }
  #interaction { bottom: 12px; }
}
@media (max-width: 460px) and (orientation: portrait) {
  .top { flex-direction: column; }
  .task { max-width: 100%; }
  #cue { top: 138px; }
  #interaction { bottom: 104px; max-width: 67vw; }
  #subtitle { bottom: 176px; }
}
