:root {
  --ink: #111111;
  --paper: #eee8d2;
  --paper-dark: #d8d0ba;
  --muted: rgba(17, 17, 17, 0.68);
  --dread: #5a1a1a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  /* Block double-tap zoom and pinch on iOS Safari. Combined with the
     viewport meta (user-scalable=no), this kills the 300ms double-tap
     zoom delay that fights mobile gameplay. */
  touch-action: manipulation;
}

#stage {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,0.35), transparent 24rem),
    repeating-linear-gradient(90deg, var(--paper-dark) 0 14px, #d0c7af 14px 28px);
  overflow: hidden;
}

canvas#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: var(--paper);
  image-rendering: pixelated;
  touch-action: none;
}

.scanlines {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, rgba(17,17,17,0.035) 0 2px, transparent 2px 5px),
    radial-gradient(circle at center, transparent 50%, rgba(17,17,17,0.10));
  mix-blend-mode: multiply;
  z-index: 5;
}

/* --- LOBBY (boarding card) ----------------------------------------------- */

.lobby {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Right padding clears the bottom-right corner where the Vibe Jam badge
     and similar widgets dock once we re-enable them at launch. */
  padding: 16px 16px 16px 16px;
  background:
    radial-gradient(circle at 50% 30%, rgba(238,232,210,0.92), rgba(238,232,210,0.78) 60%, rgba(17,17,17,0.55) 100%);
  backdrop-filter: blur(2px);
  overflow-y: auto;
  pointer-events: auto;
}

body.playing .lobby { display: none; }

.lobby-card {
  width: min(380px, 100%);
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 10px 0 rgba(17,17,17,0.18);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* "Live, you're joining a thing in progress" pill. Sits above the title
   and uses the killfeed pulsing-dot vocabulary so it reads as activity,
   not chrome. Pure cosmetic in SP — the round IS in progress as soon as
   the player taps PLAY (no sim until then by design). */
.lobby-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 3px 8px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.1;
}
.lobby-title {
  margin: 0;
  font-size: clamp(30px, 7.5vw, 44px);
  letter-spacing: -0.07em;
  text-transform: uppercase;
  line-height: 0.9;
}

.lobby-title-tld {
  font-size: 0.45em;
  letter-spacing: -0.04em;
  opacity: 0.55;
  text-transform: lowercase;
  vertical-align: 0.45em;
}

.lobby-sub {
  margin: -4px 0 0;
  font-size: 12px;
  line-height: 1.45;
  letter-spacing: 0.02em;
  opacity: 0.78;
}

.lobby-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.lobby-portrait {
  width: 86px;
  height: 86px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: var(--paper-dark);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.lobby-portrait svg, .lobby-portrait img {
  width: 100%;
  height: 100%;
  display: block;
}

.lobby-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.lobby-input {
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  padding: 10px 12px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  width: 100%;
  outline: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lobby-input::placeholder {
  color: var(--ink);
  opacity: 0.35;
  letter-spacing: 0.18em;
}

.lobby-input:focus { background: #fff7e1; }

.lobby-portrait-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ghost-btn {
  font: inherit;
  font-weight: 800;
  font-size: 18px;
  flex: 1;
  height: 32px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.ghost-btn:active { background: var(--ink); color: var(--paper); }

.lobby-rules {
  list-style: none;
  padding: 10px 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 2px dashed var(--ink);
  border-bottom: 2px dashed var(--ink);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  font-weight: 600;
}

.lobby-best {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-top: 2px dashed var(--ink);
  border-bottom: 2px dashed var(--ink);
  padding: 8px 0;
}

.lobby-best:empty { display: none; }

.lobby-best-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  text-align: center;
}

.lobby-best-label {
  font-size: 9px;
  letter-spacing: 0.18em;
  opacity: 0.6;
}

.lobby-best-value {
  font-size: 14px;
  letter-spacing: 0.04em;
}

.lobby-best-value.is-good {
  color: #c01818;
}

.lobby-start {
  font: inherit;
  font-weight: 900;
  font-size: 20px;
  letter-spacing: 0.08em;
  width: 100%;
  padding: 16px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  text-transform: uppercase;
  box-shadow: 0 6px 0 rgba(17,17,17,0.25);
  transition: transform 0.04s ease;
}

.lobby-start:active { transform: translateY(2px); box-shadow: 0 4px 0 rgba(17,17,17,0.25); }

/* Two-button mode picker. PLAY is solid black, MP is a clearly-locked
   ghost button — dashed border, dim text, not-allowed cursor — so it
   reads as "coming, not for you yet" without an emoji. */
.lobby-modes { display: grid; gap: 10px; }

.lobby-start-disabled,
.lobby-start-disabled:active {
  background: transparent;
  color: rgba(17, 17, 17, 0.45);
  border-color: rgba(17, 17, 17, 0.35);
  border-style: dashed;
  border-width: 2px;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  font-size: 13px;
  padding: 9px;
  letter-spacing: 0.16em;
}
.lobby-start-disabled:hover { color: rgba(17, 17, 17, 0.45); }

/* --- LOBBY HELP (? button + rules panel) -------------------------------- */

/* Small circular ? in the top-right corner of the lobby card. Same ink-on-
   paper language as the rest of the card; offset slightly outside the card
   border so it reads as an accessory, not a primary control. */
.lobby-help {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(17,17,17,0.20);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 2;
}
.lobby-help:hover { background: #fff7e1; }
.lobby-help:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(17,17,17,0.20); }

/* Help panel: full-screen scrim within the lobby. Inherits the lobby's
   alignment so it covers everything below it. Hidden by default — the ?
   toggles `hidden` + aria-hidden. */
.lobby-help-panel[hidden] { display: none; }
.lobby-help-panel {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(17, 17, 17, 0.55);
  animation: help-fade 0.18s ease-out both;
}

@keyframes help-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lobby-help-card {
  position: relative;
  width: min(440px, 100%);
  max-height: 100%;
  overflow-y: auto;
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 18px;
  padding: 22px 22px 18px;
  box-shadow: 0 14px 0 rgba(17,17,17,0.20);
}

.lobby-help-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lobby-help-close:hover { background: #fff7e1; }
.lobby-help-close:active { transform: translateY(1px); }

.lobby-help-title {
  margin: 0 0 14px;
  font-size: 18px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  line-height: 1;
  border-bottom: 2px dashed rgba(17, 17, 17, 0.25);
  padding-bottom: 10px;
}

.lobby-help-list {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.lobby-help-list dt {
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 2px;
}

.lobby-help-list dd {
  margin: 0 0 6px 0;
  font-size: 12px;
  line-height: 1.45;
  letter-spacing: 0.02em;
  opacity: 0.78;
}

.lobby-help-list dd strong {
  font-weight: 800;
  letter-spacing: 0.08em;
  background: var(--ink);
  color: var(--paper);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.92em;
}

@media (max-height: 560px) {
  .lobby-help-card { padding: 14px 16px; }
  .lobby-help-title { font-size: 14px; margin-bottom: 8px; padding-bottom: 6px; }
  .lobby-help-list { gap: 6px; }
  .lobby-help-list dt { font-size: 10px; }
  .lobby-help-list dd { font-size: 11px; line-height: 1.35; margin-bottom: 2px; }
}

/* --- TOUCH HUD ----------------------------------------------------------- */

.touch-hud {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  display: none;
}

body.touch.playing .touch-hud { display: block; }
/* Hide the touch HUD on the end screen and disconnect overlay — its zone
   overlays sit at z-index 10 (above buttons at z 6) and were eating
   touchstart on the action buttons via preventDefault. */
body.touch.ended .touch-hud,
body.touch.netdown .touch-hud { display: none; }

.touch-zone {
  position: absolute;
  pointer-events: auto;
}

.touch-zone-move {
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  background: transparent;
}

.touch-zone-look {
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  background: transparent;
}

/* Floating joystick: spawns at the user's finger anywhere on the left half
   (PUBG/CoD-mobile style). Hidden by default, JS positions and shows it on
   touchstart, hides on touchend. */
.touch-stick {
  position: absolute;
  left: 0;
  top: 0;
  width: 130px;
  height: 130px;
  margin-left: -65px;
  margin-top: -65px;
  pointer-events: none;
  touch-action: none;
}

.touch-stick[hidden] { display: none; }

.touch-stick-base {
  position: absolute;
  inset: 0;
  border: 2.5px solid rgba(17,17,17,0.65);
  border-radius: 50%;
  background: rgba(238,232,210,0.22);
}

.touch-stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  background: rgba(238,232,210,0.85);
  pointer-events: none;
  transition: transform 0.06s linear;
}

.touch-btn {
  position: absolute;
  pointer-events: auto;
  font: inherit;
  font-weight: 900;
  letter-spacing: 0.08em;
  border: 2.5px solid rgba(17,17,17,0.85);
  border-radius: 50%;
  background: rgba(238,232,210,0.55);
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  text-transform: uppercase;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.touch-btn:active,
.touch-btn.is-pressed {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* FIRE wrap: holds the button plus ammo arc and weapon label so they all
   move as a unit. The wrap itself is non-interactive — only the button is. */
.touch-fire-wrap {
  position: absolute;
  right: 22px;
  bottom: 28px;
  width: 96px;
  height: 96px;
  pointer-events: none;
}

/* FIRE: big anchor where the right thumb rests. Doubles as a look-drag
   zone (JS handles drag-while-pressed). Positioned via the wrap. */
.touch-fire {
  position: absolute;
  inset: 0;
  right: auto;
  bottom: auto;
  width: 100%;
  height: 100%;
  font-size: 18px;
  pointer-events: auto;
}

/* Ammo arc: 5 dots curving above the FIRE button. Each .spent dot fades
   to a hollow ring. Recomputed via :nth-child rotations below. */
.touch-ammo {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.touch-ammo-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--ink);
  /* Each dot rotates around the FIRE button center. The translate
     pushes each dot out to a ring radius just outside the button edge. */
  --ring-radius: 64px;
  transition: background 0.12s ease, opacity 0.12s ease;
}

/* Five dots evenly spaced across an 80° arc centered above the button.
   Narrower than a 120° fan so the end dots stay above the button equator
   and don't crash into the weapon label below. */
.touch-ammo-dot:nth-child(1) { transform: rotate(-130deg) translate(0, calc(-1 * var(--ring-radius))) rotate(130deg); }
.touch-ammo-dot:nth-child(2) { transform: rotate(-110deg) translate(0, calc(-1 * var(--ring-radius))) rotate(110deg); }
.touch-ammo-dot:nth-child(3) { transform: rotate(-90deg)  translate(0, calc(-1 * var(--ring-radius))) rotate(90deg); }
.touch-ammo-dot:nth-child(4) { transform: rotate(-70deg)  translate(0, calc(-1 * var(--ring-radius))) rotate(70deg); }
.touch-ammo-dot:nth-child(5) { transform: rotate(-50deg)  translate(0, calc(-1 * var(--ring-radius))) rotate(50deg); }

.touch-ammo-dot.spent {
  background: transparent;
  opacity: 0.45;
}

/* Hide the ammo arc when the razor is selected (it has no ammo). */
.touch-fire-wrap[data-weapon="razor"] .touch-ammo { display: none; }

/* Weapon label below FIRE — tiny, paper, centered. Tucked further below
   so the end dots of the ammo arc never overlap it. */
.touch-weapon-label {
  position: absolute;
  left: 50%;
  bottom: -22px;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  background: rgba(238,232,210,0.8);
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  padding: 2px 6px;
  pointer-events: none;
  white-space: nowrap;
}

/* SWAP / BLEND stacked above FIRE on the right. SWAP sits closer to FIRE
   (used during fights, thumb shouldn't travel) and BLEND sits higher
   (used between fights, less thumb-urgent). */
.touch-swap {
  right: 38px;
  bottom: 142px;
  width: 60px;
  height: 60px;
  font-size: 11px;
}

.touch-blend {
  right: 38px;
  bottom: 210px;
  width: 52px;
  height: 52px;
  font-size: 10px;
}

/* --- TUTORIAL RIBBON ---------------------------------------------------- */

/* A tiny strip below the compass / room-name strip. Shows on every round
   start for ~4s, then fades. Single line; if it doesn't fit it shrinks. */
.tutorial-ribbon {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  background: rgba(238, 232, 210, 0.96);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink);
  white-space: nowrap;
  box-shadow: 0 3px 0 rgba(17,17,17,0.18);
  max-width: calc(100% - 32px);
  overflow: hidden;
  text-overflow: ellipsis;
}

.tutorial-ribbon strong { letter-spacing: 0.12em; }

body.tutorial-on .tutorial-ribbon { opacity: 1; }

/* Show the right control hints per platform. */
.touch-only { display: none; }
.desk-only { display: inline; }
body.touch .touch-only { display: inline; }
body.touch .desk-only { display: none; }

/* Phone portrait: wrap to multi-line, sit below the corner HUD chunks. */
@media (max-width: 480px) and (orientation: portrait) {
  .tutorial-ribbon {
    font-size: 9.5px;
    padding: 5px 10px;
    top: 150px;
    white-space: normal;
    text-align: center;
    line-height: 1.35;
    border-radius: 12px;
  }
}

/* Phone landscape (short height): keep single line but shrink + sit
   under the compass. Ribbon stays out of the action zone. */
@media (max-height: 500px) and (orientation: landscape) {
  .tutorial-ribbon {
    font-size: 10px;
    padding: 4px 12px;
    top: 60px;
  }
}

/* RESTART: only shown on the death/win screen. Bottom-center, big. */
.touch-restart {
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  width: 200px;
  height: 64px;
  border-radius: 14px;
  font-size: 16px;
  letter-spacing: 0.16em;
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
  display: none;
}

/* Old single restart button: kept hidden — replaced by .end-actions. The
   element is left in the DOM so any external integration that targets it
   doesn't break, but it never displays. */
body.touch.ended .touch-restart { display: none; }
/* Hide gameplay buttons on the end screen — they'd just fight the restart. */
body.touch.ended .touch-stick,
body.touch.ended .touch-fire-wrap,
body.touch.ended .touch-swap,
body.touch.ended .touch-blend { display: none; }

/* End-of-round actions — two real buttons: PLAY AGAIN (primary) + SHARE.
   Centered horizontally, hugged to the bottom of the canvas, slide up on
   reveal. Hidden by default; body.ended toggles them on. */
.end-actions {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: none;
  gap: 10px;
  z-index: 6;
  flex-direction: row;
  align-items: stretch;
  pointer-events: none;
}

body.ended .end-actions {
  display: flex;
  pointer-events: auto;
  animation: end-rise 0.42s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

/* Force a visible cursor on the canvas/body when the round is over. Pointer
   lock should already be released by JS, but if anything has set cursor:none
   somewhere in the stack, this guarantees the player can see and use it to
   click PLAY AGAIN / SHARE. */
body.ended,
body.ended #game,
body.ended #stage { cursor: default !important; }

@keyframes end-rise {
  from { opacity: 0; transform: translate(-50%, 18px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

.end-btn {
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 14px 24px;
  cursor: pointer;
  font-size: 15px;
  min-width: 160px;
  transition: transform 0.05s linear, background 0.12s linear;
}

.end-btn-primary {
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 4px 0 rgba(17,17,17,0.35);
}
.end-btn-primary:hover { background: #2a1818; }
.end-btn-primary:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(17,17,17,0.35); }

.end-btn-ghost {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 4px 0 rgba(17,17,17,0.18);
}
.end-btn-ghost:hover { background: #fff7e1; }
.end-btn-ghost:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(17,17,17,0.18); }

@media (max-width: 480px) {
  .end-btn { font-size: 13px; min-width: 130px; padding: 12px 16px; }
  .end-actions { bottom: 14px; gap: 8px; }
}
/* Short-landscape phones: shrink buttons further so they don't crowd
   the leaderboard card. Same trigger as the canvas's "tiny" layout. */
@media (max-height: 420px) {
  .end-btn { font-size: 12px; min-width: 110px; padding: 10px 14px; }
  .end-actions { bottom: 10px; gap: 8px; }
}

/* Full-leaderboard overlay — HTML-based so it can scroll natively on
   mobile (canvas can't). Opens when the player taps the "+N MORE" hint
   on the trimmed end-card leaderboard. */
.full-leaderboard {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(17, 17, 17, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  pointer-events: auto;
}
.full-leaderboard[hidden] { display: none; }
.full-lb-card {
  background: var(--paper);
  color: var(--ink);
  border: 4px solid var(--ink);
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  font-family: monospace;
  outline: 1.5px dashed var(--ink);
  outline-offset: -8px;
}
.full-lb-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px 10px;
  border-bottom: 1px solid rgba(17, 17, 17, 0.18);
}
.full-lb-title { font-weight: bold; font-size: 13px; letter-spacing: 1px; }
.full-lb-close {
  font-family: monospace; font-weight: bold; font-size: 11px;
  background: var(--ink); color: var(--paper);
  border: 0; padding: 6px 12px;
  cursor: pointer;
  letter-spacing: 1px;
}
.full-lb-close:hover { background: #333; }
.full-lb-cols {
  display: grid;
  grid-template-columns: 50px 1fr 60px 60px;
  gap: 8px;
  padding: 10px 18px 6px;
  font-size: 9px;
  font-weight: bold;
  color: rgba(17, 17, 17, 0.55);
  border-bottom: 1px solid rgba(17, 17, 17, 0.18);
}
.full-lb-col-kills, .full-lb-col-pts { text-align: right; }
.full-lb-rows {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 18px 14px;
  flex: 1;
}
.full-lb-row {
  display: grid;
  grid-template-columns: 50px 1fr 60px 60px;
  gap: 8px;
  padding: 6px 0;
  font-size: 12px;
  font-weight: bold;
  border-bottom: 1px solid rgba(17, 17, 17, 0.06);
}
.full-lb-row:last-child { border-bottom: 0; }
.full-lb-row .rank { color: var(--ink); }
.full-lb-row.is-first .rank,
.full-lb-row.is-player .rank { color: #c01818; }
.full-lb-row.is-player { background: rgba(192, 24, 24, 0.12); margin: 0 -8px; padding-left: 8px; padding-right: 8px; }
.full-lb-row .kills { text-align: right; }
.full-lb-row .pts { text-align: right; color: rgba(17, 17, 17, 0.55); }
@media (max-width: 480px), (max-height: 420px) {
  .full-lb-card { max-height: 92vh; }
  .full-lb-row { font-size: 11px; padding: 5px 0; }
  .full-lb-cols, .full-lb-row { grid-template-columns: 40px 1fr 50px 50px; gap: 6px; }
}

/* Pause overlay — io-style: game keeps running underneath, this is just
   a menu over live action. Pinned to the viewport with position:fixed so
   it always covers the full screen regardless of stage/canvas geometry. */
.pause-overlay[hidden] { display: none; }
.pause-overlay {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(17, 17, 17, 0.55);
  animation: pause-fade 0.18s ease-out both;
}

/* Plain fade — don't reuse end-rise (its translate(-50%, ...) was meant
   for .end-actions which has translateX(-50%) baked into its layout, and
   leaks a -756px transform onto this overlay). */
@keyframes pause-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.pause-card {
  width: min(360px, 100%);
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 18px;
  padding: 24px 24px 20px;
  text-align: center;
  box-shadow: 0 14px 0 rgba(17, 17, 17, 0.20);
}

.pause-title {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  line-height: 1;
}

.pause-sub {
  margin: 0 0 18px;
  font-size: 12px;
  letter-spacing: 0.04em;
  opacity: 0.7;
}

.pause-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}
.pause-actions .end-btn { width: 100%; min-width: 0; }

/* During the kill-cam (mid-round death scene), hide every gameplay UI
   element so only the death card is on screen. The canvas-drawn HUD is
   already gated on game.deathCam in render(); this handles the DOM side. */
body.deathcam .touch-hud,
body.deathcam .tutorial-ribbon { display: none !important; }

/* Hide the tutorial during the end-of-round card too — leftover ribbon
   peeking out behind the leaderboard reveal looks broken. */
body.ended .tutorial-ribbon { display: none !important; }

@media (max-width: 480px) {
  .touch-stick { width: 110px; height: 110px; margin-left: -55px; margin-top: -55px; }
  .touch-stick-knob { width: 44px; height: 44px; margin: -22px 0 0 -22px; }
  .touch-fire-wrap { width: 84px; height: 84px; right: 16px; bottom: 22px; }
  .touch-fire { font-size: 16px; }
  .touch-ammo-dot { --ring-radius: 56px; width: 10px; height: 10px; margin: -5px 0 0 -5px; }
  .touch-weapon-label { font-size: 8px; bottom: -18px; padding: 2px 5px; }
  .touch-swap { width: 54px; height: 54px; right: 32px; bottom: 122px; font-size: 10px; }
  .touch-blend { width: 48px; height: 48px; right: 32px; bottom: 184px; font-size: 9px; }
  .touch-restart { width: 180px; height: 56px; bottom: 24px; font-size: 14px; }
  .lobby-card { padding: 12px 14px; gap: 8px; }
  .lobby-rules { font-size: 12px; padding: 4px 0; }
  .lobby-status { font-size: 9px; padding: 2px 7px; }
  .lobby-title { font-size: clamp(26px, 9vw, 38px); }
}

/* Landscape phones / short windows: lobby still fits, no scroll needed. */
@media (max-height: 560px) {
  .lobby { align-items: center; padding: 6px; }
  .lobby-card { padding: 10px 12px; gap: 6px; }
  .lobby-title { font-size: 22px; }
  .lobby-status { font-size: 9px; padding: 2px 7px; }
  .lobby-rules { padding: 4px 0; font-size: 11px; }
  .lobby-portrait { width: 56px; height: 56px; }
  .lobby-input { padding: 6px 10px; font-size: 14px; }
  .lobby-start { padding: 10px; font-size: 14px; }
  .lobby-modes { gap: 10px; }
  .ghost-btn { height: 24px; font-size: 13px; }
}

/* --- ROTATE-TO-LANDSCAPE GATE -------------------------------------------- */

/* Hidden by default. Only shown on touch devices in portrait via JS adding
   the body.rotate-needed class. Sits above everything else. */
.rotate-gate {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--paper);
}

body.rotate-needed .rotate-gate { display: flex; }

.rotate-card {
  text-align: center;
  padding: 32px 28px;
  max-width: 320px;
}

.rotate-icon {
  font-size: 64px;
  line-height: 1;
  margin-bottom: 12px;
  animation: rotate-spin 2.4s ease-in-out infinite;
}

@keyframes rotate-spin {
  0%   { transform: rotate(0deg); }
  50%  { transform: rotate(90deg); }
  100% { transform: rotate(0deg); }
}

.rotate-card h2 {
  margin: 0 0 8px;
  font-size: 22px;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.rotate-card p {
  margin: 0 0 18px;
  font-size: 13px;
  letter-spacing: 0.04em;
  opacity: 0.75;
}

/* Secondary opt-out: small, ghost-styled so the "rotate" message stays
   the primary action. Saves the user's choice for the session only — a
   fresh tab gets the gate back. */
.rotate-skip {
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.08em;
  font-weight: 700;
  padding: 8px 14px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  opacity: 0.6;
}

.rotate-skip:active {
  background: var(--ink);
  color: var(--paper);
  opacity: 1;
}
