@font-face {
  font-family: 'MasaoFree';
  src: url('../assets/fonts/MasaoFree.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
}

/* Tell the browser this page uses a dark colour scheme so UA form
   controls (inputs, selects, scrollbars) default to dark styling
   instead of white backgrounds. */
:root {
  color-scheme: dark;
}

/* Fallback for older Samsung Internet (< v14) and Chrome forced-dark-mode:
   those versions apply a filter at the element level which bypasses
   color-scheme. Counter it by explicitly resetting filters on SVG content. */
@media (prefers-color-scheme: dark) {
  svg,
  img {
    filter: none;
  }
  #arena-svg-container svg {
    filter: none;
  }
}

/* Prevent forced-color mode (Windows High Contrast, etc.)
   from recoloring SVG fills and strokes. */
svg {
  forced-color-adjust: none;
}

.room-join-btn--full {
  background: #555;
  cursor: not-allowed;
  opacity: 0.7;
  position: relative;
}
.room-join-btn--full:hover::after {
  content: 'Lobby is full';
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 30, 40, 0.97);
  color: #bbb;
  font-size: 0.68rem;
  font-weight: 500;
  padding: 0.18rem 0.5rem;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 1;
  z-index: 20;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  border: 1px solid #222;
}
/* ==============================
   Global Reset & Layout
   ============================== */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'MasaoFree', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #1a1a2e;
  color: #eee;
}

/* scale down default sizing by 10% since font feels large */
html {
  font-size: 90%;
}

/* ensure all form controls and buttons inherit the global font and
   match the dark theme so browsers never inject white UA backgrounds */
button,
input,
select,
textarea,
.btn,
.mobile-pause-btn,
.overlay,
.overlay * {
  font-family: inherit;
}

input,
select,
textarea {
  background-color: transparent;
  color: inherit;
}

#app {
  width: 100%;
  height: 100%;
  position: relative;
}

/* ==============================
   Loading Overlay
   ============================== */

#loading-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  cursor: pointer;
}

#loading-darkness {
  position: fixed;
  inset: 0;
  background: #000000;
  z-index: -1;
  transition: opacity 1.2s ease-in-out;
}

#loading-overlay.preloading #loading-darkness {
  opacity: 1;
}

#loading-overlay.preloading #loading-text-container {
  opacity: 0;
  pointer-events: none;
}

#loading-text-container {
  transition: opacity 0.5s ease;
  pointer-events: none;
  z-index: 1;
}

#loading-overlay p {
  color: #ffffff;
  font-size: 2.5rem;
  font-weight: 500;
  text-align: center;
  user-select: none;
}

#loading-overlay.hidden #loading-darkness {
  opacity: 0;
  pointer-events: none;
}

#loading-overlay.hidden {
  pointer-events: none;
}

/* ==============================
   Screens
   ============================== */

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.5rem 0.5rem;
}

/* Spacer trick: push content to visual center when it fits,
   but always allow scrolling from the very top */
.screen::before,
.screen::after {
  content: '';
  flex: 1 0 0px;
}

.screen.active {
  display: flex;
}

/* Game screen should NOT scroll — it has its own layout */
#game-screen {
  overflow: hidden;
  padding: 0;
}

#game-screen::before,
#game-screen::after {
  display: none;
}

/* Lobby screen */
#lobby-screen {
  padding: 1rem 0.5rem;
}

/* ==============================
   Title
   ============================== */

.title {
  font-size: clamp(1.4rem, 6vw, 3rem);
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 0.6rem;
  flex-shrink: 0;
  background: linear-gradient(135deg, #e74c3c, #f39c12);
  background-clip: border-box;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: clamp(0.7rem, 2.5vw, 1rem);
  color: #888;
  margin-bottom: 1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* ==============================
   Buttons
   ============================== */

.btn {
  padding: 0.6rem 1.4rem;
  min-height: 44px; /* minimum touch target */
  border: none;
  border-radius: 6px;
  background: #e74c3c;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition:
    background 0.15s,
    transform 0.15s;
  touch-action: manipulation; /* prevent 300ms tap delay */
}

.btn:hover {
  background: #c0392b;
  transform: scale(1.03);
}

.btn:disabled {
  background: #555;
  cursor: not-allowed;
}

.btn-menu {
  display: block;
  width: clamp(180px, 60vw, 280px);
  padding: 0.7rem 1.2rem;
  font-size: clamp(0.85rem, 3vw, 1.1rem);
  text-align: center;
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  border: 2px solid rgba(255, 255, 255, 0.1);
  transition:
    transform 0.15s,
    background 0.15s;
}

.btn-menu:hover {
  background: linear-gradient(135deg, #c0392b, #96281b);
  transform: scale(1.03);
}

.btn-start {
  margin-top: 1rem;
  font-size: 1.2rem;
  padding: 0.8rem 2rem;
  background: #2ecc71;
}

.btn-start:hover:not(:disabled) {
  background: #27ae60;
  transform: scale(1.03);
}

.room-join-btn--full {
  background: #555;
  cursor: not-allowed;
  opacity: 0.7;
}

.room-full-warning {
  text-align: center;
  color: #e74c3c;
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  background: none;
}

.btn-start:disabled {
  background: #555;
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-danger {
  background: #c0392b;
}

.btn-danger:hover {
  background: #96281b;
  transform: scale(1.03);
}

.btn-back {
  margin-top: 1rem;
  background: #555;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.btn-back:hover {
  background: #444;
  transform: scale(1.03);
}

/* ==============================
   Main Menu
   ============================== */

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

/* ==============================
   Instructions
   ============================== */

.instructions-content {
  max-width: min(450px, 92vw);
  width: 100%;
  margin-bottom: 1.5rem;
}

.instruction-item {
  padding: 0.7rem 1rem;
  margin: 0.4rem 0;
  background: #16213e;
  border-radius: 6px;
  border-left: 4px solid #e74c3c;
  font-size: 0.95rem;
}

.instruction-item strong {
  color: #f39c12;
}

/* ==============================
   Selection Grid (maps, characters)
   ============================== */

.select-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1.5rem;
  max-width: min(600px, 92vw);
}

.select-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: clamp(120px, 30vw, 160px);
  padding: 0.8rem;
  background: #16213e;
  border: 3px solid #333;
  border-radius: 10px;
  cursor: pointer;
  transition:
    transform 0.15s,
    border-color 0.15s,
    box-shadow 0.15s,
    background 0.15s;
}

.select-card:hover {
  transform: scale(1.05);
  border-color: #3498db;
  box-shadow: 0 0 15px rgba(52, 152, 219, 0.18);
  background: #1a2744;
}

.select-card.selected {
  border-color: #f39c12;
  box-shadow: 0 0 20px rgba(243, 156, 18, 0.4);
}

.select-card-preview {
  width: 100%;
  aspect-ratio: 21 / 9;
  background: #0a0f1a;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.select-card-preview img,
.select-card-preview svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.select-card-preview .placeholder-icon {
  font-size: 2rem;
  color: #555;
}

.select-card-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #ccc;
}

/* Character card preview: taller aspect for character SVGs */
#char-select-grid .select-card-preview {
  aspect-ratio: 3 / 4;
  background: #16213e;
}

#char-select-grid .select-card-preview svg {
  width: 80%;
  height: 80%;
  object-fit: contain;
}

/* ==============================
   Map Carousel
   ============================== */

.map-carousel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* Full-screen variant for single/local mode */
.map-carousel--full {
  width: min(800px, 90vw);
}

.map-carousel--full .carousel-preview {
  width: 100%;
  aspect-ratio: 21 / 9;
  max-height: 50vh;
}

/* Lobby variant — stacked: preview on top, nav row below */
.map-carousel--lobby {
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
  max-width: 100%;
}

.map-carousel--lobby .carousel-center {
  width: 100%;
}

.map-carousel--lobby .carousel-preview {
  width: 100%;
  aspect-ratio: 21 / 9;
}

/* Arrow + label row below preview */
.carousel-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
}

.carousel-nav .carousel-label {
  margin-top: 0;
  width: 20ch;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.carousel-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.carousel-preview {
  background: #0a0f1a;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #333;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel-label {
  margin-top: 0.6rem;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #ccc;
}

.carousel-arrow {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid #444;
  background: #16213e;
  color: #ccc;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    border-color 0.15s,
    background 0.15s,
    transform 0.15s;
}
.carousel-arrow:hover {
  border-color: #e74c3c;
  background: #0f1828;
  transform: scale(1.1);
}
.carousel-arrow:disabled {
  opacity: 0.35;
  cursor: default;
  transform: none;
}

/* ==============================
   Color Palette
   ============================== */

.color-palette {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1.2rem;
}

.palette-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #888;
  margin-bottom: 0.6rem;
}

.color-swatches {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
}

.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid #333;
  cursor: pointer;
  transition:
    transform 0.15s,
    border-color 0.15s,
    box-shadow 0.15s,
    filter 0.15s;
}

.color-swatch:hover {
  transform: scale(1.15);
  border-color: #aaa;
  filter: brightness(0.9);
}

.color-swatch.selected {
  border-color: #fff;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.5);
  transform: scale(1.15);
}

.color-swatch.taken {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
  position: relative;
}
.color-swatch.taken::after {
  content: '✕';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
}

.btn-confirm {
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  margin-bottom: 0.5rem;
  min-width: 160px;
}

.btn-confirm:hover {
  background: linear-gradient(135deg, #27ae60, #1e8449);
  transform: scale(1.03);
}

.btn-confirm:disabled {
  background: #555;
  cursor: not-allowed;
  opacity: 0.6;
}

/* ==============================
   Multiplayer / Join Form
   ============================== */

.join-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  justify-content: center;
}

#name-input {
  padding: 0.6rem 1rem;
  min-height: 44px;
  border: 2px solid #444;
  border-radius: 6px;
  background: #16213e;
  color: #eee;
  font-size: 1rem;
  outline: none;
  width: clamp(200px, 70vw, 260px);
  text-align: center;
  touch-action: manipulation;
}

#name-input:-webkit-autofill,
#name-input:-webkit-autofill:hover,
#name-input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #16213e inset !important;
  -webkit-text-fill-color: #eee !important;
  transition: background-color 5000s ease-in-out 0s;
}

#name-input:focus {
  border-color: #e74c3c;
}

.status-text {
  margin-top: 1rem;
  color: #888;
  font-size: 0.9rem;
}

/* ==============================
   Create Lobby Screen  →  Combined MP Panel
   ============================== */

/* Split layout container */
.mp-split {
  display: flex;
  gap: 1.5rem;
  width: min(960px, 92vw);
  margin-bottom: 0.8rem;
  align-items: stretch;
  flex-shrink: 0;
}

.mp-panel {
  flex: 1;
  min-width: 0;
  background: rgba(22, 33, 62, 0.6);
  border: 2px solid #333;
  border-radius: 12px;
  padding: 0.8rem;
}

.mp-panel-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #f39c12;
  margin-bottom: 0.6rem;
  text-align: center;
}

/* Create panel */
.mp-create {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mp-create .create-lobby-form {
  width: 100%;
  max-width: 320px;
}

.mp-create .btn-confirm {
  width: 100%;
  margin-top: 0.5rem;
}

/* Browse panel */
.mp-browse {
  display: flex;
  flex-direction: column;
}

.mp-browse-toolbar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.room-search-field {
  flex: 1;
  padding: 0.5rem 0.8rem;
  min-height: 40px;
  border: 2px solid #444;
  border-radius: 8px;
  background: #16213e;
  color: #eee;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.room-search-field::placeholder {
  color: #666;
}

.room-search-field:focus {
  border-color: #3498db;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 8px;
}

.create-lobby-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

/* Mask PIN digits without using type="password" (avoids browser autofill) */
#lobby-pin-input,
#pin-prompt-input {
  -webkit-text-security: disc;
  text-security: disc;
}

#lobby-pin-input {
  margin-top: 0.3rem;
}

.lobby-name-field {
  width: 100%;
  padding: 0.6rem 1rem;
  min-height: 44px;
  border: 2px solid #444;
  border-radius: 10px;
  background: #16213e;
  color: #eee;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  outline: none;
  text-align: center;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

/* Override browser autofill background (Chrome / Edge / Safari) */
.lobby-name-field:-webkit-autofill,
.lobby-name-field:-webkit-autofill:hover,
.lobby-name-field:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #16213e inset !important;
  -webkit-text-fill-color: #eee !important;
  transition: background-color 5000s ease-in-out 0s;
}

.lobby-name-field::placeholder {
  color: #666;
  font-weight: 400;
}

.lobby-name-field:focus {
  border-color: #3498db;
  box-shadow: 0 0 12px rgba(52, 152, 219, 0.3);
}

.field-error {
  font-size: 0.8rem;
  color: #e74c3c;
  min-height: 1.2rem;
  text-align: center;
}

/* Lobby name displayed in lobby header */
.lobby-header-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 0.3rem;
}

.lobby-header-row .title {
  margin-bottom: 0;
}

.lobby-header-sep {
  color: #aaa;
  font-size: clamp(1.2rem, 5vw, 2.6rem);
  font-weight: 300;
}

.lobby-name-title {
  font-size: clamp(1.4rem, 6vw, 3rem);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  max-width: 15ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: linear-gradient(135deg, #e74c3c, #f39c12);
  background-clip: border-box;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ==============================
   Room Browser (inside panel)
   ============================== */

.room-list {
  width: 100%;
  max-height: 40vh;
  overflow-y: auto;
  margin-bottom: 0.5rem;
}

.room-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  margin: 0.4rem 0;
  background: #16213e;
  border-radius: 6px;
  border: 2px solid #333;
  transition:
    border-color 0.15s,
    background 0.15s;
}

.room-item:hover {
  border-color: #3498db;
  background: #1a2744;
}

.room-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.room-host {
  font-weight: 700;
  font-size: 1rem;
}

.room-players {
  font-size: 0.8rem;
  color: #888;
}

.room-join-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.room-lock-icon {
  font-size: 1.1rem;
  color: #f39c12;
  opacity: 0.9;
  cursor: default;
}

.room-join-btn {
  padding: 0.4rem 1rem;
  border: none;
  border-radius: 4px;
  background: #2ecc71;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.85rem;
  text-transform: uppercase;
  transition: background 0.15s;
}

.room-join-btn:hover {
  background: #27ae60;
}

.no-rooms {
  text-align: center;
  color: #666;
  padding: 2rem;
  font-size: 0.95rem;
}

/* Pagination */
.room-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding-top: 0.5rem;
}

.room-pagination button {
  padding: 0.3rem 0.6rem;
  min-width: 32px;
  border: 1px solid #444;
  border-radius: 4px;
  background: #16213e;
  color: #ccc;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.room-pagination button:hover {
  border-color: #e74c3c;
  background: #1a2744;
}

.room-pagination button.active {
  background: #e74c3c;
  border-color: #e74c3c;
  color: #fff;
}

.room-pagination button:disabled {
  opacity: 0.35;
  cursor: default;
}

/* Responsive: stack on narrow screens */
@media (max-width: 640px) {
  .mp-split {
    flex-direction: column;
    gap: 1rem;
  }

  .screen {
    padding: 1rem 0.4rem;
  }

  .title {
    font-size: clamp(1.1rem, 5vw, 2rem);
    letter-spacing: 0.08em;
  }

  .subtitle {
    font-size: clamp(0.6rem, 2vw, 0.85rem);
  }

  .mp-panel {
    padding: 0.6rem;
  }
}

/* ==============================
   Lobby (In-Room) — Card Layout
   ============================== */

/* Horizontal player cards row — always 4 slots */
.lobby-cards {
  display: flex;
  gap: 1rem;
  justify-content: center;
  width: min(980px, 94vw);
  margin-bottom: 0.8rem;
}

/* Individual player card */
.lobby-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 0;
  min-width: 0;
  max-width: 240px;
  padding: 0.8rem 0.6rem 0.7rem;
  background: rgba(22, 33, 62, 0.85);
  border: 2px solid #333;
  border-radius: 12px;
  position: relative;
  transition: border-color 0.2s;
}

.lobby-card--me {
  border-color: #555;
}

.lobby-card--me:hover {
  border-color: #f39c12;
}

/* Empty slot */
.lobby-card--empty {
  border-style: dashed;
  border-color: #2a2a3a;
  background: rgba(15, 22, 42, 0.5);
}

.lobby-card-empty-icon {
  font-size: 2.5rem;
  color: #333;
  line-height: 1;
}

.lobby-card-name--empty {
  color: #444;
  font-style: italic;
}

/* ---- Bot badge (top-left corner of card) ---- */
.bot-badge {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 0.72rem;
  background: #636e72;
  color: #fff;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  z-index: 5;
}

/* ---- Remove button (× on filled card) ---- */
.lobby-card-remove-btn {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: 2px solid #c0392b;
  border-radius: 50%;
  background: rgba(150, 40, 40, 0.8);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s,
    border-color 0.2s,
    box-shadow 0.2s;
  z-index: 10;
}

.lobby-card-remove-btn:hover {
  background: rgba(231, 76, 60, 0.95);
  border-color: #e74c3c;
  box-shadow: 0 0 8px rgba(231, 76, 60, 0.6);
  transform: scale(1.1);
}

/* ---- Two-button stacked empty card (local multiplayer) ---- */
.lobby-card--split {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  cursor: default;
  gap: 0;
}

.split-half {
  flex: 1;
  border: none;
  background: transparent;
  color: #555;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  transition:
    background 0.18s,
    color 0.18s;
  width: 100%;
  padding: 0;
}

.split-half--human:hover {
  background: rgba(52, 152, 219, 0.18);
  color: #ccc;
}

.split-half--bot:hover {
  background: rgba(99, 110, 114, 0.22);
  color: #ccc;
}

.split-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.split-icon img {
  width: 3rem;
  height: 3rem;
  display: block;
  opacity: 0.6;
  transition: opacity 0.18s;
}

.split-half:hover .split-icon img {
  opacity: 1;
}

.split-label {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.split-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
  width: 100%;
}

/* Character avatar area — clickable on own card */
.lobby-card-avatar {
  width: 100%;
  max-width: 120px;
  aspect-ratio: 3 / 4;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
  position: relative;
}

.lobby-card--me .lobby-card-avatar {
  cursor: pointer;
}

/* Clickable avatar for editable cards (bots in local/online-host) */
.lobby-card-avatar--editable {
  cursor: pointer;
}

.lobby-card-avatar svg {
  width: 100%;
  height: 100%;
}

/* Pencil-icon hint shown on own card avatar */
.lobby-card-edit-hint {
  position: absolute;
  bottom: 0px;
  right: -4px;
  font-size: 0.78rem;
  background: rgba(0, 0, 0, 0.7);
  color: #f39c12;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition:
    transform 120ms ease,
    right 120ms ease;
}

/* Slight scale and pop when avatar is hovered for editable avatars */
.lobby-card-avatar--editable:hover .lobby-card-edit-hint {
  transform: scale(1.12);
  right: -2px;
}

/* Host badge at top-left of card */
.lobby-card .host-badge {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 0.72rem;
  background: #f39c12;
  color: #000;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-weight: 700;
  text-transform: uppercase;
  z-index: 5;
}

/* Name area */
.lobby-card-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #eee;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 0.1rem;
}

/* Difficulty stars row in bot lobby card */
.bot-difficulty-stars {
  display: flex;
  gap: 2px;
  margin-bottom: 0.3rem;
  line-height: 1;
}

.bot-diff-star {
  font-size: 0.95rem;
  line-height: 1;
  transition:
    transform 0.1s,
    color 0.1s;
}

.bot-diff-star--filled {
  color: #f1c40f;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.bot-diff-star--empty {
  color: #555;
}

/* Clickable stars (when host or local) */
[data-action='set-bot-difficulty'] {
  cursor: pointer;
  pointer-events: all;
}

[data-action='set-bot-difficulty']:hover {
  transform: scale(1.3);
  color: #f39c12;
}

/* Inline name input on own card */
.lobby-card .player-name-input {
  width: 100%;
  max-width: 16ch;
  padding: 0.2rem 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid #444;
  border-radius: 5px;
  background: #1a1a2e;
  color: #eee;
  outline: none;
  text-align: center;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.lobby-card .player-name-input:focus {
  border-color: #3498db;
}

/* Wrapper so the error floats below the input without expanding the card */
.player-name-wrap {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 0.15rem;
}

.player-name-error {
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  color: #e74c3c;
  white-space: nowrap;
  z-index: 20;
  pointer-events: none;
  line-height: 1.2;
}

.player-name-error:empty {
  display: none;
}

/* Ready badge — positioned at top-left corner of card */
.lobby-card-ready-badge {
  position: absolute;
  top: 6px;
  left: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(150, 40, 40, 0.8);
  border: 2px solid #c0392b;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s,
    border-color 0.2s,
    box-shadow 0.3s;
  cursor: pointer;
  user-select: none;
}

.lobby-card-ready-badge:hover {
  transform: scale(1.1);
}

.lobby-card-ready-badge.is-ready {
  background: rgba(46, 204, 113, 0.9);
  border-color: #27ae60;
  box-shadow: 0 0 8px rgba(46, 204, 113, 0.5);
}

.lobby-card-ready-badge.is-ready:hover {
  box-shadow: 0 0 12px rgba(46, 204, 113, 0.8);
}

.ready-badge-icon {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

.lobby-card-ready-badge .ready-checkbox {
  display: none;
}

/* Tooltip on hover */
.lobby-card-ready-badge::after {
  content: attr(title);
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 10, 20, 0.92);
  color: #eee;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 15;
}

.lobby-card-ready-badge:hover::after {
  opacity: 1;
}

/* Map section (same width as 4 cards) */
.lobby-map-section {
  width: min(980px, 94vw);
  margin: 0 auto 0.6rem;
}

/* Lobby footer */
.lobby-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.lobby-footer-buttons {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.8rem;
  justify-content: center;
}

.lobby-footer-buttons .btn {
  min-width: 150px;
  padding: 0.6rem 1.2rem;
  font-size: 0.95rem;
  text-align: center;
  line-height: 1.2;
  box-sizing: border-box;
  margin-top: 0;
}

.lobby-footer-buttons .btn-start {
  margin-top: 0;
}

/* Tooltip wrapper for disabled Start Game button */
.start-btn-wrap {
  position: relative;
  display: inline-block;
}

.start-hint {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 10, 20, 0.92);
  color: #f39c12;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.3rem 0.7rem;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10;
}

.start-hint:empty {
  display: none;
}

.start-btn-wrap:hover .start-hint {
  opacity: 1;
}

/* ==============================
   PIN Prompt Modal
   ============================== */

.pin-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pin-modal {
  background: #0f1b2d;
  border: 2px solid #444;
  border-radius: 14px;
  width: min(420px, 90vw);
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.pin-modal-header {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid #333;
  text-align: center;
}

.pin-modal-lobby-name {
  font-size: clamp(1.2rem, 4vw, 1.6rem);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #e74c3c, #f39c12);
  background-clip: border-box;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
}

.pin-modal-body {
  padding: 1.5rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.pin-modal-buttons {
  display: flex;
  flex-direction: row;
  gap: 0.8rem;
  margin-top: 0.5rem;
  justify-content: center;
  align-items: center;
}

.pin-modal-buttons .btn {
  min-width: 120px;
  padding: 0.6rem 1.2rem;
  font-size: 0.95rem;
  text-align: center;
  line-height: 1.2;
  box-sizing: border-box;
  margin: 0;
}

/* ==============================
   Character Picker Modal
   ============================== */

.char-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.char-modal {
  background: #0f1b2d;
  border: 2px solid #444;
  border-radius: 14px;
  width: min(620px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.char-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid #333;
}

.char-modal-title {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #f39c12;
}

.char-modal-x {
  background: none;
  border: none;
  color: #888;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 0.2rem;
  transition: color 0.15s;
}

.char-modal-x:hover {
  color: #fff;
}

.char-modal-body {
  display: flex;
  gap: 1.2rem;
  padding: 1rem;
}

/* Big preview on the left */
.char-modal-preview {
  flex: 0 0 auto;
  width: clamp(120px, 24vw, 160px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.char-modal-preview-svg {
  width: 100%;
  aspect-ratio: 4 / 5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.char-modal-preview-svg svg {
  width: 100%;
  height: 100%;
}

/* Options on the right */
.char-modal-options {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 0;
}

.char-modal-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #888;
}

.char-modal-grid {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.char-modal-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 68px;
  padding: 0.35rem;
  background: #16213e;
  border: 2px solid #333;
  border-radius: 8px;
  cursor: pointer;
  transition:
    transform 0.12s,
    border-color 0.12s,
    background 0.12s;
}

.char-modal-card:hover {
  transform: scale(1.06);
  border-color: #e74c3c;
  background: #1a2744;
}

.char-modal-card.selected {
  border-color: #f39c12;
  box-shadow: 0 0 8px rgba(243, 156, 18, 0.3);
}

.char-modal-card .char-thumb {
  width: 44px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.char-modal-card .char-thumb svg {
  width: 100%;
  height: 100%;
}

.char-modal-card .char-name {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #ccc;
  margin-top: 0.15rem;
}

/* Color swatches inside modal — left-aligned */
.char-modal-options .color-swatches {
  gap: 0.5rem;
  justify-content: flex-start;
}

.char-modal-confirm {
  margin-top: 0.5rem;
  align-self: center;
}

/* Difficulty section in char-picker modal */
#char-modal-difficulty-section {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.char-modal-difficulty-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.char-modal-difficulty-btn {
  flex: 1;
  min-width: 0;
  padding: 0.3rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #16213e;
  border: 2px solid #333;
  border-radius: 7px;
  color: #bbb;
  cursor: pointer;
  transition:
    border-color 0.12s,
    color 0.12s,
    background 0.12s;
  white-space: nowrap;
}

.char-modal-difficulty-btn:hover {
  border-color: #e74c3c;
  color: #fff;
}

.char-modal-difficulty-btn--active {
  border-color: #f39c12;
  color: #f39c12;
  background: rgba(243, 156, 18, 0.1);
  box-shadow: 0 0 6px rgba(243, 156, 18, 0.25);
}

/* Mobile: stack modal body vertically */
@media (max-width: 520px) {
  .char-modal-body {
    flex-direction: column;
    align-items: center;
  }

  .char-modal-preview {
    width: clamp(100px, 40vw, 160px);
  }

  .char-modal {
    width: 96vw;
    max-height: 95vh;
  }
}

/* Mobile: compact lobby layout */
@media (max-width: 600px) {
  #lobby-screen {
    padding: 0.8rem 0.3rem;
  }

  /* Disable centering spacers on mobile — content starts at top */
  #lobby-screen::before,
  #lobby-screen::after {
    display: none;
  }

  .lobby-header-row {
    gap: 0.3rem;
    margin-bottom: 0.2rem;
  }

  .lobby-header-row .title {
    font-size: clamp(1rem, 5vw, 1.6rem);
  }

  .lobby-header-sep {
    font-size: clamp(0.9rem, 4vw, 1.4rem);
  }

  .lobby-name-title {
    font-size: clamp(1rem, 5vw, 1.6rem);
    max-width: 10ch;
  }

  .lobby-cards {
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 94vw;
  }

  .lobby-card {
    flex: 0 0 auto;
    width: clamp(100px, 42vw, 150px);
    padding: 0.4rem 0.35rem 0.35rem;
    border-radius: 8px;
  }

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

  /* In single/local modes, empty cards should still be visible */
  .lobby-card--empty.lobby-card--split,
  .lobby-card--empty[data-action='add-bot'] {
    display: flex;
  }

  .bot-badge {
    font-size: 0.6rem;
    top: 3px;
    left: 4px;
    padding: 0.05rem 0.2rem;
  }

  .host-badge {
    font-size: 0.6rem;
    top: 3px;
    left: 4px;
    padding: 0.05rem 0.2rem;
  }

  .lobby-card-remove-btn {
    width: 18px;
    height: 18px;
    font-size: 0.8rem;
    top: 3px;
    right: 4px;
  }

  .split-label {
    font-size: 0.5rem;
  }

  .lobby-card-avatar {
    width: 56px;
    height: 74px;
    max-width: none;
    aspect-ratio: auto;
    margin-bottom: 0.25rem;
  }

  .lobby-card-edit-hint {
    width: 16px;
    height: 16px;
    font-size: 0.55rem;
  }

  .lobby-card .host-badge {
    font-size: 0.5rem;
    top: 4px;
    right: 4px;
    padding: 0.05rem 0.2rem;
  }

  .lobby-card-ready-badge {
    width: 22px;
    height: 22px;
    top: 4px;
    left: 4px;
  }

  .lobby-card-remove-btn {
    width: 22px;
    height: 22px;
    top: 4px;
    right: 4px;
    font-size: 0.9rem;
  }

  .ready-badge-icon {
    font-size: 0.7rem;
  }

  .lobby-card-name {
    font-size: 0.72rem;
  }

  .lobby-card .player-name-input {
    font-size: 0.7rem;
    max-width: 11ch;
    padding: 0.15rem 0.3rem;
  }

  .player-name-error {
    font-size: 0.55rem;
  }

  .lobby-map-section {
    width: 94vw;
  }

  .map-carousel--lobby {
    max-width: 100%;
    gap: 0.2rem;
  }

  .carousel-nav {
    gap: 0.4rem;
  }

  .carousel-nav .carousel-label {
    width: 16ch;
    font-size: 0.8rem;
  }

  .carousel-nav .carousel-arrow {
    width: 36px;
    height: 36px;
    font-size: 1.3rem;
  }

  .lobby-footer-buttons {
    gap: 0.5rem;
  }

  .lobby-footer-buttons .btn {
    min-width: 110px;
    padding: 0.45rem 0.7rem;
    font-size: 0.8rem;
  }

  .start-hint {
    font-size: 0.6rem;
    padding: 0.2rem 0.5rem;
  }
}

/* ==============================
   HUD
   ============================== */

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  padding: 12px 20px;
  background: none;
  z-index: 20;
  pointer-events: none;
}

.hud-item {
  background: rgba(61, 26, 3, 0.6);
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: 700;
  font-size: clamp(0.7rem, 2.5vw, 1rem);
  line-height: 1;
  display: flex;
  align-items: center;
}

/* Debug constants menu shown in DEV: fixed left-center, vertical list (non-scrollable) */
/* Outer container for debug area; inner box holds content so toggles and constants
   share a single visual background. */
#debug-constants-menu {
  position: fixed;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0px;
  align-items: stretch;
  pointer-events: auto;
  padding: 0;
  font-size: clamp(0.5rem, 2vw, 0.88rem);
  width: min(26em, calc(100vw - 16px));
  max-height: min(80vh, calc(100vh - 40px));
  overflow: hidden;
  z-index: 60;
}

/* Draggable title bar */
.debug-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(40, 40, 40, 0.95);
  padding: 6px 10px;
  border-radius: 8px 8px 0 0;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
  font-weight: 800;
  font-size: 0.85em;
  color: #ffd166;
  letter-spacing: 0.05em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}
.debug-title-bar:active {
  cursor: grabbing;
}
.debug-title-bar .debug-close-btn {
  background: rgba(192, 57, 43, 0.8);
  border: none;
  color: #fff;
  font-size: 1em;
  width: 1.6em;
  height: 1.6em;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.debug-panel-content {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
}

.debug-menu-inner {
  background: rgba(20, 20, 20, 0.85);
  padding: 8px;
  border-radius: 0 0 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  box-sizing: border-box;
}

/* Collapsible sections */
.debug-section {
  margin-bottom: 2px;
}
.debug-section-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: rgba(50, 50, 50, 0.8);
  border-radius: 6px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  font-weight: 700;
  font-size: 0.85em;
  color: #aaa;
  transition: background 0.15s;
}
.debug-section-header:hover {
  background: rgba(70, 70, 70, 0.8);
}
.debug-section-header .chevron {
  transition: transform 0.2s;
  font-size: 0.7em;
}
.debug-section-header.collapsed .chevron {
  transform: rotate(-90deg);
}
.debug-section-body {
  padding: 4px 0;
}
.debug-section-body.collapsed {
  display: none;
}

/* Preset switcher row */
.debug-preset-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 5px 6px;
  margin-bottom: 2px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
}
.debug-preset-btn {
  padding: 0.2em 0.55em;
  border: 1px solid #555;
  border-radius: 4px;
  background: #333;
  color: #ddd;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}
.debug-preset-btn:hover {
  background: #555;
  border-color: #888;
}
.debug-preset-btn:active {
  background: #222;
}
.debug-preset-label {
  flex: 1;
  text-align: center;
  font-size: 0.88em;
  font-weight: 700;
  color: #7ecfff;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  min-width: 4em;
}

/* Step size selector row */
.debug-step-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  font-size: 0.8em;
  color: #aaa;
  margin-bottom: 4px;
}
.debug-step-btn {
  padding: 0.15em 0.5em;
  border: 1px solid #555;
  border-radius: 4px;
  background: #333;
  color: #ddd;
  cursor: pointer;
  font-size: 0.85em;
  font-weight: 600;
}
.debug-step-btn.active {
  background: #e74c3c;
  border-color: #e74c3c;
  color: #fff;
}

/* Align items in a 4-column grid: name | dec | value | inc */
.debug-const-item {
  display: grid;
  grid-template-columns: 1fr 2.6em minmax(4em, 6em) 2.6em;
  align-items: center;
  gap: 0.3em;
  font-size: 0.85em;
  color: #ffd166;
  background: rgba(10, 10, 10, 0.35);
  padding: 0.35em 0.45em;
  border-radius: 6px;
  box-sizing: border-box;
  overflow: visible;
  pointer-events: auto;
}

.debug-const-name {
  color: #ffd166;
  font-weight: 800;
  margin-right: 4px;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  font-size: 0.85em;
}

.debug-const-value {
  color: #fff;
  text-align: center;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Editable number input for constants */
.debug-const-input {
  width: 100%;
  background: rgba(30, 30, 30, 0.8);
  border: 1px solid #555;
  border-radius: 4px;
  color: #fff;
  text-align: center;
  font-size: 0.9em;
  font-weight: 700;
  padding: 3px 2px;
  box-sizing: border-box;
  -moz-appearance: textfield;
  appearance: textfield;
  outline: none;
}
.debug-const-input:focus {
  border-color: #e74c3c;
  background: rgba(50, 30, 30, 0.8);
}
.debug-const-input::-webkit-outer-spin-button,
.debug-const-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.debug-btn {
  pointer-events: auto;
  padding: 0.15em 0.3em;
  border-radius: 5px;
  background: rgba(231, 76, 60, 0.95);
  color: #fff;
  border: none;
  font-weight: 800;
  cursor: pointer;
  box-sizing: border-box;
  width: 2.6em;
  height: 2.1em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9em;
}

.debug-btn:active {
  transform: translateY(1px);
}

#scores-display {
  display: none;
}

/* ---- Ranking Table ---- */
.ranking-table {
  position: relative;
  background: rgba(10, 10, 10, 0.75);
  border-radius: 8px;
  padding: 0;
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  width: fit-content;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  overflow: visible;
}

/* Transparent click‑capture overlay — ensures the entire ranking table
   area is clickable regardless of inner table element quirks. */
.ranking-table::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  cursor: pointer;
}

.ranking-body {
  padding: 2px 0;
  overflow: visible;
  font-size: clamp(0.6rem, 1.8vw, 0.8rem);
}

/* Real HTML table — columns always aligned */
.ranking-tbl {
  border-collapse: collapse;
  table-layout: auto;
}

/* Round columns: hidden by default, shown in expanded */
.round-col {
  display: none;
  text-align: center;
  font-size: 0.85em;
  color: #bbb;
  white-space: nowrap;
  padding: 2px 4px;
}

.ranking-table.expanded .round-col {
  display: table-cell;
}

.ranking-hint {
  text-align: center;
  font-size: 0.55em;
  color: rgba(255, 255, 255, 0.4);
  padding: 1px 6px 2px;
  line-height: 1;
  letter-spacing: 0.03em;
}

.ranking-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
  font-weight: 700;
  font-size: clamp(0.65rem, 2vw, 0.85rem);
  color: #ffd166;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

/* Table header cells */
.ranking-tbl thead th {
  padding: 2px 4px;
  font-weight: 600;
  color: #aaa;
  text-align: center;
  font-size: 0.9em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ranking-tbl thead .name-col {
  text-align: left;
}

.ranking-row {
  transition: opacity 0.3s ease;
}

.ranking-row td {
  padding: 3px 4px;
  color: #eee;
  white-space: nowrap;
}

.ranking-eliminated {
  opacity: 0.4;
}

.ranking-eliminated td {
  text-decoration: line-through;
  text-decoration-color: rgba(255, 255, 255, 0.3);
}

.rank-col {
  text-align: center;
  color: #888;
  font-weight: 700;
}

.name-col {
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}

.rank-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
  vertical-align: middle;
}

.tally-col {
  text-align: center;
  font-size: 0.95em;
}

/* ==============================
   Arena (SVG-based)
   ============================== */

#arena-wrapper {
  position: absolute;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
}

/* SVG map container */
#arena-svg-container {
  position: absolute;
  inset: 0;
}

#arena-svg-container svg {
  width: 100%;
  height: 100%;
}

/* Arena rings layer — g_arena group moved here at runtime, sits above players
   falling from the top half (z-index 5) but below normal players (15+) */
#arena-rings-container {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

#arena-rings-container svg {
  width: 100%;
  height: 100%;
}

/* Player layer sits on top of the SVG */
#player-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* SVG sector shaking animation */
@keyframes sector-shake {
  0%,
  100% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(-2px, 1px);
  }
  50% {
    transform: translate(2px, -1px);
  }
  75% {
    transform: translate(-1px, 2px);
  }
}

.sector-shaking {
  animation: sector-shake 0.1s infinite;
}

/* ==============================
   Player (Sumo Character)
   ============================== */

.player {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  transform-origin: center var(--player-origin-y, bottom);
}

.player.eliminated {
  opacity: 0.25;
  filter: grayscale(0.8);
}

/* Falling players use dynamic opacity, don't apply eliminated styling */
.player.falling {
  filter: none;
}

.player-sumo {
  width: 120px;
  height: 160px;
  position: relative;
}

.player-sumo svg {
  width: 100%;
  height: 100%;
  display: block;
}

.player-namestack {
  position: absolute;
  bottom: 100%; /* sits above the player sprite */
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  pointer-events: none;
  will-change: transform;
  backface-visibility: hidden;
  z-index: 10;
}

.player-name {
  white-space: nowrap;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
  padding-bottom: 2px;
  -webkit-font-smoothing: antialiased;
}

/* Difficulty stars shown above the bot name in-game */
.player-bot-stars {
  font-size: 0.72rem;
  color: #f1c40f;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  white-space: nowrap;
  line-height: 1;
  letter-spacing: 0.5px;
  order: -1; /* renders above .player-name in the flex column */
  margin-bottom: -1px;
}

/* DEV: coordinate label shown above the player name when debug GUI is enabled */
.player-coords {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.6rem;
  font-weight: 700;
  color: lime;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

/* ==============================
   Overlays
   ============================== */

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  background: rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

#countdown-text {
  font-size: clamp(3rem, 15vw, 6rem);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 30px rgba(231, 76, 60, 0.8);
  animation: pulse 0.5s ease-out;
}

@keyframes pulse {
  0% {
    transform: scale(1.5);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

#round-result-text {
  font-size: clamp(1.5rem, 6vw, 2.5rem);
  font-weight: 900;
  text-align: center;
  color: #f39c12;
  text-shadow: 0 0 20px rgba(243, 156, 18, 0.6);
}

.pause-content {
  text-align: center;
  pointer-events: auto;
}

.pause-content h2 {
  font-size: clamp(1.8rem, 7vw, 3rem);
  margin-bottom: 0.5rem;
}

.pause-content p {
  margin-bottom: 1.5rem;
  color: #aaa;
}

.pause-content .btn {
  display: block;
  width: 200px;
  margin: 0 auto 0.6rem;
}

.pause-content .btn:last-child {
  margin-bottom: 0;
}

/* ==============================
   Notifications
   ============================== */

#notification-area {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
}

/* Duplicate removed — keep only the first .debug-const-item rule */
.debug-const-item-dup-removed {
  align-items: center;
  gap: 0.3em;
}

.debug-toggle {
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  padding: 0.4em 0.6em;
  border: none;
  border-radius: 6px;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  background: #444;
  font-size: 0.85em;
}
.debug-toggle.toggle-on {
  background: #27ae60; /* green */
}
.debug-toggle.toggle-off {
  background: #c0392b; /* red */
}
.debug-toggle:focus {
  outline: none;
}

/* Reset-to-defaults button */
.debug-reset-btn {
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  padding: 6px 8px;
  margin-top: 4px;
  border: 1px dashed #666;
  border-radius: 6px;
  color: #ccc;
  font-weight: 600;
  cursor: pointer;
  background: rgba(60, 60, 60, 0.6);
  font-size: 0.8em;
  transition: background 0.15s;
}
.debug-reset-btn:hover {
  background: rgba(80, 80, 80, 0.8);
}

/* Player slot config */
.debug-player-slot {
  display: grid;
  grid-template-columns: 2em 1fr 4.5em;
  align-items: center;
  gap: 0.4em;
  padding: 0.3em 0.45em;
  background: rgba(10, 10, 10, 0.35);
  border-radius: 6px;
  font-size: 0.85em;
}
.debug-player-slot .slot-label {
  font-weight: 800;
  color: #ffd166;
}
.debug-player-slot .slot-name {
  color: #ccc;
  font-size: 0.9em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.debug-player-select {
  padding: 0.2em 0.3em;
  background: #2a2a2a;
  border: 1px solid #555;
  border-radius: 4px;
  color: #fff;
  font-size: 0.85em;
  cursor: pointer;
  outline: none;
}
.debug-player-select:focus {
  border-color: #e74c3c;
}

/* Small-screen scaling for debug panel */
@media (max-height: 450px) {
  #debug-constants-menu {
    top: 4px;
    transform: none;
    max-height: calc(100vh - 8px);
  }
}
@media (max-width: 500px) {
  #debug-constants-menu {
    left: 4px;
    width: calc(100vw - 8px);
  }
}

/* Player debug labels */
.player-coords {
  position: absolute;
  top: -36px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.75rem;
  pointer-events: none;
}
.player-speed {
  position: absolute;
  top: -56px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(192, 57, 43, 0.9);
  color: #fff;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.75rem;
  pointer-events: none;
}

.notification {
  background: rgba(0, 0, 0, 0.7);
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 0.9rem;
  animation: fade-in-out 2.5s ease forwards;
}

@keyframes fade-in-out {
  0% {
    opacity: 0;
    transform: translateY(-10px);
  }
  15% {
    opacity: 1;
    transform: translateY(0);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* ==============================
   Match Result / Podium
   ============================== */

#podium-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 700px;
  margin: 1rem auto;
}

.podium-wrapper {
  width: 100%;
  position: relative;
}

.podium-svg-container {
  position: relative;
  width: 100%;
}

.podium-svg {
  width: 100%;
  height: auto;
  display: block;
}

.podium-character {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateX(-50%);
  pointer-events: none;
}

.podium-char-sprite {
  width: clamp(72px, 14.4vw, 126px);
  height: clamp(99px, 19.8vw, 160px);
  flex-shrink: 0;
}

.podium-char-sprite svg {
  width: 100%;
  height: 100%;
  display: block;
}

.podium-char-name {
  font-size: clamp(0.55rem, 1.5vw, 0.85rem);
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  text-align: center;
  white-space: nowrap;
  order: -1;
  margin-bottom: 2px;
}

/* ==============================
   Mobile / touch-specific
   ============================== */

/* Show/hide based on input type */
.mobile-only {
  display: none;
}
.desktop-only {
  display: block;
}

/* Hide local multiplayer entirely on touch devices */
@media (pointer: coarse) {
  #local-multiplayer-btn {
    display: none;
  }
  .mobile-only {
    display: block;
  }
  .desktop-only {
    display: none;
  }
}

/* ==============================
   Mobile Pause Button
   ============================== */

.mobile-pause-btn {
  display: flex;
  position: absolute;
  top: 10px;
  right: 14px;
  width: 44px;
  height: 44px;
  z-index: 20;
  background: rgba(0, 0, 0, 0.55);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 1.05rem;
  letter-spacing: 1px;
  cursor: pointer;
  pointer-events: auto;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

@media (pointer: coarse) {
  .mobile-pause-btn {
    display: flex;
  }
}

/* ==============================
   Touch joystick indicator
   ============================== */

.touch-ring {
  display: none;
  position: fixed;
  width: 72px;
  height: 72px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 200;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
}

.touch-ring.active {
  display: block;
}

.touch-dot {
  display: none;
  position: fixed;
  width: 26px;
  height: 26px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 200;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.touch-dot.active {
  display: block;
}

/* ==============================
   Landscape Hint
   ============================== */

#landscape-hint {
  background: rgba(26, 26, 46, 0.95);
  z-index: 9999;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  position: fixed;
  inset: 0;
  pointer-events: auto;
  width: 100%;
  height: 100%;
}

#landscape-hint .hint-content {
  background: rgba(0, 0, 0, 0.8);
  padding: 2rem;
  border-radius: 12px;
  border: 2px solid #e74c3c;
  max-width: 80%;
}

#landscape-hint .rotate-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: rotate-anim 2s infinite ease-in-out;
  display: inline-block;
}

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

#landscape-hint h2 {
  color: #e74c3c;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

#landscape-hint p {
  font-size: 1.1rem;
  color: #ddd;
}

/* Show landscape hint on portrait mobile devices */
@media (pointer: coarse) and (orientation: portrait) {
  #landscape-hint {
    display: flex;
  }
}

/* =============================================
   DEBUG MODE SETUP SCREEN
   ============================================= */

.btn-debug {
  background: linear-gradient(135deg, #8e44ad, #6c2fa0);
  border-color: #a660c8;
}

.btn-debug:hover {
  background: linear-gradient(135deg, #9b59b6, #7d3c98);
  border-color: #c280e0;
  transform: translateY(-2px);
}

/* ==============================
   Sudden Death / Overtime
   ============================== */

#sudden-death-overlay {
  z-index: 45;
}

#sudden-death-text {
  font-size: clamp(2rem, 10vw, 4rem);
  font-weight: 900;
  color: #e74c3c;
  text-shadow:
    0 0 30px rgba(231, 76, 60, 0.8),
    0 0 60px rgba(231, 76, 60, 0.4);
  letter-spacing: 0.15em;
  animation: sd-pulse 1s ease-in-out infinite;
}

@keyframes sd-pulse {
  0%,
  100% {
    opacity: 0.7;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
}

/* Camera shake applied to the arena wrapper during Sudden Death */
.camera-shake {
  animation: camera-shake 0.15s linear infinite;
}

@keyframes camera-shake {
  0% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(-3px, 2px);
  }
  50% {
    transform: translate(3px, -2px);
  }
  75% {
    transform: translate(-2px, -3px);
  }
  100% {
    transform: translate(2px, 3px);
  }
}

/* ==============================
   Volume Controls Overlay
   ============================== */

.volume-controls {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 0.5rem;
  background: transparent;
  padding: 0;
  z-index: 1000;
}

/* ---- Volume pill (collapsed = circle, expanded = tall pill) ---- */
.volume-pill {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 22px;
  background: rgba(32, 32, 38, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  overflow: hidden;
  transition:
    height 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    border-color 0.28s ease,
    box-shadow 0.28s ease;
  cursor: pointer;
}

.volume-pill:hover {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

/* Icon button at the bottom of the pill */
.volume-pill-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 0;
  z-index: 1;
}

.volume-pill-btn svg {
  width: 20px;
  height: 20px;
}

/* Slider area — clipped by overflow:hidden when collapsed */
.volume-pill-slider-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding-top: 8px;
  width: 100%;
  opacity: 0;
  transition: opacity 0.18s ease 0s;
  pointer-events: none;
}

/* Expanded state */
.volume-pill.sound-expanded {
  height: 152px;
  background: rgba(30, 30, 40, 0.97);
  border-color: rgba(102, 126, 234, 0.35);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.volume-pill.sound-expanded .volume-pill-slider-area {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.18s ease 0.12s;
}

/* Percentage label */
.volume-percentage {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.45);
  font-weight: 700;
  user-select: none;
  letter-spacing: 0.05em;
  line-height: 1;
}

/* Rotation wrapper — creates correct visual bounding box for rotated slider */
.slider-wrap {
  position: relative;
  width: 26px; /* pill width minus side padding */
  height: 72px; /* visual track length */
}

/* Horizontal slider rotated -90deg — thumb stays perfectly on track */
.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 72px; /* becomes visual height */
  height: 26px; /* becomes visual width = pill inner width */
  transform: translate(-50%, -50%) rotate(-90deg);
  border-radius: 13px;
  /* filled gradient: left = bottom when rotated (low volume), right = top (high volume) */
  background: linear-gradient(
    to right,
    #667eea var(--vol, 75%),
    rgba(255, 255, 255, 0.1) var(--vol, 75%)
  );
  outline: none;
  cursor: pointer;
  border: none;
}

/* Thumb — white disc sits on top of the colored fill */
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
  cursor: grab;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease;
  margin-top: 2px; /* centers thumb on 26px-high track (26-22=4, /2=2) */
}

.volume-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.1);
  box-shadow: 0 2px 10px rgba(102, 126, 234, 0.6);
}

/* Hide the webkit runnable track and let bg gradient do the styling */
.volume-slider::-webkit-slider-runnable-track {
  height: 26px;
  border-radius: 13px;
  background: transparent;
}

/* Firefox */
.volume-slider::-moz-range-track {
  height: 26px;
  border-radius: 13px;
  background: transparent;
}

.volume-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: none;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
  cursor: grab;
  transition: transform 0.12s ease;
}

.volume-slider::-moz-range-thumb:active {
  cursor: grabbing;
  transform: scale(1.1);
}

.volume-btn {
  background: rgba(28, 28, 32, 0.9);
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.03);
  color: #fff;
  padding: 0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.volume-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.volume-btn:active {
  transform: scale(0.95);
}

.volume-btn.muted {
  color: #e74c3c;
}

/* Fullscreen button styling */
#fullscreen-btn {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 22px;
  background: rgba(32, 32, 38, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#fullscreen-btn svg {
  width: 20px;
  height: 20px;
}

#fullscreen-btn:hover {
  background: rgba(40, 40, 48, 0.95);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

#fullscreen-btn:active {
  transform: scale(0.96);
}

/* Mobile and tablet adjustments */
@media (max-width: 1024px) {
  .volume-controls {
    bottom: 1rem;
    right: 1rem;
  }
}

/* ========== LOBBY → GAME BATTLE TRANSITION ========== */

/* Lobby elements fade-out */
.lobby-transition-fadeout {
  transition: opacity 0.4s ease-out;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* "STARTING BATTLE!" slam text */
.battle-start-text {
  position: fixed;
  left: 50%;
  top: 18%;
  transform: translate(-50%, -50%) scale(2.5);
  opacity: 0;
  font-size: clamp(1.8rem, 5vw, 3.5rem);
  font-weight: 900;
  color: #fff;
  text-shadow:
    0 0 30px rgba(255, 100, 50, 0.8),
    0 0 60px rgba(255, 50, 0, 0.4),
    0 4px 8px rgba(0, 0, 0, 0.7);
  letter-spacing: 0.15em;
  white-space: nowrap;
  z-index: 10010;
  pointer-events: none;
}

.battle-start-text.slam {
  transition:
    transform 0.3s cubic-bezier(0.22, 1.2, 0.36, 1),
    opacity 0.18s ease-out;
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.battle-start-text.fade-out {
  transition: opacity 0.35s ease-in;
  opacity: 0;
}

/* Map preview expansion overlay */
.map-expand-overlay {
  position: fixed;
  z-index: 10005;
  border-radius: 8px;
  overflow: hidden;
  pointer-events: none;
  will-change: transform, top, left, width, height, border-radius;
}

.map-expand-overlay img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.map-expand-overlay.expanding {
  transition:
    top 0.9s cubic-bezier(0.4, 0, 0.2, 1),
    left 0.9s cubic-bezier(0.4, 0, 0.2, 1),
    width 0.9s cubic-bezier(0.4, 0, 0.2, 1),
    height 0.9s cubic-bezier(0.4, 0, 0.2, 1),
    border-radius 0.9s cubic-bezier(0.4, 0, 0.2, 1);
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  border-radius: 0 !important;
}

.map-expand-overlay.fade-cross {
  transition: opacity 0.5s ease-in;
  opacity: 0;
}

/* Character drop-in animation — uses a wrapper translate offset
   that the game's renderFrame eventually overrides once the animation ends. */
@keyframes playerDropIn {
  0% {
    opacity: 0;
    filter: blur(2px);
    margin-top: -120px;
  }
  60% {
    opacity: 1;
    filter: blur(0);
    margin-top: 8px;
  }
  80% {
    margin-top: -4px;
  }
  100% {
    opacity: 1;
    filter: blur(0);
    margin-top: 0;
  }
}

.player-drop-in {
  animation: playerDropIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
