/* =========================================================
   VACMAN — neon-domestic arcade
   ========================================================= */

:root {
  /* base palette */
  --bg-deep: #07070f;
  --bg-night: #0d0d1a;
  --bg-panel: #14142a;
  --bg-panel-2: #1c1c36;
  --line-soft: rgba(255, 255, 255, 0.07);
  --line-mid: rgba(255, 255, 255, 0.14);

  /* text */
  --text-primary: #f3f3ff;
  --text-secondary: #c2c2dc;
  --text-muted: #7a7a9a;

  /* arcade neons */
  --mint: #00ffc6;
  --mint-soft: rgba(0, 255, 198, 0.18);
  --pink: #ff3d8b;
  --pink-soft: rgba(255, 61, 139, 0.2);
  --amber: #ffb13d;
  --amber-soft: rgba(255, 177, 61, 0.22);
  --violet: #8b5cf6;
  --sky: #38bdf8;

  /* powerup hues */
  --pu-speed: #ffd84d;
  --pu-turret: #ff6b6b;
  --pu-mine: #b388ff;
  --pu-bomb: #ff8c42;
  --pu-stealth: #38bdf8;

  /* type */
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

  /* layout */
  --radius-xl: 28px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;

  /* shadows */
  --shadow-pop: 0 24px 80px -16px rgba(0, 0, 0, 0.6),
    0 0 0 1px var(--line-soft) inset;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-feature-settings: "ss01", "cv11";
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
}

body {
  /* ambient gradient under the canvas */
  background:
    radial-gradient(ellipse 1200px 800px at 20% 0%, rgba(139, 92, 246, 0.18), transparent 60%),
    radial-gradient(ellipse 900px 700px at 100% 100%, rgba(0, 255, 198, 0.13), transparent 60%),
    linear-gradient(180deg, #06060d, #0a0a16 60%, #07070f);
}

a { color: inherit; }

/* ---------- Background atmosphere ---------- */

.bg-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.95 0 0 0 0 0.95 0 0 0 0 0.95 0 0 0 0.18 0'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
}

.bg-glow {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  filter: blur(120px);
  opacity: 0.55;
  border-radius: 50%;
}
.bg-glow--mint {
  width: 600px; height: 600px;
  background: var(--mint);
  top: -200px; left: -180px;
  animation: drift 22s ease-in-out infinite alternate;
}
.bg-glow--pink {
  width: 700px; height: 700px;
  background: var(--pink);
  bottom: -260px; right: -240px;
  opacity: 0.4;
  animation: drift 28s ease-in-out infinite alternate-reverse;
}
@keyframes drift {
  from { transform: translate3d(0,0,0); }
  to   { transform: translate3d(60px, 40px, 0); }
}

/* ---------- 3D canvas ---------- */

#game-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
  background: transparent;
  /* Subtle vignette baked into the canvas wrapper */
}

/* ---------- UI shell ---------- */

.ui {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 4vw, 56px);
  pointer-events: none;
}

.screen {
  width: 100%;
  max-width: 1080px;
  pointer-events: auto;
  animation: screen-in 0.45s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes screen-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

.screen[hidden] { display: none !important; }

.screen__header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.screen__header h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -0.02em;
  margin: 0;
}
.screen__sub {
  color: var(--text-muted);
  font-size: 14px;
  margin-left: 4px;
}

/* ---------- Title screen ---------- */

.title {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: clamp(24px, 5vw, 56px);
  background: linear-gradient(180deg, rgba(20, 20, 42, 0.6), rgba(13, 13, 26, 0.78));
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-pop);
  max-width: 760px;
  margin: auto;
  position: relative;
  overflow: hidden;
}
.title::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 30% 0%, rgba(0, 255, 198, 0.18), transparent 50%),
    radial-gradient(circle at 80% 100%, rgba(255, 61, 139, 0.15), transparent 55%);
  pointer-events: none;
}

.title__eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.32em;
  color: var(--mint);
  padding: 6px 12px;
  border: 1px solid var(--mint-soft);
  border-radius: 999px;
  background: rgba(0, 255, 198, 0.06);
  margin-bottom: 22px;
}

.title__logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(72px, 14vw, 148px);
  line-height: 0.85;
  letter-spacing: -0.04em;
  margin: 0 0 18px;
  text-transform: lowercase;
  display: flex;
  gap: 0.05em;
}
.title__logo-vac {
  background: linear-gradient(180deg, #fff, #c2c2dc 80%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 6px 30px rgba(255, 255, 255, 0.08);
}
.title__logo-man {
  background: linear-gradient(135deg, var(--mint), var(--sky) 60%, var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 30px rgba(0, 255, 198, 0.4));
}

.title__tagline {
  max-width: 460px;
  color: var(--text-secondary);
  font-size: 17px;
  line-height: 1.5;
  margin: 0 0 36px;
}

.title__menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}
.title__menu .btn { justify-content: flex-start; }
@media (max-width: 520px) {
  .title__menu { grid-template-columns: 1fr; }
}

.title__credits {
  margin-top: 30px;
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.title__credits a {
  color: var(--mint);
  text-decoration: none;
  border-bottom: 1px dashed rgba(0, 255, 198, 0.35);
  padding-bottom: 1px;
}

/* ---------- Buttons ---------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 1px solid var(--line-mid);
  background: linear-gradient(180deg, rgba(28,28,54,0.9), rgba(20,20,42,0.9));
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform 0.18s, border-color 0.18s, background 0.18s, box-shadow 0.18s;
  text-align: left;
  user-select: none;
}
.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,0.32);
  box-shadow: 0 10px 28px -12px rgba(0,0,0,0.6);
}
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn--primary {
  background: linear-gradient(135deg, var(--mint), #00d2a3);
  color: #042620;
  border-color: transparent;
  box-shadow: 0 14px 40px -10px rgba(0, 255, 198, 0.45);
}
.btn--primary:hover {
  filter: brightness(1.04);
  box-shadow: 0 18px 50px -10px rgba(0, 255, 198, 0.6);
}

.btn--ghost {
  background: transparent;
  border-color: var(--line-soft);
}
.btn--full { width: 100%; justify-content: center; }
.btn--small { padding: 8px 12px; font-size: 13px; }

.btn__kbd {
  display: inline-grid;
  place-items: center;
  width: 28px; height: 28px;
  border: 1px solid var(--line-mid);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(0,0,0,0.25);
  flex-shrink: 0;
}
.btn--primary .btn__kbd {
  background: rgba(0,0,0,0.18);
  border-color: rgba(0,0,0,0.25);
  color: #042620;
}
.btn__hint {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}
.btn--primary .btn__hint { color: rgba(4, 38, 32, 0.65); }

.iconbtn {
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line-mid);
  background: rgba(20,20,42,0.7);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 18px;
  transition: transform 0.18s, border-color 0.18s;
}
.iconbtn:hover { transform: translateY(-1px); border-color: var(--mint); color: var(--mint); }

/* ---------- Input ---------- */

.input {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-mid);
  background: rgba(7,7,15,0.6);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.input:focus {
  border-color: var(--mint);
  box-shadow: 0 0 0 3px var(--mint-soft);
  background: rgba(7,7,15,0.85);
}
.input--code {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 28px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  font-weight: 700;
}

.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.field__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ---------- Garage ---------- */

.garage {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 28px;
  padding: 28px;
  background: linear-gradient(180deg, rgba(20,20,42,0.6), rgba(13,13,26,0.78));
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-pop);
}
@media (max-width: 720px) {
  .garage { grid-template-columns: 1fr; }
}

.garage__preview {
  position: relative;
  background:
    radial-gradient(circle at 50% 70%, rgba(0,255,198,0.18), transparent 60%),
    linear-gradient(180deg, rgba(40, 40, 80, 0.4), rgba(7,7,15,0.6));
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-soft);
  overflow: hidden;
  min-height: 320px;
  aspect-ratio: 4 / 3;
}
#garage-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.garage__brand-badge {
  position: absolute;
  top: 12px; left: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  border: 1px solid var(--line-mid);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-secondary);
}

.brand-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.brand {
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-mid);
  background: rgba(20,20,42,0.6);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  transition: border-color 0.18s, color 0.18s, background 0.18s, transform 0.18s;
}
.brand:hover { transform: translateY(-1px); color: var(--text-primary); }
.brand[aria-pressed="true"] {
  border-color: var(--mint);
  color: var(--text-primary);
  background: linear-gradient(180deg, rgba(0,255,198,0.12), rgba(0,255,198,0.04));
}

.color-row {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
}
.swatch {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  transition: transform 0.18s;
  box-shadow: 0 0 0 1px var(--line-soft) inset;
}
.swatch:hover { transform: scale(1.1); }
.swatch[aria-pressed="true"] {
  border-color: #fff;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.12), 0 0 16px currentColor;
}

/* ---------- Mode select ---------- */

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 600px) { .mode-grid { grid-template-columns: 1fr; } }

.mode-card {
  padding: 28px;
  border: 1px solid var(--line-mid);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(28,28,54,0.7), rgba(20,20,42,0.7));
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--text-primary);
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
  font-family: var(--font-body);
}
.mode-card:hover {
  transform: translateY(-2px);
  border-color: var(--mint);
  box-shadow: 0 18px 40px -16px rgba(0,255,198,0.35);
}
.mode-card__icon { font-size: 36px; }
.mode-card__name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -0.01em;
}
.mode-card__desc { color: var(--text-muted); font-size: 14px; line-height: 1.45; }

/* ---------- Lobby ---------- */

.lobby {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px;
  background: linear-gradient(180deg, rgba(20,20,42,0.6), rgba(13,13,26,0.78));
  border-radius: var(--radius-xl);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-pop);
}

.lobby__code-block {
  text-align: center;
  padding: 24px;
  background: rgba(7,7,15,0.5);
  border: 1px dashed var(--line-mid);
  border-radius: var(--radius-lg);
}
.lobby__code-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.lobby__code {
  display: block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(48px, 10vw, 84px);
  letter-spacing: 0.18em;
  background: linear-gradient(135deg, var(--mint), var(--sky), var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 18px rgba(0, 255, 198, 0.3));
  margin-bottom: 14px;
}
.lobby__share-hint {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.lobby__join-row { display: flex; gap: 8px; align-items: stretch; }
.lobby__join-row .input { flex: 1; }

.lobby__players {
  background: rgba(7,7,15,0.4);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.lobby__players-header {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.lobby__players-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lobby__player-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(28,28,54,0.6);
  border: 1px solid var(--line-soft);
}
.lobby__player-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
  flex-shrink: 0;
}
.lobby__player-name { flex: 1; font-weight: 600; }
.lobby__player-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.lobby__waiting {
  color: var(--text-muted);
  text-align: center;
  font-size: 13px;
  margin: 0;
}

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

.howto {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 800px) { .howto { grid-template-columns: 1fr; } }

.howto__col {
  background: linear-gradient(180deg, rgba(28,28,54,0.6), rgba(20,20,42,0.7));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 22px;
}
.howto__col h3 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
}
.howto__list {
  list-style: none;
  padding: 0; margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}
.howto__list--icons li { display: flex; gap: 10px; align-items: center; }

.powerchip {
  display: inline-grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: 8px;
  font-size: 14px;
  flex-shrink: 0;
}
.powerchip--speed   { background: rgba(255,216,77,0.18);  color: var(--pu-speed);  box-shadow: 0 0 12px rgba(255,216,77,0.3); }
.powerchip--turret  { background: rgba(255,107,107,0.18); color: var(--pu-turret); box-shadow: 0 0 12px rgba(255,107,107,0.3); }
.powerchip--mine    { background: rgba(179,136,255,0.18); color: var(--pu-mine);   box-shadow: 0 0 12px rgba(179,136,255,0.3); }
.powerchip--bomb    { background: rgba(255,140,66,0.18);  color: var(--pu-bomb);   box-shadow: 0 0 12px rgba(255,140,66,0.3); }
.powerchip--stealth { background: rgba(56,189,248,0.18);  color: var(--pu-stealth);box-shadow: 0 0 12px rgba(56,189,248,0.3); }

kbd {
  display: inline-block;
  min-width: 22px; padding: 2px 6px;
  border: 1px solid var(--line-mid);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: rgba(0,0,0,0.3);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.4;
}

/* ---------- Pause / results ---------- */

.pause, .results {
  max-width: 460px;
  margin: auto;
  padding: 28px;
  background: linear-gradient(180deg, rgba(20,20,42,0.85), rgba(13,13,26,0.92));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-pop);
  text-align: center;
}
.pause h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 38px;
  margin: 0 0 18px;
}
.pause .btn { margin-top: 8px; }
.pause .btn:first-of-type { margin-top: 0; }

.results h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 32px;
  margin: 0 0 6px;
  background: linear-gradient(135deg, var(--mint), var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.results__sub { color: var(--text-muted); font-size: 14px; margin: 0 0 18px; }
.results__board {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 22px;
  text-align: left;
}
.results__row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: rgba(28,28,54,0.5);
}
.results__row--winner {
  border-color: var(--mint);
  background: linear-gradient(180deg, rgba(0,255,198,0.1), rgba(0,255,198,0.04));
}
.results__rank {
  font-family: var(--font-mono); font-weight: 700;
  width: 22px; color: var(--text-muted);
}
.results__row .lobby__player-dot { width: 12px; height: 12px; }
.results__name { flex: 1; font-weight: 600; }
.results__score { font-family: var(--font-mono); font-weight: 700; color: var(--mint); }
.results__buttons { display: flex; flex-direction: column; gap: 8px; }

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

.hud {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(12px, 2.4vw, 24px);
  font-family: var(--font-body);
}
.hud[hidden] { display: none !important; }

.hud__row {
  display: flex; gap: 12px; align-items: center;
  pointer-events: none;
}
.hud__row--top { justify-content: space-between; flex-wrap: wrap; }
.hud__row--bottom { justify-content: space-between; align-items: flex-end; }

.hud__chip {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 14px;
  background: rgba(7,7,15,0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  pointer-events: auto;
}
.hud__label {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--text-muted);
}
.hud__value {
  font-family: var(--font-display); font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.hud__chip--time .hud__value { font-family: var(--font-mono); font-size: 18px; }

.hud__progress {
  display: flex; align-items: center; gap: 12px;
  flex: 1;
  min-width: 200px;
  max-width: 480px;
  padding: 10px 16px;
  background: rgba(7,7,15,0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
}
.hud__progress-bar {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  overflow: hidden;
}
.hud__progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--mint), var(--sky), var(--pink));
  box-shadow: 0 0 16px var(--mint);
  transition: width 0.3s ease;
}
.hud__progress-text {
  font-family: var(--font-mono); font-weight: 700;
  font-size: 13px;
  color: var(--mint);
}

.hud__players {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin: 12px 0;
  pointer-events: none;
}
.hud__player-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 8px;
  background: rgba(7,7,15,0.65);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.hud__player-pill .lobby__player-dot { width: 10px; height: 10px; }
.hud__player-pill--self {
  border-color: var(--mint);
  background: linear-gradient(180deg, rgba(0,255,198,0.16), rgba(0,255,198,0.06));
}
.hud__player-pill--stunned { opacity: 0.45; filter: grayscale(0.5); }
.hud__player-score {
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-left: 4px;
}

.hud__powerup {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: rgba(7,7,15,0.65);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  pointer-events: auto;
  min-width: 220px;
}
.hud__powerup-icon {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  font-size: 22px;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line-mid);
  flex-shrink: 0;
}
.hud__powerup--armed .hud__powerup-icon {
  border-color: var(--mint);
  background: rgba(0,255,198,0.12);
  box-shadow: 0 0 22px rgba(0,255,198,0.4);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
.hud__powerup-meta { display: flex; flex-direction: column; gap: 2px; }
.hud__powerup-name { font-weight: 700; font-size: 14px; }
.hud__powerup-hint { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); letter-spacing: 0.12em; text-transform: uppercase; }

.hud__hint {
  padding: 8px 12px;
  background: rgba(7,7,15,0.5);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hud__icon, .hud__leave {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(7,7,15,0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line-soft);
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  pointer-events: auto;
  transition: color 0.18s, border-color 0.18s, transform 0.18s;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.hud__icon:hover { color: var(--mint); border-color: var(--mint); transform: scale(1.05); }
.hud__icon--active { color: var(--mint); border-color: var(--mint); background: rgba(0, 255, 198, 0.1); }
.hud__leave:hover { color: var(--pink); border-color: var(--pink); transform: scale(1.05); }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  top: max(72px, env(safe-area-inset-top, 0) + 64px);
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  padding: 12px 22px;
  background: rgba(7,7,15,0.85);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line-mid);
  border-radius: 999px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
}
.toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast--good { border-color: var(--mint); color: var(--mint); }
.toast--bad  { border-color: var(--pink); color: var(--pink); }

/* ---------- Touch joystick ---------- */

.touch {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 6;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 24px max(20px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  pointer-events: none;
}
.touch[hidden] { display: none !important; }
.touch__stick {
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(7,7,15,0.55);
  border: 1px solid var(--line-mid);
  position: relative;
  pointer-events: auto;
  touch-action: none;
}
.touch__nub {
  position: absolute;
  top: 50%; left: 50%;
  width: 60px; height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--mint), var(--sky));
  transform: translate(-50%, -50%);
  box-shadow: 0 8px 24px rgba(0, 255, 198, 0.4);
}
.touch__action {
  width: 88px; height: 88px;
  border-radius: 50%;
  border: 1px solid var(--line-mid);
  background: rgba(255, 61, 139, 0.2);
  color: var(--pink);
  font-size: 28px;
  pointer-events: auto;
  cursor: pointer;
  touch-action: none;
  box-shadow: 0 0 24px rgba(255, 61, 139, 0.4);
}
.touch__action:active { transform: scale(0.96); }

/* ---------- Small responsive tweaks ---------- */

@media (max-width: 520px) {
  .title__logo { font-size: clamp(64px, 18vw, 128px); }
  .hud__progress { min-width: 0; flex-basis: 100%; order: 3; }
  .hud__row--top { gap: 8px; }
  .hud__chip { padding: 6px 10px; }
  .hud__chip .hud__value { font-size: 14px; }
  .hud__powerup { min-width: 0; flex: 1; }
  .hud__hint { display: none; }
}
