/* Nightshrike UI: frosted dark glass, hairline borders, a cyan→violet accent and warm gold for the things
   that matter (you, your lock, the FLY button). Chakra Petch for labels and numbers, Inter for prose. */
:root {
  --glass: rgba(9, 16, 30, 0.5);
  --glass-strong: rgba(9, 16, 30, 0.78);
  --line: rgba(255, 255, 255, 0.13);
  --line-strong: rgba(255, 255, 255, 0.26);
  --ink: #eef6ff;
  --dim: #93a9c2;
  --accent: #5ee7ff;
  --accent-2: #8c7bff;
  --gold: #ffc857;
  --hot: #ff5468;
  --ok: #5effa8;
  --grad: linear-gradient(100deg, var(--accent), var(--accent-2));
  --display: 'Chakra Petch', 'Segoe UI', system-ui, sans-serif;
  --body: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --blur: blur(14px) saturate(150%);
  --radius: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; background: #070d18; color: var(--ink); font: 14px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
#view { display: block; width: 100vw; height: 100vh; }
#hud { position: fixed; inset: 0; pointer-events: none; display: none; }
#overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
[hidden] { display: none !important; }

/* ---------- HUD panels ---------- */
.pill {
  position: absolute; display: flex; align-items: center; gap: 18px; padding: 10px 16px;
  background: var(--glass); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  font: 600 13px/1 var(--display); color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.stat { display: flex; flex-direction: column; gap: 5px; }
.stat.wide { min-width: 130px; }
.k { font: 600 9px/1 var(--display); letter-spacing: 0.18em; color: var(--dim); }
.stat b { font: 700 20px/1 var(--display); letter-spacing: 0.02em; }
.bar { position: relative; display: block; height: 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.bar i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: linear-gradient(90deg, var(--ok), var(--accent)); box-shadow: 0 0 12px rgba(94, 255, 168, 0.55); transition: width .25s ease, background .25s; }
.bar.hull { width: 130px; margin-top: 4px; }
.bar.hull.low i { background: linear-gradient(90deg, #ff2f55, var(--hot)); box-shadow: 0 0 14px rgba(255, 84, 104, 0.8); animation: pulse 0.9s ease-in-out infinite; }
.bar.boost { position: absolute; left: 16px; right: 16px; bottom: 6px; height: 3px; background: rgba(255, 255, 255, 0.08); }
.bar.boost i { background: var(--grad); box-shadow: 0 0 10px rgba(94, 231, 255, 0.7); }
.bar.boost i.drained { background: var(--hot); box-shadow: 0 0 10px rgba(255, 84, 104, 0.7); }
#status { top: 18px; left: 18px; }
#weapons { left: 18px; bottom: 24px; padding-bottom: 16px; }
.msl-row { display: flex; gap: 4px; height: 20px; align-items: center; }
.ico.msl { display: block; width: 6px; height: 18px; border-radius: 3px 3px 1px 1px; background: linear-gradient(180deg, #fff 0 18%, var(--gold) 18% 80%, #ff8a3d 80%); box-shadow: 0 0 8px rgba(255, 200, 87, 0.45); transition: opacity .2s; }
.ico.msl.off { opacity: .15; box-shadow: none; filter: grayscale(1); }

/* Roster, kill feed */
#score { position: absolute; top: 18px; right: 18px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
#score .row {
  display: flex; gap: 10px; align-items: center; padding: 7px 12px; min-width: 170px;
  background: var(--glass); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line); border-radius: 10px; font: 600 12px/1 var(--display); color: var(--ink); letter-spacing: 0.03em;
}
#score .row.me { border-color: rgba(255, 200, 87, 0.55); background-image: linear-gradient(90deg, rgba(255, 200, 87, 0.2), transparent 70%); }
#score .row.dead { opacity: .45; }
#score .row i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; box-shadow: 0 0 8px currentColor; }
#score .row span { color: var(--dim); margin-left: auto; min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
#score .row.teams { gap: 18px; font-size: 14px; justify-content: center; }
#score .row.teams .blue { color: #6fb0ff; }
#score .row.teams .red { color: #ff7a66; }
#feed { position: absolute; right: 18px; top: 120px; text-align: right; font: 600 12px/2 var(--display); letter-spacing: 0.03em; color: var(--ink); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7); }
#feed > div { animation: slide-in .3s ease-out; }

/* Radar: a glass disc */
#radar {
  position: absolute; bottom: 18px; right: 18px; width: 140px; height: 140px; border-radius: 50%;
  background: radial-gradient(circle, rgba(9, 16, 30, 0.35), rgba(9, 16, 30, 0.7)); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid rgba(94, 231, 255, 0.28); box-shadow: 0 0 24px rgba(94, 231, 255, 0.12), inset 0 0 24px rgba(94, 231, 255, 0.08);
}

/* Lock brackets */
#lock { position: absolute; width: 46px; height: 46px; display: none; transform: translate(-50%, -50%); }
#lock::before {
  content: ''; position: absolute; inset: 0; border-radius: 6px;
  background:
    linear-gradient(var(--gold), var(--gold)) top left / 12px 2px, linear-gradient(var(--gold), var(--gold)) top left / 2px 12px,
    linear-gradient(var(--gold), var(--gold)) top right / 12px 2px, linear-gradient(var(--gold), var(--gold)) top right / 2px 12px,
    linear-gradient(var(--gold), var(--gold)) bottom left / 12px 2px, linear-gradient(var(--gold), var(--gold)) bottom left / 2px 12px,
    linear-gradient(var(--gold), var(--gold)) bottom right / 12px 2px, linear-gradient(var(--gold), var(--gold)) bottom right / 2px 12px;
  background-repeat: no-repeat; filter: drop-shadow(0 0 6px rgba(255, 200, 87, 0.8)); animation: lock-in .35s ease-out;
}
#lock::after { content: 'LOCK'; position: absolute; top: 52px; left: 50%; transform: translateX(-50%); font: 700 10px/1 var(--display); letter-spacing: 0.2em; color: var(--gold); text-shadow: 0 0 8px rgba(255, 200, 87, 0.7); }

/* Warnings, notices, tips */
#warning {
  position: absolute; top: 19%; left: 50%; transform: translateX(-50%); padding: 9px 18px; border-radius: 999px;
  font: 700 12px/1.2 var(--display); letter-spacing: 0.16em; color: #fff;
  background: linear-gradient(100deg, rgba(255, 47, 85, 0.85), rgba(255, 110, 70, 0.85)); border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 30px rgba(255, 70, 90, 0.55); animation: pulse 1s ease-in-out infinite;
}
#warning:empty { display: none; }
#message { position: absolute; top: 33%; width: 100%; padding: 0 16px; text-align: center; font: 700 clamp(18px, 2.4vw, 32px)/1.3 var(--display); letter-spacing: 0.14em; color: #fff; text-shadow: 0 0 24px rgba(94, 231, 255, 0.55), 0 2px 10px rgba(0, 0, 0, 0.6); }
#tip { position: absolute; bottom: 92px; left: 50%; transform: translateX(-50%); padding: 8px 16px; font: 600 12px/1.3 var(--display); letter-spacing: 0.06em; color: var(--ink); background: var(--glass-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid rgba(255, 200, 87, 0.45); border-radius: 999px; white-space: nowrap; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3); }
#tip:empty { display: none; }
#wave { position: fixed; left: 50%; transform: translateX(-50%); top: 66px; font: 600 12px/1 var(--display); letter-spacing: 0.12em; color: var(--ink); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7); pointer-events: none; }
#flash { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 45%, rgba(255, 60, 80, .5) 80%, #ff3c50 100%); opacity: 0; } /* an edge glow: a full-screen red fill on every hit read as a glitch */
#killflash { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(circle, #fffbe8, #fff3c4); opacity: 0; }
#message.pop { animation: pop-in .45s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop-in { from { opacity: 0; transform: scale(1.35); letter-spacing: 0.4em; filter: blur(4px); } }
@keyframes pulse { 50% { opacity: .55; } }
@keyframes slide-in { from { opacity: 0; transform: translateX(12px); } }
@keyframes lock-in { from { transform: scale(1.8); opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* ---------- Buttons and fields ---------- */
input, button, select { font: inherit; min-width: 0; }
button {
  font: 700 12px/1 var(--display); letter-spacing: 0.14em; cursor: pointer; padding: 14px 18px; border-radius: 12px; color: #071222;
  background: linear-gradient(100deg, #ffd977, var(--gold) 40%, #ff9f43); border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 8px 24px rgba(255, 170, 60, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.5); transition: transform .15s, box-shadow .15s, filter .15s, background .15s;
}
button:hover { transform: translateY(-1px); filter: brightness(1.08); box-shadow: 0 12px 30px rgba(255, 170, 60, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
button:active { transform: translateY(1px); }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: .6; transform: none; }
.invite, .menu-buttons .secondary, .picker button {
  color: var(--ink); background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line-strong); box-shadow: none; backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.invite:hover, .menu-buttons .secondary:hover, .picker button:hover { background: rgba(255, 255, 255, 0.12); box-shadow: none; }
.invite { font-size: 11px; padding: 11px 16px; margin: 4px 0 10px; }
input { background: rgba(255, 255, 255, 0.06); color: #fff; border: 1px solid var(--line-strong); border-radius: 12px; padding: 14px 16px; flex: 1; transition: border-color .15s, background .15s; }
input::placeholder { color: #8197ad; }
input:focus { border-color: var(--accent); background: rgba(255, 255, 255, 0.09); }
#color { flex: 0 0 48px; width: 48px; height: 48px; padding: 6px; cursor: pointer; }
#color::-webkit-color-swatch-wrapper { padding: 0; }
#color::-webkit-color-swatch { border: none; border-radius: 8px; }

/* ---------- Title screen ---------- */
#start { position: fixed; inset: 0; display: flex; align-items: flex-start; overflow-y: auto; touch-action: pan-y; background: radial-gradient(ellipse 80% 120% at 0% 50%, rgba(7, 13, 24, 0.92), rgba(7, 13, 24, 0.55) 55%, transparent 80%); }
.card { width: min(560px, 92vw); margin: auto 0 auto 6vw; padding: 32px 0; animation: rise .6s ease-out; } /* centred when it fits, scrolls when it doesn't */
.eyebrow { font: 700 11px/1.7 var(--display); letter-spacing: 0.32em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
h1 { font: 700 clamp(44px, 6.6vw, 96px)/0.95 var(--display); letter-spacing: -0.01em; margin: 18px 0 20px; background: linear-gradient(180deg, #ffffff 30%, #a9c8e8); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 6px 30px rgba(94, 231, 255, 0.25)); }
p { color: #b6c6d8; line-height: 1.7; font-size: 14px; text-shadow: 0 1px 8px rgba(7, 13, 24, 0.9); }
#online { display: inline-flex; align-items: center; gap: 8px; font: 600 11px/1 var(--display); letter-spacing: 0.14em; color: var(--ok); margin: 18px 0 14px; }
#online::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; animation: pulse 1.6s ease-in-out infinite; }
.picker { display: inline-flex; flex-wrap: wrap; gap: 4px; margin: 8px 8px 0 0; padding: 4px; max-width: 100%; border-radius: 14px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); }
.picker button { font-size: 11px; letter-spacing: 0.1em; padding: 9px 13px; border-radius: 10px; border-color: transparent; background: transparent; }
.picker button.on { color: #071222; background: var(--grad); border-color: transparent; box-shadow: 0 4px 18px rgba(94, 231, 255, 0.35); }
#room-code { display: block; width: 100%; margin-top: 10px; padding: 10px 14px; letter-spacing: .12em; text-transform: uppercase; }
#room-code::placeholder { letter-spacing: normal; text-transform: none; }
#pause-room { margin: -8px 0 16px; font-size: 15px; letter-spacing: .14em; color: #5ee7ff; }
#pause.settings #pause-room { display: none; }
#room-note { margin: 10px 0 -6px; font-size: 12.5px; color: #5ee7ff; }
#mode-note { white-space: pre-line; font-size: 12.5px; color: #9fd8ec; min-height: 2.6em; line-height: 1.55; margin: 10px 0 0; }
form { display: flex; gap: 10px; margin: 14px 0 26px; max-width: 470px; }
#fly { padding: 14px 26px; font-size: 14px; }
#fly span { display: inline-block; transition: transform .2s; }
#fly:hover span { transform: translateX(4px); }
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 22px; font-size: 12px; color: #a7bacd; max-width: 480px; padding: 16px 18px; border-radius: var(--radius); background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.controls b { display: block; margin-bottom: 3px; font: 600 10.5px/1.3 var(--display); letter-spacing: 0.12em; color: var(--ink); }
.start-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
#connect { font-size: 12px; color: #93a9c2; min-height: 16px; margin-top: 18px; }
#credit { font-size: 11px; color: #7e95ad; margin: 4px 0 0; }
#credit a { color: var(--accent); }
.hangar-caption { position: absolute; bottom: 8%; right: 7%; font: 700 20px/1.5 var(--display); letter-spacing: 0.24em; text-align: right; text-shadow: 0 2px 20px rgba(0, 0, 0, 0.6); }
.hangar-caption span { font-size: 11px; letter-spacing: 0.3em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
#start, .pause-card { scrollbar-width: thin; scrollbar-color: rgba(94, 231, 255, 0.4) transparent; }

/* ---------- Pause / settings ---------- */
#pause { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(5, 10, 20, 0.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 20; }
#pause.settings { z-index: 40; }
.pause-card {
  width: min(600px, 92vw); max-height: 92vh; overflow: auto; touch-action: pan-y; padding: 26px 28px; border-radius: 22px;
  background: linear-gradient(160deg, rgba(20, 32, 56, 0.86), rgba(9, 16, 30, 0.9)); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line-strong); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08); animation: rise .25s ease-out;
}
.pause-card h2 { font: 700 34px/1 var(--display); margin: 10px 0 8px; color: #fff; letter-spacing: 0.02em; }
.pause-note { font-size: 13px; color: #9fb4ca; margin: 0 0 18px; }
.menu-buttons { display: flex; gap: 10px; margin-bottom: 22px; }
.menu-buttons button { flex: 1; padding: 13px; }
.menu-buttons .invite { margin: 0; font-size: 12px; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; margin-bottom: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.options label { display: flex; flex-direction: column; gap: 8px; min-width: 0; font: 600 12px/1 var(--display); letter-spacing: 0.1em; color: #c3d3e4; }
.options select {
  width: 100%; appearance: none; -webkit-appearance: none; padding: 11px 36px 11px 12px; border-radius: 10px; cursor: pointer;
  font: 600 12.5px/1.2 var(--display); letter-spacing: 0.04em; color: #fff; background: rgba(255, 255, 255, 0.06) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235ee7ff' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--line-strong);
}
.options select option { background: #0e1a2e; color: #fff; }
.options input[type=range] { width: 100%; appearance: none; -webkit-appearance: none; height: 22px; background: transparent; cursor: pointer; padding: 0; border: none; }
.options input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.options input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.options input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%; background: #fff; border: none; box-shadow: 0 0 0 4px rgba(94, 231, 255, 0.25), 0 2px 8px rgba(0, 0, 0, 0.4); }
.options input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: none; box-shadow: 0 0 0 4px rgba(94, 231, 255, 0.25), 0 2px 8px rgba(0, 0, 0, 0.4); }
.options .label-row { display: flex; justify-content: space-between; }
.options output { font: 600 13px/1 var(--display); color: var(--accent); letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
/* Checkboxes as switches */
.options label.check { flex-direction: row; align-items: center; gap: 12px; color: var(--ink); cursor: pointer; }
.options input[type=checkbox] { flex: none; appearance: none; -webkit-appearance: none; position: relative; width: 40px; height: 22px; padding: 0; margin: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.14); border: 1px solid var(--line-strong); cursor: pointer; transition: background .2s; }
.options input[type=checkbox]::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); transition: transform .2s; }
.options input[type=checkbox]:checked { background: var(--grad); border-color: transparent; }
.options input[type=checkbox]:checked::after { transform: translateX(18px); }
.keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 9px 14px; padding-top: 16px; border-top: 1px solid var(--line); font: 500 12.5px/1.2 var(--display); color: #c3d3e4; }
.keys span { display: flex; align-items: center; gap: 8px; }
.keys kbd { font: 700 10.5px/1 var(--display); letter-spacing: 0.06em; color: var(--ink); padding: 4px 7px; border-radius: 6px; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line-strong); white-space: nowrap; }
body:not(.touch) .thumb-keys { display: none; }
@media not (any-pointer: fine) { .desk-only { display: none; } } /* phones; a touch laptop with a trackpad keeps it */
/* Title-screen settings: the pause panel without the in-flight buttons. */
#pause.settings .pause-note, #pause.settings #exit-title, #pause.settings #invite-pause { display: none; }
#pause.settings h2 { font-size: 0; }
#pause.settings h2::after { content: 'Settings'; font-size: 34px; }
#pause.settings .eyebrow { visibility: hidden; }
#pause.settings #resume { font-size: 0; }
#pause.settings #resume::after { content: 'BACK'; font-size: 12px; }

/* ---------- Touch ---------- */
html, body, #view, #touch-controls { touch-action: none; overscroll-behavior: none; }
body { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
input { user-select: text; -webkit-user-select: text; }
#touch-controls { position: fixed; inset: 0; pointer-events: none; }
#stick-zone { position: absolute; left: 0; bottom: 0; width: 47%; height: 72%; pointer-events: auto; }
#stick-ring { position: absolute; width: 120px; height: 120px; margin: -60px; border: 1px solid rgba(94, 231, 255, 0.5); border-radius: 50%; background: rgba(9, 16, 30, 0.35); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: 0 0 24px rgba(94, 231, 255, 0.2); }
#stick-knob { width: 46px; height: 46px; margin: 36px; border-radius: 50%; background: var(--grad); box-shadow: 0 0 18px rgba(94, 231, 255, 0.6); }
#touch-buttons { position: absolute; right: max(12px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(3, 54px); gap: 8px; pointer-events: auto; }
#touch-buttons button { width: 54px; height: 54px; border-radius: 50%; font: 700 8.5px/1 var(--display); letter-spacing: 0.04em; padding: 0; color: var(--ink); background: rgba(9, 16, 30, 0.5); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid var(--line-strong); box-shadow: none; }
#touch-buttons button:hover { transform: none; filter: none; }
#touch-buttons [data-action=fire] { color: #fff; background: linear-gradient(140deg, #ff2f55, #ff8a3d); border-color: rgba(255, 255, 255, 0.5); box-shadow: 0 0 22px rgba(255, 70, 90, 0.45); }
#touch-buttons button.empty { opacity: .4; }
#touch-buttons button.pressed { color: #071222; background: var(--grad); border-color: transparent; transform: scale(.93); }
#rotate-hint { display: none; position: absolute; top: 42%; width: 100%; text-align: center; font: 600 12px var(--display); letter-spacing: 0.12em; color: var(--gold); }
/* Thumb layout: FIRE in the bottom-right corner, boost and dodge beside it, the rarer buttons above.
   Bottom row is held during fights: BRAKE · BOOST · FIRE. TILT is a rare toggle, so it sits up by MENU. */
#touch-buttons [data-action=camera] { order: 1; }
#touch-buttons [data-action=missile] { order: 2; }
#touch-buttons [data-action=dodge] { order: 3; }
#touch-buttons [data-action=brake] { order: 4; }
#touch-buttons [data-action=boost] { order: 5; }
#touch-buttons [data-action=fire] { order: 6; }
#touch-buttons #tilt, #touch-buttons button[data-action=menu] { position: fixed; top: max(8px, env(safe-area-inset-top)); width: 66px; height: 30px; border-radius: 999px; font-size: 9px; }
#touch-buttons #tilt { left: calc(50% + 40px); }
#touch-buttons button[data-action=menu] { left: 50%; transform: translateX(-50%); }
.touch #hint, .touch .controls, .touch .hangar-caption, .touch .pause-keys { display: none; }
.touch #status { left: max(10px, env(safe-area-inset-left)); top: max(8px, env(safe-area-inset-top)); }
.touch #score { right: max(10px, env(safe-area-inset-right)); top: max(8px, env(safe-area-inset-top)); }
.touch #score .row { min-width: 0; padding: 5px 9px; font-size: 10px; }
.touch #radar { width: 76px; height: 76px; left: max(10px, env(safe-area-inset-left)); top: calc(max(8px, env(safe-area-inset-top)) + 56px); right: auto; bottom: auto; }
.touch #weapons { left: 50%; transform: translateX(-50%); bottom: 40px; }
.touch .pill { padding: 6px 10px 8px; gap: 12px; }
.touch .stat b { font-size: 15px; }
.touch .stat.wide { min-width: 90px; }
.touch .bar.hull { width: 90px; }
.touch #tip { bottom: auto; top: 118px; white-space: normal; max-width: 86vw; text-align: center; border-radius: 14px; }
.touch #wave { top: 84px; }
/* Phones: no live blur behind in-flight panels and buttons (it re-blurs the moving 3D view every frame);
   a denser tint stands in for it. */
.touch .pill, .touch #score .row, .touch #radar, .touch #tip, .touch #touch-buttons button, .touch #stick-ring { backdrop-filter: none; -webkit-backdrop-filter: none; }
.touch .pill, .touch #score .row, .touch #tip, .touch #touch-buttons button:not([data-action=fire]):not(.pressed) { background-color: rgba(9, 16, 30, 0.66); }
.touch .picker button, .touch .invite, .touch .menu-buttons button { min-height: 42px; }
.touch .options select { min-height: 40px; }
.touch #rotate-hint { animation: hint-out .8s 6s forwards; }
@keyframes hint-out { to { opacity: 0; visibility: hidden; } }

/* ---------- Small screens ---------- */
@media (max-width: 760px) {
  .card { margin-left: 6vw; }
  .hangar-caption { display: none; }
  .options { gap: 12px 14px; }
  .pause-card { padding: 20px; }
  .pause-card h2 { font-size: 26px; margin: 6px 0; }
}
@media (max-height: 650px) {
  h1 { margin: 12px 0; }
  .card { padding: 14px 0; }
  #online, #connect { margin-top: 10px; }
  .controls { gap: 8px 16px; padding: 12px 14px; }
}
@media (max-height: 450px) {
  .controls, .hangar-caption { display: none; }
  .card { margin-left: max(24px, env(safe-area-inset-left)); padding: 8px 0; }
  h1 { font-size: 30px; margin: 4px 0; } /* FLY stays on screen on a landscape phone */
  h1 br { display: none; }
  .picker { margin-top: 4px; padding: 3px; }
  .picker button { padding: 7px 11px; }
  #room-code { margin-top: 4px; padding: 5px 12px; font-size: 13px; }
  #mode-note { min-height: 0; }
  #room-note { display: none; } /* the field shows the code: FLY stays on screen */
  #mode-note { margin-top: 4px; font-size: 11.5px; line-height: 1.4; }
  input { padding: 11px 14px; }
  #color { width: 42px; height: 42px; flex-basis: 42px; }
  #fly { padding: 11px 22px; }
  .card p { margin: 6px 0; line-height: 1.4; }
  form { margin: 8px 0; }
  #online { margin: 8px 0; }
  #connect { margin-top: 8px; }
  .pause-note { margin-bottom: 8px; }
  .pause-card { padding: 14px 18px; max-height: 96vh; }
  .pause-card h2, #pause.settings h2::after { font-size: 22px; margin: 2px 0 6px; }
  .menu-buttons { margin-bottom: 12px; }
  .menu-buttons button { padding: 10px; }
  .options { gap: 10px 16px; padding-top: 12px; margin-bottom: 12px; }
  .keys { padding-top: 12px; gap: 7px 12px; }
  .card > p:first-of-type, #credit { display: none; } /* the callsign and FLY row stay on screen */
}
@media (max-width: 420px) { .eyebrow { font-size: 9.5px; letter-spacing: 0.22em; } .menu-buttons button { padding: 12px 6px; letter-spacing: 0.08em; } }
@media (orientation: portrait) {
  .touch #rotate-hint { display: block; }
  .touch #weapons { bottom: 180px; left: 10px; transform: none; }
  .touch #touch-buttons { grid-template-columns: repeat(2, 54px); }
  .touch #touch-buttons button { width: 54px; height: 54px; }
  /* The status panel and the roster no longer fit side by side: MENU and TILT take the top-right corner,
     the roster starts below them, and the wave line sits under the radar. */
  .touch #touch-buttons button[data-action=menu] { left: auto; right: max(10px, env(safe-area-inset-right)); transform: none; width: 62px; height: 30px; }
  .touch #touch-buttons button#tilt { left: auto; right: calc(max(10px, env(safe-area-inset-right)) + 70px); width: 62px; height: 30px; }
  .touch #score { top: calc(max(8px, env(safe-area-inset-top)) + 40px); }
  .touch #wave { left: max(10px, env(safe-area-inset-left)); transform: none; top: calc(max(8px, env(safe-area-inset-top)) + 142px); text-align: left; }
  .touch #tip { top: auto; bottom: 300px; } /* above the 4-row button grid (~285 px) */
}
/* Very wide, low-density screens (4K at 100%): everything scales up with the canvas HUD (hud.js uiScale). */
@media (orientation: landscape) { /* phone landscape: the thumb buttons fill the bottom right */
  .touch #feed { left: max(10px, env(safe-area-inset-left)); right: auto; top: calc(max(8px, env(safe-area-inset-top)) + 142px); text-align: left; font-size: 11px; }
  .touch #message { top: 98px; }
  .touch #tip { top: auto; bottom: max(6px, env(safe-area-inset-bottom)); padding: 5px 12px; font-size: 10px; white-space: nowrap; border-radius: 999px; } /* the bottom edge, under the weapons pill: out of the sky you're flying into */
}
@media (min-width: 2300px) { .pill, #score, #feed, #radar, #tip, #warning, #message, #wave, .card, .pause-card, .hangar-caption { zoom: 1.25; } }
@media (min-width: 3000px) { .pill, #score, #feed, #radar, #tip, #warning, #message, #wave, .card, .pause-card, .hangar-caption { zoom: 1.5; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0s !important; transition-duration: 0s !important; } }
