/* CARNEVALE — shared theme */
:root {
  --ink: #efe6d2;
  --ink-dim: #b8a98c;
  --gold: #d9a441;
  --gold-soft: rgba(217, 164, 65, 0.45);
  --blood: #a32430;
  --blood-bright: #d03543;
  --night: #14101c;
  --night-2: #1d1726;
  --panel: rgba(26, 20, 32, 0.92);
  --panel-edge: rgba(217, 164, 65, 0.35);
  --ok: #7fbf6a;
  --font-display: 'Cinzel', 'Times New Roman', serif;
  --font-body: 'IM Fell English', Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  background: var(--night);
  color: var(--ink);
  font-family: var(--font-body);
  overflow: hidden;
}

body { overscroll-behavior: none; }
body.playerbody {
  position: fixed; inset: 0;
  width: 100%; height: 100vh; height: 100dvh;
  overflow: hidden;
  touch-action: none;
}

h1, h2, h3, .display { font-family: var(--font-display); letter-spacing: 0.06em; }

button {
  font-family: var(--font-display);
  cursor: pointer;
  border: none;
  color: var(--ink);
  background: none;
}

/* ---------- shared bits ---------- */
.btn {
  display: inline-block;
  padding: 14px 30px;
  font-size: 18px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  background: linear-gradient(180deg, #5d1722, #3c0e16);
  border: 1px solid var(--gold-soft);
  border-radius: 6px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 0.08s ease, box-shadow 0.12s ease, filter 0.12s;
}
.btn:hover { filter: brightness(1.18); }
.btn:active { transform: translateY(2px) scale(0.99); }
.btn.gold { background: linear-gradient(180deg, #8a6420, #5d4112); }
.btn.ghostly { background: rgba(255, 255, 255, 0.05); }
.btn:disabled { opacity: 0.35; cursor: default; filter: none; }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
  box-shadow: 0 12px 50px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
}

.flourish { color: var(--gold); opacity: 0.85; letter-spacing: 0.3em; font-size: 13px; }

input[type='text'] {
  font-family: var(--font-display);
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--panel-edge);
  color: var(--ink);
  border-radius: 6px;
  padding: 13px 14px;
  font-size: 20px;
  letter-spacing: 0.15em;
  outline: none;
  width: 100%;
  text-align: center;
}
input[type='text']:focus { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(217, 164, 65, 0.2); }
input::placeholder { color: rgba(239, 230, 210, 0.3); letter-spacing: 0.05em; }

/* ============================================================
   LANDING (index.html)
   ============================================================ */
.landing {
  height: 100vh; height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 20px;
  background:
    radial-gradient(1200px 700px at 50% -10%, #2c1f33 0%, transparent 60%),
    radial-gradient(900px 500px at 50% 110%, #2a1420 0%, transparent 55%),
    var(--night);
  text-align: center;
}
.landing .title { font-size: clamp(42px, 9vw, 84px); color: var(--ink); text-shadow: 0 0 40px rgba(217, 164, 65, 0.25); }
.landing .title .red { color: var(--blood-bright); }
.landing .subtitle { color: var(--ink-dim); font-style: italic; font-size: clamp(15px, 3vw, 20px); margin-top: -10px; }
.landing .card { padding: 28px 30px; width: min(420px, 92vw); display: flex; flex-direction: column; gap: 14px; }
.landing .divider { display: flex; align-items: center; gap: 12px; color: var(--ink-dim); font-size: 13px; letter-spacing: 0.25em; }
.landing .divider::before, .landing .divider::after { content: ''; flex: 1; height: 1px; background: var(--panel-edge); }
.landing .err { color: var(--blood-bright); font-size: 14px; min-height: 18px; }
.landing .tiny { color: var(--ink-dim); font-size: 13px; opacity: 0.8; }

/* ============================================================
   HOST (host.html)
   ============================================================ */
#stage { position: fixed; inset: 0; display: block; background: var(--night); }
#fxlayer { position: fixed; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; z-index: 2; }
#phlover { justify-content: center; gap: 14px; }
.phl-title { font-family: var(--font-display); font-size: 15px; letter-spacing: 0.2em; color: var(--gold); }
.phl-card { display: flex; align-items: center; gap: 12px; }
.phl-card.in { animation: phlin 0.4s ease; }
@keyframes phlin { from { opacity: 0; transform: scale(0.92); } }
#phl-killer, #phl-victim {
  width: 116px; height: 116px; border-radius: 14px; background: rgba(0,0,0,0.35);
  border: 2px solid var(--gold-soft); box-shadow: 0 8px 30px rgba(0,0,0,0.55);
}
#phl-victim { border-color: var(--blood-bright); }
.phl-verb { font-family: var(--font-display); font-style: italic; font-size: 15px; color: var(--ink-dim); }
.phl-line { font-family: var(--font-display); font-size: clamp(20px, 5.5vw, 30px); color: var(--ink); text-align: center; }
.phl-line .phl-contract { color: var(--gold); font-size: 0.7em; }
.phl-pts { font-family: var(--font-display); font-size: 20px; color: var(--ok); }
.phl-pts.bad { color: var(--blood-bright); }
.phl-dots { display: flex; gap: 7px; margin-top: 4px; }
.phl-dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(239,230,210,0.25); }
.phl-dot.on { background: var(--gold); }
#death-by { display: flex; flex-direction: column; align-items: center; gap: 10px; }
#death-by .death-kicker { font-family: var(--font-display); font-size: 15px; letter-spacing: 0.22em; color: var(--blood-bright); }
#death-portrait {
  width: 190px; height: 190px; border-radius: 16px;
  background: rgba(0,0,0,0.35); border: 2px solid var(--blood-bright);
  box-shadow: 0 0 44px rgba(208,53,67,0.35), 0 10px 40px rgba(0,0,0,0.6);
}
.death-name {
  font-family: var(--font-display); font-size: clamp(30px, 8vw, 52px);
  color: var(--ink); text-shadow: 0 3px 18px #000; letter-spacing: 0.02em;
}
#cohostbar {
  /* viewport-fixed, mid-right edge — a direct child of #pwrap (NOT inside
     #pmid, whose landscape stacking context used to trap it under the
     contract bar). Clear of the top pills and the bottom controls, and
     it floats above the end-of-round / champion overlays too. */
  position: fixed; top: 50%; right: 6px; transform: translateY(-50%);
  z-index: 55; display: flex; flex-direction: column; gap: 7px; align-items: flex-end;
  pointer-events: none;
}
.ch-mini {
  pointer-events: auto;
  font-family: var(--font-display); font-size: 13px; letter-spacing: 0.04em;
  padding: 9px 15px; border-radius: 8px; white-space: nowrap;
  background: rgba(20, 13, 20, 0.9); color: var(--ink);
  border: 1px solid var(--gold-soft); box-shadow: 0 3px 12px rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}
.ch-mini[data-cmd="skip"] { color: #f1b9be; border-color: rgba(163,36,48,0.5); }
.ch-mini:disabled { opacity: 0.4; }
#cohost-lobby {
  width: 100%; max-width: 420px; margin-top: 6px;
  display: flex; flex-direction: column; align-items: stretch; gap: 8px;
  padding-top: 10px; border-top: 1px solid rgba(217,164,65,0.25);
}
#cohost-lobby .ch-crown { font-family: var(--font-display); font-size: 12px; letter-spacing: 0.14em; color: var(--gold); text-align: center; }
.cohost-btn {
  pointer-events: auto;
  font-family: var(--font-display); font-size: 15px; letter-spacing: 0.05em;
  padding: 11px 18px; border-radius: 10px; width: 100%;
  background: rgba(24,16,24,0.92); color: var(--ink);
  border: 1px solid var(--gold-soft); box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.cohost-btn.ch-gear-wide { font-size: 14px; }
.cohost-btn.go { background: linear-gradient(180deg, #b8893a, #8a6420); color: #1c1208; border-color: #d9a441; }
.cohost-btn:disabled { opacity: 0.45; }
#cohost-settings {
  pointer-events: auto;
  width: 100%; max-height: 40vh; overflow-y: auto;
  background: rgba(18, 12, 20, 0.97); border: 1px solid var(--gold-soft);
  border-radius: 10px; padding: 8px 10px; box-shadow: 0 8px 26px rgba(0,0,0,0.6);
  -webkit-overflow-scrolling: touch; touch-action: pan-y;
}
#cohost-settings .ch-set {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 5px 0; font-size: 12.5px; color: var(--ink-dim);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
#cohost-settings .ch-set:last-child { border-bottom: none; }
#cohost-settings select {
  flex: 0 0 118px; font-size: 12.5px; padding: 4px 6px;
  background: rgba(0,0,0,0.35); color: var(--ink);
  border: 1px solid var(--panel-edge); border-radius: 6px;
}
.crownbtn {
  flex: none; width: 24px; height: 24px; margin-left: 4px;
  border-radius: 50%; border: 1px solid var(--gold-soft);
  background: transparent; color: var(--gold-soft); font-size: 13px; line-height: 1; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.crownbtn:hover { background: rgba(217,164,65,0.2); color: var(--gold); }
.crownbtn.on { background: var(--gold); color: #1c1208; border-color: var(--gold); }
#statusline.good { color: var(--ok); }
#pbuildtag { position: fixed; right: 6px; bottom: 4px; z-index: 60; font-size: 9px; letter-spacing: 0.1em; color: rgba(228, 216, 192, 0.3); pointer-events: none; }
#buildtag { position: fixed; left: 8px; bottom: 6px; z-index: 60; font-size: 10px; letter-spacing: 0.12em; color: rgba(228, 216, 192, 0.34); pointer-events: none; font-family: var(--font-display); }
.host-ui { position: fixed; inset: 0; pointer-events: none; }
.host-ui > * { pointer-events: auto; }

/* host.html begins route-pending so its lobby cannot flash before the Steam
   chooser (or the non-Steam private route) has been committed. */
body.steam-route-pending #stage,
body.steam-route-pending #fxlayer,
body.steam-route-pending #buildtag,
body.steam-route-pending .host-ui > :not(#game-type-gate) {
  visibility: hidden !important;
}

/* Steam matchmaking gate. It is an opaque layer over the existing lobby:
   choosing Private removes the layer and preserves the established host UI. */
.steam-gate {
  position: fixed; inset: 0; z-index: 80;
  align-items: center; justify-content: center;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  overflow: auto;
  background:
    radial-gradient(900px 520px at 50% -8%, rgba(104, 29, 48, 0.5), transparent 67%),
    radial-gradient(720px 420px at 50% 112%, rgba(91, 66, 28, 0.3), transparent 68%),
    var(--night);
}
.steam-menu {
  width: min(clamp(760px, 40vw, 1280px), calc(100vw - 36px));
  max-height: calc(100dvh - 36px);
  padding: clamp(22px, 2.2vw, 68px);
  overflow: auto;
  text-align: center;
}
.steam-menu-logo {
  margin: 0 0 11px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(36px, 3.45vw, 106px);
  line-height: 0.95;
  letter-spacing: 0.07em;
  unicode-bidi: isolate;
  text-shadow:
    0 2px 4px rgba(8, 5, 10, 0.95),
    0 5px 30px rgba(0, 0, 0, 0.78),
    0 0 42px rgba(217, 164, 65, 0.2);
}
.steam-menu-logo .red {
  color: var(--blood-bright);
  text-shadow:
    0 2px 4px rgba(8, 5, 10, 0.95),
    0 0 28px rgba(208, 53, 67, 0.42);
}
.steam-menu h2 {
  margin: 7px 0 10px;
  color: var(--gold);
  font-size: clamp(27px, 2.4vw, 74px);
  line-height: 1.12;
  text-shadow: 0 3px 0 rgba(20, 10, 22, 0.9);
}
.steam-menu-kicker {
  color: var(--blood-bright);
  font-family: var(--font-display);
  font-size: clamp(12px, 0.63vw, 19px);
  letter-spacing: 0.28em;
}
.steam-menu-note {
  max-width: clamp(630px, 33vw, 1010px);
  margin: 0 auto;
  color: var(--ink-dim);
  font-size: clamp(14px, 0.73vw, 22px);
  line-height: 1.55;
}
.steam-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}
.steam-choice {
  min-height: clamp(144px, 7.5vw, 230px);
  padding: clamp(20px, 1.05vw, 32px) clamp(18px, 0.95vw, 29px);
  white-space: normal;
  text-align: center;
}
.steam-choice strong {
  display: block;
  font-size: clamp(17px, 1.15vw, 35px);
  letter-spacing: 0.08em;
}
.steam-choice .steam-choice-title {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.45em;
}
.steam-choice > span {
  display: block;
  margin-top: 9px;
  color: rgba(239, 230, 210, 0.78);
  font-family: var(--font-body);
  font-size: clamp(12.5px, 0.66vw, 20px);
  line-height: 1.42;
  letter-spacing: 0.02em;
  text-transform: none;
  text-shadow: none;
}
.steam-choice .steam-beta-flag {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin: 0;
  padding: 4px 11px 4px 8px;
  color: #fff4dc;
  background: linear-gradient(180deg, #cf3d4a, #8f202d);
  border: 1px solid rgba(255, 226, 178, 0.72);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  clip-path: polygon(0 0, calc(100% - 5px) 0, 100% 50%, calc(100% - 5px) 100%, 0 100%);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
  unicode-bidi: isolate;
}
.steam-menu-state {
  min-height: 18px;
  margin-top: 15px;
  color: var(--ink-dim);
  font-size: clamp(12.5px, 0.66vw, 20px);
  line-height: 1.4;
}
.steam-menu-state.good { color: var(--ok); }
.steam-menu-state.bad { color: var(--blood-bright); }
.steam-back {
  min-height: clamp(44px, 2.3vw, 70px);
  margin-top: 17px;
  padding: 8px 18px;
  color: var(--ink-dim);
  border: 1px solid var(--gold-soft);
  border-radius: 6px;
  font-size: clamp(13px, 0.68vw, 21px);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.steam-back:hover, .steam-back:focus-visible { color: var(--ink); border-color: var(--gold); }

.private-join-card {
  min-height: clamp(144px, 7.5vw, 230px);
  padding: clamp(20px, 1.05vw, 32px) clamp(18px, 0.95vw, 29px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid rgba(217, 164, 65, 0.34);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(31, 23, 42, 0.92), rgba(18, 13, 25, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.private-join-card > strong {
  display: block;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(17px, 1.15vw, 35px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.private-code-form { margin: 15px 0 0; padding: 9px; }
.private-join-card .steam-menu-state { min-height: 17px; margin: 7px 0 0; }

.steam-browser { width: min(clamp(980px, 51vw, 1560px), calc(100vw - 36px)); text-align: left; }
.steam-browser-head {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  margin-bottom: 16px;
}
.steam-browser-head h2 { margin-bottom: 0; }
.steam-browser-head .btn { flex: 0 0 auto; min-height: 44px; padding: 10px 18px; font-size: 12px; }
.public-code-form {
  display: flex; align-items: flex-end; gap: 10px;
  margin: 0 0 13px; padding: 10px 12px;
  border: 1px solid rgba(217, 164, 65, 0.2);
  border-radius: 7px;
  background: rgba(10, 7, 13, 0.38);
}
.public-code-field {
  display: flex; flex: 1 1 auto; align-items: center; gap: 10px;
  min-width: 0;
}
.public-code-field > span {
  flex: 0 0 auto;
  color: rgba(239, 230, 210, 0.62);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.public-code-input {
  width: 8em; min-width: 0; min-height: 40px;
  padding: 7px 11px;
  border: 1px solid var(--gold-soft);
  border-radius: 6px;
  outline: none;
  background: rgba(4, 3, 7, 0.72);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-align: center;
  text-transform: uppercase;
  direction: ltr;
  unicode-bidi: isolate;
}
.public-code-input:focus-visible { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(217, 164, 65, 0.18); }
.public-code-input:disabled { opacity: 0.52; }
.public-code-form .btn { flex: 0 0 auto; min-height: 40px; padding: 8px 16px; font-size: 11px; }
.public-lobby-head, .public-lobby-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.5fr) minmax(140px, 1.2fr) minmax(115px, 1fr)
    minmax(80px, 0.7fr) 90px;
  gap: 10px;
  align-items: center;
}
.public-lobby-head {
  padding: 0 12px 7px;
  color: rgba(239, 230, 210, 0.52);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.public-lobby-list {
  display: flex; flex-direction: column; gap: 7px;
  min-height: 96px; max-height: min(50dvh, 430px);
  overflow-y: auto;
}
.public-lobby-row {
  padding: 11px 12px;
  border: 1px solid rgba(217, 164, 65, 0.24);
  border-radius: 7px;
  background: rgba(10, 7, 13, 0.58);
  font-size: 13px;
}
.public-lobby-row:hover { border-color: rgba(217, 164, 65, 0.52); }
.public-lobby-row .public-host { color: var(--gold); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.public-lobby-row .public-field { min-width: 0; color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.public-lobby-row .public-status.good { color: var(--ok); }
.public-lobby-row .public-status.bad { color: var(--blood-bright); }
.public-lobby-row .public-lobby-join { min-height: 40px; padding: 8px 10px; font-size: 11px; }
.public-lobby-row[aria-disabled='true'] { opacity: 0.67; }

.steam-guest { width: min(clamp(900px, 47vw, 1440px), calc(100vw - 36px)); }
.steam-guest-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(300px, 1.25fr);
  gap: clamp(22px, 4vw, 42px);
  align-items: center;
  margin-top: 19px;
  text-align: left;
}
.steam-guest-join { display: flex; flex-direction: column; align-items: center; text-align: center; }
.steam-guest-qr {
  width: 160px; height: 160px; margin-bottom: 13px; padding: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #1a1410; background: #f0e6d2; border-radius: 9px;
}
.steam-guest-qr img, .steam-guest-qr canvas { width: 140px !important; height: 140px !important; }
.steam-guest-join .code-label { margin-top: 7px; }
.steam-guest-code { direction: ltr; unicode-bidi: isolate; font-size: clamp(32px, 5vw, 44px); }
.steam-guest-info > p { color: var(--ink-dim); font-size: 14px; line-height: 1.55; }
.steam-guest-details {
  display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 14px;
  margin-top: 17px; padding: 14px;
  background: rgba(0, 0, 0, 0.26);
  border: 1px solid rgba(217, 164, 65, 0.18);
  border-radius: 7px;
  font-size: 13px;
}
.steam-guest-details dt { color: rgba(239, 230, 210, 0.56); text-transform: uppercase; letter-spacing: 0.1em; }
.steam-guest-details dd { min-width: 0; color: var(--ink); overflow-wrap: anywhere; }
.steam-guest-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 13px; }
.steam-guest-actions .btn { flex: 1 1 190px; min-height: 44px; padding: 10px 13px; font-size: 11px; }

.steam-listing {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid rgba(217, 164, 65, 0.18);
}
.steam-listing-state { display: block; color: var(--ink-dim); font-size: 11.5px; line-height: 1.35; }
.steam-listing-state.good { color: var(--ok); }
.steam-listing-state.bad { color: var(--blood-bright); }
.steam-listing-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.steam-mini-btn {
  min-height: 34px; padding: 5px 8px;
  color: var(--gold); border: 1px solid var(--gold-soft); border-radius: 5px;
  font-family: var(--font-body); font-size: 10.5px; letter-spacing: 0.03em;
}
.steam-mini-btn:hover, .steam-mini-btn:focus-visible { color: var(--ink); border-color: var(--gold); }
html[dir='rtl'] .steam-browser, html[dir='rtl'] .steam-guest-layout { text-align: right; }
html[dir='rtl'] .steam-guest-code, html[dir='rtl'] #public-guest-url { direction: ltr; unicode-bidi: isolate; }
html[dir='rtl'] .public-code-input { direction: ltr; unicode-bidi: isolate; }

@media (max-width: 760px) {
  .steam-menu { width: min(94vw, 620px); padding: 20px 16px; }
  .steam-choice-grid { grid-template-columns: 1fr; gap: 11px; margin-top: 18px; }
  .steam-choice { min-height: 108px; padding: 15px 13px; }
  .private-join-card { min-height: 108px; padding: 15px 13px; }
  .private-code-form { align-items: stretch; }
  .public-code-field { align-items: stretch; flex-direction: column; gap: 6px; }
  .public-code-input { width: 100%; }
  .public-lobby-head { display: none; }
  .public-lobby-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 7px 12px; }
  .public-lobby-row .public-host { grid-column: 1 / -1; }
  .public-lobby-row .public-lobby-join { grid-column: 1 / -1; width: 100%; }
  .steam-guest-layout { grid-template-columns: 1fr; gap: 18px; }
  .steam-guest-info { text-align: center; }
  .steam-guest-details { text-align: left; }
  html[dir='rtl'] .steam-guest-details { text-align: right; }
}

@media (max-height: 540px) and (orientation: landscape) {
  .steam-gate { align-items: flex-start; padding-top: max(8px, env(safe-area-inset-top)); padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .steam-menu { max-height: calc(100dvh - 16px); padding: 13px 18px; }
  .steam-menu-logo { margin-bottom: 5px; font-size: clamp(30px, 7vw, 44px); }
  .steam-menu h2 { font-size: clamp(23px, 4.5vw, 32px); margin: 3px 0 5px; }
  .steam-menu-note { font-size: 12px; line-height: 1.35; }
  .steam-choice-grid { margin-top: 10px; gap: 11px; }
  .steam-choice { min-height: 92px; padding: 11px 12px; }
  .private-join-card { min-height: 92px; padding: 11px 12px; }
  .private-code-form { margin-top: 8px; padding: 7px; }
  .steam-choice > span { margin-top: 5px; font-size: 11px; }
  .steam-menu-state { margin-top: 8px; }
  .steam-back { margin-top: 8px; }
  .public-lobby-list { max-height: 48dvh; }
  .steam-guest-layout { grid-template-columns: minmax(170px, 0.65fr) minmax(320px, 1.35fr); gap: 18px; margin-top: 7px; }
  .steam-guest-qr { width: 116px; height: 116px; margin-bottom: 5px; padding: 7px; }
  .steam-guest-qr img, .steam-guest-qr canvas { width: 102px !important; height: 102px !important; }
  .steam-guest-info > p { font-size: 11.5px; line-height: 1.35; }
  .steam-guest-details { margin-top: 8px; padding: 8px 10px; gap: 5px 10px; font-size: 11px; }
  .steam-guest-actions { margin-top: 7px; }
}

#hud {
  position: fixed; top: 0; left: 0; right: 0;
  display: none;
  justify-content: center;
  pointer-events: none;
}
#hud .ribbon {
  margin-top: clamp(10px, 0.52vw, 16px);
  display: flex; align-items: center; gap: clamp(26px, 1.36vw, 42px);
  padding: clamp(8px, 0.42vw, 13px) clamp(30px, 1.56vw, 48px);
  background: linear-gradient(180deg, rgba(20, 14, 24, 0.88), rgba(20, 14, 24, 0.72));
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
}
#hud .timer { font-family: var(--font-display); font-size: clamp(30px, 1.56vw, 48px); color: var(--ink); min-width: clamp(92px, 4.8vw, 147px); text-align: center; }
#hud .timer.low { color: var(--blood-bright); animation: pulse 1s infinite; }
#hud .roundlab { color: var(--ink-dim); letter-spacing: 0.2em; font-size: clamp(13px, 0.68vw, 21px); text-transform: uppercase; }
@keyframes pulse { 50% { opacity: 0.55; } }

#feed {
  position: fixed; left: 18px; bottom: 16px;
  display: flex; flex-direction: column-reverse; gap: 6px;
  pointer-events: none;
}
#feed .line {
  font-family: var(--font-body); font-size: 17px;
  color: var(--ink);
  background: rgba(16, 12, 20, 0.78);
  border-left: 3px solid var(--blood);
  padding: 6px 14px 6px 10px;
  border-radius: 0 6px 6px 0;
  opacity: 0;
  animation: feedin 0.35s ease forwards;
  max-width: 460px;
}
#feed .line.gold { border-left-color: var(--gold); }
@keyframes feedin { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
.fadeout { animation: fadeout 0.8s ease forwards !important; }
@keyframes fadeout { to { opacity: 0; } }

/* lobby overlay */
#lobby {
  position: fixed; inset: 0;
  display: flex; align-items: stretch; justify-content: space-between;
  padding: 4vh 4vw;
  gap: 24px;
}
#lobby .left-col { display: flex; flex-direction: column; justify-content: center; gap: 3vh; max-width: 46vw; }
#lobby .title-block {
  position: relative;
  padding: 18px 30px 16px 24px;
  border-radius: 14px;
  width: fit-content;
  background:
    radial-gradient(ellipse 120% 130% at 30% 50%, rgba(13, 9, 17, 0.88), rgba(13, 9, 17, 0.72) 55%, rgba(13, 9, 17, 0) 100%);
}
#lobby h1.game-title {
  font-size: clamp(40px, 5vw, 160px); line-height: 0.95;
  text-shadow:
    0 2px 4px rgba(8, 5, 10, 0.95),
    0 4px 14px rgba(8, 5, 10, 0.85),
    0 6px 50px rgba(0, 0, 0, 0.8),
    0 0 60px rgba(217, 164, 65, 0.18);
}
#lobby h1.game-title .red {
  color: var(--blood-bright);
  text-shadow:
    0 2px 4px rgba(8, 5, 10, 0.95),
    0 4px 14px rgba(8, 5, 10, 0.9),
    0 0 34px rgba(208, 53, 67, 0.45);
}
#lobby .tagline {
  font-style: italic;
  color: var(--parchment, #efe6d2);
  opacity: 0.92;
  font-size: clamp(15px, 1.15vw, 35px);
  text-shadow: 0 1px 3px rgba(8, 5, 10, 0.95), 0 3px 10px rgba(8, 5, 10, 0.85);
}
#lobby .howto {
  font-size: clamp(13.5px, 0.92vw, 28px);
  color: #ddd2b8;
  line-height: 1.62;
  max-width: 54ch;
  background: rgba(18, 13, 22, 0.88);
  border: 1px solid var(--panel-edge);
  border-left: 3px solid var(--gold);
  border-radius: 10px;
  padding: clamp(16px, 0.85vw, 26px) clamp(20px, 1.05vw, 32px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(5px);
}
#lobby .howto b { color: #f5edd9; font-weight: 600; }
#lobby .howto .gold { color: var(--gold); }

#joincard { padding: clamp(22px, 1.15vw, 35px) clamp(26px, 1.36vw, 42px); display: flex; gap: clamp(22px, 1.15vw, 35px); align-items: center; width: fit-content; }
#joincard .qr { width: clamp(124px, 6.46vw, 198px); height: clamp(124px, 6.46vw, 198px); background: #efe6d2; padding: clamp(8px, 0.42vw, 13px); border-radius: 6px; }
#joincard .qr img, #joincard .qr canvas { width: 100%; height: 100%; }
#joincard .meta { display: flex; flex-direction: column; gap: 4px; }
#joincard .url { color: var(--ink-dim); font-size: clamp(15px, 0.78vw, 24px); }
#joincard .url b { color: var(--ink); }
#joincard .code { font-family: var(--font-display); font-size: clamp(44px, 3.75vw, 115px); color: var(--gold); letter-spacing: 0.22em; line-height: 1; text-shadow: 0 0 30px rgba(217, 164, 65, 0.35); }
#joincard .code-label { color: var(--ink-dim); font-size: clamp(12px, 0.63vw, 19px); letter-spacing: 0.3em; text-transform: uppercase; }
#joincard .netstate { font-size: clamp(12.5px, 0.66vw, 20px); color: var(--ink-dim); }
#joincard .netstate.bad { color: var(--blood-bright); }

#lobby .right-col { display: flex; flex-direction: column; justify-content: center; gap: clamp(14px, 0.73vw, 22px); width: min(clamp(420px, 22vw, 680px), 42vw); }
#roster { padding: clamp(18px, 0.94vw, 29px); display: flex; flex-direction: column; gap: clamp(8px, 0.42vw, 13px); max-height: 52vh; overflow-y: auto; }
#roster h3 { color: var(--ink-dim); font-size: clamp(13px, 0.68vw, 21px); letter-spacing: 0.25em; text-transform: uppercase; margin-bottom: 4px; }
#roster .empty { color: var(--ink-dim); font-style: italic; opacity: 0.7; padding: 10px 4px; }
.rost-row { display: flex; align-items: center; gap: clamp(12px, 0.63vw, 19px); padding: clamp(7px, 0.36vw, 11px) clamp(10px, 0.52vw, 16px); background: rgba(255, 255, 255, 0.035); border-radius: 6px; }
.rost-row canvas { width: clamp(40px, 2.08vw, 64px); height: clamp(40px, 2.08vw, 64px); border-radius: 4px; flex: none; }
.rost-row .nm { font-family: var(--font-display); font-size: clamp(17px, 0.89vw, 27px); flex: 1; }
.rost-row .cos { color: var(--ink-dim); font-size: clamp(13px, 0.68vw, 21px); font-style: italic; }
.howto .casttip {
  margin-top: 10px; padding-top: 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12.5px; color: var(--ink-dim);
}

.rost-row .kickbtn {
  flex: none;
  width: 24px; height: 24px;
  margin-left: 6px;
  border-radius: 50%;
  border: 1px solid rgba(208, 53, 67, 0.45);
  background: transparent;
  color: rgba(208, 53, 67, 0.8);
  font-size: 12px; line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.rost-row .kickbtn:hover {
  background: var(--blood, #a32430);
  border-color: var(--blood-bright, #d03543);
  color: #fff;
}

.rost-row .rdy { font-size: 12px; letter-spacing: 0.15em; color: var(--ink-dim); }
.rost-row .rdy.on { color: var(--ok); }

#settings { padding: clamp(14px, 0.73vw, 22px) clamp(18px, 0.94vw, 29px); display: flex; gap: clamp(18px, 0.94vw, 29px); align-items: center; flex-wrap: wrap; }
#settings label { color: var(--ink-dim); font-size: clamp(13px, 0.68vw, 21px); letter-spacing: 0.1em; display: flex; align-items: center; gap: clamp(8px, 0.42vw, 13px); }
#settings #lobby-size-setting[hidden] { display: none; }
#settings .settings-back {
  min-height: 38px;
  padding: 8px 14px;
  color: #fff4dc;
  background: linear-gradient(180deg, rgba(163, 36, 48, 0.96), rgba(76, 18, 28, 0.96));
  border: 1px solid var(--gold);
  border-radius: 5px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  transition: transform 0.08s ease, filter 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
#settings .settings-back::before { content: '\2190'; margin-right: 6px; }
html[dir='rtl'] #settings .settings-back::before { content: '\2192'; margin-right: 0; margin-left: 6px; }
#settings .settings-back:hover, #settings .settings-back:focus-visible {
  color: #fff;
  border-color: #f0c56a;
  filter: brightness(1.12);
  box-shadow: 0 4px 16px rgba(163, 36, 48, 0.42), 0 0 0 2px rgba(217, 164, 65, 0.18);
  transform: translateY(-1px);
}
#settings .settings-back:active { transform: translateY(1px); }
#settings .settings-back:disabled { opacity: 0.42; cursor: default; }
#settings .settings-back[hidden] { display: none; }
#settings select {
  font-family: var(--font-display); background: rgba(0, 0, 0, 0.5); color: var(--ink);
  border: 1px solid var(--panel-edge); border-radius: 4px; padding: clamp(5px, 0.26vw, 8px) clamp(8px, 0.42vw, 13px); font-size: clamp(14px, 0.73vw, 22px);
}
@media (max-height: 620px) and (min-width: 821px) {
  #lobby { padding-top: 12px; padding-bottom: 12px; }
  #lobby .right-col {
    justify-content: flex-start;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
  }
  #roster { flex: none; max-height: 120px; }
}
#startbtn { font-size: clamp(22px, 1.15vw, 35px); padding: clamp(18px, 0.94vw, 29px) clamp(30px, 1.56vw, 48px); }
#lobby .hint { color: var(--ink-dim); font-size: clamp(13px, 0.68vw, 21px); font-style: italic; text-align: center; }

/* reveal / podium overlays */
.bigover {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3vh;
  background: radial-gradient(ellipse at 50% 42%, rgba(10, 7, 14, 0.6), rgba(10, 7, 14, 0.84));
}
.bigover h2 { font-size: clamp(34px, 3.13vw, 96px); text-shadow: 0 4px 30px #000; }
.bigover .sub { color: var(--ink-dim); font-style: italic; font-size: clamp(18px, 0.94vw, 29px); margin-top: -2vh; }
#scoretable { border-collapse: collapse; min-width: min(clamp(760px, 39.6vw, 1216px), 86vw); }
#scoretable th { font-family: var(--font-display); font-size: clamp(13px, 0.68vw, 21px); letter-spacing: 0.2em; color: var(--ink-dim); text-transform: uppercase; padding: clamp(8px, 0.42vw, 13px) clamp(16px, 0.83vw, 26px); border-bottom: 1px solid var(--panel-edge); }
#scoretable td { padding: clamp(9px, 0.47vw, 14px) clamp(16px, 0.83vw, 26px); font-size: clamp(19px, 0.99vw, 30px); text-align: center; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
#scoretable td.nm { font-family: var(--font-display); text-align: left; }
#scoretable td.pts { font-family: var(--font-display); color: var(--gold); }
#scoretable tr.first td { background: rgba(217, 164, 65, 0.08); }
#scoretable td.innocents.bad { color: var(--blood-bright); font-family: var(--font-display); }
#scoretable .cosmini { width: clamp(34px, 1.77vw, 54px); height: clamp(34px, 1.77vw, 54px); vertical-align: middle; border-radius: 4px; }
#scoretable .delta { color: var(--ink-dim); font-size: clamp(14px, 0.73vw, 22px); }

.podium-wrap { display: flex; align-items: flex-end; gap: 3vw; margin-top: 2vh; }
.podium { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.podium canvas { border-radius: 8px; box-shadow: 0 14px 50px rgba(0, 0, 0, 0.7); }
.podium .pname { font-family: var(--font-display); font-size: clamp(24px, 1.25vw, 38px); }
.podium .ppts { color: var(--gold); font-family: var(--font-display); }
.podium .plinth { background: linear-gradient(180deg, #3a2d44, #241b2e); border: 1px solid var(--panel-edge); border-bottom: none; width: clamp(150px, 7.81vw, 240px); text-align: center; font-family: var(--font-display); font-size: clamp(30px, 1.56vw, 48px); color: var(--gold); padding-top: clamp(10px, 0.52vw, 16px); border-radius: 6px 6px 0 0; }
.podium.p1 .plinth { height: clamp(120px, 6.25vw, 192px); } .podium.p2 .plinth { height: clamp(80px, 4.17vw, 128px); } .podium.p3 .plinth { height: clamp(52px, 2.71vw, 83px); }
.champion-label { color: var(--gold); letter-spacing: 0.35em; font-size: clamp(15px, 0.78vw, 24px); text-transform: uppercase; }

.host-corner { position: fixed; top: clamp(12px, 0.63vw, 19px); right: clamp(14px, 0.73vw, 22px); display: flex; gap: clamp(8px, 0.42vw, 13px); }
.host-corner button { font-size: clamp(12px, 0.63vw, 19px); letter-spacing: 0.12em; padding: clamp(7px, 0.36vw, 11px) clamp(12px, 0.63vw, 19px); background: rgba(20, 14, 24, 0.8); border: 1px solid var(--panel-edge); border-radius: 5px; color: var(--ink-dim); text-transform: uppercase; }
.host-corner button:hover { color: var(--ink); border-color: var(--gold); }

#countover { position: fixed; inset: 0; display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; pointer-events: none; }
#countover .num { font-family: var(--font-display); font-size: 22vh; color: var(--ink); text-shadow: 0 0 80px rgba(217, 164, 65, 0.4), 0 10px 40px #000; animation: countpop 0.9s ease; }
#countover .word { font-family: var(--font-display); font-size: 6vh; color: var(--blood-bright); letter-spacing: 0.4em; text-shadow: 0 0 60px rgba(208, 53, 67, 0.5); }
@keyframes countpop { 0% { transform: scale(1.7); opacity: 0; } 25% { transform: scale(1); opacity: 1; } }

/* ============================================================
   PLAYER (player.html) — phone controller
   ============================================================ */
.steam-player-back {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  z-index: 120;
  min-height: 40px;
  padding: 9px 14px;
  color: #fff4dc;
  background: linear-gradient(180deg, rgba(163, 36, 48, 0.98), rgba(76, 18, 28, 0.98));
  border: 1px solid var(--gold);
  border-radius: 7px;
  box-shadow: 0 7px 24px rgba(0, 0, 0, 0.58);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.steam-player-back[hidden] { display: none; }
.steam-player-back:hover, .steam-player-back:focus-visible { filter: brightness(1.16); }
.steam-player-back:disabled { opacity: 0.55; cursor: default; }

.steam-player-audio {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 7px 10px;
  color: #fff4dc;
  background: rgba(20, 14, 24, 0.94);
  border: 1px solid var(--panel-edge);
  border-radius: 7px;
  box-shadow: 0 7px 24px rgba(0, 0, 0, 0.5);
}
.steam-player-audio[hidden] { display: none; }
.steam-player-audio button {
  min-height: 28px;
  padding: 5px 9px;
  color: var(--ink);
  background: rgba(72, 48, 80, 0.85);
  border: 1px solid var(--gold-dim);
  border-radius: 5px;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.steam-player-audio button:hover, .steam-player-audio button:focus-visible { filter: brightness(1.15); }
.steam-player-audio label { display: flex; align-items: center; gap: 5px; color: var(--gold); font-size: 11px; font-weight: 700; }
.steam-player-audio input[type="range"] { width: 74px; accent-color: var(--gold); }
body.player-audio-active #ptop { padding-right: min(330px, 38vw); }

.steam-chat {
  position: fixed;
  left: max(16px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 125;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 7px;
  width: min(430px, 42vw);
  color: var(--ink);
  text-align: left;
  pointer-events: none;
}
/* Keep host notifications and chat on opposite sides of the live TV view. */
body.host-screen .host-chat {
  left: auto;
  right: max(16px, env(safe-area-inset-right));
}
.steam-chat[hidden] { display: none; }
.steam-chat-log {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 30vh;
  overflow: hidden;
}
.steam-chat-line {
  padding: 7px 10px;
  background: rgba(15, 10, 20, 0.86);
  border-left: 3px solid var(--gold-dim);
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.36);
  font-size: 13px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.steam-chat-line.mine { border-left-color: var(--gold); }
.steam-chat-line .author { color: var(--gold); font-family: var(--font-display); font-weight: 700; }
.steam-chat-line.expiring { animation: steam-chat-expire 800ms linear forwards; }
@keyframes steam-chat-expire { from { opacity: 1; } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .steam-chat-line.expiring { animation: none !important; }
}
.steam-chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
  padding: 8px;
  background: rgba(15, 10, 20, 0.96);
  border: 1px solid var(--gold-dim);
  border-radius: 7px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.58);
  pointer-events: auto;
}
.steam-chat-form[hidden] { display: none; }
.steam-chat-form input {
  min-width: 0;
  padding: 9px 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--panel-edge);
  border-radius: 5px;
  font: 14px var(--font-body);
}
.steam-chat-form button {
  padding: 8px 13px;
  color: #fff4dc;
  background: linear-gradient(180deg, #8b2636, #511923);
  border: 1px solid var(--gold-dim);
  border-radius: 5px;
  font-family: var(--font-display);
  font-weight: 700;
}
.steam-chat-hint {
  align-self: flex-start;
  padding: 5px 8px;
  color: var(--ink-dim);
  background: rgba(15, 10, 20, 0.72);
  border: 1px solid rgba(217, 164, 65, 0.24);
  border-radius: 4px;
  cursor: pointer;
  pointer-events: auto;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.steam-lobby-summary {
  display: none;
  width: 100%;
  max-width: 620px;
  padding: 15px;
  background: rgba(20, 14, 24, 0.78);
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
  text-align: left;
}
.steam-lobby-summary[hidden] { display: none; }
.steam-lobby-summary-title, .steam-lobby-players-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--gold);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.steam-lobby-summary-title { margin-bottom: 10px; font-size: 15px; }
.steam-lobby-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
  margin-bottom: 14px;
}
.steam-lobby-setting { display: flex; justify-content: space-between; gap: 8px; padding: 5px 7px; background: rgba(255, 255, 255, 0.035); border-radius: 4px; font-size: 12px; }
.steam-lobby-setting span:first-child { color: var(--ink-dim); }
.steam-lobby-setting strong { color: var(--ink); text-align: right; }
.steam-lobby-players-title { padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.08); font-size: 12px; }
.steam-lobby-players { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.steam-lobby-player { display: grid; grid-template-columns: 1fr auto; gap: 5px; padding: 7px 9px; background: rgba(255, 255, 255, 0.04); border-left: 3px solid var(--panel-edge); border-radius: 4px; font-size: 12px; }
.steam-lobby-player.me { border-left-color: var(--gold); }
.steam-lobby-player .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.steam-lobby-player .state { color: var(--ink-dim); font-size: 10px; font-weight: 700; letter-spacing: 0.04em; }
.steam-lobby-player .state.ready { color: #79cf91; }
#lobbyover.player-ready #steam-lobby-summary { display: block; }
#lobbyover.player-ready .lobby-main > :not(#steam-lobby-summary):not(#lobby-chat-slot) { display: none; }
#lobbyover.player-ready .lobby-main { justify-content: flex-start; }

@media (max-width: 700px) {
  .steam-player-audio { top: 6px; right: 6px; gap: 5px; padding: 5px 6px; }
  .steam-player-audio button { padding: 4px 6px; font-size: 9px; }
  .steam-player-audio label { display: none; }
  body.player-audio-active #ptop { padding-right: 92px; }
  .steam-chat { left: 10px; bottom: 10px; width: calc(100vw - 20px); }
  .steam-chat-log { max-height: 25vh; }
  .steam-chat-line { font-size: 12px; }
  .steam-lobby-settings, .steam-lobby-players { grid-template-columns: 1fr; }
}

.pwrap {
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  background:
    radial-gradient(120% 60% at 50% -8%, #2c1f33 0%, transparent 55%),
    var(--night);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  overflow: hidden;
}

#ptop {
  display: flex; align-items: center; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: rgba(16, 12, 20, 0.85);
  border-bottom: 1px solid var(--panel-edge);
}
#ptop .me-bust { width: 46px; height: 46px; border-radius: 6px; flex: none; }
#ptop .me-meta { flex: 1; min-width: 0; }
#ptop .me-name { font-family: var(--font-display); font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#ptop .me-cos { font-size: 12.5px; color: var(--gold); font-style: italic; white-space: nowrap; }
#ptop .me-score { font-family: var(--font-display); font-size: 22px; color: var(--ink); text-align: right; }
#ptop .me-score small { display: block; font-size: 9px; color: var(--ink-dim); letter-spacing: 0.25em; }

#contractbar {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px;
  background: rgba(30, 16, 22, 0.85);
  border-bottom: 1px solid rgba(163, 36, 48, 0.4);
}
#contractbar .c-bust { width: 38px; height: 38px; border-radius: 5px; flex: none; }
#contractbar .c-meta { flex: 1; min-width: 0; }
#contractbar .c-label { font-size: 10px; letter-spacing: 0.28em; color: var(--blood-bright); text-transform: uppercase; }
#contractbar .c-name { font-family: var(--font-display); font-size: 15px; white-space: nowrap; }
#heat { display: flex; gap: 3px; align-items: center; }
#heat .seg { width: 16px; height: 8px; border-radius: 2px; background: rgba(255, 255, 255, 0.1); transition: background 0.25s; }
#heat .seg.on1 { background: #6b4f86; }
#heat .seg.on2 { background: #9a5a3c; }
#heat .seg.on3 { background: #c46a2e; }
#heat .seg.on4 { background: #d03543; box-shadow: 0 0 8px rgba(208, 53, 67, 0.7); }
#heat .hlabel { font-size: 10px; color: var(--ink-dim); margin-left: 5px; letter-spacing: 0.1em; text-transform: uppercase; min-width: 52px; }

#pmid { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; }
#minimap { border: 1px solid var(--panel-edge); border-radius: 10px; background: #100c16; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }
#statusline {
  position: absolute; bottom: 8px; left: 0; right: 0;
  text-align: center; font-style: italic; color: var(--ink-dim); font-size: 13.5px;
  pointer-events: none; padding: 0 16px;
}
#statusline.alert { color: var(--gold); }

#pbottom {
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 6px 16px calc(16px + env(safe-area-inset-bottom));
  gap: 10px;
}

#stickzone { width: 168px; height: 168px; position: relative; flex: none; }
#stickbase {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.35) 70%);
  border: 1.5px solid var(--panel-edge);
}
#stickbase::after {
  content: ''; position: absolute; inset: 26%;
  border-radius: 50%; border: 1px dashed rgba(217, 164, 65, 0.25);
}
#sticknub {
  position: absolute; width: 64px; height: 64px; left: 52px; top: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #6b5a7e, #2c2138 70%);
  border: 1.5px solid var(--gold-soft);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6);
}

#actioncluster { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
#abilrow { display: flex; gap: 10px; }
.abilbtn {
  width: 62px; height: 62px; border-radius: 12px;
  background: linear-gradient(180deg, #2e2440, #1c1628);
  border: 1.5px solid var(--panel-edge);
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  transition: filter 0.1s;
}
.abilbtn svg { width: 30px; height: 30px; stroke: var(--ink); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.abilbtn .cdmask {
  position: absolute; inset: 0; background: rgba(8, 5, 12, 0.82);
  transform-origin: bottom; transform: scaleY(0);
}
.abilbtn .cdtext { position: absolute; font-family: var(--font-display); font-size: 18px; color: var(--ink-dim); display: none; }
.abilbtn.cooling .cdtext { display: block; }
.abilbtn.cooling svg { opacity: 0.3; }
.abilbtn.armed { border-color: var(--ok); box-shadow: 0 0 14px rgba(127, 191, 106, 0.4); }
.abilbtn:active { filter: brightness(1.4); }

#killbtn {
  width: 96px; height: 96px; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #7e1c28, #45101a 75%);
  border: 2px solid rgba(217, 164, 65, 0.5);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.12);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  transition: box-shadow 0.15s, filter 0.15s, transform 0.08s;
}
#killbtn svg { width: 40px; height: 40px; stroke: var(--ink); fill: none; stroke-width: 1.6; stroke-linecap: round; }
#killbtn span { font-family: var(--font-display); font-size: 10px; letter-spacing: 0.3em; color: var(--ink-dim); }
#killbtn.ready {
  border-color: var(--blood-bright);
  box-shadow: 0 0 26px rgba(208, 53, 67, 0.75), 0 8px 26px rgba(0, 0, 0, 0.6);
  animation: killpulse 1.1s infinite;
}
#killbtn.ready span { color: var(--ink); }
#killbtn:active { transform: scale(0.94); }
#killbtn:disabled { opacity: 0.4; }
@keyframes killpulse { 50% { box-shadow: 0 0 40px rgba(208, 53, 67, 1), 0 8px 26px rgba(0, 0, 0, 0.6); } }

/* phone overlays */
.pover {
  position: absolute; inset: 0; z-index: 30;
  background: rgba(13, 9, 18, 0.96);
  display: flex; flex-direction: column; align-items: center;
  padding: calc(14px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  text-align: center;
  gap: 12px;
}
.pover > * { flex: none; }

/* lobby wrappers vanish in portrait; flex `order` keeps the classic flow */
.lobby-side, .lobby-main { display: contents; }
#lobbytitle { order: 1; }
.lobby-me { order: 2; }
#lobbycos { order: 3; }
.lobby-main .note:first-child { order: 4; }
#cosgrid { order: 5; }
.lobby-main .note:nth-child(3) { order: 6; }
#loadout-grid { order: 7; }
#readybtn { order: 8; }
#lobbynote { order: 9; }
/* items without an explicit order default to 0 and pool above the title —
   keep every lobby child placed on purpose */
#langsel { order: 0; }        /* the language picker leads, above the title */
#loadout-hint { order: 7; }   /* the tool hint stays with the tool grid */
#cohost-lobby { order: 11; }

/* ============================================================
   PHONE LANDSCAPE — menus: full-viewport overlays (the controls
   are fully covered), and the select screen becomes two columns:
   identity + Ready on the left, costume & tool grids scrolling
   on the right.
   ============================================================ */
.pwrap.landscape .pover {
  position: fixed; inset: 0;
  z-index: 40;
  background: rgba(13, 9, 18, 0.99);
}
.pwrap.landscape #lobbyover {
  flex-direction: row;
  align-items: stretch;
  text-align: center;
  gap: 0;
  overflow: hidden;
  padding: calc(8px + env(safe-area-inset-top)) calc(10px + env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) calc(10px + env(safe-area-inset-left));
}
.pwrap.landscape #lobbyover .lobby-side {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  flex: 0 0 232px;
  padding-right: 14px;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
}
.pwrap.landscape #lobbyover .lobby-side > * { order: 0; }
.pwrap.landscape #lobbyover #lobbytitle { margin: 0; font-size: 20px; }
.pwrap.landscape #lobbyover .lobby-me canvas { width: 84px; height: 84px; }
.pwrap.landscape #lobbyover #readybtn { position: static; width: 100%; box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5); }
.pwrap.landscape #lobbyover #lobbynote { margin: 0; font-size: 11px; }
.pwrap.landscape #lobbyover .lobby-main {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  /* clear of the browser's floating address pill */
  padding: 46px 6px 14px 14px;
}
.pwrap.landscape #lobbyover .lobby-main > * { order: 0; }
.pwrap.landscape .pover h2 { margin-top: 0; }
.pwrap.landscape #deathover, .pwrap.landscape #endover, .pwrap.landscape #waitover { justify-content: center; }

/* ============================================================
   TABLETS — same structure as phone landscape when wide, the
   portrait flow when tall, everything scaled for the big glass.
   ============================================================ */
.pwrap.tablet #stickzone { width: 188px; height: 188px; }
.pwrap.tablet #sticknub { width: 72px; height: 72px; left: 58px; top: 58px; }
.pwrap.tablet #killbtn { width: 116px; height: 116px; font-size: 15px; }
.pwrap.tablet .abilbtn { width: 72px; height: 72px; font-size: 24px; }
.pwrap.tablet #statusline { font-size: 15px; }
.pwrap.tablet .toast { font-size: 17px; }
.pwrap.tablet #ptop .me-bust { width: 46px; height: 46px; }
.pwrap.tablet #ptop .me-name { font-size: 16px; max-width: 150px; }
.pwrap.tablet #ptop .me-score { font-size: 20px; }
.pwrap.tablet #contractbar .c-bust, .pwrap.tablet #contractbar .c-top { width: 42px; height: 42px; }
.pwrap.tablet #contractbar .c-name { font-size: 15px; }
.pwrap.tablet #pmid.worldmode #minimap {
  width: 150px !important; height: 94px !important;
}
.pwrap.tablet #zoomwrap { width: 150px; top: 110px; }
.pwrap.tablet.landscape #pmid.worldmode #minimap {
  top: 68px; width: 130px !important; height: 82px !important;
}
.pwrap.tablet.landscape #zoomwrap { top: 162px; width: 130px; }
.pwrap.tablet.landscape #stickzone { width: 172px; height: 172px; opacity: 0.88; }
.pwrap.tablet.landscape #sticknub { width: 64px; height: 64px; left: 54px; top: 54px; }
.pwrap.tablet.landscape #killbtn { width: 108px; height: 108px; }
.pwrap.tablet.landscape .abilbtn { width: 66px; height: 66px; }
.pwrap.tablet.landscape #pbottom {
  padding: 0 calc(24px + env(safe-area-inset-left)) calc(20px + env(safe-area-inset-bottom)) calc(24px + env(safe-area-inset-right));
}
/* the select screen breathes on a tablet */
.pwrap.tablet.landscape #lobbyover .lobby-side {
  flex: 0 0 320px;
  gap: 14px;
  padding-right: 24px;
}
.pwrap.tablet.landscape #lobbyover #lobbytitle { font-size: 28px; }
.pwrap.tablet.landscape #lobbyover .lobby-me canvas { width: 124px; height: 124px; }
.pwrap.tablet.landscape #lobbyover #lobbynote { font-size: 13px; }
.pwrap.tablet.landscape #lobbyover .lobby-main {
  padding: 18px 24px 20px 26px;   /* no floating url pill on tablets */
  gap: 14px;
}
.pwrap.tablet:not(.landscape) .pover { padding-left: 7vw; padding-right: 7vw; }
.pwrap.tablet:not(.landscape) #cosgrid, .pwrap.tablet:not(.landscape) #loadout-grid { max-width: 720px; }
.pwrap.tablet:not(.landscape) #readybtn { max-width: 460px; }

/* the Ready button rides above the scrolling content, always reachable */
#readybtn {
  position: sticky;
  bottom: calc(4px + env(safe-area-inset-bottom));
  z-index: 5;
  box-shadow: 0 -10px 24px rgba(13, 9, 18, 0.9), 0 4px 18px rgba(0, 0, 0, 0.5);
}
.pover h2 { font-size: 24px; }
.pover .note { color: var(--ink-dim); font-style: italic; font-size: 14px; line-height: 1.5; }

#loadout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; width: 100%; max-width: 420px; }
#loadout-hint {
  width: 100%; max-width: 420px; margin-top: 8px;
  flex: none;                       /* never let flexbox shrink + clip the text */
  min-height: 2.2em; height: auto; padding: 8px 12px; box-sizing: border-box;
  font-size: 13px; line-height: 1.35; color: var(--ink-dim);
  background: rgba(20, 14, 24, 0.6); border: 1px solid var(--panel-edge);
  border-radius: 8px; text-align: left;
  overflow-wrap: anywhere; white-space: normal;
}
#loadout-hint b { color: var(--gold); font-family: var(--font-display); }
.loadout-card {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid var(--panel-edge); border-radius: 9px;
  padding: 9px 10px; text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.loadout-card svg { width: 26px; height: 26px; flex: none; stroke: var(--gold); fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.loadout-card .ln { font-family: var(--font-display); font-size: 13.5px; }
.loadout-card .lb { font-size: 11px; color: var(--ink-dim); line-height: 1.3; margin-top: 2px; }
.loadout-card.sel { border-color: var(--gold); background: rgba(217, 164, 65, 0.12); }
.loadout-card.dis { opacity: 0.45; }

#deathover { justify-content: center; background: rgba(30, 6, 10, 0.96); display: none; }
#deathover h2 { color: var(--blood-bright); font-size: 38px; letter-spacing: 0.2em; }
#deathover .resp { font-family: var(--font-display); font-size: 64px; }

#waitover, #endover { justify-content: center; display: none; }
#endover .standing { font-family: var(--font-display); font-size: 20px; line-height: 1.8; }
#endover .standing .pts { color: var(--gold); }
#endover .standing .me { color: var(--gold); }
#endover .standing.detailed {
  width: min(1100px, calc(100vw - 48px));
  min-width: 0;
  max-width: calc(100vw - 48px);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.25;
}
.player-scoreboard-scroll {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  background: rgba(16, 12, 20, 0.74);
}
.player-scoreboard {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}
.player-scoreboard th {
  padding: 8px 10px;
  border-bottom: 1px solid var(--panel-edge);
  color: var(--ink-dim);
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}
.player-scoreboard td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
  white-space: nowrap;
}
.player-scoreboard tbody tr:last-child td { border-bottom: 0; }
.player-scoreboard tr.me td { background: rgba(217, 164, 65, 0.09); }
.player-scoreboard td.name { max-width: 210px; overflow: hidden; text-overflow: ellipsis; text-align: left; font-family: var(--font-display); }
.player-scoreboard .costume-inner { display: flex; align-items: center; gap: 7px; text-align: left; }
.player-scoreboard td.costume canvas { width: 32px; height: 32px; flex: none; border-radius: 4px; }
.player-scoreboard td.innocents.bad { color: var(--blood-bright); font-family: var(--font-display); }
.player-scoreboard td.delta { color: var(--ink-dim); }
.player-scoreboard td.pts { color: var(--gold); font-family: var(--font-display); }

.toast {
  position: fixed; top: 86px; left: 50%; transform: translateX(-50%);
  background: rgba(20, 14, 24, 0.95); border: 1px solid var(--gold-soft);
  color: var(--ink); padding: 10px 20px; border-radius: 8px;
  font-family: var(--font-display); font-size: 16px; white-space: nowrap;
  max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis;
  z-index: 70; pointer-events: none;
  animation: toastin 0.25s ease;
}
.pwrap.landscape .toast {
  top: calc(60px + env(safe-area-inset-top));
  font-size: 14px;
}
.toast.bad { border-color: var(--blood-bright); color: #f1b9be; }
.toast.good { border-color: var(--ok); }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, -8px); } }

.conn-pill {
  position: absolute; top: 8px; right: 8px; z-index: 50;
  font-size: 10px; letter-spacing: 0.15em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 20px;
  background: rgba(0, 0, 0, 0.5); color: var(--ink-dim);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.conn-pill.bad { color: #f1b9be; border-color: var(--blood-bright); }

@media (max-height: 620px) {
  #stickzone { width: 132px; height: 132px; }
  #sticknub { width: 54px; height: 54px; left: 39px; top: 39px; }
  #killbtn { width: 78px; height: 78px; }
  .abilbtn { width: 52px; height: 52px; }
}


/* ---------- live leaderboard (TV) ---------- */
#leader {
  position: fixed; top: clamp(56px, 2.92vw, 90px); right: clamp(14px, 0.73vw, 22px);
  background: rgba(16, 12, 20, 0.78);
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  padding: clamp(8px, 0.42vw, 13px) clamp(12px, 0.63vw, 19px);
  min-width: clamp(150px, 7.81vw, 240px);
  pointer-events: none;
}
#leader .ltitle { font-family: var(--font-display); font-size: clamp(11px, 0.57vw, 18px); letter-spacing: 0.22em; color: var(--gold); text-transform: uppercase; margin-bottom: 4px; }
#leader .lrow { display: flex; justify-content: space-between; gap: clamp(14px, 0.73vw, 22px); font-size: clamp(13.5px, 0.7vw, 22px); color: var(--ink); padding: 1.5px 0; }
#leader .lrow b { color: var(--gold); font-family: var(--font-display); }

#hostplay { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
#hostplay select, #hostplay input {
  font-family: var(--font-display); background: rgba(0,0,0,0.5); color: var(--ink);
  border: 1px solid var(--panel-edge); border-radius: 4px; padding: 6px 8px; font-size: 12.5px;
  text-align: left; letter-spacing: 0.03em;
}
#playhere.on { border-color: var(--ok); color: var(--ink); }

/* ---------- scaled desktop / TV displays ----------
   Electron receives Windows-scaled dimensions in device-independent pixels:
   a 4K screen is roughly 1536x864 at 250%, 1280x720 at 300%, and 1097x617
   at 350%. Keep the user's accessibility scale, then make every host surface
   fit or scroll intentionally at those shorter desktop viewports. */
body.host-screen #lobby .left-col,
body.host-screen #lobby .right-col { min-width: 0; min-height: 0; }
body.host-screen .bigover {
  max-width: 100vw;
  max-height: 100dvh;
  overflow: auto;
  overscroll-behavior: contain;
}

/* A maximized 4K window at 200% can be only ~1000 CSS px tall after the
   taskbar and frame. Switch centering to top-aligned, owned scroll regions
   before anything can be clipped by the fixed host viewport. */
@media (min-width: 821px) and (max-height: 1040px) {
  body.host-screen #lobby {
    padding-top: clamp(16px, 2vh, 24px);
    padding-bottom: clamp(16px, 2vh, 24px);
  }
  body.host-screen #lobby .left-col,
  body.host-screen #lobby .right-col {
    justify-content: flex-start;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--gold-soft) transparent;
  }
  body.host-screen #lobby .left-col { padding-right: 5px; }
  body.host-screen #lobby .right-col {
    padding-top: 52px;
    padding-right: 5px;
    scroll-padding-top: 52px;
  }
  body.host-screen .bigover {
    justify-content: flex-start;
    padding-top: clamp(20px, 3vh, 32px);
    padding-bottom: clamp(20px, 3vh, 32px);
  }
}

@media (min-width: 821px) and (max-height: 900px) {
  body.host-screen .steam-gate {
    align-items: flex-start;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  body.host-screen .steam-menu {
    max-height: calc(100dvh - 24px);
    padding: clamp(18px, 3vh, 28px) clamp(20px, 3vw, 34px);
  }
  body.host-screen .steam-menu-logo { margin-bottom: 7px; font-size: clamp(38px, 5vw, 56px); }
  body.host-screen .steam-menu h2 { margin: 5px 0 8px; font-size: clamp(28px, 3.7vw, 40px); }
  body.host-screen .steam-choice-grid { gap: 12px; margin-top: 16px; }
  body.host-screen .steam-choice,
  body.host-screen .private-join-card { min-height: 112px; padding: 14px 15px; }
  body.host-screen .steam-back { margin-top: 11px; }
  body.host-screen .public-lobby-list { max-height: min(43dvh, 340px); }

  body.host-screen #lobby {
    padding: clamp(12px, 2vh, 18px) clamp(20px, 3.2vw, 50px);
    gap: clamp(20px, 3vw, 42px);
  }
  body.host-screen #lobby .left-col,
  body.host-screen #lobby .right-col {
    justify-content: flex-start;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--gold-soft) transparent;
  }
  body.host-screen #lobby .left-col {
    gap: clamp(10px, 1.6vh, 15px);
    max-width: 50vw;
    padding-right: 5px;
  }
  body.host-screen #lobby .right-col {
    width: min(440px, 42vw);
    gap: 10px;
    padding: 52px 5px 2px 0;
    scroll-padding-top: 52px;
  }
  body.host-screen #lobby .title-block { padding: 10px 22px 9px 18px; }
  body.host-screen #lobby h1.game-title { font-size: clamp(40px, 5vw, 70px); }
  body.host-screen #lobby .tagline { font-size: clamp(13px, 1.25vw, 17px); }
  body.host-screen #joincard { padding: 13px 17px; gap: 16px; max-width: 100%; }
  body.host-screen #joincard .qr {
    width: clamp(88px, 13vh, 112px);
    height: clamp(88px, 13vh, 112px);
    flex: none;
  }
  body.host-screen #joincard .meta { min-width: 0; }
  body.host-screen #joincard .url,
  body.host-screen #joincard .netstate { overflow-wrap: anywhere; }
  body.host-screen #joincard .code { font-size: clamp(38px, 4.3vw, 58px); }
  body.host-screen #lobby .howto {
    max-width: 100%;
    padding: 12px 15px;
    font-size: clamp(12px, 1.05vw, 14px);
    line-height: 1.42;
  }
  body.host-screen #lobby .howto .casttip { margin-top: 7px; padding-top: 7px; font-size: 11.5px; }
  body.host-screen #lobby .credit-line { margin-top: 7px; padding-top: 6px; font-size: 9.5px; line-height: 1.4; }
  body.host-screen #roster { flex: none; max-height: min(25dvh, 180px); padding: 12px; gap: 6px; }
  body.host-screen .rost-row { padding: 5px 8px; }
  body.host-screen .rost-row canvas { width: 34px; height: 34px; }
  body.host-screen #settings { padding: 10px 12px; gap: 9px 12px; }
  body.host-screen #settings label { gap: 6px; font-size: 11.5px; }
  body.host-screen #settings select { padding: 4px 6px; font-size: 12.5px; }
  body.host-screen #settings .settings-back { min-height: 34px; padding: 6px 10px; font-size: 10.5px; }
  body.host-screen #hostplay { padding: 9px 12px; gap: 7px; }
  body.host-screen #startbtn { padding: 12px 20px; font-size: 18px; }
  body.host-screen #lobby .hint { font-size: 12px; }

  body.host-screen .bigover {
    justify-content: flex-start;
    gap: clamp(9px, 1.6vh, 14px);
    padding: clamp(18px, 3vh, 28px) 18px;
  }
  body.host-screen .bigover h2 { font-size: clamp(30px, 4vw, 48px); }
  body.host-screen .bigover .sub { margin-top: 0; font-size: 15px; }
  body.host-screen #scoretable th { padding: 5px 10px; font-size: 11px; }
  body.host-screen #scoretable td { padding: 5px 10px; font-size: 16px; }
  body.host-screen #scoretable .cosmini { width: 28px; height: 28px; }
  body.host-screen #scoretable .delta { font-size: 12px; }
  body.host-screen #factline { min-height: 1.2em; font-size: clamp(19px, 2.4vw, 28px) !important; }
  body.host-screen .podium-wrap { margin-top: 0; }
  body.host-screen .podium { gap: 6px; }
  body.host-screen .podium canvas:not(.thead) { width: 88px !important; height: 88px !important; }
  body.host-screen .podium.p1 canvas:not(.thead) { width: 106px !important; height: 106px !important; }
  body.host-screen .podium .pname { font-size: 19px; }
  body.host-screen .podium .plinth { width: 124px; font-size: 25px; padding-top: 7px; }
  body.host-screen .podium.p1 .plinth { height: 88px; }
  body.host-screen .podium.p2 .plinth { height: 62px; }
  body.host-screen .podium.p3 .plinth { height: 44px; }
  body.host-screen #againbtn { margin-top: 0 !important; padding: 11px 24px; font-size: 15px; }
}

@media (min-width: 821px) and (max-height: 680px) {
  body.host-screen .steam-menu { padding-top: 13px; padding-bottom: 13px; }
  body.host-screen .steam-menu-logo { font-size: 40px; }
  body.host-screen .steam-menu h2 { font-size: 28px; }
  body.host-screen .steam-menu-note { font-size: 12px; line-height: 1.35; }
  body.host-screen .steam-choice-grid { margin-top: 10px; }
  body.host-screen .steam-choice,
  body.host-screen .private-join-card { min-height: 92px; padding: 11px 12px; }
  body.host-screen .steam-choice > span { margin-top: 5px; font-size: 11px; }
  body.host-screen #lobby .right-col { padding-top: 50px; scroll-padding-top: 50px; }
  body.host-screen #lobby .howto { font-size: 11.5px; line-height: 1.34; }
  body.host-screen #roster { max-height: 118px; }
  body.host-screen .host-corner { transform: scale(0.9); transform-origin: top right; }
  body.host-screen .bigover { padding-top: 14px; padding-bottom: 14px; }
  body.host-screen #scoretable th { padding-top: 4px; padding-bottom: 4px; }
  body.host-screen #scoretable td { padding-top: 4px; padding-bottom: 4px; font-size: 14px; }
}

/* At 400% Windows scaling the lobby's final controls extend below the short
   logical viewport. Park the idle Chat button in the narrow center gutter;
   live/count/reveal keep the normal bottom-right chat anchor. */
@media (min-width: 821px) and (max-height: 560px) {
  body.host-screen:has(#lobby[style*="display: flex"]) .host-chat {
    left: 50%;
    right: auto;
  }
}

/* ---------- host screen on phones / small screens ---------- */
@media (max-width: 820px) {
  #lobby {
    flex-direction: column;
    justify-content: flex-start;
    padding: 12px 14px calc(20px + env(safe-area-inset-bottom));
    gap: 14px;
    overflow-y: auto;
  }
  #lobby .left-col { max-width: 100%; gap: 12px; }
  #lobby h1.game-title { font-size: 44px; }
  #lobby .tagline { font-size: 14px; }
  #joincard { width: 100%; padding: 14px; gap: 14px; }
  #joincard .qr { width: 92px; height: 92px; flex: none; }
  #joincard .code { font-size: 46px; }
  #lobby .howto { display: none; }
  #lobby .right-col { width: 100%; }
  #roster { max-height: 30vh; }
  #settings { gap: 10px; padding: 10px 12px; }
  #settings label { font-size: 12px; }
  #startbtn { font-size: 17px; padding: 14px 18px; }
  #hud .ribbon { gap: 14px; padding: 6px 14px; }
  #hud .timer { font-size: 22px; min-width: 64px; }
  #feed .line { font-size: 13px; max-width: 76vw; }
  #leader { top: 46px; right: 8px; min-width: 120px; padding: 6px 9px; }
  #leader .lrow { font-size: 12px; }
  #scoretable { min-width: 0; width: 94vw; }
  #scoretable th { padding: 5px 6px; font-size: 10px; }
  #scoretable td { padding: 6px 6px; font-size: 13px; }
  #scoretable .cosmini { width: 24px; height: 24px; }
  .bigover h2 { font-size: 26px; padding: 0 12px; text-align: center; }
  .podium .plinth { width: 92px; font-size: 22px; }
  .podium .pname { font-size: 17px; }
  .host-corner button { font-size: 10px; padding: 5px 8px; }
  #countover .num { font-size: 16vh; }
  #countover .word { font-size: 4vh; }
}


/* ---------- phone world view ---------- */
#worldview {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  background: #100c16;
}
#pmid.worldmode #minimap {
  position: absolute;
  top: 8px; left: 8px;
  width: 96px !important; height: 60px !important;
  opacity: 0.85;
  border-radius: 6px;
  z-index: 5;
}
.c-as { font-size: 0.78em; color: var(--ink-dim); font-style: italic; }
#contractbar .c-top { width: 38px; height: 38px; border-radius: 5px; flex: none; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.07); }

/* zoom slider (phone world view) */
#zoomwrap {
  position: absolute; top: 74px; left: 8px; z-index: 6;
  display: none; align-items: center; gap: 6px;
  width: 96px; padding: 4px 7px; box-sizing: border-box;
  background: rgba(16, 12, 20, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  backdrop-filter: blur(3px);
  touch-action: none;
}
#pmid.worldmode #zoomwrap { display: flex; }
#zoomwrap .zico { font-size: 12px; line-height: 1; color: rgba(228, 216, 192, 0.7); user-select: none; }
#zoomslider {
  flex: 1; min-width: 0; -webkit-appearance: none; appearance: none;
  height: 3px; margin: 6px 0; background: rgba(228, 216, 192, 0.28);
  border-radius: 2px; outline: none;
}
#zoomslider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--gold); border: 1px solid rgba(0, 0, 0, 0.35);
}
#zoomslider::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--gold); border: none;
}


/* music slider + podium extras */
.host-corner .volcol {
  display: flex; flex-direction: column; gap: 4px;
}
.host-corner .musrow {
  display: inline-flex; align-items: center; gap: clamp(6px, 0.31vw, 10px);
  font-size: clamp(13px, 0.68vw, 21px); color: var(--ink-dim);
  padding: clamp(3px, 0.16vw, 5px) clamp(10px, 0.52vw, 16px);
  background: rgba(20, 14, 24, 0.8);
  border: 1px solid var(--panel-edge); border-radius: 5px;
}
.host-corner .musrow .vlabel {
  min-width: clamp(20px, 1.04vw, 32px); text-align: center;
  font-family: var(--font-display); font-size: clamp(11px, 0.57vw, 18px); letter-spacing: 0.08em;
}
.host-corner .musrow input[type=range] { width: clamp(86px, 4.48vw, 138px); accent-color: var(--gold); }
.host-corner { align-items: flex-start; }

#factline {
  min-height: 40px;
  font-size: clamp(24px, 2.8vw, 38px) !important;
  color: var(--gold) !important;
  font-style: italic;
}
#factline { transition: opacity 0.45s ease; opacity: 0; min-height: 1.4em; }

.podium .trophies {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: 3px; max-width: 150px; margin-top: 2px;
}
.podium .thead {
  width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid rgba(217, 164, 65, 0.45);
  background: rgba(0, 0, 0, 0.35);
}
/* one head per victim; repeat kills wear an exponent-style count */
.podium .thead-wrap { position: relative; display: inline-block; line-height: 0; }
.podium .thead-wrap .tkills {
  position: absolute; top: -5px; right: -7px;
  min-width: 13px; height: 14px; line-height: 14px; padding: 0 3px;
  border-radius: 8px; text-align: center; box-sizing: border-box;
  font-family: var(--font-display); font-size: 10px; font-weight: 700;
  color: var(--gold); background: rgba(12, 8, 16, 0.92);
  border: 1px solid rgba(217, 164, 65, 0.55);
}
.podium .tmore { font-size: 11px; color: var(--ink-dim); font-family: var(--font-display); }


/* ---------- costume selection grid (phone lobby) ---------- */
#cosgrid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  width: 100%;
  max-width: 420px;
}
.cos-card {
  position: relative;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid var(--panel-edge);
  border-radius: 9px;
  padding: 4px 3px 2px;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  transition: border-color 0.15s, transform 0.1s;
}
.cos-card canvas { width: 48px; height: 48px; border-radius: 5px; }
.cos-card .cos-lbl { font-size: 9px; color: var(--ink-dim); letter-spacing: 0.02em; line-height: 1.1; }
.cos-card .cos-owner { font-size: 8.5px; color: var(--gold); min-height: 10px; font-style: italic; }
.cos-card.mine { border-color: var(--gold); background: rgba(217, 164, 65, 0.13); }
.cos-card.taken { opacity: 0.38; }
.cos-card.taken .cos-owner { color: var(--blood-bright); }
.cos-card:active { transform: scale(0.95); }


/* ---------- keyboard mode (PC players) ---------- */
#keylegend { display: none; }
.kbhint { display: none; }

.pwrap.kbmode #stickzone { display: none; }
.pwrap.kbmode #keylegend {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; width: 168px; padding-bottom: 6px;
  color: var(--ink-dim);
}
#keylegend .krow { display: flex; gap: 5px; }
#keylegend .klabel { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-dim); }
.keycap {
  display: inline-block; min-width: 30px; text-align: center;
  padding: 5px 7px;
  font-family: var(--font-display); font-size: 13px; color: var(--ink);
  background: linear-gradient(180deg, #342a44, #221a30);
  border: 1px solid var(--panel-edge);
  border-bottom-width: 3px;
  border-radius: 6px;
}
.keycap.wide { padding: 5px 22px; }
.pwrap.kbmode .kbhint {
  display: block;
  position: absolute; bottom: 2px; right: 4px;
  font-family: var(--font-display); font-size: 10px;
  color: var(--ink-dim);
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 3px;
  padding: 0 4px;
  pointer-events: none;
}
.pwrap.kbmode #killbtn { cursor: pointer; }
.pwrap.kbmode #killbtn span { font-size: 10px; }
/* touch devices: the dagger speaks for itself — the label never fit the circle */
.pwrap:not(.kbmode) #killbtn span { display: none; }
.keyactive { filter: brightness(1.5) !important; }


/* ---------- desktop layout for PC players ---------- */
.pwrap.desktop {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-rows: auto auto 1fr auto;
  grid-template-areas:
    "mid top"
    "mid contract"
    "mid gap"
    "mid bottom";
  background: var(--night);
}
.pwrap.desktop #ptop {
  grid-area: top;
  border-left: 1px solid var(--panel-edge);
  border-bottom: 1px solid rgba(217, 164, 65, 0.18);
  padding: 16px 18px 12px;
}
.pwrap.desktop #ptop .me-bust { width: 56px; height: 56px; }
.pwrap.desktop #contractbar {
  grid-area: contract;
  border-left: 1px solid var(--panel-edge);
  flex-wrap: wrap;
  padding: 12px 18px;
}
.pwrap.desktop #pmid {
  grid-area: mid;
  border-right: none;
}
.pwrap.desktop #pbottom {
  grid-area: bottom;
  flex-direction: column-reverse;
  align-items: center;
  gap: 18px;
  padding: 14px 18px 26px;
  border-left: 1px solid var(--panel-edge);
  background: rgba(16, 12, 20, 0.55);
}
.pwrap.desktop #actioncluster {
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.pwrap.desktop #killbtn { width: 110px; height: 110px; }
.pwrap.desktop .abilbtn { width: 72px; height: 72px; }
.pwrap.desktop #keylegend { width: auto; }
.pwrap.desktop .conn-pill { top: 12px; left: 12px; right: auto; }
body.steam-desktop-player .pwrap.desktop .conn-pill { top: 62px; }
.pwrap.desktop #statusline { font-size: 15px; bottom: 14px; }
.pwrap.desktop .pover { z-index: 60; }
.pwrap.desktop #loadout-grid { max-width: 560px; }
.pwrap.desktop #cosgrid { max-width: 560px; }
.pwrap.desktop .toast { top: 60px; }


/* tighter lobby on short phones so less scrolling is needed */
@media (max-height: 740px) {
  #lobbyover { gap: 8px; }
  #lobbyover h2 { font-size: 19px; }
  #lobbybust { width: 64px !important; height: 64px !important; }
  #cosgrid { gap: 5px; }
  .cos-card canvas { width: 38px; height: 38px; }
  #loadout-grid { gap: 6px; }
  .loadout-card { padding: 6px 8px; }
  .loadout-card .lb { display: none; }
  #loadout-hint { font-size: 12.5px; padding: 7px 11px; }
  .pover .note { font-size: 12.5px; }
}


/* ---------- "this is you" card ---------- */
#mecard {
  position: absolute;
  top: 64px; left: 50%;
  transform: translate(-50%, -8px);
  z-index: 45;
  background: var(--panel);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 12px 22px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.75), 0 0 30px rgba(217, 164, 65, 0.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
#mecard.show {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}
#mecard canvas { width: 100px; height: 100px; }
#mecard .mc-label { font-size: 13px; color: var(--ink-dim); font-style: italic; }
#mecard .mc-label b { color: var(--gold); }
#mecard .mc-cos { font-family: var(--font-display); font-size: 14px; color: var(--ink); }
#ptop { cursor: pointer; }


/* lobby identity: portrait + in-game look side by side */
.lobby-me { display: flex; gap: 14px; align-items: flex-start; }
.lobby-me .lm-col {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.lobby-me canvas {
  width: 88px; height: 88px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--panel-edge);
}
#lobbytop { border-color: var(--gold-soft) !important; }
.lobby-me span {
  font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink-dim);
}
@media (max-height: 740px) {
  .lobby-me canvas { width: 64px !important; height: 64px !important; }
}


/* ============================================================
   PHONE LANDSCAPE — full-screen view, controls float on top
   ============================================================ */
.pwrap.landscape { display: block; }

.pwrap.landscape #pmid {
  position: fixed; inset: 0;
  z-index: 1;
}

.pwrap.landscape #ptop {
  position: fixed; top: 6px; left: calc(8px + env(safe-area-inset-left));
  z-index: 20;
  width: auto;
  padding: 5px 12px 5px 6px;
  background: rgba(16, 12, 20, 0.72);
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
  backdrop-filter: blur(4px);
  gap: 8px;
}
.pwrap.landscape #ptop .me-bust { width: 34px; height: 34px; }
.pwrap.landscape #ptop .me-name { font-size: 13px; max-width: 90px; }
.pwrap.landscape #ptop .me-cos { font-size: 10.5px; }
.pwrap.landscape #ptop .me-score { font-size: 17px; }
.pwrap.landscape #ptop .me-score small { font-size: 7px; }

.pwrap.landscape #contractbar {
  position: fixed; top: 6px; right: calc(8px + env(safe-area-inset-right));
  left: auto;
  z-index: 20;
  width: auto;
  padding: 5px 10px;
  background: rgba(30, 16, 22, 0.72);
  border: 1px solid rgba(163, 36, 48, 0.45);
  border-radius: 10px;
  backdrop-filter: blur(4px);
  gap: 8px;
}
.pwrap.landscape #contractbar .c-bust,
.pwrap.landscape #contractbar .c-top { width: 30px; height: 30px; }
.pwrap.landscape #contractbar .c-name { font-size: 12px; }
.pwrap.landscape #contractbar .c-label { font-size: 8.5px; }
.pwrap.landscape #heat .seg { width: 11px; height: 6px; }
.pwrap.landscape #heat .hlabel { display: none; }

.pwrap.landscape #pbottom {
  position: fixed; inset: 0;
  z-index: 15;
  pointer-events: none;
  padding: 0 calc(12px + env(safe-area-inset-left)) calc(10px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-right));
  align-items: flex-end;
}
.pwrap.landscape #pbottom > * { pointer-events: auto; }
.pwrap.landscape #stickzone { width: 132px; height: 132px; opacity: 0.85; }
.pwrap.landscape #sticknub { width: 52px; height: 52px; left: 40px; top: 40px; }
.pwrap.landscape #actioncluster {
  flex-direction: row;
  align-items: flex-end;
  gap: 10px;
}
.pwrap.landscape #abilrow { flex-direction: row; }
.pwrap.landscape .abilbtn { width: 54px; height: 54px; opacity: 0.92; }
.pwrap.landscape #killbtn { width: 84px; height: 84px; opacity: 0.95; }

/* ---------- local player client (No spectator TV + host plays) ----------
   The big screen becomes a real player controller: player.html runs
   fullscreen in this iframe. Only the host-corner buttons float above it,
   shifted left so they never cover the player sidebar. */
#localplayer {
  position: fixed; inset: 0; width: 100%; height: 100%;
  border: 0; z-index: 30;
  background: var(--night);
  display: none;
}
/* Chrome gives position:fixed containers their own stacking context, so the
   corner buttons can only rise above the iframe if .host-ui itself does —
   everything else in it hides while the player client is on screen */
body.localplay .host-ui { z-index: 31; }
body.localplay #hud, body.localplay #feed, body.localplay #leader,
body.localplay #countover, body.localplay #revealover,
body.localplay #podiumover { display: none !important; }
body.localplay .host-corner {
  right: 356px;
  width: 148px;
  flex-direction: column;
  align-items: stretch;
}
body.localplay .host-corner .volcol,
body.localplay .host-corner button { width: 100%; box-sizing: border-box; }

/* ---------- lobby music credit: its own quiet block ---------- */
.credit-line {
  margin-top: 10px; padding-top: 8px;
  border-top: 1px solid rgba(217, 164, 65, 0.14);
  font-size: 10.5px; line-height: 1.55; color: var(--ink-dim); opacity: 0.75;
}

/* ---------- desktop sidebar: heat pips on their own row (no overlap) ---------- */
.pwrap.desktop #heat { flex-basis: 100%; margin-top: 4px; }
.pwrap.desktop #contractbar .c-name { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* ---------- round pill: compact clock every player device shows ---------- */
#roundpill {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  z-index: 6; pointer-events: none;
  display: flex; align-items: baseline; gap: 8px;
  padding: 3px 12px; border-radius: 20px;
  background: rgba(16, 12, 20, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(3px);
}
#roundpill #rp-round { font-size: 10px; letter-spacing: 0.18em; color: var(--ink-dim); }
#roundpill #rp-timer { font-family: var(--font-display); font-size: 16px; color: var(--ink); }
#roundpill #rp-timer.low { color: var(--blood-bright); animation: pulse 1s infinite; }
.pwrap.landscape #roundpill { top: 6px; }
.pwrap.desktop #roundpill #rp-timer { font-size: 18px; }

/* ---------- highlight replay reel (no-spectator-TV mode) ---------- */
#reelover { padding: 0; background: #0a070f; }
#reelcv { position: absolute; inset: 0; width: 100%; height: 100%; }
#reelover .phl-title { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 0; right: 0; z-index: 2; }
#reel-line {
  position: absolute; bottom: calc(16px + env(safe-area-inset-bottom)); left: 0; right: 0; z-index: 2;
  text-align: center; font-family: var(--font-display); font-size: 17px; color: var(--ink);
  padding: 0 16px; text-shadow: 0 2px 12px #000;
}

/* ---------- landscape phones: keep the floating cards out of the corners ---------- */
.pwrap.landscape #pmid.worldmode #minimap { top: 64px; }
.pwrap.landscape #zoomwrap { top: 130px; }
.pwrap.landscape .conn-pill { top: 56px; right: calc(8px + env(safe-area-inset-right)); }

/* ---------- final podium (no spectator TV): top three + full standings ---------- */
#podover {
  gap: 5px; justify-content: center;
  padding: calc(12px + env(safe-area-inset-top)) 14px calc(10px + env(safe-area-inset-bottom));
}
.pd-kicker { font-family: var(--font-display); font-size: 12px; letter-spacing: 0.3em; color: var(--gold); text-transform: uppercase; text-align: center; }
#pd-champ { font-family: var(--font-display); font-size: clamp(26px, 6vw, 44px); color: var(--ink); text-shadow: 0 3px 18px #000; margin: 0; }
#pd-podium { display: flex; align-items: flex-end; gap: 14px; margin-top: 6px; }
.pd-col { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.pd-col canvas { width: 64px; height: 64px; border-radius: 10px; border: 1px solid rgba(217, 164, 65, 0.4); background: rgba(0, 0, 0, 0.35); }
.pd-col.p1 canvas { width: 90px; height: 90px; border-color: var(--gold); box-shadow: 0 0 26px rgba(217, 164, 65, 0.28); }
.pd-name { font-family: var(--font-display); font-size: 14px; color: var(--ink); max-width: 112px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-score { font-size: 11px; color: var(--ink-dim); }
.pd-block {
  width: 78px; margin-top: 3px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, rgba(74, 58, 96, 0.6), rgba(38, 28, 52, 0.6));
  border: 1px solid rgba(217, 164, 65, 0.25); border-bottom: none;
  color: var(--gold); font-family: var(--font-display); font-size: 20px;
  display: flex; align-items: flex-start; justify-content: center; padding-top: 6px;
  height: 34px;
}
.pd-col.p1 .pd-block { height: 62px; width: 92px; }
.pd-col.p2 .pd-block { height: 44px; }
.pd-col.me .pd-name { color: var(--gold); }
#pd-rest {
  margin-top: 10px; width: min(430px, 88vw); max-height: 30vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
}
#pd-rest.desktop-scoreboard {
  width: min(1100px, calc(100vw - 48px));
  max-height: 38vh;
}
.pd-row {
  display: flex; gap: 10px; align-items: baseline;
  font-size: 14px; color: var(--ink);
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px; padding: 4px 12px;
}
.pd-row .pd-rank { color: var(--ink-dim); min-width: 22px; font-family: var(--font-display); }
.pd-row .pd-nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-row .pd-pts { font-family: var(--font-display); color: var(--gold); }
.pd-row.me { border-color: rgba(217, 164, 65, 0.5); background: rgba(217, 164, 65, 0.08); }
/* landscape squeeze */
.pwrap.landscape #podover { gap: 3px; }
.pwrap.landscape #pd-champ { font-size: 22px; }
.pwrap.landscape .pd-kicker { font-size: 9.5px; }
.pwrap.landscape .pd-col canvas { width: 44px; height: 44px; }
.pwrap.landscape .pd-col.p1 canvas { width: 60px; height: 60px; }
.pwrap.landscape .pd-name { font-size: 12px; max-width: 90px; }
.pwrap.landscape .pd-score { font-size: 9.5px; }
.pwrap.landscape .pd-block { font-size: 14px; padding-top: 3px; height: 18px; width: 62px; }
.pwrap.landscape .pd-col.p1 .pd-block { height: 34px; width: 70px; }
.pwrap.landscape .pd-col.p2 .pd-block { height: 25px; }
.pwrap.landscape #pd-rest { margin-top: 5px; max-height: 25vh; }
.pwrap.landscape .pd-row { font-size: 12px; padding: 2px 10px; }

/* landscape phones: the whole kill screen must fit a short viewport */
.pwrap.landscape #deathover {
  gap: 2px;
  padding: calc(6px + env(safe-area-inset-top)) 16px calc(6px + env(safe-area-inset-bottom));
}
.pwrap.landscape #death-by { gap: 4px; }
.pwrap.landscape #death-by .death-kicker { font-size: 10.5px; }
.pwrap.landscape #death-portrait { width: 104px; height: 104px; border-radius: 10px; }
.pwrap.landscape .death-name { font-size: 24px; }
.pwrap.landscape #deathover h2 { font-size: 24px; margin: 2px 0; }
.pwrap.landscape #deathover .resp { font-size: 38px; line-height: 1.05; }
.pwrap.landscape #deathover .note { font-size: 11.5px; }
.hostab-blurb { flex-basis: 100%; font-size: 12px; color: var(--ink-dim); line-height: 1.45; }
.hostab-blurb b { color: var(--ink); }

/* ---------- language selector ---------- */
.langsel {
  /* native select chrome (esp. iOS) draws tall serif fonts clipped — take
     the box over entirely and make it comfortably taller than the text */
  -webkit-appearance: none;
  appearance: none;
  background: rgba(20, 14, 22, 0.85) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23d9a441' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 9px center;
  color: var(--ink-dim, #b9a98e);
  border: 1px solid rgba(217, 164, 65, 0.25);
  border-radius: 6px;
  font: 13px/1.5 'IM Fell English', serif;
  min-height: 36px;
  padding: 7px 26px 7px 10px;
  cursor: pointer;
  max-width: 220px;
}
.langsel:hover { border-color: rgba(217, 164, 65, 0.55); color: #efe6d2; }
.landing .langsel { display: block; margin: 12px auto 0; position: static; }
#lobbyover .langsel { margin-top: 10px; }
/* portrait: the picker is the FIRST thing on the screen — clear the phone's
   status bar / notch even when env(safe-area-inset-top) reports 0 (Chrome iOS
   does), otherwise its top half hides under the clock and battery icons */
.pwrap:not(.landscape) #lobbyover .langsel { margin-top: max(48px, env(safe-area-inset-top, 48px)); }

/* ---------- support footer (join site) ---------- */
.support-line {
  position: fixed;
  left: 14px;
  bottom: 12px;
  z-index: 40;
  margin: 0;
  font: italic 12px/1.4 'IM Fell English', serif;
  color: rgba(185, 169, 142, 0.55);
}
.support-line a { color: rgba(217, 164, 65, 0.75); text-decoration: none; }
.support-line a:hover { color: #d9a441; text-decoration: underline; }
@media (max-width: 640px) {
  .support-line { position: static; text-align: center; margin-top: 14px; }
}
@media (max-height: 820px) {
  .landing {
    justify-content: flex-start;
    overflow-x: hidden;
    overflow-y: auto;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }
}

/* ============================================================
   PLAYER v81 â€” owned utility, map, and chat regions
   ============================================================ */
.player-utility-slot:empty, .lobby-utility-slot:empty, .overlay-utility-slot:empty,
.lobby-chat-slot:empty, .player-chat-slot:empty { display: none; }
.player-utility-dock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 6px 10px;
  background: rgba(16, 12, 20, 0.9);
  border-bottom: 1px solid rgba(217, 164, 65, 0.16);
}
.player-utility-dock:not(:has(.steam-player-back:not([hidden]), .steam-player-audio:not([hidden]))) { display: none; }
.steam-player-back, .steam-player-audio {
  position: static;
  inset: auto;
  z-index: auto;
  box-shadow: none;
}
.steam-player-back { min-height: 44px; flex: 0 1 auto; }
.steam-player-audio {
  min-height: 44px;
  max-width: 100%;
  margin-left: auto;
  background: rgba(31, 22, 37, 0.92);
}
.steam-player-audio button { min-height: 32px; }
body.player-audio-active #ptop { padding-right: 12px; }
.pwrap:not(.desktop) .steam-player-audio label { display: none; }

#player-utility-home { flex: none; min-width: 0; }
.lobby-utility-slot, .overlay-utility-slot {
  width: min(100%, 620px);
  margin: 0 auto;
}
.lobby-utility-slot .player-utility-dock,
.overlay-utility-slot .player-utility-dock {
  flex-wrap: wrap;
  justify-content: center;
  border: 1px solid rgba(217, 164, 65, 0.18);
  border-radius: 8px;
}
#lobby-utility-slot { order: 1; }
#wait-utility-slot { margin-top: 8px; }

/* The map owns its minimap, zoom control and connection state as one stack. */
#map-dock {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
#map-dock > * { pointer-events: auto; }
#map-dock .conn-pill {
  position: absolute;
  top: 8px;
  right: 8px;
  left: auto;
  z-index: auto;
}
#pmid.worldmode #map-dock {
  inset: 8px auto auto 8px;
  width: 96px;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 6px;
}
#pmid.worldmode #map-dock #minimap {
  position: static;
  inset: auto;
  width: 96px !important;
  height: 60px !important;
  flex: none;
}
#map-dock #zoomwrap,
.pwrap.tablet #map-dock #zoomwrap,
.pwrap.tablet.landscape #map-dock #zoomwrap,
.pwrap.landscape #map-dock #zoomwrap {
  position: static;
  inset: auto;
  width: 96px;
  min-height: 44px;
  padding: 6px 7px;
  flex: none;
}
#pmid.worldmode #map-dock .conn-pill {
  position: static;
  inset: auto;
  align-self: flex-start;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pwrap.landscape #pmid.worldmode #map-dock,
.pwrap.tablet.landscape #pmid.worldmode #map-dock {
  top: 58px;
  left: calc(8px + env(safe-area-inset-left));
}
.pwrap.tablet #pmid.worldmode #map-dock #minimap,
.pwrap.tablet.landscape #pmid.worldmode #map-dock #minimap,
.pwrap.landscape #pmid.worldmode #map-dock #minimap {
  position: static;
  inset: auto;
}

/* Chat lives above portrait controls, between landscape controls, and in the
   world-safe lower-left region on desktop. It moves into normal lobby flow. */
#pbottom { position: relative; }
.player-chat-slot {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 100%;
  z-index: 22;
  min-width: 0;
  pointer-events: none;
}
.pwrap:not(.desktop):not(.landscape) .player-chat-slot {
  bottom: calc(100% + 32px);
}
.pwrap .steam-chat {
  position: static;
  inset: auto;
  z-index: auto;
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
}
.pwrap .steam-chat-log { max-height: min(25vh, 190px); }
.pwrap .steam-chat-hint { min-height: 44px; padding: 8px 11px; }
.pwrap:not(.desktop) .steam-chat-line:nth-last-child(n + 4) { display: none; }
.lobby-chat-slot {
  order: 12;
  width: min(100%, 620px);
  margin: 0 auto;
  padding-bottom: 4px;
}
.lobby-chat-slot .steam-chat { max-width: 620px; }
#steam-lobby-summary { order: 10; }
#lobbyover.player-ready .lobby-main > :not(#steam-lobby-summary):not(#lobby-chat-slot) { display: none; }
#lobbyover.player-ready #lobby-chat-slot { display: block; }

.pwrap[data-player-phase='wait'] #player-live-chat-slot,
.pwrap[data-player-phase='count'] #player-live-chat-slot,
.pwrap[data-player-phase='death'] #player-live-chat-slot,
.pwrap[data-player-phase='reveal'] #player-live-chat-slot,
.pwrap[data-player-phase='podium'] #player-live-chat-slot { visibility: hidden; }
.pwrap:not(.desktop).chat-open .steam-chat-form {
  position: fixed;
  left: max(10px, env(safe-area-inset-left));
  right: max(10px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 85;
}
.pwrap.chat-open #stickzone, .pwrap.chat-open #actioncluster { pointer-events: none; opacity: 0.32; }

/* Desktop utility controls occupy their own sidebar row. */
.pwrap.desktop {
  grid-template-rows: auto auto auto 1fr auto;
  grid-template-areas:
    "mid top"
    "mid contract"
    "mid utility"
    "mid gap"
    "mid bottom";
}
.pwrap.desktop #player-utility-home { grid-area: utility; border-left: 1px solid var(--panel-edge); }
.pwrap.desktop #player-utility-home:empty { display: none; }
.pwrap.desktop #player-utility-home .player-utility-dock {
  flex-wrap: wrap;
  padding: 8px 12px;
}
.pwrap.desktop #player-utility-home .steam-player-audio { flex: 1 1 100%; margin: 0; justify-content: center; }
.pwrap.desktop #lobby-utility-slot {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 62;
  width: min(300px, calc(100vw - 24px));
  margin: 0;
}
.pwrap.desktop #lobby-utility-slot .player-utility-dock {
  flex-direction: column;
  align-items: stretch;
  padding: 7px;
}
.pwrap.desktop #lobby-utility-slot .steam-player-back,
.pwrap.desktop #lobby-utility-slot .steam-player-audio {
  width: 100%;
  margin: 0;
  justify-content: center;
}
.pwrap.desktop #player-live-chat-slot {
  position: fixed;
  left: 16px;
  right: auto;
  bottom: 16px;
  width: min(430px, calc(100vw - 380px));
  z-index: 24;
}
.pwrap.desktop #pmid.worldmode #map-dock { top: 12px; left: 12px; }
.pwrap.desktop .conn-pill,
body.steam-desktop-player .pwrap.desktop .conn-pill { top: auto; left: auto; right: auto; }

/* Landscape controls form three intentional lanes: movement, chat, action. */
.pwrap.landscape #player-utility-home {
  position: fixed;
  top: 54px;
  right: calc(8px + env(safe-area-inset-right));
  z-index: 21;
  width: min(230px, 42vw);
}
.pwrap.tablet.landscape #player-utility-home { top: 64px; }
.pwrap.landscape #player-utility-home .player-utility-dock {
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  background: transparent;
  border: 0;
}
.pwrap.landscape #player-utility-home .steam-player-back,
.pwrap.landscape #player-utility-home .steam-player-audio {
  width: 100%;
  margin: 0;
  justify-content: center;
}
.pwrap.landscape #pbottom {
  display: grid;
  grid-template-columns: auto minmax(170px, 430px) auto;
  grid-template-rows: 1fr;
  justify-content: space-between;
  align-items: end;
  column-gap: 12px;
}
.pwrap.landscape #stickzone, .pwrap.landscape #keylegend {
  grid-column: 1;
  grid-row: 1;
  align-self: end;
}

/* Mobile-performance paint budget: translucent cards remain readable, but
   avoid live backdrop convolution and large animated shadows over the canvas. */
body.mobile-perf-player #zoomwrap,
body.mobile-perf-player #roundpill,
body.mobile-perf-player .pwrap.landscape #ptop,
body.mobile-perf-player .pwrap.landscape #contractbar {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background-color: rgba(16, 12, 20, 0.88);
}
body.mobile-perf-player #killbtn.ready {
  animation: none;
  box-shadow: 0 0 18px rgba(208, 53, 67, 0.68), 0 8px 20px rgba(0, 0, 0, 0.55);
}
body.mobile-perf-player #roundpill #rp-timer.low { animation: none; }
body.mobile-perf-player #sticknub { will-change: transform; }
.pwrap.landscape #player-live-chat-slot {
  position: static;
  grid-column: 2;
  grid-row: 1;
  align-self: end;
  width: 100%;
  margin-bottom: 4px;
}
.pwrap.landscape #actioncluster { grid-column: 3; grid-row: 1; align-self: end; }

/* Short phones have less horizontal clearance between the centred clock and
   the contract card, and their map stack reaches the movement pad. Keep both
   status controls directly below the top cards at only those compact sizes. */
@media (orientation: landscape) and (max-width: 700px) and (max-height: 420px) {
  .pwrap.landscape #roundpill { top: 54px; }
  .pwrap.landscape #map-dock .conn-pill,
  .pwrap.landscape #pmid.worldmode #map-dock .conn-pill {
    position: fixed;
    top: 54px;
    right: calc(8px + env(safe-area-inset-right));
    bottom: auto;
    left: auto;
    align-self: auto;
  }
}

/* Portrait/touch utility row is normal flow beneath the contract. */
.pwrap:not(.desktop):not(.landscape) #player-utility-home .player-utility-dock {
  flex-wrap: wrap;
  justify-content: center;
}
.pwrap:not(.desktop):not(.landscape) #player-utility-home .steam-player-audio { margin-left: 0; }

/* Long localized identities and contract names never escape their cards. */
#contractbar .c-name, .pwrap.landscape #contractbar .c-name {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pwrap.landscape #contractbar .c-meta { max-width: min(23vw, 180px); }

/* Windows-scaled Steam desktops can have phone-like height while retaining
   a fine-pointer desktop layout. This comes after the normal desktop rules
   so the sidebar controls actually shrink; touch phone/tablet layouts never
   match the desktop class and remain unchanged. */
@media (min-width: 821px) and (max-height: 700px) {
  .pwrap.desktop { grid-template-columns: minmax(0, 1fr) clamp(280px, 31vw, 320px); }
  .pwrap.desktop #ptop { padding: 8px 12px 6px; gap: 8px; }
  .pwrap.desktop #ptop .me-bust { width: 42px; height: 42px; }
  .pwrap.desktop #ptop .me-name { font-size: 13px; }
  .pwrap.desktop #ptop .me-score { font-size: 18px; }
  .pwrap.desktop #contractbar { padding: 7px 12px; gap: 7px; }
  .pwrap.desktop #contractbar .c-bust,
  .pwrap.desktop #contractbar .c-top { width: 34px; height: 34px; }
  .pwrap.desktop #player-utility-home .player-utility-dock { padding: 5px 8px; gap: 5px; }
  .pwrap.desktop .steam-player-back,
  .pwrap.desktop .steam-player-audio { min-height: 36px; }
  .pwrap.desktop .steam-player-audio button { min-height: 28px; }
  .pwrap.desktop #pbottom { gap: 8px; padding: 7px 12px 12px; }
  .pwrap.desktop #actioncluster { gap: 8px; }
  .pwrap.desktop #killbtn { width: 78px; height: 78px; }
  .pwrap.desktop .abilbtn { width: 52px; height: 52px; }
  .pwrap.desktop #keylegend { transform: scale(0.88); transform-origin: bottom center; }
  .pwrap.desktop #statusline { bottom: 8px; left: 76px; font-size: 13px; }
  .pwrap.desktop #player-live-chat-slot {
    left: 12px;
    bottom: 12px;
    width: min(390px, calc(100vw - 340px));
  }
  body.host-screen.localplay .host-corner { right: 336px; }
}
