:root {
  --bg: #0b0d10;
  --ink: #e8ecf1;
  --muted: #8a94a3;
  --panel: rgba(12, 15, 20, 0.78);
  --t: #e8a33d;
  --ct: #5aa0f0;
  --live: #e5484d;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.4 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow: hidden;
}

/* The stage holds the whole page, so that one transform can turn it on an upright phone. Sizes inside it
   use the stage's container units (cqw, cqh), which stay right after the turn. */
#stage { position: fixed; inset: 0; overflow: hidden; container-type: size; container-name: stage; --map: 30cqh; --squad-h: 190px; }
#radar, #view3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#view3d[hidden] { display: none; }

.bar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: linear-gradient(var(--panel), transparent);
}
.brand { color: var(--ink); font-weight: 800; letter-spacing: 0.12em; text-decoration: none; }
.live {
  background: var(--live); color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 6px; border-radius: 3px; letter-spacing: 0.08em;
}
.channel { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spacer { flex: 1; }
.director { color: var(--muted); font-size: 12px; display: flex; gap: 6px; align-items: center; }
select, button {
  background: #1a1f27; color: var(--ink); border: 1px solid #2b323d; border-radius: 4px;
  font: inherit; padding: 3px 6px;
}
button { cursor: pointer; }
#follow { max-width: 12em; }

.score {
  position: absolute; top: 52px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 14px; align-items: baseline;
  background: var(--panel); padding: 6px 14px; border-radius: 6px;
  font-variant-numeric: tabular-nums;
}
/* The planted bomb: its icon in the clock's place, and a red line under the score that runs out with it. */
.c4 { color: #ff3b30; min-width: 4.5em; display: inline-flex; justify-content: center; align-self: center; animation: c4 1s ease-in-out infinite; }
.c4.soon { animation-duration: 0.35s; }
.c4[hidden], .clock[hidden], .c4-bar[hidden] { display: none; }
@keyframes c4 { 50% { opacity: 0.45; } }
.c4-bar { position: absolute; left: 0; right: 0; bottom: -4px; height: 4px; background: rgba(0, 0, 0, 0.55); border-radius: 0 0 3px 3px; overflow: hidden; }
.c4-bar i { display: block; height: 100%; width: 100%; background: #ff3b30; transform-origin: left; }
.team { font-weight: 600; }
.team b { font-size: 20px; }
.team.t { color: var(--t); }
.team.ct { color: var(--ct); }
.clock { font-size: 18px; min-width: 3.5em; text-align: center; }

.feed {
  position: absolute; top: 52px; right: 16px; margin: 0; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 4px; align-items: flex-end;
  max-width: calc(100% - 32px);
}
.feed li {
  background: var(--panel); padding: 3px 8px; border-radius: 4px; white-space: nowrap;
  font-size: 13px; animation: in 0.25s ease-out;
}
.hud-icon { display: inline-block; background: currentColor; vertical-align: middle; flex-shrink: 0; }
.feed .w { color: #ffa000; margin: 0 8px; font-size: 12px; display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; }
.feed .t { color: var(--t); }
.feed .ct { color: var(--ct); }
@keyframes in { from { opacity: 0; transform: translateX(12px); } }

.caption {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 12px;
  padding: 12px 16px; background: linear-gradient(transparent, var(--panel));
  pointer-events: none;
}
.caption a, .caption button, .caption select { pointer-events: auto; }
.camera { font-size: 18px; font-weight: 700; }
.camera small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.meta { color: var(--muted); font-size: 12px; text-align: right; }
.info { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; min-width: 0; }
/* A POV demo: who recorded it. The title says what that means for the other players. */
.pov-note { font-size: 12px; text-align: right; pointer-events: auto; cursor: help; }
.pov-note::before { content: '!'; display: inline-block; width: 1.3em; margin-right: 6px; border-radius: 50%; background: var(--t); color: #111; font-weight: 800; text-align: center; }
.pov-note[hidden] { display: none; }

.card {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center;
  background: radial-gradient(circle at center, #151a22, var(--bg) 70%); padding: 16px;
}
.card[hidden] { display: none; }

.loader {
  position: absolute; inset: 0; z-index: 10; display: grid; place-content: center; justify-items: center; gap: 14px;
  background: radial-gradient(circle at center, #151a22, var(--bg) 70%); transition: opacity 0.3s ease-out;
}
.loader[hidden] { display: none; }
.loader.done { opacity: 0; pointer-events: none; }
.loader.waiting { background: rgb(0 0 0 / 0.45); pointer-events: none; }
.loader.waiting .loader-brand { display: none; }
.loader.failed .loader-bar { display: none; }
.loader.failed .loader-text { color: inherit; }
.loader-brand { margin: 0; font-weight: 800; letter-spacing: 0.24em; font-size: 18px; }
.loader-bar { width: min(320px, 60cqw); height: 4px; border-radius: 2px; background: #222a35; overflow: hidden; }
.loader-bar span { display: block; height: 100%; width: 0; background: var(--live); transition: width 0.2s ease-out; }
.loader-text { margin: 0; color: var(--muted); font-size: 13px; min-height: 1.4em; }
.card-kicker { color: var(--live); font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; margin: 0; }
.card h1 { font-size: clamp(28px, 6vw, 56px); margin: 8px 0; }
.card p { color: var(--muted); margin: 4px 0; }
.card-count { font-variant-numeric: tabular-nums; font-size: 20px; margin-top: 12px !important; }
.card-map { font-size: 18px; }
.card-players { display: grid; gap: 6px; margin-top: 14px; max-width: min(900px, 90cqw); }
.card-players p { margin: 0; line-height: 1.4; }
.card-players b { font-weight: 700; }
.card-players b.t { color: var(--t); }
.card-players b.ct { color: var(--ct); }
/* The title card covers the stage: the insets of the views have nothing to show over it. */
body[data-card] .pip, body[data-card] .minimap { display: none; }

.chat {
  position: absolute; left: 16px; bottom: 82px; margin: 0; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 2px; max-width: min(560px, calc(100% - 32px));
}
.chat li {
  background: rgba(12, 15, 20, 0.6); padding: 2px 8px; border-radius: 3px; font-size: 13px;
  overflow-wrap: anywhere; animation: in 0.25s ease-out;
}
.chat .t { color: var(--t); }
.chat .ct { color: var(--ct); }
.chat .spec { color: var(--muted); }
.chat .viewer { color: #a3e635; }
.chat .smiley { height: 15px; vertical-align: text-bottom; }
/* The say line of a viewer on gamerz.ba (Y or Enter), under the chat box as in CS. */
.say {
  position: absolute; left: 16px; bottom: 52px; display: flex; align-items: center; gap: 6px;
  width: min(560px, calc(100% - 32px)); background: rgba(12, 15, 20, 0.85); padding: 4px 8px; border-radius: 3px;
}
.say[hidden] { display: none; }
.say label { color: #a3e635; font-size: 13px; font-weight: 700; }
.say input { flex: 1; min-width: 0; background: transparent; border: 0; color: inherit; font: inherit; font-size: 13px; outline: none; }
.say-error { color: #f87171; font-size: 12px; white-space: nowrap; }
.say-error[hidden] { display: none; }

.board {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(720px, calc(100% - 32px)); max-height: calc(100% - 120px); overflow: auto;
  background: rgba(10, 12, 16, 0.92); border: 1px solid #2b323d; border-radius: 8px; padding: 12px 16px;
  font-variant-numeric: tabular-nums;
  /* Over the map, the frames and the inset (z-index 2), under the settings panel (5). */
  z-index: 4;
}
.board[hidden] { display: none; }
.board-team + .board-team { margin-top: 14px; }
.board-team header { display: flex; align-items: baseline; gap: 12px; border-bottom: 1px solid currentColor; padding-bottom: 4px; }
.board-team.t { color: var(--t); }
.board-team.ct { color: var(--ct); }
.board-team h2 { margin: 0; font-size: 16px; flex: 1; }
.board-score { font-size: 20px; font-weight: 700; }
.board-alive { color: var(--muted); font-size: 12px; }
.board table { width: 100%; border-collapse: collapse; margin-top: 4px; }
.board th { color: var(--muted); font-weight: 400; font-size: 11px; text-align: left; padding: 2px 6px; }
.board td { padding: 3px 6px; color: inherit; }
.board .num { text-align: right; width: 4.5em; }
.board .mark { color: var(--muted); font-size: 12px; width: 4.5em; }
.board .gun { width: 4em; }
.board .gun .icon { display: block; }
.board tr.dead td { opacity: 0.5; }
.board-spectators { color: var(--muted); font-size: 12px; margin: 12px 0 0; }
#board-toggle[aria-pressed="true"] { border-color: var(--live); }

.pip, .minimap {
  position: absolute; z-index: 2; pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 6px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}
.pip { right: 16px; bottom: 84px; width: calc(26cqh * 16 / 9); height: 26cqh; }
/* With the players' cards in the bottom corners, the inset stands over the right one. */
/* The cards show only on a stage that is not short or narrow (see below): so do the rules made for them. */
@container stage (min-width: 641px) and (min-height: 521px) {
  #stage.with-squads .pip { bottom: calc(96px + var(--squad-h) + 10px); width: calc(22cqh * 16 / 9); height: 22cqh; }
}
.pip span {
  position: absolute; left: 6px; top: 4px; font-size: 11px; color: #fff;
  background: rgba(0, 0, 0, 0.55); padding: 1px 6px; border-radius: 3px; letter-spacing: 0.06em;
}
/* The map in the top left corner, where the game draws its radar. */
.minimap { left: 16px; top: 52px; width: var(--map); height: var(--map); background: rgba(8, 10, 14, 0.85); overflow: hidden; }
.minimap canvas { width: 100%; height: 100%; display: block; }
.pip[hidden], .minimap[hidden] { display: none; }

/* The clip in first person, as the game's HUD shows it: an estimate (src/shared/ammo.js). Over the inset
   where the inset shows. */
.ammo {
  position: absolute; right: 16px; bottom: 84px; z-index: 2; pointer-events: auto;
  color: rgba(255, 160, 0, 0.9); font-variant-numeric: tabular-nums; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}
.ammo b { font-size: clamp(22px, 5cqh, 40px); font-weight: 800; }
.ammo.beside-map { bottom: calc(84px + 26cqh + 10px); }
@container stage (min-width: 641px) and (min-height: 521px) {
  #stage.with-squads .ammo { display: none; }
}
/* The frames a second in the top left corner, as cl_showfps 1 shows them in the game; beside the map when it is there. */
.fps {
  position: absolute; left: 16px; top: 46px; z-index: 2; pointer-events: none;
  color: rgba(255, 160, 0, 0.9); font: 600 13px/1 ui-monospace, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}
#stage.with-map .fps { left: calc(16px + var(--map) + 10px); top: 56px; }
.ammo[hidden] { display: none; }

.settings {
  position: absolute; top: 52px; right: 16px; z-index: 5; min-width: 220px;
  background: rgba(12, 15, 20, 0.95); border: 1px solid #2b323d; border-radius: 8px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px; font-size: 13px;
}
.settings[hidden] { display: none; }
.settings-title { margin: 0 0 2px; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.settings label { display: flex; gap: 8px; align-items: center; cursor: pointer; }

.rounds { position: absolute; left: 16px; right: 16px; bottom: 58px; height: 10px; pointer-events: none; }
.rounds canvas { width: 100%; height: 100%; display: block; }
/* In a replay the strip seeks: a taller box around the same thin strip is easier to hit. */
.rounds.seekable { pointer-events: auto; cursor: pointer; touch-action: none; height: 26px; bottom: 60px; padding: 8px 0; }

.transport { display: flex; gap: 6px; align-items: center; margin-bottom: 2px; }
.transport[hidden] { display: none; }
.transport button { min-width: 38px; font-variant-numeric: tabular-nums; }
.back-live {
  color: #fff; background: var(--live); border-radius: 4px; padding: 3px 8px; font-size: 12px; font-weight: 700;
  text-decoration: none; white-space: nowrap;
}
.back-live[hidden] { display: none; }

.banner {
  position: absolute; top: 108px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 22px; border-radius: 8px; background: var(--panel); border-bottom: 3px solid var(--ink);
  animation: banner 0.45s cubic-bezier(0.34, 1.6, 0.64, 1); pointer-events: none; white-space: nowrap;
}
.banner[hidden] { display: none; }
/* A note for the viewer that takes no input and leaves on its own (notice() in tv.js). */
.notice {
  position: absolute; top: 176px; left: 0; right: 0; margin: 0 auto; width: fit-content; max-width: min(560px, calc(100% - 32px)); z-index: 3;
  padding: 8px 14px; border-radius: 6px; background: var(--panel); border-left: 3px solid var(--t);
  font-size: 13px; line-height: 1.35; text-align: center; pointer-events: none; animation: in 0.25s ease-out;
}
.notice[hidden] { display: none; }
.banner b { font-size: clamp(20px, 3.4vw, 30px); letter-spacing: 0.12em; font-weight: 900; }
.banner span { font-size: 13px; color: var(--muted); }
.banner.t { border-color: var(--t); }
.banner.t b { color: var(--t); }
.banner.ct { border-color: var(--ct); }
.banner.ct b { color: var(--ct); }
.banner.clutch b { color: #fff; }
@keyframes banner { from { opacity: 0; transform: translateX(-50%) scale(0.6); } }

/* The death cam: who killed the followed player, under the picture, and the picture going dark red at the
   edges, as the game's world fades for a dead player. */
.deathcard {
  position: absolute; bottom: 96px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; white-space: nowrap; pointer-events: none;
  padding: 8px 18px; border-radius: 6px; background: var(--panel); border-left: 3px solid var(--live);
  font-size: 16px; font-weight: 700; animation: deathcard 0.5s cubic-bezier(0.2, 0.9, 0.3, 1);
  max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis;
}
.deathcard[hidden] { display: none; }
.deathcard .by { color: var(--muted); font-size: 12px; font-weight: 400; text-transform: uppercase; letter-spacing: 0.12em; }
.deathcard .t { color: var(--t); }
.deathcard .ct { color: var(--ct); }
.deathcard .victim { text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: rgba(229, 72, 77, 0.8); }
.deathcard .w { color: #ffa000; display: inline-flex; align-items: center; gap: 4px; }
@keyframes deathcard { from { opacity: 0; transform: translateX(-50%) translateY(14px); } }
.deathfx {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(90, 0, 0, 0.55) 100%);
  animation: deathfx 3.4s ease-out forwards;
}
.deathfx[hidden] { display: none; }

/* The moments of the demo (round ends, multi-kills, clutches, plants): a list to jump by. */
.moments {
  position: absolute; right: 16px; top: 52px; bottom: 96px; width: 260px; z-index: 4; overflow-y: auto;
  background: var(--panel); border-radius: 8px; padding: 6px; font-size: 12px;
}
.moments[hidden] { display: none; }
.moments h2 { margin: 8px 6px 2px; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.moments button {
  display: flex; gap: 8px; width: 100%; text-align: left; border: 0; background: none; color: var(--ink);
  padding: 3px 6px; border-radius: 4px; cursor: pointer; font: inherit;
}
.moments button:hover, .moments button.now { background: rgba(255, 255, 255, 0.1); }
.moments time { color: var(--muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.moments .t { color: var(--t); }
.moments .ct { color: var(--ct); }
.replay-badge {
  position: absolute; top: 108px; left: 16px; z-index: 3; pointer-events: none;
  background: var(--live); color: #fff; font-weight: 800; font-size: 12px; letter-spacing: 0.16em;
  padding: 3px 10px; border-radius: 3px; animation: in 0.25s ease-out;
}
#stage.with-map .replay-badge { top: calc(52px + var(--map) + 10px); }
.replay-badge[hidden] { display: none; }

/* The broadcast HUD: how many live under the score, each side's players in a bottom corner, and the followed
   player's bar at the bottom centre. */
.alive {
  position: absolute; top: 96px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; align-items: baseline;
  background: var(--panel); padding: 1px 12px; border-radius: 0 0 6px 6px; font-weight: 800; font-size: 16px;
  font-variant-numeric: tabular-nums; pointer-events: none;
}
.alive[hidden] { display: none; }
/* A defuse under the score: the defuser's time runs out in blue, the bomb's end a red mark on it. Past the mark
   the bomb goes off first: the bar turns red, as a broadcast shows whether the defuse makes it. */
.defuse {
  position: absolute; top: 122px; left: 50%; transform: translateX(-50%); z-index: 2; pointer-events: none;
  display: flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 4px; background: var(--panel);
  color: var(--ct); font-weight: 800; font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.defuse[hidden] { display: none; }
.defuse .what { display: inline-flex; align-items: center; gap: 5px; }
.defuse .track { position: relative; width: 150px; height: 6px; border-radius: 3px; background: rgba(0, 0, 0, 0.55); overflow: hidden; }
.defuse .track i { position: absolute; inset: 0; background: var(--ct); transform-origin: left; }
.defuse .track b { position: absolute; top: 0; bottom: 0; width: 2px; background: #ff3b30; }
.defuse.late { color: #ff6b61; }
.defuse.late .track i { background: #ff3b30; }
.defuse .left { min-width: 3.2em; text-align: right; }
.alive span { color: var(--muted); font-size: 11px; font-weight: 400; }
.alive .t { color: var(--t); }
.alive .ct { color: var(--ct); }
@container stage (min-width: 641px) and (min-height: 521px) {
  #stage.with-squads .banner { top: 130px; }
}
/* A defuse bar stands under the score: the banner goes under it. */
#stage:has(.defuse:not([hidden])) .banner { top: 158px; }
.squad {
  position: absolute; bottom: 96px; width: 262px; z-index: 2; display: flex; flex-direction: column; gap: 3px;
  font-size: 13px;
}
.squad[hidden] { display: none; }
.squad.t { left: 16px; }
.squad.ct { right: 16px; }
.squad h2 {
  margin: 0 0 1px; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 800;
  padding: 2px 8px; background: var(--panel); border-radius: 3px; align-self: flex-start; white-space: nowrap;
}
.squad.ct h2 { align-self: flex-end; }
.squad.t h2 { color: var(--t); }
.squad.ct h2 { color: var(--ct); }
.squad button {
  /* As a broadcast lays it out: name and K/D, the weapon over what they carry, the health large at the edge. */
  display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 34px; grid-template-rows: auto auto; column-gap: 6px; align-items: center;
  grid-template-areas: "key name gun hp" "key kd nades armor";
  width: 100%; height: 44px; padding: 3px 8px; border: 0; border-left: 3px solid currentColor; border-radius: 3px;
  background: var(--panel); color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.squad.t button { border-color: var(--t); }
.squad.ct button {
  border-color: var(--ct); border-left: 0; border-right: 3px solid var(--ct); text-align: right;
  grid-template-columns: 34px auto minmax(0, 1fr) 12px; grid-template-areas: "hp gun name key" "armor nades kd key";
}
.squad button:hover { --fill: rgba(96, 106, 122, 0.95); }
/* The card fills to the player's health (--hp, estimated from the hits): from the left for T, from the right for CT. */
.squad button {
  --fill: rgba(78, 88, 104, 0.92);
  background: linear-gradient(var(--hp-from, 90deg), var(--fill) var(--hp, 100%), var(--panel) var(--hp, 100%));
}
.squad.ct button { --hp-from: 270deg; }
.squad button.low { --fill: rgba(150, 44, 44, 0.9); }
.squad button.now { --fill: rgba(232, 236, 241, 0.92); background: linear-gradient(var(--hp-from, 90deg), var(--fill) var(--hp, 100%), rgba(150, 156, 166, 0.92) var(--hp, 100%)); color: #0b0d10; }
.squad button.now.low { --fill: rgba(255, 196, 196, 0.95); }
.squad button.now .kd, .squad button.now .key { color: #3a4350; }
/* A blinded player: the card whitens with the flashbang's white-out (--blind, 0 to 1). */
.squad button.blind { position: relative; }
.squad button.blind::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: #fff; opacity: calc(var(--blind, 0) * 0.8);
}
.squad button.dead { opacity: 0.45; }
.squad button.dead .name { text-decoration: line-through; }
.squad .key { grid-area: key; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.squad .name { grid-area: name; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.15; }
.squad .gun { grid-area: gun; justify-self: end; display: inline-flex; align-items: center; gap: 4px; color: #ffa000; }
.squad button.now .gun { color: #a85f00; }
.squad .kd { grid-area: kd; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.squad.ct .gun, .squad.ct .nades { justify-self: start; }
.squad .nades { grid-area: nades; justify-self: end; display: inline-flex; gap: 3px; align-items: flex-end; min-height: 17px; color: #ffa000; }
.squad button.now .nades { color: #a85f00; --hole: rgba(232, 236, 241, 0.9); }
.squad .hp {
  grid-area: hp; justify-self: end; font-size: 20px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.squad.ct .hp { justify-self: start; }
.squad .armor { grid-area: armor; justify-self: end; min-height: 14px; }
.squad.ct .armor { justify-self: start; flex-direction: row-reverse; }
/* The kit or the bomb inside, the armour at the card's edge; in the colour of the text, the bomb red. */
.armor { display: inline-flex; align-items: center; gap: 4px; color: var(--ink); }
.armor .icon { display: block; }
.armor .bomb { color: #ff3b30; }
.squad button.now .armor { color: #0b0d10; }
.squad button.now .armor .bomb { color: #c62828; }
.squad button.low .hp { color: #ff8a80; }
.squad button.now.low .hp { color: #b3261e; }
/* What a player carries, in the weapon's colour as a broadcast draws it: each grenade by its shape, the bomb, the kit. */
.carry { display: inline-flex; opacity: 0.6; }
.carry.held { opacity: 1; filter: brightness(1.35); }
.carry .icon { display: block; }
.focus .nades { display: inline-flex; gap: 6px; align-items: center; color: #cfd6df; }
.squad .kd .count { display: inline-flex; align-items: center; gap: 2px; margin-right: 7px; }
.squad.ct .kd .count { margin: 0 0 0 7px; }
.squad .kd .count .icon { display: block; }
.squad .stars { color: #ffcf40; letter-spacing: 1px; margin-left: 6px; }
.squad button.now .stars { color: #b57a00; }
/* The chat beside the left cards, over the followed player's bar. */
@container stage (min-width: 641px) and (min-height: 521px) {
  #stage.with-squads .chat { left: 294px; bottom: 142px; max-width: min(460px, calc(100% - 600px)); }
}
.focus {
  position: absolute; bottom: 96px; left: 50%; transform: translateX(-50%); z-index: 2; pointer-events: none;
  display: flex; align-items: center; gap: 14px; white-space: nowrap;
  padding: 5px 16px; border-radius: 4px; background: var(--panel); border-bottom: 3px solid var(--ink);
  font-size: 17px; font-weight: 800;
}
.focus[hidden] { display: none; }
.focus.t { border-color: var(--t); }
.focus.ct { border-color: var(--ct); }
/* Between the two card columns (262px each, 16px from the edge) the bar has no room on a stage under 1100px:
   the cards mark the followed player there. */
@container stage (max-width: 1100px) {
  #stage.with-squads .focus { display: none; }
}
.focus .gun { color: #ffa000; display: inline-flex; align-items: center; }
.focus .clip { color: #ffa000; font-variant-numeric: tabular-nums; }
.focus .kd { color: var(--muted); font-size: 12px; font-weight: 400; }
.focus .hp { font-variant-numeric: tabular-nums; }
.keys {
  position: absolute; top: 52px; right: 16px; z-index: 6; width: 330px; max-height: calc(100% - 120px); overflow-y: auto;
  background: rgba(12, 15, 20, 0.94); border-radius: 8px; padding: 10px 14px; font-size: 13px;
}
.keys[hidden] { display: none; }
.keys dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 4px 0; }
.keys dt { font-weight: 700; white-space: nowrap; }
.keys dd { margin: 0; color: var(--muted); }
.keys-note { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.transport select { font-variant-numeric: tabular-nums; }
.minimap { pointer-events: auto; cursor: crosshair; }
@keyframes deathfx { 0% { opacity: 0; } 12% { opacity: 1; } 100% { opacity: 0.55; } }

.buys {
  position: absolute; left: 16px; top: 66px; width: 240px; max-height: calc(100% - 214px); overflow: hidden;
  background: var(--panel); border-radius: 8px; padding: 8px 10px; animation: in 0.3s ease-out;
}
.buys[hidden] { display: none; }
/* Under the map where the map shows. */
#stage.with-map .buys { top: calc(52px + var(--map) + 10px); max-height: calc(100% - 52px - var(--map) - 160px); }
/* The cards show each player's weapon: the buy panel would only cover them. */
@container stage (min-width: 641px) and (min-height: 521px) {
  #stage.with-squads .buys { display: none; }
}
.buys-title { margin: 0 0 4px; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.buys-team + .buys-team { margin-top: 8px; }
.buys-team header { display: flex; justify-content: space-between; font-weight: 700; font-size: 13px; border-bottom: 1px solid currentColor; margin-bottom: 3px; }
.buys-team.t { color: var(--t); }
.buys-team.ct { color: var(--ct); }
.buys-spent { color: #8fd18f; font-variant-numeric: tabular-nums; }
.buys-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; padding: 1px 0; }
.buys-name { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.buys-items { display: flex; gap: 3px; flex-shrink: 0; }
.buys-items .icon { animation: pop 0.35s cubic-bezier(0.34, 1.8, 0.64, 1); }
@keyframes pop { from { transform: scale(0.2); opacity: 0; } }

/* An upright phone plays wide: the stage turns a quarter to the right and fills the screen sideways. */
@media (pointer: coarse) and (orientation: portrait) {
  #stage {
    inset: auto; top: 0; left: 0; width: 100dvh; height: 100dvw;
    transform-origin: top left; transform: translateX(100dvw) rotate(90deg);
  }
}

/* A short stage (a phone on its side): smaller panels, nothing over the controls. */
@container stage (max-height: 520px) {
  .bar { padding: 6px 10px; gap: 6px; }
  .bar .channel, .bar .live { display: none; }
  .director { font-size: 0; gap: 0; }
  .brand { font-size: 12px; }
  select, button { padding: 2px 5px; font-size: 12px; }
  #follow { max-width: 8em; }
  #stage { --map: min(22cqh, 110px); }
  .squad, .focus, .alive { display: none; }
  .score { top: 38px; padding: 3px 10px; gap: 8px; }
  .team b { font-size: 15px; }
  .clock { font-size: 14px; min-width: 3em; }
  .feed { top: 38px; right: 10px; gap: 2px; }
  .feed li { font-size: 11px; padding: 2px 6px; }
  .feed li:nth-child(n+4) { display: none; }
  .banner { top: 74px; padding: 4px 14px; }
  .deathcard { bottom: 60px; font-size: 13px; padding: 5px 12px; }
  .banner b { font-size: 18px; }
  .banner span { font-size: 11px; }
  .caption { padding: 6px 10px; }
  .camera { font-size: 14px; }
  .camera small { font-size: 10px; }
  .meta { font-size: 10px; }
  .pov-note { font-size: 10px; }
  .notice { top: 124px; font-size: 11px; padding: 5px 10px; }
  .rounds { bottom: 40px; left: 10px; right: 10px; height: 6px; }
  .rounds.seekable { height: 22px; bottom: 32px; padding: 8px 0; }
  .transport { gap: 4px; }
  .transport button { min-width: 30px; }
  .chat { bottom: 52px; left: 10px; max-width: 45cqw; }
  .chat li { font-size: 11px; }
  .chat li:nth-child(n+4) { display: none; }
  .fps { top: 36px; left: 10px; font-size: 11px; }
  #stage.with-map .fps { left: calc(10px + min(22cqh, 110px) + 8px); top: 40px; }
  .buys { top: 52px; left: 10px; width: 180px; max-height: 55cqh; }
  #stage.with-map .buys { top: calc(38px + min(22cqh, 110px) + 6px); max-height: calc(100% - 38px - min(22cqh, 110px) - 70px); }
  .buys-row { font-size: 11px; }
  .minimap { top: 38px; left: 10px; width: min(22cqh, 110px); height: min(22cqh, 110px); pointer-events: auto; cursor: pointer; }
  .ammo { bottom: 52px; right: 10px; }
  .ammo.beside-map { bottom: calc(52px + 22cqh + 6px); }
  .minimap.big { width: 60cqh; height: 60cqh; }
  .pip { bottom: 52px; right: 10px; width: calc(22cqh * 16 / 9); height: 22cqh; }
  .settings { top: 38px; right: 10px; }
  /* Between the bar and the controls, never under them, and in the type size of the rest of a short stage. */
  .board {
    top: 40px; bottom: 64px; transform: translateX(-50%); max-height: none;
    width: min(560px, calc(100% - 20px)); padding: 6px 10px;
  }
  .board .mark, .board .gun { display: none; }
  .board-team + .board-team { margin-top: 8px; }
  .board-team header { gap: 8px; padding-bottom: 2px; }
  .board-team h2 { font-size: 13px; }
  .board-score { font-size: 15px; }
  .board-alive { font-size: 10px; }
  .board table { margin-top: 2px; }
  .board th { font-size: 10px; padding: 1px 6px; }
  .board td { font-size: 12px; line-height: 1.3; padding: 1px 6px; }
  .board .num { width: 3.6em; }
  .board-spectators { font-size: 10px; margin-top: 6px; }
  .card h1 { font-size: 28px; }
}

/* A narrow stage (a small desktop window): no inset first-person view, a smaller radar. */
@container stage (max-width: 640px) {
  .squad, .focus, .alive { display: none; }
  .pip { display: none; }
  .minimap { width: min(24cqw, 120px); height: min(24cqw, 120px); pointer-events: auto; cursor: pointer; }
  .minimap.big { width: 70cqw; height: 70cqw; }
  .director { display: none; }
  .pov-note { font-size: 10px; }
  .notice { font-size: 11px; }
}

/* A poster (tools/posters.js): the 3D picture alone. */
body.poster #stage > :not(#view3d) { display: none !important; }
