/* ========================================================================== */
/* Tokens                                                                      */
/* ========================================================================== */

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

:root {
  --bg: #0b0b0d;
  --bg-2: #131316;
  --bg-3: #1c1c20;
  --ink: #efe6d4;
  --ink-soft: #b8b1a3;
  --ink-dim: #6d6859;
  --line: #1f1f23;
  --line-strong: #2c2c30;
  --accent: #d4a93a;        /* antique gold */
  --accent-hot: #f0c050;    /* hover — brighter gold */
  --tape: #b08c4a;          /* tan masking-tape, distinct from accent */
  --hud-bg: rgba(11, 11, 13, 0.85);
  --shadow-stamp: 5px 5px 0 #000;
  --display: 'Anton', 'Impact', sans-serif;
  --tag: 'Special Elite', ui-monospace, monospace;
  --body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Fixed grain layer behind everything. SVG-noise data URI keeps it small
   and crisp at any zoom. Subtle but it's what kills the "flat dark gradient"
   AI-template feeling. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='280' height='280'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='matrix' values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.18 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
}

canvas { display: block; }

/* ========================================================================== */
/* Auth screen                                                                 */
/* ========================================================================== */

#auth-screen {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
#auth-screen.hidden { display: none; }
.auth-card {
  background: var(--ink);
  color: var(--bg);
  border: 2.5px solid #000;
  padding: 32px 36px;
  width: min(400px, 88vw);
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 6px 6px 0 #000;
  transform: rotate(-0.8deg);
}
.auth-mark {
  display: inline-block;
  align-self: flex-start;
  padding: 4px 10px;
  background: var(--accent);
  color: var(--ink);
  border: 2px solid #000;
  font-family: var(--tag);
  font-size: 12px;
  letter-spacing: 0.32em;
  font-weight: 700;
  margin-bottom: 6px;
  transform: rotate(-2deg);
  box-shadow: 3px 3px 0 #000;
}
.auth-card h2 {
  font-family: var(--display);
  font-size: 44px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--bg);
}
.auth-tag {
  font-size: 14px;
  font-weight: 500;
  color: var(--bg);
  margin-bottom: 6px;
  line-height: 1.4;
}
#auth-google,
#auth-guest {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 16px;
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 2px solid #000;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
}
#auth-google {
  background: #fff;
  color: #1a1a1a;
  box-shadow: 3px 3px 0 #000;
}
#auth-google:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 #000;
}
#auth-guest {
  background: transparent;
  color: var(--bg);
}
#auth-guest:hover { background: rgba(0, 0, 0, 0.05); }
.auth-hint {
  font-family: var(--tag);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-top: 4px;
}

#username-screen {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
#username-screen.hidden { display: none; }
#username-input {
  background: #fff;
  border: 2px solid #000;
  color: var(--bg);
  padding: 12px 14px;
  font-family: var(--display);
  font-size: 24px;
  letter-spacing: 0.04em;
  outline: none;
  text-transform: lowercase;
}
#username-input:focus { border-color: var(--accent); }
.username-status {
  font-family: var(--tag);
  font-size: 12px;
  letter-spacing: 0.06em;
  min-height: 1em;
  margin-top: -4px;
}
.username-status.ok { color: #2e8b3a; }
.username-status.bad { color: var(--accent); }
#username-claim {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 2px solid #000;
  background: var(--accent);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
  box-shadow: 3px 3px 0 #000;
}
#username-claim:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 #000;
}
#username-claim:disabled {
  background: var(--bg-3);
  color: var(--ink-dim);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* ========================================================================== */
/* Lobby                                                                       */
/* ========================================================================== */

#lobby {
  position: fixed;
  inset: 0;
  z-index: 10;
  background:
    radial-gradient(900px 700px at 80% -20%, rgba(212, 169, 58, 0.07), transparent 60%),
    radial-gradient(700px 500px at 5% 110%, rgba(176, 140, 74, 0.04), transparent 60%),
    var(--bg);
}
#lobby.hidden { display: none; }

/* Top-left profile pill — sticker style: rotated, hard shadow, marker font. */
.lobby-profile {
  position: absolute;
  top: 28px;
  left: 28px;
  z-index: 5;
}
.profile-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 10px;
  background: var(--ink);
  color: var(--bg);
  border: 2px solid #000;
  font-family: var(--tag);
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transform: rotate(-1.6deg);
  box-shadow: 4px 4px 0 #000;
  transition: transform 0.1s, box-shadow 0.1s;
}
.profile-pill:hover {
  transform: rotate(-1.6deg) translate(-1px, -1px);
  box-shadow: 5px 5px 0 #000;
}
.profile-pill.open {
  transform: rotate(-1.6deg) translate(2px, 2px);
  box-shadow: 2px 2px 0 #000;
  background: var(--accent);
  color: var(--ink);
}
.profile-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 1.5px solid #000;
  flex-shrink: 0;
}
.profile-caret { font-size: 10px; opacity: 0.65; }
.profile-pill.open .profile-caret { transform: rotate(180deg); }

.profile-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 4px;
  width: 320px;
  background: var(--ink);
  color: var(--bg);
  border: 2px solid #000;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 5px 5px 0 #000;
  transform: rotate(-0.6deg);
}
.profile-panel.hidden { display: none; }
.profile-panel h3 {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  line-height: 1;
}
.profile-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.profile-field label {
  font-family: var(--tag);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.profile-field input {
  background: #fff;
  border: 1.5px solid #000;
  color: var(--bg);
  padding: 9px 12px;
  font: inherit;
  font-family: var(--body);
  font-size: 14px;
  font-weight: 600;
  outline: none;
}
.profile-field input:focus { border-color: var(--accent); }
.profile-chars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
}
.profile-char {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: transparent;
  border: 1.5px solid #000;
  color: var(--bg);
  font-family: var(--tag);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.1s;
}
.profile-char:hover { background: rgba(0, 0, 0, 0.05); }
.profile-char.active {
  background: var(--accent);
  color: var(--ink);
  border-color: #000;
}
.profile-char-swatch {
  width: 18px;
  height: 18px;
  border: 1.5px solid #000;
  flex-shrink: 0;
}
.profile-char-white { background: #d8d2c4; }
.profile-char-black { background: #1d1d1f; }
.profile-char-swag { background: linear-gradient(135deg, #d4a93a 0%, #6c2bd9 100%); }
.profile-colors {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}
.profile-color {
  aspect-ratio: 1;
  border: 1.5px solid #000;
  cursor: pointer;
  border-radius: 50%;
  transition: transform 0.08s;
}
.profile-color:hover { transform: scale(1.12); }
.profile-color.active {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.profile-save {
  padding: 12px;
  background: var(--accent);
  color: var(--ink);
  border: 2px solid #000;
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
  box-shadow: 3px 3px 0 #000;
}
.profile-save:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 #000;
}

/* --- friends widget (top-right) ------------------------------------------ */
.lobby-friends {
  position: absolute;
  top: 28px;
  right: 28px;
  z-index: 5;
}
.lobby-friends.hidden { display: none; }
.friends-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--ink);
  color: var(--bg);
  border: 2px solid #000;
  font-family: var(--tag);
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transform: rotate(1.4deg);
  box-shadow: 4px 4px 0 #000;
  transition: transform 0.1s, box-shadow 0.1s;
  position: relative;
}
.friends-pill:hover {
  transform: rotate(1.4deg) translate(-1px, -1px);
  box-shadow: 5px 5px 0 #000;
}
.friends-pill.open {
  transform: rotate(1.4deg) translate(2px, 2px);
  box-shadow: 2px 2px 0 #000;
  background: var(--accent);
  color: var(--ink);
}
.friends-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--ink);
  font-family: var(--tag);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  border: 1.5px solid #000;
}
.friends-badge.hidden { display: none; }
.friends-pill.open .friends-badge {
  background: var(--ink);
  color: var(--bg);
}

.friends-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 4px;
  width: 340px;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--ink);
  color: var(--bg);
  border: 2px solid #000;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 5px 5px 0 #000;
  transform: rotate(0.6deg);
}
.friends-panel.hidden { display: none; }
.friends-panel h3 {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  line-height: 1;
}

.friends-add {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}
#friends-add-input {
  background: #fff;
  border: 1.5px solid #000;
  color: var(--bg);
  padding: 8px 10px;
  font: inherit;
  font-family: var(--body);
  font-size: 13px;
  font-weight: 600;
  outline: none;
  text-transform: lowercase;
}
#friends-add-input:focus { border-color: var(--accent); }
#friends-add-btn {
  padding: 8px 14px;
  background: var(--accent);
  color: var(--ink);
  border: 1.5px solid #000;
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.1s;
}
#friends-add-btn:hover { background: var(--accent-hot); }
#friends-add-btn:disabled {
  background: var(--bg-3);
  color: var(--ink-dim);
  cursor: not-allowed;
}
.friends-status {
  font-family: var(--tag);
  font-size: 11px;
  letter-spacing: 0.06em;
  min-height: 1em;
}
.friends-status.ok { color: #2e8b3a; }
.friends-status.bad { color: var(--accent); }

.friends-section { display: flex; flex-direction: column; gap: 6px; }
.friends-section-h {
  font-family: var(--tag);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.friends-count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 16px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
}
.friends-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.friend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border: 1.5px solid var(--bg-3);
  background: rgba(0, 0, 0, 0.04);
}
.friend-name {
  font-family: var(--body);
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.friend-actions { display: flex; gap: 4px; }
.friend-action {
  padding: 4px 9px;
  font-family: var(--tag);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  border: 1px solid #000;
  background: transparent;
  color: var(--bg);
  cursor: pointer;
  transition: background 0.1s;
}
.friend-action.accept { background: var(--accent); color: var(--ink); }
.friend-action.accept:hover { background: var(--accent-hot); }
.friend-action.danger:hover { background: rgba(230, 57, 70, 0.15); color: var(--accent); }
.friends-empty {
  font-family: var(--tag);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
  padding: 4px 0;
}

@media (max-width: 960px) {
  .lobby-friends { top: 16px; right: 16px; }
}

/* --- mute button (bottom-right of lobby) --------------------------------- */
.music-toggle {
  position: absolute;
  bottom: 24px;
  right: 24px;
  z-index: 5;
  width: 42px;
  height: 42px;
  background: var(--ink);
  color: var(--bg);
  border: 2px solid #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 3px 3px 0 #000;
  transform: rotate(-2.5deg);
  transition: transform 0.1s, box-shadow 0.1s, background 0.1s;
}
.music-toggle:hover {
  transform: rotate(-2.5deg) translate(-1px, -1px);
  box-shadow: 4px 4px 0 #000;
}
.music-toggle:active {
  transform: rotate(-2.5deg) translate(2px, 2px);
  box-shadow: 1px 1px 0 #000;
}
.music-toggle.muted {
  background: var(--accent);
  color: var(--ink);
}
.music-toggle .icon-off { display: none; }
.music-toggle.muted .icon-on { display: none; }
.music-toggle.muted .icon-off { display: block; }

/* --- main lobby grid ------------------------------------------------------ */
.lobby-grid {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(380px, 0.95fr) minmax(440px, 1.05fr);
  max-width: 1280px;
  margin: 0 auto;
  padding: 90px 64px 56px;
  gap: 56px;
  position: relative;
  z-index: 1;
}
.lobby-stage {
  position: relative;
  overflow: hidden;
}
#char-preview {
  width: 100%;
  height: 100%;
  display: block;
}
.lobby-username-tag {
  position: absolute;
  bottom: 18px;
  left: 0;
  font-family: var(--tag);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: var(--bg);
  padding: 4px 10px;
  border: 1.5px solid var(--accent);
  transform: rotate(-1deg);
}
.lobby-username-tag::before {
  content: '@ ';
  color: var(--accent);
  font-weight: 700;
}

.lobby-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 32px;
  position: relative;
}

/* Decorative paint splatter behind the title — single asymmetric blob,
   not a full background gradient. Reads as a tag, not as decor noise. */
.lobby-info::before {
  content: '';
  position: absolute;
  top: -40px;
  left: -30px;
  width: 220px;
  height: 220px;
  background: radial-gradient(closest-side, rgba(212, 169, 58, 0.20) 0%, transparent 70%);
  filter: blur(14px);
  pointer-events: none;
  z-index: -1;
}

.brand { display: flex; flex-direction: column; gap: 14px; position: relative; }
.brand-mark {
  display: inline-block;
  align-self: flex-start;
  padding: 4px 10px;
  background: var(--accent);
  color: var(--ink);
  border: 2px solid #000;
  font-family: var(--tag);
  font-size: 12px;
  letter-spacing: 0.32em;
  font-weight: 700;
  transform: rotate(-2deg);
  box-shadow: 3px 3px 0 #000;
}
.brand h1 {
  font-family: var(--display);
  font-size: clamp(64px, 9.5vw, 132px);
  line-height: 0.84;
  letter-spacing: -0.005em;
  text-transform: uppercase;
  color: var(--ink);
  font-weight: 400; /* Anton ships at 400 — already heavy */
  /* Hard chiseled shadow gives it a stenciled poster feel without
     looking neon. */
  text-shadow: 4px 4px 0 #000;
}
.brand h1 em {
  color: var(--accent);
  font-style: normal;
  display: inline-block;
  transform: skew(-5deg);
}

/* Online row — mono tag font + a big Anton number. */
.online-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-family: var(--tag);
}
.online-row .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  align-self: center;
}
.online-num {
  font-family: var(--display);
  font-size: 36px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  line-height: 1;
}
.online-label {
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.section-h {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 16px;
  position: relative;
}
.section-h::after {
  /* short red underline like a hand stroke */
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  background: var(--accent);
  margin-top: 4px;
}

/* Map cards — taped-up posters. Each rotates a different direction so
   they read as paste-up rather than a uniform grid. */
.map-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}
.map-card {
  background: var(--bg-2);
  border: 2px solid #000;
  padding: 0;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  position: relative;
  transition: transform 0.12s, box-shadow 0.12s;
  box-shadow: 4px 4px 0 #000;
  transform: rotate(-1.4deg);
}
.map-card:nth-child(2) { transform: rotate(1.2deg); }
.map-card:nth-child(3) { transform: rotate(-0.6deg); }
.map-card:hover {
  transform: rotate(0deg) translate(-1px, -2px);
  box-shadow: 6px 6px 0 #000;
}
.map-card.selected {
  background: var(--ink);
  color: var(--bg);
}
/* Tape strip at the top of every card */
.map-card::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 14px;
  width: 56px;
  height: 18px;
  background: rgba(214, 178, 96, 0.82);
  border: 1px dashed rgba(0, 0, 0, 0.18);
  transform: rotate(-4deg);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.map-card:nth-child(2)::before {
  left: auto;
  right: 14px;
  transform: rotate(5deg);
}
.map-card:nth-child(3)::before { left: 30%; transform: rotate(-2deg); }

.map-art {
  height: 110px;
  width: 100%;
  display: block;
  position: relative;
  overflow: hidden;
  background: var(--bg);
  border-bottom: 2px solid #000;
}
.alley-art::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(78deg, #1c1417 0%, transparent 36%),
    linear-gradient(-78deg, #1c1417 0%, transparent 36%),
    linear-gradient(180deg, #2a1a1a 0%, #0a0608 100%);
}
.alley-art::after {
  content: '';
  position: absolute;
  bottom: 22%;
  left: 38%;
  width: 24%;
  height: 22%;
  background: var(--accent);
  filter: blur(3px);
  opacity: 0.7;
}
.rooftop-art::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, #1a1424 0%, #050714 100%);
}
.rooftop-art::after {
  /* skyline silhouette + neon stripe */
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 26%;
  height: 36%;
  background:
    linear-gradient(90deg,
      #050610 0%, #050610 10%, #0e0e16 10%, #0e0e16 22%,
      #050610 22%, #050610 36%, #0e0e16 36%, #0e0e16 52%,
      #050610 52%, #050610 64%, #0e0e16 64%, #0e0e16 78%,
      #050610 78%, #050610 90%, #0e0e16 90%);
}
.custom-art::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    #1a1a1c 0 8px,
    #0c0c0e 8px 16px
  );
}
.custom-art::after {
  content: '?';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-size: 56px;
  color: var(--accent);
  text-shadow: 3px 3px 0 #000;
}

.map-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-top: 0;
}
.map-name {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
}
.map-pop {
  font-family: var(--tag);
  font-size: 12px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.map-card.selected .map-pop { color: var(--ink-dim); }
.map-pop::after {
  content: ' here';
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Drop in button — heavy stamped CTA. */
#play {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 16px;
  padding: 16px 30px;
  font-family: var(--display);
  font-size: 26px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: var(--accent);
  color: var(--ink);
  border: 2.5px solid #000;
  cursor: pointer;
  transform: rotate(-1deg);
  box-shadow: var(--shadow-stamp);
  transition: transform 0.08s, box-shadow 0.08s, gap 0.15s, outline-offset 0.12s;
}
/* When a map card is currently selected, halo the Drop in button with a
   white outline so the "ready to go" state reads at a glance. Uses :has()
   so the outline tracks the selection state without any JS hooks. */
.lobby-info:has(.map-card.selected) #play {
  outline: 2px solid #fff;
  outline-offset: 4px;
}
#play:hover {
  transform: rotate(-1deg) translate(-2px, -2px);
  box-shadow: 7px 7px 0 #000;
  gap: 22px;
}
#play:active {
  transform: rotate(-1deg) translate(2px, 2px);
  box-shadow: 3px 3px 0 #000;
}
.play-arrow { font-size: 22px; line-height: 1; }

@media (max-width: 960px) {
  .lobby-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 280px 1fr;
    padding: 68px 24px 24px;
    gap: 24px;
  }
  .map-grid { grid-template-columns: 1fr 1fr; }
  .lobby-profile { top: 16px; left: 16px; }
}

/* ========================================================================== */
/* In-game UI                                                                  */
/* ========================================================================== */

/* --- left palette rail ---------------------------------------------------- */
#tool-rail {
  position: fixed;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
}
#palette {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--ink);
  border: 2px solid #000;
  padding: 10px 8px;
  box-shadow: 4px 4px 0 #000;
  transform: rotate(-1.5deg);
}
.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid #000;
  cursor: pointer;
  position: relative;
  transition: transform 0.08s;
}
.swatch:hover { transform: scale(1.1); }
.swatch.active {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* --- bottom tool dock ----------------------------------------------------- */
#hud {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) rotate(-0.4deg);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--ink);
  border: 2px solid #000;
  padding: 4px;
  box-shadow: 4px 4px 0 #000;
}
#toolbar { display: flex; gap: 0; }
.tool {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  background: transparent;
  border: 0;
  color: var(--bg);
  font-family: var(--display);
  font-size: 16px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.tool svg { width: 22px; height: 22px; display: block; }
.tool:hover { background: rgba(0, 0, 0, 0.05); }
.tool.active {
  background: var(--accent);
  color: var(--ink);
}
.tool.active svg { color: var(--ink); }

#username {
  padding: 0 12px 0 14px;
  font-family: var(--tag);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
  border-left: 1.5px solid var(--bg);
  align-self: stretch;
  display: flex;
  align-items: center;
}

/* --- brush panel (right) -------------------------------------------------- */
#brush-panel {
  position: fixed;
  right: 18px;
  top: 50%;
  transform: translateY(-50%) rotate(1deg);
  z-index: 5;
  background: var(--ink);
  border: 2px solid #000;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 240px;
  box-shadow: 4px 4px 0 #000;
}
.brush-row {
  display: grid;
  grid-template-columns: 64px 1fr 44px;
  gap: 10px;
  align-items: center;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.brush-label {
  font-family: var(--display);
  color: var(--bg);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.08em;
}
.brush-value {
  text-align: right;
  font-family: var(--tag);
  font-size: 12px;
  color: var(--bg);
  font-variant-numeric: tabular-nums;
}
#brush-panel input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  background: var(--bg);
  outline: none;
  cursor: pointer;
}
#brush-panel input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 1.5px solid #000;
}
#brush-panel input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 1.5px solid #000;
}

/* --- crosshair ------------------------------------------------------------ */
#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
  color: var(--accent);
  pointer-events: none;
  z-index: 1;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.9);
  display: none;
  font-family: var(--tag);
  font-weight: 700;
}
body.pointer-locked #crosshair { display: block; }

/* ========================================================================== */
/* Hamburger / menu button                                                     */
/* ========================================================================== */

#menu-button {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 6;
  width: 44px;
  height: 44px;
  background: var(--ink);
  border: 2px solid #000;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
  box-shadow: 3px 3px 0 #000;
  transform: rotate(-3deg);
  transition: transform 0.08s, box-shadow 0.08s;
}
#menu-button.hidden { display: none; }
#menu-button:hover {
  transform: rotate(-3deg) translate(-1px, -1px);
  box-shadow: 4px 4px 0 #000;
}
#menu-button:active {
  transform: rotate(-3deg) translate(2px, 2px);
  box-shadow: 1px 1px 0 #000;
}
#menu-button span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--bg);
}
#menu-button:hover span { background: var(--accent); }

/* ========================================================================== */
/* Leaderboard                                                                 */
/* ========================================================================== */

#leaderboard {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 5;
  background: var(--ink);
  color: var(--bg);
  border: 2px solid #000;
  padding: 12px 16px;
  min-width: 220px;
  max-height: 60vh;
  overflow-y: auto;
  box-shadow: 4px 4px 0 #000;
  transform: rotate(1.2deg);
}
#leaderboard.hidden { display: none; }
.leaderboard-header {
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--bg);
  line-height: 1;
}
.leaderboard-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--tag);
  font-size: 14px;
}
.leaderboard-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid #000;
}
.leaderboard-name {
  color: var(--bg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.leaderboard-row.self .leaderboard-name {
  font-weight: 700;
}
.leaderboard-row.self .leaderboard-name::after {
  content: ' · YOU';
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.1em;
  font-size: 11px;
}

/* ========================================================================== */
/* Pause menu                                                                  */
/* ========================================================================== */

#pause-menu {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.78);
}
#pause-menu.hidden { display: none; }
.pause-card {
  background: var(--ink);
  color: var(--bg);
  border: 2.5px solid #000;
  padding: 28px 32px;
  width: min(340px, 88vw);
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 6px 6px 0 #000;
  transform: rotate(-0.8deg);
}
.pause-card h2 {
  font-family: var(--display);
  font-size: 32px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 14px;
  color: var(--accent);
  line-height: 1;
}
.pause-card button {
  padding: 12px 14px;
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 2px solid #000;
  background: transparent;
  color: var(--bg);
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
}
.pause-card button:hover { background: rgba(0, 0, 0, 0.06); }
.pause-card #resume {
  background: var(--accent);
  color: var(--ink);
  box-shadow: 3px 3px 0 #000;
}
.pause-card #resume:hover { background: var(--accent-hot); }
.pause-hint {
  margin-top: 10px;
  font-family: var(--tag);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

/* ========================================================================== */
/* Chat                                                                        */
/* ========================================================================== */

#chat {
  position: fixed;
  bottom: 88px;
  left: 18px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(380px, 60vw);
  pointer-events: none;
}
#chat-log {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chat-msg {
  background: var(--ink);
  color: var(--bg);
  border: 1.5px solid #000;
  padding: 6px 10px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  word-break: break-word;
  box-shadow: 2px 2px 0 #000;
  animation: chat-in 0.2s ease-out;
  align-self: flex-start;
}
.chat-msg-out { animation: chat-out 0.4s ease-in forwards; }
.chat-author {
  font-family: var(--tag);
  font-weight: 700;
  margin-right: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.chat-text { color: var(--bg); }
@keyframes chat-in {
  from { opacity: 0; transform: translateX(-8px) rotate(-1deg); }
  to { opacity: 1; transform: translateX(0) rotate(-0.5deg); }
}
@keyframes chat-out { to { opacity: 0; } }
#chat-input {
  pointer-events: auto;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--bg);
  border: 2px solid var(--accent);
  font-family: var(--body);
  font-weight: 600;
  font-size: 14px;
  outline: none;
  width: 100%;
  box-shadow: 3px 3px 0 #000;
}
#chat-input::placeholder {
  color: var(--ink-dim);
  font-style: italic;
}
#chat-input.hidden { display: none; }

/* ========================================================================== */
/* Hover tooltip on tags                                                       */
/* ========================================================================== */

#hover-tooltip {
  position: fixed;
  pointer-events: none;
  z-index: 6;
  background: var(--ink);
  color: var(--bg);
  border: 1.5px solid #000;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.35;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transform: translate(14px, 14px) rotate(-1deg);
  white-space: nowrap;
  box-shadow: 2px 2px 0 #000;
}
#hover-tooltip.hidden { display: none; }
.hover-name {
  font-family: var(--tag);
  font-weight: 700;
  letter-spacing: 0.04em;
}
.hover-time {
  font-family: var(--tag);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
