:root {
  color-scheme: dark;
  --ink: #eae9ef;
  --muted: #c3c6d2;
  --panel: #141924;
  --line: #535e74;
  --accent: #e9c286;
  font-family: 'Yu Gothic', 'Meiryo', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #090c14; color: var(--ink); }
[hidden] { display: none !important; }
a { color: #e8d8ab; }
button, input { font: inherit; }
button { color: inherit; background: #1f2838; border: 1px solid #66758d99; border-radius: 6px; padding: 10px 15px; min-height: 44px; cursor: pointer; touch-action: manipulation; }
button:not(:disabled):hover { border-color: var(--accent); background: #2c394a; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid #f2dba5; outline-offset: 3px; }
button:disabled { opacity: .6; cursor: default; }
button.primary { background: var(--accent); color: #192825; border-color: var(--accent); font-weight: 700; }
button.primary:not(:disabled):hover { background: #f0dfae; }
#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 #030a0aaa; pointer-events: none; }
#title { overflow: auto; padding: max(25px, env(safe-area-inset-top)) 7vw 28px; background: linear-gradient(90deg,#0b121df5,#0c1420dc 40%,#10202a20 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: #abbfdc; 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(30px, 5.4vw, 73px); margin: 0 0 19px; }
h1 em { color: #ead5a5; 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: #101a26e8; border-left: 2px solid #b5a778; }
.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: #cadaaa; }
.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: #10272bd9; color: #efe0b5; 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: #0b111deb; line-height: 1.65; text-align: center; border: 1px solid #4e5e79; 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: #e3f2e5; text-shadow: 0 1px 4px #000, 0 1px 4px #000; }
#desktop-hint { position: absolute; bottom: 6px; width: 100%; text-align: center; color: #bfcbc2; 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 #8cb8a991; border-radius: 50%; background: #22303e90; touch-action: none; }
#stick i { position: absolute; left: 33px; top: 33px; width: 32px; height: 32px; border-radius: 50%; background: #c4d0e4a0; 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: #061013de; }
#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; }
@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; }
}



#doors { position:absolute; left:50%; bottom:55px; transform:translateX(-50%); display:flex; justify-content:center; gap:8px; width:max-content; max-width:95%; }
#doors button { font-size:13px; padding-inline:10px; background:#221b1aee; border-color:#9d7d60; }
#doors button:focus-visible,#doors button:hover { background:#4d362b; }
#doors:not([hidden]) ~ #subtitle { bottom:145px; }
body.brake .vignette { box-shadow:inset 0 0 16vw 1vw #04060b; }
@media (max-width:460px) and (orientation:portrait) { #subtitle { bottom:184px; } #doors { bottom:104px; flex-wrap:wrap; width:220px; max-width:60vw; } #doors button { flex:1 0 100%; min-height:40px; } #doors:not([hidden]) ~ #subtitle { bottom:202px; } }
@media (max-height:520px) { #doors { bottom:18px; } #doors:not([hidden]) ~ #subtitle { bottom:93px; } }
