:root { --ink: #e9eef4; --dim: #9fb0c3; --line: #253242; --panel: rgba(10, 17, 26, .92); --accent: #ff8a3c; --warn: #ffd166; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b1520; color: var(--ink); font: 14px/1.4 -apple-system, "Helvetica Neue", Arial, sans-serif; }
canvas { display: block; position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; }
button { font: inherit; }

#banner { position: fixed; top: 0; left: 0; right: 0; z-index: 30; padding: 8px 14px; background: rgba(60, 40, 0, .85); color: var(--warn); border-bottom: 1px solid rgba(255, 209, 102, .35); font-size: 13px; text-align: center; }
#banner strong { color: #fff; }

#hud { position: fixed; top: 42px; left: 0; right: 0; z-index: 20; display: flex; justify-content: space-between; align-items: flex-start; padding: 10px 14px; pointer-events: none; gap: 12px; flex-wrap: wrap; }
#brand b { display: block; font-size: 18px; letter-spacing: 4px; text-transform: uppercase; text-shadow: 0 2px 8px #000; }
#brand small { display: block; font-size: 11px; letter-spacing: 2px; color: var(--dim); text-transform: uppercase; }
#stats { display: flex; gap: 14px; flex-wrap: wrap; justify-content: flex-end; font-variant-numeric: tabular-nums; font-size: 12px; color: var(--dim); text-shadow: 0 1px 4px #000; }
#stats span:first-child { color: var(--ink); font-size: 15px; }

#edge, #unbuilt { position: fixed; left: 50%; transform: translateX(-50%); z-index: 25; padding: 8px 14px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; }
#edge { top: 96px; color: var(--warn); }
#unbuilt { top: 96px; color: var(--dim); }
#edge:not([hidden]) + #unbuilt:not([hidden]) { top: 136px; }

#status { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; background: rgba(11, 21, 32, .96); font-size: 16px; }
#status[hidden] { display: none !important; }
#status button { margin-left: 10px; padding: 6px 12px; border: 1px solid var(--line); background: #17222f; color: var(--ink); border-radius: 6px; }

#controls { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
#bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: center; }
#bar .hint { color: var(--dim); font-size: 12px; margin-right: auto; }
#bar button { padding: 8px 12px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px; cursor: pointer; }
#bar button:hover { border-color: var(--accent); }

#touchpad { display: none; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 520px; width: 100%; margin: 0 auto; }
#touchpad button { height: 64px; font-size: 26px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); touch-action: none; user-select: none; -webkit-user-select: none; }
#touchpad button.on { background: var(--accent); color: #111; }
body.touch #touchpad { display: grid; }
body.touch #bar .hint { display: none; }

.panel { position: fixed; z-index: 40; top: 48px; right: 12px; bottom: 12px; width: min(440px, calc(100% - 24px)); overflow: auto; padding: 18px 18px 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
.panel h2 { margin: 0 32px 10px 0; font-size: 18px; }
.panel h3 { margin: 18px 0 6px; font-size: 14px; color: var(--dim); text-transform: uppercase; letter-spacing: 1px; }
.panel p, .panel dd, .panel li { color: #d5dde6; }
.panel dl { margin: 0; } .panel dt { color: var(--dim); margin-top: 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; } .panel dd { margin: 2px 0 0; }
.panel code { font-size: 12px; color: var(--warn); }
.panel a { color: #8ec5ff; }
.panel .close { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 16px; border: 1px solid var(--line); background: #17222f; color: var(--ink); font-size: 18px; cursor: pointer; }
.panel label { display: block; margin: 10px 0; color: var(--dim); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.panel select, .panel textarea, .panel input { display: block; width: 100%; margin-top: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: #0f1926; color: var(--ink); font: inherit; text-transform: none; letter-spacing: 0; }
.panel .hp { position: absolute; left: -9999px; }
.panel button[type=submit] { padding: 9px 16px; border: 0; border-radius: 8px; background: var(--accent); color: #111; font-weight: 600; cursor: pointer; }
.panel .where { font-size: 12px; color: var(--dim); }
#report-result { margin-top: 10px; font-size: 13px; }

@media (max-width: 700px) {
  #hud { top: 58px; } #brand b { font-size: 15px; } #stats { font-size: 11px; gap: 8px; }
  #banner { font-size: 12px; }
}

#hud2 { position: fixed; top: 42px; left: 50%; right: 0; z-index: 20; padding: 10px 14px; text-align: right; font-size: 12px; color: var(--dim); text-shadow: 0 1px 4px #000; pointer-events: none; font-variant-numeric: tabular-nums; }
#hud2 span { margin-left: 12px; } #hud2 span:first-child { color: #9fd0ff; font-size: 15px; }
body.split #stats { max-width: 50%; }
#toast { position: fixed; top: 140px; left: 50%; transform: translateX(-50%); z-index: 35; padding: 8px 14px; border-radius: 8px; background: var(--panel); border: 1px solid var(--accent); font-size: 13px; max-width: min(520px, calc(100% - 32px)); text-align: center; }
#minimap { position: fixed; z-index: 20; right: 12px; bottom: 96px; width: 126px; height: 161px; border: 1px solid var(--line); border-radius: 6px; background: #0d151d; opacity: .9; pointer-events: none; image-rendering: pixelated; }
body.touch #minimap { bottom: 190px; width: 84px; height: 107px; }
@media (max-width: 700px) { #minimap { width: 84px; height: 107px; bottom: 150px; } #hud2 { top: 58px; } }
