:root {
  --bg: #050608;
  --panel: #0c1018;
  --line: #1e2a3a;
  --text: #d8e6f5;
  --muted: #7a8ca0;
  --acc: #5ad0ff;
  --hot: #ff6b5a;
  --gold: #f0d060;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, "Noto Sans KR", sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
#wrap {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
}
.bar {
  width: min(960px, 100%);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--muted);
}
.brand span { color: var(--acc); font-weight: 700; letter-spacing: 0.12em; }
.hud { display: flex; flex-wrap: wrap; gap: 14px; }
.hud b { color: var(--gold); font-variant-numeric: tabular-nums; }
#stage-box {
  position: relative;
  width: min(960px, 100%);
  aspect-ratio: 384 / 216;
  background: #000;
  border: 2px solid var(--line);
  box-shadow: 0 0 0 1px #000, 0 20px 50px rgba(0,0,0,.55);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
#c {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #02040a;
}
#scan {
  pointer-events: none;
  /* inset 단축 속성은 Chrome 87 부터다. 구버전(실기: Android 11 · Chrome 83)은 이 선언을
       통째로 버려 절대배치 요소가 스테이지를 덮지 못하고 정적 위치로 내려앉는다.
       실측 2026-08-07: 이 때문에 6대 캐비닛 전부 START 가 화면 밖으로 밀려 누를 수 없었다. */
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0) 0px,
    rgba(0,0,0,0) 2px,
    rgba(0,0,0,.28) 2px,
    rgba(0,0,0,.28) 3px
  );
  mix-blend-mode: multiply;
  opacity: 0.85;
}
#scan.off { display: none; }
#overlay {
  /* inset 단축 속성은 Chrome 87 부터다. 구버전(실기: Android 11 · Chrome 83)은 이 선언을
       통째로 버려 절대배치 요소가 스테이지를 덮지 못하고 정적 위치로 내려앉는다.
       실측 2026-08-07: 이 때문에 6대 캐비닛 전부 START 가 화면 밖으로 밀려 누를 수 없었다. */
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(2,4,10,.78);
  text-align: center; padding: 16px; gap: 8px;
}
#overlay h1 {
  margin: 0; font-size: clamp(2rem, 6vw, 3.2rem);
  letter-spacing: 0.2em; color: var(--acc);
  text-shadow: 0 0 18px rgba(90,208,255,.45);
}
#overlay .tag { margin: 0; color: var(--gold); font-size: 0.85rem; letter-spacing: 0.08em; }
#overlay p { margin: 0; color: var(--muted); font-size: 0.92rem; }
#overlay .hint { color: var(--text); max-width: 28rem; }
#overlay.hidden { display: none; }
#btn-start {
  margin-top: 10px;
  border: 1px solid var(--acc);
  background: linear-gradient(180deg, #1a3a50, #0e2030);
  color: var(--acc);
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 12px 22px;
  border-radius: 6px;
  cursor: pointer;
}
#btn-start:hover { filter: brightness(1.1); }
#toast {
  position: absolute; left: 50%; top: 18%; transform: translateX(-50%);
  background: rgba(0,0,0,.7); border: 1px solid var(--line);
  padding: 6px 12px; border-radius: 4px; font-size: 0.85rem; color: var(--gold);
}
.foot .chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
#fps { font-variant-numeric: tabular-nums; min-width: 4.5rem; text-align: right; }
#touch {
  display: none;
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  gap: 10px;
  justify-content: space-between;
  pointer-events: none;
  z-index: 5;
}
#touch button {
  pointer-events: auto;
  min-width: 72px;
  min-height: 56px;
  border: 1px solid rgba(90, 208, 255, 0.45);
  background: rgba(8, 16, 28, 0.72);
  color: var(--acc);
  font-weight: 700;
  font-size: 1rem;
  border-radius: 10px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
#touch #t-fire {
  flex: 1;
  max-width: 140px;
  color: var(--gold);
  border-color: rgba(240, 208, 96, 0.5);
}
@media (hover: none), (max-width: 720px) {
  #touch { display: flex; }
  /* CabinShell already owns the landscape thumb controls. Keep these legacy
     buttons only as a no-shell fallback so the playfield is never covered by
     a second left/fire/right row. */
  body.cab-touch-active #touch { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  #scan { opacity: 0.4; }
}
