/* Fonts are served from node_modules (see VENDOR in server/index.js): no CDN, works offline and in the Steam build */
@import url('../vendor/oswald/500.css');
@import url('../vendor/oswald/600.css');
@import url('../vendor/oswald/700.css');
@import url('../vendor/ptsans/400.css');
@import url('../vendor/ptsans/700.css');

:root {
  --ink: #11130e;
  --panel: rgba(20, 22, 16, 0.84);
  --panel-solid: #1a1c15;
  --line: rgba(236, 222, 186, 0.13);
  --line-strong: rgba(236, 222, 186, 0.28);
  --fg: #efe7d4;
  --muted: #a39b86;
  --brass: #d9a441;
  --brass-hi: #f2c669;
  --brass-dk: #7a5718;
  --fire: #b8402c;
  --ok: #8cc063;
  --foe: #e2644c;
  --display: 'Oswald', 'Arial Narrow', 'Segoe UI', sans-serif;
  --body: 'PT Sans', 'Segoe UI', system-ui, sans-serif;
  /* kept for older rules */
  --bg: var(--panel); --bg-solid: var(--panel-solid); --accent: var(--brass);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #9fb6c6; color: var(--fg); font-family: var(--body); font-size: 15px; }
canvas#view { display: block; position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; }
[hidden] { display: none !important; }
::selection { background: var(--brass); color: var(--ink); }

/* darkening over the 3D scene behind the menus: strong on the left where the menu is, clear on the right */
#scrim { position: fixed; inset: 0; z-index: 2; pointer-events: none; opacity: 0; transition: opacity 0.6s;
  background:
    linear-gradient(90deg, rgba(10, 11, 8, 0.94) 0, rgba(10, 11, 8, 0.82) 360px, rgba(10, 11, 8, 0.25) 62%, rgba(10, 11, 8, 0) 80%),
    radial-gradient(120% 90% at 70% 45%, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.45) 100%); }
body[data-screen=login] #scrim, body[data-screen=menu] #scrim { opacity: 1; }
body[data-screen=search] #scrim, body[data-screen=loading] #scrim { opacity: 1; background: radial-gradient(42% 38% at 50% 50%, rgba(10, 11, 8, 0.88), rgba(10, 11, 8, 0.7) 55%, rgba(10, 11, 8, 0.3) 100%); }

.screen { position: fixed; z-index: 5; }
.center { left: 50%; top: 50%; transform: translate(-50%, -50%); }
.card { width: min(400px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; padding: 24px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45); display: flex; flex-direction: column; gap: 10px; text-align: center; }
.card.wide { width: min(940px, calc(100vw - 32px)); }
.sub { color: var(--muted); margin: 0; }
h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: 0.02em; margin: 4px 0; }
label { display: flex; flex-direction: column; gap: 6px; text-align: left; color: var(--muted); font-size: 13px; letter-spacing: 0.04em; }
input:not([type=range]):not([type=checkbox]) { font: 16px var(--body); color: var(--fg); background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line);
  border-bottom: 2px solid var(--line-strong); border-radius: 3px; padding: 10px 12px; outline: none; transition: border-color 0.2s, background 0.2s; }
input:not([type=range]):not([type=checkbox]):focus { border-bottom-color: var(--brass); background: rgba(0, 0, 0, 0.5); }
.err { color: #ff8a73; min-height: 1.2em; margin: 0; font-size: 13px; }
.row { display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap; }
.row > button { flex: 1; }
kbd { display: inline-block; min-width: 1.5em; padding: 0 5px; font: 600 11px/1.6 var(--display); text-align: center; color: var(--fg);
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 3px; }

/* ---------------------------------------------------------------- buttons */
button { font: 15px var(--body); color: var(--fg); background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 4px;
  padding: 9px 14px; cursor: pointer; transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.08s; }
button:hover { background: rgba(255, 255, 255, 0.12); border-color: var(--line-strong); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.4; cursor: default; transform: none; }
button:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
button.cta, button.primary { font: 600 17px var(--display); text-transform: uppercase; letter-spacing: 0.08em; color: #1d1405;
  background: linear-gradient(#e7b654, #c48c2c); border: 1px solid var(--brass-dk); box-shadow: inset 0 1px rgba(255, 255, 255, 0.4), 0 2px 0 #5e4210, 0 6px 18px rgba(0, 0, 0, 0.3); padding: 11px 18px; }
button.cta:hover, button.primary:hover { background: linear-gradient(#f0c46a, #d39a36); border-color: var(--brass-dk); }
button.ghost { font: 500 15px var(--display); text-transform: uppercase; letter-spacing: 0.08em; background: transparent; border: 1px solid var(--line-strong); color: var(--fg); }
button.ghost:hover { border-color: var(--brass); color: var(--brass-hi); background: rgba(217, 164, 65, 0.06); }
button.danger-cta { font: 600 16px var(--display); text-transform: uppercase; letter-spacing: 0.08em; color: #fff; background: linear-gradient(#cc5238, #9e3222);
  border: 1px solid #5f1a10; box-shadow: inset 0 1px rgba(255, 255, 255, 0.25), 0 2px 0 #4a140c; }
button.danger-cta:hover { background: linear-gradient(#dc6246, #ad3a28); }
button.active { background: rgba(217, 164, 65, 0.16); border-color: var(--brass); color: var(--brass-hi); }
button.icon { width: 40px; height: 40px; padding: 0; display: grid; place-items: center; }
button.icon svg { width: 20px; height: 20px; }
button.danger { color: #ffab9a; }
button.danger:hover { border-color: var(--foe); background: rgba(226, 100, 76, 0.12); }
button.link { background: none; border: none; color: var(--muted); text-decoration: underline; }

/* ---------------------------------------------------------------- brand */
.brand { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px; align-items: center; }
.brand .emblem { grid-row: 1 / 3; width: 76px; height: 76px; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5)); }
.brand .word { display: flex; flex-direction: column; font: 700 50px/0.86 var(--display); text-transform: uppercase; letter-spacing: 0.01em; }
.brand .w1 { color: var(--fg); }
.brand .w2 { color: var(--brass); text-shadow: 0 0 24px rgba(217, 164, 65, 0.25); }
.brand .tagline { grid-column: 1 / 3; margin-top: 12px; display: flex; align-items: center; gap: 10px; font: 500 12px var(--display); text-transform: uppercase;
  letter-spacing: 0.42em; color: var(--muted); }
.brand .tagline::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--brass-dk), transparent); }
.spark { transform-box: fill-box; transform-origin: center; animation: spark 0.18s steps(2) infinite alternate; }
@keyframes spark { to { opacity: 0.55; transform: scale(0.8) rotate(20deg); } }

/* ---------------------------------------------------------------- login & menu shell */
.shell { inset: 0; pointer-events: none; }
.shell > * { pointer-events: auto; }
.rail { position: absolute; left: 0; top: 0; bottom: 0; width: min(430px, 100vw); padding: 56px 48px 28px 60px; display: flex; flex-direction: column; overflow: auto; }
.rail > * { animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.brand-slot { animation-delay: 0.05s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes slide { from { opacity: 0; transform: translateX(-18px); } }

.nav { margin-top: 64px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; animation: none; }
.nav button { position: relative; display: flex; flex-direction: column; align-items: flex-start; background: none; border: none; border-radius: 0;
  padding: 7px 0; font: 500 25px/1.15 var(--display); text-transform: uppercase; letter-spacing: 0.05em; color: rgba(239, 231, 212, 0.8);
  animation: slide 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; transition: color 0.15s, padding 0.2s; }
.nav button:nth-child(1) { animation-delay: 0.12s; } .nav button:nth-child(2) { animation-delay: 0.18s; } .nav button:nth-child(3) { animation-delay: 0.24s; }
.nav button:nth-child(4) { animation-delay: 0.30s; } .nav button:nth-child(5) { animation-delay: 0.36s; } .nav button:nth-child(6) { animation-delay: 0.42s; } .nav button:nth-child(7) { animation-delay: 0.48s; }
.nav button::before { content: ''; position: absolute; left: -22px; top: 50%; width: 11px; height: 11px; margin-top: -6px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff4d6, var(--brass) 45%, var(--brass-dk)); transform: scale(0); transition: transform 0.18s; }
.nav button:not(.nav-cta) span { position: relative; }
.nav button:hover, .nav button.open { color: var(--brass-hi); background: none; padding-left: 8px; }
.nav button:hover::before, .nav button.open::before { transform: scale(1); }
.nav button small { font: 400 13px var(--body); text-transform: none; letter-spacing: 0.02em; color: var(--muted); margin-top: 2px; }
.nav .nav-cta { font-size: 44px; font-weight: 700; color: var(--brass); margin-bottom: 14px; }
.nav .nav-cta::before { display: none; }
.nav .nav-cta:hover { color: var(--brass-hi); padding-left: 6px; text-shadow: 0 0 30px rgba(242, 198, 105, 0.35); }
.nav .nav-quiet { font-size: 16px; color: var(--muted); margin-top: 20px; }
.nav .nav-sound { margin-top: 20px; }
.nav .nav-sound + .nav-quiet { margin-top: 2px; }
.nav .nav-sound span { display: inline-flex; align-items: center; gap: 8px; }
.nav .nav-sound svg { width: 17px; height: 17px; }
.nav .nav-sound.off { color: var(--foe); }

.foot { margin-top: auto; padding-top: 24px; display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); letter-spacing: 0.04em; }
.foot { align-items: center; }
.foot .menu-mute { width: 32px; height: 32px; margin-left: auto; margin-right: 10px; background: none; border-color: transparent; color: var(--muted); }
.foot .menu-mute:hover { color: var(--brass-hi); border-color: var(--line-strong); }
.foot .menu-mute.off { color: var(--foe); }
.foot .menu-mute svg { width: 18px; height: 18px; }
.foot .online::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); vertical-align: 1px; }
.foot .online:empty::before { display: none; }

.login { margin-top: 48px; display: flex; flex-direction: column; gap: 14px; }
.login .lead { margin: 0 0 8px; color: var(--fg); opacity: 0.85; font-size: 17px; line-height: 1.45; max-width: 300px; }
.login .cta { margin-top: 4px; }

/* player card, top right of the menu */
.profile { position: absolute; top: 36px; right: 36px; width: 300px; padding: 20px 22px 18px; background: var(--panel); border: 1px solid var(--line);
  border-top: 3px solid var(--brass); border-radius: 4px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  animation: rise 0.6s 0.25s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.profile:empty { display: none; }
.profile .who { display: flex; gap: 14px; align-items: center; }
.profile .badge { width: 52px; height: 52px; flex: none; }
.profile .nick { font: 600 24px/1.1 var(--display); letter-spacing: 0.02em; word-break: break-all; }
.profile .rank { font: 500 12px var(--display); text-transform: uppercase; letter-spacing: 0.22em; color: var(--brass); margin-top: 3px; }
.profile .rating { display: flex; align-items: baseline; justify-content: space-between; margin: 16px 0 12px; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.profile .rating span { font: 500 12px var(--display); text-transform: uppercase; letter-spacing: 0.2em; color: var(--muted); }
.profile .rating b { font: 600 40px/1 var(--display); font-variant-numeric: tabular-nums; }
.profile .next { font-size: 12px; color: var(--muted); margin: -4px 0 12px; }
.profile .next i { display: block; height: 3px; margin-top: 5px; background: rgba(255, 255, 255, 0.1); border-radius: 2px; overflow: hidden; }
.profile .next i::after { content: ''; display: block; height: 100%; width: var(--p); background: var(--brass); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 8px; }
.stats div { display: flex; flex-direction: column; }
.stats b { font: 600 22px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.stats span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }

/* leaderboard / history sheet next to the menu */
.sheet { position: absolute; left: 440px; top: 56px; bottom: 56px; width: min(600px, calc(100vw - 800px)); min-width: 420px; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45); animation: slide 0.35s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.sheet header { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 12px 22px; border-bottom: 1px solid var(--line); }
.sheet h3 { margin: 0; font-size: 22px; text-transform: uppercase; letter-spacing: 0.08em; }
.sheet .icon { background: none; border-color: transparent; }
.sheet-body { overflow: auto; padding: 6px 12px 14px; }
/* thin scrollbars in the game's colours */
* { scrollbar-width: thin; scrollbar-color: rgba(217, 164, 65, 0.45) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(217, 164, 65, 0.35); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }
.empty { padding: 40px 12px; text-align: center; color: var(--muted); }
.empty b { display: block; font: 600 18px var(--display); color: var(--fg); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
th { font: 500 11px var(--display); text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); }
td.num, th.num { text-align: right; }
tr.me td { background: rgba(217, 164, 65, 0.1); }
td.place { font: 600 16px var(--display); color: var(--muted); width: 38px; }
tr.top1 td.place { color: #f2c669; } tr.top2 td.place { color: #cfd3d8; } tr.top3 td.place { color: #d09060; }
.res { font: 600 12px var(--display); text-transform: uppercase; letter-spacing: 0.1em; padding: 2px 8px; border-radius: 3px; }
.res.win { color: #1d2a12; background: var(--ok); } .res.loss { color: #fff; background: #8c3526; } .res.draw { color: var(--fg); background: rgba(255, 255, 255, 0.15); }
.tag-bot { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; padding: 0 5px; font: 600 10px/16px var(--display); letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 3px; vertical-align: 2px; }
.tag-bot svg { width: 11px; height: 11px; }

/* ---------------------------------------------------------------- search & loading */
.stage { inset: 0; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; animation: rise 0.4s both; }
.stage-title { margin: 12px 0 0; font: 600 34px var(--display); text-transform: uppercase; letter-spacing: 0.12em; }
.stage-text { font: 500 18px var(--display); text-transform: uppercase; letter-spacing: 0.12em; margin: 8px 0; color: var(--fg); }
.big-num { font: 600 64px/1 var(--display); margin: 0; color: var(--brass); font-variant-numeric: tabular-nums; }
.stage .sub { max-width: 380px; }
.stage .ghost { margin-top: 14px; min-width: 160px; }
.fuse-bar { position: relative; width: min(340px, 80vw); height: 3px; margin: 14px 0 6px; background: rgba(255, 255, 255, 0.08); }
.fuse-bar i { position: absolute; inset: 0; background: linear-gradient(90deg, #5d4027, #a07443); transform-origin: left; animation: fuse-burn 10s linear forwards; }
.fuse-bar b { position: absolute; top: 50%; left: 100%; width: 12px; height: 12px; margin: -6px; border-radius: 50%;
  background: radial-gradient(circle, #fff6d0 0, #ffc766 35%, rgba(255, 150, 40, 0) 70%); box-shadow: 0 0 14px 5px rgba(255, 160, 50, 0.45);
  animation: fuse-spark 10s linear forwards, flicker 0.12s steps(2) infinite alternate; }
@keyframes fuse-burn { to { transform: scaleX(0); } }
@keyframes fuse-spark { to { left: 0; } }
@keyframes flicker { to { opacity: 0.6; transform: scale(0.7); } }
.roller { width: 64px; height: 64px; position: relative; }
.roller svg { width: 64px; height: 64px; animation: roll 1.4s linear infinite; }
.roller::after { content: ''; position: absolute; left: 6px; right: 14px; bottom: -8px; height: 8px; border-radius: 50%; background: rgba(0, 0, 0, 0.4); filter: blur(3px); }
@keyframes roll { to { transform: rotate(360deg); } }
.spinner { display: none; }

/* ---------------------------------------------------------------- HUD */
.hud { inset: 0; pointer-events: none; }
.hud > * { pointer-events: auto; }
.panel-ui, .topbar, .roster, .dock, .log, .cam-group { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3); }
.topbar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: min(740px, calc(100vw - 20px));
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; padding: 8px 16px; border-top: 2px solid var(--brass); }
.topbar .side { display: flex; flex-direction: column; min-width: 0; }
.topbar .foe-side { text-align: right; align-items: flex-end; }
.topbar b { font: 600 19px/1.2 var(--display); letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.topbar .me-side b { color: var(--ok); }
.topbar .foe-side b { color: var(--foe); }
.balls { color: var(--muted); font-size: 12px; letter-spacing: 0.04em; }
.turn { text-align: center; display: flex; flex-direction: column; font: 500 13px var(--display); text-transform: uppercase; letter-spacing: 0.14em; }
.timer { font: 600 30px/1.05 var(--display); letter-spacing: 0.04em; font-variant-numeric: tabular-nums; color: var(--brass); }
.timer.low { color: #ff6b50; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
.roster { position: absolute; top: 84px; left: 10px; width: 200px; padding: 10px 12px; font-size: 13px; }
.roster.foe { left: auto; right: 10px; }
.roster h4 { margin: 0 0 8px; font: 500 11px var(--display); text-transform: uppercase; letter-spacing: 0.18em; color: var(--muted); }
.hp { display: grid; grid-template-columns: 82px 1fr 40px; gap: 6px; align-items: center; margin: 5px 0; }
.hp .bar { height: 6px; border-radius: 1px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.hp .bar i { display: block; height: 100%; background: linear-gradient(90deg, #6fa446, var(--ok)); transition: width 0.5s; }
.roster.foe .hp .bar i { background: var(--foe); }
.hp.dead { color: var(--muted); text-decoration: line-through; }
.hp span:last-child { text-align: right; font: 600 13px var(--display); font-variant-numeric: tabular-nums; }
.roster.foe .hp span:last-child { font: 500 11px var(--display); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }

.banner { position: absolute; top: 32%; left: 50%; transform: translate(-50%, -50%); font: 700 clamp(36px, 7vw, 76px) var(--display); text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--fg); text-shadow: 0 4px 24px rgba(0, 0, 0, 0.6), 0 0 2px #000; pointer-events: none; white-space: nowrap; animation: pop 0.4s cubic-bezier(0.2, 0.7, 0.2, 1); }
.banner::after { content: ''; display: block; height: 3px; margin: 6px auto 0; width: 60%; background: linear-gradient(90deg, transparent, var(--brass), transparent); }
@keyframes pop { from { transform: translate(-50%, -50%) scale(1.35); opacity: 0; } }

.dock { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); width: min(440px, calc(100vw - 20px)); padding: 12px 14px; }
.dock .hint { margin: 0 0 10px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.tray { display: flex; gap: 8px; margin-bottom: 10px; }
.tray button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 6px; }
.tray button b { font: 600 15px var(--display); letter-spacing: 0.03em; }
.tray button small { color: var(--muted); font-size: 11px; }
.tray button.placed small { color: var(--ok); }
.tray button.active small { color: var(--brass-hi); }
#floorPick { display: flex; gap: 6px; }
label.rng { display: block; margin: 6px 0; }
label.rng div { display: flex; justify-content: space-between; color: var(--muted); }
label.rng output { color: var(--fg); font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; accent-color: var(--brass); }
.ammo button { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px; font: 500 15px var(--display); letter-spacing: 0.04em; text-transform: uppercase; }
.ammo button b { font: 600 22px/1.1 var(--display); }
.ammo button small { font: 400 11px var(--body); text-transform: none; letter-spacing: 0; color: var(--muted); }
.ammo button.active small { color: var(--brass-hi); }
.ammo button:disabled { opacity: 0.35; }
.fire { width: 100%; font: 700 20px var(--display); text-transform: uppercase; letter-spacing: 0.16em; color: #fff; padding: 11px; margin: 8px 0 6px;
  background: linear-gradient(#cc5238, #9e3222); border: 1px solid #5f1a10; box-shadow: inset 0 1px rgba(255, 255, 255, 0.25), 0 2px 0 #4a140c, 0 6px 18px rgba(0, 0, 0, 0.3); }
.fire:hover { background: linear-gradient(#dc6246, #ad3a28); border-color: #5f1a10; }
.keys { color: var(--muted); font-size: 11px; margin: 4px 0 0; line-height: 1.9; }

.cams { position: absolute; right: 10px; bottom: 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.cam-group { display: flex; flex-direction: column; padding: 4px; gap: 2px; }
.cam-group button { display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 8px; width: 132px; padding: 7px 8px; background: none; border-color: transparent;
  font: 500 13px var(--display); text-transform: uppercase; letter-spacing: 0.08em; text-align: left; }
.cam-group button svg { width: 18px; height: 18px; }
.cam-group button kbd { opacity: 0.6; }
.cam-group button:hover { background: rgba(255, 255, 255, 0.07); }
.cam-group button.active { background: rgba(217, 164, 65, 0.16); color: var(--brass-hi); border-color: transparent; box-shadow: inset 2px 0 var(--brass); }
.cam-group.tools { flex-direction: row; }
.cam-group.tools button { display: grid; width: 34px; height: 34px; padding: 0; place-items: center; }
.cam-group.tools button.active { box-shadow: none; }
.speed { font: 600 13px var(--display); }
.roster:empty, .log:empty { display: none; }
.log { position: absolute; left: 10px; bottom: 12px; width: 260px; max-height: 30vh; overflow: auto; padding: 8px 12px; font-size: 13px; color: var(--muted); }
.log p { margin: 3px 0; }
.log p.me { color: #bfe3a8; }
.log p.foe { color: #ffb4a6; }

#toasts { position: fixed; top: 96px; left: 50%; transform: translateX(-50%); z-index: 20; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { padding: 9px 16px; border-radius: 3px; background: var(--panel-solid); border: 1px solid var(--line); border-left: 3px solid var(--brass);
  font: 500 15px var(--display); letter-spacing: 0.04em; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); animation: toast 0.3s cubic-bezier(0.2, 0.7, 0.2, 1); }
.toast.good { border-left-color: var(--ok); }
.toast.bad { border-left-color: var(--foe); }
@keyframes toast { from { opacity: 0; transform: translateY(-8px); } }

/* floating hp bars over our humans */
#overlays { position: fixed; inset: 0; pointer-events: none; z-index: 3; }
.tag { position: absolute; left: 0; top: 0; will-change: transform; font: 500 12px var(--display); letter-spacing: 0.04em; text-align: center; white-space: nowrap; color: #fff; text-shadow: 0 1px 2px #000, 0 0 6px rgba(0, 0, 0, 0.6); }
.tag .bar { width: 44px; height: 4px; margin: 2px auto 0; background: rgba(0, 0, 0, 0.55); border-radius: 1px; overflow: hidden; }
.tag .bar i { display: block; height: 100%; background: var(--ok); }
.tag.dead { color: #ccc; }

/* ---------------------------------------------------------------- results */
.results { text-align: center; padding: 28px; border-top: 3px solid var(--brass); }
.kicker { margin: 0; font: 500 12px var(--display); text-transform: uppercase; letter-spacing: 0.4em; color: var(--muted); }
#resTitle { font: 700 56px/1 var(--display); text-transform: uppercase; letter-spacing: 0.06em; margin: 4px 0 2px; }
#resTitle.win { color: var(--brass); text-shadow: 0 0 40px rgba(217, 164, 65, 0.3); }
#resTitle.loss { color: var(--foe); }
.results > .row { margin-top: 8px; }
.res-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; text-align: left; margin-top: 6px; }
.res-grid .col { background: rgba(0, 0, 0, 0.28); border: 1px solid var(--line); border-radius: 4px; padding: 12px; }
.res-grid h3 { margin: 0 0 4px; font-size: 20px; }
.res-grid .win { color: var(--brass); }
.res-grid .win::after { content: 'победитель'; margin-left: 8px; font: 500 10px var(--display); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink);
  background: var(--brass); padding: 1px 6px; border-radius: 2px; vertical-align: 4px; }
.res-grid .col { overflow-x: auto; }
.res-grid table { font-size: 13px; margin-top: 6px; }
.res-grid th, .res-grid td { white-space: nowrap; padding: 7px 8px; }
.res-grid td.dead { color: #ffab9a; }
.res-grid td.alive { color: var(--ok); }
.delta.up { color: var(--ok); } .delta.down { color: var(--foe); }

@media (max-width: 760px) {
  .roster { display: none; }
  .log { display: none; }
  .res-grid { grid-template-columns: 1fr; }
  .cams { bottom: auto; top: 96px; right: 10px; }
  .cam-group button { width: auto; grid-template-columns: 18px; }
  .cam-group button span, .cam-group button kbd { display: none; }
}

#fps { position: fixed; top: 8px; right: 10px; z-index: 30; padding: 2px 7px; border-radius: 3px; font: 12px/1.4 ui-monospace, Consolas, monospace;
  color: #d8f5c8; background: rgba(0, 0, 0, 0.45); pointer-events: none; font-variant-numeric: tabular-nums; }
#fps.low { color: #ffb4a6; }
body[data-screen=menu] #fps, body[data-screen=login] #fps { top: auto; bottom: 8px; }
@media (max-width: 760px) { #fps { top: auto; bottom: 8px; } }

/* ---------------------------------------------------------------- dialogs */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(8, 9, 6, 0.55); animation: fade 0.2s; }
@keyframes fade { from { opacity: 0; } }
.modal .card { position: static; transform: none; text-align: left; width: min(440px, calc(100vw - 32px)); border-top: 3px solid var(--brass); animation: rise 0.3s both; }
.modal h2 { text-align: left; text-transform: uppercase; letter-spacing: 0.08em; font-size: 22px; }
.modal .dialog { text-align: center; }
.modal .dialog h2 { text-align: center; }
.modal .dialog .row { margin-top: 10px; }
.set-sec { margin: 10px 0 0; font: 500 12px var(--display); text-transform: uppercase; letter-spacing: 0.22em; color: var(--brass); }
#setPreset button { font: 500 14px var(--display); text-transform: uppercase; letter-spacing: 0.06em; }
label.opt { flex-direction: row; justify-content: space-between; align-items: center; color: var(--fg); font-size: 14px; letter-spacing: 0; }
label.rng div { font-size: 14px; letter-spacing: 0; }
select { font: 14px var(--body); color: var(--fg); background: rgba(0, 0, 0, 0.4); border: 1px solid var(--line-strong); border-radius: 3px; padding: 6px 8px; }
label.check { flex-direction: row; align-items: flex-start; gap: 8px; color: var(--fg); font-size: 14px; letter-spacing: 0; }
label.check input { margin-top: 3px; accent-color: var(--brass); }
.small { font-size: 12px; }

/* death cam: the scene is drawn into this rectangle by a second camera (see Scene3D.renderDeathCam) */
#deathcam { position: fixed; top: 200px; right: 10px; width: min(320px, 40vw); aspect-ratio: 16 / 10; z-index: 25; pointer-events: none;
  border: 2px solid var(--line-strong); border-radius: 4px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5); }
#deathcam.own { border-color: var(--foe); }
#deathcam.enemy { border-color: var(--ok); }
#deathcam span { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 8px; font: 500 13px var(--display); letter-spacing: 0.06em; text-align: center; text-transform: uppercase;
  color: #fff; background: rgba(0, 0, 0, 0.6); }
@media (max-width: 760px) { #deathcam { top: 90px; } }

#fieldBar { position: fixed; z-index: 6; text-align: center; }

/* ---------------------------------------------------------------- menu on small screens */
@media (max-width: 1180px) {
  .sheet { left: 16px; right: 16px; width: auto; min-width: 0; top: 16px; bottom: 16px; z-index: 3; }
}
@media (max-width: 980px) {
  .profile { top: auto; bottom: 24px; right: 24px; width: 260px; }
}
@media (max-width: 720px) {
  .rail { padding: 32px 24px 20px; }
  .profile { display: none; }
  .nav { margin-top: 36px; }
  .brand .word { font-size: 40px; }
  .brand .emblem { width: 60px; height: 60px; }
  body[data-screen=login] #scrim, body[data-screen=menu] #scrim { background: rgba(10, 11, 8, 0.8); }
}
