:root {
  --ink: #ece7df;
  --muted: #9a9183;
  --gold: #f3b73b;
  --gold-lite: #ffd86b;
  --steel: #c8ccd4;
  --red: #e2473f;
  --red-lite: #ff8a82;
  --blue: #3f7ad6;
  --blue-lite: #86b0ff;
  --plate: #1b1e24;
  --plate-dk: #101216;
  --stencil: 'Arial Black', 'Arial Narrow Bold', Impact, system-ui, sans-serif;
  --mono: ui-monospace, 'Courier New', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  color: var(--ink);
  font: 16px/1.4 system-ui, sans-serif;
}

/* Warzone backdrop: bright blue sky up top, fiery dust kicked up from below. */
body {
  display: flex;
  justify-content: center;
  align-items: safe center; /* center when it fits, scroll-from-top when tall */
  min-height: 100vh;
  overflow-y: auto;
  padding: 24px 0;
  background:
    radial-gradient(130% 85% at 50% 130%, rgba(255, 145, 45, 0.95), rgba(225, 95, 28, 0.55) 26%, transparent 56%),
    linear-gradient(180deg, #5b93d6 0%, #4a7ec2 18%, #41669c 38%, #6a5746 64%, #7a4422 100%);
}

.screen { width: min(900px, 96vw); padding: 24px; }
.hidden { display: none !important; }

/* --- riveted metal plate ------------------------------------------------ */
.panel {
  position: relative;
  background:
    linear-gradient(180deg, #3c424d, #2a2f38 55%, #20242b);
  border: 4px solid #07080a;
  border-radius: 12px;
  padding: 30px 26px 26px;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.12),
    inset 0 -6px 14px rgba(0, 0, 0, 0.55),
    0 22px 55px rgba(0, 0, 0, 0.6);
}
/* inset frame with corner rivets */
.panel::before {
  content: '';
  position: absolute;
  inset: 9px;
  border: 2px solid rgba(0, 0, 0, 0.55);
  border-radius: 7px;
  pointer-events: none;
  background:
    radial-gradient(circle at 12px 12px, #565b64 2.6px, rgba(0,0,0,.4) 3px, transparent 3.4px),
    radial-gradient(circle at calc(100% - 12px) 12px, #565b64 2.6px, rgba(0,0,0,.4) 3px, transparent 3.4px),
    radial-gradient(circle at 12px calc(100% - 12px), #565b64 2.6px, rgba(0,0,0,.4) 3px, transparent 3.4px),
    radial-gradient(circle at calc(100% - 12px) calc(100% - 12px), #565b64 2.6px, rgba(0,0,0,.4) 3px, transparent 3.4px);
}

/* --- title: the real key-art logo (includes the tagline banner) -------- */
.title-img {
  display: block;
  width: min(560px, 88%);
  height: auto;
  margin: 6px auto 18px;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.55));
}

/* --- (legacy CSS title — unused now that the logo image is in) ---------- */
.title {
  display: block;
  width: max-content;
  max-width: 100%;
  margin: 4px auto 14px;
  padding: 12px 26px 14px;
  text-align: center;
  font-family: var(--stencil);
  font-weight: 900;
  font-size: clamp(46px, 9vw, 92px);
  line-height: 0.82;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #313641, #23272f 60%, #1a1d23);
  border: 3px solid #0a0c10;
  border-radius: 10px;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.18),
    inset 0 -5px 12px rgba(0, 0, 0, 0.45),
    0 10px 26px rgba(0, 0, 0, 0.45);
}
.title span { display: block; }
.title .t1 {
  background: linear-gradient(180deg, #ffffff, #e4e8ef 36%, #9fa6b1 56%, #d2d7df 78%, #ffffff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 1.5px #14171c;
  text-shadow: 0 3px 0 #0a0b0e, 0 6px 9px rgba(0, 0, 0, 0.45);
}
.title .t2 {
  background: linear-gradient(180deg, #fff0bf, #f3b73b 46%, #a9690c 62%, #ffd86b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 2px #241803;
  text-shadow: 0 4px 0 #1a1205, 0 7px 9px rgba(0, 0, 0, 0.6);
}

.tagline {
  margin: 0 0 22px;
  text-align: center;
  color: var(--ink);
  font-family: var(--stencil);
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: 13px;
}
.tagline::before, .tagline::after { content: '★'; color: var(--gold); margin: 0 0.6em; }

.conn {
  position: fixed;
  left: 12px;
  bottom: 10px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.conn.ok { color: #5ad06a; }
.conn.down { color: var(--red-lite); }

/* --- shared metal controls ---------------------------------------------- */
.row { display: flex; gap: 8px; margin-bottom: 16px; }

input[type='text'] {
  flex: 1;
  padding: 11px 12px;
  border: 2px solid #07080a;
  border-radius: 5px;
  background: #0c0e12;
  color: var(--ink);
  font-family: var(--mono);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
}
input::placeholder { color: #6b7280; letter-spacing: 0.1em; }

button {
  padding: 11px 16px;
  border: 2px solid #050608;
  border-radius: 6px;
  background: linear-gradient(180deg, #4a4f59, #2b2f37 55%, #20242b);
  color: var(--ink);
  font-family: var(--stencil);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 4px 0 #08090c, 0 6px 10px rgba(0, 0, 0, 0.4);
}
button:hover { filter: brightness(1.08); }
button:active { transform: translateY(3px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 1px 0 #08090c; }
button:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* --- pre-join row ------------------------------------------------------- */
.joinrow { justify-content: center; margin-bottom: 14px; }
.joinrow input[type='text'] {
  flex: 0 1 320px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.joinrow #join {
  background: linear-gradient(180deg, #ffe093, #f3b73b 55%, #b9760f);
  color: #2a1a00;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 4px 0 #6e470a, 0 6px 10px rgba(0, 0, 0, 0.45);
}
.mini { text-align: center; font-family: var(--mono); letter-spacing: 0.06em; }
.hint { color: var(--muted); font-size: 14px; }

/* Control/mute hints: wrap as whole chips, never mid-phrase. */
.hints {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  column-gap: 16px;
  row-gap: 6px;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.hints .hk {
  white-space: nowrap;                         /* keep each hint on one line */
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 5px;
  padding: 3px 9px;
}
.hints .hk.sep { margin-left: 6px; }           /* small gap before the mute group */
.hints b { color: #e6e1d7; font-weight: 700; }
.hints em { color: var(--gold); font-style: normal; opacity: 0.85; }

/* --- split team battle banners ------------------------------------------ */
.hives { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.hive {
  display: flex;
  flex-direction: column;
  border: 3px solid #07080a;
  border-radius: 8px;
  background: linear-gradient(180deg, #1d2026, #121419);
  padding: 0 12px 12px;
  min-height: 210px;
  box-shadow: inset 0 -5px 12px rgba(0, 0, 0, 0.5);
}
.hive-red { box-shadow: inset 0 0 0 2px rgba(226, 71, 63, 0.35), inset 0 -5px 12px rgba(0,0,0,.5); }
.hive-blue { box-shadow: inset 0 0 0 2px rgba(63, 122, 214, 0.35), inset 0 -5px 12px rgba(0,0,0,.5); }
.hive-h {
  margin: 0 -12px 4px;
  padding: 8px 0 6px;
  font-family: var(--stencil);
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 0.06em;
  text-align: center;
  border-radius: 5px 5px 0 0;
  border-bottom: 3px solid #07080a;
}
.hive-red .hive-h { color: #fff; background: linear-gradient(180deg, #e2473f, #8e221c); text-shadow: 0 2px 0 #4a0f0c; }
.hive-blue .hive-h { color: #fff; background: linear-gradient(180deg, #3f7ad6, #1d3f7e); text-shadow: 0 2px 0 #0c2147; }
.hive-slogan {
  text-align: center;
  font-family: var(--stencil);
  font-size: 11px;
  letter-spacing: 0.12em;
  margin-bottom: 10px;
}
.hive-red .hive-slogan { color: var(--red-lite); }
.hive-blue .hive-slogan { color: var(--blue-lite); }

.roster {
  list-style: none;
  margin: 0 0 12px;
  padding: 0 4px 0 0;
  flex: 1;
  min-height: 0;            /* allow the flex child to shrink so it can scroll */
  max-height: 230px;        /* ~9-10 rows; scrolls beyond that */
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--mono);
  font-size: 14px;
}
.roster::-webkit-scrollbar { width: 8px; }
.roster::-webkit-scrollbar-thumb { background: #3a3f49; border-radius: 4px; }
.roster li { display: flex; justify-content: space-between; gap: 8px; }
.roster .who { color: #d7d2c8; }
.roster .you { color: #fff; font-weight: 700; }
.roster .ping { color: #5ad06a; font-size: 12px; }
.roster .ping.high { color: var(--gold); }

.switch-red { background: linear-gradient(180deg, #e2473f, #8e221c); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 4px 0 #4a0f0c; }
.switch-blue { background: linear-gradient(180deg, #3f7ad6, #1d3f7e); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 4px 0 #0c2147; }
.team-btn.selected { outline: 3px solid var(--gold); outline-offset: 1px; }

/* --- map selection ------------------------------------------------------ */
.maprow { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 16px; }
.maplabel { color: var(--muted); letter-spacing: 0.12em; font-family: var(--stencil); }
.map-btn { padding: 8px 12px; font-size: 14px; }
.map-btn.selected { border-color: var(--gold); box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 0 0 2px var(--gold), 0 4px 0 #08090c; color: var(--gold-lite); }
.map-btn.voted { outline: 2px solid #5ad06a; outline-offset: 2px; }

/* --- ready row ---------------------------------------------------------- */
.readyrow { display: flex; justify-content: center; margin-bottom: 10px; }
.ready {
  font-size: 22px;
  padding: 14px 40px;
  background: linear-gradient(180deg, #ffe093, #f3b73b 55%, #b9760f);
  color: #2a1a00;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 5px 0 #6e470a, 0 8px 12px rgba(0, 0, 0, 0.45);
}
.ready.armed { background: linear-gradient(180deg, #8ef0a0, #4ad06a 55%, #1f8a3e); color: #062510; box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 5px 0 #11592a, 0 8px 12px rgba(0,0,0,.45); }
.ready:active { transform: translateY(4px); }
.center { text-align: center; }

/* --- chat --------------------------------------------------------------- */
.chat { margin-top: 14px; }
.chat-log {
  height: 130px;
  overflow-y: auto;
  background: #0a0c10;
  border: 2px solid #07080a;
  border-radius: 6px;
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6);
}
.chat-log .msg .from { font-weight: 700; }
.chat-log .from-red { color: var(--red-lite); }
.chat-log .from-blue { color: var(--blue-lite); }
.chat-log .ch-team { color: #c39bff; }
.chat-input { display: flex; gap: 8px; margin-top: 8px; }
.chat-input input { flex: 1; }
.chat-channel { min-width: 64px; background: linear-gradient(180deg, #4a4f59, #20242b); }
.chat-channel.team { background: linear-gradient(180deg, #9a6bff, #5a2db0); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 4px 0 #2c1560; }
#chatSend { background: linear-gradient(180deg, #ffe093, #f3b73b 55%, #b9760f); color: #2a1a00; box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 4px 0 #6e470a; }

/* --- overlays / game ---------------------------------------------------- */
.notice {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(8, 9, 12, 0.93);
  font-family: var(--stencil);
  font-size: 24px;
  letter-spacing: 0.04em;
  z-index: 10;
}

.audio-badge {
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 12px;
  color: #cfd3dc;
  background: rgba(0, 0, 0, 0.5);
  padding: 4px 8px;
  border-radius: 6px;
  pointer-events: none;
  min-height: 1em;
  font-family: var(--mono);
}

#game { display: grid; place-items: center; position: relative; }
canvas {
  background: #0c0f16;
  border: 3px solid #07080a;
  border-radius: 8px;
  max-width: 100%;
  touch-action: none;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.banner {
  position: absolute;
  top: 38%;
  padding: 16px 26px;
  background: rgba(8, 9, 12, 0.82);
  border: 3px solid var(--gold);
  border-radius: 10px;
  font-family: var(--stencil);
  font-size: 26px;
  letter-spacing: 0.04em;
  text-align: center;
}
