* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --pink: #ff4f9a;
  --teal: #2dd4bf;
  --yellow: #facc15;
  --bg: #101018;
  --panel: rgba(18, 18, 30, 0.88);
  --panel-border: rgba(255, 255, 255, 0.12);
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: #f1f1f4;
  font-family: "Segoe UI", system-ui, sans-serif;
  user-select: none;
}

.hidden { display: none !important; }

.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
}

/* ============================ menu ============================ */

#menu-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.menu-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  pointer-events: none;
}
.menu-overlay > * { pointer-events: auto; }

.game-title {
  font-size: clamp(52px, 9vw, 110px);
  font-weight: 900;
  letter-spacing: 2px;
  text-shadow: 0 6px 30px rgba(0, 0, 0, 0.6);
}
.t-paint {
  background: linear-gradient(120deg, var(--pink), var(--yellow), var(--teal));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.t-amp { color: #ffffff; }
.t-seek { color: #cfd4ff; }

.tagline {
  font-size: 18px;
  color: #c9cbe0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.menu-card {
  margin-top: 10px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 26px 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(360px, 90vw);
  backdrop-filter: blur(8px);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
}

input[type="text"] {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--panel-border);
  color: #fff;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 16px;
  outline: none;
}
input[type="text"]:focus { border-color: var(--teal); }
#code-input {
  width: 110px;
  text-transform: uppercase;
  text-align: center;
  letter-spacing: 6px;
  font-weight: 700;
}
.join-row { display: flex; gap: 10px; }
.join-row .btn { flex: 1; }

/* ============================ buttons ============================ */

.btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--panel-border);
  color: #fff;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.06s ease, background 0.15s ease;
}
.btn:hover { background: rgba(255, 255, 255, 0.18); }
.btn:active { transform: scale(0.97); }
.btn-big { padding: 14px 20px; font-size: 17px; }
.btn-primary {
  background: linear-gradient(120deg, var(--pink), #b33bf0);
  border: none;
}
.btn-primary:hover { filter: brightness(1.15); background: linear-gradient(120deg, var(--pink), #b33bf0); }
.btn-primary:disabled { filter: grayscale(0.8); cursor: not-allowed; }
.btn-icon {
  position: absolute;
  bottom: 22px;
  right: 24px;
  font-size: 20px;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  padding: 0;
}
.btn-icon.off { opacity: 0.4; }

.error-text { color: #ff7b7b; font-size: 14px; min-height: 18px; }
/* home-menu error lines reserve no space while empty (min-height above
   is for in-panel layouts that must not jump; the menu should be tight) */
#menu-error:empty, #account-error:empty { display: none; }
.hint { color: #9aa0b8; font-size: 13px; }
.key-chip {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 5px;
  padding: 1px 7px;
  font-size: 12px;
  margin-left: 4px;
}

/* ============================ lobby ============================ */

#lobby-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  /* translucent scrim: the animated menu scene keeps looping behind it */
  background:
    radial-gradient(1200px 600px at 20% 0%, rgba(255, 79, 154, 0.12), transparent),
    radial-gradient(1000px 700px at 90% 100%, rgba(45, 212, 191, 0.1), transparent),
    rgba(10, 10, 18, 0.55);
}

.lobby-box {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 30px 34px;
  width: min(780px, 94vw);
  max-height: 92vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
}
.lobby-head h2 { font-size: 30px; display: flex; align-items: center; gap: 14px; }
.code-chip {
  background: linear-gradient(120deg, var(--teal), #4f9aff);
  color: #08222b;
  border-radius: 10px;
  padding: 3px 16px;
  letter-spacing: 8px;
  font-weight: 900;
}

.lobby-cols { display: flex; gap: 26px; flex-wrap: wrap; }
.lobby-players { flex: 1; min-width: 220px; }
.lobby-settings { flex: 1.2; min-width: 260px; display: flex; flex-direction: column; gap: 8px; }
.lobby-settings label { font-size: 13px; color: #9aa0b8; margin-top: 6px; }
.lobby-settings select {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--panel-border);
  color: #fff;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 15px;
}
.lobby-settings select:disabled { opacity: 0.55; }

/* shared master Volume widget (static/js/volumeControl.js): Tab menu +
   the Brawl Table panel */
.vol-ctl { display: flex; flex-direction: column; gap: 6px; }
.vol-head { display: flex; justify-content: space-between; align-items: baseline; }
.vol-label { font-size: 13px; color: #9aa0b8; }
.vol-val { font-size: 13px; font-weight: 700; color: var(--teal); min-width: 48px; text-align: right; }
.vol-ctl.muted .vol-val { color: #9aa0b8; }
.vol-row { display: flex; align-items: center; gap: 12px; }
.vol-slider { flex: 1; min-width: 0; accent-color: var(--teal); cursor: pointer; }
.vol-ctl.muted .vol-slider { opacity: 0.45; }
.vol-mute { display: flex; align-items: center; gap: 5px; font-size: 13px; color: #9aa0b8; cursor: pointer; margin: 0 !important; }
.vol-mute input { accent-color: var(--pink); cursor: pointer; }

.time-row { display: flex; gap: 12px; }
.time-row > div { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.time-row label { font-size: 13px; color: #9aa0b8; }
.time-row input[type="number"] {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--panel-border);
  color: #fff;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 15px;
  width: 100%;
}
.time-row input[type="number"]:disabled { opacity: 0.55; }

.item-toggles {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 4px;
}
.item-toggle {
  border: 2px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 9px;
  padding: 5px 0 3px;
  text-align: center;
  cursor: pointer;
  font-size: 19px;
  transition: opacity 0.15s ease, border-color 0.15s ease;
}
.item-toggle .it-role { display: block; font-size: 8px; color: #9aa0b8; letter-spacing: 0.5px; }
.item-toggle.off { opacity: 0.28; border-style: dashed; }
.item-toggle.locked { pointer-events: none; }

#player-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
#player-list li {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 9px;
  padding: 9px 13px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
}
.role-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 800;
  border-radius: 6px;
  padding: 2px 8px;
  letter-spacing: 1px;
}
.role-badge.hunter { background: #7a1f2d; color: #ffb3c0; }
.role-badge.hider { background: #14532d; color: #a7f3d0; }
.role-badge.spectator { background: #333; color: #bbb; }

.map-picker { display: flex; gap: 10px; flex-wrap: wrap; }
.map-tile {
  border: 2px solid var(--panel-border);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  width: 118px;
  transition: border-color 0.15s ease, transform 0.08s ease;
  background: rgba(255, 255, 255, 0.05);
}
.map-tile:hover { transform: translateY(-2px); }
.map-tile.selected { border-color: var(--teal); background: rgba(45, 212, 191, 0.12); }
.map-tile.disabled { pointer-events: none; opacity: 0.6; }
.map-swatch { height: 40px; border-radius: 7px; margin-bottom: 7px; }
.map-tile b { font-size: 14px; }
.map-tile p { font-size: 11px; color: #9aa0b8; margin-top: 2px; }

.lobby-actions { display: flex; justify-content: space-between; }

.toggle-row {
  display: flex !important;
  align-items: center;
  gap: 9px;
  margin-top: 12px !important;
  font-size: 14px !important;
  color: #e6e8f5 !important;
  cursor: pointer;
}
.toggle-row input { width: 18px; height: 18px; accent-color: var(--teal); cursor: pointer; }
.toggle-row input:disabled { opacity: 0.5; }

/* ---------- chat dock (bottom right, collapsible) ---------- */
#chat-dock {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 45;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;               /* children opt back in */
}
#chat-dock.hidden { display: none; }
@media (pointer: coarse) {
  /* the touch-button column is ALSO bottom-right anchored and grows to 4
     buttons in a round (~268px) — a bottom offset can never clear it, so
     the dock sits LEFT of the column instead (found by test_verbs_ui:
     the chat toggle swallowed tb-paint's taps) */
  #chat-dock { bottom: 12px; right: 104px; }
  /* GBA deck up: touch-ui is hidden while seated, so the corner is free —
     tuck the chat there, over the deck, clear of the game screen */
  body.gba-deck-up #chat-dock { bottom: 10px; right: 12px; }
}
/* seated at a GBA cabinet: the lounge walk controls (joystick/jump/emote)
   yield for the whole sit — the on-screen menu's tap layer, the SP deck,
   or the plaza's own pad owns touch input instead (gba.js enter/exit) */
body.gba-seated #touch-ui { display: none !important; }
#btn-chat-toggle {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--panel-border);
  background: rgba(14, 12, 24, 0.85);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
}
#btn-chat-toggle:hover { background: rgba(40, 34, 62, 0.9); }
#chat-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 19px;
  height: 19px;
  border-radius: 999px;
  background: #e2352f;
  color: #fff;
  font: 700 11px/19px "Segoe UI", sans-serif;
  padding: 0 3px;
}
#chat-badge.hidden { display: none; }
#chat-panel {
  width: min(320px, 84vw);
  background: rgba(12, 10, 22, 0.92);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
}
#chat-panel.hidden { display: none; }
#chat-pops {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  pointer-events: none;               /* popups never block clicks */
}
.chat-pop {
  background: rgba(12, 10, 22, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 10px;
  padding: 6px 10px;
  color: #e6ebff;
  font-size: 13px;
  max-width: min(300px, 78vw);
  overflow-wrap: break-word;
  transition: opacity 0.9s;
}
.chat-pop b { color: var(--teal); }
.chat-pop.fade { opacity: 0; }
.chat-pop.mention { border-color: #ffb14c; background: rgba(80, 50, 12, 0.68); }
.chat-line.mention {
  border: 1px solid rgba(255, 177, 76, 0.6);
  background: rgba(80, 50, 12, 0.45);
  border-radius: 6px;
  padding: 2px 6px;
}
.mention-tag { color: #ffb14c; font-weight: 700; }
/* server-update warning (deploy pre-restart countdown): unmissable —
   its own amber-red palette, outlined box, and a breathing glow. Works
   as both a chat-log line and a (non-fading) chat pop. */
.restart-alert {
  border: 2px solid #ff9f2d;
  outline: 1px solid rgba(255, 61, 61, 0.55);
  outline-offset: 2px;
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(96, 42, 6, 0.92), rgba(64, 16, 8, 0.92));
  color: #ffd9a0;
  font-weight: 700;
  font-size: 13px;
  padding: 7px 11px;
  margin: 4px 0;
  overflow-wrap: break-word;
  animation: restart-glow 1.1s ease-in-out infinite;
}
.restart-alert .ra-count { color: #ffffff; font-size: 15px; }
@keyframes restart-glow {
  0%, 100% { box-shadow: 0 0 6px rgba(255, 159, 45, 0.55); }
  50% { box-shadow: 0 0 16px rgba(255, 90, 45, 0.9); }
}
#chat-messages {
  height: 170px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 13px;
}
#chat-messages .chat-line b { color: var(--teal); }
#chat-messages .chat-line.system { color: #9aa0b8; font-style: italic; }
.chat-input-row { display: flex; gap: 8px; }
#chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--panel-border);
  color: #fff;
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 14px;
  outline: none;
}
#btn-chat-send { padding: 8px 14px; }

/* ============================ arcade lounge hud ============================ */

#lobby-hud { position: fixed; inset: 0; z-index: 6; pointer-events: none; }
#lobby-hud .btn { pointer-events: auto; }

#btn-options {
  position: absolute;
  top: 14px;
  left: 14px;
  background: var(--panel);
}
#lobby-code-mini {
  position: absolute;
  top: 18px;
  right: 16px;
  font-weight: 900;
  letter-spacing: 5px;
  color: var(--teal);
  text-shadow: 0 0 12px rgba(45, 212, 191, 0.6);
}
#arcade-hint {
  position: absolute;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 16px;
  font-weight: 700;
  color: #ffe012;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
  text-align: center;
}
/* walking controls hint (jump/sprint/emote); sits above the machine hint */
#lounge-hint {
  position: absolute;
  bottom: 136px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  color: rgba(223, 228, 238, 0.55);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
  white-space: nowrap;
  pointer-events: none;
}
/* seated at a machine: the walking hint gets out of the way */
#lobby-hud:has(#btn-arcade-exit:not(.hidden)) #lounge-hint { display: none; }
.arcade-play {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(120deg, var(--pink), #b33bf0);
  border: none;
  font-size: 17px;
  padding: 12px 26px;
}
#btn-arcade-exit {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--panel);
}
/* controller-active chip: sits under the Menu chip (gamepad.js toggles it) */
#pad-chip {
  position: fixed;
  top: 58px;
  left: 14px;
  z-index: 30;
  font-size: 15px;
  padding: 3px 9px;
  border-radius: 9px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  pointer-events: none;
}
#arcade-controls {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  pointer-events: auto;
}
.arcade-btn {
  min-width: 74px;
  height: 58px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(18, 18, 30, 0.75);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  cursor: pointer;
}
.arcade-btn:active { background: rgba(255, 224, 18, 0.5); }
.arcade-btn-big { min-width: 100px; height: 72px; font-size: 18px; }

#lobby-screen .lobby-box { position: relative; }

/* arena countdown: big neon number above the circle, whole-lounge overlay */
#match-countdown {
  position: fixed;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 46;
  pointer-events: none;
  font-size: 84px;
  font-weight: 900;
  color: #b7f4ff;
  text-shadow: 0 0 16px rgba(55, 224, 255, 0.95), 0 0 44px rgba(55, 224, 255, 0.5);
}
#match-countdown.hidden { display: none; }

/* cancel button riding under the countdown number (clickable, unlike the
   number itself — the overlay stays pointer-events:none) */
#match-cancel {
  position: fixed;
  top: calc(22% + 108px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 46;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
#match-cancel.hidden { display: none; }
#match-cancel .error-text { text-align: center; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9); }

/* ============================ game hud ============================ */

#world-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  touch-action: none;   /* no pull-to-refresh / pinch-zoom while playing */
}

#game-ui { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
#game-ui .btn, #game-ui .popup { pointer-events: auto; }

#hud-top {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 8px 22px;
}
#hud-phase { font-weight: 900; letter-spacing: 2px; font-size: 14px; color: var(--yellow); }
#hud-phase.hunting { color: #ff6b6b; }
#hud-timer { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
#hud-hiders { font-size: 13px; color: #9aa0b8; }
#hud-votes { font-size: 13px; color: var(--yellow); }

#hud-role {
  position: absolute;
  top: 16px;
  left: 16px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 8px 16px;
  font-weight: 800;
  letter-spacing: 1px;
}
#hud-role.hider { color: #6ee7b7; }
#hud-role.hunter { color: #ff8aa0; }
#hud-role.spectator { color: #aaa; }

#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 26px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.9);
}
#crosshair.in-range { color: #ff4f4f; font-weight: 700; }

#cooldown-bar {
  position: absolute;
  top: calc(50% + 26px);
  left: 50%;
  transform: translateX(-50%);
  width: 64px;
  height: 5px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 3px;
  overflow: hidden;
}
#cooldown-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--pink), var(--yellow));
  border-radius: 3px;
  transition: width 0.08s linear;
}

/* ============================ touch controls ============================ */

#touch-ui { position: fixed; inset: 0; pointer-events: none; z-index: 7; }

#joystick {
  position: absolute;
  bottom: 34px;
  left: 30px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.2);
  pointer-events: auto;
  touch-action: none;
}
#joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transform: translate(-50%, -50%);
}

#touch-buttons {
  position: absolute;
  bottom: 34px;
  right: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-end;
  pointer-events: auto;
}
.touch-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: rgba(18, 18, 30, 0.65);
  color: #fff;
  font-size: 24px;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.touch-btn.tb-big { width: 72px; height: 72px; font-size: 30px; }
.touch-btn:active { background: rgba(255, 255, 255, 0.3); }
.touch-btn.cooling { opacity: 0.35; }
.touch-btn.active { background: rgba(45, 212, 191, 0.45); border-color: var(--teal); }

/* ============================ emote wheel ============================ */

#emote-wheel {
  position: fixed;
  inset: 0;
  z-index: 44;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 50%,
    rgba(6, 5, 14, 0.25), rgba(6, 5, 14, 0.6));
  touch-action: none;
  cursor: default;
}
#emote-wheel.hidden { display: none; }
#emote-wheel .wheel { position: relative; width: 280px; height: 280px; }
#emote-wheel svg {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 8px 26px rgba(0, 0, 0, 0.6));
}
#emote-wheel path {
  fill: rgba(17, 16, 30, 0.88);
  stroke: rgba(255, 255, 255, 0.14);
  stroke-width: 1.5;
  transition: fill 0.08s;
}
#emote-wheel path.sel {
  fill: rgba(45, 212, 191, 0.32);
  stroke: var(--teal);
}
.emote-label {
  position: absolute;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  color: #cfd5e4;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
}
.emote-label .emote-emoji { display: block; font-size: 30px; line-height: 1.2; }
.emote-label.sel { color: #fff; }
#emote-wheel-name {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #9aa0b8;
}
#emote-wheel-name.sel { color: var(--teal); }

/* ============================ paint studio ============================ */

.paint-studio { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.studio-wrap { position: relative; }
#paint3d {
  border-radius: 12px;
  background: #1a1a2b;
  touch-action: none;
  cursor: crosshair;
  max-width: 100%;
}
.zoom-btns {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.zoom-btn {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(10, 10, 20, 0.7);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
}
.zoom-btn:active { background: rgba(255, 255, 255, 0.25); }

.popup-x {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  z-index: 2;
}
.popup-x:hover { background: rgba(255, 80, 80, 0.4); }
.paint-tools { display: flex; flex-direction: column; gap: 8px; min-width: 220px; }
.paint-tools > label { font-size: 12px; color: #9aa0b8; }

.brush-row { display: flex; gap: 8px; }
.brush-btn {
  width: 44px;
  height: 38px;
  border-radius: 9px;
  border: 2px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.brush-btn .dot { background: #fff; border-radius: 50%; display: block; }
.brush-btn.selected { border-color: var(--teal); background: rgba(45, 212, 191, 0.15); }

#hud-toast {
  position: absolute;
  top: 84px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
  opacity: 0;
  transition: opacity 0.4s ease;
  text-align: center;
}
#hud-toast.show { opacity: 1; }

#hud-hint {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
  text-align: center;
}

#hud-buttons {
  position: absolute;
  bottom: 18px;
  right: 18px;
  display: flex;
  gap: 10px;
}
.hud-btn { background: var(--panel); }

/* pulsing red vignette while a nearby fire alarm rattles a hider's screen */
#alarm-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  background: radial-gradient(ellipse at center,
    rgba(255, 20, 10, 0) 42%, rgba(255, 30, 16, 0.5) 100%);
  animation: alarm-flash 0.34s steps(2, jump-none) infinite;
}
@keyframes alarm-flash {
  0% { opacity: 0.25; }
  100% { opacity: 1; }
}

#blackout {
  position: absolute;
  inset: 0;
  background: #05050a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 6;
}
#blackout h2 { font-size: 34px; }
#blackout-timer { font-size: 90px; font-weight: 900; color: var(--yellow); font-variant-numeric: tabular-nums; }
.hunter-word { color: #ff6b6b; }

/* ============================ popups ============================ */

.popup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 320px;
  max-width: 92vw;
  max-height: 94vh;
  overflow-y: auto;
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 7;
}
.popup h3 { font-size: 21px; }
.popup h2 { font-size: 30px; }

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(6, 44px);
  gap: 9px;
}
.swatch {
  width: 44px;
  height: 44px;
  border-radius: 9px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: transform 0.08s ease;
}
.swatch:hover { transform: scale(1.12); }
.swatch.selected { border-color: #fff; box-shadow: 0 0 0 2px var(--teal); }

.custom-color-row { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #9aa0b8; }
input[type="color"] {
  width: 54px;
  height: 34px;
  border: none;
  border-radius: 7px;
  background: none;
  cursor: pointer;
}

.pose-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}
.pose-tile {
  border: 2px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 11px;
  padding: 12px 6px;
  text-align: center;
  cursor: pointer;
  color: #fff;
  transition: transform 0.08s ease, border-color 0.15s ease;
}
.pose-tile:hover { transform: translateY(-2px); }
.pose-tile.selected { border-color: var(--pink); background: rgba(255, 79, 154, 0.13); }
.pose-tile .pose-emoji { font-size: 26px; display: block; margin-bottom: 5px; }
.pose-tile .pose-name { font-size: 12px; font-weight: 600; }

#gameover-popup { text-align: center; }
#gameover-title.hiders { color: #6ee7b7; }
#gameover-title.hunters { color: #ff8aa0; }
#gameover-title.none { color: #cbd5e1; }
#gameover-winners { font-weight: 800; color: var(--yellow); }
#gameover-scores {
  list-style: none;
  margin: 0 auto;
  font-size: 14px;
  min-width: 220px;
}
#gameover-scores li {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 2px 0;
}
#gameover-scores .score-note { color: #9aa0b8; }
#gameover-scores li.winner .score-note { color: #6ee7b7; }

/* ============================ power-ups ============================ */

#powerup-toast {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(120deg, rgba(255, 194, 26, 0.95), rgba(255, 122, 26, 0.95));
  color: #3a2500;
  border-radius: 16px;
  padding: 14px 24px;
  box-shadow: 0 10px 50px rgba(255, 180, 0, 0.45);
  animation: powerpop 0.35s ease;
  z-index: 6;
}
#powerup-emoji { font-size: 40px; }
#powerup-toast b { font-size: 19px; letter-spacing: 0.5px; }
#powerup-toast p { font-size: 13px; margin-top: 2px; }
@keyframes powerpop {
  0% { transform: translate(-50%, -50%) scale(0.4); opacity: 0; }
  70% { transform: translate(-50%, -50%) scale(1.12); }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

#shield-badge {
  position: absolute;
  top: 64px;
  left: 16px;
  background: rgba(255, 107, 176, 0.2);
  border: 1px solid rgba(255, 107, 176, 0.6);
  color: #ffb3d5;
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
}

/* item roulette (mario-kart style) */
#roulette {
  position: absolute;
  top: 24%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 92px;
  height: 92px;
  border-radius: 20px;
  background: linear-gradient(140deg, #2a2a44, #14142a);
  border: 3px solid var(--yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 40px rgba(250, 204, 21, 0.45);
  z-index: 6;
}
#roulette-emoji { font-size: 52px; }
#roulette.settled { animation: powerpop 0.3s ease; border-color: #fff; }

/* inventory slots */
#inventory {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  pointer-events: auto;
}
.inv-slot {
  width: 58px;
  height: 58px;
  border-radius: 13px;
  border: 2px solid var(--panel-border);
  background: var(--panel);
  position: relative;
  cursor: pointer;
  color: #fff;
}
.inv-slot .inv-emoji { font-size: 28px; line-height: 54px; }
.inv-slot .inv-key {
  position: absolute;
  top: 2px;
  left: 6px;
  font-size: 10px;
  color: #9aa0b8;
  font-weight: 700;
}
.inv-slot.filled { border-color: var(--yellow); background: rgba(250, 204, 21, 0.12); }
.inv-slot.filled:hover { transform: translateY(-2px); }
.inv-slot:not(.filled) { opacity: 0.4; cursor: default; }

/* active effect countdown rings */
#active-effects {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
}
.fx-ring {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.fx-ring::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: rgba(10, 10, 20, 0.8);
}
.fx-ring span { position: relative; z-index: 1; font-size: 22px; }

/* compact HUD on phone-sized screens */
@media (max-width: 980px) {
  #hud-role { font-size: 11px; padding: 5px 9px; top: 10px; left: 10px; }
  #hud-top { padding: 4px 12px; gap: 10px; top: 8px; }
  #hud-phase { font-size: 11px; }
  #hud-timer { font-size: 19px; }
  #hud-hiders { font-size: 11px; }
  #hud-hint { font-size: 10px; bottom: 5px; }
  #hud-buttons { bottom: auto; top: 52px; right: 12px; }
  .hud-btn { padding: 7px 12px; font-size: 13px; }

  #inventory { bottom: 30px; gap: 8px; }
  .inv-slot { width: 46px; height: 46px; }
  .inv-slot .inv-emoji { font-size: 22px; line-height: 42px; }
  #active-effects { top: 56px; }
  .fx-ring { width: 38px; height: 38px; }
  .fx-ring span { font-size: 18px; }

  /* paint studio has to fit a landscape phone */
  .popup { padding: 12px 16px; gap: 8px; }
  .popup h3 { font-size: 16px; }
  .popup > .hint { display: none; }
  #paint3d { height: 52vh; width: auto; }
  .paint-tools { min-width: 170px; gap: 6px; }
  .swatch-grid { grid-template-columns: repeat(6, 32px); gap: 6px; }
  .swatch { width: 32px; height: 32px; }
  #chat-messages { height: 80px; }
}

/* ---------- account box (GBA saves) ---------- */
.account-box { padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.12); }
.account-box .join-row { margin-bottom: 8px; }
.account-box input { flex: 1; min-width: 0; }
.account-badge { color: #7dff9e; font-weight: 600; margin-right: 10px; }
#account-logged { display: flex; align-items: center; justify-content: center; gap: 8px; }

/* ---------- menu: public lobby count chip ---------- */
.count-chip { font-size: 13px; opacity: 0.85; font-weight: 600; margin-left: 6px; }
#account-buttons .btn { flex: 1; }

/* ---------- home-screen changelog (menu status card + recent-changes overlay) ----------
   The newest entry renders as a full-width bounding box: a tinted title
   bar inside the top of the box (UPCOMING = wip yellow, NEW FEATURE =
   active green — the same colors the dot always used) above the entry
   text, with the "recent changes" link centered UNDER the card. */
.changelog-card {
  width: 100%;
  border: 1px solid;
  border-radius: 10px;
  overflow: hidden;          /* the title bar sits flush to the box top */
  text-align: left;
}
.changelog-card.active {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.07);
}
.changelog-card.wip {
  border-color: rgba(250, 204, 21, 0.45);
  background: rgba(250, 204, 21, 0.06);
}
.changelog-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.changelog-card.active .changelog-titlebar {
  background: rgba(34, 197, 94, 0.16);
  border-bottom: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
}
.changelog-card.wip .changelog-titlebar {
  background: rgba(250, 204, 21, 0.14);
  border-bottom: 1px solid rgba(250, 204, 21, 0.3);
  color: #fde047;
}
.changelog-card #changelog-text {
  display: block;
  padding: 9px 11px 10px;
  font-size: 12.5px;
  line-height: 1.45;
  color: #e6e8f5;
}
.changelog-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.changelog-dot.active { background: #22c55e; box-shadow: 0 0 7px rgba(34, 197, 94, 0.65); }
.changelog-dot.wip {
  background: #facc15;
  box-shadow: 0 0 7px rgba(250, 204, 21, 0.65);
  animation: changelog-pulse 1.4s ease-in-out infinite;
}
@keyframes changelog-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
#changelog-link {
  display: block;
  margin-top: 7px;
  text-align: center;
  font-size: 12px;
  color: #8fa3ff;
  text-decoration: underline;
  text-underline-offset: 2px;
}
#changelog-link:hover { color: #b3c2ff; }

#changelog-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  /* dark scrim over the animated menu scene */
  background: rgba(6, 6, 14, 0.7);
  z-index: 40;
}
.changelog-box {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 26px 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(420px, 92vw);
  max-height: min(560px, 86vh);
  backdrop-filter: blur(8px);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
}
.changelog-box h3 { font-size: 21px; }
#changelog-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
#changelog-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
#changelog-list li:last-child { border-bottom: none; }
#changelog-list .changelog-dot { margin-top: 5px; }
.changelog-entry p { font-size: 14px; color: #f1f1f4; }
.changelog-meta { font-size: 11px; color: #9aa0b8; }
