:root { color-scheme: dark; --accent: #f2a33a; --teal: #2bb2aa; --panel: rgba(12, 12, 16, .62); }
html, body { margin: 0; height: 100%; background: #111; overflow: hidden; overscroll-behavior: none; }
body { font: 14px/1.3 system-ui, sans-serif; color: #eee; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
#game { position: fixed; inset: 0; width: 100vw; height: 100dvh; display: block; touch-action: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: none; }
button, .btn { font-size: 16px; padding: 12px 22px; border-radius: 10px; border: 0; background: var(--accent); color: #111; font-weight: 700; text-decoration: none; }

/* HUD */
#hud { position: fixed; left: max(12px, env(safe-area-inset-left)); top: 10px; width: 180px; pointer-events: none; display: grid; gap: 4px; text-shadow: 0 1px 2px #000; }
.meter { position: relative; height: 14px; background: var(--panel); border-radius: 4px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.meter i { position: absolute; inset: 0 auto 0 0; width: 100%; transition: width .12s; }
.meter.hp i { background: linear-gradient(#e94b3c, #b3261e); }
.meter.hp span { position: absolute; right: 6px; top: 0; font: 700 11px/14px ui-monospace, monospace; }
.meter.jet { height: 6px; }
.meter.jet i { background: linear-gradient(#7fd8ff, #2f8fd0); transition: none; }
#weapon { font: 700 12px/1.2 ui-monospace, monospace; letter-spacing: .04em; }
#debug { position: fixed; left: 50%; transform: translateX(-50%); top: 6px; padding: 2px 8px; border-radius: 6px; background: var(--panel); font: 11px/1.4 ui-monospace, monospace; color: #cfd; white-space: pre; }
#menu-btn { position: fixed; right: max(12px, env(safe-area-inset-right)); top: 8px; width: 44px; height: 44px; padding: 0; font-size: 20px; background: var(--panel); color: #fff; border-radius: 10px; }
#respawn { position: fixed; left: 50%; top: 38%; transform: translate(-50%, -50%); padding: 8px 16px; border-radius: 10px; background: var(--panel); font-weight: 700; pointer-events: none; }

/* Weapon slots, above the right thumb */
#slots { position: fixed; right: max(12px, env(safe-area-inset-right)); top: 60px; display: flex; gap: 8px; }
#slots button { min-width: 92px; padding: 8px 12px; background: var(--panel); color: #eee; font-size: 13px; display: flex; justify-content: space-between; gap: 10px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.12); }
#slots button b { font-family: ui-monospace, monospace; color: var(--accent); }
#slots button.on { box-shadow: inset 0 0 0 2px var(--accent); background: rgba(242, 163, 58, .22); }

/* Floating sticks: drawn where the thumb lands, never catch touches themselves */
.stick { --r: 64px; position: fixed; width: calc(var(--r) * 2); height: calc(var(--r) * 2); margin: calc(var(--r) * -1) 0 0 calc(var(--r) * -1); border-radius: 50%; border: 2px solid rgba(255,255,255,.35); background: rgba(0,0,0,.12); pointer-events: none; display: none; }
.stick.on { display: block; }
.stick i { position: absolute; left: 50%; top: 50%; width: 46%; height: 46%; margin: -23% 0 0 -23%; border-radius: 50%; background: rgba(255,255,255,.45); }
.stick.jet i { background: rgba(242, 163, 58, .85); box-shadow: 0 0 16px var(--accent); }

/* Off-screen opponent marker */
#arrow { position: fixed; transform: translate(-50%, -50%); pointer-events: none; display: grid; place-items: center; }
#arrow i { width: 0; height: 0; border: 11px solid transparent; border-left: 18px solid var(--teal); border-right: 0; filter: drop-shadow(0 1px 2px #000); }
#arrow span { position: absolute; top: 24px; font: 700 11px ui-monospace, monospace; text-shadow: 0 1px 2px #000; white-space: nowrap; }

/* Sandbox palette */
#palette { position: fixed; left: 0; right: 0; bottom: max(8px, env(safe-area-inset-bottom)); display: flex; gap: 8px; padding: 0 max(12px, env(safe-area-inset-left)); align-items: center; justify-content: center; }
#brushes { display: flex; gap: 4px; overflow-x: auto; padding: 4px; background: var(--panel); border-radius: 12px; scrollbar-width: none; }
#brushes button { touch-action: pan-x; } /* the strip scrolls sideways on narrow phones */
#brushes button, #size { display: grid; justify-items: center; gap: 3px; padding: 5px 2px; min-width: 47px; background: transparent; color: #ddd; font-size: 10px; font-weight: 600; border-radius: 8px; }
#brushes button i { width: 22px; height: 22px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.35); }
#brushes button.on { background: rgba(255,255,255,.16); color: #fff; box-shadow: inset 0 0 0 2px var(--accent); }
#size { --dot: 12px; flex: none; min-width: 48px; height: 48px; place-items: center; background: var(--panel); }
#size::before { content: ''; width: var(--dot); height: var(--dot); border-radius: 50%; background: #fff; }

/* Main menu */
#menu { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px; text-align: center; background: radial-gradient(ellipse at 50% 35%, rgba(60, 40, 22, .75), rgba(8, 8, 10, .96) 70%); }
#menu h1 { margin: 0; font-size: clamp(30px, 7vw, 56px); letter-spacing: .06em; text-transform: uppercase; color: var(--accent); text-shadow: 0 3px 0 #6b3b0a, 0 6px 18px rgba(0,0,0,.6); }
#menu .sub { margin: -6px 0 12px; letter-spacing: .4em; text-transform: uppercase; color: #bbb; font-size: 13px; }
#menu .modes { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
#menu .modes button { min-width: 170px; padding: 16px 24px; font-size: 18px; }
#menu .modes button + button { background: #e8e2d6; }
#menu .hint { color: #999; font-size: 12px; max-width: 520px; }

/* Portrait phones: ask to rotate */
#rotate { position: fixed; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 16px; background: #111; z-index: 20; font-weight: 700; }
#rotate .phone { width: 36px; height: 62px; border: 3px solid var(--accent); border-radius: 8px; animation: tilt 1.6s ease-in-out infinite; }
@keyframes tilt { 50% { transform: rotate(-90deg); } }
@media (orientation: portrait) and (pointer: coarse) { #rotate { display: flex; } }

#overlay { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(10,10,12,.88); text-align: center; padding: 16px; }
#overlay h1 { margin: 0; font-size: 22px; }
#overlay pre { max-width: 90vw; max-height: 40vh; overflow: auto; text-align: left; font-size: 11px; background: #000; padding: 8px; white-space: pre-wrap; }
