:root {
  --cyan: #5ff4ff;
  --cyan-dim: rgba(95, 244, 255, 0.5);
  --ink: #e9f7ff;
  --panel: rgba(5, 22, 36, 0.8);
  --line: rgba(95, 244, 255, 0.34);
  --amber: #ffcf55;
  --red: #ff5048;
  font-family: "Oxanium", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #061424; color: var(--ink); }
[hidden] { display: none !important; }
canvas#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; outline: none; }
#hudwrap { position: fixed; inset: 0; pointer-events: none; }
canvas#hud { position: absolute; inset: 0; width: 100%; height: 100%; }
#fps { position: fixed; left: 8px; top: 6px; font-size: 11px; color: var(--cyan-dim); pointer-events: none; letter-spacing: 0.04em; }

#overlay { position: fixed; inset: 0; overflow: auto; display: flex; align-items: center; justify-content: center; padding: 22px;
  background: linear-gradient(90deg, rgba(3, 12, 22, 0.6), rgba(3, 12, 22, 0.1) 46%, rgba(3, 12, 22, 0.1)); }
.screen { width: 100%; display: flex; justify-content: flex-start; max-height: 100%; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 26px 30px; backdrop-filter: blur(9px);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5), inset 0 0 40px rgba(95, 244, 255, 0.05); max-width: 520px; width: 100%; max-height: calc(100vh - 44px); overflow-y: auto; }
.card.wide { max-width: 880px; margin: auto; }
h1 { margin: 2px 0; font-size: 62px; letter-spacing: 0.03em; font-weight: 800; line-height: 1; color: #fff; text-shadow: 0 0 22px rgba(95, 244, 255, 0.55); }
h1 span { color: var(--cyan); margin-left: 12px; }
h2 { margin: 2px 0 8px; font-size: 26px; letter-spacing: 0.03em; color: #fff; }
h3 { margin: 16px 0 7px; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--cyan); font-weight: 700; }
p { margin: 8px 0; line-height: 1.45; }
.eyebrow { margin: 0; font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--cyan); }
.tag { font-size: 18px; color: #c9e6f2; margin-top: 2px; }
#who { color: var(--amber); font-weight: 600; }
button { font: inherit; color: inherit; cursor: pointer; }
.primary { background: linear-gradient(180deg, #49e3f0, #1d9fb5); color: #02151f; border: 0; border-radius: 4px; padding: 13px 32px; font-size: 17px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.primary:hover:not(:disabled) { background: linear-gradient(180deg, #8ff4fb, #33bdd2); }
.primary:disabled { opacity: 0.55; cursor: default; }
.ghost { background: transparent; border: 1px solid var(--line); border-radius: 4px; padding: 10px 16px; color: var(--ink); }
.ghost:hover { border-color: var(--cyan); background: rgba(95, 244, 255, 0.08); }
.hub-btn { color: var(--ink); border: 1px solid var(--line); border-radius: 4px; padding: 10px 14px; text-decoration: none; display: inline-block; }
.hub-btn:hover { border-color: var(--cyan); }
.foot { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-top: 18px; flex-wrap: wrap; }
.quality { font-size: 13px; color: var(--cyan-dim); display: flex; align-items: center; gap: 6px; }
select { background: #0a2537; color: var(--ink); border: 1px solid var(--line); border-radius: 4px; padding: 7px; font: inherit; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0 6px; }
.stat { border: 1px solid var(--line); border-radius: 4px; padding: 8px; text-align: center; background: rgba(95, 244, 255, 0.05); }
.stat b { display: block; font-size: 22px; color: #fff; }
.stat span { font-size: 11px; color: var(--cyan-dim); letter-spacing: 0.08em; text-transform: uppercase; }
.how { margin: 12px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.5; color: #b9d6e3; }
.how b { color: #fff; }

.row-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.pilot { color: #b9d6e3; margin: 0; }
.pilot b { color: var(--amber); }
#session-list { display: flex; flex-direction: column; gap: 8px; min-height: 120px; max-height: 44vh; overflow-y: auto; margin-top: 10px; }
.session { display: grid; grid-template-columns: 136px 1fr auto; gap: 14px; align-items: center; text-align: left; background: rgba(95, 244, 255, 0.05); border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; }
.session:hover:not(:disabled) { border-color: var(--cyan); background: rgba(95, 244, 255, 0.13); }
.session:disabled { opacity: 0.55; cursor: not-allowed; }
.session-main strong, .session-meta strong { display: block; color: #fff; font-size: 15px; }
.session-main span, .session-meta span { color: #9dbecd; font-size: 13px; }
.session-meta { text-align: right; }
.session-flags { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--cyan-dim); }
.ffa-badge { color: var(--amber); font-weight: 800; letter-spacing: 0.12em; font-size: 18px; padding-left: 8px; }
canvas.flag { border-radius: 2px; display: block; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5); }
.empty { color: #9dbecd; padding: 26px 8px; text-align: center; }

.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.choice, .role { display: block; text-align: left; background: rgba(95, 244, 255, 0.05); border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; }
.choice strong, .role strong { display: block; color: #fff; font-size: 15px; }
.choice span, .role span { display: block; color: #9dbecd; font-size: 12.5px; margin-top: 3px; line-height: 1.35; }
.choice.on, .role.on, .teambtn.on, .flagbtn.on { border-color: var(--cyan); background: rgba(95, 244, 255, 0.18); box-shadow: inset 0 0 0 1px var(--cyan); }
.choice:hover, .role:hover:not(:disabled), .teambtn:hover, .flagbtn:hover:not(:disabled) { border-color: var(--cyan); }
.role:disabled { opacity: 0.5; cursor: not-allowed; }
.flags { display: flex; gap: 7px; flex-wrap: wrap; }
.flagbtn { background: rgba(95, 244, 255, 0.05); border: 1px solid var(--line); border-radius: 4px; padding: 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; min-width: 84px; }
.flagbtn.small { min-width: 0; }
.flagbtn:disabled { opacity: 0.3; cursor: not-allowed; }
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.teambtn { display: flex; align-items: center; gap: 12px; text-align: left; background: rgba(95, 244, 255, 0.05); border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; }
.teambtn strong { display: block; color: #fff; }
.teambtn span { color: #9dbecd; font-size: 12.5px; }
.roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }

#toast { position: fixed; left: 50%; top: 66px; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 8px 16px; font-size: 14px; pointer-events: none; z-index: 40; }
#feed { position: absolute; left: 22px; top: 42px; display: flex; flex-direction: column; gap: 3px; font-size: 13px; max-width: 42vw; }
.feed-row { background: rgba(3, 18, 30, 0.54); border-left: 2px solid var(--cyan-dim); padding: 3px 9px; color: #dff4fb; }
.feed-row.me { border-left-color: var(--amber); color: var(--amber); font-weight: 700; }
.feed-row.dead { border-left-color: var(--red); color: #ffb9b5; }
#death { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); text-align: center; text-shadow: 0 2px 10px #000; }
#death h2 { font-size: 30px; color: #ff6d65; margin: 0 0 8px; }
#death p { margin: 4px; font-size: 17px; }
#death .hint { font-size: 13px; color: #c9e6f2; }
#scoreboard { position: absolute; left: 50%; top: 80px; transform: translateX(-50%); background: rgba(3, 18, 30, 0.86); border: 1px solid var(--line); border-radius: 6px; padding: 14px 18px; width: min(860px, 94vw); }
#scoreboard h2 { font-size: 16px; color: var(--cyan); margin: 0 0 8px; letter-spacing: 0.1em; text-transform: uppercase; }
.board { display: flex; gap: 14px; flex-wrap: wrap; }
.board-col { flex: 1 1 340px; min-width: 0; }
.board-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; color: #fff; }
.board table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.board th { text-align: right; color: var(--cyan-dim); font-weight: 600; padding: 3px 5px; font-size: 11px; letter-spacing: 0.04em; }
.board th:first-child, .board td:first-child { text-align: left; }
.board th:nth-child(2), .board td:nth-child(2) { text-align: left; color: #9dbecd; }
.board td { text-align: right; padding: 3px 5px; border-top: 1px solid rgba(95, 244, 255, 0.12); }
.board tr.me td { color: var(--amber); font-weight: 700; }
#results { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
#results .card { max-width: 900px; }
#results h2 { font-size: 40px; text-align: center; }
#results h2.won { color: var(--amber); text-shadow: 0 0 18px rgba(255, 207, 85, 0.6); }
#results-reason, #results-next { text-align: center; color: #c9e6f2; }

@media (max-width: 720px) {
  h1 { font-size: 46px; }
  .session { grid-template-columns: 1fr; }
  .session-meta { text-align: left; }
  .teams { grid-template-columns: 1fr; }
  .card { padding: 18px; }
}
