:root {
  --ink: #fff8ec;
  --dim: rgba(255, 248, 236, 0.65);
  --panel: rgba(18, 16, 24, 0.62);
  --panel-solid: #1b1822;
  --hot: #ff7a2f;
  --hot2: #ffb703;
  --prop: #4cc9f0;
  --good: #06d6a0;
  --bad: #ef476f;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0d0c12;
  color: var(--ink);
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 800;
  user-select: none;
  -webkit-user-select: none;
}
canvas#game {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  outline: none;
}
.hidden { display: none !important; }
.dim { color: var(--dim); }
b { color: var(--hot2); }

/* ------------------------------------------------------------ menu */
#menu {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background:
    radial-gradient(1200px 600px at 20% 10%, rgba(255, 122, 47, 0.35), transparent 60%),
    radial-gradient(900px 600px at 90% 90%, rgba(76, 201, 240, 0.25), transparent 60%),
    #120f18;
  z-index: 20;
  overflow-y: auto;
}
.menu-card {
  width: min(760px, 100%);
  background: var(--panel-solid);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 28px 28px 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  display: grid;
  gap: 12px;
}
.logo {
  font-family: "Lilita One", "Nunito", sans-serif;
  font-weight: 400;
  font-size: clamp(44px, 9vw, 84px);
  margin: 0;
  line-height: 0.95;
  letter-spacing: 1px;
  background: linear-gradient(180deg, #ffe066, #ff7a2f 55%, #e63946);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 0 #5a1e10);
}
.logo .flame {
  display: inline-block;
  -webkit-text-fill-color: initial;
  animation: flicker 1.2s infinite alternate ease-in-out;
}
@keyframes flicker {
  0% { transform: rotate(-6deg) scale(1); }
  100% { transform: rotate(6deg) scale(1.08); }
}
.tag { margin: 0 0 6px; color: var(--dim); font-size: 18px; }
.menu-card label { display: grid; gap: 4px; font-size: 14px; color: var(--dim); }
input {
  font: inherit;
  color: var(--ink);
  background: #0f0d14;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
}
input:focus { border-color: var(--hot); }
button {
  font: inherit;
  cursor: pointer;
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  color: #2a1204;
  background: linear-gradient(180deg, var(--hot2), var(--hot));
  box-shadow: 0 4px 0 #9c3a10;
}
button:active { transform: translateY(2px); box-shadow: 0 2px 0 #9c3a10; }
button.big { font-family: "Lilita One", sans-serif; font-weight: 400; font-size: 28px; padding: 12px; letter-spacing: 1px; }
button.link { background: none; box-shadow: none; color: var(--dim); text-decoration: underline; padding: 0; justify-self: center; }
.error { background: rgba(239, 71, 111, 0.15); border: 1px solid var(--bad); padding: 10px; border-radius: 10px; color: #ffd0da; }
.howto { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 6px; }
.howto h3 { margin: 0 0 4px; font-size: 18px; }
.howto p { margin: 0; color: var(--dim); font-size: 14px; line-height: 1.45; font-weight: 600; }
.fine { margin: 6px 0 0; font-size: 13px; color: var(--dim); text-align: center; }
@media (max-width: 640px) { .howto { grid-template-columns: 1fr; } }

#loading {
  position: fixed; inset: 0; display: grid; place-content: center; text-align: center; gap: 8px;
  background: #120f18; z-index: 30; font-size: 20px;
}
.spinner { font-size: 64px; animation: flicker 0.5s infinite alternate; }

/* ------------------------------------------------------------ HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud * { pointer-events: none; }
#clicktoplay, #clicktoplay *, #chatinput { pointer-events: auto !important; }

#topbar {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  display: grid; justify-items: center; gap: 2px; text-align: center;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}
#phase { font-size: 14px; letter-spacing: 3px; color: var(--hot2); }
#timer { font-family: "Lilita One", sans-serif; font-size: 40px; line-height: 1; min-height: 4px; }
#timer.urgent { color: #ff5d5d; animation: pulse 0.6s infinite alternate; }
@keyframes pulse { to { transform: scale(1.08); } }
#teamcount { font-size: 13px; color: var(--dim); background: var(--panel); padding: 3px 12px; border-radius: 99px; }

#crosshair { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; transform: translate(-50%, -50%); }
#crosshair i { position: absolute; background: rgba(255, 255, 255, 0.85); box-shadow: 0 0 2px #000; border-radius: 2px; }
#crosshair i:nth-child(1) { left: 10px; top: 0; width: 2px; height: 6px; }
#crosshair i:nth-child(2) { left: 10px; bottom: 0; width: 2px; height: 6px; }
#crosshair i:nth-child(3) { top: 10px; left: 0; width: 6px; height: 2px; }
#crosshair i:nth-child(4) { top: 10px; right: 0; width: 6px; height: 2px; }
#crosshair.hunter i { background: #ffd8b8; }

#hint {
  position: absolute; left: 50%; top: calc(50% + 34px); transform: translateX(-50%);
  background: var(--panel); padding: 6px 14px; border-radius: 99px; font-size: 15px; white-space: nowrap;
}

#announce { position: absolute; left: 0; right: 0; top: 22%; text-align: center; text-shadow: 0 4px 16px rgba(0, 0, 0, 0.7); }
#announce.pop { animation: pop 0.35s cubic-bezier(.2, 1.6, .5, 1); }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#ann-main { font-family: "Lilita One", sans-serif; font-size: clamp(32px, 6vw, 64px); color: #fff3d6; -webkit-text-stroke: 2px #6b2a0e; }
#ann-sub { font-size: 18px; color: var(--ink); margin-top: 4px; }

#killfeed { position: absolute; top: 12px; right: 12px; display: grid; gap: 4px; justify-items: end; max-width: 46vw; }
#killfeed .line { background: var(--panel); padding: 5px 10px; border-radius: 10px; font-size: 14px; animation: slidein 0.25s ease-out; }
#killfeed .verb { color: var(--hot2); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }

#chat { position: absolute; left: 12px; bottom: 150px; width: min(420px, 60vw); display: grid; gap: 6px; }
#chatlog { display: grid; gap: 2px; }
#chatlog .line { background: rgba(0, 0, 0, 0.35); padding: 3px 8px; border-radius: 8px; font-size: 14px; font-weight: 700; transition: opacity 0.6s; overflow-wrap: anywhere; }
#chatlog .line.faded { opacity: 0; }
#chatlog .sys { color: #b8f2e6; }
#chatinput { width: 100%; }

#vitals {
  position: absolute; left: 12px; bottom: 12px; width: min(340px, 70vw);
  background: var(--panel); border-radius: var(--radius); padding: 10px 12px; display: grid; gap: 8px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
#team-badge { font-size: 12px; letter-spacing: 3px; padding: 2px 10px; border-radius: 99px; justify-self: start; background: #555; }
#team-badge.hunter { background: var(--hot); color: #2a1204; }
#team-badge.prop { background: var(--prop); color: #062833; }
.bar { position: relative; height: 22px; background: rgba(0, 0, 0, 0.45); border-radius: 8px; overflow: hidden; }
.bar > div { position: absolute; inset: 0 auto 0 0; transition: width 0.15s; }
.bar .label { position: absolute; left: 8px; top: 2px; font-size: 13px; text-shadow: 0 1px 2px #000; }
#hptext { position: absolute; right: 8px; top: 1px; font-size: 14px; text-shadow: 0 1px 2px #000; }
#hpfill { background: linear-gradient(90deg, #2bd47d, #06d6a0); }
#hpfill.low { background: linear-gradient(90deg, #ef476f, #ff7a59); animation: pulse 0.5s infinite alternate; }
#fuelfill { background: linear-gradient(90deg, #ff7a2f, #ffd166); }
#fuelfill.empty { background: #ef476f; width: 100% !important; opacity: 0.4; animation: pulse 0.3s infinite alternate; }
#propname { font-family: "Lilita One", sans-serif; font-size: 22px; color: var(--prop); }
#lockinfo { font-size: 13px; color: var(--dim); }
#lockinfo.on { color: var(--hot2); }
#tauntinfo { font-size: 12px; color: var(--dim); }

#controls-hint { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 10px; font-size: 12px; color: var(--dim); }
#controls-hint b { color: var(--ink); }
@media (max-width: 760px) { #controls-hint { display: none; } }

#nametags { position: absolute; inset: 0; overflow: hidden; }
#nametags .tag {
  position: absolute; left: 0; top: 0; font-size: 13px; white-space: nowrap;
  text-shadow: 0 1px 3px #000, 0 0 2px #000; will-change: transform;
}

#vignette {
  position: absolute; inset: 0; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(220, 20, 40, 0.75) 100%);
}
#burnfx {
  position: absolute; inset: 0; opacity: 0;
  background: radial-gradient(ellipse at center bottom, transparent 40%, rgba(255, 110, 20, 0.7) 100%);
}

#blind {
  position: absolute; inset: 0; background: #08070b; display: grid; place-content: center; text-align: center; gap: 6px;
}
.blind-title { font-family: "Lilita One", sans-serif; font-size: 52px; color: var(--hot2); }
.blind-sub { color: var(--dim); font-size: 18px; }
#blindtime { font-family: "Lilita One", sans-serif; font-size: 96px; }

#scoreboard {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(620px, calc(100vw - 32px)); background: rgba(18, 16, 24, 0.92); border-radius: 18px; padding: 16px 20px;
}
#scoreboard h2 { margin: 0; font-family: "Lilita One", sans-serif; font-weight: 400; font-size: 30px; }
#sbroom { color: var(--dim); font-size: 13px; margin-bottom: 8px; }
#scoreboard table { width: 100%; border-collapse: collapse; font-size: 15px; }
#scoreboard th { text-align: left; color: var(--dim); font-size: 12px; letter-spacing: 1px; padding: 4px 6px; }
#scoreboard td { padding: 6px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
#scoreboard tr.me td { background: rgba(255, 183, 3, 0.1); }
#scoreboard tr.dead td { opacity: 0.5; }

#netstatus { position: absolute; top: 90px; left: 50%; transform: translateX(-50%); background: var(--bad); padding: 8px 14px; border-radius: 10px; }

#clicktoplay {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 16px;
  background: rgba(10, 8, 14, 0.55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); cursor: pointer;
}
.pause-card { background: var(--panel-solid); border-radius: 20px; padding: 20px 24px; width: min(520px, 100%); display: grid; gap: 12px; cursor: default; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.pause-card h2 { margin: 0; font-family: "Lilita One", sans-serif; font-weight: 400; font-size: 34px; color: var(--hot2); cursor: pointer; }
.pause-card p { margin: 0; }
.settings { display: grid; gap: 8px; }
.settings label { display: grid; grid-template-columns: 150px 1fr 50px; align-items: center; gap: 10px; font-size: 14px; }
.settings input[type="range"] { padding: 0; accent-color: var(--hot); }
.share { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.share input { font-size: 13px; }
.keys { font-size: 13px; color: var(--dim); display: grid; gap: 4px; font-weight: 700; }
@media (max-width: 520px) { .settings label { grid-template-columns: 1fr; gap: 2px; } }
