@font-face { font-family: Rajdhani; src: url("fonts/Rajdhani-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: Rajdhani; src: url("fonts/Rajdhani-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: Rajdhani; src: url("fonts/Rajdhani-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Share Tech Mono"; src: url("fonts/ShareTechMono-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }

:root {
  --bg: #07080c;
  --panel: rgba(8, 10, 14, 0.84);
  --line: rgba(228, 177, 90, 0.4);
  --amber: #e4b15a;
  --amber-2: #f3e2bc;
  --cyan: #79e7ff;
  --red: #e23b32;
  --text: #e7edf2;
  --dim: #8b97a3;
  --font: Rajdhani, "Arial Narrow", sans-serif;
  --mono: "Share Tech Mono", ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: 0.45; cursor: wait; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
a { color: var(--amber); }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(42px, 7vw, 68px); line-height: 0.88; letter-spacing: 0.03em; }
h1 em { font-style: normal; color: var(--amber); }
h2 { font-size: 32px; letter-spacing: 0.08em; margin: 0 0 12px; }
.kicker { font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; color: var(--amber); margin: 0 0 8px; }
.lede { max-width: 36ch; color: #c5d0da; margin: 10px 0 16px; }
.fine { color: var(--dim); font-size: 13px; line-height: 1.4; }
.lbl { display: flex; justify-content: space-between; margin: 12px 0 6px; letter-spacing: 0.14em; font-size: 12px; color: var(--dim); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.frame { position: relative; background: var(--panel); border: 1px solid var(--line); padding: 16px; }
.frame::before, .frame::after { content: ""; position: absolute; width: 12px; height: 12px; border-color: var(--amber); border-style: solid; pointer-events: none; }
.frame::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.frame::after { right: -1px; bottom: -1px; border-width: 0 2px 2px 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
button, .opt {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--amber-2);
  letter-spacing: 0.12em;
  padding: 10px 12px;
}
button.primary, button.go, button.fire {
  background: var(--amber);
  color: #1a1206;
  border-color: var(--amber);
  font-weight: 700;
}
button.text { border-color: transparent; padding-inline: 8px; }
button.go { min-width: 140px; }
input[type="text"], input:not([type]), #callsign, #room-input, #chat-input {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(231, 237, 242, 0.2);
  padding: 10px 12px;
  width: 100%;
  min-width: 0;
}
select { width: 100%; background: #10141c; border: 1px solid rgba(231, 237, 242, 0.2); padding: 8px; }
.spin { width: 10px; height: 10px; border: 2px solid rgba(228, 177, 90, 0.3); border-top-color: var(--amber); border-radius: 50%; display: inline-block; animation: spin 0.8s linear infinite; }
body:not(.loading) .spin { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; background: #07080c; }
#hurt { position: fixed; inset: 0; z-index: 2; pointer-events: none; box-shadow: inset 0 0 14vw 4vw rgba(176, 20, 16, var(--hurt, 0)); }
body[data-camo="1"] #hurt { box-shadow: inset 0 0 14vw 4vw rgba(176, 20, 16, var(--hurt, 0)), inset 0 0 90px 18px rgba(170, 255, 220, 0.28); }
#scope { position: fixed; inset: 0; z-index: 3; pointer-events: none; display: none; background: linear-gradient(rgba(0,0,0,0.85), rgba(0,0,0,0.85)) center/1px 22% no-repeat, linear-gradient(rgba(0,0,0,0.85), rgba(0,0,0,0.85)) center/22% 1px no-repeat, radial-gradient(circle at center, transparent 17%, #05060a 17.8%); }
body[data-scope="1"] #scope { display: block; }
#reticle { position: fixed; left: 50%; top: 50%; width: 18px; height: 18px; transform: translate(-50%, -50%); z-index: 5; pointer-events: none; opacity: 0; }
#reticle i { position: absolute; background: rgba(232, 244, 236, 0.92); }
#reticle i:nth-child(1) { left: 8px; top: 0; width: 2px; height: 5px; }
#reticle i:nth-child(2) { left: 8px; bottom: 0; width: 2px; height: 5px; }
#reticle i:nth-child(3) { top: 8px; left: 0; width: 5px; height: 2px; }
#reticle i:nth-child(4) { top: 8px; right: 0; width: 5px; height: 2px; }
body[data-phase="play"] #reticle { opacity: 1; }
body[data-scope="1"] #reticle { opacity: 0; }
body[data-weapon="4"] #reticle i, body[data-weapon="5"] #reticle i { background: #7dffe8; }
body[data-weapon="6"] #reticle i { background: #ff7ad9; }
body[data-weapon="7"] #reticle i { background: #ffb15a; }
#marker { position: fixed; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px; transform: rotate(45deg); border: 2px solid transparent; z-index: 6; pointer-events: none; opacity: 0; }
body[data-phase="play"][data-hit="1"] #marker { opacity: 1; border-color: #fff; }
body[data-phase="play"][data-head="1"] #marker { border-color: #ffb14a; }
#announce, #respawn-label, #prompt { position: fixed; left: 50%; transform: translateX(-50%); z-index: 5; pointer-events: none; text-align: center; }
#announce { top: 22%; font-size: clamp(32px, 6vw, 72px); letter-spacing: 0.16em; font-weight: 700; color: var(--amber-2); text-shadow: 0 2px 0 #000; }
#respawn-label { top: 40%; letter-spacing: 0.2em; }
#prompt { bottom: 27%; color: var(--amber); letter-spacing: 0.16em; font-size: 14px; }
#announce:empty, #respawn-label:empty, #prompt:empty, #boot-error:empty { display: none; }
#feed { position: fixed; top: 52px; right: 16px; width: min(340px, 46vw); z-index: 5; text-align: right; font-family: var(--mono); font-size: 12px; pointer-events: none; }
#feed div { padding: 2px 0; }
#statusline { display: none; position: fixed; top: 14px; right: 16px; z-index: 7; gap: 10px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; color: var(--dim); }
body[data-phase="lobby"] #statusline, body[data-phase="play"] #statusline, body[data-phase="post"] #statusline { display: flex; }

#boot { display: none; position: relative; z-index: 3; min-height: 100%; overflow: auto; background: radial-gradient(900px 480px at 78% 8%, rgba(228, 177, 90, 0.16), transparent 60%), radial-gradient(700px 420px at 8% 90%, rgba(61, 125, 255, 0.12), transparent 55%), linear-gradient(#121722, #07080c 42%); }
body[data-phase="boot"] #boot, body[data-phase="connecting"] #boot { display: block; }
body[data-phase="boot"], body[data-phase="connecting"], body[data-phase="lobby"] { overflow: auto; }
.wrap { width: min(1080px, 100%); margin: 0 auto; padding: 20px 16px 32px; }
.mast, .mast-side, .brand { display: flex; align-items: center; gap: 12px; }
.mast { justify-content: space-between; margin-bottom: 18px; }
.brand { color: inherit; text-decoration: none; }
.brand svg { width: 42px; height: 42px; color: var(--amber); }
.brand strong { display: block; font-size: 22px; letter-spacing: 0.16em; }
.brand small { color: var(--dim); letter-spacing: 0.18em; }
.status { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; color: var(--dim); }
.status i { width: 8px; height: 8px; border-radius: 50%; background: #8b97a3; display: inline-block; }
.status[data-ok="1"] i { background: #7dffa8; }
.boot-grid { display: grid; grid-template-columns: minmax(280px, 440px) minmax(260px, 1fr); gap: 16px; }
.boot-grid > * { min-width: 0; }
.side { display: grid; gap: 12px; align-content: start; }
.deploy { display: grid; gap: 10px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 28px; height: 28px; padding: 0; border-radius: 50%; background: var(--swatch); border: 2px solid transparent; }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 2px var(--amber); }
#join-public { display: flex; justify-content: space-between; align-items: center; text-align: left; }
#join-public small { font-weight: 500; letter-spacing: 0.04em; opacity: 0.75; }
.rooms { display: grid; gap: 6px; max-height: 220px; overflow: auto; }
.room { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; width: 100%; text-align: left; }
.room span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); }
.empty { color: var(--dim); padding: 8px 0; }
details summary { cursor: pointer; letter-spacing: 0.14em; color: var(--amber); }
.notes { list-style: none; padding: 8px 0 0; margin: 0; display: grid; gap: 8px; }
.notes li { display: grid; gap: 2px; }
.notes b { letter-spacing: 0.06em; }
.notes span, #map-blurb, #mode-blurb { color: var(--dim); font-size: 14px; }
.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 18px; color: var(--dim); font-size: 12px; letter-spacing: 0.12em; }

#lobby { display: none; position: fixed; inset: 0; z-index: 3; padding: 12px; gap: 12px; pointer-events: none; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr) minmax(240px, 320px); grid-template-rows: auto minmax(160px, 1fr) auto; }
body[data-phase="lobby"] #lobby { display: grid; }
#lobby > * { pointer-events: auto; min-width: 0; }
#lobby .vista { pointer-events: none; }
#lobby .top { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-right: 150px; }
#lobby .roster-panel { grid-column: 1; grid-row: 2; overflow: auto; }
#lobby .vista { grid-column: 2; grid-row: 2; }
#lobby .rules-panel { grid-column: 3; grid-row: 2; overflow: auto; }
#lobby .launch-slot { grid-column: 2 / 4; grid-row: 3; display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
#room-code { display: block; color: var(--amber); letter-spacing: 0.18em; }
.opts { display: grid; gap: 6px; }
.opt { display: flex; justify-content: space-between; gap: 8px; width: 100%; text-align: left; }
.opt span { color: var(--dim); }
body[data-host="0"] .host-only { pointer-events: none; }
body[data-host="0"] .hide-guest { display: none; }
body[data-teams="0"] .teams { display: none; }
#roster { display: grid; }
.slot { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.slot b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot.red b { color: #ff8d84; }
.slot.blue b { color: #8eb6ff; }
.slot.ffa b { color: var(--amber-2); }
.slot span, .slot em { color: var(--dim); font-style: normal; font-size: 12px; letter-spacing: 0.08em; }
#auto-label { margin-right: auto; letter-spacing: 0.14em; color: var(--amber-2); }

#chat-dock { display: none; position: fixed; z-index: 6; gap: 6px; flex-direction: column; }
body[data-phase="lobby"] #chat-dock { display: flex; left: 16px; bottom: 16px; width: min(320px, calc(100% - 32px)); }
body[data-phase="lobby"] .roster-panel { margin-bottom: 168px; }
body[data-phase="play"] #chat-dock, body[data-phase="post"] #chat-dock { display: flex; top: 56px; left: 12px; width: min(300px, 72vw); }
body[data-phase="play"] #chat-form, body[data-phase="post"] #chat-form { display: none; }
body[data-phase="play"].chatting #chat-form, body[data-phase="post"].chatting #chat-form { display: flex; }
#chat-log { max-height: 140px; overflow: auto; font-family: var(--mono); font-size: 12px; line-height: 1.45; }
body[data-phase="play"] #chat-log, body[data-phase="post"] #chat-log { background: rgba(0,0,0,0.4); padding: 6px 8px; }
#chat-form { display: flex; }
#chat-input { pointer-events: auto; }

#hud { display: none; }
body[data-phase="play"] #hud, body[data-phase="post"] #hud { display: block; }
#hud { pointer-events: none; }
#hud .hit { pointer-events: auto; }
.score { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 16px; z-index: 5; font-variant-numeric: tabular-nums; }
#score-left, #score-right { font-size: 28px; }
#score-left { color: #ff8d84; }
#score-right { color: #8eb6ff; }
body[data-teams="0"] #score-left { color: var(--amber-2); }
body[data-teams="0"] #score-right { color: var(--dim); }
#score-mid { font-family: var(--mono); letter-spacing: 0.12em; }
#pause-map { display: block; text-align: center; color: var(--dim); font-size: 11px; letter-spacing: 0.12em; }
#hud-pause { position: fixed; top: 12px; left: 12px; z-index: 6; }
.radar-wrap { position: fixed; left: 16px; bottom: 16px; z-index: 5; }
.radar { width: 128px; height: 128px; border-radius: 50%; border: 1px solid rgba(121, 231, 255, 0.5); background: rgba(4, 14, 16, 0.55); position: relative; overflow: hidden; }
.radar b { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px; background: var(--cyan); }
.radar span { position: absolute; right: 10px; bottom: 8px; font-size: 10px; color: rgba(121, 231, 255, 0.75); }
#blips { position: absolute; inset: 0; }
#blips i { position: absolute; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: #ff5a4e; box-shadow: 0 0 6px #ff5a4e; }
@property --sweep { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.radar::after { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: conic-gradient(from var(--sweep), transparent 0 300deg, rgba(121, 231, 255, 0.4) 360deg); animation: sweep 3.4s linear infinite; pointer-events: none; }
@keyframes sweep { to { --sweep: 360deg; } }
.vitals { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); width: min(340px, 72vw); z-index: 5; }
.track { height: 7px; background: rgba(255,255,255,0.08); margin: 4px 0; overflow: hidden; }
.track.shield { height: 10px; }
#shield-fill { display: block; height: 100%; background: var(--cyan); width: 100%; }
#health-fill { display: block; height: 100%; background: var(--red); width: 100%; }
body[data-os="1"] #shield-fill { background: #f2e7a8; box-shadow: 0 0 10px #f2e7a8; }
body[data-low="1"] #shield-fill { animation: low 0.45s steps(2) infinite; }
@keyframes low { 50% { opacity: 0.35; } }
.read { display: flex; justify-content: space-between; font-size: 12px; letter-spacing: 0.14em; }
.weapon { position: fixed; right: 18px; bottom: 18px; text-align: right; z-index: 5; }
#weapon-name { letter-spacing: 0.16em; font-size: 13px; color: var(--amber); }
.ammo { font-size: 42px; line-height: 0.9; font-weight: 700; }
#reserve { color: var(--dim); font-size: 16px; margin-left: 6px; }
.nades { display: flex; justify-content: flex-end; gap: 10px; letter-spacing: 0.1em; font-size: 12px; }
.nades span { opacity: 0.4; }
body[data-gsel="0"] .frag, body[data-gsel="1"] .plasma { opacity: 1; color: var(--amber-2); }
#flash-pip { font-style: normal; font-size: 11px; letter-spacing: 0.14em; opacity: 0.35; }
body[data-flash="1"] #flash-pip { opacity: 1; color: #d7f6ff; }
.hints { position: fixed; left: 50%; bottom: 6px; transform: translateX(-50%); display: flex; gap: 12px; font-size: 11px; letter-spacing: 0.12em; color: var(--dim); z-index: 5; }
.turn { display: none; }
body[data-protect="1"] #hud::before { content: ""; position: fixed; inset: 8px; border: 1px solid rgba(228, 177, 90, 0.5); pointer-events: none; }

#board, #summary, #pause { display: none; position: fixed; inset: 0; z-index: 9; place-items: center; background: rgba(5, 6, 8, 0.72); padding: 16px; }
body[data-board="1"] #board { display: grid; }
body[data-phase="post"] #summary { display: grid; }
body.menu-open[data-phase="play"] #pause { display: grid; }
body[data-phase="post"] #pause, body[data-phase="post"] #capture { display: none !important; }
#board .panel, #summary .frame, #pause .frame { width: min(640px, 100%); max-height: calc(100% - 24px); overflow: auto; }
#pause .frame, #summary .frame { display: grid; gap: 10px; }
.sb-head, .sb-row { display: grid; grid-template-columns: 1.6fr repeat(5, 0.5fr); gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.sb-head { color: var(--dim); font-size: 11px; letter-spacing: 0.12em; }
.sb-row.red span:first-child { color: #ff8d84; }
.sb-row.blue span:first-child { color: #8eb6ff; }
#capture { display: none; position: fixed; inset: 0; z-index: 8; place-items: center; background: rgba(0, 0, 0, 0.28); border: 0; letter-spacing: 0.18em; font-size: 18px; }
body[data-phase="play"][data-paused="1"]:not(.menu-open):not(.has-touch) #capture { display: grid; }

#touch { display: none; position: fixed; inset: 0; z-index: 7; pointer-events: none; }
body.has-touch[data-phase="play"] #touch, body.has-touch[data-phase="post"] #touch { display: block; }
#touch .hit { pointer-events: auto; touch-action: none; }
.lookpad { position: absolute; top: 0; right: 0; width: 56%; height: 100%; }
.lookpad span { position: absolute; right: 18px; top: 46%; letter-spacing: 0.2em; opacity: 0.35; font-size: 12px; }
.stick { position: absolute; left: 18px; bottom: 18px; width: 132px; height: 132px; border-radius: 50%; border: 1px solid rgba(228, 177, 90, 0.45); background: rgba(0, 0, 0, 0.28); }
.stick i { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px; border-radius: 50%; background: rgba(228, 177, 90, 0.8); }
.tbtns { position: absolute; right: 14px; bottom: 14px; display: grid; grid-template-columns: 64px 64px; gap: 8px; }
.tbtns button { min-height: 52px; }
#touch-pause { position: absolute; top: 12px; right: 12px; }
body.has-touch #hud-pause { display: none; }
body.has-touch .hints, body.has-touch .turn { pointer-events: none; }
body.has-touch .turn { display: block; position: fixed; top: 52px; left: 50%; transform: translateX(-50%); z-index: 6; font-size: 12px; letter-spacing: 0.12em; color: var(--amber-2); }
@media (orientation: landscape) { body.has-touch .turn { display: none; } }
body.has-touch .vitals { bottom: 14px; width: min(220px, 34vw); }
body.has-touch .weapon { right: 148px; bottom: 78px; }
body.has-touch .radar-wrap { left: 132px; bottom: 22px; }
body.has-touch .radar { width: 84px; height: 84px; }
body.has-touch .stick { width: 112px; height: 112px; }
body.has-touch .tbtns { grid-template-columns: 56px 56px; gap: 6px; right: 10px; bottom: 10px; }
body.has-touch .tbtns button { min-height: 44px; }
body.has-touch[data-phase="play"] #chat-dock,
body.has-touch[data-phase="post"] #chat-dock { width: min(220px, 42vw); }

#boot-error { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 12; background: #3a1412; color: #ffd0c8; padding: 8px 12px; max-width: min(520px, calc(100% - 24px)); }
#toast { position: fixed; left: 50%; bottom: 56px; transform: translateX(-50%); z-index: 12; background: #141820; border: 1px solid var(--line); padding: 8px 12px; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
#toast.on { opacity: 1; }
dialog { width: min(440px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto; background: #10141c; color: var(--text); border: 1px solid var(--line); padding: 18px; }
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.check { display: flex; gap: 8px; align-items: center; margin: 10px 0; }
dialog .primary { margin-top: 12px; }

body.doc { overflow: auto; height: auto; min-height: 100%; background: radial-gradient(800px 360px at 15% 0%, rgba(228, 177, 90, 0.12), transparent 50%), #07080c; }
body.doc main { width: min(760px, 100%); margin: 0 auto; padding: 40px 20px 72px; }
body.doc pre, pre.changelog { white-space: pre-wrap; font-family: var(--mono); font-size: 13px; line-height: 1.55; color: #d5dde6; }

@media (max-width: 860px) {
  .boot-grid { grid-template-columns: 1fr; }
  .mast { align-items: flex-start; }
  .mast-side { flex-direction: column; align-items: flex-end; }
  #lobby { position: absolute; display: none; overflow: auto; background: rgba(7, 8, 12, 0.55); grid-template-columns: 1fr; }
  body[data-phase="lobby"] #lobby { display: flex; flex-direction: column; padding-bottom: 190px; }
  #lobby .top { padding-right: 12px; flex-wrap: wrap; }
  #lobby .vista { height: 180px; order: 2; }
  #lobby .launch-slot { order: 1; justify-content: stretch; }
  #lobby .launch-slot .go { flex: 1; }
  #lobby .roster-panel { order: 3; margin-bottom: 0; }
  #lobby .rules-panel { order: 4; }
  body[data-phase="lobby"] #chat-dock { right: 12px; left: 12px; width: auto; }
  .hints { display: none; }
  .ammo { font-size: 32px; }
  .radar { width: 96px; height: 96px; }
  #statusline { display: none !important; }
}
@media (max-width: 520px) {
  .sb-head, .sb-row { font-size: 12px; gap: 4px; }
  h1 { font-size: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .spin, .radar::after, .brand svg { animation: none; }
}
