:root {
  --bg: #0b0d10; --fg: #e8eef4; --muted: #8a97a6; --accent: #40c4ff; --warn: #ffb74d; --card: rgba(18, 23, 30, 0.94);
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; overflow: hidden; -webkit-tap-highlight-color: transparent; }
#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }
#plan { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: manipulation; z-index: 1; }
#strip { position: fixed; left: 8px; right: 8px; top: calc(8px + var(--safe-t)); height: 150px; width: calc(100vw - 16px); border-radius: 12px; z-index: 4; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5); }
[hidden] { display: none !important; }
h1 { font-size: 34px; margin: 0 0 8px; letter-spacing: -0.5px; }
h2 { font-size: 20px; margin: 0 0 12px; }
.lead { color: #c9d4de; margin: 0 0 20px; }
.fine { color: var(--muted); font-size: 13px; margin-top: 18px; }
button { font: inherit; border: 0; border-radius: 14px; padding: 14px 18px; min-height: 48px; cursor: pointer; color: var(--fg); background: #1c242e; }
button.primary { background: var(--accent); color: #031018; font-weight: 600; width: 100%; }
button.secondary { background: #1c242e; width: 100%; margin-top: 10px; }
button.link { background: none; color: var(--muted); width: 100%; margin-top: 6px; }
button.row { width: 100%; text-align: left; background: #151c24; margin-bottom: 8px; }
button:active { transform: scale(0.98); }
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; justify-content: center; padding: 28px; padding-bottom: calc(28px + var(--safe-b)); max-width: 520px; margin: 0 auto; background: radial-gradient(ellipse at 50% 30%, rgba(64, 196, 255, 0.10), transparent 60%); }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto; background: var(--card); border-radius: 20px 20px 0 0; padding: 22px; padding-bottom: calc(18px + var(--safe-b)); box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5); z-index: 20; max-height: 80vh; overflow: auto; }
.sheet.tall { max-height: 88vh; }
.sheet label { display: block; margin: 0 0 14px; color: #c9d4de; font-size: 14px; }
.sheet select, .sheet input[type=number], .sheet input[type=text] { display: block; width: 100%; margin-top: 6px; padding: 12px; border-radius: 10px; border: 1px solid #2a3441; background: #10161d; color: var(--fg); font: inherit; }
.sheet label.check { display: flex; gap: 10px; align-items: center; }
.perm { padding-left: 18px; margin: 0 0 6px; }
.perm li { margin-bottom: 8px; }
.overlay { position: fixed; left: 0; right: 0; bottom: 0; padding: 22px; padding-bottom: calc(18px + var(--safe-b)); background: linear-gradient(transparent, rgba(11, 13, 16, 0.92) 28%); text-align: center; z-index: 10; }
.overlay h2 { font-size: 22px; }
.steps { display: flex; gap: 8px; justify-content: center; margin-bottom: 12px; }
.steps i { width: 28px; height: 4px; border-radius: 2px; background: #2a3441; }
.steps i.on { background: var(--accent); }
.ring { --p: 0; width: 120px; height: 120px; margin: 0 auto 10px; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--p) * 1turn), #1c242e 0); display: grid; place-items: center; position: relative; }
.ring::after { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: #0e1318; }
.ring span { position: relative; z-index: 1; font-size: 22px; font-weight: 600; }
.hint { min-height: 22px; color: var(--warn); margin: 4px 0 12px; }
#hud { position: fixed; top: 0; left: 0; right: 0; padding: 12px; padding-top: calc(12px + var(--safe-t)); pointer-events: none; z-index: 5; }
.hud-top { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { background: rgba(14, 19, 24, 0.82); border-radius: 12px; padding: 8px 12px; font-size: 14px; }
.pill.subtle { color: var(--muted); }
.meter { margin-top: 8px; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.meter .bar { width: 120px; height: 6px; background: #1c242e; border-radius: 3px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.15s; }
.meter.alert i { background: #ff5252; }
#bar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; padding: 12px; padding-bottom: calc(12px + var(--safe-b)); background: linear-gradient(transparent, rgba(11, 13, 16, 0.9)); z-index: 6; }
#bar button { flex: 1; background: rgba(28, 36, 46, 0.92); padding: 14px 6px; font-size: 15px; }
#bar button[aria-pressed="true"] { background: var(--accent); color: #031018; }
#toast { position: fixed; left: 50%; top: calc(64px + var(--safe-t)); transform: translateX(-50%) translateY(-8px); background: #e8eef4; color: #0b0d10; padding: 10px 14px; border-radius: 12px; font-size: 14px; opacity: 0; transition: opacity 0.2s, transform 0.2s; z-index: 30; pointer-events: none; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
pre { white-space: pre-wrap; font: 12px/1.5 ui-monospace, Menlo, monospace; color: #c9d4de; background: #0e1318; padding: 12px; border-radius: 10px; }
@media (min-width: 900px) { .overlay { max-width: 560px; margin: 0 auto; border-radius: 20px 20px 0 0; } }
.sheet .walls { display: grid; gap: 10px; margin-bottom: 6px; }
.sheet .wallRow { display: grid; grid-template-columns: 54px 1fr 96px; gap: 10px; align-items: center; color: #c9d4de; font-size: 14px; }
.sheet .wallRow input { margin-top: 0; }
.sheet .wallRow .aim { margin-top: 0; padding: 12px 6px; font-size: 14px; }
