@font-face {
  font-family: 'Minecraft';
  src: url('/assets/Minecraft.ttf') format('truetype');
}

/* Title-screen pulse banner — uses the existing 'Minecraft' font resource.
   Scale is driven by a delta-time rAF loop in main.js (transform-origin
   centred so it grows/shrinks about its middle). */
#bobr-title {
  font-family: 'Minecraft', monospace;
  color: #ffd21e;
  font-size: 40px;
  letter-spacing: 3px;
  text-align: center;
  margin: 0 auto 10px;
  text-shadow: 0 0 18px rgba(255, 210, 30, 0.45), 0 2px 0 rgba(0, 0, 0, 0.5);
  transform-origin: center center;
  will-change: transform;
  user-select: none;
}

:root {
  --bg-1: #0f0f1f;
  --bg-2: #1a1a2e;
  --bg-3: #221536;
  --panel: rgba(28, 28, 48, 0.72);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #f1f1f5;
  --muted: #9aa0b4;
  --accent: #ff5555;
  --accent-2: #ffaa33;
  --gold: #ffcc00;
  --danger: #ff6b6b;
}

* { box-sizing: border-box; }

/* Disable double-tap-to-zoom on touch devices (panning/pinch stay allowed).
   touch-action is not inherited, so interactive elements get it explicitly. */
html, body { touch-action: manipulation; }
button, a, input, select, label { touch-action: manipulation; }

body {
  margin: 0;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 20% 10%, rgba(255, 85, 85, 0.10), transparent 60%),
    radial-gradient(900px 500px at 85% 90%, rgba(255, 170, 51, 0.08), transparent 60%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2) 50%, var(--bg-3));
  background-attachment: fixed;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
}

.screen {
  position: relative;
  padding: 36px 40px;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  min-width: 340px;
  max-width: 92vw;
}

#screen-game {
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 0;
  /* Use the full screen on desktop: a slim top bar, then the arena as large as
     the height allows with the controls / player columns beside it. */
  width: 100vw;
  max-width: 100vw;
  min-height: 100vh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.hidden { display: none !important; }

/* Full-screen "WOMBO KOMBO" flash shown when a player eliminates everyone. */
#wombo-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(40,0,0,0.55), rgba(0,0,0,0.82));
  pointer-events: none;
}
#wombo-overlay .wombo-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  max-width: 92vw;
}
#wombo-overlay #wombo-video {
  width: min(70vw, 780px);
  max-height: 60vh;
  border: 4px solid #000;
  border-radius: 6px;
  box-shadow: 0 0 40px rgba(180, 0, 0, 0.6), 0 10px 30px rgba(0, 0, 0, 0.8);
  background: #000;
}
#wombo-overlay .wombo-title {
  font-family: 'Minecraft', monospace;
  font-weight: 900;
  font-size: clamp(36px, 8vw, 96px);
  line-height: 0.95;
  text-align: center;
  letter-spacing: 4px;
  color: #8a0d0d;
  -webkit-text-stroke: 4px #000;
  paint-order: stroke fill;
  text-shadow:
    0 0 6px #000, 0 6px 0 #000, 4px 0 0 #000, -4px 0 0 #000,
    0 0 30px rgba(180, 0, 0, 0.7);
  animation: womboPulse 0.5s ease-in-out infinite alternate;
}
#wombo-overlay .wombo-sub {
  font-family: 'Minecraft', monospace;
  font-size: clamp(16px, 2.4vw, 30px);
  text-align: center;
  color: #ffd24a;
  -webkit-text-stroke: 2px #000;
  paint-order: stroke fill;
  text-shadow: 0 3px 0 #000, 0 0 12px rgba(0, 0, 0, 0.9);
  max-width: 90vw;
}
#wombo-overlay #wombo-skip {
  pointer-events: auto;
  margin-top: 6px;
  padding: 10px 22px;
  font-family: 'Minecraft', monospace;
  font-size: clamp(13px, 1.6vw, 18px);
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
#wombo-overlay #wombo-skip:hover { background: rgba(180, 0, 0, 0.7); transform: scale(1.05); }
@keyframes womboPulse {
  from { transform: scale(1); filter: brightness(1); }
  to   { transform: scale(1.06); filter: brightness(1.25); }
}

/* "Du bist gut genug!" — shown centre-screen to the player who just died. */
#death-message {
  position: fixed;
  inset: 0;
  z-index: 88;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  font-family: 'Minecraft', monospace;
  font-weight: 900;
  font-size: clamp(32px, 6vw, 72px);
  text-align: center;
  color: #ffd21f;
  -webkit-text-stroke: 4px #000;
  paint-order: stroke fill;
  text-shadow: 0 4px 0 #000, 3px 0 0 #000, -3px 0 0 #000, 0 0 22px rgba(0, 0, 0, 0.85);
  animation: deathMsg 2.6s ease-out forwards;
}
#death-message.hidden { display: none; }
@keyframes deathMsg {
  0%   { opacity: 0; transform: scale(0.7); }
  12%  { opacity: 1; transform: scale(1.08); }
  22%  { transform: scale(1); }
  80%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.04); }
}

/* Ghost chat bar: appears at the bottom-centre only while you are a ghost. */
#ghost-chat {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 46;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: rgba(20, 24, 40, 0.82);
  border: 1px solid rgba(120, 180, 255, 0.35);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
}
#ghost-chat .ghost-chat-ico { font-size: 18px; filter: drop-shadow(0 0 4px rgba(120,180,255,0.6)); }
#ghost-chat input {
  width: 260px;
  max-width: 46vw;
  margin: 0;
  padding: 8px 10px;
  font-size: 14px;
  background: rgba(10, 12, 22, 0.7);
  border: 1px solid rgba(120, 180, 255, 0.25);
  color: #dfe6f2;
}
#ghost-chat button {
  margin: 0;
  padding: 8px 14px;
  font-size: 14px;
  background: rgba(90, 140, 220, 0.35);
  border: 1px solid rgba(140, 190, 255, 0.4);
  color: #eaf1ff;
}

h1 {
  margin: 0 0 24px;
  font-size: 48px;
  letter-spacing: 2px;
  font-weight: 800;
  background: linear-gradient(180deg, #fff 0%, #ffd0a0 60%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 32px rgba(255, 85, 85, 0.35);
  filter: drop-shadow(0 2px 0 rgba(0,0,0,0.4));
}

h2 {
  margin: 0 0 20px;
  font-weight: 600;
  color: var(--muted);
  font-size: 18px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

input, button {
  font-size: 16px;
  padding: 12px 16px;
  margin: 6px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 15, 31, 0.7);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
  font-family: inherit;
}

input::placeholder { color: #6b6f82; }

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 85, 85, 0.15);
}

button {
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.3px;
  border: none;
  background: linear-gradient(180deg, var(--accent) 0%, #d63838 100%);
  color: white;
  box-shadow:
    0 6px 20px rgba(255, 85, 85, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

button:hover {
  background: linear-gradient(180deg, #ff7070 0%, #e64545 100%);
  box-shadow:
    0 8px 24px rgba(255, 85, 85, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

button:active { transform: translateY(1px); }

#btn-create {
  font-size: 18px;
  padding: 12px 28px;
  margin-top: 4px;
}

#name {
  width: 260px;
  text-align: center;
  font-size: 17px;
}

.row {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
}

#join-code {
  width: 180px;
  font-family: 'SF Mono', Menlo, monospace;
  letter-spacing: 4px;
  text-align: center;
  text-transform: uppercase;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 2px;
  margin: 18px 4px 12px;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
}

#room-code {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 44px;
  letter-spacing: 8px;
  color: var(--gold);
  text-shadow: 0 0 24px rgba(255, 204, 0, 0.4);
  display: inline-block;
  padding: 4px 8px;
}

#player-list { list-style: none; padding: 0; margin: 16px 0; }
#player-list li {
  padding: 10px 14px;
  margin: 6px 0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  font-size: 15px;
}

#game {
  image-rendering: pixelated;
  display: block;
  margin: 0 auto;
  max-width: 100%;
  /* The arena takes the full viewport height minus the slim top bar; player
     info sits beside it (16:9 screens have width to spare, not height). */
  max-height: calc(100vh - 64px);
  max-height: calc(100dvh - 64px);
  width: auto;
  height: auto;
}

#round-info {
  text-align: center;
  font-family: 'Minecraft', monospace;
  font-size: 14px;
  letter-spacing: 1px;
  color: #eef1ff;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
#round-info .ri-sep { color: rgba(255,255,255,.35); margin: 0 10px; }

/* Late-join lobby banner + Beitreten button */
.lobby-running-banner {
  margin: 10px auto;
  max-width: 420px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(90, 150, 255, 0.14);
  border: 1px solid rgba(120, 180, 255, 0.5);
  color: #cfe4ff;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
}
#btn-join-running {
  background: linear-gradient(180deg, #3a8bff, #2a6be0);
  border: none;
  font-weight: 700;
}
#btn-cs-spectate {
  background: linear-gradient(180deg, #3a8bff, #2a6be0);
  border: none;
  font-weight: 700;
}

/* Top-right in-game lobby-list button */
#btn-lobby-list {
  position: fixed;
  top: 12px;
  right: 14px;
  z-index: 60;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  color: #eaf2ff;
  background: rgba(20, 28, 48, 0.85);
  border: 1px solid rgba(120, 160, 255, 0.5);
  border-radius: 10px;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
#btn-lobby-list:hover { background: rgba(40, 55, 90, 0.95); }

/* Spectator banner during a watched round */
#spectator-banner {
  position: fixed;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: rgba(120, 90, 200, 0.85);
  border: 1px solid rgba(180, 150, 255, 0.6);
  border-radius: 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

/* In-game lobby / player-list overlay */
#lobby-list-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 14, 0.6);
  backdrop-filter: blur(3px);
}
.lobby-list-card {
  width: min(90vw, 360px);
  background: #121a2e;
  border: 1px solid rgba(120, 160, 255, 0.4);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}
.lobby-list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  font-weight: 700;
  color: #eaf2ff;
  margin-bottom: 12px;
}
.lobby-list-head #lobby-list-count { color: var(--muted); font-weight: 400; font-size: 13px; }
#btn-lobby-list-close {
  background: transparent;
  border: none;
  color: #9fb2d8;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
}
#btn-lobby-list-close:hover { color: #fff; }
#lobby-list-entries { list-style: none; margin: 0; padding: 0; }
#lobby-list-entries li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: #dbe5f7;
  font-size: 14px;
}
#lobby-list-entries li:last-child { border-bottom: none; }
#lobby-list-entries .ll-status { color: var(--muted); font-size: 12px; }


.rounds-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 4px 0;
  color: var(--muted);
  font-size: 14px;
}
.rounds-row select {
  font-size: 16px;
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(15, 15, 31, 0.7);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

#lobby-rounds {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 4px;
  letter-spacing: 1px;
}

#round-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 8, 18, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 50;
}

.overlay-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 32px 40px;
  min-width: 320px;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

#overlay-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 1px;
  background: linear-gradient(180deg, #fff 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 6px;
}

#overlay-subtitle {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 18px;
}

#overlay-ranking {
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
  counter-reset: rank;
}
#overlay-ranking li {
  counter-increment: rank;
  padding: 10px 14px;
  margin: 6px 0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  font-size: 15px;
  text-align: left;
}
#overlay-ranking li::before {
  content: counter(rank) '. ';
  color: var(--muted);
  font-family: 'SF Mono', Menlo, monospace;
  margin-right: 8px;
}
#overlay-ranking li:first-child {
  border-color: rgba(255, 204, 0, 0.4);
  background: rgba(255, 204, 0, 0.08);
}
#overlay-ranking li:first-child::before { color: var(--gold); }
#overlay-ranking li.me { color: var(--gold); }

.overlay-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}
#overlay-waiting {
  color: var(--muted);
  font-size: 14px;
  font-style: italic;
}
.overlay-nav {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--panel-border);
}

#btn-restart {
  font-size: 14px;
  padding: 8px 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  box-shadow: none;
  font-weight: 500;
}

#btn-restart:hover {
  background: rgba(255, 85, 85, 0.18);
  border-color: rgba(255, 85, 85, 0.4);
  box-shadow: none;
}

#menu-error {
  color: var(--danger);
  min-height: 1.2em;
  margin-top: 12px;
  font-size: 14px;
}

.invite-block {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.invite-block a {
  color: var(--gold);
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 14px;
  text-decoration: none;
  padding: 6px 12px;
  background: rgba(255, 204, 0, 0.08);
  border: 1px solid rgba(255, 204, 0, 0.18);
  border-radius: 6px;
  transition: background 0.15s ease;
  word-break: break-all;
  max-width: 100%;
}

.invite-block a:hover {
  background: rgba(255, 204, 0, 0.16);
  text-decoration: none;
}

.invite-block button {
  font-size: 12px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  box-shadow: none;
  font-weight: 500;
}

.invite-block button:hover {
  background: rgba(255, 255, 255, 0.14);
  box-shadow: none;
}

/* ── Controls hint ───────────────────────────────────────────────────── */
.controls-hint {
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.5px;
}

/* ── Coin bar ────────────────────────────────────────────────────────── */
.coin-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  color: var(--gold);
  margin-bottom: 16px;
  font-weight: 600;
}

/* ── Back row (top-left navigation back button) ─────────────────────── */
.screen-back-row {
  position: absolute;
  top: 14px;
  left: 18px;
}

/* ── Secondary button ───────────────────────────────────────────────── */
.btn-secondary {
  font-size: 13px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  box-shadow: none;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  box-shadow: none;
}

/* ── Shop ────────────────────────────────────────────────────────────── */
#screen-shop {
  min-width: 480px;
  max-width: 96vw;
}

#shop-skin-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin: 16px 0;
}

.skin-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  width: 90px;
  transition: border-color 0.15s;
}
.skin-card.equipped {
  border-color: var(--gold);
  background: rgba(255, 204, 0, 0.07);
}
.skin-card.unlocked:not(.equipped) {
  border-color: rgba(68, 255, 136, 0.3);
}

.skin-name {
  font-size: 11px;
  color: var(--muted);
}

.btn-equipped, .btn-equip, .btn-buy {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  border: none;
}
.btn-equipped {
  background: var(--gold);
  color: #111;
  cursor: default;
  box-shadow: none;
}
.btn-equip {
  background: linear-gradient(180deg, #44ff88 0%, #22cc66 100%);
  color: #111;
  box-shadow: 0 3px 10px rgba(68, 255, 136, 0.3);
}
.btn-buy {
  background: linear-gradient(180deg, var(--accent) 0%, #d63838 100%);
  color: white;
  box-shadow: 0 3px 10px rgba(255, 85, 85, 0.3);
}
.btn-buy:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

/* ── Stats table ─────────────────────────────────────────────────────── */
.stats-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 8px;
  font-size: 13px;
}
.stats-table th {
  color: var(--muted);
  font-weight: 600;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
}
.stats-table td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.stats-table tr.me td {
  color: var(--gold);
}

/* ── Henry reason ────────────────────────────────────────────────────── */
.henry-reason {
  margin: 12px 0 4px;
  padding: 10px 14px;
  background: rgba(255, 204, 0, 0.08);
  border: 1px solid rgba(255, 204, 0, 0.25);
  border-radius: 8px;
  font-size: 13px;
  color: var(--gold);
  font-style: italic;
  text-align: center;
}

/* ── Game area (canvas + event log side by side) ─────────────────────── */
#game-area {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 14px;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  padding: 0 14px;
  box-sizing: border-box;
}

/* Side columns sit next to the arena; on 16:9 screens the arena is limited by
   height, so this width would otherwise be empty. */
#game-left {
  width: 172px;
  flex: 0 0 172px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#board-wrap {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  justify-content: center;
}
#game-right {
  width: 236px;
  flex: 0 0 236px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 64px);
  max-height: calc(100dvh - 64px);
}

/* ── Controls legend ─────────────────────────────────────────────────────── */
#controls-panel {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 10px 10px;
  background: rgba(15, 15, 31, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
#controls-body { display: flex; flex-direction: column; gap: 5px; }
#controls-panel.collapsed { padding-bottom: 8px; }
#controls-panel.collapsed #controls-body { display: none; }
#controls-arrow { display: inline-block; transition: transform .15s; }
#controls-panel.collapsed #controls-arrow { transform: rotate(-90deg); }
/* Ghost controls only while you are a ghost (and then instead of the bomb keys). */
#controls-panel .ctrl-ghost { display: none; }
#controls-panel.is-ghost .ctrl-ghost { display: block; }
#controls-panel.is-ghost .ctrl-alive { display: none; }

.ctrl-title {
  font-family: 'Minecraft', monospace;
  font-size: 11px;
  font-weight: bold;
  color: #ffcc00;
  text-align: center;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: none;
  border: none;
  box-shadow: none;
  padding: 4px 0;
  margin: 0;
  width: 100%;
  cursor: pointer;
}
.ctrl-title:hover { color: #ffe066; background: none; }

.ctrl-section {
  font-family: 'Minecraft', monospace;
  font-size: 10px;
  color: #aabbff;
  margin-top: 2px;
  padding-left: 2px;
}

.ctrl-divider {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 3px 0;
}

.ctrl-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.ctrl-sub {
  padding-left: 6px;
}

.ctrl-label {
  font-family: 'Minecraft', monospace;
  font-size: 10px;
  color: #cccccc;
  margin-left: 2px;
  white-space: nowrap;
}

/* Keyboard key badges */
.key-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Minecraft', monospace;
  font-size: 10px;
  font-weight: bold;
  color: #ffffff;
  background: linear-gradient(to bottom, #555566, #33333f);
  border: 1px solid #222230;
  border-bottom: 3px solid #111118;
  border-radius: 4px;
  padding: 2px 5px;
  min-width: 20px;
  min-height: 20px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.9);
  box-shadow: 0 1px 3px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
  flex-shrink: 0;
  white-space: nowrap;
}

.key-badge.key-wide {
  padding: 2px 8px;
  min-width: auto;
  font-size: 9px;
}

#test-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 10px;
  background: rgba(15, 15, 31, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  min-width: 120px;
  align-self: flex-start;
}

#test-panel.hidden { display: none !important; }

.test-panel-title {
  font-size: 12px;
  font-weight: bold;
  color: #ffcc00;
  text-align: center;
  letter-spacing: 1px;
  margin-bottom: 4px;
  font-family: 'Minecraft', monospace;
}

/* The title doubles as a collapse toggle so the board can reclaim the width. */
button.test-panel-title {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

#test-panel-arrow {
  display: inline-block;
  transition: transform 0.15s ease;
}

#test-panel.collapsed > :not(.test-panel-title) { display: none; }
#test-panel.collapsed { min-width: auto; }
#test-panel.collapsed .test-panel-title { margin-bottom: 0; }
#test-panel.collapsed #test-panel-arrow { transform: rotate(-90deg); }

.test-item-btn {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  font-family: 'Minecraft', monospace;
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
  white-space: nowrap;
}

.test-item-btn:hover {
  background: rgba(255, 220, 50, 0.18);
  border-color: rgba(255, 220, 50, 0.5);
}

.test-exit-btn {
  color: #ff6666;
  border-color: rgba(255, 80, 80, 0.35);
  margin-top: 4px;
}

.test-exit-btn:hover {
  background: rgba(255, 80, 80, 0.2);
  border-color: rgba(255, 80, 80, 0.6);
}

.test-panel-divider {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 2px 0;
}

#event-log {
  width: 100%;
  font-size: 12px;
}

#event-log-entries {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#event-log-entries::-webkit-scrollbar { width: 4px; }
#event-log-entries::-webkit-scrollbar-track { background: transparent; }
#event-log-entries::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

.log-entry {
  padding: 5px 10px;
  line-height: 1.35;
  color: #d4d8e4;
  font-size: 12px;
  word-break: break-word;
  background: rgba(12, 12, 26, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  animation: log-in 0.25s ease-out;
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.log-entry.fading { opacity: 0; transform: translateX(10px); }
@keyframes log-in { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }

.log-entry.log-kill {
  font-size: 13px;
  font-weight: 700;
  color: #ff8a8a;
  border-color: rgba(255, 107, 107, 0.35);
  background: rgba(60, 12, 20, 0.78);
}

/* Kill-streak events: TRIPLE KILL (fiery gold) / MEGA KILL (electric blue). */
.log-entry.log-triple {
  color: #ffb020;
  text-shadow: 0 0 6px rgba(255, 140, 0, 0.6);
  border-left: 3px solid #ff8c00;
  background: rgba(255, 140, 0, 0.1);
  animation: log-streak-pop 0.4s ease-out;
}
.log-entry.log-mega {
  color: #4fc3ff;
  text-shadow: 0 0 8px rgba(79, 195, 255, 0.7);
  border-left: 3px solid #2196f3;
  background: rgba(33, 150, 243, 0.12);
  animation: log-streak-pop 0.4s ease-out;
}
@keyframes log-streak-pop {
  0%   { transform: scale(0.85); opacity: 0; }
  60%  { transform: scale(1.04); opacity: 1; }
  100% { transform: scale(1); }
}

/* ── Character Select Screen ───────────────────────────────────────────────── */
#screen-charselect {
  position: fixed;
  inset: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% 25%, #1a1a4e 0%, #0a0a1e 75%);
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  overflow: hidden;
}

#cs-header {
  text-align: center;
  flex: 0 0 auto;
  padding: 6px 12px 2px;
}

#cs-header h2 {
  font-size: 20px;
  font-family: 'Minecraft', monospace;
  background: linear-gradient(180deg, #ffe566 0%, #ff9900 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 0;
  text-shadow: none;
  letter-spacing: 3px;
}

#cs-meta {
  font-family: 'Minecraft', monospace;
  font-size: 12px;
  color: rgba(255,255,255,0.6);
}

#cs-grid-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background: rgba(255,255,255,0.05);
  border-top: 2px solid rgba(255,255,255,0.12);
  border-bottom: 2px solid rgba(255,255,255,0.12);
  padding: 10px clamp(8px, 2vw, 28px);
  margin: 4px 0;
  cursor: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#cs-grid {
  display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr));
  gap: clamp(3px, 0.5vw, 8px);
  width: 100%;
  max-width: 1500px;
}

.cs-gender-header { display: none; }

.cs-portrait-card {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  background: linear-gradient(to bottom, #2e2e48, #1a1a30);
  border: 2px solid var(--sel-color, rgba(255,255,255,0.18));
  border-radius: 5px;
  padding: 0;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.08);
  user-select: none;
  overflow: hidden;
  position: relative;
}

.cs-portrait-card:hover:not(.cs-taken) {
  transform: scale(1.08);
  border-color: var(--sel-color, rgba(255,255,255,0.55));
  z-index: 5;
}

.cs-portrait-canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.cs-portrait-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  font-family: 'Minecraft', monospace;
  font-size: clamp(5px, 0.7vw, 9px);
  color: #ddd;
  background: rgba(0,0,0,0.55);
  text-align: center;
  letter-spacing: 0.3px;
  padding: 1px 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cs-portrait-card.cs-mine {
  box-shadow: 0 0 14px var(--sel-color), 0 3px 10px rgba(0,0,0,0.6);
  animation: cs-pulse 1.4s ease-in-out infinite;
}

@keyframes cs-pulse {
  0%, 100% { box-shadow: 0 0 10px var(--sel-color), 0 3px 10px rgba(0,0,0,0.6); }
  50%       { box-shadow: 0 0 22px var(--sel-color), 0 3px 10px rgba(0,0,0,0.6); }
}

.cs-portrait-card.cs-taken {
  opacity: 0.55;
  cursor: not-allowed;
}

.cs-portrait-card.cs-taken:hover { transform: none; }

/* Cursor hand */
#cs-cursors {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.cs-cursor {
  position: absolute;
  pointer-events: none;
  display: flex;
  align-items: flex-start;
  gap: 5px;
  transform: translate(-2px, -2px);
  z-index: 20;
  filter: drop-shadow(1px 2px 3px rgba(0,0,0,0.8));
}

.cs-cursor-hand {
  font-size: 22px;
  line-height: 1;
}

.cs-cursor-name {
  background: var(--cursor-color, #fff);
  color: #000;
  font-family: 'Minecraft', monospace;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  margin-top: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.7);
}

/* Player slots — Smash-style cards along the bottom */
#cs-player-slots {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: flex-end;
  flex: 0 0 auto;
  padding: 6px 12px 10px;
  overflow-x: auto;
}

.cs-slot {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  background: linear-gradient(to bottom, #23233c, #14141f);
  border: 2px solid var(--player-color, #555);
  border-radius: 8px 8px 6px 6px;
  padding: 0;
  width: clamp(72px, 9vw, 120px);
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(0,0,0,0.5);
}

.cs-slot-portrait {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cs-clown-days {
  position: absolute;
  top: 3px;
  left: 3px;
  right: 3px;
  text-align: center;
  line-height: 1.15;
  padding: 1px 3px;
  border-radius: 7px;
  background: #d81e3c;
  border: 1px solid #ffd23f;
  color: #fff;
  font: bold clamp(9px, 0.8vw, 11px) 'Minecraft', monospace;
  text-shadow: 0 1px 0 rgba(0,0,0,.5);
  box-shadow: 0 2px 4px rgba(0,0,0,.45);
  z-index: 1;
  pointer-events: none;
}
.cs-slot-portrait canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.cs-slot-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3px 2px 4px;
  gap: 1px;
}

.cs-slot-pick {
  font-family: 'Minecraft', monospace;
  font-size: clamp(8px, 1vw, 11px);
  color: #fff;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cs-slot-name {
  font-family: 'Minecraft', monospace;
  font-size: 9px;
  color: #cdd;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cs-slot-idx {
  font-family: 'Minecraft', monospace;
  font-size: 9px;
  font-weight: bold;
  color: #111;
  background: var(--player-color, #aaa);
  border-radius: 3px;
  padding: 1px 6px;
  margin-top: 2px;
}

/* READY TO FIGHT banner (shown once everyone has locked in) */
#cs-ready-banner {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* Only the banner text itself is clickable — the rest of the screen (alias
     dropdown, character grid, player cards) stays fully interactive. */
  pointer-events: none;
  background: transparent;
}
#cs-ready-banner .cs-ready-text {
  pointer-events: auto;
  font-family: 'Minecraft', monospace;
  font-size: clamp(40px, 9vw, 120px);
  font-style: italic;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
  transform: skewX(-10deg);
  padding: 10px 60px;
  background: linear-gradient(180deg, #ff7a00 0%, #e23b00 100%);
  border-top: 6px solid #111;
  border-bottom: 6px solid #111;
  box-shadow: 0 10px 40px rgba(0,0,0,0.7);
  text-shadow: 3px 3px 0 rgba(0,0,0,0.5);
  width: 130%;
  text-align: center;
  animation: cs-ready-in 0.35s ease-out;
}
#cs-ready-banner .cs-ready-sub {
  pointer-events: auto;
  margin-top: 22px;
  font-family: 'Minecraft', monospace;
  font-size: clamp(12px, 1.6vw, 18px);
  color: #ffe;
  background: rgba(0,0,0,0.55);
  padding: 8px 20px;
  border-radius: 20px;
}
#cs-ready-banner.cs-ready-clickable .cs-ready-text,
#cs-ready-banner.cs-ready-clickable .cs-ready-sub { cursor: pointer; }
#cs-ready-banner.cs-ready-clickable:hover .cs-ready-text { filter: brightness(1.12); }
@keyframes cs-ready-in {
  0% { transform: skewX(-10deg) scale(0.6); opacity: 0; }
  100% { transform: skewX(-10deg) scale(1); opacity: 1; }
}

#cs-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

#btn-cs-start {
  font-size: 16px;
  padding: 10px 32px;
  background: linear-gradient(to bottom, #55dd55, #228822);
  border: 2px solid #114411;
  border-radius: 6px;
  color: #fff;
  font-family: 'Minecraft', monospace;
  cursor: pointer;
  letter-spacing: 1px;
  transition: filter 0.12s;
}

#btn-cs-start:hover { filter: brightness(1.15); }

#cs-waiting {
  font-family: 'Minecraft', monospace;
  font-size: 13px;
  color: rgba(255,255,255,0.5);
}

/* Screen transition overlay */
#screen-transition-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
}

/* ── Level Select ──────────────────────────────────────────────────────── */
#screen-levelselect {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px;
}

#ls-header {
  text-align: center;
}

#ls-header h2 {
  font-family: 'Minecraft', monospace;
  font-size: 22px;
  color: #fff;
  margin: 0 0 4px;
  text-transform: none;
  letter-spacing: 1px;
}

#ls-meta {
  font-family: 'Minecraft', monospace;
  font-size: 12px;
  color: rgba(255,255,255,0.5);
}

#ls-grid {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

.ls-card {
  width: 180px;
  background: rgba(255,255,255,0.06);
  border: 3px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  cursor: pointer;
  padding: 0 0 12px;
  text-align: center;
  transition: border-color 0.15s, transform 0.1s;
  user-select: none;
}

.ls-card:hover { transform: scale(1.04); }

.ls-card.ls-selected {
  border-color: #ffdd33;
  background: rgba(255,220,50,0.08);
}

.ls-card-icon {
  font-size: 52px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px 7px 0 0;
  margin-bottom: 10px;
}

.ls-card-name {
  font-family: 'Minecraft', monospace;
  font-size: 13px;
  color: #fff;
  margin-bottom: 6px;
}

.ls-card-desc {
  font-family: 'Minecraft', monospace;
  font-size: 10px;
  color: rgba(255,255,255,0.5);
  padding: 0 8px;
  line-height: 1.4;
}

.ls-card-votes {
  margin-top: 8px;
  font-family: 'Minecraft', monospace;
  font-size: 11px;
  color: #ffdd33;
  min-height: 16px;
}

#ls-status {
  font-family: 'Minecraft', monospace;
  font-size: 12px;
  color: rgba(255,255,255,0.55);
}

#ls-countdown {
  font-family: 'Minecraft', monospace;
  font-size: 22px;
  color: #ffdd33;
  font-weight: bold;
}

/* ── Team Select ───────────────────────────────────────────────────────── */
#screen-teamselect {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 24px;
}

#screen-teamselect h2 {
  font-family: 'Minecraft', monospace;
  font-size: 20px;
  color: #fff;
  margin: 0;
  text-transform: none;
  letter-spacing: 1px;
}

#ts-area {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.ts-side {
  width: 160px;
  min-height: 160px;
  border-radius: 8px;
  padding: 12px;
}

.ts-red-side {
  background: rgba(220,60,60,0.12);
  border: 2px solid rgba(220,60,60,0.4);
}

.ts-blue-side {
  background: rgba(60,100,220,0.12);
  border: 2px solid rgba(60,100,220,0.4);
}

#ts-pool-wrap {
  width: 140px;
  min-height: 160px;
  background: rgba(255,255,255,0.05);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 12px;
}

.ts-label {
  font-family: 'Minecraft', monospace;
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  margin-bottom: 8px;
  text-align: center;
}

.ts-slots, #ts-pool {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 80px;
}

.ts-token {
  background: rgba(255,255,255,0.12);
  border: 2px solid rgba(255,255,255,0.25);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: 'Minecraft', monospace;
  font-size: 12px;
  color: #fff;
  cursor: grab;
  text-align: center;
  transition: background 0.1s;
}

.ts-token:active { cursor: grabbing; }
.ts-token:hover { background: rgba(255,255,255,0.2); }

.ts-token-red {
  border-color: rgba(220,60,60,0.7);
  background: rgba(220,60,60,0.2);
}

.ts-token-blue {
  border-color: rgba(60,100,220,0.7);
  background: rgba(60,100,220,0.2);
}

#ts-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

#ts-countdown {
  font-family: 'Minecraft', monospace;
  font-size: 20px;
  color: #ffdd33;
  font-weight: bold;
}

#btn-ts-start {
  font-size: 15px;
  padding: 10px 28px;
  background: linear-gradient(to bottom, #55dd55, #228822);
  border: 2px solid #114411;
  border-radius: 6px;
  color: #fff;
  font-family: 'Minecraft', monospace;
  cursor: pointer;
}

#btn-ts-start:hover { filter: brightness(1.15); }

#ts-waiting-ts {
  font-family: 'Minecraft', monospace;
  font-size: 12px;
  color: rgba(255,255,255,0.45);
}

/* ── In-game nav buttons ───────────────────────────────────────────────── */
.btn-hud-nav {
  font-family: 'Minecraft', monospace;
  font-size: 11px;
  padding: 4px 10px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}

.btn-hud-nav:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

/* ── Mode Select ─────────────────────────────────────────────────────────── */
#screen-modeselect {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 36px 40px;
  min-width: 480px;
}

#modeselect-cards {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

.mode-card {
  width: 200px;
  background: rgba(255,255,255,0.06);
  border: 3px solid rgba(255,255,255,0.15);
  border-radius: 14px;
  cursor: pointer;
  padding: 28px 20px 24px;
  text-align: center;
  transition: border-color 0.15s, transform 0.1s, box-shadow 0.15s;
  user-select: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.mode-card:hover {
  transform: scale(1.05);
  border-color: #ffdd33;
  box-shadow: 0 0 20px rgba(255,221,51,0.2);
}

/* A disabled mode card (e.g. 1vs1 without exactly 2 players). */
.mode-card.disabled {
  opacity: 0.4;
  filter: grayscale(1);
  cursor: not-allowed;
  pointer-events: none;
}

.mode-card-icon {
  font-size: 56px;
  line-height: 1;
}

.mode-card-title {
  font-family: 'Minecraft', monospace;
  font-size: 15px;
  color: #fff;
  font-weight: bold;
  letter-spacing: 0.5px;
}

.mode-card-desc {
  font-family: 'Minecraft', monospace;
  font-size: 10px;
  color: rgba(255,255,255,0.5);
  line-height: 1.4;
}

/* ── Slot Machine ────────────────────────────────────────────────────────── */
#screen-slotmachine {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 36px 40px;
  min-width: 400px;
}

#slot-machine-frame {
  border: 3px solid rgba(255,221,51,0.4);
  border-radius: 16px;
  padding: 16px;
  background: rgba(0,0,0,0.35);
  box-shadow: 0 0 32px rgba(255,221,51,0.15);
  transition: box-shadow 0.3s;
}

#slot-machine-frame.slot-machine-glow {
  border-color: #ffdd33;
  box-shadow: 0 0 48px rgba(255,221,51,0.6), 0 0 16px rgba(255,221,51,0.4);
  animation: slot-glow-pulse 0.8s ease-in-out infinite;
}

@keyframes slot-glow-pulse {
  0%, 100% { box-shadow: 0 0 48px rgba(255,221,51,0.6), 0 0 16px rgba(255,221,51,0.4); }
  50%       { box-shadow: 0 0 72px rgba(255,221,51,0.9), 0 0 28px rgba(255,221,51,0.7); }
}

#slot-machine-card {
  width: 300px;
  height: 200px;
  background: rgba(255,255,255,0.06);
  border: 3px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  overflow: hidden;
}

.slot-card-icon {
  font-size: 64px;
  line-height: 1;
}

.slot-card-name {
  font-family: 'Minecraft', monospace;
  font-size: 16px;
  color: #fff;
  text-align: center;
  letter-spacing: 0.5px;
}

/* ─── Duo Role Select ─────────────────────────────────────────────────────── */

#screen-duoselect {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px;
}
#duo-role-btns {
  display: flex;
  gap: 16px;
}
.duo-role-btn {
  padding: 12px 24px;
  font-size: 16px;
  cursor: pointer;
  border: 2px solid var(--accent, #4488ff);
  background: transparent;
  color: inherit;
  border-radius: 8px;
  transition: background 0.15s;
}
.duo-role-btn.selected,
.duo-role-btn:hover {
  background: var(--accent, #4488ff);
  color: #fff;
}
#duo-role-status {
  display: flex;
  gap: 24px;
  font-size: 14px;
}
#duo-timer-row {
  font-size: 24px;
  font-weight: bold;
}
#duo-bomb-turn {
  padding: 4px 8px;
  background: rgba(0,0,0,0.5);
  border-radius: 4px;
  font-size: 13px;
  color: #fff;
}

.ls-card-locked {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.ls-card-locked .ls-card-desc {
  color: var(--accent-2);
  font-style: italic;
}

/* ── Explainer screen ──────────────────────────────────────────────────────── */
#screen-explainer {
  display: flex;
  flex-direction: column;
  width: min(96vw, 920px);
  height: min(90vh, 580px);
  padding: 20px 24px;
  gap: 16px;
  box-sizing: border-box;
}

.explainer-layout {
  display: flex;
  gap: 20px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.explainer-left {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  gap: 10px;
  overflow: hidden;
}

.explainer-left h2 {
  margin: 0;
  font-size: 20px;
  color: var(--accent-2);
  flex-shrink: 0;
}

.explainer-text-wrap {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  overflow: hidden;
}

.explainer-text {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px 10px 12px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text);
  scrollbar-width: none;
}
.explainer-text::-webkit-scrollbar { display: none; }

.explainer-scrollbar {
  width: 5px;
  background: rgba(255,255,255,0.06);
  border-radius: 0 8px 8px 0;
  position: relative;
  flex-shrink: 0;
}

#explainer-scrollbar-thumb {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: rgba(255,170,51,0.55);
  border-radius: 3px;
  transition: top 0.1s;
}

.explainer-controls {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}

.explainer-controls .ctrl-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0;
}

.explainer-controls .key-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-family: monospace;
  color: var(--text);
  white-space: nowrap;
}

.explainer-controls .ctrl-label {
  color: var(--text);
}

.key-imgs-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
}

.key-img {
  height: 28px;
  width: auto;
  image-rendering: pixelated;
}

.key-separator {
  color: var(--muted);
  padding: 0 2px;
  font-size: 12px;
  line-height: 1;
}

.explainer-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

#explainer-canvas {
  border: 2px solid var(--panel-border);
  border-radius: 10px;
  background: #111;
  display: block;
  width: 100%;
  height: auto;
  max-height: 100%;
  aspect-ratio: 420 / 300;
}

.explainer-footer {
  display: flex;
  justify-content: center;
}

.btn-explainer-ready {
  font-family: 'Minecraft', monospace;
  font-size: 18px;
  padding: 12px 48px;
  background: rgba(60, 200, 80, 0.15);
  border: 2px solid #3cc850;
  color: #3cc850;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
}

.btn-explainer-ready:hover {
  background: rgba(60, 200, 80, 0.3);
}

.btn-explainer-ready.ready {
  background: rgba(255, 100, 20, 0.25);
  border-color: #ff6414;
  color: #ff9955;
  animation: burn-btn 0.6s ease-in-out infinite alternate;
}

@keyframes burn-btn {
  0%  { box-shadow: 0 0 8px #ff6414, 0 0 18px rgba(255,100,20,0.4); border-color: #ff6414; }
  50% { box-shadow: 0 0 16px #ffaa33, 0 0 32px rgba(255,170,51,0.5); border-color: #ffaa33; }
  100%{ box-shadow: 0 0 8px #ff3300, 0 0 22px rgba(255,50,0,0.45);  border-color: #ff3300; }
}

/* ── Match Results (Smash-Brawl style) ────────────────────────────────────── */
#results-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #000;
  overflow: hidden;
}
#results-overlay.hidden { display: none; }

/* Sunset-sky stage with a floor, like the Brawl results backdrop. */
#results-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 34% 7% at 18% 24%, rgba(255,255,255,.38), transparent 70%),
    radial-gradient(ellipse 30% 6% at 78% 18%, rgba(255,236,236,.32), transparent 70%),
    radial-gradient(ellipse 46% 9% at 52% 40%, rgba(255,214,204,.42), transparent 70%),
    radial-gradient(ellipse 30% 6% at 12% 47%, rgba(255,200,190,.35), transparent 70%),
    linear-gradient(180deg, #5d78a8 0%, #8a8db2 22%, #c49da6 42%, #e4bdb2 56%, #ecd6c8 61.5%,
                            #bdb3a6 62%, #aca295 74%, #958c80 88%, #7f776c 100%);
  animation: rsFadeIn .45s ease-out;
}
@keyframes rsFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Banner: slanted dark bars, WINNER, name, score box ── */
#results-banner {
  position: absolute;
  top: 2.5%;
  left: 0; right: 0;
  height: clamp(96px, 19vh, 170px);
  z-index: 6;
  pointer-events: none;
}
.rb-stripes { position: absolute; inset: 0; filter: drop-shadow(0 2px 0 rgba(255,255,255,.45)) drop-shadow(0 3px 4px rgba(0,0,0,.35)); }
.rb-stripe {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #5a5b63 0%, #3a3b42 55%, #2a2b30 100%);
}
.rb-stripe-1 { clip-path: polygon(0% 30%, 58% 30%, 66% 2%, 100% 2%, 100% 20%, 67.5% 20%, 59.5% 48%, 0% 48%); }
.rb-stripe-2 { clip-path: polygon(0% 76%, 72% 76%, 78% 54%, 100% 54%, 100% 70%, 79.5% 70%, 73.5% 92%, 0% 92%); }
#results-winner-label {
  position: absolute;
  left: 18%;
  top: 9%;
  font: italic 900 clamp(18px, 4.2vh, 38px)/1 'Arial Black', 'Segoe UI Black', Impact, sans-serif;
  letter-spacing: 1px;
  background: linear-gradient(180deg, #ffd04a 0%, #ff7a1a 45%, #e01b12 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  -webkit-text-stroke: 1.5px #2a0a00;
  filter: drop-shadow(0 2px 0 rgba(0,0,0,.45));
  transform: skewX(-8deg);
}
#results-winner-emblem {
  position: absolute;
  left: 21%;
  top: 44%;
  font-size: clamp(34px, 8vh, 74px);
  opacity: .55;
  filter: sepia(1) saturate(3) hue-rotate(5deg) brightness(1.15);
  transform: rotate(-12deg);
}
#results-winner-name {
  position: absolute;
  left: 0; right: 0;
  top: 62%;
  transform: translateY(-50%);
  text-align: center;
  font: 900 clamp(34px, 8.5vh, 82px)/1 'Arial Black', 'Segoe UI Black', Impact, sans-serif;
  color: #fff;
  letter-spacing: 1px;
  -webkit-text-stroke: 1px rgba(0,0,0,.25);
  text-shadow: 0 3px 0 rgba(0,0,0,.35), 0 0 18px rgba(0,0,0,.35);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 28%;
}
#results-winner-score {
  position: absolute;
  right: 11%;
  top: 60%;
  transform: translateY(-50%);
  min-width: clamp(56px, 10vh, 96px);
  padding: 2px 12px 3px;
  background: linear-gradient(180deg, #2f3036, #141518);
  border: 3px solid #f2f2f2;
  border-radius: 10px;
  box-shadow: 0 0 0 2px #1a1a1a, 0 4px 8px rgba(0,0,0,.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}
#results-winner-score-num {
  font: 900 clamp(22px, 5.2vh, 46px)/1.05 'Arial Black', Impact, sans-serif;
  color: #e3241c;
  -webkit-text-stroke: 1.5px #fff;
  paint-order: stroke fill;
}
#results-winner-score-label {
  font: bold clamp(8px, 1.3vh, 11px)/1.2 'Minecraft', monospace;
  color: rgba(255,255,255,.7);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ── Characters standing on the stage ── */
#results-lineup {
  --char-size: clamp(170px, 46vh, 440px);
  position: absolute;
  left: 0; right: 0;
  bottom: 34.5%;               /* feet on the floor line */
  display: flex;
  justify-content: center;
  align-items: flex-end;
  z-index: 2;
  pointer-events: none;
}
.rl-char {
  position: relative;
  width: var(--char-size);
  height: var(--char-size);
  margin: 0 calc(var(--char-size) * -0.15);
  animation: rlEnter .6s cubic-bezier(.2,.9,.3,1.2) both;
}
.rl-char::before {           /* soft shadow on the floor */
  content: '';
  position: absolute;
  left: 22%; right: 22%;
  bottom: 4%;
  height: 9%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(40,30,25,.45), transparent 70%);
}
.rl-char canvas { position: relative; width: 100%; height: 100%; image-rendering: pixelated; }
.rl-char.back { transform: scale(.8); transform-origin: 50% 96%; filter: saturate(.85) brightness(.95); }
.rl-char.winner { transform: scale(1.08); transform-origin: 50% 96%; }
.rl-char.winner canvas { animation: rlCheer 1.1s ease-in-out infinite; }
@keyframes rlCheer { 0%,100% { transform: translateY(0); } 45% { transform: translateY(-9%); } 60% { transform: translateY(-9%); } }
@keyframes rlEnter { from { opacity: 0; translate: 0 12%; } to { opacity: 1; translate: 0 0; } }

#results-1v1-banner { position: absolute; top: 23%; left: 50%; transform: translateX(-50%); z-index: 7; margin: 0; }

/* ── Player cards ── */
#results-cards {
  --card-w: 180px;
  --card-h: calc(var(--card-w) * 1.32);
  position: absolute;
  left: 0; right: 0;
  top: 47%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(8px, 1.6vw, 22px);
  z-index: 5;
}
#results-hint {
  position: absolute;
  left: 0; right: 0;
  bottom: 2.5%;
  text-align: center;
  font: bold 12px 'Minecraft', monospace;
  color: rgba(255,255,255,.85);
  text-shadow: 0 1px 2px rgba(0,0,0,.7);
  z-index: 6;
}
#results-hint.hidden { display: none; }

.result-card {
  width: var(--card-w);
  height: var(--card-h);
  margin-top: calc(var(--card-w) * 0.2 * var(--rank-step, 0));
  perspective: 900px;
  position: relative;
  cursor: default;
  animation: rcDrop .55s cubic-bezier(.2,.9,.3,1.25) both;
}
.result-card:nth-child(2) { animation-delay: .08s; }
.result-card:nth-child(3) { animation-delay: .16s; }
.result-card:nth-child(4) { animation-delay: .24s; }
.result-card:nth-child(n+5) { animation-delay: .32s; }
@keyframes rcDrop { from { opacity: 0; transform: translateY(-40px); } to { opacity: 1; transform: none; } }

/* Only your own card reacts; others are mirrored but view-only. */
.result-card:not(.is-mine) { pointer-events: none; }
.result-card.is-mine { cursor: pointer; }
.result-card.is-mine:not(.flipped):not(.fertig-done):hover .card-inner { transform: translateY(-4px); }

.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform .55s cubic-bezier(.4,0,.2,1);
}
.result-card.flipped .card-inner { transform: rotateY(180deg); }
/* The hidden face must not catch clicks: backface-visibility only hides it
   visually, so the big placement number on the front used to swallow almost
   half of the "Fertig" button on the flipped card. */
.result-card.flipped .card-front,
.result-card:not(.flipped) .card-back { pointer-events: none; }

.card-front, .card-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 14px;
  border: calc(var(--card-w) * 0.035) solid var(--pc);
  box-shadow: 0 0 0 2px rgba(255,255,255,.7), 0 8px 18px rgba(0,0,0,.45);
}

/* Front: portrait / name band / placement number */
.card-front {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #4b4b51 0%, #5d5d63 50%, #6e6d72 100%);
}
.result-card.is-winner .card-front { box-shadow: 0 0 0 2px rgba(255,255,255,.8), 0 0 22px rgba(255,214,90,.55), 0 8px 18px rgba(0,0,0,.45); }
.rc-portrait {
  height: 36%;
  border-radius: 9px 9px 0 0;
  background: linear-gradient(180deg, #27272b, #45454b);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
.rc-portrait canvas {
  width: 86%;
  height: auto;
  aspect-ratio: 1;
  image-rendering: pixelated;
  margin-top: -6%;
}
.rc-nameband {
  padding: 5% 6%;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--pc) 78%, #fff 22%) 0%,
    var(--pc) 45%,
    color-mix(in srgb, var(--pc) 62%, #000 38%) 100%);
  box-shadow: 0 2px 0 rgba(0,0,0,.25);
  text-align: center;
}
.rc-nameband span {
  display: block;
  font: 900 calc(var(--card-w) * 0.115)/1.05 'Arial Black', 'Segoe UI Black', Impact, sans-serif;
  color: #fff;
  letter-spacing: 1px;
  text-transform: uppercase;
  -webkit-text-stroke: 1px rgba(0,0,0,.55);
  paint-order: stroke fill;
  text-shadow: 0 2px 0 rgba(0,0,0,.35);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rc-place {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rc-emblem {                  /* faint series-logo watermark behind the number */
  position: absolute;
  font-size: calc(var(--card-w) * 0.42);
  opacity: .18;
  filter: grayscale(1) brightness(2);
  transform: rotate(-14deg) translate(-18%, -6%);
}
.rc-place-num {
  position: relative;
  z-index: 2;
  font: italic 900 calc(var(--card-w) * 0.5)/1 'Arial Black', 'Segoe UI Black', Impact, sans-serif;
  background: var(--num-grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  -webkit-text-stroke: calc(var(--card-w) * 0.022) #121212;
  filter: drop-shadow(0 3px 0 rgba(0,0,0,.35)) drop-shadow(0 0 2px rgba(255,255,255,.6));
  transform: skewX(-7deg);
  padding: 0 .08em;
}
.rc-place-1 { --num-grad: linear-gradient(180deg, #ffffff 0%, #ffc2b0 16%, #ff3e22 46%, #b40e0a 100%); }
.rc-place-2 { --num-grad: linear-gradient(180deg, #ffffff 0%, #fff3c4 30%, #e3c063 66%, #a37b27 100%); }
.rc-place-3 { --num-grad: linear-gradient(180deg, #ffffff 0%, #f1f4f7 35%, #b8c1cb 70%, #7a8491 100%); }
.rc-place-n { --num-grad: linear-gradient(180deg, #f4f4f4 0%, #cdcdcd 45%, #8b8b8b 100%); }
.rc-laurel {
  position: absolute;
  z-index: 1;
  width: 104%;
  left: -2%;
  top: 50%;
  transform: translateY(-46%);
  pointer-events: none;
  filter: drop-shadow(0 2px 1px rgba(0,0,0,.35));
}

/* Back: stats */
.card-back {
  transform: rotateY(180deg);
  background: linear-gradient(180deg, #24242b, #34343d);
  display: flex;
  flex-direction: column;
  padding: 7px 9px 9px;
  overflow: hidden;
}
.card-back-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding-bottom: 5px;
  margin-bottom: 4px;
  border-bottom: 2px solid var(--pc);
}
.card-back-face { width: 30px; height: 30px; image-rendering: pixelated; background: rgba(0,0,0,.3); border-radius: 5px; flex-shrink: 0; }
.card-back-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.card-back-title span { font-weight: bold; font-size: 12px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-back-title small { font-size: 10px; color: var(--pc); font-weight: bold; }
.card-back-flip { color: rgba(255,255,255,.6); font-size: 16px; flex-shrink: 0; }

.card-stats-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  width: 100%;
  font-size: 11px;
  line-height: 1.7;
  color: var(--text);
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--pc) 70%, transparent) transparent;
  cursor: auto;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding: 1px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.stat-row .stat-label { color: var(--muted); flex: 1; }
.stat-row .stat-val   { font-weight: bold; white-space: nowrap; }

.btn-card-fertig {
  margin-top: 7px;
  width: 100%;
  padding: 6px;
  font-size: 13px;
  font-family: 'Minecraft', monospace;
  background: rgba(60, 200, 80, 0.15);
  border: 2px solid #3cc850;
  color: #3cc850;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.btn-card-fertig:hover { background: rgba(60, 200, 80, 0.35); }
.btn-card-fertig:disabled { opacity: 0.4; cursor: default; }

.card-fertig-badge {
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(60, 200, 80, 0.95);
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  padding: 2px 10px;
  border-radius: 10px;
  white-space: nowrap;
  z-index: 3;
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.card-fertig-badge.hidden { display: none; }

/* ── Round timer on canvas ────────────────────────────────────────────────── */
/* (rendered via render.js, no CSS needed for the canvas element itself) */

/* ── Mobile / touch controls ──────────────────────────────────────────────── */
/* Hidden by default; only touch-capable devices get the on-screen controls.
   The wrapper ignores pointer events so it never blocks taps on the game UI —
   only the joystick and buttons themselves are interactive. */
/* Game selection screen */
#gs-title {
  font-family: 'Minecraft', monospace;
  font-size: 34px;
  color: #ffd21e;
  letter-spacing: 2px;
  text-align: center;
  margin-bottom: 6px;
  text-shadow: 0 0 18px rgba(255, 210, 30, 0.4);
}
#gameselect-cards {
  display: flex;
  gap: 18px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 18px;
}
.gs-card {
  all: unset;
  cursor: pointer;
  width: 220px;
  padding: 24px 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
}
.gs-card:hover { transform: translateY(-3px); background: rgba(255, 210, 30, 0.12); border-color: rgba(255, 210, 30, 0.5); }
.gs-card .gs-icon { font-size: 56px; line-height: 1; }
.gs-card .gs-name { font-size: 22px; font-weight: 800; margin: 10px 0 4px; color: var(--text); }
.gs-card .gs-desc { font-size: 13px; color: var(--muted); }

/* Moorhuhn lobby + game */
#mh-player-list { list-style: none; padding: 0; margin: 12px auto; max-width: 320px; }
#mh-player-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; margin: 5px 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px; font-size: 15px;
}
.mh-swatch { width: 16px; height: 16px; border-radius: 4px; display: inline-block; border: 1px solid rgba(0,0,0,0.4); }
#mh-countdown { font-family: 'Minecraft', monospace; font-size: 22px; color: #ffd21e; margin: 8px 0; }
.mh-hint { color: var(--muted); font-size: 12px; margin: 10px 0; }
/* Moorhuhn game fills the whole viewport (black letterbox), canvas kept 16:9. */
#screen-mh-game {
  position: fixed;
  inset: 0;
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  max-width: none;
  background: #000;
  border: none;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
#mh-canvas {
  image-rendering: pixelated;
  display: block;
  /* Largest 16:9 box that fits → black bars fill the rest (letterbox). */
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  cursor: none;
  background: #5aa9e6;
}
#mh-game-back { position: fixed; top: 12px; left: 12px; z-index: 10; }

/* Survival co-op shop dialog */
#shop-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 4, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
#shop-dialog {
  width: min(560px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  background: linear-gradient(160deg, #12200e, #0a1206);
  border: 1px solid rgba(136, 204, 51, 0.4);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
}
#shop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
#shop-title { font-size: 22px; font-weight: 800; color: #aaff66; letter-spacing: 1px; }
#shop-money { font-size: 18px; color: #ffd21e; font-weight: 700; }
#shop-items { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.shop-cat { grid-column: 1 / -1; margin: 8px 0 2px; color: var(--muted); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; }
.shop-item {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: background 0.12s ease, transform 0.05s ease;
}
.shop-item:hover:not(:disabled) { background: rgba(136, 204, 51, 0.18); }
.shop-item:active:not(:disabled) { transform: translateY(1px); }
.shop-item:disabled { opacity: 0.45; cursor: not-allowed; }
.shop-item .si-name { font-size: 14px; color: var(--text); }
.shop-item .si-cost { font-size: 13px; color: #ffd21e; font-weight: 700; white-space: nowrap; }
.shop-item.owned .si-cost { color: #66dd66; }
#shop-close {
  margin-top: 14px;
  width: 100%;
  background: linear-gradient(180deg, #6aa832, #4e7d22);
}

/* Emoji reaction bar — bottom-right of the game screen */
#emoji-bar {
  position: fixed;
  right: max(0px, env(safe-area-inset-right));
  bottom: max(6px, env(safe-area-inset-bottom));
  z-index: 45;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  max-width: 160px;
  padding: 6px;
  background: rgba(20, 20, 34, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
#emoji-bar .emoji-btn {
  all: unset;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  line-height: 1;
  border-radius: 8px;
  transition: transform 0.08s ease, background 0.12s ease;
  user-select: none;
}
#emoji-bar .emoji-btn:hover { background: rgba(255, 255, 255, 0.12); }
#emoji-bar .emoji-btn:active { transform: scale(1.35); background: rgba(255, 255, 255, 0.18); }

/* Toggle that collapses the emoji bar on touch devices; hidden on desktop. */
#emoji-toggle { display: none; }

#mobile-controls {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 0 max(16px, env(safe-area-inset-left)) max(18px, env(safe-area-inset-bottom));
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* #mobile-controls lives inside #screen-game, so it inherits that screen's
   hidden/visible state automatically and only appears during a live game. */
body.touch-device #mobile-controls {
  display: flex;
}

/* Action buttons (left thumb) */
#mc-buttons {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 10px;
  pointer-events: auto;
}

.mc-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 64px;
  height: 64px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18);
  background: rgba(20, 20, 38, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: var(--text);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  transition: transform 0.06s ease, background 0.1s ease, box-shadow 0.1s ease;
  touch-action: none;
}

.mc-btn .mc-ico { font-size: 22px; line-height: 1; }
.mc-btn .mc-lbl {
  font-family: 'Minecraft', monospace;
  font-size: 9px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
}

.mc-btn-bomb { border-color: rgba(255, 170, 51, 0.5); }
.mc-btn-nuke { border-color: rgba(255, 85, 85, 0.55); }
.mc-btn-holo { border-color: rgba(170, 187, 255, 0.5); }

.mc-btn.mc-btn-active {
  transform: scale(0.92);
  background: rgba(255, 170, 51, 0.28);
  box-shadow: 0 0 16px rgba(255, 170, 51, 0.5);
}

/* Virtual joystick (right thumb) */
#mc-joystick {
  pointer-events: auto;
}

#mc-joy-base {
  position: relative;
  width: 136px;
  height: 136px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18);
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.06), transparent 70%),
    rgba(20, 20, 38, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.4), 0 6px 18px rgba(0, 0, 0, 0.4);
  touch-action: none;
}

#mc-joy-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  margin-left: -28px;
  margin-top: -28px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffce7a, var(--accent-2) 70%);
  border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  will-change: transform;
  pointer-events: none;
}

/* On touch devices the on-screen buttons replace the keyboard legend, and the
   side panels are dropped so the canvas gets the full width. */
body.touch-device #controls-panel,
body.touch-device #event-log {
  display: none;
}
/* The left column only hosts the floating test panel on touch devices. */
body.touch-device #game-left { flex: 0 0 0; width: 0; min-width: 0; padding: 0; }
body.touch-device #game-area { flex-wrap: wrap; justify-content: center; }
body.touch-device #game-right { width: 100%; max-height: none; }
body.touch-device #player-cards { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 6px; }
body.touch-device .pcard { flex: 0 1 180px; }
body.touch-device #game-topbar { position: fixed; top: max(4px, env(safe-area-inset-top)); left: 0; right: 0; z-index: 41; height: auto; padding: 0 8px; pointer-events: none; }
body.touch-device #game-topbar > * { pointer-events: auto; }

/* Maximize the board on phones: the round label shrinks to a floating pill on
   top of the canvas margin, and the canvas takes almost the full height (the
   HUD scrolls below it when needed). */
body.touch-device #round-info {
  position: fixed;
  top: max(4px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 41;
  padding: 3px 12px;
  font-size: 11px;
  background: rgba(15, 15, 31, 0.6);
  border-radius: 8px;
  pointer-events: none;
  white-space: nowrap;
}

body.touch-device #game {
  max-height: calc(100vh - 16px);
  max-height: calc(100dvh - 16px);
  margin: 8px auto;
}

/* The full-viewport desktop layout is desktop-only; keep the touch layout as it
   was (block flow, content-sized, its own game sizing above). */
body.touch-device #screen-game {
  display: block;
  width: auto;
  max-width: 92vw;
  min-height: 0;
  justify-content: initial;
}
body.touch-device #game-area {
  align-items: flex-start;
  flex: 0 1 auto;
}


/* The test-mode item panel floats above the action-button cluster instead of
   occupying a flex column next to the board. */
body.touch-device #test-panel {
  position: fixed;
  left: max(16px, env(safe-area-inset-left));
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 146px);
  z-index: 46;
  max-height: calc(100vh - 210px);
  max-height: calc(100dvh - 210px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}


/* In portrait the controls span the whole bottom edge, so reserve space for
   them below the HUD instead. */
@media (orientation: portrait) {
  body.touch-device #screen-game {
    padding-bottom: 175px;
  }
}

/* On touch devices the emoji bar collapses behind a round toggle stacked above
   the joystick, so neither ever covers it. */
body.touch-device #emoji-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 150px);
  width: 48px;
  height: 48px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18);
  background: rgba(20, 20, 38, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  font-size: 24px;
  line-height: 1;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  z-index: 46;
  -webkit-tap-highlight-color: transparent;
}

body.touch-device #emoji-toggle:active,
body.touch-device #emoji-toggle.open {
  background: rgba(255, 170, 51, 0.28);
  box-shadow: 0 0 16px rgba(255, 170, 51, 0.5);
}

body.touch-device #emoji-bar {
  display: none;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 206px);
}

body.touch-device #emoji-bar.open {
  display: flex;
}

/* ── Auth screen (invite-link join) ─────────────────────────────────────────── */
#screen-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
#auth-card {
  background: linear-gradient(180deg, #1b1b34, #12121f);
  border: 1px solid rgba(120, 150, 255, 0.35);
  border-radius: 14px;
  padding: 24px 26px 26px;
  width: min(92vw, 380px);
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}
#auth-card h2 { margin: 0 0 4px; font-family: 'Minecraft', monospace; color: #ffe566; letter-spacing: 2px; }
#auth-room-line { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
#auth-room-line strong { color: #fff; letter-spacing: 2px; }
.auth-welcome { font-size: 15px; margin: 8px 0 14px; color: #dbe5f7; }
.auth-actions { display: flex; gap: 10px; justify-content: center; }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.auth-tab {
  flex: 1; padding: 8px 0; font-family: 'Minecraft', monospace; font-size: 13px;
  background: rgba(255,255,255,0.06); color: #aab; border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px; cursor: pointer;
}
.auth-tab-active { background: linear-gradient(180deg, #3a8bff, #2a6be0); color: #fff; border-color: #2a6be0; }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form input, .auth-guest input {
  padding: 10px 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.35); color: #fff; font-size: 15px; width: 100%; box-sizing: border-box;
}
.auth-form button, .auth-guest button, .auth-actions button { padding: 10px 16px; }
.auth-error { color: #ff6b6b; min-height: 18px; font-size: 13px; margin: 8px 0 0; }
.auth-guest { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.auth-guest .divider { color: var(--muted); font-size: 12px; }

/* Alias dropdown on the own player card in character select */
.cs-alias-select {
  width: 100%;
  margin: 1px 0;
  padding: 2px 4px;
  font-family: 'Minecraft', monospace;
  font-size: clamp(8px, 1vw, 11px);
  color: #fff;
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--player-color, rgba(255,255,255,0.4));
  border-radius: 4px;
  cursor: pointer;
}
.cs-alias-select option { color: #fff; background: #14141f; }

/* Main-menu "signed in as …" indicator (top-right) */
.menu-account {
  position: fixed;
  top: 12px;
  right: 14px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(20, 28, 48, 0.85);
  border: 1px solid rgba(120, 160, 255, 0.45);
  border-radius: 10px;
  font-family: 'Minecraft', monospace;
  font-size: 13px;
  color: #dbe5f7;
  backdrop-filter: blur(4px);
}
.menu-account .ma-label { color: var(--muted); }
.menu-account .ma-name { color: #ffe566; }
.menu-account #btn-menu-logout {
  padding: 3px 8px;
  font-size: 11px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 6px;
  color: #cdd;
  cursor: pointer;
}
.menu-account #btn-menu-logout:hover { background: rgba(255,90,90,0.25); color: #fff; }

/* ── Profile (stats) overlay ────────────────────────────────────────────────── */
.menu-account #btn-menu-profile {
  padding: 3px 8px; font-size: 11px;
  background: rgba(90,150,255,0.25);
  border: 1px solid rgba(120,160,255,0.5);
  border-radius: 6px; color: #eaf2ff; cursor: pointer;
  font-family: 'Minecraft', monospace;
}
.menu-account #btn-menu-profile:hover { background: rgba(90,150,255,0.45); }
#profile-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.7);
}
#profile-card {
  width: min(94vw, 460px);
  max-height: 86vh;
  display: flex; flex-direction: column;
  background: #000;
  border: 2px solid #333;
  border-radius: 12px;
  box-shadow: 0 12px 50px rgba(0,0,0,0.8);
  font-family: 'Minecraft', monospace;
  color: #fff;
  overflow: hidden;
}
#profile-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #333;
  font-size: 20px;
  letter-spacing: 1px;
}
#profile-head #profile-name { color: #fff; }
#btn-profile-close {
  background: transparent; border: none; color: #aaa; font-size: 18px; cursor: pointer;
}
#btn-profile-close:hover { color: #fff; }
#profile-list {
  overflow-y: auto;
  padding: 10px 16px 18px;
}
#profile-list .pf-section {
  margin: 14px 0 6px; font-size: 13px; color: #888;
  text-transform: uppercase; letter-spacing: 2px;
  border-bottom: 1px solid #222; padding-bottom: 4px;
}
#profile-list .pf-section:first-child { margin-top: 0; }
#profile-list .pf-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 4px 0; font-size: 14px; color: #fff;
  border-bottom: 1px solid #141414;
}
#profile-list .pf-row .pf-label { color: #cfcfcf; }
#profile-list .pf-row .pf-val { color: #fff; font-weight: bold; }
#profile-list .pf-empty { color: #777; font-size: 13px; padding: 6px 0; }

/* ── Ranked mode ────────────────────────────────────────────────────────────── */
#screen-ranked {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; gap: 16px; text-align: center;
}
#ranked-head h2 { font-family: 'Minecraft', monospace; color: #ffd23f; margin: 0; letter-spacing: 2px; }
#ranked-round-label { color: var(--muted); font-family: 'Minecraft', monospace; font-size: 14px; }
#ranked-cards { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.ranked-card {
  width: clamp(140px, 22vw, 220px);
  background: linear-gradient(180deg, #23233c, #14141f);
  border: 3px solid rgba(255,255,255,0.15);
  border-radius: 12px; padding: 18px 12px; cursor: pointer;
  transition: transform .12s, border-color .15s, box-shadow .15s;
  font-family: 'Minecraft', monospace;
}
.ranked-card:hover { transform: translateY(-4px); border-color: rgba(255,255,255,0.5); }
.ranked-card-icon { font-size: 46px; }
.ranked-card-name { font-size: 16px; color: #fff; margin-top: 8px; }
.ranked-card-votes { font-size: 13px; color: #ffd23f; margin-top: 6px; min-height: 18px; }
.ranked-card-mine { border-color: #3a8bff; box-shadow: 0 0 14px rgba(58,139,255,0.6); }
.ranked-card-hl { border-color: #ffd23f; box-shadow: 0 0 26px rgba(255,210,63,0.9); transform: scale(1.06); }
.ranked-card-chosen { border-color: #3ad64a; box-shadow: 0 0 40px rgba(58,214,74,1); transform: scale(1.12); }
/* Levels nobody voted for: greyed out and out of the running. */
.ranked-card-dim { filter: grayscale(1) brightness(0.5); opacity: 0.45; }
.ranked-card-dim.ranked-card-hl, .ranked-card-dim.ranked-card-chosen { filter: grayscale(1) brightness(0.5); box-shadow: none; transform: none; }
#ranked-timer { font-family: 'Minecraft', monospace; font-size: 28px; color: #fff; letter-spacing: 2px; }
#ranked-hint { font-family: 'Minecraft', monospace; color: #cdd; font-size: 16px; min-height: 20px; }
#ranked-standings { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
#ranked-standings .rk-stand { font-family: 'Minecraft', monospace; font-size: 13px; color: #bbb; background: rgba(0,0,0,0.4); padding: 4px 10px; border-radius: 8px; }
#ranked-standings .rk-stand.me { color: #ffd23f; }

#ranked-bars-overlay {
  position: fixed; inset: 0; z-index: 150; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.75);
}
#ranked-bars-card {
  width: min(96vw, 680px); background: #10101a; border: 2px solid #333; border-radius: 14px;
  padding: 22px 24px; font-family: 'Minecraft', monospace; color: #fff;
}
#ranked-bars-title { text-align: center; font-size: 20px; color: #ffd23f; margin-bottom: 16px; letter-spacing: 2px; }
.rk-bar-row { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.rk-bar-face { width: 34px; height: 34px; flex-shrink: 0; }
.rk-bar-face canvas { width: 34px; height: 34px; image-rendering: pixelated; }
.rk-bar-name { width: 92px; font-size: 13px; color: #ddd; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-shrink: 0; }
/* Track spans 0…target. Segments stack left→right inside it; gridlines mark the
   quarters and a bright "WIN" line marks the target at the far right. */
.rk-bar-track {
  position: relative; flex: 1; height: 26px;
  background: rgba(255,255,255,0.06);
  border: 1px solid #2a2a3a; border-radius: 4px; overflow: hidden;
}
.rk-bar-grid { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.rk-grid-line { position: absolute; top: 0; bottom: 0; width: 1px; background: repeating-linear-gradient(to bottom, rgba(255,255,255,0.28) 0 3px, transparent 3px 6px); }
.rk-win-line { position: absolute; top: -2px; bottom: -2px; right: 0; width: 3px; background: #ffd23f; box-shadow: 0 0 6px rgba(255,210,63,0.8); }
.rk-bar-segs { position: absolute; inset: 0; display: flex; align-items: stretch; z-index: 1; }
.rk-seg { height: 100%; width: 0%; transition: width .55s cubic-bezier(.34,1.2,.64,1); }
/* Diagonal hatch, UCH-style, tinted per contribution type. */
.rk-seg-base   { background-color: #34508f; background-image: repeating-linear-gradient(45deg, rgba(0,0,0,0.22) 0 4px, transparent 4px 8px); }
.rk-seg-podium { background-color: #ffd23f; background-image: repeating-linear-gradient(45deg, rgba(0,0,0,0.18) 0 4px, transparent 4px 8px); }
.rk-seg-kills  { background-color: #3ad64a; background-image: repeating-linear-gradient(45deg, rgba(0,0,0,0.18) 0 4px, transparent 4px 8px); }
.rk-seg-pen    { background-color: #ff5a5a; background-image: repeating-linear-gradient(45deg, rgba(0,0,0,0.22) 0 4px, transparent 4px 8px); }
.rk-bar-val { width: 46px; text-align: right; font-size: 14px; color: #fff; flex-shrink: 0; }
.rk-bars-legend { display: flex; justify-content: center; gap: 16px; margin-top: 14px; font-size: 12px; color: #aaa; }
.rk-bars-legend span::before { content: ''; display: inline-block; width: 11px; height: 11px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.rk-lg-podium::before { background: #ffd23f; } .rk-lg-kills::before { background: #3ad64a; } .rk-lg-pen::before { background: #ff5a5a; }

/* ── Emoji legend under the in-game controls ─────────────────────────────────── */
#emoji-legend-rows { display: flex; flex-direction: column; gap: 3px; }
.emoji-legend-row { display: flex; align-items: center; gap: 6px; }
.emoji-legend-row .key-badge { min-width: 18px; text-align: center; }
.emoji-legend-eq { color: #888; font-size: 12px; }
.emoji-legend-val { display: inline-flex; align-items: center; font-size: 16px; line-height: 1; }
.emoji-legend-val img { width: 20px; height: 20px; object-fit: contain; image-rendering: auto; }

/* ── Custom image/GIF reactions (DOM overlay above the canvas) ────────────────── */
.reaction-img-bubble {
  position: fixed; transform: translate(-50%, -50%);
  display: flex; align-items: center; justify-content: center;
  background: rgba(20,20,30,0.82);
  border: 1.5px solid rgba(255,255,255,0.35);
  border-radius: 50%; padding: 0; box-sizing: border-box;
  overflow: hidden;
  will-change: left, top, opacity;
}
.reaction-img-bubble img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* ── Explainer "ready" column ────────────────────────────────────────────────── */
.explainer-ready-col {
  min-width: 170px; max-width: 200px;
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px; background: rgba(0,0,0,0.35);
  border: 1px solid #333; border-radius: 10px;
}
.explainer-ready-title {
  font-size: 13px; letter-spacing: 2px; text-transform: uppercase;
  color: #9ad; border-bottom: 1px solid #333; padding-bottom: 6px;
}
#explainer-ready-list { display: flex; flex-direction: column; gap: 6px; }
.exp-ready-row {
  display: flex; align-items: center; gap: 8px;
  opacity: 0.4; filter: grayscale(1);
  transition: opacity .25s ease, filter .25s ease;
}
.exp-ready-row.ready { opacity: 1; filter: none; }
.exp-ready-face {
  width: 40px; height: 40px; image-rendering: pixelated;
  background: rgba(255,255,255,0.05); border-radius: 8px;
}
.exp-ready-name { flex: 1; font-size: 13px; color: #eee; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exp-ready-check { color: #3ad64a; font-weight: bold; font-size: 18px; width: 16px; text-align: center; }

/* ── Generic modal (alias dialog) ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.7);
}
.modal-overlay.hidden { display: none; }
.modal-card {
  width: min(90vw, 340px);
  background: #0d0d0d; border: 2px solid #444; border-radius: 12px;
  padding: 20px; font-family: 'Minecraft', monospace; color: #fff;
  box-shadow: 0 12px 50px rgba(0,0,0,0.8);
}
.modal-title { font-size: 18px; letter-spacing: 1px; margin-bottom: 14px; }
#alias-input {
  width: 100%; box-sizing: border-box; padding: 10px 12px;
  background: #1a1a1a; border: 1px solid #555; border-radius: 8px;
  color: #fff; font-family: 'Minecraft', monospace; font-size: 15px;
}
#alias-input:focus { outline: none; border-color: #6cf; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.modal-btn {
  padding: 8px 16px; border-radius: 8px; border: none; cursor: pointer;
  background: #3a6; color: #fff; font-family: 'Minecraft', monospace; font-size: 14px;
}
.modal-btn:hover { background: #4c7; }
.modal-btn-ghost { background: #333; }
.modal-btn-ghost:hover { background: #444; }

/* ── Profile: emoji configuration ────────────────────────────────────────────── */
#profile-body { overflow-y: auto; padding: 10px 16px 18px; }
#profile-body #profile-list { overflow: visible; padding: 0; }
#emoji-config .pf-section {
  margin: 14px 0 6px; font-size: 13px; color: #888;
  text-transform: uppercase; letter-spacing: 2px;
  border-bottom: 1px solid #222; padding-bottom: 4px;
}
#emoji-config .pf-section:first-child { margin-top: 0; }
.ec-hint { color: #777; font-size: 12px; margin: 2px 0 8px; }
.ec-slots { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.ec-slot {
  position: relative; aspect-ratio: 1; min-width: 0;
  display: flex; align-items: center; justify-content: center;
  background: #1a1a1a; border: 1px solid #444; border-radius: 8px;
  cursor: pointer; font-size: 20px; padding: 0;
}
.ec-slot:hover { border-color: #777; }
.ec-slot.selected { border-color: #6cf; box-shadow: 0 0 0 2px rgba(102,204,255,0.4); }
.ec-slot img { width: 78%; height: 78%; object-fit: contain; }
.ec-slot-key {
  position: absolute; top: 1px; left: 3px; font-size: 10px; color: #888;
}
.ec-slot-emoji { line-height: 1; }
.ec-picker {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px;
  background: #111; border: 1px solid #333; border-radius: 8px; padding: 8px;
}
.ec-picker.hidden { display: none; }
.ec-choice {
  width: 40px; height: 40px; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: #1c1c1c; border: 1px solid #3a3a3a; border-radius: 6px;
  cursor: pointer; font-size: 20px; padding: 0; color: #fff;
}
.ec-choice:hover { border-color: #6cf; }
.ec-choice small { font-size: 8px; color: #999; }
.ec-choice img { width: 78%; height: 78%; object-fit: contain; }
.ec-choice-default { width: 52px; }
.ec-upload-btn {
  margin: 4px 0 10px; padding: 8px 14px; border-radius: 8px; border: 1px dashed #666;
  background: #1a1a1a; color: #ddd; cursor: pointer; font-family: 'Minecraft', monospace; font-size: 13px;
}
.ec-upload-btn:hover { border-color: #6cf; color: #fff; }
.ec-uploads { display: flex; flex-wrap: wrap; gap: 8px; }
.ec-upload-cell {
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  background: #1a1a1a; border: 1px solid #3a3a3a; border-radius: 8px;
}
.ec-upload-cell img { width: 80%; height: 80%; object-fit: contain; }

/* ── Hover mini-profile popup ─────────────────────────────────────────────────── */
#mini-profile {
  position: fixed; z-index: 250; width: 200px;
  background: #0d0d16; border: 2px solid #4a4a66; border-radius: 10px;
  padding: 12px; font-family: 'Minecraft', monospace; color: #fff;
  box-shadow: 0 10px 34px rgba(0,0,0,0.75); pointer-events: auto;
  text-align: center;
}
#mini-profile-potm {
  margin-top: 10px; width: 100%; padding: 7px 10px; border: none; border-radius: 7px;
  background: #b8892b; color: #fff; cursor: pointer;
  font-family: 'Minecraft', monospace; font-size: 12px;
}
#mini-profile-potm:hover { background: #d9a53a; }
#mini-profile.hidden { display: none; }
#mini-profile-name {
  font-size: 15px; color: #ffd23f; letter-spacing: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 8px;
}
#mini-profile-face {
  width: 56px; height: 56px; image-rendering: pixelated;
  background: rgba(255,255,255,0.05); border-radius: 8px; display: block; margin: 0 auto 4px;
}
#mini-profile-char { font-size: 12px; color: #bbb; margin-bottom: 10px; }
#mini-profile-stats { display: flex; flex-direction: column; gap: 4px; }
.mp-stat { display: flex; justify-content: space-between; font-size: 13px; padding: 2px 4px; border-top: 1px solid #20202e; }
.mp-stat:first-child { border-top: none; }
.mp-stat-label { color: #cfcfcf; } .mp-stat-val { color: #fff; font-weight: bold; }
.mini-hoverable { cursor: help; }

/* ── Profile: mini-profile settings ──────────────────────────────────────────── */
#mini-config .pf-section {
  margin: 14px 0 6px; font-size: 13px; color: #888;
  text-transform: uppercase; letter-spacing: 2px;
  border-bottom: 1px solid #222; padding-bottom: 4px;
}
#mini-config .pf-section:first-child { margin-top: 0; }
.mini-stat-select {
  width: 100%; box-sizing: border-box; padding: 6px 8px; margin-bottom: 6px;
  background: #1a1a1a; border: 1px solid #444; border-radius: 6px;
  color: #fff; font-family: 'Minecraft', monospace; font-size: 13px;
}
.mini-stat-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.mini-stat-row .mini-stat-select { margin-bottom: 0; }

/* ── Killcam / Play-of-the-Game banner ───────────────────────────────────────── */
#replay-banner {
  position: fixed; top: 54px; left: 50%; transform: translateX(-50%);
  z-index: 120; text-align: center; pointer-events: none;
  font-family: 'Minecraft', monospace; text-shadow: 0 2px 8px rgba(0,0,0,0.9);
}
#replay-banner.hidden { display: none; }
#replay-banner-title { font-size: 34px; color: #ffd23f; letter-spacing: 3px; animation: replayPulse 1s ease-in-out infinite; }
#replay-banner-sub { font-size: 14px; color: #ddd; margin-top: 4px; }
@keyframes replayPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }

/* ── Play of the Match viewer ────────────────────────────────────────────────── */
#potm-viewer {
  position: fixed; inset: 0; z-index: 260; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.85);
}
#potm-viewer.hidden { display: none; }
#potm-viewer-card {
  background: #0c0c14; border: 2px solid #b8892b; border-radius: 12px; padding: 14px;
  font-family: 'Minecraft', monospace; color: #fff; max-width: 96vw; max-height: 94vh;
}
#potm-viewer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
#potm-viewer-title { color: #ffd23f; font-size: 18px; letter-spacing: 1px; }
#potm-viewer-close { background: transparent; border: none; color: #aaa; font-size: 18px; cursor: pointer; }
#potm-viewer-close:hover { color: #fff; }
#potm-canvas { display: block; max-width: 90vw; max-height: 82vh; image-rendering: pixelated; border-radius: 6px; }

/* ── Emoji-config: custom sayings ────────────────────────────────────────────── */
.ec-saying-row { display: flex; gap: 6px; margin-bottom: 8px; }
#emoji-saying-input {
  flex: 1; min-width: 0; padding: 7px 9px; background: #1a1a1a; border: 1px solid #444;
  border-radius: 7px; color: #fff; font-family: 'Minecraft', monospace; font-size: 13px;
}
#emoji-saying-input:focus { outline: none; border-color: #6cf; }
.ec-saying-row .ec-upload-btn { margin: 0; white-space: nowrap; }
.ec-sayings { display: flex; flex-wrap: wrap; gap: 6px; }
.ec-saying-cell {
  background: #1a1a1a; border: 1px solid #3a3a3a; border-radius: 7px;
  padding: 5px 9px; font-size: 12px; color: #ddd; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ec-slot-say { font-size: 8px; line-height: 1.05; color: #cde; padding: 0 2px; text-align: center; overflow: hidden; max-height: 100%; }
.ec-choice-say { width: auto; min-width: 40px; padding: 0 8px; }
.ec-choice-saytext { font-size: 9px; color: #cde; white-space: normal; text-align: center; line-height: 1.1; }
.emoji-legend-say { font-size: 11px; color: #cde; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Ranked "Weiter" button on the bar table ─────────────────────────────────── */
#ranked-continue-btn {
  display: block; margin: 16px auto 0; padding: 10px 28px;
  background: #3a6; color: #fff; border: none; border-radius: 9px; cursor: pointer;
  font-family: 'Minecraft', monospace; font-size: 16px; letter-spacing: 1px;
}
#ranked-continue-btn:hover { background: #4c7; }
#ranked-continue-btn:disabled { background: #333; color: #888; cursor: default; }
#ranked-continue-btn.hidden { display: none; }

/* ── POTM viewer loading bar ──────────────────────────────────────────────────── */
#potm-loading { padding: 30px 20px; min-width: 320px; }
#potm-loading.hidden { display: none; }
#potm-loading-label { text-align: center; color: #ddd; font-size: 14px; margin-bottom: 10px; }
#potm-loading-track { height: 14px; background: rgba(255,255,255,0.08); border: 1px solid #333; border-radius: 8px; overflow: hidden; }
#potm-loading-bar { height: 100%; width: 0%; background: linear-gradient(90deg,#b8892b,#ffd23f); border-radius: 8px; transition: width .2s ease; }

/* ── Now-playing music banner ─────────────────────────────────────────────────── */
#music-banner {
  position: fixed; bottom: 16px; left: 16px; transform: translateY(12px);
  z-index: 130; display: flex; align-items: center; gap: 8px;
  background: #000; border: 2px solid #ffd23f; border-radius: 8px;
  padding: 8px 16px; max-width: 90vw;
  font-family: 'Minecraft', monospace; color: #ffd23f;
  box-shadow: 0 4px 18px rgba(0,0,0,0.7);
  opacity: 0; pointer-events: none;
  transition: opacity .35s ease, transform .35s ease;
}
#music-banner.hidden { display: none; }
#music-banner.show { opacity: 1; transform: translateY(0); }
#music-banner-note { font-size: 14px; }
#music-banner-title { font-size: 12px; letter-spacing: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Head-to-head: mini-profile positional row ──────────────────────────────── */
#mini-profile-h2h { margin-top: 10px; border-top: 1px solid #20202e; padding-top: 8px; }
.mp-h2h-title { font-size: 11px; color: #9ad; letter-spacing: 1px; margin-bottom: 4px; text-transform: uppercase; }
.mp-h2h-row { display: flex; justify-content: space-between; gap: 4px; font-size: 11px; }
.mp-h2h-hi { color: #3ad64a; } .mp-h2h-dr { color: #cbb35a; } .mp-h2h-lo { color: #ff7a7a; }
.mp-h2h-empty { font-size: 11px; color: #888; }

/* ── Head-to-head: opponents list in the profile ────────────────────────────── */
#h2h-opponents .pf-section {
  margin: 4px 0 6px; font-size: 13px; color: #888;
  text-transform: uppercase; letter-spacing: 2px; border-bottom: 1px solid #222; padding-bottom: 4px;
}
.h2h-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.h2h-opp {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: #1a1a1a; border: 1px solid #333; border-radius: 8px; padding: 8px 12px;
  color: #fff; font-family: 'Minecraft', monospace; font-size: 14px; cursor: pointer; text-align: left;
}
.h2h-opp:hover { border-color: #6cf; background: #202030; }
.h2h-opp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h2h-opp-shared { color: #9ad; font-size: 12px; flex-shrink: 0; }

/* ── Head-to-head comparison card (chess.com-style) ─────────────────────────── */
#h2h-card-overlay {
  position: fixed; inset: 0; z-index: 260; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.8);
}
#h2h-card-overlay.hidden { display: none; }
#h2h-card {
  width: min(96vw, 560px); max-height: 90vh; overflow-y: auto;
  background: #14141b; border: 2px solid #3a3a4a; border-radius: 14px;
  font-family: 'Minecraft', monospace; color: #fff;
}
#h2h-card-head {
  position: relative; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 16px 18px; border-bottom: 1px solid #2a2a38; background: #1b1b24;
  border-radius: 12px 12px 0 0;
}
.h2h-side { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 120px; }
.h2h-side canvas { width: 56px; height: 56px; image-rendering: pixelated; background: rgba(255,255,255,0.05); border-radius: 8px; }
.h2h-side span { font-size: 13px; color: #ddd; max-width: 118px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#h2h-card-title { color: #cdd; font-size: 18px; letter-spacing: 1px; }
#h2h-card-close { position: absolute; top: 8px; right: 10px; background: transparent; border: none; color: #aaa; font-size: 18px; cursor: pointer; }
#h2h-card-close:hover { color: #fff; }
#h2h-card-rows { padding: 6px 0 14px; }
.h2h-row { display: flex; align-items: center; padding: 12px 18px; border-bottom: 1px solid #20202a; }
.h2h-val { width: 90px; font-size: 22px; font-weight: bold; }
.h2h-val-l { text-align: left; color: #7fd6ff; }
.h2h-val-r { text-align: right; color: #ffb27f; }
.h2h-mid { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.h2h-icon { font-size: 20px; }
.h2h-label { font-size: 13px; color: #cfcfcf; }
.h2h-note { font-size: 11px; color: #8a8; }
.h2h-shared { text-align: center; color: #888; font-size: 12px; padding: 12px 0 2px; }

/* ── 1vs1 Contract screen ─────────────────────────────────────────────────── */
#screen-contract { max-width: 720px; margin: 0 auto; }
.contract-scroll {
  max-height: 46vh; overflow-y: auto; text-align: left;
  background: #f5efe0; color: #2a2418;
  border: 3px solid #b9a06a; border-radius: 8px;
  padding: 18px 22px; margin: 10px 0 16px;
  font-family: 'Georgia', 'Times New Roman', serif; line-height: 1.5;
  box-shadow: inset 0 0 40px rgba(120,90,30,0.15);
}
.contract-scroll h3 { margin: 14px 0 4px; font-size: 16px; color: #5a3d12; }
.contract-scroll h3:first-child { margin-top: 0; }
.contract-scroll p { margin: 0 0 6px; font-size: 14px; }
.contract-form { text-align: center; }
.contract-duration-row {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 14px; font-family: 'Minecraft', monospace; font-size: 13px;
}
.contract-duration-row input {
  width: 90px; padding: 8px; font-size: 15px; text-align: center;
  border-radius: 6px; border: 2px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.35); color: #fff;
}
.contract-locked-badge { color: #ffbb55; font-size: 12px; }
.contract-sign-row {
  display: flex; align-items: flex-end; justify-content: center; gap: 14px;
  flex-wrap: wrap; margin-bottom: 12px;
}
.contract-vs { font-size: 26px; padding-bottom: 20px; }
.contract-party { display: flex; flex-direction: column; gap: 6px; min-width: 220px; }
.contract-party-label { font-family: 'Minecraft', monospace; font-size: 12px; color: #ffdd33; }
.contract-party input {
  padding: 10px; font-size: 15px; border-radius: 6px;
  border: 2px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.35); color: #fff; text-align: center;
}
.contract-party input:disabled { opacity: 0.8; background: rgba(255,255,255,0.06); }
.contract-status { font-size: 12px; min-height: 16px; color: #7ed67e; font-family: 'Minecraft', monospace; }
.contract-hint { font-size: 12px; color: rgba(255,255,255,0.6); margin-bottom: 10px; font-style: italic; }
.contract-waiting { margin-top: 10px; color: #7ed67e; font-family: 'Minecraft', monospace; font-size: 13px; }
#contract-sign-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Penalty banner on the character-select screen. */
.cs-penalty-banner {
  background: linear-gradient(90deg, #7a1420, #b02a37);
  color: #fff; border: 2px solid #ff9aa6; border-radius: 8px;
  padding: 10px 16px; margin: 8px auto; max-width: 560px; text-align: center;
  font-family: 'Minecraft', monospace; font-size: 13px; line-height: 1.4;
}

/* 1vs1 result banner on the match-results overlay. */
#results-1v1-banner {
  max-width: 620px; margin: 0 auto 14px; text-align: center;
  background: linear-gradient(90deg, #6a1b22, #a5303c);
  color: #fff; border: 2px solid #ffb3bd; border-radius: 10px;
  padding: 12px 18px; font-family: 'Minecraft', monospace; font-size: 14px; line-height: 1.5;
}
#results-1v1-banner .ovo-saying { display: block; margin-top: 4px; color: #ffe08a; font-style: italic; }

/* ── In-game top bar + menu ───────────────────────────────────────────────── */
#game-topbar {
  display: grid;
  grid-template-columns: 1fr minmax(0, auto) 1fr;
  align-items: center;
  gap: 12px;
  height: 52px;
  padding: 0 14px;
  box-sizing: border-box;
  flex: 0 0 auto;
}
.gtb-side { position: relative; display: flex; align-items: center; }
#btn-game-menu {
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  color: #eaf2ff;
  background: rgba(20, 28, 48, 0.85);
  border: 1px solid rgba(120, 160, 255, 0.5);
  border-radius: 10px;
  box-shadow: none;
  cursor: pointer;
  margin: 0;
}
#btn-game-menu:hover { background: rgba(40, 55, 90, 0.95); }
#game-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 70;
  min-width: 250px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  background: rgba(14, 16, 30, 0.97);
  border: 1px solid rgba(120, 160, 255, 0.35);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
}
.game-menu-item {
  text-align: left;
  padding: 10px 12px;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #e6ebf5;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  box-shadow: none;
  cursor: pointer;
}
.game-menu-item:hover { background: rgba(255, 255, 255, 0.08); }
.game-menu-danger { color: #ff9a9a; }
.game-menu-item.armed {
  color: #fff;
  background: rgba(200, 40, 40, 0.35);
  border-color: rgba(255, 110, 110, 0.7);
}

/* ── Player cards (right column) ──────────────────────────────────────────── */
#player-cards { display: flex; flex-direction: column; gap: 8px; }
.pcard {
  --pc: #888;
  position: relative;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 10px 8px 12px;
  background: rgba(15, 15, 31, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-left: 4px solid var(--pc);
  border-radius: 10px;
  transition: opacity .25s, filter .25s;
}
.pcard.is-me {
  border-color: rgba(255, 210, 63, 0.6);
  border-left-color: var(--pc);
  box-shadow: 0 0 0 1px rgba(255, 210, 63, 0.25), 0 0 14px rgba(255, 210, 63, 0.15);
}
.pcard.is-dead { opacity: .55; }
.pcard.is-dead .pcard-face { filter: grayscale(1); }
.pcard.is-zombie .pcard-face { filter: hue-rotate(70deg) saturate(1.6); }
.pcard-face {
  width: 40px; height: 40px;
  flex: 0 0 40px;
  image-rendering: pixelated;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}
.pcard-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pcard-top { display: flex; align-items: center; gap: 6px; }
.pcard-name {
  flex: 1; min-width: 0;
  font-weight: 700; font-size: 14px; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pcard-you {
  display: none;
  font: bold 10px 'Minecraft', monospace;
  color: #1a1400; background: #ffd23f;
  padding: 2px 5px; border-radius: 5px;
}
.pcard.is-me .pcard-you { display: inline-block; }
.pcard-score {
  font-weight: 800; font-size: 13px; color: #ffd23f;
  white-space: nowrap;
}
.pcard-stats { display: flex; flex-wrap: wrap; gap: 2px 9px; font-size: 12px; color: #c6cbdb; }
.pcard-items:empty { display: none; }
.pcard-items { color: #ffe066; letter-spacing: 2px; }
.pcard-status { display: none; font-size: 11px; color: #a9b4d6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard.has-status .pcard-status { display: block; }

/* Narrower windows: arena on top, player cards in a row below it. */
@media (max-width: 1080px) {
  body:not(.touch-device) #game-area { flex-wrap: wrap; }
  body:not(.touch-device) #board-wrap { order: 1; flex-basis: 100%; }
  body:not(.touch-device) #game-right { order: 2; width: 100%; flex-basis: 100%; max-height: none; }
  body:not(.touch-device) #game-left { order: 3; width: auto; flex: 0 1 auto; flex-direction: row; align-items: flex-start; }
  body:not(.touch-device) #player-cards { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  body:not(.touch-device) .pcard { flex: 0 1 220px; }
  body:not(.touch-device) #event-log { max-width: 520px; margin: 0 auto; }
  body:not(.touch-device) #game { max-height: calc(100vh - 150px); max-height: calc(100dvh - 150px); }
}

/* Lobby button lives in the top bar flow now (was fixed and touched the cards). */
.gtb-right { justify-content: flex-end; }
#game-topbar #btn-lobby-list { position: static; }
.pcard-main { text-align: left; }
/* Left column never runs off-screen (test-mode items sit below the legend). */
#game-left {
  max-height: calc(100vh - 64px);
  max-height: calc(100dvh - 64px);
  overflow-y: auto;
  scrollbar-width: thin;
}
/* Emoji legend in two columns: half the height. */
#controls-panel #emoji-legend-rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 6px; }
#controls-panel .emoji-legend-row { min-width: 0; overflow: hidden; }
#controls-panel .emoji-legend-say { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* Test-mode items stretch to the left column instead of overflowing it. */
#game-left #test-panel { align-self: stretch; min-width: 0; }
#game-left .test-item-btn, #game-left .test-panel-title { width: 100%; box-sizing: border-box; margin: 0; overflow: hidden; text-overflow: ellipsis; }
/* Pin the top-bar columns so the Lobby button stays right even when the round
   info is taken out of the flow (touch layout). */
#game-topbar .gtb-side:first-child { grid-column: 1; }
#round-info { grid-column: 2; }
#game-topbar .gtb-right { grid-column: 3; }
/* Touch: compact player cards below the arena (where the score pills were). */
body.touch-device #game-right { flex: 0 0 100%; width: 100%; padding-bottom: 8px; }
body.touch-device .pcard { flex: 0 1 160px; padding: 4px 8px; gap: 6px; }
body.touch-device .pcard-face { width: 28px; height: 28px; flex-basis: 28px; }
body.touch-device .pcard-name { font-size: 12px; }
body.touch-device .pcard-stats { font-size: 11px; gap: 1px 6px; }
/* Touch: keep the cards in the free middle strip between the action buttons
   (left) and the joystick (right), as the old score pills were. */
body.touch-device #game-right { max-width: max(240px, calc(100vw - 2 * 200px)); margin: 0 auto; }
/* Touch: the bottom-left corner holds the action buttons → toast goes up top. */
body.touch-device #music-banner { bottom: auto; top: calc(max(4px, env(safe-area-inset-top)) + 46px); left: 50%; transform: translate(-50%, -8px); }
body.touch-device #music-banner.show { transform: translate(-50%, 0); }

/* ── Kill-streak banner over the arena ────────────────────────────────────── */
#board-wrap { position: relative; }
.streak-banner {
  position: absolute;
  left: 50%;
  top: 26%;
  transform: translate(-50%, -50%);
  z-index: 6;
  pointer-events: none;
  text-align: center;
  white-space: nowrap;
  animation: sbSlam 1.9s cubic-bezier(.2,.8,.3,1) forwards;
}
.streak-banner .sb-title {
  font: italic 900 clamp(30px, 7vh, 72px)/1 'Arial Black', 'Segoe UI Black', Impact, sans-serif;
  letter-spacing: 2px;
  background: var(--sb-grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  -webkit-text-stroke: 2px #1a0800;
  filter: drop-shadow(0 4px 0 rgba(0,0,0,.45)) drop-shadow(0 0 18px var(--sb-glow));
}
.streak-banner .sb-name {
  margin-top: 4px;
  font: bold clamp(13px, 2.2vh, 20px) 'Minecraft', monospace;
  color: #fff;
  text-shadow: 0 2px 0 #000, 0 0 8px rgba(0,0,0,.8);
}
.streak-banner.triple { --sb-grad: linear-gradient(180deg, #fffbd0 0%, #ffc02e 45%, #e2401a 100%); --sb-glow: rgba(255,140,30,.7); }
.streak-banner.mega   { --sb-grad: linear-gradient(180deg, #f2ffff 0%, #6fdcff 45%, #4a3dff 100%); --sb-glow: rgba(90,150,255,.75); }
@keyframes sbSlam {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(2.6) rotate(-8deg); }
  14%  { opacity: 1; transform: translate(-50%, -50%) scale(0.9) rotate(2deg); }
  22%  { transform: translate(-50%, -50%) scale(1.08) rotate(-1deg); }
  30%  { transform: translate(-50%, -50%) scale(1) rotate(0); }
  78%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -85%) scale(0.96); }
}
@media (prefers-reduced-motion: reduce) {
  .streak-banner { animation: sbFade 1.9s ease forwards; }
  @keyframes sbFade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
}
