:root {
  --bg: #0d1117;
  --bg2: #141a23;
  --panel: rgba(20, 26, 36, 0.92);
  --glass: rgba(14, 19, 27, 0.78);
  --line: rgba(255, 255, 255, 0.08);
  --line2: rgba(255, 255, 255, 0.14);
  --text: #e8e6e1;
  --muted: #8b93a1;
  --gold: #e8b04b;
  --gold2: #f5cf7a;
  --red: #e5484d;
  --green: #46c96b;
  --radius: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "URW Palladio L", "P052", Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.4 var(--font); overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.grow { flex: 1; }

button { border: 1px solid var(--line2); background: rgba(255,255,255,0.04); border-radius: 9px; padding: 8px 14px; cursor: pointer; transition: background .15s, border-color .15s, transform .05s; }
button:hover { background: rgba(255,255,255,0.09); border-color: rgba(255,255,255,0.22); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .4; cursor: not-allowed; }
button.primary { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #241a06; border-color: transparent; font-weight: 650; }
button.primary:hover { filter: brightness(1.07); }
button.big { padding: 11px 28px; font-size: 15px; }
button.ghost { background: transparent; }
button.danger { border-color: rgba(229,72,77,.5); color: #ff9a9d; }
input { background: rgba(0,0,0,0.3); border: 1px solid var(--line2); border-radius: 9px; padding: 9px 12px; outline: none; }
input:focus { border-color: var(--gold); }
/* sliders: no text-field box around them (its padding indented the track,
   so dragging to its visible end stopped at 1 instead of 0) */
input[type=range] { padding: 0; border: none; background: transparent; width: 200px; height: 24px; margin: 0; cursor: pointer; accent-color: var(--gold); }
.vol-val { min-width: 34px; font-size: 12px; color: var(--muted, #9aa3ad); font-variant-numeric: tabular-nums; }
select { background: #1b222d; border: 1px solid var(--line2); border-radius: 8px; padding: 6px 8px; }

.brand { font-family: var(--serif); font-weight: 600; letter-spacing: .5px; margin: 0; font-size: 44px; }
.brand span { color: var(--gold); }
.brand.small { font-size: 26px; }
.brand.tiny { font-size: 16px; }

.screen { position: fixed; inset: 0; }
/* join and lobby float over the canvas; the 3D world is only built once a game starts */
#screen-join, #screen-lobby {
  background:
    radial-gradient(1200px 600px at 70% -10%, rgba(232,176,75,0.10), transparent 60%),
    linear-gradient(rgba(10, 13, 18, 0.72), rgba(10, 13, 18, 0.82));
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  z-index: 10;
}

/* ---------- join ---------- */
#screen-join { display: grid; place-items: center; }
.join-card { text-align: center; padding: 48px 56px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.45); width: min(460px, 92vw); }
.crest { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 16px; background:
  linear-gradient(135deg, rgba(232,176,75,.25), rgba(232,176,75,.05)); border: 1px solid rgba(232,176,75,.35); position: relative; }
.crest::after { content: ""; position: absolute; inset: 14px 16px 12px; background:
  linear-gradient(var(--gold), var(--gold)) 0 100%/100% 55% no-repeat,
  linear-gradient(var(--gold), var(--gold)) 0 0/20% 60% no-repeat,
  linear-gradient(var(--gold), var(--gold)) 40% 0/20% 60% no-repeat,
  linear-gradient(var(--gold), var(--gold)) 100% 0/20% 60% no-repeat; opacity: .9; }
.tag { color: var(--muted); margin: 8px 0 26px; }
#join-form { display: flex; gap: 10px; }
#join-form input { flex: 1; }
.join-msg { margin-top: 14px; min-height: 20px; color: #ffb4b6; }

/* ---------- lobby ---------- */
#screen-lobby { display: flex; flex-direction: column; padding: 22px 28px; gap: 18px; }
.lobby-head { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.join-url { color: var(--muted); }
.join-url code { color: var(--gold2); background: rgba(232,176,75,.08); padding: 3px 8px; border-radius: 6px; font-size: 14px; }
.lobby-grid { flex: 1; display: grid; grid-template-columns: minmax(420px, 1.2fr) minmax(320px, 1fr); gap: 18px; min-height: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel.glass { background: var(--glass); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.panel-title { font-weight: 650; font-size: 13px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.side { display: flex; flex-direction: column; gap: 18px; min-height: 0; }
.lobby-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.slot { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid transparent; margin-bottom: 6px; background: rgba(255,255,255,0.025); transition: background .15s; }
.slot.you { border-color: rgba(232,176,75,.35); background: rgba(232,176,75,.06); }
.slot.open { cursor: pointer; }
.slot.open:hover { background: rgba(255,255,255,0.06); }
.slot.closed { opacity: .55; }
.swatch { width: 26px; height: 26px; border-radius: 8px; border: 2px solid rgba(255,255,255,.18); cursor: default; padding: 0; position: relative; }
.swatch.can { cursor: pointer; }
.slot-name { font-weight: 560; display: flex; align-items: center; gap: 8px; min-width: 0; }
.slot-name .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-sub { font-size: 12px; color: var(--muted); }
.badge { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; padding: 2px 6px; border-radius: 5px; background: rgba(255,255,255,.08); color: var(--muted); font-weight: 650; }
.badge.host { background: rgba(232,176,75,.16); color: var(--gold2); }
.badge.you { background: rgba(70,201,107,.16); color: #8be3a4; }
.palette { position: absolute; z-index: 20; top: 32px; left: -4px; display: grid; grid-template-columns: repeat(4, 24px); gap: 6px; padding: 8px; background: #1b222d; border: 1px solid var(--line2); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.palette div { width: 24px; height: 24px; border-radius: 6px; cursor: pointer; border: 2px solid transparent; }
.palette div.used { opacity: .35; }
.palette div:hover { border-color: #fff; }

.map-card { padding: 12px; }
#preview { width: 100%; aspect-ratio: 740 / 669; max-height: 42vh; object-fit: contain; display: block; border-radius: 8px; background: #0a0d12; }
.map-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 10px; }
.map-name { font-family: var(--serif); font-size: 19px; }
.chat-panel { flex: 1; display: flex; flex-direction: column; min-height: 160px; }
.chat-log { flex: 1; overflow-y: auto; font-size: 13px; padding-right: 4px; }
.chat-log .line { margin: 2px 0; word-wrap: break-word; }
.chat-log .who { font-weight: 650; margin-right: 6px; }
.chat-log .sys { color: var(--muted); font-style: italic; }
.chat-panel input { margin-top: 10px; }

/* ---------- game ---------- */
#screen-game { background: transparent; pointer-events: none; }
#screen-game > * { pointer-events: auto; }
#screen-game > #labels { pointer-events: none; }
#view-wrap {
  position: fixed; left: 0; top: 0; z-index: 0;
  width: calc(100vw / var(--rs, 1)); height: calc(100vh / var(--rs, 1));
  transform: scale(var(--rs, 1)); transform-origin: 0 0;
}
#view { display: block; width: 100%; height: 100%; cursor: default; }
#view.attack { cursor: crosshair; }
#view.panning { cursor: grabbing; }
.fs-off { display: none; }
#g-full.active .fs-on, #l-full.active .fs-on { display: none; }
#g-full.active .fs-off, #l-full.active .fs-off { display: inline; }
.lobby-tools { display: flex; align-items: center; gap: 12px; }
.actions button.danger { display: inline-flex; align-items: center; gap: 4px; }
.ico.skull { width: 15px; height: 15px; }
#topbar { position: absolute; top: 0; left: 0; right: 0; height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; background: linear-gradient(180deg, rgba(10,13,18,.92), rgba(10,13,18,.72)); border-bottom: 1px solid var(--line); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); z-index: 5; pointer-events: auto; }
.tb-left, .tb-right { flex: 1; display: flex; gap: 8px; align-items: center; }
.tb-right { justify-content: flex-end; }
.tb-center { display: flex; gap: 26px; align-items: center; }
.stat { display: flex; align-items: center; gap: 9px; }
.stat-val { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.05; }
.stat-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.stat-lbl b { color: var(--green); }
.stat.gold .stat-val { color: var(--gold2); }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.stat.gold .ico { color: var(--gold); }
.ring { width: 32px; height: 32px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255,255,255,.1); stroke-width: 3.5; }
.ring-fg { fill: none; stroke: var(--gold); stroke-width: 3.5; stroke-linecap: round; stroke-dasharray: 94.25; transition: stroke-dashoffset .25s linear; }
.icon-btn { padding: 6px 10px; min-width: 34px; height: 34px; display: grid; place-items: center; font-weight: 700; }
.icon-btn .ico { width: 18px; height: 18px; }

#players-panel { position: absolute; top: 62px; right: 12px; width: 312px; padding: 10px 12px; z-index: 4; font-size: 13px; }
.pl { display: grid; grid-template-columns: 12px minmax(0, 1fr) 46px 40px 38px 44px; gap: 6px; align-items: center; padding: 3px 0; }
.pl .dot { width: 10px; height: 10px; border-radius: 3px; }
.pl .num { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; min-width: 34px; text-align: right; }
.pl.head { cursor: pointer; user-select: none; font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); padding-bottom: 5px; border-bottom: 1px solid var(--line); margin-bottom: 3px; }
.pl.head .num { font-size: 10px; letter-spacing: .3px; }
.pl .num { min-width: 0; }
.pl .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* "report this player" flags: only the online version shows them (portal.css) */
.report-btn { display: none; }
.pl.dead { opacity: .4; text-decoration: line-through; }
.pl.me .nm { color: var(--gold2); }

#observer-banner { position: absolute; top: 62px; left: 50%; transform: translateX(-50%); background: rgba(229,72,77,.18); border: 1px solid rgba(229,72,77,.4); color: #ffb4b6; padding: 6px 16px; border-radius: 14px; z-index: 4; font-weight: 600; text-align: center; }

#minimap-wrap { position: absolute; right: 12px; bottom: 12px; padding: 6px; border-radius: 12px; border: 1px solid var(--line2); z-index: 4; }
#minimap { display: block; border-radius: 8px; cursor: pointer; }

#sel-panel { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); min-width: 360px; max-width: min(760px, calc(100vw - 800px)); z-index: 4; padding: 12px 14px; }
.sel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 8px; }
.sel-title { font-weight: 650; font-size: 15px; }
.sel-units { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: flex; align-items: center; gap: 6px; padding: 4px 9px 4px 5px; border-radius: 8px; background: rgba(255,255,255,.05); border: 1px solid var(--line); font-size: 12.5px; cursor: pointer; }
.chip canvas { width: 26px; height: 26px; }
.chip b { font-variant-numeric: tabular-nums; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.actions button { padding: 5px 10px; font-size: 12.5px; }
kbd { font: 11px var(--font); padding: 1px 5px; border-radius: 4px; background: rgba(255,255,255,.1); border: 1px solid var(--line2); margin-left: 5px; color: var(--muted); }
.shop { display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.buy { display: grid; grid-template-columns: 40px auto; grid-template-rows: auto auto; column-gap: 8px; align-items: center; padding: 6px 12px 6px 6px; text-align: left; min-width: 150px; }
.buy canvas { grid-row: span 2; width: 40px; height: 40px; }
.buy .bn { font-weight: 650; }
.buy .bc { font-size: 12px; color: var(--gold2); }
.hpbar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; width: 160px; }
.hpbar div { height: 100%; background: var(--green); }

#toasts { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 6; pointer-events: none; }
.toast { background: var(--glass); border: 1px solid var(--line2); padding: 7px 14px; border-radius: 10px; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); font-weight: 560; animation: toast-in .2s ease-out; }
.toast.good { border-color: rgba(70,201,107,.5); }
.toast.bad { border-color: rgba(229,72,77,.5); }
.toast.gold { border-color: rgba(232,176,75,.6); color: var(--gold2); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }

#game-chat { position: absolute; left: 12px; bottom: 12px; width: 360px; max-height: 220px; display: flex; flex-direction: column; z-index: 4; pointer-events: none; }
#game-chat .chat-log { max-height: 180px; overflow: hidden; text-shadow: 0 1px 2px #000; }
#game-chat .line { transition: opacity 1s; }
#game-chat .line.old { opacity: 0; }
#game-chat.open .line.old { opacity: .8; }
#game-chat input { pointer-events: auto; margin-top: 6px; background: var(--glass); }

#help { position: absolute; top: 62px; left: 12px; z-index: 6; font-size: 13px; }
#help td { padding: 3px 14px 3px 0; }
#help td:first-child { color: var(--gold2); white-space: nowrap; }

.overlay { position: fixed; inset: 0; background: rgba(5,7,10,.66); display: grid; place-items: center; z-index: 50; -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.end-card { text-align: center; padding: 36px 52px; background: var(--panel); border: 1px solid var(--line2); border-radius: 18px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.end-title { font-family: var(--serif); font-size: 46px; color: var(--gold2); }

.modal { background: var(--panel); border: 1px solid var(--line2); border-radius: 16px; width: min(820px, 94vw); max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 30px 90px rgba(0,0,0,.55); }
.modal-head { padding: 18px 20px 0; display: flex; justify-content: space-between; gap: 12px; }
.modal-body { padding: 4px 20px 10px; overflow: auto; }
.modal-foot { padding: 14px 20px; display: flex; gap: 8px; border-top: 1px solid var(--line); }
.stats-table { border-collapse: collapse; width: 100%; margin-bottom: 18px; }
.stats-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 600; padding: 6px; text-align: left; }
.stats-table td { padding: 4px 6px; }
.stats-table td:first-child { font-weight: 600; white-space: nowrap; }
.stats-table input, .settings-grid input { width: 100%; min-width: 64px; padding: 6px 8px; font-variant-numeric: tabular-nums; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 16px; }
.settings-grid label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
input:disabled { opacity: .7; }

#loading { flex-direction: column; gap: 14px; display: flex; align-items: center; justify-content: center; }
#loading.hidden { display: none; }
.boot-status { margin-top: 10px; min-height: 16px; font-size: 12.5px; color: var(--muted, #9aa3ad); }
.loader { width: 38px; height: 38px; border-radius: 50%; border: 3px solid rgba(255,255,255,.12); border-top-color: var(--gold); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .lobby-grid { grid-template-columns: 1fr; overflow: auto; }
  #sel-panel { max-width: calc(100vw - 24px); min-width: 0; bottom: 250px; }
}

/* ---------- 3D client overlay ---------- */
#view { outline: none; }
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.clabel .cinc { font-family: var(--font); font-weight: 700; font-size: 11px; letter-spacing: .04em; color: var(--gold2); text-align: center; }
.clabel { text-align: center; }
.clabel { position: absolute; left: 0; top: 0; font-family: var(--serif); font-weight: 600; font-size: 12px; letter-spacing: .18em; color: rgba(255, 248, 232, 0.9); text-shadow: 0 1px 2px rgba(0,0,0,.85), 0 0 6px rgba(0,0,0,.5); white-space: nowrap; display: none; }
#selbox { position: absolute; border: 1px solid rgba(125,255,160,.85); background: rgba(125,255,160,.08); pointer-events: none; z-index: 3; }
.kico { width: 24px; height: 24px; flex: none; }
.buy .kico { grid-row: span 2; width: 36px; height: 36px; }
.sel-panel .hint, #sel-panel .hint { font-size: 11.5px; margin-top: 8px; }
#topbar, #players-panel, #sel-panel, #minimap-wrap, #game-chat, #help, #toasts, #observer-banner { z-index: 5; }
.ustats { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 8px; font-size: 12.5px; }
.ustats .hpbar { width: 140px; }
.ustats b { font-variant-numeric: tabular-nums; }
.sel-title .kico { width: 18px; height: 18px; vertical-align: -3px; margin-right: 6px; }
.actions button.active { border-color: var(--gold2); color: var(--gold2); }
.lm-bonus { margin-top: 8px; font-size: 12.5px; color: var(--muted, #9aa3ad); }
.lm-bonus.on { color: var(--gold2); font-weight: 600; }
.lm-plus { color: var(--green); margin-left: 2px; }
.lm-text { margin: 8px 0 0; font-size: 12.5px; line-height: 1.45; max-width: 640px; color: #c9cfd6; }

/* ---------------------------------------------------------- loading screen */
#loading-screen {
  position: fixed; inset: 0; z-index: 45; display: flex; flex-direction: column; gap: 18px;
  padding: 26px 34px; overflow: hidden;
  background:
    radial-gradient(900px 500px at 15% 0%, rgba(232,176,75,0.16), transparent 60%),
    radial-gradient(900px 600px at 100% 100%, rgba(62,139,255,0.12), transparent 60%),
    linear-gradient(160deg, #0b0f15 0%, #121a24 55%, #0b0f15 100%);
}
#loading-screen.hidden { display: none; }
.ls-glow { position: absolute; inset: -20%; background: conic-gradient(from 200deg at 60% 40%, transparent, rgba(232,176,75,.05), transparent 40%); animation: ls-spin 30s linear infinite; pointer-events: none; }
@keyframes ls-spin { to { transform: rotate(360deg); } }
.ls-head { display: flex; justify-content: space-between; align-items: flex-end; position: relative; }
.ls-head .brand { font-size: 40px; margin: 0; }
.ls-sub { color: var(--gold2); letter-spacing: .08em; text-transform: uppercase; font-size: 13px; margin-top: 4px; }
.ls-main { flex: 1; display: grid; grid-template-columns: 300px 1fr; gap: 18px; min-height: 0; position: relative; }
.ls-players { padding: 16px; overflow: auto; }
.ls-pl { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 10px; margin: 12px 0 4px; font-size: 14px; }
.ls-pl .dot { width: 12px; height: 12px; border-radius: 50%; }
.ls-pl .pct { font-variant-numeric: tabular-nums; color: var(--muted, #9aa3ad); font-size: 12px; }
.ls-bar { height: 7px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; }
.ls-bar div { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--gold), var(--gold2)); transition: width .4s ease; }
.ls-bar.done div { background: linear-gradient(90deg, #2fae66, #57d68b); }
.ls-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; min-height: 0; }
#ls-card { flex: 1; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); min-height: 0; animation: ls-fade .5s ease; }
@keyframes ls-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ls-img { background-size: cover; background-position: center; position: relative; min-height: 220px; }
.ls-img::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 60%, rgba(17,22,30,.95)); }
.ls-img .ls-cap { position: absolute; left: 14px; bottom: 12px; z-index: 1; font-size: 12px; color: #e9e3d4; background: rgba(0,0,0,.45); padding: 3px 9px; border-radius: 6px; }
.ls-text { padding: 22px 26px; overflow: auto; }
.ls-text .kicker { color: var(--gold2); letter-spacing: .03em; font-size: 13px; font-weight: 700; }
.ls-text h2 { font-family: "Cormorant Garamond", Georgia, serif; font-size: 30px; margin: 4px 0 10px; }
.ls-text p, .ls-text li { font-size: 14px; line-height: 1.55; color: #cfd5dc; }
.ls-text ul { padding-left: 18px; margin: 8px 0; }
.ls-text b { color: #f2ead8; }
.ls-text table { border-collapse: collapse; width: 100%; font-size: 13px; margin-top: 6px; }
.ls-text th { text-align: left; color: var(--muted, #9aa3ad); font-weight: 600; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.ls-text td { padding: 4px 6px; border-bottom: 1px solid rgba(255,255,255,.04); font-variant-numeric: tabular-nums; }
.ls-nav { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 10px; border-top: 1px solid var(--line); }
.ls-nav button { width: 34px; height: 30px; padding: 0; font-size: 20px; line-height: 1; }
#ls-dots { display: flex; gap: 7px; }
#ls-dots span { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.18); cursor: pointer; }
#ls-dots span.on { background: var(--gold2); }
.ls-foot { display: flex; align-items: center; gap: 18px; position: relative; }
.ls-total { flex: 1; height: 4px; border-radius: 2px; background: rgba(255,255,255,.08); overflow: hidden; }
#ls-total-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold2)); transition: width .4s ease; }
.ls-start {
  font-size: 18px; font-weight: 700; padding: 14px 34px; border-radius: 12px; border: none; cursor: pointer; color: #241a06;
  background: linear-gradient(180deg, var(--gold2), var(--gold)); box-shadow: 0 0 0 0 rgba(245,207,122,.6);
  animation: ls-pulse 1.6s ease-out infinite;
}
@keyframes ls-pulse { 0% { box-shadow: 0 0 0 0 rgba(245,207,122,.55); } 100% { box-shadow: 0 0 0 18px rgba(245,207,122,0); } }
@media (max-width: 900px) { .ls-main { grid-template-columns: 1fr; } #ls-card { grid-template-columns: 1fr; } }

/* ------------------------------------------------- saved game, pause, rally */
.saved-card { display: flex; align-items: center; gap: 18px; padding: 10px 14px; border-radius: 12px; margin-left: auto; }
.saved-card.hidden { display: none; }
.sv-title { font-weight: 700; color: var(--gold2); }
.sv-meta { font-size: 12px; color: var(--muted, #9aa3ad); margin: 2px 0 4px; }
.sv-players { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; }
.sv-pl { display: inline-flex; align-items: center; gap: 6px; }
.sv-pl .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
#pause-overlay { position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: rgba(8, 11, 16, .45); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
#pause-overlay.hidden { display: none; }
.pause-card { padding: 26px 40px; border-radius: 16px; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.pause-title { font-family: "Cormorant Garamond", Georgia, serif; font-size: 40px; color: var(--gold2); letter-spacing: .06em; }
#g-pause.active { background: var(--gold); color: #241a06; }
.rally-hint { font-size: 12px; margin-top: 8px; }
.toast.saved { border-left: 3px solid #57d68b; }

.sel-cargo { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; }
.chip.small { padding: 2px 8px; font-size: 12px; cursor: default; }

.join-ask { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; margin-top: 8px; font-size: 13px; }
.join-ask button { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; pointer-events: auto; }
.join-ask .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
#join-popup { position: absolute; top: 76px; left: 50%; transform: translateX(-50%); z-index: 32; padding: 16px 20px; border-radius: 14px; max-width: 420px; display: flex; flex-direction: column; gap: 8px; }
#join-popup.hidden { display: none; }
.jp-title { font-weight: 700; font-size: 16px; color: var(--gold2); }
.jp-actions { display: flex; gap: 10px; justify-content: flex-end; }

.display-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 0 0 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.display-row label { font-weight: 600; }
.display-row #res-info { font-size: 12px; }

#sandbox-bar { position: absolute; top: 62px; left: 12px; z-index: 6; display: flex; gap: 14px; align-items: center; padding: 8px 12px; border-radius: 12px; font-size: 13px; }
#sandbox-bar.hidden { display: none; }
.sb-title { font-weight: 700; color: var(--gold2); }
.sb-side { display: inline-flex; gap: 4px; align-items: center; }
.sb-side button { padding: 3px 10px; font-size: 12px; }
.sb-side button.active { background: var(--gold); color: #241a06; border-color: var(--gold); }
#sandbox-btn.hidden { display: none; }

/* frame rate in the top bar: amber below 30, red below 20 */
.stat.fps .stat-val { min-width: 2.2em; text-align: right; font-variant-numeric: tabular-nums; }
.stat.fps.warn .stat-val { color: #e8b04a; }
.stat.fps.bad .stat-val { color: #ef6b5e; }
#gametime { font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .stat.fps .stat-lbl, #gametime + .stat-lbl { display: none; } }

/* formation buttons sit together like a segmented control */
.formation-group { display: inline-flex; gap: 0; }
.formation-group button { border-radius: 0; margin: 0; }
.formation-group button:first-child { border-radius: 6px 0 0 6px; }
.formation-group button:last-child { border-radius: 0 6px 6px 0; }

/* end-of-game statistics */
.end-stats { display: flex; flex-direction: column; gap: 8px; align-items: center; max-width: min(92vw, 640px); }
.end-stats table { border-collapse: collapse; font-size: 13px; }
.end-stats th { font-weight: 600; color: var(--muted, #9aa); padding: 4px 10px; text-align: right; }
.end-stats td { padding: 4px 10px; text-align: right; font-variant-numeric: tabular-nums; border-top: 1px solid var(--line2, #333); }
.end-stats td.who { text-align: left; white-space: nowrap; }
.end-stats .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.end-stats .chart { width: min(86vw, 560px); height: 150px; }
.end-stats .chart polyline { fill: none; stroke-width: 2.2; vector-effect: non-scaling-stroke; }
.end-stats .chart .axis { stroke: var(--line2, #444); stroke-width: 1; vector-effect: non-scaling-stroke; }
.end-stats .chart-label { font-size: 12px; }
@media (max-width: 560px) { .end-stats th:nth-child(4), .end-stats td:nth-child(4), .end-stats th:nth-child(6), .end-stats td:nth-child(6) { display: none; } }

/* attack alerts stand out from ordinary notes */
.toast.alert { border-color: #ef6b5e; color: #ffd9d4; }

/* copyright line at the bottom of the join, lobby and loading screens and in the About section */
.copyright { font-size: 11.5px; color: var(--muted, #9aa3ad); text-align: center; opacity: .8; position: relative; }
.join-card .copyright { margin-top: 18px; }
#screen-lobby > .copyright, #loading-screen > .copyright { margin-top: -10px; }
.about { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.about p { margin: 6px 0; }
.about .copyright { text-align: left; opacity: 1; }

/* players table: the header folds it (the arrow shows which way) */
.pl.head .fold { font-size: 11px; color: var(--muted); }
/* the player's own colour stays on the "give up" button only as an outline */
#g-giveup { padding: 0 10px; width: auto; font-size: 12px; }
#g-leave { padding: 0 10px; width: auto; font-size: 12px; }

/* small "Beta" mark next to the title on the start page */
/* pinned to the corner of the title: it takes no room, so the title stays on one line */
.brand .beta-host { position: relative; }
.brand .beta { position: absolute; left: 100%; top: -2px; margin-left: 6px; font-family: system-ui, sans-serif; font-size: 10px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--muted, #9aa3ad); border: 1px solid var(--line2, #3a4250); border-radius: 6px; padding: 2px 5px; line-height: 1.2; }

/* legal notice: a link-styled button in the footers, a small dialog above everything */
.legal-link { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }
.legal-link:hover { color: var(--gold2, #e8b04b); }
.legal-overlay { z-index: 80; }
.legal-card { width: min(480px, 92vw); }
.legal-body p { margin: 10px 0; line-height: 1.5; }
.legal-body a { color: var(--gold2, #e8b04b); }
.privacy-card { width: min(720px, 94vw); }
.modal-foot a.legal-link { font-size: 12.5px; align-self: center; }
.end-card .copyright { margin-top: 6px; }
.privacy-body h3 { font-size: 14px; margin: 18px 0 4px; color: var(--gold2, #e8b04b); }
.privacy-body ul { margin: 6px 0 10px 18px; padding: 0; }
.privacy-body li { margin: 3px 0; line-height: 1.45; }
.privacy-body p { font-size: 13.5px; }
/* the narrow start card: the two links on a line of their own (the first
   separator turns into the line break) */
.join-card .copyright .legal-sep:first-of-type { display: block; height: 4px; overflow: hidden; color: transparent; }
