/* SURVIVE LIMIT — 段階 1 の最小スタイル。縦長の列（最大 480px）を中央に置く。 */
:root {
  --bg: #050608;
  --panel: #0d0f16;
  --line: rgba(255, 255, 255, 0.1);
  --text: #e8eaf0;
  --muted: #8a8fa3;
  --accent: #ff2a3d;
  --heal: #3dffa8;
  --rank: #6f7a99;
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--text); overscroll-behavior: none; }
body {
  font-family: system-ui, -apple-system, "Hiragino Kaku Gothic ProN", sans-serif;
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
.hidden { display: none !important; }

#app {
  max-width: 480px; height: 100dvh; margin: 0 auto;
  display: flex; flex-direction: column;
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
}
.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.btn, .btn-primary {
  border: 1px solid var(--line); background: var(--panel);
  padding: 14px; border-radius: 10px; font-weight: 600; letter-spacing: .04em;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:disabled { opacity: .35; cursor: default; }

/* ---------- THREAT SETUP ---------- */
.setup { padding: 16px; gap: 12px; overflow-y: auto;
  background: linear-gradient(180deg, color-mix(in srgb, var(--rank) 18%, transparent), transparent 45%); }
.setup[data-rank="CALM"] { --rank: #3d8bff; }
.setup[data-rank="RISKY"] { --rank: #3dffa8; }
.setup[data-rank="SEVERE"] { --rank: #ffd400; }
.setup[data-rank="LETHAL"] { --rank: #ff8a00; }
.setup[data-rank="LIMIT"] { --rank: #ff2a3d; }
.setup[data-rank="OVERLIMIT"] { --rank: #ff3df0; }
.setup-head { border: 1px solid var(--rank); border-radius: 12px; padding: 12px; background: rgba(0,0,0,.35); }
.setup-head .label { font-size: .75rem; letter-spacing: .3em; color: var(--muted); }
.setup-head .rank { font-size: 1.6rem; font-weight: 800; letter-spacing: .12em; color: var(--rank); }
.gauge { height: 8px; background: rgba(255,255,255,.08); border-radius: 4px; margin: 8px 0; overflow: hidden; }
.gauge-fill { height: 100%; background: var(--rank); transition: width .25s; }
.numbers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.numbers .k { display: block; font-size: .7rem; color: var(--muted); }
.numbers .v { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.enemy-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.enemy-row { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.enemy-name { display: grid; grid-template-columns: 14px auto; column-gap: 8px; align-items: center; font-weight: 700; }
.enemy-name small { grid-column: 2; font-weight: 400; font-size: .7rem; color: var(--muted); }
.swatch { width: 12px; height: 12px; border-radius: 3px; }
.t-CHASER { background: #ff3b5c; } .t-DASHER { background: #ff8a00; } .t-SHOOTER { background: #c070ff; }
.t-LASER { background: #ff2a6d; } .t-MINE { background: #ffb03b; } .t-JAMMER { background: #00e5ff; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper .count { min-width: 2ch; text-align: center; font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.btn-step { width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--line); background: #151826; font-size: 1.2rem; }
.toggles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.toggle { padding: 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); font-weight: 700; }

/* ---------- GAME ---------- */
.game { position: relative; }
.hud { display: grid; grid-template-columns: 1fr auto 1fr auto; align-items: center; gap: 8px; padding: 8px 12px; }
.hud-lives { color: var(--accent); letter-spacing: .1em; }
.hud-time { font-size: 1.8rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.hud-time.danger { color: var(--accent); }
.hud-score { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.hud-score small { display: block; font-size: .6rem; color: var(--muted); letter-spacing: .2em; }
.hud-pause { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); font-weight: 800; }
.stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.field { display: block; }
.flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.flash.hit { background: rgba(255, 42, 61, .45); }
.flash.heal { background: rgba(61, 255, 168, .3); }
.flash.go { animation: flash .35s ease-out; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
.game.dying .stage { filter: saturate(.4) contrast(1.2); }
.banner { position: absolute; inset: auto 0; text-align: center; font-size: 2rem; font-weight: 900; letter-spacing: .2em; opacity: 0; pointer-events: none; }
.banner.show { opacity: 1; transition: opacity .2s; }
.banner.cleared { color: var(--heal); } .banner.failed { color: var(--accent); }
.pause-menu { position: absolute; inset: 0; background: rgba(5,6,8,.92); display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 32px; }
.pause-title { text-align: center; font-size: 1.6rem; font-weight: 900; letter-spacing: .3em; margin-bottom: 8px; }

.control-zone { position: relative; height: 34vh; min-height: 200px; touch-action: none; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.stick { position: absolute; width: 96px; height: 96px; margin: -48px 0 0 -48px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.18); opacity: 0; pointer-events: none; }
.stick.on { opacity: 1; }
.stick-knob { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; border-radius: 50%; background: rgba(255,42,61,.6); }
.dpad { position: absolute; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); width: 168px; height: 168px; display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr); gap: 4px; }
.dpad-btn { border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.06); font-size: 1.1rem; touch-action: none; }
.dpad-btn.on { background: rgba(255,42,61,.45); }
.dpad .up { grid-area: 1 / 2; } .dpad .left { grid-area: 2 / 1; } .dpad .right { grid-area: 2 / 3; } .dpad .down { grid-area: 3 / 2; }

/* ---------- RESULT ---------- */
.result { padding: 24px 16px; gap: 16px; justify-content: center; }
.result-title { font-size: 1.5rem; font-weight: 900; letter-spacing: .15em; text-align: center; }
.result.cleared .result-title { color: var(--heal); } .result.failed .result-title { color: var(--accent); }
.result-score { font-size: 2.4rem; font-weight: 900; text-align: center; font-variant-numeric: tabular-nums; }
.new-record { text-align: center; color: #ffd400; font-weight: 800; letter-spacing: .3em; }
.result-stats { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.result-stats dt { color: var(--muted); } .result-stats dd { text-align: right; font-weight: 700; }
.result-actions { display: flex; flex-direction: column; gap: 10px; }

/* ---------- 通知・調整パネル ---------- */
.notice { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); z-index: 20;
  background: #222637; border: 1px solid var(--line); padding: 8px 14px; border-radius: 8px; font-size: .85rem; }
.dev-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(320px, 90vw); z-index: 30;
  background: rgba(10,12,18,.96); border-left: 1px solid var(--line); font-size: 12px; display: flex; flex-direction: column; }
.dev-panel.collapsed { width: auto; bottom: auto; background: none; border: none; }
.dev-panel.collapsed .dev-body { display: none; }
.dev-toggle { align-self: flex-end; margin: 6px; padding: 4px 10px; border-radius: 6px; border: 1px solid #ffd400; background: #000; color: #ffd400; font-weight: 800; }
.dev-body { overflow-y: auto; padding: 0 8px 16px; }
.dev-actions { display: flex; gap: 6px; margin-bottom: 8px; }
.dev-actions button { flex: 1; padding: 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); }
.dev-row { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 2px 0; }
.dev-row span { color: var(--muted); overflow-wrap: anywhere; }
.dev-row.changed span { color: #ffd400; }
.dev-row input { width: 80px; background: #000; color: var(--text); border: 1px solid var(--line); border-radius: 4px; padding: 2px 4px; }
