* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --navy: #0b2740;
  --navy-2: #123a5c;
  --navy-3: #1b4a70;
  --wood: #7a4a26;
  --wood-2: #5b3a1e;
  --wood-3: #3f2410;
  --gold: #f5b731;
  --gold-2: #c98f1b;
  --parch: #f2e4c4;
  --parch-2: #e0cfa6;
  --parch-3: #c9b384;
  --ink: #3a2a14;
  --red: #e2483d;
  --red-2: #b03028;
  --green: #3fae5a;
  --cyan: #39c2d7;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #0b2740;
  font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#app { position: fixed; inset: 0; }

#game {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

.hidden { display: none !important; }

button { font-family: inherit; cursor: pointer; }

/* ---------- Overlays ---------- */

#vignette {
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(4, 16, 30, 0.42) 100%);
  transition: box-shadow 0.4s;
}
#vignette.danger { animation: dangerPulse 1.1s ease-in-out infinite; }
@keyframes dangerPulse {
  0%, 100% { box-shadow: inset 0 0 60px rgba(226, 72, 61, 0.0); }
  50% { box-shadow: inset 0 0 140px rgba(226, 72, 61, 0.5); }
}

#hitflash {
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(226, 72, 61, 0.12) 30%, rgba(226, 72, 61, 0.4) 100%);
  opacity: 0;
}
#hitflash.on { animation: flashOut 0.45s ease-out; }
@keyframes flashOut { 0% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- Name tags / floaters ---------- */

#tags, #floaters { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

.tag {
  position: absolute; left: 0; top: 0;
  transform: translate(-50%, -100%);
  text-align: center;
  will-change: transform;
}
.tag .tag-name {
  font-size: 12px; font-weight: 800; color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 8px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.03em;
}
.tag .tag-hp {
  width: 46px; height: 5px; margin: 3px auto 0;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 3px; overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.4);
}
.tag .tag-hp i { display: block; height: 100%; background: var(--red); border-radius: 3px; }

.floater {
  position: absolute; left: 0; top: 0;
  font-weight: 800; font-size: 15px;
  transform: translate(-50%, -50%);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
  will-change: transform, opacity;
  white-space: nowrap;
}
.floater.fl-dmg { color: #ff6a5e; }
.floater.fl-gold { color: var(--gold); }
.floater.fl-xp { color: #7fe3f2; }
.floater.fl-info { color: #fff; }

/* ---------- HUD ---------- */

#hud { position: absolute; inset: 0; pointer-events: none; }
#hud > * { pointer-events: none; }
#hud button, #hud #lb, #hud #map-wrap { pointer-events: auto; }

/* Everything numeric sits on a fixed numeral grid so counters and scores
   never shimmy as digits roll over. */
#hud, .stat-chip, #lb, .kf-item, #fps,
.dstat, #death-by, #shop-gold, .up-buy, .cls-cost, #respawn-cost {
  font-variant-numeric: tabular-nums;
}

#hud-tl {
  position: absolute; top: 14px; left: 14px;
  display: flex; flex-direction: column; gap: 9px;
  width: 250px;
}

#hud-chips { display: flex; gap: 8px; align-items: stretch; }

.stat-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(8, 25, 42, 0.72);
  border: 1.5px solid rgba(245, 183, 49, 0.35);
  border-radius: 12px;
  padding: 6px 12px;
  color: var(--gold);
  font-weight: 800; font-size: 17px;
  width: max-content;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  transition: transform 0.15s;
}
.stat-chip.bump { transform: scale(1.13); }

.coin-ico {
  width: 17px; height: 17px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe08a, var(--gold) 55%, var(--gold-2));
  border: 1.5px solid #a06f10;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  flex: none;
}

#chip-level { font-size: 14px; color: #cfe3f2; gap: 9px; }
#hud-level { color: #fff; }
#hud-xp {
  width: 70px; height: 6px; border-radius: 4px;
  background: rgba(0, 0, 0, 0.5); overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
#hud-xp i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--cyan), #7fe3f2); border-radius: 4px; transition: width 0.3s; }

#hp-wrap { display: flex; align-items: center; gap: 8px; }
#hp-bar {
  position: relative;
  width: 210px; height: 20px;
  background: rgba(8, 25, 42, 0.72);
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  overflow: hidden;
  backdrop-filter: blur(4px);
}
#hp-ghost, #hp-fill { position: absolute; inset: 0; border-radius: 8px; }
#hp-ghost i, #hp-fill i {
  display: block; height: 100%;
  border-radius: 8px;
  transition: width 0.25s ease-out;
}
#hp-ghost i { background: #ffd9d4; transition: width 0.9s ease-out; }
#hp-fill i {
  background: linear-gradient(180deg, #ff7a5e, var(--red) 45%, var(--red-2));
  box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.35), inset 0 -3px 5px rgba(0, 0, 0, 0.25);
}
#hp-bar.low #hp-fill i { animation: hpBlink 0.7s linear infinite; }
@keyframes hpBlink { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.5); } }
#hp-num {
  font-weight: 800; font-size: 13px; color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

#reload-wrap { display: flex; align-items: center; gap: 8px; }
#reload-bar {
  width: 120px; height: 7px;
  background: rgba(8, 25, 42, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px; overflow: hidden;
}
#reload-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--gold-2), var(--gold)); border-radius: 4px; }
#reload-bar.ready i { animation: readyPulse 0.8s ease-in-out infinite; }
@keyframes readyPulse { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.6); } }
#reload-label {
  font-size: 10px; font-weight: 800; letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.75);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* ---------------- in-run tutorial ---------------- */

#tutorial {
  position: absolute; left: 50%; bottom: 132px;
  transform: translateX(-50%);
  z-index: 12;
  width: min(340px, 86vw);
  background: linear-gradient(180deg, rgba(18, 58, 92, 0.94), rgba(8, 25, 42, 0.94));
  border: 1px solid rgba(245, 183, 49, 0.5);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 13px 16px 11px;
  text-align: center;
  animation: tutIn 0.35s ease-out;
}
@keyframes tutIn {
  from { opacity: 0; transform: translateX(-50%) translateY(14px); }
  to { opacity: 1; transform: translateX(-50%); }
}
#tut-title {
  font-family: Georgia, 'Times New Roman', serif;
  color: var(--gold); font-size: 17px; letter-spacing: 0.04em;
}
#tut-text {
  color: #f4ecd8; font-size: 13.5px; line-height: 1.45;
  margin-top: 4px;
}
#tut-keys { margin-top: 6px; }
#tut-keys b {
  background: rgba(90, 60, 25, 0.28); border: 1px solid rgba(245, 183, 49, 0.4);
  border-radius: 5px; padding: 1px 7px; font-size: 11px; color: var(--gold);
}
#tut-dots { display: flex; gap: 5px; justify-content: center; margin-top: 8px; }
.tut-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
}
.tut-dot.done { background: var(--green); }
.tut-dot.cur { background: var(--gold); box-shadow: 0 0 6px rgba(245, 183, 49, 0.8); }
#tut-x {
  position: absolute; top: 5px; right: 7px;
  background: none; border: none; color: rgba(244, 236, 216, 0.6);
  font-size: 13px; font-weight: 700; cursor: pointer; padding: 3px 5px;
}
#tut-x:hover { color: #fff; }

/* The Shipyard button pulses while the tutorial asks for it. */
body.tut-glow #btn-shop {
  animation: shopGlow 1.1s ease-in-out infinite;
}
@keyframes shopGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 183, 49, 0.0); }
  50% { box-shadow: 0 0 14px 3px rgba(245, 183, 49, 0.65); }
}
/* The shop step is the one place the touch FIRE button must yield the
   bottom-left corner, so the pulsing Shipyard button is unmistakable. */
body.tut-glow #btn-fire { display: none; }

@media (max-width: 760px) {
  #tutorial { bottom: 118px; }
}

/* ---------------- aim reticle ---------------- */
#reticle {
  position: absolute; left: 0; top: 0;
  width: 38px; height: 38px; margin: -19px 0 0 -19px;
  opacity: 0; transition: opacity 0.16s ease;
  pointer-events: none;
  z-index: 15;
}
#reticle.on { opacity: 1; }
#reticle .rt-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid rgba(245, 183, 49, 0.7);
  box-shadow: 0 0 6px rgba(4, 14, 26, 0.7), inset 0 0 6px rgba(4, 14, 26, 0.5);
}
#reticle .rt-dot {
  position: absolute; left: 50%; top: 50%;
  width: 4px; height: 4px; margin: -2px 0 0 -2px;
  border-radius: 50%; background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 4px rgba(4, 14, 26, 0.8);
}
#reticle .rt-x {
  position: absolute; inset: 0; opacity: 0;
}
#reticle .rt-x::before,
#reticle .rt-x::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 26px; height: 3px; margin: -1.5px 0 0 -13px;
  border-radius: 2px; background: #fff;
  box-shadow: 0 0 7px rgba(255, 255, 255, 0.85);
}
#reticle .rt-x::before { transform: rotate(45deg); }
#reticle .rt-x::after { transform: rotate(-45deg); }
#reticle.hit .rt-x { animation: hitMark 0.3s ease-out; }
#reticle.hit .rt-ring { animation: hitRing 0.3s ease-out; }
#crosshair.hit::before, #crosshair.hit::after { background: var(--gold); }
#crosshair.hit .ch-dot { animation: chHit 0.3s ease-out; }
@keyframes chHit {
  0% { transform: scale(1); }
  40% { transform: scale(2.1); }
  100% { transform: scale(1); }
}
@keyframes hitMark {
  0% { opacity: 1; transform: scale(0.6); }
  60% { opacity: 1; transform: scale(1.05); }
  100% { opacity: 0; transform: scale(1.25); }
}
@keyframes hitRing {
  0% { transform: scale(1); border-color: #fff; }
  100% { transform: scale(1.5); border-color: rgba(245, 183, 49, 0); }
}
/* Desktop: hide the OS cursor over the sea while playing — the reticle IS
   the cursor, and two cursors fighting looks unfinished. Touch devices have
   no cursor at all. */
@media (hover: hover) and (pointer: fine) {
  body.mode-playing #game,
  body.mode-playing #hud,
  body.mode-playing #hud * { cursor: none; }
  /* Keep the normal pointer over interactive HUD chrome so buttons feel like buttons */
  body.mode-playing #hud button { cursor: pointer; }
}

body.touch #reticle { display: none; }

/* Mouse-locked (GTA-style look): hide the floating reticle, show a fixed
   centre crosshair instead. */
body.mouse-locked #reticle { display: none; }
#crosshair {
  position: absolute; left: 50%; top: 50%;
  width: 26px; height: 26px; margin: -13px 0 0 -13px;
  pointer-events: none;
  opacity: 0; transition: opacity 0.15s ease;
  z-index: 15;
}
body.mouse-locked #crosshair { opacity: 0.95; }
#crosshair::before, #crosshair::after {
  content: '';
  position: absolute; background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 5px rgba(4, 14, 26, 0.8);
}
#crosshair::before {
  left: 50%; top: 0; width: 2px; height: 100%; margin-left: -1px;
  clip-path: polygon(0 0, 100% 0, 100% 32%, 0 32%, 0 68%, 100% 68%, 100% 100%, 0 100%);
}
#crosshair::after {
  top: 50%; left: 0; height: 2px; width: 100%; margin-top: -1px;
  clip-path: polygon(0 0, 32% 0, 32% 100%, 0 100%, 68% 0, 100% 0, 100% 100%, 68% 100%);
}
#crosshair .ch-dot {
  position: absolute; left: 50%; top: 50%;
  width: 4px; height: 4px; margin: -2px 0 0 -2px;
  border-radius: 50%; background: var(--gold);
  box-shadow: 0 0 6px rgba(245, 183, 49, 0.9);
}

#killfeed {
  position: absolute; top: 110px; left: 14px;
  display: flex; flex-direction: column; gap: 5px;
  width: 270px;
}
.kf-item {
  background: rgba(8, 25, 42, 0.66);
  border-left: 3px solid var(--gold);
  border-radius: 6px;
  padding: 4px 9px;
  color: #e8eef4; font-size: 12px; font-weight: 700;
  animation: kfIn 0.3s ease-out;
  backdrop-filter: blur(3px);
}
.kf-item b { color: var(--gold); }
.kf-item.out { opacity: 0; transition: opacity 0.8s; }
@keyframes kfIn { from { transform: translateX(-16px); opacity: 0; } to { transform: none; opacity: 1; } }

#lb {
  position: absolute; top: 14px; right: 14px;
  background: rgba(8, 25, 42, 0.66);
  border: 1.5px solid rgba(245, 183, 49, 0.3);
  border-radius: 12px;
  padding: 8px 10px;
  min-width: 172px;
  backdrop-filter: blur(4px);
}
.lb-title {
  font-family: Georgia, 'Times New Roman', serif;
  color: var(--gold); font-size: 15px; letter-spacing: 0.06em;
  margin-bottom: 5px;
}
.lb-row {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700; color: #dfe9f2;
  padding: 2px 4px; border-radius: 6px;
}
.lb-row .lb-rank {
  width: 16px; font-size: 11px; text-align: center;
  color: rgba(255, 255, 255, 0.55); font-weight: 800;
}
.lb-row:nth-child(2) .lb-rank { color: #ffd76a; }
.lb-row:nth-child(3) .lb-rank { color: #cdd8e0; }
.lb-row:nth-child(4) .lb-rank { color: #d9a06b; }
.lb-row .lb-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; box-shadow: 0 0 4px rgba(0,0,0,0.5); }
.lb-row .lb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 96px; }
.lb-row .lb-gold { color: var(--gold); font-size: 11px; }
.lb-row.me { background: rgba(245, 183, 49, 0.18); outline: 1px solid rgba(245, 183, 49, 0.4); }

#map-wrap {
  position: absolute; right: 14px; bottom: 14px;
  border-radius: 14px;
  border: 3px solid rgba(8, 25, 42, 0.85);
  box-shadow: var(--shadow);
  overflow: hidden;
  background: rgba(10, 30, 50, 0.75);
}
#minimap { display: block; width: 132px; height: 132px; }

#hud-btns {
  position: absolute; left: 14px; bottom: 14px;
  display: flex; gap: 9px;
}

.iconbtn {
  position: relative;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(245, 183, 49, 0.4);
  background: rgba(8, 25, 42, 0.78);
  color: var(--gold);
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform 0.12s, background 0.2s, border-color 0.2s;
  backdrop-filter: blur(4px);
}
.iconbtn svg { width: 21px; height: 21px; }
.iconbtn:hover { transform: translateY(-2px); background: rgba(27, 74, 112, 0.9); border-color: var(--gold); }
.iconbtn:active { transform: translateY(0) scale(0.94); }
.iconbtn.small { width: 36px; height: 36px; }
.iconbtn.small svg { width: 17px; height: 17px; }

#btn-fire {
  display: none;
  position: absolute;
  right: 18px;
  bottom: 170px;
  width: 72px; height: 72px;
  background: rgba(226, 72, 61, 0.85);
  border-color: #ff9a8f;
}
#btn-fire svg { width: 34px; height: 34px; }
body.touch #btn-fire { display: inline-flex; }

#shop-badge {
  position: absolute; top: -3px; right: -3px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--navy);
  animation: badgePulse 1.2s ease-in-out infinite;
}
@keyframes badgePulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.35); } }

#banner {
  position: absolute; left: 50%; top: 26%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}
#banner-main {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(34px, 6vw, 62px);
  color: #fff;
  opacity: 0;
  text-shadow: 0 3px 0 var(--wood-3), 0 6px 18px rgba(0, 0, 0, 0.6), 0 0 30px rgba(245, 183, 49, 0.35);
}
#banner-sub {
  font-weight: 800; font-size: clamp(15px, 2.4vw, 22px);
  color: var(--gold);
  opacity: 0;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}
#banner.anim #banner-main { animation: bannerPop 1.9s cubic-bezier(0.2, 1.4, 0.4, 1) forwards; }
#banner.anim #banner-sub { animation: bannerSub 1.9s ease-out forwards; }
#banner.gold #banner-main { color: var(--gold); }
@keyframes bannerPop {
  0% { transform: scale(0.4) rotate(-4deg); opacity: 0; }
  12% { transform: scale(1.12) rotate(1deg); opacity: 1; }
  22% { transform: scale(1) rotate(0); }
  78% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.05) translateY(-14px); opacity: 0; }
}
@keyframes bannerSub {
  0%, 10% { opacity: 0; }
  22% { opacity: 1; }
  78% { opacity: 1; }
  100% { opacity: 0; }
}

#hint {
  position: absolute; left: 50%; bottom: 92px;
  transform: translateX(-50%);
  background: rgba(8, 25, 42, 0.78);
  border: 1px solid rgba(245, 183, 49, 0.35);
  color: #f4ecd8; font-weight: 700; font-size: 14px;
  padding: 8px 18px; border-radius: 999px;
  opacity: 0; transition: opacity 0.4s;
  pointer-events: none;
  text-align: center;
  max-width: 86vw;
  backdrop-filter: blur(4px);
}
#hint.show { opacity: 1; }

/* ---------- Screens & panels ---------- */

.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 22px;
  padding: 20px;
  z-index: 20;
}
#screen-menu { justify-content: center; }

.panel {
  background:
    repeating-linear-gradient(93deg, rgba(120, 84, 40, 0.05) 0 2px, transparent 2px 9px),
    radial-gradient(ellipse at 50% 0%, rgba(255, 252, 240, 0.5), transparent 55%),
    linear-gradient(160deg, var(--parch) 0%, var(--parch-2) 70%, var(--parch-3) 100%);
  border: 3px solid var(--wood-2);
  border-radius: 18px;
  box-shadow:
    var(--shadow),
    0 0 0 2px var(--wood-3),
    0 0 0 3.5px rgba(245, 183, 49, 0.5),
    inset 0 0 0 2px rgba(255, 255, 255, 0.35),
    inset 0 0 40px rgba(120, 84, 40, 0.18);
  padding: 22px 26px;
  color: var(--ink);
  position: relative;
}

.panel-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 34px; letter-spacing: 0.08em;
  color: var(--wood-3);
  text-align: center;
  margin-bottom: 14px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 800; font-size: 15px;
  color: #ffe9b8;
  background: linear-gradient(180deg, #8a5a33, #6b421f);
  border: 2px solid var(--wood-3);
  border-radius: 12px;
  padding: 10px 20px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.18), 0 4px 10px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s, filter 0.15s;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.12); }
.btn:active { transform: translateY(0) scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; filter: grayscale(0.4); }

.btn-primary {
  background: linear-gradient(180deg, #ffd257, var(--gold) 45%, var(--gold-2));
  color: #4a2c00;
  border-color: #8a5c0a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
  position: relative; overflow: hidden;
}
.btn-primary::after {
  content: '';
  position: absolute; top: 0; left: -80%;
  width: 50%; height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-20deg);
  animation: sheen 3.2s ease-in-out infinite;
}
@keyframes sheen { 0%, 60% { left: -80%; } 100% { left: 140%; } }

.btn-danger { background: linear-gradient(180deg, #d05a48, #a33427); border-color: #6e2018; }
.btn-big { font-size: 19px; padding: 13px 34px; letter-spacing: 0.06em; width: 100%; }
.btn-small { font-size: 13px; padding: 7px 14px; }

.menu-row { display: flex; gap: 9px; justify-content: center; flex-wrap: wrap; }
.btn-block { width: 100%; }

/* Ghost-style secondary action: quieter than the wood buttons, so the main
   action of each screen reads first. */
.btn-ghost {
  background: transparent;
  border: 2px solid rgba(90, 60, 25, 0.4);
  color: #6e4e22;
  box-shadow: none;
  text-shadow: none;
}
.btn-ghost:hover {
  background: rgba(90, 60, 25, 0.1);
  border-color: rgba(90, 60, 25, 0.7);
  filter: none;
}
.btn-ghost:active { background: rgba(90, 60, 25, 0.18); }
.btn-ghost svg { width: 15px; height: 15px; opacity: 0.75; flex: none; }

/* ---------- Main menu ---------- */

#screen-menu::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(4, 14, 26, 0.14) 30%, rgba(4, 14, 26, 0.52) 100%);
  pointer-events: none;
}
#screen-menu > * { position: relative; }

#menu-logo { text-align: center; animation: logoBob 4s ease-in-out infinite; }
@keyframes logoBob { 0%, 100% { transform: translateY(0) rotate(-0.6deg); } 50% { transform: translateY(-8px) rotate(0.6deg); } }

/* Enamel-pin ship's-badge crest above the title */
#menu-crest {
  width: 86px; height: 86px;
  margin: 0 auto 2px;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.5));
}
#menu-crest svg { width: 100%; height: 100%; animation: crestGlint 5s ease-in-out infinite; }
@keyframes crestGlint {
  0%, 72%, 100% { transform: none; filter: none; }
  80% { transform: scale(1.07); filter: brightness(1.35) drop-shadow(0 0 10px rgba(245, 183, 49, 0.8)); }
  88% { transform: scale(1.02); filter: brightness(1.1); }
}

/* Rope-tied ribbon tails pinned to the top corners of the menu panel */
.panel-ribbons i {
  position: absolute; top: -7px;
  width: 46px; height: 15px;
  background: linear-gradient(180deg, var(--red), var(--red-2));
  border: 1.5px solid rgba(46, 12, 8, 0.65);
  box-shadow: 0 3px 7px rgba(0, 0, 0, 0.35), inset 0 1.5px 0 rgba(255, 255, 255, 0.28);
  z-index: 1;
}
.panel-ribbons i:first-child { left: -13px; transform: rotate(-5deg); border-radius: 5px 2px 3px 6px; clip-path: polygon(0 0, 100% 0, 100% 100%, 30% 78%, 0 100%); }
.panel-ribbons i:last-child { right: -13px; transform: rotate(5deg); border-radius: 2px 5px 6px 3px; clip-path: polygon(0 0, 100% 0, 70% 78%, 100% 100%, 0 100%); }

#menu-logo h1 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(40px, 7.5vw, 72px);
  letter-spacing: 0.04em;
  line-height: 1;
  margin-top: 4px;
  background: linear-gradient(180deg, #fff 12%, #f7e7c3 38%, #e8cd94 55%, #f5b731 68%, #b8810f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 2px #2c1c0a;
  paint-order: stroke fill;
  filter: drop-shadow(0 4px 0 var(--wood-3)) drop-shadow(0 9px 16px rgba(0, 0, 0, 0.6));
}
#menu-logo h1 span { color: transparent; background: linear-gradient(180deg, #fff8e0 10%, var(--gold) 55%, #c98f1b 100%); -webkit-background-clip: text; background-clip: text; }
#menu-logo em {
  display: block;
  font-family: Georgia, 'Times New Roman', serif; font-style: normal;
  font-size: clamp(17px, 3vw, 25px);
  color: var(--parch);
  letter-spacing: 0.35em;
  text-indent: 0.35em;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.85);
  margin-top: 6px;
}
#menu-logo em::before, #menu-logo em::after {
  content: '';
  display: inline-block;
  vertical-align: middle;
  width: 34px; height: 2px; margin: 0 12px;
  background: linear-gradient(90deg, transparent, rgba(245, 183, 49, 0.9));
}
#menu-logo em::after { background: linear-gradient(90deg, rgba(245, 183, 49, 0.9), transparent); }

.menu-panel { width: min(400px, 92vw); display: flex; flex-direction: column; gap: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 12px; font-weight: 800; letter-spacing: 0.1em;
  color: #7a5a30; text-transform: uppercase;
}

.namerow { display: flex; gap: 8px; align-items: center; }
#input-name {
  flex: 1;
  font-family: inherit; font-weight: 700; font-size: 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
  border: 2px solid var(--wood-2);
  border-radius: 10px;
  padding: 9px 13px;
  outline: none;
  transition: box-shadow 0.15s, background 0.15s;
}
#input-name:focus { background: rgba(255, 255, 255, 0.85); box-shadow: 0 0 0 3px rgba(245, 183, 49, 0.45); }

#flag-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.4), 0 2px 4px rgba(0, 0, 0, 0.25);
  transition: transform 0.12s;
}
.swatch:hover { transform: scale(1.15); }
.swatch.sel { outline: 3px solid #fff; outline-offset: 1px; transform: scale(1.1); }

#menu-best {
  text-align: center;
  font-size: 12.5px; font-weight: 700; color: #7a5a30;
  display: flex; justify-content: center; gap: 14px; flex-wrap: wrap;
}
#menu-best b { color: var(--wood-3); }

#menu-footer {
  position: absolute; bottom: 14px; left: 0; right: 0;
  text-align: center;
  font-size: 12px; font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* ---------- Pause / death ---------- */

.pause-panel, .death-panel {
  width: min(360px, 92vw);
  display: flex; flex-direction: column; gap: 11px;
}

.death-title { color: var(--red-2); font-size: 44px; filter: drop-shadow(0 4px 12px rgba(176, 48, 40, 0.3)); }
.death-panel .panel-title { text-shadow: 0 2px 0 rgba(255, 255, 255, 0.5), 0 5px 14px rgba(176, 48, 40, 0.35); }
#death-by {
  text-align: center; font-weight: 700; font-size: 15px;
  color: #6e4e22; margin-top: -8px; margin-bottom: 4px;
}
.death-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px; margin-bottom: 8px;
}
.dstat {
  background: linear-gradient(180deg, rgba(255, 252, 240, 0.75), rgba(255, 252, 240, 0.35));
  border: 1.5px solid rgba(90, 60, 25, 0.4);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 2px 5px rgba(74, 44, 0, 0.14);
  padding: 9px 4px;
  text-align: center;
}
.dstat span { display: block; font-size: 19px; font-weight: 800; color: var(--wood-3); text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); }
.dstat label { font-size: 10px; font-weight: 800; letter-spacing: 0.06em; color: #8a6a38; text-transform: uppercase; }
#respawn-cost { font-size: 12px; opacity: 0.75; font-weight: 700; }

/* ---------- Shop ---------- */

.shop-panel {
  width: min(560px, 94vw);
  max-height: min(640px, 92vh);
  display: flex; flex-direction: column;
}
.shop-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.shop-head .panel-title { margin-bottom: 0; }
.shop-scroll { overflow-y: auto; padding: 4px 6px 4px 2px; flex: 1; min-height: 0; }
.shop-sep {
  font-size: 12px; font-weight: 800; letter-spacing: 0.14em;
  color: #8a6a38; margin: 14px 0 8px;
  display: flex; align-items: center; gap: 10px;
}
.shop-sep::after { content: ''; flex: 1; height: 1.5px; background: rgba(90, 60, 25, 0.3); }

#shop-classes { display: flex; gap: 10px; align-items: stretch; }
.cls-card {
  flex: 1;
  background: linear-gradient(180deg, rgba(255, 252, 240, 0.7), rgba(255, 252, 240, 0.3));
  border: 2px solid rgba(90, 60, 25, 0.4);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 2px 6px rgba(74, 44, 0, 0.14);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.cls-card.current {
  border-color: var(--green);
  background: linear-gradient(180deg, rgba(63, 174, 90, 0.16), rgba(63, 174, 90, 0.07));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 0 0 2px rgba(63, 174, 90, 0.35), 0 2px 6px rgba(74, 44, 0, 0.14);
}
.cls-card h3 { font-family: Georgia, 'Times New Roman', serif; font-size: 22px; letter-spacing: 0.05em; color: var(--wood-3); }
.cls-card .cls-badge {
  font-size: 10px; font-weight: 800; letter-spacing: 0.1em;
  color: var(--green); align-self: flex-start;
}
.cls-card .cls-cost { font-size: 12px; font-weight: 800; color: #8a6a38; display: flex; align-items: center; gap: 5px; }
.cls-stat { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: #6e4e22; }
.cls-stat b { color: var(--ink); }
.cls-card .btn { margin-top: auto; }
.cls-arrow { align-self: center; font-size: 22px; color: #8a6a38; font-weight: 800; }

.up-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 4px;
  border-bottom: 1.5px dashed rgba(90, 60, 25, 0.25);
}
.up-row:last-child { border-bottom: none; }
.up-info { flex: 1; min-width: 0; }
.up-name { font-weight: 800; font-size: 14.5px; color: var(--ink); }
.up-desc { font-size: 11.5px; font-weight: 600; color: #8a6a38; }
.up-pips { display: flex; gap: 4px; }
.up-pips i {
  width: 9px; height: 9px; border-radius: 50%;
  background: rgba(90, 60, 25, 0.18);
  border: 1px solid rgba(90, 60, 25, 0.4);
  box-shadow: inset 0 1.5px 2px rgba(74, 44, 0, 0.35);
}
.up-pips i.on { background: var(--gold); border-color: var(--gold-2); box-shadow: 0 0 5px rgba(245, 183, 49, 0.7); }
.up-buy { min-width: 96px; font-size: 13px; padding: 8px 10px; }
.up-buy .coin-ico { width: 13px; height: 13px; }
.up-max { font-size: 11px; font-weight: 800; color: var(--green); letter-spacing: 0.08em; min-width: 96px; text-align: center; }

/* ---------- Modals ---------- */

.modal { position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; }
.modal-back { position: absolute; inset: 0; background: rgba(4, 14, 26, 0.55); backdrop-filter: blur(3px); }
.modal-panel {
  position: relative;
  width: min(400px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 11px;
  animation: modalIn 0.25s cubic-bezier(0.2, 1.3, 0.4, 1);
}
@keyframes modalIn { from { transform: scale(0.85) translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Round ✕ in the corner of any closable panel */
.panel-x {
  position: absolute; top: 10px; right: 10px;
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1.5px solid rgba(90, 60, 25, 0.4);
  background: rgba(120, 84, 40, 0.12);
  color: #6e4e22;
  z-index: 2;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}
.panel-x svg { width: 13px; height: 13px; }
.panel-x:hover { background: rgba(176, 48, 40, 0.15); border-color: var(--red-2); color: var(--red-2); transform: scale(1.06); }
.panel-x:active { transform: scale(0.94); }

.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-weight: 700; font-size: 14.5px; color: var(--ink);
  padding: 4px 2px;
}
.set-row input[type="range"] { width: 150px; accent-color: var(--gold-2); }
.set-row select {
  font-family: inherit; font-weight: 700; font-size: 13.5px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.6);
  border: 2px solid var(--wood-2);
  border-radius: 8px; padding: 5px 9px; outline: none;
}
.tgl-row input { display: none; }
.tgl {
  width: 44px; height: 24px; border-radius: 999px;
  background: rgba(90, 60, 25, 0.35);
  border: 2px solid rgba(90, 60, 25, 0.5);
  position: relative;
  transition: background 0.2s;
  flex: none;
}
.tgl::after {
  content: '';
  position: absolute; top: 1px; left: 1px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
  transition: left 0.2s;
}
.tgl-row input:checked + .tgl {
  background: var(--gold-2);
  box-shadow: 0 0 8px rgba(245, 183, 49, 0.45), inset 0 1px 2px rgba(255, 255, 255, 0.4);
}
.tgl-row input:checked + .tgl::after { left: 21px; }

/* ---------- How to play ---------- */

.howto-panel { width: min(520px, 94vw); }.howto-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.howto-item {
  display: grid;
  grid-template-columns: 30px 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  background: linear-gradient(180deg, rgba(255, 252, 240, 0.7), rgba(255, 252, 240, 0.3));
  border: 1.5px solid rgba(90, 60, 25, 0.35);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 2px 5px rgba(74, 44, 0, 0.12);
  padding: 10px 12px;
}
.howto-item svg { grid-row: 1 / 3; width: 26px; height: 26px; color: var(--gold-2); align-self: center; }
.howto-item b { font-size: 13.5px; color: var(--wood-3); }
.howto-item span { font-size: 12px; font-weight: 600; color: #6e4e22; }
.keys-row {
  text-align: center; font-size: 12.5px; font-weight: 600; color: #8a6a38;
  padding-top: 2px;
}
.keys-row b {
  display: inline-block;
  background: linear-gradient(180deg, #fffcf0, #efe2c4);
  border: 1px solid rgba(90, 60, 25, 0.5);
  border-bottom-width: 3px;
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 11px;
  color: var(--wood-3);
  box-shadow: 0 1px 2px rgba(74, 44, 0, 0.18);
  margin: 0 1px;
}

/* ---------- Toast / fps / loading / error ---------- */

#toast {
  position: absolute; left: 50%; bottom: 40px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(8, 25, 42, 0.9);
  color: #f4ecd8; font-weight: 700; font-size: 14px;
  border: 1.5px solid rgba(245, 183, 49, 0.4);
  border-radius: 999px;
  padding: 9px 20px;
  opacity: 0; transition: opacity 0.3s, transform 0.3s;
  pointer-events: none; z-index: 60;
  max-width: 86vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

#fps {
  position: absolute; top: 8px; left: 50%;
  transform: translateX(-50%);
  font-size: 12px; font-weight: 800; color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 2px #000;
  z-index: 30; pointer-events: none;
}

#loading {
  position: absolute; inset: 0; z-index: 100;
  background: radial-gradient(ellipse at center, #123a5c, #081c30 75%);
  display: flex; align-items: center; justify-content: center;
}
.load-inner { text-align: center; color: #cfe3f2; font-weight: 700; font-size: 16px; letter-spacing: 0.04em; }
.load-ship { width: 84px; height: 84px; animation: loadBob 1.6s ease-in-out infinite; display: block; margin: 0 auto 12px; }
@keyframes loadBob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-10px) rotate(3deg); } }

#errorbox {
  position: absolute; inset: auto 14px 14px 14px; z-index: 110;
  background: rgba(176, 48, 40, 0.95);
  color: #fff; font-weight: 700; font-size: 13px;
  border-radius: 12px; padding: 12px 16px;
  white-space: pre-wrap;
  pointer-events: none;
}

/* ---------- Responsive / touch ---------- */

@media (max-width: 760px) {
  #hud-tl { width: 190px; }
  #hp-bar { width: 150px; }
  #lb { min-width: 140px; }
  .lb-row .lb-name { max-width: 70px; }
  #minimap { width: 96px; height: 96px; }
  #killfeed { display: none; }
  #hud-btns { gap: 7px; }
  .iconbtn { width: 40px; height: 40px; }
  #hud-chips { flex-wrap: wrap; }
  .death-stats { grid-template-columns: repeat(2, 1fr); }
  .howto-grid { grid-template-columns: 1fr; }
  #menu-logo h1 { font-size: 11vw; }
}

/* Short landscape windows (common on laptops with the menu open) */
@media (max-height: 620px) {
  #screen-menu { gap: 10px; }
  #menu-logo h1 { font-size: clamp(40px, 8vh, 64px); }
  #menu-crest { width: 58px; height: 58px; }
  .menu-panel { gap: 9px; }
  .btn-big { font-size: 17px; padding: 10px 28px; }
  #menu-footer { display: none; }
}

/* ---------- Visual polish pass ---------- */

/* Keyboard focus rings (accessibility) */
.btn:focus-visible,
.iconbtn:focus-visible,
.swatch:focus-visible,
.keys-row b:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(245, 183, 49, 0.65);
  outline-offset: 2px;
}
.swatch:focus-visible { outline-color: rgba(255, 255, 255, 0.9); }

/* Disabled buttons must not react to hover */
.btn:disabled:hover,
.btn:disabled:active { transform: none; filter: grayscale(0.4); }
.btn:disabled:focus-visible { outline-color: rgba(255, 255, 255, 0.35); }
.panel-x:focus-visible { outline: 3px solid rgba(176, 48, 40, 0.6); outline-offset: 2px; }

/* Panel titles clear the ✕ button on the right */
.panel-x ~ .panel-title { margin-right: 24px; }

/* Death screen: banner-worthy title treatment */
.death-panel .panel-title { text-shadow: 0 2px 0 rgba(255, 255, 255, 0.5), 0 5px 14px rgba(176, 48, 40, 0.35); }
#respawn-cost { font-size: 12px; opacity: 0.75; font-weight: 700; }
#respawn-cost:not(:empty) { opacity: 1; color: #7c3a12; }

/* Muted-state styling on the sound button */
.iconbtn.off { color: #9fb6c9; border-color: rgba(255, 255, 255, 0.22); }
.iconbtn.off:hover { border-color: rgba(255, 255, 255, 0.4); background: rgba(27, 74, 112, 0.9); }

/* Dim the scene behind pause / shop / death screens */
#screen-pause::before,
#screen-shop::before,
#screen-death::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(4, 14, 26, 0.22) 30%, rgba(4, 14, 26, 0.62) 100%);
}
#screen-death::before {
  background: radial-gradient(ellipse at center, rgba(70, 10, 5, 0.35) 25%, rgba(12, 3, 2, 0.75) 100%);
}

/* Panels glide in whenever a screen is revealed */
.screen .panel { animation: panelIn 0.3s cubic-bezier(0.2, 1.3, 0.4, 1); }
@keyframes panelIn {
  from { transform: scale(0.94) translateY(14px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* Tactile "stitched rope" detail on panels */
.panel::after {
  content: '';
  position: absolute; inset: 5px;
  border: 1.5px dashed rgba(90, 60, 25, 0.32);
  border-radius: 13px;
  pointer-events: none;
}

/* Letterpress depth for panel titles */
.panel-title {
  text-shadow:
    0 -1px 1px rgba(74, 44, 0, 0.28),
    0 1px 0 rgba(255, 255, 255, 0.55);
}

/* Themed range slider */
.set-row input[type="range"] {
  -webkit-appearance: none; appearance: none;
  height: 6px; border-radius: 4px;
  background: linear-gradient(90deg, var(--gold-2) 80%, rgba(90, 60, 25, 0.28) 80%);
  outline: none;
}
.set-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe08a, var(--gold) 55%, var(--gold-2));
  border: 2px solid #8a5c0a;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}
.set-row input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe08a, var(--gold) 55%, var(--gold-2));
  border: 2px solid #8a5c0a;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}

.set-row select:focus { box-shadow: 0 0 0 3px rgba(245, 183, 49, 0.4); }

/* Toggle rows behave like the controls they are */
.tgl-row { cursor: pointer; }
.tgl-row:hover .tgl { border-color: var(--gold-2); background: rgba(90, 60, 25, 0.5); }

/* Themed scrollbars */
.shop-scroll::-webkit-scrollbar,
.modal-panel::-webkit-scrollbar { width: 10px; }
.shop-scroll::-webkit-scrollbar-track,
.modal-panel::-webkit-scrollbar-track {
  background: rgba(90, 60, 25, 0.08);
  border-radius: 8px;
}
.shop-scroll::-webkit-scrollbar-thumb,
.modal-panel::-webkit-scrollbar-thumb {
  background: rgba(90, 60, 25, 0.45);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.shop-scroll::-webkit-scrollbar-thumb:hover,
.modal-panel::-webkit-scrollbar-thumb:hover { background-color: rgba(90, 60, 25, 0.65); }

/* Shop cards & how-to items respond to hover */
.cls-card, .howto-item { transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s; }
.cls-card:hover {
  transform: translateY(-2px);
  border-color: rgba(90, 60, 25, 0.7);
  box-shadow: 0 8px 18px rgba(60, 35, 10, 0.18);
}
.howto-item:hover {
  transform: translateY(-1px);
  border-color: rgba(90, 60, 25, 0.55);
  box-shadow: 0 6px 14px rgba(60, 35, 10, 0.14);
}

/* Menu best-stats as chips */
#menu-best span {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(90, 60, 25, 0.12);
  border: 1.5px solid rgba(90, 60, 25, 0.28);
  border-radius: 999px;
  padding: 4px 12px;
}

/* Shop footnote */
.shop-note {
  text-align: center;
  font-size: 12px; font-weight: 700;
  color: #8a6a38;
  margin: -3px 0 9px;
}

/* Respawn cost sits under the label */
#respawn-cost { margin-left: 7px; }

/* Inner ring on the minimap frame */
#map-wrap {
  box-shadow: var(--shadow), inset 0 0 0 1.5px rgba(159, 215, 234, 0.25);
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  #menu-logo, .load-ship, #shop-badge,
  .btn-primary::after,
  .screen .panel,
  .modal-panel,
  #banner.anim #banner-main,
  #banner.anim #banner-sub,
  #vignette.danger { animation: none !important; }
  #banner.anim #banner-main,
  #banner.anim #banner-sub { opacity: 1 !important; }
}

/* Safe-area aware HUD on notched devices */
@supports (padding: env(safe-area-inset-left)) {
  #hud-tl { top: calc(14px + env(safe-area-inset-top)); left: calc(14px + env(safe-area-inset-left)); }
  #lb { top: calc(14px + env(safe-area-inset-top)); right: calc(14px + env(safe-area-inset-right)); }
  #hud-btns { bottom: calc(14px + env(safe-area-inset-bottom)); left: calc(14px + env(safe-area-inset-left)); }
  #map-wrap { bottom: calc(14px + env(safe-area-inset-bottom)); right: calc(14px + env(safe-area-inset-right)); }
}

