/*
 * Arcade cabinet styling. Pixel type carries the game identity on titles and
 * calls to action; a modern UI face handles small, changing information so the
 * HUD stays readable. Bevels remain hard-edged and cheap to render.
 */

@font-face {
  font-family: 'ArcadeFont';
  src: url('font/pressstart.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

:root {
  --void: #08070f;
  --panel: #16113a;
  --panel-2: #241c58;
  --panel-3: #2f2570;
  --line: #5a49c8;
  --line-dim: #372a83;
  --text: #f4f0ff;
  --dim: #9c8fdd;
  --yellow: #ffcf3d;
  --red: #ff3b5c;
  --green: #3ff08a;
  --blue: #45b6ff;
  --magenta: #ff5fd2;
  --arcade: 'ArcadeFont', 'Courier New', monospace;
  --ui: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--void);
  color: var(--text);
  font-family: var(--arcade);
  /*
   * Press Start 2P has a small x-height for its point size, so what reads as
   * 11px in a normal face is uncomfortably tiny here. Everything is scaled up
   * from this base.
   */
  font-size: 14px;
  line-height: 1.7;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-font-smoothing: none;
  text-rendering: geometricPrecision;
}

/* Scanlines and a CRT vignette over everything. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0) 0px,
      rgba(0, 0, 0, 0) 2px,
      rgba(0, 0, 0, .08) 3px,
      rgba(0, 0, 0, .08) 4px
    ),
    radial-gradient(ellipse at 50% 50%, rgba(0,0,0,0) 58%, rgba(0,0,0,.36) 100%);
}

/* Hard 8-bit bevel: light top-left, dark bottom-right, no blur. */
.bevel {
  box-shadow:
    inset 2px 2px 0 rgba(255, 255, 255, .18),
    inset -2px -2px 0 rgba(0, 0, 0, .45);
}
.bevel-in {
  box-shadow:
    inset 2px 2px 0 rgba(0, 0, 0, .5),
    inset -2px -2px 0 rgba(255, 255, 255, .1);
}

#app {
  display: grid;
  /* minmax(0,...) so the track can shrink below the HUD's min-content width */
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-rows: 66px 1fr;
  grid-template-areas: "hud hud" "stage sidebar";
  height: 100%;
  max-width: 100vw;
}

/* ------------------------------------------------------------------- hud */

#hud {
  grid-area: hud;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  background: var(--panel);
  border-bottom: 3px solid var(--line-dim);
  overflow: hidden;
  min-width: 0;
}

.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.brand {
  font-size: 19px;
  color: var(--yellow);
  text-shadow: 2px 2px 0 #7a3b00, 3px 3px 0 rgba(0,0,0,.6);
  white-space: nowrap;
}
.brand span { color: var(--text); text-shadow: 2px 2px 0 #2a1f66; }

.chip {
  font-family: var(--ui);
  font-weight: 800;
  letter-spacing: .045em;
  background: var(--panel-2);
  border: 2px solid var(--line-dim);
  padding: 7px 11px;
  font-size: 13px;
  color: #cec7f3;
  white-space: nowrap;
  text-transform: uppercase;
}
.chip.warn {
  color: #fff;
  background: var(--red);
  border-color: #8c132c;
  animation: blink .45s steps(1) infinite;
}
.chip.online { color: var(--green); border-color: #177847; }
.chip.warm { color: var(--yellow); border-color: #a37000; background: #302657; }

.btn {
  font-family: var(--ui);
  font-weight: 850;
  letter-spacing: .045em;
  font-size: 12px;
  text-transform: uppercase;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--text);
  background: var(--panel-3);
  border: 2px solid var(--line);
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.16), inset -2px -2px 0 rgba(0,0,0,.45);
}
.btn:hover { background: #3d318c; }
.warmup-setup { color: var(--yellow); border-color: #a37000; }
.btn:disabled, .btn-start:disabled { cursor: wait; opacity: .58; animation: none; }
.btn:active {
  box-shadow: inset 2px 2px 0 rgba(0,0,0,.5), inset -2px -2px 0 rgba(255,255,255,.1);
  transform: translate(1px, 1px);
}

/* ----------------------------------------------------------------- stage */

#stage {
  grid-area: stage;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    linear-gradient(rgba(8,7,22,.48), rgba(8,7,22,.7)),
    url('assets/office-after-hours.webp') center / cover no-repeat,
    radial-gradient(ellipse at 50% 35%, #1a1442 0%, var(--void) 72%);
}

#game {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 4px solid var(--line);
  box-shadow: 0 0 0 4px #0a0818, 0 0 38px rgba(90, 73, 200, .32);
}

#banner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 92%;
  font-size: clamp(13px, 2.1vw, 26px);
  line-height: 1.7;
  text-align: center;
  color: var(--text);
  text-shadow: 3px 3px 0 #1b0f3d, 5px 5px 0 rgba(0,0,0,.75);
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
}
#banner.show { opacity: 1; }
#banner.danger {
  top: 11%;
  color: var(--red);
  font-size: clamp(10px, 1.5vw, 19px);
  text-shadow: 3px 3px 0 #47000f, 5px 5px 0 rgba(0,0,0,.8);
}

/* Evan appears once when the closing office chairs begin. The card is one
   compressed image plus a transform animation, so the gag is cheap to render. */
#evanAlert {
  position: absolute;
  z-index: 12;
  left: 50%;
  top: 50%;
  width: min(760px, 88%);
  aspect-ratio: 1693 / 929;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -180%);
  border: 4px solid var(--yellow);
  background: #080b1b;
  box-shadow: 8px 8px 0 rgba(0,0,0,.72), 0 0 0 4px #251b56;
}
#evanAlert.show { animation: evan-entrance 5.2s cubic-bezier(.2,.8,.2,1) both; }
#evanAlert img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.evan-copy {
  position: absolute;
  z-index: 1;
  left: 5%;
  top: 50%;
  width: 47%;
  transform: translateY(-50%);
  color: #fff;
  text-transform: uppercase;
  text-shadow: 3px 3px 0 #080b1b;
}
.evan-copy span {
  display: inline-block;
  margin-bottom: 14px;
  padding: 7px 10px;
  color: #190812;
  background: var(--yellow);
  font-size: clamp(7px, 1vw, 11px);
  text-shadow: none;
}
.evan-copy strong {
  display: block;
  font-size: clamp(16px, 3vw, 35px);
  line-height: 1.35;
  color: #fff;
}
.evan-copy p {
  margin: 16px 0 0;
  font-size: clamp(9px, 1.45vw, 16px);
  line-height: 1.7;
  color: var(--yellow);
}

@keyframes evan-entrance {
  0% { opacity: 0; transform: translate(-50%, -180%); }
  10%, 78% { opacity: 1; transform: translate(-50%, -50%); }
  86% { opacity: 1; transform: translate(-48%, -50%); }
  100% { opacity: 0; transform: translate(120%, -50%); }
}

/* --------------------------------------------------------------- sidebar */

#sidebar {
  grid-area: sidebar;
  background: var(--panel);
  border-left: 3px solid var(--line-dim);
  padding: 18px 14px;
  overflow-y: auto;
  font-family: var(--ui);
}

#sidebar h2, .legend h3 {
  margin: 0 0 14px;
  font-family: var(--arcade);
  font-size: 13px;
  color: var(--yellow);
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #6b3200;
}

#scoreboard { list-style: none; margin: 0 0 20px; padding: 0; }

#scoreboard li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  margin-bottom: 6px;
  background: var(--panel-2);
  border: 2px solid var(--line-dim);
  font-size: 14px;
  font-weight: 750;
}
#scoreboard li.dead { opacity: .4; }
#scoreboard li.me { border-color: var(--yellow); }

#scoreboard .dot {
  width: 9px; height: 9px;
  flex: none;
  border: 2px solid rgba(0,0,0,.55);
}
#scoreboard .nm {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#scoreboard .tag { font-size: 11px; font-weight: 700; color: var(--dim); white-space: nowrap; }
#scoreboard .sc { font-family: var(--arcade); font-size: 14px; color: var(--yellow); }

.legend { border-top: 3px solid var(--line-dim); padding-top: 15px; }
.legend ul { list-style: none; margin: 0 0 18px; padding: 0; }
.legend li {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 650; color: #ddd7fa; margin-bottom: 9px;
}
.legend canvas { width: 28px; height: 28px; flex: none; image-rendering: pixelated; }
.legend p { font-size: 13px; color: #ddd7fa; margin: 0; line-height: 2.2; }

kbd {
  background: var(--panel-3);
  border: 2px solid var(--line);
  padding: 2px 5px;
  font-family: var(--arcade);
  font-size: 11px;
  color: var(--yellow);
}

/* ----------------------------------------------------------- title screen */

#joinOverlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #07060e;
}
#joinOverlay.hidden { display: none; }

/* Slow drifting grid, like an attract-mode background. */
#joinOverlay::before {
  content: '';
  position: absolute;
  inset: -50%;
  background:
    linear-gradient(rgba(90,73,200,.14) 2px, transparent 2px) 0 0 / 100% 44px,
    linear-gradient(90deg, rgba(90,73,200,.14) 2px, transparent 2px) 0 0 / 44px 100%,
    radial-gradient(ellipse at 50% 50%, #1d1550 0%, #07060e 70%);
  animation: drift 9s linear infinite;
}

@keyframes drift {
  from { transform: translate(0, 0); }
  to { transform: translate(44px, 44px); }
}

.join-card {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100vw - 22px));
  max-height: calc(100vh - 18px);
  overflow-y: auto;
  padding: 21px 26px 19px;
  text-align: center;
  background: var(--panel);
  border: 3px solid var(--line);
  box-shadow:
    inset 3px 3px 0 rgba(255,255,255,.13),
    inset -3px -3px 0 rgba(0,0,0,.5),
    0 0 0 4px #0a0818,
    0 0 46px rgba(90,73,200,.4);
}

.join-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 19px;
  margin-bottom: 18px;
}

.title-bomb {
  width: 78px; height: 78px;
  flex: none;
  image-rendering: pixelated;
  animation: hover 1.5s ease-in-out infinite;
}
@keyframes hover {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.join-card h1 {
  margin: 0;
  font-size: clamp(31px, 3.5vw, 42px);
  line-height: 1.18;
  text-align: left;
  color: var(--yellow);
  letter-spacing: 1px;
  /* stacked hard shadows for the chunky arcade logo look */
  text-shadow:
    3px 3px 0 #a33800,
    5px 5px 0 #5c1e00,
    7px 7px 0 rgba(0,0,0,.6);
}
.join-card h1 .l2 {
  color: var(--text);
  margin-left: 9px;
  text-shadow: 3px 3px 0 #3b2a9e, 5px 5px 0 #1d1350, 7px 7px 0 rgba(0,0,0,.6);
}

.join-card .sub {
  margin: 11px 0 0;
  font-size: 12px;
  font-family: var(--ui);
  font-weight: 700;
  letter-spacing: .09em;
  color: var(--dim);
  line-height: 1.8;
  text-align: left;
  text-transform: uppercase;
}

.join-layout {
  display: grid;
  grid-template-columns: minmax(365px, .9fr) minmax(660px, 1.6fr);
  gap: 28px;
  align-items: start;
}

/* One tiny preview canvas reuses the real in-game sprite and face renderer. */
.fighter-panel {
  min-width: 0;
  padding: 12px;
  background: #0d0a22;
  border: 2px solid var(--line-dim);
  box-shadow: inset 2px 2px 0 rgba(0,0,0,.55);
}
.fighter-stage {
  --fighter-color: var(--yellow);
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  isolation: isolate;
  contain: layout paint;
  background:
    linear-gradient(180deg, transparent 67%, rgba(7,6,14,.35) 67%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.04) 0 2px, transparent 2px 22px),
    radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--fighter-color) 28%, #17103c) 0%, #0a0818 68%);
  border: 2px solid var(--line);
}
.fighter-stage::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0;
  background: repeating-linear-gradient(105deg, transparent 0 18px, rgba(255,255,255,.17) 19px 21px);
  transform: translateX(-35%);
}
.fighter-stage.entering::before { animation: fighterRush .72s steps(5, end); }
.fighter-stage::after {
  content: '';
  position: absolute;
  z-index: 2;
  left: 7%; right: 7%; bottom: 11%;
  height: 4px;
  pointer-events: none;
  background: var(--fighter-color);
  box-shadow: 0 5px 0 rgba(0,0,0,.55);
}
.fighter-slot {
  position: absolute;
  z-index: 3;
  top: 7px; left: 8px;
  padding: 4px 6px;
  font-size: 11px;
  line-height: 1.4;
  color: #160d00;
  background: var(--fighter-color);
  text-transform: uppercase;
}
#fighterPreview {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
.fighter-ready {
  position: absolute;
  z-index: 4;
  top: 23%; left: 0; right: 0;
  opacity: 0;
  color: #fff;
  font-size: clamp(23px, 3.2vw, 34px);
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 3px 3px 0 #7a1c33, 6px 6px 0 rgba(0,0,0,.7);
  pointer-events: none;
}
.fighter-stage.entering .fighter-ready { animation: fighterReady .82s steps(4, end) .42s; }
.fighter-id {
  display: block;
  padding: 14px 6px 5px;
  text-align: left;
  text-transform: uppercase;
}
.fighter-id span {
  display: block;
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .08em;
  color: var(--dim);
  white-space: nowrap;
}
.fighter-id strong {
  display: block;
  overflow: hidden;
  margin-top: 6px;
  font-size: 22px;
  line-height: 1.6;
  color: var(--fighter-color, var(--yellow));
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fighter-id small {
  display: block;
  min-height: 30px;
  margin-top: 3px;
  overflow: hidden;
  font-family: var(--ui);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: .04em;
  color: #8f83ca;
}
.fighter-tip {
  margin: 5px 4px 2px;
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: .05em;
  color: #6f63aa;
  text-align: left;
  text-transform: uppercase;
}
.join-form { min-width: 0; }
.identity-fields {
  display: grid;
  grid-template-columns: 1.35fr .65fr;
  gap: 15px;
}
.field { text-align: left; margin-bottom: 15px; }
.field label {
  display: block;
  font-size: 14px;
  color: var(--yellow);
  margin-bottom: 8px;
  text-transform: uppercase;
}
.join-card input {
  width: 100%;
  font-family: var(--ui);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .04em;
  padding: 13px 14px;
  color: var(--text);
  background: #0d0a22;
  border: 2px solid var(--line-dim);
  box-shadow: inset 2px 2px 0 rgba(0,0,0,.6);
}
.join-card input:focus { outline: 2px solid var(--yellow); outline-offset: 2px; border-color: var(--yellow); }
.join-card input::placeholder { color: #5b4f96; }
#roomInput { text-transform: uppercase; letter-spacing: 5px; }

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}
.avatar-grid button {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  cursor: pointer;
  background: #0d0a22;
  border: 2px solid var(--line-dim);
  box-shadow: inset 2px 2px 0 rgba(0,0,0,.55);
  transition: transform .08s ease-out, border-color .08s linear;
}
.avatar-grid button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar-grid button:hover:not(:disabled) { z-index: 1; border-color: var(--line); background: #191340; transform: translateY(-2px); }
.avatar-grid button.sel {
  border-color: var(--yellow);
  background: #2b2159;
  box-shadow: inset 2px 2px 0 rgba(255,207,61,.3), 0 0 0 2px rgba(255,207,61,.45);
  transform: translateY(-2px);
}
.avatar-grid button.sel::after {
  content: '';
  position: absolute;
  right: -2px; bottom: -2px;
  width: 12px; height: 12px;
  background: var(--yellow);
  border: 2px solid #2a1200;
}
.avatar-grid button.locked {
  cursor: not-allowed;
  border-color: #7d1731;
  background: #190812;
  box-shadow: inset 0 0 0 2px rgba(255,59,92,.12);
}
.avatar-grid button.locked img {
  opacity: .84;
  filter: grayscale(.82) brightness(.7) contrast(1.18) sepia(.12);
}
.avatar-grid button.locked::before {
  content: 'LOCKED';
  position: absolute;
  z-index: 2;
  left: 2px; right: 2px; bottom: 2px;
  padding: 4px 0;
  font-family: var(--arcade);
  font-size: 10px;
  line-height: 1;
  color: #fff;
  background: var(--red);
  text-align: center;
}
.avatar-grid button.locked::after {
  display: none;
}

.avatar-grid button:focus-visible,
.btn:focus-visible,
.btn-start:focus-visible,
#touch button:focus-visible,
.kick-btn:focus-visible,
.map-picker button:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 2px;
}

#scoreboard .face {
  width: 32px; height: 32px;
  flex: none;
  object-fit: cover;
  border: 2px solid rgba(0,0,0,.55);
}

@keyframes fighterRush {
  0% { opacity: 0; transform: translateX(-40%); }
  35% { opacity: .9; }
  100% { opacity: 0; transform: translateX(40%); }
}
@keyframes fighterReady {
  0% { opacity: 0; transform: scale(1.8) skewX(-8deg); }
  28%, 70% { opacity: 1; transform: scale(1) skewX(-8deg); }
  100% { opacity: 0; transform: scale(.88) skewX(-8deg); }
}

/* ----------------------------------------------------------------- lobby */

#lobby {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: rgba(8, 6, 20, .82);
}
#lobby.show { display: flex; }
#lobby.show.warmup { background: rgba(8, 6, 20, .72); }

.lobby-box {
  width: min(680px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 26px;
  text-align: center;
  background: var(--panel);
  border: 3px solid var(--line);
  box-shadow:
    inset 3px 3px 0 rgba(255,255,255,.12),
    inset -3px -3px 0 rgba(0,0,0,.5),
    0 0 0 4px #0a0818;
}

.lobby-box h2 {
  margin: 0 0 8px;
  font-size: clamp(20px, 3vw, 28px);
  color: var(--yellow);
  text-shadow: 3px 3px 0 #7a3b00, 5px 5px 0 rgba(0,0,0,.6);
}

.lobby-actions {
  display: flex;
  align-items: stretch;
  gap: 10px;
}
.lobby-actions .btn { flex: none; margin-top: 4px; }
.lobby-actions .btn-start { flex: 1; }

.kick-btn {
  flex: none;
  font-family: var(--arcade);
  font-size: 9px;
  color: var(--text);
  background: #6c1730;
  border: 2px solid var(--red);
  padding: 4px 6px;
  cursor: pointer;
}
.offline .who::after { content: ' (RECONNECTING)'; color: var(--yellow); font-size: 10px; }
.lobby-sub { margin: 0 0 20px; font-family: var(--ui); font-size: 14px; font-weight: 650; color: #c9c1ef; line-height: 1.6; }

.lobby-players {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 7px;
  text-align: left;
}
.lobby-players li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 750;
  background: var(--panel-2);
  border: 2px solid var(--line-dim);
}
.lobby-players li.host { border-color: var(--yellow); }
.lobby-players img {
  width: 32px; height: 32px;
  flex: none;
  object-fit: cover;
  border: 2px solid rgba(0,0,0,.5);
}
.lobby-players .who { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-players .crown { font-family: var(--arcade); color: var(--yellow); font-size: 9px; }

.lobby-label {
  display: block;
  font-size: 12px;
  color: var(--yellow);
  margin-bottom: 7px;
  text-align: left;
  text-transform: uppercase;
}
.map-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 7px;
  margin-bottom: 20px;
}
.map-picker button {
  font-family: var(--arcade);
  font-size: 10px;
  line-height: 1.6;
  padding: 9px 5px;
  cursor: pointer;
  color: var(--text);
  background: var(--panel-2);
  border: 2px solid var(--line-dim);
}
.map-picker button .dim { display: block; margin-top: 2px; font-family: var(--ui); font-size: 10px; font-weight: 700; color: var(--dim); }
.map-picker button:hover:not(:disabled) { border-color: var(--line); background: #2b2159; }
.map-picker button.sel { border-color: var(--yellow); background: #2b2159; }
.map-picker button:disabled { opacity: .35; cursor: not-allowed; }

.lobby-hint { min-height: 20px; margin: 13px 0 0; font-family: var(--ui); font-size: 13px; font-weight: 650; color: #c9c1ef; line-height: 1.6; }

/* ------------------------------------------------------------- countdown */

/*
 * The round countdown used to share the small banner and got missed entirely,
 * so it is now its own full-stage overlay with a very large number.
 */
#countdown {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
  background: rgba(8, 6, 20, .5);
}
#countdown.show { display: flex; }

#countdown .ready {
  font-size: clamp(14px, 2.6vw, 30px);
  color: var(--yellow);
  letter-spacing: 3px;
  text-shadow: 3px 3px 0 #7a3b00, 5px 5px 0 rgba(0,0,0,.7);
}
#countdown .num {
  font-size: clamp(80px, 17vw, 190px);
  line-height: 1;
  color: var(--text);
  text-shadow:
    5px 5px 0 #3b2a9e,
    9px 9px 0 #1d1350,
    13px 13px 0 rgba(0,0,0,.6);
  animation: countPop .55s ease-out;
}
#countdown.go .num {
  font-size: clamp(52px, 11vw, 130px);
  color: var(--green);
  text-shadow: 5px 5px 0 #0c5c37, 9px 9px 0 rgba(0,0,0,.6);
}

.lobby-results {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  text-align: left;
}
.lobby-results li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  margin-bottom: 4px;
  font-family: var(--ui);
  font-size: 14px;
  font-weight: 750;
  background: var(--panel-2);
  border: 2px solid var(--line-dim);
}
.lobby-results li.first { border-color: var(--yellow); background: #34275f; }
.lobby-results img {
  width: 30px; height: 30px;
  flex: none; object-fit: cover;
  border: 2px solid rgba(0,0,0,.5);
}
.lobby-results .rank { width: 22px; color: var(--dim); }
.lobby-results .who { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-results .pts { color: var(--yellow); }

@keyframes countPop {
  0% { transform: scale(2.1); opacity: 0; }
  45% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.btn-start {
  display: block;
  width: 100%;
  margin-top: 4px;
  font-family: var(--arcade);
  font-size: 18px;
  padding: 16px 12px;
  cursor: pointer;
  text-transform: uppercase;
  color: #2a1200;
  background: var(--yellow);
  border: 3px solid #a37000;
  box-shadow: inset 3px 3px 0 rgba(255,255,255,.5), inset -3px -3px 0 rgba(0,0,0,.28);
  animation: pulseBtn 1.1s ease-in-out infinite;
}
.btn-start:hover { background: #ffdc72; }
.btn-start:active {
  transform: translate(2px, 2px);
  box-shadow: inset 3px 3px 0 rgba(0,0,0,.3), inset -3px -3px 0 rgba(255,255,255,.3);
  animation: none;
}
@keyframes pulseBtn {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.16); }
}

.hint { min-height: 20px; margin: 14px 0 0; font-size: 12px; color: var(--red); line-height: 1.9; }
#joinHint:empty { display: none; }

.credits {
  margin: 18px 0 0;
  font-size: 11px;
  font-family: var(--ui);
  font-weight: 700;
  letter-spacing: .05em;
  color: #5f5399;
  line-height: 2;
  text-transform: uppercase;
}
.credits summary { cursor: pointer; }
.credits p { margin: 8px 0; font-size: 10px; line-height: 1.8; }
.credits a { color: var(--dim); }

@keyframes blink { 50% { opacity: .25; } }

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

#touch {
  grid-area: pad;
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px 15px;
  background: var(--panel);
  border-top: 3px solid var(--line-dim);
}
body.has-touch #touch { display: flex; }
body.has-touch #app {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 44px 1fr auto;
  grid-template-areas: "hud" "stage" "pad";
}
/* A phone needs every pixel for the board, so the roster stays in the HUD. */
body.has-touch #sidebar { display: none; }

#touch .pad {
  display: grid;
  grid-template-columns: repeat(3, 52px);
  grid-template-rows: repeat(3, 46px);
  gap: 4px;
  flex: none;
}
#touch .pad button:nth-child(1) { grid-area: 1 / 2; }
#touch .pad button:nth-child(2) { grid-area: 2 / 1; }
#touch .pad button:nth-child(3) { grid-area: 2 / 3; }
#touch .pad button:nth-child(4) { grid-area: 3 / 2; }

#touch button {
  font-family: var(--arcade);
  font-size: 13px;
  color: var(--text);
  background: var(--panel-3);
  border: 2px solid var(--line);
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.16), inset -2px -2px 0 rgba(0,0,0,.45);
  touch-action: none;
}
#touch button.on {
  background: var(--yellow);
  color: #2a1200;
  box-shadow: inset 2px 2px 0 rgba(0,0,0,.3);
}
#touch #touchBomb {
  flex: none;
  width: 96px; height: 96px;
  font-size: 11px;
  background: var(--red);
  border-color: #8c132c;
}
#touch #touchBomb.on { background: var(--yellow); border-color: #a37000; }

/* ----------------------------------------------------------- responsive */

@media (max-width: 980px) {
  #evanAlert { width: 94%; border-width: 3px; }
  .evan-copy { left: 4%; width: 49%; }
  .evan-copy span { margin-bottom: 7px; padding: 5px 7px; }
  .evan-copy p { margin-top: 8px; }
  .join-card { width: min(760px, calc(100vw - 18px)); padding: 9px 24px; }
  .join-heading { margin-bottom: 6px; }
  .title-bomb { width: 62px; height: 62px; }
  .join-card h1 { font-size: clamp(27px, 5vw, 34px); }
  .join-card .sub { display: none; }
  .join-layout { grid-template-columns: 1fr; gap: 12px; }
  .fighter-panel { display: none; }
  .field { margin-bottom: 10px; }
  .avatar-field { margin-bottom: 11px; }
  .credits { display: none; }
}

@media (max-width: 410px) {
  #joinOverlay { padding: 9px; }
  .join-card { width: 100%; padding: 11px; }
  .join-heading { justify-content: flex-start; }
  .join-card h1 .l2 { display: block; margin: 2px 0 0; }
  .join-card .sub { display: none; }
  .identity-fields { grid-template-columns: 1.2fr .8fr; gap: 7px; }
  .join-card input { font-size: 14px; padding: 11px; }
  .field label { font-size: 11px; }
  .avatar-grid { gap: 4px; }
  .btn-start { padding: 14px 8px; font-size: 15px; }
  .hint { margin-top: 8px; }
}

@media (max-width: 620px) {
  #pingChip { display: none; }
  #connectionChip { display: none; }
  #roomChip { display: none; }
  #mapChip { display: none; }
  .brand span { display: none; }
  #hud { gap: 7px; padding: 0 9px; }
  .hud-left, .hud-right { gap: 5px; }
  .brand { font-size: 16px; }
  #hud .btn { padding: 7px 9px; font-size: 11px; }
  #hud .chip { padding: 6px 8px; font-size: 11px; }
}

@media (max-width: 940px) {
  #app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 66px 1fr auto;
    grid-template-areas: "hud" "stage" "sidebar";
  }
  #sidebar {
    border-left: none;
    border-top: 3px solid var(--line-dim);
    max-height: 30vh;
  }
  .legend { display: none; }
  #hud .btn-ghost { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
  }
  body::after {
    background: radial-gradient(ellipse at 50% 50%, rgba(0,0,0,0) 55%, rgba(0,0,0,.32) 100%);
  }
  #evanAlert.show {
    animation: none !important;
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}
