/* =====================================================================
   Bomberman DOM — WARM CHARCOAL style
   Amber/orange primary, sage green secondary on a warm charcoal base.
   Glass cards, animated grid floor, subtle glows, rounded shapes.
   This file *overrides* app.css completely — load it second.
   ===================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@500;700;800;900&family=Manrope:wght@400;500;700;800&family=JetBrains+Mono:wght@400;700&display=swap");

/* ──────────────────────────────────────────────────────────────────
   1. New core tokens — warm charcoal palette
   ────────────────────────────────────────────────────────────────── */
:root {
  /* surfaces */
  --bg:           #1c1917;
  --bg-mid:       #231e1a;
  --bg-elev:      #2c2520;
  --panel:        rgba(41, 37, 36, 0.96);
  --panel-alt:    rgba(52, 46, 44, 0.96);
  --inset:        rgba(28, 25, 23, 0.55);
  --inset-2:      rgba(28, 25, 23, 0.78);

  /* hairlines */
  --line:           rgba(214, 211, 209, 0.12);
  --line-2:         rgba(214, 211, 209, 0.22);
  --line-glow:      rgba(245, 158, 11, 0.45);

  /* primary = amber */
  --accent:         #f59e0b;
  --accent-2:       #d97706;
  --accent-on:      #1c1100;
  --accent-glow:    rgba(245, 158, 11, 0.45);

  /* secondary cool = sage green */
  --cool:           #4ade80;
  --cool-2:         #22c55e;
  --cool-glow:      rgba(74, 222, 128, 0.40);

  /* go/success = emerald */
  --go:             #34d399;
  --go-2:           #10b981;
  --go-on:          #022c22;
  --go-glow:        rgba(52, 211, 153, 0.40);

  /* spark / highlight = orange */
  --spark:          #fb923c;
  --spark-2:        #f97316;
  --spark-glow:     rgba(251, 146, 60, 0.50);

  /* danger */
  --danger:         #ef4444;
  --danger-2:       #f87171;
  --danger-bg:      rgba(127, 29, 29, 0.35);

  /* text */
  --text:           #fafaf9;
  --text-2:         #e7e5e4;
  --muted:          #a8a29e;
  --muted-2:        #78716c;

  /* player slots */
  --spawn-a:        #38bdf8;   /* sky blue */
  --spawn-b:        #fb923c;   /* orange   */
  --spawn-c:        #4ade80;   /* green    */
  --spawn-d:        #facc15;   /* yellow   */

  /* arena */
  --wall:           #57534e;
  --block:          #b45309;
  --floor:          rgba(214, 211, 209, 0.04);

  /* shadow / glow */
  --shadow:         0 22px 60px rgba(0, 0, 0, 0.45);
  --shadow-deep:    0 32px 80px rgba(0, 0, 0, 0.6);
  --glow-amber:     0 0 28px rgba(245, 158, 11, 0.30), 0 0 8px rgba(245, 158, 11, 0.50);
  --glow-green:     0 0 28px rgba(74, 222, 128, 0.25), 0 0 8px rgba(74, 222, 128, 0.40);
  --glow-emerald:   0 0 28px rgba(52, 211, 153, 0.25), 0 0 8px rgba(52, 211, 153, 0.40);

  /* radii — slightly bigger */
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --r-xl: 24px;
  --r-2xl: 28px;
  --r-pill: 999px;

  /* animation vars (driven by Animation Control) */
  --anim-bomb-bounce-ms:     900ms;
  --anim-bomb-spark-ms:      320ms;
  --anim-explosion-pulse-ms: 300ms;
  --anim-explosion-rotate-ms: 1400ms;
  --anim-gift-bob-ms:        1400ms;
  --anim-spawn-rotate-ms:    6000ms;
  --anim-player-pulse-ms:    1400ms;

  color-scheme: dark;
}

/* ──────────────────────────────────────────────────────────────────
   2. Base + background — animated grid floor
   ────────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  font-family: "Manrope", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

body {
  padding: 24px;
  background:
    radial-gradient(900px 600px at 12% -10%, rgba(245, 158, 11, 0.08), transparent 60%),
    radial-gradient(900px 600px at 100% 110%, rgba(74, 222, 128, 0.06), transparent 65%),
    radial-gradient(circle at 50% 50%, rgba(251, 146, 60, 0.03), transparent 70%),
    var(--bg);
}

/* Animated grid floor — pinned, low-z.
   Uses transform: translate for animation (GPU compositor thread, zero repaint cost). */
body::before {
  content: "";
  position: fixed;
  inset: -48px;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
  background-image:
    linear-gradient(to right, rgba(245, 158, 11, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(214, 211, 209, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.6;
  animation: gridDrift 16s linear infinite;
}
@keyframes gridDrift {
  0%   { transform: translate(0, 0); }
  100% { transform: translate(48px, 48px); }
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  gap: 22px;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

/* ──────────────────────────────────────────────────────────────────
   3. Typography
   ────────────────────────────────────────────────────────────────── */
.page-title, .topbar-title, h1, h2, h3 {
  font-family: "Outfit", "Manrope", sans-serif;
  letter-spacing: -0.01em;
}
.page-title {
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  font-weight: 800;
  margin: 0;
  background: linear-gradient(135deg, #fafaf9 0%, #fde68a 35%, #fb923c 70%, #f59e0b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 40px rgba(245, 158, 11, 0.18);
  line-height: 1.05;
}
.section-title {
  font-size: 1.2rem;
  font-weight: 800;
  margin: 0;
  color: var(--text);
}
.topbar-title {
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, #f59e0b, #fb923c 50%, #4ade80);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.topbar-subtitle, .feedback, .lead { color: var(--muted); }
.lead { font-size: 1.05rem; line-height: 1.55; margin: 0; }
.feedback { line-height: 1.45; margin: 0; font-size: .92rem; }
.feedback-error { color: #fecaca; background: rgba(127, 29, 29, 0.35); border: 1px solid rgba(248, 113, 113, 0.4); padding: 12px 14px; border-radius: var(--r-md); }
.feedback-warn  { color: #fde68a; background: rgba(120, 53, 15, 0.30); border: 1px solid rgba(245, 158, 11, 0.35); padding: 12px 14px; border-radius: var(--r-md); }
.label { font-weight: 700; color: var(--text); font-size: 0.92rem; }

.eyebrow {
  font-family: "Outfit", sans-serif;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-weight: 700;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-shadow: 0 0 16px var(--accent-glow);
}
.eyebrow::before {
  content: "";
  width: 22px; height: 2px; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), transparent);
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ──────────────────────────────────────────────────────────────────
   4. Panels & cards — glass with amber-glow border on hover
   ────────────────────────────────────────────────────────────────── */
.panel {
  position: relative;
  padding: 32px;
  border-radius: var(--r-2xl);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.04);
  display: grid;
  gap: 22px;
  overflow: hidden;
}
.panel::before {
  /* glow corner */
  content: "";
  position: absolute;
  top: -120px; right: -120px;
  width: 280px; height: 280px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.12), transparent 70%);
  pointer-events: none;
}

.notification-banner {
  padding: 16px 22px;
  border-radius: var(--r-lg);
  border: 1px solid rgba(74, 222, 128, 0.45);
  background:
    linear-gradient(90deg, rgba(74, 222, 128, 0.12), rgba(74, 222, 128, 0.04));
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--glow-green);
  animation: banner-slide 280ms cubic-bezier(.5,1.4,.6,1);
}
@keyframes banner-slide {
  from { transform: translateY(-8px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* metric card */
.metric-card, .lobby-metric-card {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 18px;
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--inset) 0%, rgba(28,25,23,0.55) 100%);
  border: 1px solid var(--line);
  overflow: hidden;
}
.metric-card:hover {
  border-color: var(--line-2);
  box-shadow: var(--shadow);
}
.metric-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
}
.metric-card:hover::before { opacity: 1; }
.metric-card-local {
  background: linear-gradient(180deg, rgba(74,222,128,0.12) 0%, rgba(28,25,23,0.78) 100%);
  border-color: rgba(74, 222, 128, 0.40);
  box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.20), 0 0 30px rgba(74, 222, 128, 0.14);
}
.metric-card-local::before { opacity: 1; background: linear-gradient(90deg, transparent, var(--go), transparent); }
.metric-label, .metric-label, .topbar-status-label {
  font-family: "Outfit", sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.lobby-metric-value, .metric-card strong, .metric-detail {
  font-family: "Outfit", "Manrope", sans-serif;
}
.lobby-metric-value {
  font-size: clamp(2rem, 3.2vw, 3rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}
.metric-detail { color: var(--muted); font-size: 0.88rem; line-height: 1.4; }
.metrics-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* config section */
.config-page-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
}
.config-page-shell > .config-tab-row {
  align-self: start;
  justify-self: start;
}
.config-page-shell > .panel {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.config-page-shell > .panel::-webkit-scrollbar { display: none; }
.config-section-card {
  padding: 22px;
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  background: var(--inset);
  display: grid; gap: 14px;
}

/* config field grid + field */
.config-field-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.config-field {
  display: grid; gap: 8px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: rgba(28, 25, 23, 0.55);
  border: 1px solid var(--line);
  overflow: hidden;
}
.config-field-desc { font-size: 0.78rem; }
.config-setup-shell {
  display: grid;
  grid-template-rows: auto auto;
  gap: 12px;
}
.config-setup-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  flex-wrap: wrap;
}
.config-setup-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.config-setup-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 16px;
}
.config-setup-sidebar {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
  border-radius: 22px;
  border: 1px solid rgba(214, 211, 209, 0.12);
  background:
    linear-gradient(180deg, rgba(74, 222, 128, 0.07), rgba(245, 158, 11, 0.05)),
    rgba(28, 25, 23, 0.68);
}
.config-setup-nav-button {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(214, 211, 209, 0.10);
  background: rgba(28, 25, 23, 0.62);
  color: var(--muted);
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}
.config-setup-nav-button:hover,
.config-setup-nav-button-active {
  color: var(--text);
  border-color: rgba(74, 222, 128, 0.34);
  background:
    linear-gradient(135deg, rgba(74, 222, 128, 0.13), rgba(245, 158, 11, 0.06)),
    rgba(28, 25, 23, 0.82);
  box-shadow: 0 0 18px rgba(74, 222, 128, 0.10);
}
.config-setup-nav-icon {
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9 1.8 15.5 5.5v7L9 16.2l-6.5-3.7v-7L9 1.8Zm0 2.3L4.5 6.7v4.6L9 13.9l4.5-2.6V6.7L9 4.1Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9 1.8 15.5 5.5v7L9 16.2l-6.5-3.7v-7L9 1.8Zm0 2.3L4.5 6.7v4.6L9 13.9l4.5-2.6V6.7L9 4.1Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
}
.config-setup-panel {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 12px;
}
.config-level-panel {
  min-width: 0;
}
.config-level-library-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Designer 3-column layout */
.level-config-layout {
  grid-template-columns: 220px minmax(260px, 1fr) minmax(260px, 1fr);
}
.config-setup-layout-designer {
  grid-template-columns: 230px 300px minmax(0, 1fr);
}
.designer-tools-panel {
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.designer-tools-panel::-webkit-scrollbar { display: none; }
.designer-tools-head {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: var(--r-xl);
  border: 1px solid rgba(214, 211, 209, 0.10);
  background: rgba(28, 25, 23, 0.55);
}
.designer-level-name-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.designer-grid-panel {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(214, 211, 209, 0.18) transparent;
  display: flex;
  align-items: flex-start;
  padding: 12px;
  border-radius: var(--r-xl);
  border: 1px solid rgba(214, 211, 209, 0.10);
  background: rgba(28, 25, 23, 0.40);
}

/* Override app.css grid rules so the designer grid never collapses to 1 column.
   The designer-grid-panel already has overflow:auto — the grid expands to max-content
   width and the panel scrolls. */
.level-designer-grid {
  display: grid;
  gap: 3px;
  padding: 10px;
  overflow: visible;
  width: max-content;
  background: rgba(2, 6, 23, 0.42);
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.16);
}
.level-designer-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 3px;
}
.level-designer-cell {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 5px;
  border: 1px solid rgba(214, 211, 209, 0.08);
  background: rgba(214, 211, 209, 0.04);
  color: rgba(231, 229, 228, 0.72);
  font-size: 0.62rem;
  line-height: 1;
  cursor: crosshair;
  user-select: none;
}
.level-designer-cell-wall {
  background: linear-gradient(180deg, #6b6460, #3f3a37);
  border-color: rgba(120, 113, 108, 0.56);
  color: #d6d3d1;
}
.level-designer-cell-block {
  background: linear-gradient(180deg, #a16207, #713f12);
  border-color: rgba(245, 158, 11, 0.42);
  color: #fde68a;
}
.level-designer-cell-floor {
  background: rgba(41, 37, 36, 0.48);
}
.level-designer-cell-protected {
  box-shadow: inset 0 0 0 2px rgba(56, 189, 248, 0.34);
}
.level-designer-cell-current-spawn {
  box-shadow: inset 0 0 0 2px rgba(74, 222, 128, 0.70), 0 0 12px rgba(74, 222, 128, 0.22);
}
.level-designer-cell-gifted {
  color: #fef3c7;
  box-shadow: inset 0 0 0 2px rgba(245, 158, 11, 0.48);
}
.level-designer-cell-gift-bomb       { color: #f97316; box-shadow: inset 0 0 0 2px #f97316; }
.level-designer-cell-gift-flame      { color: #f87171; box-shadow: inset 0 0 0 2px #f87171; }
.level-designer-cell-gift-speed      { color: #fde047; box-shadow: inset 0 0 0 2px #fde047; }
.level-designer-cell-gift-bomb_pass  { color: #38bdf8; box-shadow: inset 0 0 0 2px #38bdf8; }
.level-designer-cell-gift-block_pass { color: #86efac; box-shadow: inset 0 0 0 2px #86efac; }
.level-designer-cell-gift-one_up     { color: #fb7185; box-shadow: inset 0 0 0 2px #fb7185; }
.level-designer-cell:disabled {
  cursor: not-allowed;
}
.level-designer-cell:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(245, 158, 11, 0.62);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.16);
}
.level-preview-panel {
  min-width: 0;
  min-height: 0;
  align-self: start;
  justify-self: stretch;
  width: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  padding: 16px;
  border-radius: var(--r-xl);
  border: 1px solid rgba(214, 211, 209, 0.10);
  background: rgba(28, 25, 23, 0.48);
  overflow: hidden;
}
.level-preview-board-shell {
  width: 100%;
  overflow: auto;
}
/* Scale grid to fill panel width using CSS grid repeat */
.level-preview-panel .level-designer-grid {
  display: grid !important;
  grid-template-columns: repeat(var(--level-width, 15), 1fr);
  gap: 2px !important;
  width: 100%;
  padding: 8px !important;
}
.level-preview-panel .level-designer-row {
  display: contents;
}
.level-preview-panel .level-designer-cell {
  width: auto !important;
  height: auto !important;
  aspect-ratio: 1;
  font-size: clamp(0.4rem, calc(1.2 * (1 / var(--level-width, 15)) * 10vw), 0.7rem);
}
.level-middle-panel {
  min-width: 0;
  align-self: start;
}
.level-middle-section-head,
.level-generate-stack {
  display: grid;
  gap: 12px;
}
/* ── Autogen preset chips ─────────────────────────────────── */
.autogen-preset-row {
  display: flex;
  gap: 8px;
}
.autogen-preset-chip {
  flex: 1;
  padding: 7px 12px;
  background: var(--inset-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: rgba(214, 211, 209, 0.55);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 130ms ease, background 130ms ease, color 130ms ease;
  text-align: center;
}
.autogen-preset-chip:hover {
  border-color: var(--accent);
  background: rgba(245, 158, 11, 0.08);
  color: var(--accent);
}
.autogen-preset-chip-active {
  border-color: var(--accent) !important;
  background: rgba(245, 158, 11, 0.12) !important;
  color: var(--accent) !important;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

/* ── Autogen sliders ──────────────────────────────────────── */
.autogen-slider-value {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  text-shadow: 0 0 10px var(--accent-glow);
}
.autogen-slider-value-gift {
  color: var(--cool);
  text-shadow: 0 0 10px var(--cool-glow);
}
.autogen-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) var(--fill, 0%), rgba(28, 25, 23, 0.9) var(--fill, 0%));
  border: 1px solid rgba(245, 158, 11, 0.2);
  outline: none;
  cursor: pointer;
}
.autogen-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px; border-radius: 999px;
  background: var(--bg-elev);
  border: 2.5px solid var(--accent);
  box-shadow: 0 0 14px var(--accent-glow), 0 2px 4px rgba(0,0,0,0.5);
  cursor: pointer;
  transition: transform 100ms ease, box-shadow 100ms ease;
}
.autogen-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 20px var(--accent-glow), 0 2px 6px rgba(0,0,0,0.5);
}
.autogen-slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 999px;
  background: var(--bg-elev);
  border: 2.5px solid var(--accent);
  cursor: pointer;
}
.autogen-slider-gift {
  background: linear-gradient(90deg, var(--cool) var(--fill, 0%), rgba(28, 25, 23, 0.9) var(--fill, 0%));
  border-color: rgba(74, 222, 128, 0.22);
}
.autogen-slider-gift::-webkit-slider-thumb {
  border-color: var(--cool);
  box-shadow: 0 0 14px var(--cool-glow), 0 2px 4px rgba(0,0,0,0.5);
}
.autogen-slider-gift::-webkit-slider-thumb:hover {
  box-shadow: 0 0 20px var(--cool-glow), 0 2px 6px rgba(0,0,0,0.5);
}
.autogen-slider-gift::-moz-range-thumb { border-color: var(--cool); }

/* ── Autogen action row ───────────────────────────────────── */
.autogen-action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
}
.autogen-generate-btn {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
}
.autogen-util-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 130ms ease, border-color 130ms ease, color 130ms ease;
  white-space: nowrap;
  border: 1px solid transparent;
}
.autogen-util-btn-clear {
  background: rgba(245, 158, 11, 0.07);
  border-color: rgba(245, 158, 11, 0.22);
  color: rgba(245, 158, 11, 0.7);
}
.autogen-util-btn-clear:hover {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.45);
  color: var(--accent);
}
.autogen-util-btn-gifts {
  background: rgba(74, 222, 128, 0.06);
  border-color: rgba(74, 222, 128, 0.2);
  color: rgba(74, 222, 128, 0.65);
}
.autogen-util-btn-gifts:hover {
  background: rgba(74, 222, 128, 0.12);
  border-color: rgba(74, 222, 128, 0.4);
  color: var(--cool);
}

/* ── Arena preview legend ─────────────────────────────────── */
.preview-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.preview-legend-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 6px 8px;
}
.preview-legend-divider {
  height: 1px;
  background: var(--line);
}
.preview-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
}
.preview-legend-swatch {
  width: 22px !important;
  height: 22px !important;
  font-size: 0.6rem !important;
  border-radius: 4px !important;
  pointer-events: none;
  flex-shrink: 0;
  cursor: default !important;
  transform: none !important;
  line-height: 1 !important;
}
.preview-legend-label {
  font-size: 0.78rem;
  color: rgba(214, 211, 209, 0.65);
  white-space: nowrap;
  font-weight: 500;
}
.level-middle-section-head {
  padding-bottom: 4px;
}
.level-file-card {
  display: grid;
  gap: 14px;
  border-color: rgba(56, 189, 248, 0.14);
}
.level-file-identity-card {
  background:
    radial-gradient(circle at 12% 8%, rgba(56, 189, 248, 0.18), transparent 30%),
    linear-gradient(135deg, rgba(74, 222, 128, 0.07), rgba(245, 158, 11, 0.05)),
    rgba(28, 25, 23, 0.58);
}
.level-file-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}
.level-file-emblem {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(245, 158, 11, 0.22);
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.16), transparent 32%),
    linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(20, 184, 166, 0.16)),
    rgba(28, 25, 23, 0.72);
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.22);
}
.level-file-emblem-icon {
  width: 32px;
  height: 32px;
  background: url("data:image/svg+xml,%3Csvg width='32' height='32' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='5' y='6' width='22' height='20' rx='4' fill='%23292524' stroke='%23f59e0b' stroke-width='2'/%3E%3Cpath d='M10 11h4v4h-4v-4Zm8 0h4v4h-4v-4ZM10 19h4v4h-4v-4Zm8 0h4v4h-4v-4Z' fill='%23fff7ed'/%3E%3Cpath d='M14 11h4M14 21h4M10 15v4M22 15v4' stroke='%2314b8a6' stroke-width='2' stroke-linecap='round'/%3E%3Ccircle cx='10' cy='11' r='2' fill='%2338bdf8'/%3E%3Ccircle cx='22' cy='23' r='2' fill='%23ef4444'/%3E%3C/svg%3E") center / contain no-repeat;
}
.level-file-title-block {
  min-width: 0;
  display: grid;
  gap: 6px;
}
.level-file-title-block .section-title {
  overflow-wrap: anywhere;
}
.level-file-delete-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  border: 1px solid rgba(248, 113, 113, 0.28);
  color: #fecaca;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.16), transparent 34%),
    rgba(127, 29, 29, 0.30);
  box-shadow: 0 12px 24px rgba(127, 29, 29, 0.22);
  cursor: pointer;
}
.level-file-delete-btn:hover:not([disabled]) {
  border-color: rgba(248, 113, 113, 0.60);
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.20), transparent 34%),
    rgba(220, 38, 38, 0.42);
  color: #fff;
}
.level-file-delete-btn[disabled] {
  opacity: 0.42;
  cursor: not-allowed;
}
.level-icon-delete {
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 2h6l1 2h4v2H2V4h4l1-2Zm-2 6h10l-.7 9H5.7L5 8Zm3 2v5h1.5v-5H8Zm2.5 0v5H12v-5h-1.5Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 2h6l1 2h4v2H2V4h4l1-2Zm-2 6h10l-.7 9H5.7L5 8Zm3 2v5h1.5v-5H8Zm2.5 0v5H12v-5h-1.5Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* ── Preset size grid ─────────────────────────────────────── */
.level-file-card .preset-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  gap: 6px;
}
.preset-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 8px 4px 7px;
  background: var(--inset-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
  color: rgba(214, 211, 209, 0.6);
  min-width: 0;
}
.preset-card:hover {
  border-color: var(--accent);
  background: rgba(245, 158, 11, 0.08);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
  color: var(--accent);
}
.preset-card-active {
  border-color: var(--accent) !important;
  background: rgba(245, 158, 11, 0.12) !important;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.25) !important;
  color: var(--accent) !important;
}
.preset-thumb-svg { flex-shrink: 0; }
.preset-thumb-fill {
  fill: currentColor;
  opacity: 0.18;
}
.preset-thumb-stroke {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  opacity: 0.7;
}
.preset-card-active .preset-thumb-fill { opacity: 0.28; }
.preset-card-active .preset-thumb-stroke { opacity: 1; }
.preset-card-label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* ── Custom size separator ────────────────────────────────── */
.size-manual-separator {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0;
}
.size-manual-separator-line {
  flex: 1;
  height: 1px;
  background: var(--line);
}
.size-manual-separator-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.4);
  white-space: nowrap;
}

/* ── Custom size compound bar ─────────────────────────────── */
.size-bar {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  width: fit-content;
  margin: 0 auto;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--inset-2);
}
.size-bar > :first-child {
  border-radius: 9px 0 0 9px;
}
.size-bar > :last-child {
  border-radius: 0 9px 9px 0;
}
.size-bar-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  flex-shrink: 0;
}
.size-bar-cell + .size-bar-cell {
  border-left: 1px solid var(--line);
}
.size-bar-icon {
  color: rgba(148, 163, 184, 0.45);
  flex-shrink: 0;
}
.size-bar-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.5);
  flex-shrink: 0;
  cursor: default;
  user-select: none;
}
.size-bar-input {
  width: 48px;
  background: transparent;
  border: none;
  outline: none;
  color: rgba(214, 211, 209, 0.9);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.82rem;
  padding: 9px 0;
  -moz-appearance: textfield;
  flex-shrink: 0;
}
.size-bar-input::-webkit-outer-spin-button,
.size-bar-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.size-bar-sep {
  display: flex;
  align-items: center;
  padding: 0 2px;
  font-size: 0.9rem;
  font-weight: 700;
  color: rgba(148, 163, 184, 0.3);
  flex-shrink: 0;
  border-left: 1px solid var(--line);
  user-select: none;
}
.size-bar-apply {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border: none;
  border-left: 1px solid rgba(52, 211, 153, 0.4);
  background: rgba(52, 211, 153, 0.15);
  color: rgba(110, 231, 183, 0.95);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 130ms ease, color 130ms ease, border-color 130ms ease, box-shadow 130ms ease;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(110, 231, 183, 0.2);
}
.size-bar-apply:hover {
  background: rgba(52, 211, 153, 0.25);
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.8);
  box-shadow: inset 0 1px 0 rgba(110, 231, 183, 0.3), 0 4px 12px rgba(52, 211, 153, 0.25);
}
.size-bar-apply:active {
  background: rgba(52, 211, 153, 0.35);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}
.level-paint-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.level-tool-card {
  align-content: start;
}
.level-tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 10px;
}
.level-tool-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid rgba(214, 211, 209, 0.12);
  border-radius: 12px;
  background:
    radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.10), transparent 34%),
    rgba(28, 25, 23, 0.66);
  color: rgba(231, 229, 228, 0.76);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 10px 18px rgba(0, 0, 0, 0.16);
  cursor: pointer;
  transition: transform 0.16s, color 0.16s, border-color 0.16s, background 0.16s, box-shadow 0.16s;
}
.level-tool-button:hover {
  transform: translateY(-1px);
  color: #fff7ed;
  border-color: rgba(245, 158, 11, 0.52);
  background:
    radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.14), transparent 34%),
    rgba(245, 158, 11, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 14px 22px rgba(0, 0, 0, 0.22);
}
.level-tool-button-active {
  color: #111827;
  border-color: rgba(74, 222, 128, 0.70);
  background:
    radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.26), transparent 35%),
    linear-gradient(135deg, #86efac, #facc15);
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.16), 0 14px 24px rgba(0, 0, 0, 0.24);
}
.level-tool-button:disabled {
  opacity: 0.45;
  cursor: progress;
}
.level-tool-icon {
  width: 26px;
  height: 26px;
  background: transparent center / contain no-repeat;
  flex: none;
}
.level-tool-number {
  position: absolute;
  right: 7px;
  bottom: 6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(2, 6, 23, 0.72);
  color: #fef3c7;
  font: 700 0.68rem/1 "JetBrains Mono", ui-monospace, monospace;
}
.level-tool-wall {
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 5h18v14H3V5Zm2 2v3h5V7H5Zm7 0v3h7V7h-7ZM5 12v5h7v-5H5Zm9 0v5h5v-5h-5Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 5h18v14H3V5Zm2 2v3h5V7H5Zm7 0v3h7V7h-7ZM5 12v5h7v-5H5Zm9 0v5h5v-5h-5Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.level-tool-block {
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 4h12l3 5-9 11L3 9l3-5Zm1.2 2-1.6 2.7 6.4 7.9 6.4-7.9L16.8 6H7.2Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 4h12l3 5-9 11L3 9l3-5Zm1.2 2-1.6 2.7 6.4 7.9 6.4-7.9L16.8 6H7.2Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.level-tool-floor {
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 6h6v6H4V6Zm10 0h6v6h-6V6ZM4 14h6v4H4v-4Zm10 0h6v4h-6v-4Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 6h6v6H4V6Zm10 0h6v6h-6V6ZM4 14h6v4H4v-4Zm10 0h6v4h-6v-4Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.level-tool-paint {
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 3h12v6a5 5 0 0 1-4 4.9V22h-4v-8.1A5 5 0 0 1 6 9V3Zm2 2v4a3 3 0 1 0 6 0V5H8Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 3h12v6a5 5 0 0 1-4 4.9V22h-4v-8.1A5 5 0 0 1 6 9V3Zm2 2v4a3 3 0 1 0 6 0V5H8Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.level-tool-reset,
.level-tool-gift-regenerate,
.level-tool-corridors {
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M17.7 6.3A8 8 0 1 0 20 12h-2a6 6 0 1 1-1.8-4.3L13 11h8V3l-3.3 3.3Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M17.7 6.3A8 8 0 1 0 20 12h-2a6 6 0 1 1-1.8-4.3L13 11h8V3l-3.3 3.3Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.level-tool-clear,
.level-tool-gift-erase {
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 3h10l1 2h4v2H2V5h4l1-2Zm-2 6h14l-1 12H6L5 9Zm4 2v8h2v-8H9Zm4 0v8h2v-8h-2Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 3h10l1 2h4v2H2V5h4l1-2Zm-2 6h14l-1 12H6L5 9Zm4 2v8h2v-8H9Zm4 0v8h2v-8h-2Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.level-tool-gift-bomb {
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14 5h3l2-2 2 2-2 2v3h-2V8h-3V5ZM11 7a7 7 0 1 1 0 14 7 7 0 0 1 0-14Zm0 2a5 5 0 1 0 0 10 5 5 0 0 0 0-10Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14 5h3l2-2 2 2-2 2v3h-2V8h-3V5ZM11 7a7 7 0 1 1 0 14 7 7 0 0 1 0-14Zm0 2a5 5 0 1 0 0 10 5 5 0 0 0 0-10Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.level-tool-gift-flame {
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13 2c1 4-3 5-1 8 1-2 3-2 4-5 4 4 5 9 2 13a7 7 0 0 1-12-1c-2-5 2-8 5-12 0 4 1 5 2 5 1-2 0-4 0-8Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13 2c1 4-3 5-1 8 1-2 3-2 4-5 4 4 5 9 2 13a7 7 0 0 1-12-1c-2-5 2-8 5-12 0 4 1 5 2 5 1-2 0-4 0-8Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.level-tool-gift-speed {
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13 2 4 14h7l-1 8 10-13h-7l0-7Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13 2 4 14h7l-1 8 10-13h-7l0-7Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.level-tool-gift-bomb_pass {
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 12a8 8 0 1 1 16 0h-2a6 6 0 1 0-6 6v-3l5 4-5 4v-3a8 8 0 0 1-8-8Zm8-4a4 4 0 1 1 0 8 4 4 0 0 1 0-8Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 12a8 8 0 1 1 16 0h-2a6 6 0 1 0-6 6v-3l5 4-5 4v-3a8 8 0 0 1-8-8Zm8-4a4 4 0 1 1 0 8 4 4 0 0 1 0-8Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.level-tool-gift-block_pass {
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 5h16v14H4V5Zm2 2v4h5V7H6Zm7 0v4h5V7h-5ZM6 13v4h5v-4H6Zm7 0v4h5v-4h-5Zm-3-3 4 2-4 2v-4Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 5h16v14H4V5Zm2 2v4h5V7H6Zm7 0v4h5V7h-5ZM6 13v4h5v-4H6Zm7 0v4h5v-4h-5Zm-3-3 4 2-4 2v-4Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.level-tool-gift-one_up {
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 21C6 17 3 13.5 3 9a4.5 4.5 0 0 1 8-2.8A4.5 4.5 0 0 1 19 9c0 4.5-3 8-7 12Zm-1-12H8v2h3v3h2v-3h3V9h-3V6h-2v3Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 21C6 17 3 13.5 3 9a4.5 4.5 0 0 1 8-2.8A4.5 4.5 0 0 1 19 9c0 4.5-3 8-7 12Zm-1-12H8v2h3v3h2v-3h3V9h-3V6h-2v3Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.level-tool-block,
.level-tool-floor,
.level-tool-reset,
.level-tool-clear,
.level-tool-gift-bomb,
.level-tool-gift-flame,
.level-tool-gift-speed,
.level-tool-gift-bomb_pass,
.level-tool-gift-block_pass,
.level-tool-gift-one_up {
  -webkit-mask: none;
  mask: none;
}
.level-tool-block {
  background-image: url("data:image/svg+xml,%3Csvg width='30' height='30' viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='4' y='6' width='22' height='18' rx='3' fill='%23b45309'/%3E%3Cpath d='M4 12h22M4 18h22M11 6v6M19 12v6M11 18v6' stroke='%237c2d12' stroke-width='2'/%3E%3Cpath d='M7 8h6M16 14h7M7 20h6' stroke='%23fcd34d' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}
.level-tool-floor {
  background-image: url("data:image/svg+xml,%3Csvg width='30' height='30' viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='5' y='6' width='20' height='18' rx='3' fill='%233b3a35'/%3E%3Cpath d='M7 12h16M7 18h16M13 6v18M19 6v18' stroke='%2378716b' stroke-width='1.6'/%3E%3Ccircle cx='10' cy='10' r='1.3' fill='%23a8a29e'/%3E%3Ccircle cx='21' cy='20' r='1.2' fill='%23a8a29e'/%3E%3C/svg%3E");
}
.level-tool-reset {
  background-image: url("data:image/svg+xml,%3Csvg width='30' height='30' viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M23 9a10 10 0 1 0 2 6' fill='none' stroke='%2338bdf8' stroke-width='3' stroke-linecap='round'/%3E%3Cpath d='M21 4v7h-7' fill='none' stroke='%2386efac' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.level-tool-clear {
  background-image: url("data:image/svg+xml,%3Csvg width='30' height='30' viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 10h14l-1 14H9L8 10Z' fill='%23ef4444'/%3E%3Cpath d='M11 7h8l1 3H10l1-3Z' fill='%23fca5a5'/%3E%3Cpath d='M7 10h16M12 13v8M18 13v8' stroke='%237f1d1d' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}
.level-tool-gift-bomb {
  background-image: url("data:image/svg+xml,%3Csvg width='30' height='30' viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='13' cy='17' r='8' fill='%23111827'/%3E%3Ccircle cx='10' cy='14' r='2.4' fill='%236b7280'/%3E%3Cpath d='M18 9l3-3 3 3-3 3' fill='none' stroke='%23f97316' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M17 11h4' stroke='%23facc15' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}
.level-tool-gift-flame {
  background-image: url("data:image/svg+xml,%3Csvg width='30' height='30' viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16 3c2 6-4 7-1 12 1-3 4-4 5-8 6 6 5 17-5 19C7 24 6 16 12 9c0 4 2 6 4 6 1-4 0-7 0-12Z' fill='%23ef4444'/%3E%3Cpath d='M15 15c3 3 2 7-1 8-3-1-4-5-1-8 0 2 1 3 2 3v-3Z' fill='%23fde047'/%3E%3C/svg%3E");
}
.level-tool-gift-speed {
  background-image: url("data:image/svg+xml,%3Csvg width='30' height='30' viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M17 3 6 17h8l-2 10 12-16h-8l1-8Z' fill='%23facc15'/%3E%3Cpath d='M6 22h8' stroke='%2338bdf8' stroke-width='2.5' stroke-linecap='round'/%3E%3Cpath d='M4 18h5' stroke='%2386efac' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E");
}
.level-tool-gift-bomb_pass {
  background-image: url("data:image/svg+xml,%3Csvg width='30' height='30' viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='11' cy='17' r='6' fill='%23111827'/%3E%3Cpath d='M16 7h7v7' fill='none' stroke='%2386efac' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M22 8c-2 8-8 7-11 7' fill='none' stroke='%2338bdf8' stroke-width='3' stroke-linecap='round'/%3E%3Cpath d='M17 5l2-2 2 2' stroke='%23f97316' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}
.level-tool-gift-block_pass {
  background-image: url("data:image/svg+xml,%3Csvg width='30' height='30' viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='4' y='7' width='20' height='16' rx='3' fill='%23b45309'/%3E%3Cpath d='M4 15h20M11 7v8M17 15v8' stroke='%237c2d12' stroke-width='2'/%3E%3Cpath d='M11 20h13' stroke='%2386efac' stroke-width='3' stroke-linecap='round'/%3E%3Cpath d='M20 16l4 4-4 4' fill='none' stroke='%2386efac' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.level-tool-gift-one_up {
  background-image: url("data:image/svg+xml,%3Csvg width='30' height='30' viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M15 25C8 20 5 16 5 11a5 5 0 0 1 9-3 5 5 0 0 1 9 3c0 5-3 9-8 14Z' fill='%2322c55e'/%3E%3Cpath d='M14 10h3v4h4v3h-4v4h-3v-4h-4v-3h4v-4Z' fill='%23ecfccb'/%3E%3C/svg%3E");
}
.level-action-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.level-action-btn {
  width: 100%;
}
.level-action-btn-has-errors {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.4) !important;
  box-shadow: 0 0 10px rgba(248, 113, 113, 0.18);
}
.level-dialog-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}
.level-dialog-search {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-lg);
  border: 1px solid rgba(214, 211, 209, 0.10);
  background: rgba(28, 25, 23, 0.46);
}
.level-dialog-search .input {
  border: 0;
  background: transparent;
  padding: 6px 0;
}
.level-dialog-search-icon {
  width: 18px;
  height: 18px;
  background: #f59e0b;
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 2a6 6 0 1 0 3.7 10.7l3.3 3.3 1-1-3.3-3.3A6 6 0 0 0 8 2Zm0 2a4 4 0 1 1 0 8 4 4 0 0 1 0-8Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 2a6 6 0 1 0 3.7 10.7l3.3 3.3 1-1-3.3-3.3A6 6 0 0 0 8 2Zm0 2a4 4 0 1 1 0 8 4 4 0 0 1 0-8Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.level-save-target {
  margin: 0;
  padding: 12px;
  border-radius: var(--r-md);
  border: 1px solid rgba(245, 158, 11, 0.28);
  background: rgba(245, 158, 11, 0.08);
  color: #fde68a;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}
.level-save-validation-block {
  padding: 10px 14px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: 0.82rem;
}
.level-save-validation-block-error {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.28);
  color: rgba(252, 165, 165, 0.9);
}
.level-save-validation-block-warn {
  background: rgba(245, 158, 11, 0.07);
  border-color: rgba(245, 158, 11, 0.28);
  color: rgba(253, 230, 138, 0.9);
}
.level-save-validation-title {
  font-weight: 700;
  margin: 0 0 6px;
}
.level-save-validation-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1.5;
}
.level-save-validation-ok {
  margin: 0;
  font-size: 0.82rem;
  color: rgba(52, 211, 153, 0.85);
}
.level-delete-target {
  margin: 0;
  padding: 12px;
  border-radius: var(--r-md);
  border: 1px solid rgba(248, 113, 113, 0.34);
  background: rgba(127, 29, 29, 0.24);
  color: #fecaca;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}
.level-icon-new {
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 1h2v6h6v2H9v6H7V9H1V7h6V1Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 1h2v6h6v2H9v6H7V9H1V7h6V1Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.level-icon-open {
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1.5 4.5A1.5 1.5 0 0 1 3 3h3.2l1.3 1.5H13A1.5 1.5 0 0 1 14.5 6v6A1.5 1.5 0 0 1 13 13H3a1.5 1.5 0 0 1-1.5-1.5v-7ZM3 5v6.5h10V6H6.8L5.5 4.5H3Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1.5 4.5A1.5 1.5 0 0 1 3 3h3.2l1.3 1.5H13A1.5 1.5 0 0 1 14.5 6v6A1.5 1.5 0 0 1 13 13H3a1.5 1.5 0 0 1-1.5-1.5v-7ZM3 5v6.5h10V6H6.8L5.5 4.5H3Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.level-icon-save {
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 2h10.2L14 3.8V14H2V2Zm2 2v8h8V5.1L10.9 4H10v3H5V4H4Zm3 0v1.5h1.5V4H7Zm-1 6h4v2H6v-2Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 2h10.2L14 3.8V14H2V2Zm2 2v8h8V5.1L10.9 4H10v3H5V4H4Zm3 0v1.5h1.5V4H7Zm-1 6h4v2H6v-2Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

@media (max-width: 1180px) {
  .level-config-layout {
    grid-template-columns: 210px minmax(0, 1fr);
  }
  .level-preview-panel {
    grid-column: 2;
  }
}

@media (max-width: 840px) {
  .level-config-layout {
    grid-template-columns: 1fr;
  }
  .level-preview-panel {
    grid-column: auto;
  }
}

/* Create level row in sidebar */
.level-create-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}
.level-create-row .input { font-size: 0.88rem; padding: 10px 12px; }
.level-create-row .button { white-space: nowrap; }
.config-setup-active-card {
  overflow: hidden;
  align-content: start;
  border-color: rgba(74, 222, 128, 0.16);
  background:
    linear-gradient(135deg, rgba(74, 222, 128, 0.06), rgba(245, 158, 11, 0.04)),
    rgba(28, 25, 23, 0.58);
}
.config-setup-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.config-setup-field-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Compact icon action bar at top of sidebar */
.config-action-bar {
  display: flex;
  gap: 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(214, 211, 209, 0.10);
  margin-bottom: 2px;
}
.config-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid rgba(214, 211, 209, 0.12);
  background: rgba(28, 25, 23, 0.62);
  color: var(--muted);
  cursor: pointer;
  flex: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.config-icon-btn:hover {
  color: var(--text);
  border-color: rgba(245, 158, 11, 0.40);
  background: rgba(245, 158, 11, 0.08);
}
.config-icon-btn[disabled] { opacity: 0.45; cursor: progress; }
.config-icon-btn-save {
  color: var(--accent);
  border-color: rgba(245, 158, 11, 0.28);
}
.config-icon-btn-save:hover {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.60);
}
.config-icon-btn-icon {
  width: 15px;
  height: 15px;
  background: currentColor;
  flex: none;
}
.config-icon-reload {
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13.6 2.4A7 7 0 1 0 15 8h-1.5A5.5 5.5 0 1 1 11 3.5l-2 2H14V0l-2 2 1.6.4z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13.6 2.4A7 7 0 1 0 15 8h-1.5A5.5 5.5 0 1 1 11 3.5l-2 2H14V0l-2 2 1.6.4z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.config-icon-reset {
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 3.5V1L0 5.5 5 10V7.5c3.6 0 6 2.5 5 6.5C11.5 10 9 4.5 5 4.5V3.5z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 3.5V1L0 5.5 5 10V7.5c3.6 0 6 2.5 5 6.5C11.5 10 9 4.5 5 4.5V3.5z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.config-icon-save {
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13 0H2a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V3l-3-3zm-5 13.5a2.5 2.5 0 1 1 0-5 2.5 2.5 0 0 1 0 5zM11 5H5V1h6v4z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13 0H2a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V3l-3-3zm-5 13.5a2.5 2.5 0 1 1 0-5 2.5 2.5 0 0 1 0 5zM11 5H5V1h6v4z'/%3E%3C/svg%3E") center / contain no-repeat;
}
@media (max-width: 920px) {
  .config-setup-layout {
    grid-template-columns: 1fr;
  }
  .config-setup-sidebar {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
}

/* ──────────────────────────────────────────────────────────────────
   5. Buttons — amber primary with warm glow
   ────────────────────────────────────────────────────────────────── */
.button {
  position: relative;
  border-radius: var(--r-md);
  padding: 12px 18px;
  font-weight: 700;
  font-family: "Manrope", sans-serif;
  cursor: pointer;
  border: 1px solid var(--line-2);
  background: rgba(41, 37, 36, 0.85);
  color: var(--text);
  letter-spacing: 0.02em;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
.button:hover:not([disabled]) {
  border-color: var(--line-glow);
  background: rgba(52, 46, 44, 0.95);
}
.button[disabled] { opacity: 0.5; cursor: not-allowed; }

.button-primary {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #1c1100;
  border: none;
  box-shadow:
    0 8px 28px rgba(245, 158, 11, 0.40),
    0 0 1px rgba(245, 158, 11, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -2px 0 rgba(0, 0, 0, 0.20);
  text-shadow: 0 1px 0 rgba(0,0,0,0.12);
}
.button-primary:hover:not([disabled]) {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  box-shadow:
    0 14px 36px rgba(245, 158, 11, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.button-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border: none; color: #fff;
  box-shadow: 0 8px 22px rgba(239, 68, 68, 0.40), inset 0 1px 0 rgba(255,255,255,0.20);
}
.button-danger:hover:not([disabled]) {
  box-shadow: 0 12px 30px rgba(239, 68, 68, 0.55), inset 0 1px 0 rgba(255,255,255,0.25);
}
.button-quiet {
  background: transparent;
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: #fecaca;
}
.button-quiet:hover { background: rgba(127, 29, 29, 0.25); }

.button-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ──────────────────────────────────────────────────────────────────
   6. Inputs / selects / textareas
   ────────────────────────────────────────────────────────────────── */
.input, .textarea, select.input {
  width: 100%;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: rgba(28, 25, 23, 0.65);
  color: var(--text);
  padding: 14px 16px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.input::placeholder { color: var(--muted-2); }
.input:focus, .textarea:focus, select.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15), 0 0 22px rgba(245, 158, 11, 0.14);
  background: rgba(28, 25, 23, 0.85);
}
.textarea { min-height: 100px; resize: vertical; }

/* ──────────────────────────────────────────────────────────────────
   7. Badges, chips, pills
   ────────────────────────────────────────────────────────────────── */
.badge {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(28, 25, 23, 0.7);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  display: inline-flex; align-items: center; gap: 6px;
  width: max-content;
}
.badge-primary { background: rgba(245, 158, 11, 0.15); border-color: rgba(245, 158, 11, 0.45); color: #fde68a; }
.badge-success { background: rgba(52, 211, 153, 0.14); border-color: rgba(52, 211, 153, 0.40); color: #a7f3d0; }
.badge-danger  { background: rgba(239, 68, 68, 0.16);  border-color: rgba(239, 68, 68, 0.40);  color: #fecaca; }

/* ──────────────────────────────────────────────────────────────────
   8. Topbar — hero strip
   ────────────────────────────────────────────────────────────────── */
.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 22px;
  align-items: center;
  padding: 18px 22px;
  border-radius: var(--r-2xl);
  background:
    linear-gradient(135deg, rgba(245, 158, 11, 0.08), transparent 30%),
    linear-gradient(225deg, rgba(74, 222, 128, 0.07), transparent 30%),
    rgba(41, 37, 36, 0.85);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  position: relative;
  overflow: visible;
  z-index: 30; /* must exceed click-trap (25) so popup buttons stay accessible */
}
.topbar::after {
  content: "";
  position: absolute;
  bottom: 0; left: 10%; right: 10%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.5;
}
.topbar-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-brand-copy { display: grid; gap: 2px; min-width: 0; }
.topbar-subtitle { font-size: 0.86rem; }

.topbar-avatar-button { position: relative; padding: 0; border: 0; background: transparent; cursor: pointer; }
.topbar-avatar {
  width: 52px; height: 52px;
  border-radius: var(--r-md);
  border: 2px solid var(--accent);
  background: var(--bg-elev);
  object-fit: cover;
  box-shadow: var(--glow-amber);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.topbar-avatar-button:hover .topbar-avatar { transform: scale(1.04); }
.topbar-avatar-indicator {
  position: absolute; right: -2px; top: -2px;
  width: 14px; height: 14px; border-radius: 999px;
  background: var(--go);
  border: 2px solid var(--bg-mid);
  box-shadow: 0 0 10px var(--go-glow);
}

.topbar-status-strip { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.topbar-status-pill {
  display: grid; gap: 2px;
  min-width: 110px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: rgba(28, 25, 23, 0.55);
}
.topbar-status-pill-button { cursor: pointer; }
.topbar-status-pill-button:hover { border-color: var(--line-glow); background: rgba(41, 37, 36, 0.9); }
.topbar-status-value { font-size: 0.95rem; color: var(--text); font-weight: 700; font-family: "Outfit", sans-serif; }

.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

@media (max-width: 1080px) {
  .topbar { grid-template-columns: 1fr; }
  .topbar-status-strip, .topbar-actions { justify-content: flex-start; }
}

/* ──────────────────────────────────────────────────────────────────
   9. Lobby + room cards
   ────────────────────────────────────────────────────────────────── */
.lobby-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr);
  gap: 22px;
  align-items: stretch;
}
.lobby-hero-copy {
  padding: 28px;
  border-radius: var(--r-xl);
  background:
    linear-gradient(135deg, rgba(245, 158, 11, 0.12), transparent 40%),
    linear-gradient(225deg, rgba(74, 222, 128, 0.09), transparent 40%),
    rgba(28, 25, 23, 0.6);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.lobby-hero-copy::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(245,158,11,0.45), transparent 40%, rgba(74,222,128,0.40));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
}

.lobby-browser-heading {
  display: grid;
  gap: 6px;
}
.lobby-browser {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}
.lobby-browser-sidebar {
  min-height: min(620px, calc(100dvh - 160px));
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  align-content: space-between;
  padding: 14px;
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(245, 158, 11, 0.08), transparent 46%),
    rgba(28, 25, 23, 0.68);
}
.lobby-sidebar-top {
  display: grid;
  gap: 14px;
}
.lobby-sidebar-bottom {
  align-self: end;
  display: grid;
  gap: 10px;
}
.lobby-sidebar-bottom .lobby-action-button {
  width: 100%;
}
.lobby-results-panel {
  min-width: 0;
  display: grid;
  align-content: start;
}
.room-search-field {
  min-width: 0;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  min-height: 46px;
  border-radius: var(--r-md);
  border: 1px solid rgba(168, 162, 158, 0.18);
  background: rgba(12, 10, 9, 0.46);
}
.room-search-icon,
.lobby-action-icon,
.how-to-item-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: center / contain no-repeat;
  mask: center / contain no-repeat;
}
.room-search-icon {
  color: var(--muted);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.8 2.2a5.6 5.6 0 1 1 0 11.2 5.6 5.6 0 0 1 0-11.2Zm0 2a3.6 3.6 0 1 0 0 7.2 3.6 3.6 0 0 0 0-7.2Zm4.2 8.9 1.4-1.4 3 3-1.4 1.4-3-3Z' fill='black'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.8 2.2a5.6 5.6 0 1 1 0 11.2 5.6 5.6 0 0 1 0-11.2Zm0 2a3.6 3.6 0 1 0 0 7.2 3.6 3.6 0 0 0 0-7.2Zm4.2 8.9 1.4-1.4 3 3-1.4 1.4-3-3Z' fill='black'/%3E%3C/svg%3E");
}
.room-search-input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
}
.room-search-input::placeholder { color: rgba(168, 162, 158, 0.76); }
.room-filter-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.room-filter-chip {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(168, 162, 158, 0.18);
  background: rgba(12, 10, 9, 0.34);
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 800;
  font-family: "Outfit", sans-serif;
}
.room-filter-chip:hover,
.room-filter-chip-active {
  color: var(--text);
  border-color: rgba(245, 158, 11, 0.48);
  background: rgba(245, 158, 11, 0.14);
}
.lobby-action-row,
.lobby-empty-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 8px;
}
.lobby-action-button {
  min-height: 42px;
  padding: 0 13px;
  border-radius: 14px;
  border: 1px solid rgba(245, 158, 11, 0.30);
  background:
    linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(74, 222, 128, 0.06)),
    rgba(41, 37, 36, 0.86);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 900;
  font-family: "Outfit", sans-serif;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.lobby-action-button:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.18);
}
.lobby-action-create .lobby-action-icon {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8.1 2.2h1.8v2.1h2.4v1.8H9.9v2.4H8.1V6.1H5.7V4.3h2.4V2.2Zm.5 6.7a4 4 0 1 1-3.7 2.5c.6.5 1.4.8 2.2.8h2V9.1c-.2-.1-.3-.1-.5-.2Zm1.3-6.4 1.2-.8 1 1.4-1.1.8-1.1-1.4Z' fill='black'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8.1 2.2h1.8v2.1h2.4v1.8H9.9v2.4H8.1V6.1H5.7V4.3h2.4V2.2Zm.5 6.7a4 4 0 1 1-3.7 2.5c.6.5 1.4.8 2.2.8h2V9.1c-.2-.1-.3-.1-.5-.2Zm1.3-6.4 1.2-.8 1 1.4-1.1.8-1.1-1.4Z' fill='black'/%3E%3C/svg%3E");
}
.lobby-action-join .lobby-action-icon {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.2 10.8a4.6 4.6 0 1 1 3-3l5.6 5.6-1.6 1.6-1.8-1.8-1.3 1.3-1.5-1.5 1.3-1.3-1.2-1.2-2.5.3ZM5.5 4.1a1.8 1.8 0 1 0 0 3.6 1.8 1.8 0 0 0 0-3.6Z' fill='black'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.2 10.8a4.6 4.6 0 1 1 3-3l5.6 5.6-1.6 1.6-1.8-1.8-1.3 1.3-1.5-1.5 1.3-1.3-1.2-1.2-2.5.3ZM5.5 4.1a1.8 1.8 0 1 0 0 3.6 1.8 1.8 0 0 0 0-3.6Z' fill='black'/%3E%3C/svg%3E");
}
.lobby-action-help .lobby-action-icon {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9 1.8a7.2 7.2 0 1 1 0 14.4A7.2 7.2 0 0 1 9 1.8Zm0 10.6a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm0-8.1c-1.8 0-3.1 1-3.2 2.6h2c.1-.6.5-.9 1.2-.9.8 0 1.2.4 1.2 1 0 .5-.3.9-1 1.3-1 .6-1.4 1.2-1.3 2.5h1.8c0-.7.2-1 .9-1.4 1-.6 1.7-1.3 1.7-2.5 0-1.6-1.3-2.6-3.3-2.6Z' fill='black'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9 1.8a7.2 7.2 0 1 1 0 14.4A7.2 7.2 0 0 1 9 1.8Zm0 10.6a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm0-8.1c-1.8 0-3.1 1-3.2 2.6h2c.1-.6.5-.9 1.2-.9.8 0 1.2.4 1.2 1 0 .5-.3.9-1 1.3-1 .6-1.4 1.2-1.3 2.5h1.8c0-.7.2-1 .9-1.4 1-.6 1.7-1.3 1.7-2.5 0-1.6-1.3-2.6-3.3-2.6Z' fill='black'/%3E%3C/svg%3E");
}
.room-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}
.room-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 13px;
  min-height: 0;
  padding: 14px;
  border-radius: var(--r-lg);
  background:
    linear-gradient(145deg, rgba(245, 158, 11, 0.13), transparent 42%),
    linear-gradient(315deg, rgba(74, 222, 128, 0.08), transparent 46%),
    rgba(28, 25, 23, 0.72);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}
.room-card-playing {
  background:
    linear-gradient(145deg, rgba(248, 113, 113, 0.14), transparent 42%),
    linear-gradient(315deg, rgba(245, 158, 11, 0.09), transparent 46%),
    rgba(28, 25, 23, 0.72);
}
.room-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-glow);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.35), 0 0 24px rgba(245, 158, 11, 0.14);
}
.room-card-visual {
  width: 100%;
  min-height: 92px;
  max-height: 98px;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(245, 158, 11, 0.28);
  background:
    radial-gradient(circle at 78% 18%, rgba(245, 158, 11, 0.18), transparent 24%),
    linear-gradient(135deg, rgba(12, 10, 9, 0.45), rgba(41, 37, 36, 0.78));
  box-shadow: inset 0 0 34px rgba(0, 0, 0, 0.48);
}
.room-card-visual::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 12px;
  background-image: url("data:image/svg+xml,%3Csvg width='252' height='104' viewBox='0 0 252 104' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='252' height='104' rx='12' fill='%231c1917'/%3E%3Cg opacity='.34'%3E%3Cpath d='M0 26h252M0 52h252M0 78h252M42 0v104M84 0v104M126 0v104M168 0v104M210 0v104' stroke='%23d6d3d1' stroke-width='1'/%3E%3C/g%3E%3Cg fill='%2357534e'%3E%3Crect x='42' y='26' width='42' height='26' rx='4'/%3E%3Crect x='126' y='26' width='42' height='26' rx='4'/%3E%3Crect x='84' y='52' width='42' height='26' rx='4'/%3E%3Crect x='168' y='52' width='42' height='26' rx='4'/%3E%3C/g%3E%3Cg fill='%23b45309' fill-opacity='.72'%3E%3Crect x='12' y='12' width='28' height='18' rx='4'/%3E%3Crect x='212' y='74' width='28' height='18' rx='4'/%3E%3C/g%3E%3Ccircle cx='126' cy='52' r='12' fill='%234ade80' fill-opacity='.70'/%3E%3C/svg%3E");
  background-size: 100% 100%;
  opacity: 0.88;
}
.room-card-playing .room-card-visual::before {
  filter: hue-rotate(146deg) saturate(1.15);
}
.room-card-visual-arena {
  position: absolute;
  inset: 10px;
  border-radius: 12px;
  box-shadow:
    inset 0 0 0 1px rgba(245, 158, 11, 0.20),
    inset 0 0 28px rgba(0, 0, 0, 0.42);
}
.room-card-visual-glyph {
  position: absolute;
  left: 20px;
  bottom: 18px;
  width: 46px;
  height: 46px;
  border-radius: 48% 48% 52% 52%;
  background:
    radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.24), transparent 16%),
    linear-gradient(145deg, #78716c, #0c0a09);
  box-shadow:
    0 0 0 2px rgba(214, 211, 209, 0.20),
    0 0 24px rgba(245, 158, 11, 0.20);
}
.room-card-visual-glyph::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 13px;
  right: -2px;
  top: -7px;
  border-radius: 8px 8px 4px 4px;
  transform: rotate(32deg);
  background: linear-gradient(180deg, #d6d3d1, #57534e);
  box-shadow: 0 0 0 2px rgba(28, 25, 23, 0.76);
}
.room-card-visual-glyph-live {
  box-shadow:
    0 0 0 2px rgba(214, 211, 209, 0.20),
    0 0 28px rgba(248, 113, 113, 0.28);
}
.room-card-visual-dot {
  position: absolute;
  right: 18px;
  top: 18px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--go);
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.62);
}
.room-card-visual-dot-live {
  background: var(--danger);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.68);
}
.room-card-main {
  display: grid;
  gap: 10px;
  min-width: 0;
  align-content: start;
}
.room-card-details {
  display: grid;
  gap: 10px;
}
.room-card-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.82rem;
  font-weight: 700;
}
.room-card-pill::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  flex: none;
  background: currentColor;
  opacity: 0.86;
  -webkit-mask: center / contain no-repeat;
  mask: center / contain no-repeat;
}
.room-card-pill-host::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 14 14' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 1.1c1.7 0 3 1.3 3 3s-1.3 3-3 3-3-1.3-3-3 1.3-3 3-3Zm0 7.4c2.2 0 4 1.8 4 4H3c0-2.2 1.8-4 4-4Z' fill='black'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 14 14' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 1.1c1.7 0 3 1.3 3 3s-1.3 3-3 3-3-1.3-3-3 1.3-3 3-3Zm0 7.4c2.2 0 4 1.8 4 4H3c0-2.2 1.8-4 4-4Z' fill='black'/%3E%3C/svg%3E");
}
.room-card-pill-players::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 14 14' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.5 1.5a2 2 0 1 1 0 4 2 2 0 0 1 0-4Zm7 0a2 2 0 1 1 0 4 2 2 0 0 1 0-4ZM7 7.2c-2.4 0-4.3 1.2-4.3 2.7V11h8.6V9.9c0-1.5-1.9-2.7-4.3-2.7Z' fill='black'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 14 14' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.5 1.5a2 2 0 1 1 0 4 2 2 0 0 1 0-4Zm7 0a2 2 0 1 1 0 4 2 2 0 0 1 0-4ZM7 7.2c-2.4 0-4.3 1.2-4.3 2.7V11h8.6V9.9c0-1.5-1.9-2.7-4.3-2.7Z' fill='black'/%3E%3C/svg%3E");
}
.room-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.room-card-code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: clamp(1.16rem, 2vw, 1.38rem);
  letter-spacing: 0.1em;
  color: var(--text);
  font-weight: 700;
}
.room-status-badge {
  flex: none;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid rgba(74, 222, 128, 0.30);
  color: #bbf7d0;
  background: rgba(22, 101, 52, 0.16);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.room-status-badge-playing {
  border-color: rgba(248, 113, 113, 0.34);
  color: #fecaca;
  background: rgba(127, 29, 29, 0.20);
}
.room-card-info {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}
.room-card-host,
.room-card-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.room-card-host::before,
.room-card-stats::before {
  content: "";
  width: 15px;
  height: 15px;
  flex: none;
  background: currentColor;
  opacity: 0.82;
  -webkit-mask: center / contain no-repeat;
  mask: center / contain no-repeat;
}
.room-card-host::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg width='15' height='15' viewBox='0 0 15 15' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.5 1.4 12.2 3.5v3.1c0 3-1.8 5.5-4.7 6.9-2.9-1.4-4.7-3.9-4.7-6.9V3.5l4.7-2.1Zm0 3.5.7 1.4 1.5.2-1.1 1.1.3 1.5-1.4-.7-1.4.7.3-1.5-1.1-1.1 1.5-.2.7-1.4Z' fill='black'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg width='15' height='15' viewBox='0 0 15 15' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.5 1.4 12.2 3.5v3.1c0 3-1.8 5.5-4.7 6.9-2.9-1.4-4.7-3.9-4.7-6.9V3.5l4.7-2.1Zm0 3.5.7 1.4 1.5.2-1.1 1.1.3 1.5-1.4-.7-1.4.7.3-1.5-1.1-1.1 1.5-.2.7-1.4Z' fill='black'/%3E%3C/svg%3E");
}
.room-card-stats::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg width='15' height='15' viewBox='0 0 15 15' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.2 2.4a2.3 2.3 0 1 1 0 4.6 2.3 2.3 0 0 1 0-4.6Zm5.2.8a1.9 1.9 0 1 1 0 3.8 1.9 1.9 0 0 1 0-3.8ZM5.2 8c2.4 0 4.2 1.3 4.2 3v1.4H1V11c0-1.7 1.8-3 4.2-3Zm5.2.4c2.1 0 3.8 1.1 3.8 2.6v1.4h-3.4V11c0-.9-.4-1.7-1.1-2.4.2-.1.5-.2.7-.2Z' fill='black'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg width='15' height='15' viewBox='0 0 15 15' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.2 2.4a2.3 2.3 0 1 1 0 4.6 2.3 2.3 0 0 1 0-4.6Zm5.2.8a1.9 1.9 0 1 1 0 3.8 1.9 1.9 0 0 1 0-3.8ZM5.2 8c2.4 0 4.2 1.3 4.2 3v1.4H1V11c0-1.7 1.8-3 4.2-3Zm5.2.4c2.1 0 3.8 1.1 3.8 2.6v1.4h-3.4V11c0-.9-.4-1.7-1.1-2.4.2-.1.5-.2.7-.2Z' fill='black'/%3E%3C/svg%3E");
}
.room-card p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.room-card-action {
  align-self: end;
  min-height: 42px;
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(245, 158, 11, 0.34);
  background:
    linear-gradient(135deg, rgba(245, 158, 11, 0.20), rgba(74, 222, 128, 0.08)),
    rgba(41, 37, 36, 0.92);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 800;
  font-family: "Outfit", sans-serif;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.room-card-action:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.18);
}
.room-card-action:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}
.room-card-action-icon {
  width: 16px;
  height: 16px;
  flex: none;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.2 3.1v9.8L12.3 8 5.2 3.1Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.2 3.1v9.8L12.3 8 5.2 3.1Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
}
.room-card-action-watch .room-card-action-icon {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 3.2c3.4 0 5.8 3.2 6.4 4.3a1 1 0 0 1 0 1C13.8 9.6 11.4 12.8 8 12.8S2.2 9.6 1.6 8.5a1 1 0 0 1 0-1C2.2 6.4 4.6 3.2 8 3.2Zm0 2.5a2.3 2.3 0 1 0 0 4.6 2.3 2.3 0 0 0 0-4.6Z' fill='black'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 3.2c3.4 0 5.8 3.2 6.4 4.3a1 1 0 0 1 0 1C13.8 9.6 11.4 12.8 8 12.8S2.2 9.6 1.6 8.5a1 1 0 0 1 0-1C2.2 6.4 4.6 3.2 8 3.2Zm0 2.5a2.3 2.3 0 1 0 0 4.6 2.3 2.3 0 0 0 0-4.6Z' fill='black'/%3E%3C/svg%3E");
}
.lobby-empty-state {
  min-height: min(620px, calc(100dvh - 160px));
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  padding: 34px 22px;
  border-radius: var(--r-xl);
  border: 1px dashed rgba(245, 158, 11, 0.30);
  background:
    radial-gradient(circle at 50% 38%, rgba(245, 158, 11, 0.10), transparent 30%),
    rgba(12, 10, 9, 0.32);
  text-align: center;
}
.lobby-empty-mark {
  width: 118px;
  height: 118px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.30);
  background:
    radial-gradient(circle, rgba(245, 158, 11, 0.18), transparent 60%),
    rgba(41, 37, 36, 0.62);
}
.lobby-empty-mark-bomb {
  width: 58px;
  height: 58px;
  border-radius: 48% 48% 52% 52%;
  background:
    radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.24), transparent 16%),
    linear-gradient(145deg, #57534e, #0c0a09);
  box-shadow: 0 0 0 2px rgba(168, 162, 158, 0.26), 0 0 24px rgba(245, 158, 11, 0.16);
}
.lobby-empty-copy {
  display: grid;
  gap: 8px;
}
@media (max-width: 560px) {
  .lobby-action-button {
    width: auto;
    padding: 0 12px;
  }
  .room-card-visual {
    width: 100%;
    height: 112px;
    border-radius: 14px;
  }
  .room-card-action {
    width: 100%;
  }
}
@media (max-width: 1080px) {
  .lobby-browser {
    grid-template-columns: 1fr;
  }
  .lobby-browser-sidebar {
    min-height: auto;
  }
  .room-filter-row {
    grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  }
  .lobby-sidebar-bottom {
    align-self: start;
  }
  .lobby-sidebar-bottom .lobby-action-button {
    width: 100%;
  }
}

/* waiting room overlay */
.waiting-room-overlay {
  position: fixed;
  inset: 0;
  z-index: 24;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 42%, rgba(245, 158, 11, 0.10), transparent 34%),
    rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(8px);
}
.app-shell-with-chat > .waiting-room-overlay {
  right: calc(304px + 28px);
}
.waiting-room-popup {
  width: min(100%, 660px);
  min-height: 430px;
  position: relative;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 18px;
  padding: 34px;
  overflow: hidden;
  border-radius: 28px;
  color: var(--text);
  background:
    url("data:image/svg+xml,%3Csvg width='660' height='430' viewBox='0 0 660 430' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M78 24h504l54 54v274l-54 54H78l-54-54V78l54-54Z' fill='%23292524' fill-opacity='.94' stroke='%23f59e0b' stroke-opacity='.55' stroke-width='2'/%3E%3Cpath d='M105 55h450l43 43v234l-43 43H105l-43-43V98l43-43Z' stroke='%234ade80' stroke-opacity='.22' stroke-width='1.5'/%3E%3Cg stroke='%23f59e0b' stroke-opacity='.18'%3E%3Cpath d='M80 112h500M80 318h500M164 55v320M496 55v320'/%3E%3C/g%3E%3Cg fill='%23f59e0b' fill-opacity='.36'%3E%3Ccircle cx='105' cy='98' r='4'/%3E%3Ccircle cx='555' cy='98' r='4'/%3E%3Ccircle cx='105' cy='332' r='4'/%3E%3Ccircle cx='555' cy='332' r='4'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(135deg, rgba(245, 158, 11, 0.10), rgba(74, 222, 128, 0.05)),
    rgba(41, 37, 36, 0.96);
  background-size: 100% 100%, auto, auto;
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.62),
    0 0 52px rgba(245, 158, 11, 0.16),
    inset 0 0 44px rgba(0, 0, 0, 0.36);
}
.waiting-room-popup::before {
  content: "";
  position: absolute;
  inset: 18px;
  pointer-events: none;
  border-radius: 22px;
  background:
    linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.16), transparent) top / 100% 1px no-repeat,
    linear-gradient(90deg, transparent, rgba(74, 222, 128, 0.13), transparent) bottom / 100% 1px no-repeat;
}
.waiting-room-sigil {
  justify-self: center;
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  position: relative;
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 50%, rgba(74, 222, 128, 0.16), transparent 58%),
    radial-gradient(circle at 50% 50%, rgba(245, 158, 11, 0.20), transparent 70%);
  filter: drop-shadow(0 0 18px rgba(245, 158, 11, 0.22));
}
.waiting-room-sigil::before {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 999px;
  border: 2px solid rgba(245, 158, 11, 0.62);
  box-shadow:
    inset 0 0 24px rgba(245, 158, 11, 0.12),
    0 0 22px rgba(245, 158, 11, 0.12);
}
.waiting-room-sigil::after {
  content: "";
  width: 72px;
  height: 72px;
  position: relative;
  background:
    radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.26), transparent 15%),
    radial-gradient(circle at 38% 36%, rgba(120, 113, 108, 0.42), transparent 23%),
    linear-gradient(145deg, #57534e 0%, #292524 42%, #0c0a09 100%);
  border-radius: 46% 46% 50% 50%;
  box-shadow:
    inset -10px -12px 0 rgba(0, 0, 0, 0.34),
    inset 6px 7px 0 rgba(255, 255, 255, 0.08),
    0 0 0 2px rgba(168, 162, 158, 0.30),
    0 0 0 5px rgba(245, 158, 11, 0.08),
    0 0 28px rgba(245, 158, 11, 0.18);
}
.waiting-room-sigil-core {
  position: absolute;
  z-index: 1;
  width: 30px;
  height: 18px;
  top: 18px;
  left: 50%;
  transform: translateX(-3px) rotate(34deg);
  border-radius: 11px 11px 5px 5px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.22), transparent 42%),
    linear-gradient(180deg, #a8a29e, #57534e);
  box-shadow:
    0 0 0 2px rgba(28, 25, 23, 0.86),
    0 0 12px rgba(214, 211, 209, 0.20);
}
.waiting-room-sigil-core::before {
  content: "";
  position: absolute;
  width: 28px;
  height: 18px;
  left: 22px;
  top: -8px;
  border-top: 4px solid rgba(214, 211, 209, 0.82);
  border-right: 4px solid rgba(214, 211, 209, 0.70);
  border-radius: 0 18px 0 0;
  transform: rotate(-20deg);
}
.waiting-room-sigil-core::after {
  content: "";
  position: absolute;
  width: 11px;
  height: 11px;
  left: 48px;
  top: -15px;
  background: #facc15;
  clip-path: polygon(50% 0, 62% 36%, 100% 28%, 70% 54%, 88% 100%, 50% 72%, 12% 100%, 30% 54%, 0 28%, 38% 36%);
  filter: drop-shadow(0 0 7px rgba(250, 204, 21, 0.48));
}
.waiting-room-sigil-core-active {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.24), transparent 42%),
    linear-gradient(180deg, #d6d3d1, #78716c);
  box-shadow:
    0 0 0 2px rgba(28, 25, 23, 0.86),
    0 0 22px rgba(250, 204, 21, 0.35);
  animation: neon-pulse 900ms ease-in-out infinite alternate;
}
@keyframes neon-pulse {
  from { transform: translateX(-3px) rotate(34deg) scale(0.94); opacity: 0.78; }
  to { transform: translateX(-3px) rotate(34deg) scale(1.06); opacity: 1; }
}
.waiting-room-heading {
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
}
.waiting-room-title {
  margin: 0;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: clamp(2.3rem, 7vw, 4.6rem);
  line-height: 1;
  letter-spacing: 0.08em;
  color: #fde68a;
  text-shadow: 0 0 26px rgba(245, 158, 11, 0.34);
}
.waiting-room-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
  padding: 8px 0 4px;
}
.waiting-room-fact {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 8px;
  min-width: 0;
  padding-top: 34px;
}
.waiting-room-fact::before {
  content: "";
  position: absolute;
  top: 0;
  width: 26px;
  height: 26px;
  background: currentColor;
  color: rgba(245, 158, 11, 0.88);
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='26' height='26' viewBox='0 0 26 26' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13 1.8 23.2 7v12L13 24.2 2.8 19V7L13 1.8Zm0 4.4L7 9.2v6.6l6 3 6-3V9.2l-6-3Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='26' height='26' viewBox='0 0 26 26' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13 1.8 23.2 7v12L13 24.2 2.8 19V7L13 1.8Zm0 4.4L7 9.2v6.6l6 3 6-3V9.2l-6-3Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.28));
}
.waiting-room-fact-host::before {
  color: rgba(250, 204, 21, 0.92);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg width='26' height='26' viewBox='0 0 26 26' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13 2.4 21.2 6v5.6c0 5.2-3.2 9.6-8.2 12-5-2.4-8.2-6.8-8.2-12V6L13 2.4Zm0 3.1L7.2 8v3.6c0 3.8 2.1 7 5.8 9 3.7-2 5.8-5.2 5.8-9V8L13 5.5Zm0 4.1 1.1 2.2 2.4.3-1.7 1.7.4 2.4-2.2-1.1-2.2 1.1.4-2.4-1.7-1.7 2.4-.3L13 9.6Z' fill='black'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg width='26' height='26' viewBox='0 0 26 26' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13 2.4 21.2 6v5.6c0 5.2-3.2 9.6-8.2 12-5-2.4-8.2-6.8-8.2-12V6L13 2.4Zm0 3.1L7.2 8v3.6c0 3.8 2.1 7 5.8 9 3.7-2 5.8-5.2 5.8-9V8L13 5.5Zm0 4.1 1.1 2.2 2.4.3-1.7 1.7.4 2.4-2.2-1.1-2.2 1.1.4-2.4-1.7-1.7 2.4-.3L13 9.6Z' fill='black'/%3E%3C/svg%3E");
}
.waiting-room-fact-humans::before {
  color: rgba(96, 165, 250, 0.92);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg width='26' height='26' viewBox='0 0 26 26' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9 4.2a3.8 3.8 0 1 1 0 7.6 3.8 3.8 0 0 1 0-7.6Zm8.6 1.4a3.2 3.2 0 1 1 0 6.4 3.2 3.2 0 0 1 0-6.4ZM9 13.5c4 0 7.2 2.2 7.2 5v2.3H1.8v-2.3c0-2.8 3.2-5 7.2-5Zm8.6.6c3.6 0 6.6 1.9 6.6 4.4v2.3h-5.9v-2.3c0-1.5-.7-3-2-4.1.4-.2.9-.3 1.3-.3Z' fill='black'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg width='26' height='26' viewBox='0 0 26 26' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9 4.2a3.8 3.8 0 1 1 0 7.6 3.8 3.8 0 0 1 0-7.6Zm8.6 1.4a3.2 3.2 0 1 1 0 6.4 3.2 3.2 0 0 1 0-6.4ZM9 13.5c4 0 7.2 2.2 7.2 5v2.3H1.8v-2.3c0-2.8 3.2-5 7.2-5Zm8.6.6c3.6 0 6.6 1.9 6.6 4.4v2.3h-5.9v-2.3c0-1.5-.7-3-2-4.1.4-.2.9-.3 1.3-.3Z' fill='black'/%3E%3C/svg%3E");
}
.waiting-room-fact-computer::before {
  color: rgba(192, 132, 252, 0.92);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg width='26' height='26' viewBox='0 0 26 26' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 2.4h2v3h5.2a2.8 2.8 0 0 1 2.8 2.8v8.6a2.8 2.8 0 0 1-2.8 2.8H6.8A2.8 2.8 0 0 1 4 16.8V8.2a2.8 2.8 0 0 1 2.8-2.8H12v-3Zm-5.2 5A.8.8 0 0 0 6 8.2v8.6c0 .4.4.8.8.8h12.4c.4 0 .8-.4.8-.8V8.2a.8.8 0 0 0-.8-.8H6.8Zm2.4 3.1a1.7 1.7 0 1 1 0 3.4 1.7 1.7 0 0 1 0-3.4Zm7.6 0a1.7 1.7 0 1 1 0 3.4 1.7 1.7 0 0 1 0-3.4ZM8 21h10v2H8v-2Z' fill='black'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg width='26' height='26' viewBox='0 0 26 26' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 2.4h2v3h5.2a2.8 2.8 0 0 1 2.8 2.8v8.6a2.8 2.8 0 0 1-2.8 2.8H6.8A2.8 2.8 0 0 1 4 16.8V8.2a2.8 2.8 0 0 1 2.8-2.8H12v-3Zm-5.2 5A.8.8 0 0 0 6 8.2v8.6c0 .4.4.8.8.8h12.4c.4 0 .8-.4.8-.8V8.2a.8.8 0 0 0-.8-.8H6.8Zm2.4 3.1a1.7 1.7 0 1 1 0 3.4 1.7 1.7 0 0 1 0-3.4Zm7.6 0a1.7 1.7 0 1 1 0 3.4 1.7 1.7 0 0 1 0-3.4ZM8 21h10v2H8v-2Z' fill='black'/%3E%3C/svg%3E");
}
.waiting-room-fact-total::before {
  color: rgba(74, 222, 128, 0.90);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg width='26' height='26' viewBox='0 0 26 26' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13 2.6 24 8.9v8.2l-11 6.3-11-6.3V8.9l11-6.3Zm0 2.8L4.4 10.3v5.4l8.6 4.9 8.6-4.9v-5.4L13 5.4ZM8 10h10v2H8v-2Zm0 4h10v2H8v-2Z' fill='black'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg width='26' height='26' viewBox='0 0 26 26' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13 2.6 24 8.9v8.2l-11 6.3-11-6.3V8.9l11-6.3Zm0 2.8L4.4 10.3v5.4l8.6 4.9 8.6-4.9v-5.4L13 5.4ZM8 10h10v2H8v-2Zm0 4h10v2H8v-2Z' fill='black'/%3E%3C/svg%3E");
}
.waiting-room-fact-label {
  font-family: "Outfit", sans-serif;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}
.waiting-room-fact-value {
  max-width: 100%;
  font-family: "Outfit", sans-serif;
  font-size: clamp(1rem, 2vw, 1.4rem);
  font-weight: 900;
  color: var(--text);
  line-height: 1;
  text-align: center;
  overflow-wrap: anywhere;
}
.waiting-room-fact-code .waiting-room-fact-value {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  color: #fde68a;
  letter-spacing: 0.04em;
}
.waiting-room-owner-config {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 2px 0;
}
.waiting-room-counter {
  display: grid;
  justify-items: center;
  gap: 10px;
}
.waiting-room-counter-row {
  display: inline-grid;
  grid-template-columns: 44px minmax(66px, auto) 44px;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.24);
  background: rgba(28, 25, 23, 0.58);
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.28);
}
.waiting-room-counter-btn {
  width: 44px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.34);
  background:
    linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(74, 222, 128, 0.06)),
    rgba(41, 37, 36, 0.92);
  color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 1.18rem;
  font-weight: 900;
  cursor: pointer;
}
.waiting-room-counter-btn:hover:not(:disabled) {
  border-color: var(--accent);
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.18);
}
.waiting-room-counter-btn:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}
.waiting-room-counter-value {
  min-width: 44px;
  text-align: center;
  font-family: "Outfit", sans-serif;
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
  color: #fde68a;
  text-shadow: 0 0 18px rgba(245, 158, 11, 0.22);
}
.waiting-room-mini-facts {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}
.waiting-room-loading,
.waiting-room-message {
  justify-self: center;
  text-align: center;
}
.waiting-room-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 6px;
}
.waiting-room-action {
  min-width: 124px;
  min-height: 44px;
  border: 1px solid rgba(245, 158, 11, 0.34);
  border-radius: 999px;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(74, 222, 128, 0.07)),
    rgba(28, 25, 23, 0.82);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: "Outfit", sans-serif;
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}
.waiting-room-action:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.20);
}
.waiting-room-action:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}
.waiting-room-action-icon {
  width: 17px;
  height: 17px;
  flex: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='17' height='17' viewBox='0 0 17 17' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.5 3.2v10.6L13.2 8.5 5.5 3.2Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='17' height='17' viewBox='0 0 17 17' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.5 3.2v10.6L13.2 8.5 5.5 3.2Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
}
.waiting-room-action-leave {
  border-color: rgba(248, 113, 113, 0.34);
}
.waiting-room-action-leave .waiting-room-action-icon {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg width='17' height='17' viewBox='0 0 17 17' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.5 2.5h-4v12h4v-2h-2v-8h2v-2Zm3.4 2.2-1.4 1.4 1.4 1.4H7v2h3.9l-1.4 1.4 1.4 1.4 3.8-3.8-3.8-3.8Z' fill='black'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg width='17' height='17' viewBox='0 0 17 17' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.5 2.5h-4v12h4v-2h-2v-8h2v-2Zm3.4 2.2-1.4 1.4 1.4 1.4H7v2h3.9l-1.4 1.4 1.4 1.4 3.8-3.8-3.8-3.8Z' fill='black'/%3E%3C/svg%3E");
}
.waiting-room-action-cancel {
  border-color: rgba(248, 113, 113, 0.38);
}
.waiting-room-action-invite {
  border-color: rgba(74, 222, 128, 0.38);
}
.waiting-room-action-invite .waiting-room-action-icon {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg width='17' height='17' viewBox='0 0 17 17' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8.5 2.2 15 5.7v5.6l-6.5 3.5L2 11.3V5.7l6.5-3.5Zm0 2.2L4.2 6.7v3.6l4.3 2.3 4.3-2.3V6.7L8.5 4.4Zm-.8 2.3h1.6v1.8h1.8v1.6H9.3v1.8H7.7v-1.8H5.9V8.5h1.8V6.7Z' fill='black'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg width='17' height='17' viewBox='0 0 17 17' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8.5 2.2 15 5.7v5.6l-6.5 3.5L2 11.3V5.7l6.5-3.5Zm0 2.2L4.2 6.7v3.6l4.3 2.3 4.3-2.3V6.7L8.5 4.4Zm-.8 2.3h1.6v1.8h1.8v1.6H9.3v1.8H7.7v-1.8H5.9V8.5h1.8V6.7Z' fill='black'/%3E%3C/svg%3E");
}
.waiting-room-action-cancel .waiting-room-action-icon {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg width='17' height='17' viewBox='0 0 17 17' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m4.2 2.8 4.3 4.3 4.3-4.3 1.4 1.4-4.3 4.3 4.3 4.3-1.4 1.4-4.3-4.3-4.3 4.3-1.4-1.4 4.3-4.3-4.3-4.3 1.4-1.4Z' fill='black'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg width='17' height='17' viewBox='0 0 17 17' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m4.2 2.8 4.3 4.3 4.3-4.3 1.4 1.4-4.3 4.3 4.3 4.3-1.4 1.4-4.3-4.3-4.3 4.3-1.4-1.4 4.3-4.3-4.3-4.3 1.4-1.4Z' fill='black'/%3E%3C/svg%3E");
}
.waiting-room-invite-backdrop {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 45%, rgba(74, 222, 128, 0.10), transparent 36%),
    rgba(0, 0, 0, 0.50);
  backdrop-filter: blur(10px);
}
.waiting-room-invite-popup {
  width: min(100%, 760px);
  max-height: min(82vh, 720px);
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  gap: 18px;
  padding: 28px;
  border-radius: 28px;
  border: 1px solid rgba(74, 222, 128, 0.28);
  background:
    url("data:image/svg+xml,%3Csvg width='760' height='520' viewBox='0 0 760 520' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M70 24h620l46 46v380l-46 46H70l-46-46V70l46-46Z' fill='%23292524' fill-opacity='.96' stroke='%234ade80' stroke-opacity='.42' stroke-width='2'/%3E%3Cpath d='M98 58h564l34 34v336l-34 34H98l-34-34V92l34-34Z' stroke='%23f59e0b' stroke-opacity='.24' stroke-width='1.5'/%3E%3Cg stroke='%234ade80' stroke-opacity='.14'%3E%3Cpath d='M118 122h524M118 398h524M190 58v404M570 58v404'/%3E%3C/g%3E%3Cg fill='%23f59e0b' fill-opacity='.38'%3E%3Ccircle cx='98' cy='92' r='4'/%3E%3Ccircle cx='662' cy='92' r='4'/%3E%3Ccircle cx='98' cy='428' r='4'/%3E%3Ccircle cx='662' cy='428' r='4'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(135deg, rgba(74, 222, 128, 0.08), rgba(245, 158, 11, 0.07)),
    rgba(41, 37, 36, 0.98);
  background-size: 100% 100%, auto, auto;
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.66),
    0 0 54px rgba(74, 222, 128, 0.14),
    inset 0 0 42px rgba(0, 0, 0, 0.34);
  scrollbar-width: none;
}
.waiting-room-invite-popup::-webkit-scrollbar { display: none; }
.waiting-room-invite-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}
.waiting-room-invite-mark {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  border: 1px solid rgba(74, 222, 128, 0.34);
  background-color: rgba(28, 25, 23, 0.64);
  background-image: url("data:image/svg+xml,%3Csvg width='54' height='54' viewBox='0 0 54 54' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='8' y='11' width='38' height='28' rx='4' fill='none' stroke='%234ade80' stroke-opacity='.72' stroke-width='2'/%3E%3Cpath d='m10 14 17 13 17-13' fill='none' stroke='%23f59e0b' stroke-opacity='.68' stroke-width='2'/%3E%3Cpath d='M27 31v12M21 37h12' stroke='%234ade80' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-size: cover;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.30), 0 0 18px rgba(74, 222, 128, 0.12);
}
.waiting-room-invite-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.waiting-room-invite-close {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(248, 113, 113, 0.34);
  background: rgba(28, 25, 23, 0.72);
  color: var(--text);
  cursor: pointer;
  position: relative;
}
.waiting-room-invite-close::before {
  content: "";
  position: absolute;
  inset: 12px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m4.4 3 4.6 4.6L13.6 3 15 4.4 10.4 9l4.6 4.6-1.4 1.4L9 10.4 4.4 15 3 13.6 7.6 9 3 4.4 4.4 3Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m4.4 3 4.6 4.6L13.6 3 15 4.4 10.4 9l4.6 4.6-1.4 1.4L9 10.4 4.4 15 3 13.6 7.6 9 3 4.4 4.4 3Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
}
.waiting-room-invite-search {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(245, 158, 11, 0.18);
  background: rgba(28, 25, 23, 0.58);
}
.waiting-room-invite-input {
  border-radius: 999px;
  padding-left: 18px;
  background:
    linear-gradient(135deg, rgba(74, 222, 128, 0.08), rgba(245, 158, 11, 0.06)),
    rgba(15, 23, 42, 0.58);
}
.waiting-room-invite-popup .invite-user-grid {
  grid-template-columns: 1fr;
  max-height: 258px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(74, 222, 128, 0.64) rgba(28, 25, 23, 0.68);
}
.waiting-room-invite-popup .invite-user-grid::-webkit-scrollbar {
  width: 8px;
}
.waiting-room-invite-popup .invite-user-grid::-webkit-scrollbar-track {
  background: rgba(28, 25, 23, 0.68);
  border-radius: 999px;
}
.waiting-room-invite-popup .invite-user-grid::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(74, 222, 128, 0.88), rgba(245, 158, 11, 0.68));
  border-radius: 999px;
}
.waiting-room-invite-popup .invite-user-card {
  position: relative;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  min-height: 74px;
  overflow: hidden;
  border-color: rgba(74, 222, 128, 0.18);
  background:
    linear-gradient(135deg, rgba(74, 222, 128, 0.08), transparent 54%),
    rgba(28, 25, 23, 0.64);
}
.waiting-room-invite-popup .invite-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  flex: none;
  background-color: rgba(74, 222, 128, 0.82);
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='34' height='34' viewBox='0 0 34 34' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M17 5.5a5.5 5.5 0 1 1 0 11 5.5 5.5 0 0 1 0-11Zm-9 22c.8-5.1 4.3-8.2 9-8.2s8.2 3.1 9 8.2H8Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='34' height='34' viewBox='0 0 34 34' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M17 5.5a5.5 5.5 0 1 1 0 11 5.5 5.5 0 0 1 0-11Zm-9 22c.8-5.1 4.3-8.2 9-8.2s8.2 3.1 9 8.2H8Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
}
.received-invite-backdrop {
  position: fixed;
  inset: 0;
  z-index: 47;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 42%, rgba(245, 158, 11, 0.13), transparent 35%),
    radial-gradient(circle at 50% 58%, rgba(74, 222, 128, 0.10), transparent 42%),
    rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(10px);
}
.received-invite-popup {
  width: min(92vw, 620px);
  max-height: min(82vh, 680px);
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  gap: 20px;
  padding: 30px;
  border-radius: 28px;
  border: 1px solid rgba(245, 158, 11, 0.34);
  background:
    url("data:image/svg+xml,%3Csvg width='620' height='430' viewBox='0 0 620 430' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M66 22h488l44 44v298l-44 44H66l-44-44V66l44-44Z' fill='%23292524' fill-opacity='.97' stroke='%23f59e0b' stroke-opacity='.44' stroke-width='2'/%3E%3Cpath d='M94 56h432l32 32v254l-32 32H94l-32-32V88l32-32Z' stroke='%234ade80' stroke-opacity='.25' stroke-width='1.5'/%3E%3Cpath d='M144 98h332M144 332h332M98 144v142M522 144v142' stroke='%23f59e0b' stroke-opacity='.14'/%3E%3Cg fill='%234ade80' fill-opacity='.42'%3E%3Ccircle cx='94' cy='88' r='4'/%3E%3Ccircle cx='526' cy='88' r='4'/%3E%3Ccircle cx='94' cy='342' r='4'/%3E%3Ccircle cx='526' cy='342' r='4'/%3E%3C/g%3E%3Cpath d='M310 116 386 159v86l-76 43-76-43v-86l76-43Z' stroke='%234ade80' stroke-opacity='.12' stroke-width='2'/%3E%3C/svg%3E"),
    linear-gradient(135deg, rgba(245, 158, 11, 0.09), rgba(74, 222, 128, 0.07)),
    rgba(41, 37, 36, 0.98);
  background-size: 100% 100%, auto, auto;
  box-shadow:
    0 30px 92px rgba(0, 0, 0, 0.68),
    0 0 52px rgba(245, 158, 11, 0.16),
    inset 0 0 44px rgba(0, 0, 0, 0.36);
  scrollbar-width: none;
}
.received-invite-popup::-webkit-scrollbar { display: none; }
.received-invite-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}
.received-invite-mark {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  border: 1px solid rgba(245, 158, 11, 0.40);
  background-color: rgba(28, 25, 23, 0.64);
  background-image: url("data:image/svg+xml,%3Csvg width='58' height='58' viewBox='0 0 58 58' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M29 7.5 48 18.2v21.6L29 50.5 10 39.8V18.2L29 7.5Z' fill='none' stroke='%23f59e0b' stroke-opacity='.82' stroke-width='2'/%3E%3Cpath d='M21 22h16a5 5 0 0 1 0 10H25v8l-6-10 6-10v2Z' fill='%234ade80' fill-opacity='.88'/%3E%3Cpath d='M21 22h16a5 5 0 0 1 0 10H25' fill='none' stroke='%23292524' stroke-opacity='.65' stroke-width='1.5'/%3E%3C/svg%3E");
  background-size: cover;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.30), 0 0 22px rgba(245, 158, 11, 0.14);
}
.received-invite-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.received-invite-close {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(248, 113, 113, 0.34);
  background: rgba(28, 25, 23, 0.72);
  color: var(--text);
  cursor: pointer;
  position: relative;
}
.received-invite-close::before {
  content: "";
  position: absolute;
  inset: 12px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m4.4 3 4.6 4.6L13.6 3 15 4.4 10.4 9l4.6 4.6-1.4 1.4L9 10.4 4.4 15 3 13.6 7.6 9 3 4.4 4.4 3Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m4.4 3 4.6 4.6L13.6 3 15 4.4 10.4 9l4.6 4.6-1.4 1.4L9 10.4 4.4 15 3 13.6 7.6 9 3 4.4 4.4 3Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
}
.received-invite-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.received-invite-fact {
  min-height: 86px;
  display: grid;
  align-content: center;
  gap: 7px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(214, 211, 209, 0.14);
  background:
    linear-gradient(135deg, rgba(245, 158, 11, 0.08), transparent 60%),
    rgba(28, 25, 23, 0.62);
  position: relative;
  overflow: hidden;
}
.received-invite-fact::before {
  content: "";
  position: absolute;
  inset: 10px auto auto 10px;
  width: 26px;
  height: 26px;
  background: rgba(245, 158, 11, 0.26);
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='26' height='26' viewBox='0 0 26 26' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13 2.8 23 8.5v9L13 23.2 3 17.5v-9l10-5.7Zm0 3.1L5.7 10v6l7.3 4.1 7.3-4.1v-6L13 5.9Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='26' height='26' viewBox='0 0 26 26' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13 2.8 23 8.5v9L13 23.2 3 17.5v-9l10-5.7Zm0 3.1L5.7 10v6l7.3 4.1 7.3-4.1v-6L13 5.9Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
}
.received-invite-fact span,
.received-invite-fact strong {
  position: relative;
  z-index: 1;
}
.received-invite-fact span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.received-invite-fact strong {
  color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 1rem;
  overflow-wrap: anywhere;
}
.received-invite-fact-code {
  border-color: rgba(74, 222, 128, 0.24);
  background:
    linear-gradient(135deg, rgba(74, 222, 128, 0.10), rgba(245, 158, 11, 0.05)),
    rgba(28, 25, 23, 0.66);
}
.received-invite-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}
.received-invite-action {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 18px;
  border: 1px solid rgba(214, 211, 209, 0.15);
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
  background: rgba(28, 25, 23, 0.70);
}
.received-invite-action-icon {
  width: 19px;
  height: 19px;
  background: currentColor;
}
.received-invite-action-accept {
  color: #052e16;
  border-color: rgba(74, 222, 128, 0.34);
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.96), rgba(16, 185, 129, 0.92));
  box-shadow: 0 12px 32px rgba(74, 222, 128, 0.24);
}
.received-invite-action-accept .received-invite-action-icon {
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='19' height='19' viewBox='0 0 19 19' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.5 13.6 3.2 9.3l1.5-1.5 2.8 2.8 6.8-6.8 1.5 1.5-8.3 8.3Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='19' height='19' viewBox='0 0 19 19' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.5 13.6 3.2 9.3l1.5-1.5 2.8 2.8 6.8-6.8 1.5 1.5-8.3 8.3Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
}
.received-invite-action-reject {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.36);
  background: linear-gradient(135deg, rgba(127, 29, 29, 0.50), rgba(28, 25, 23, 0.78));
}
.received-invite-action-reject .received-invite-action-icon {
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='19' height='19' viewBox='0 0 19 19' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m5 3.6 4.5 4.5L14 3.6 15.4 5l-4.5 4.5 4.5 4.5-1.4 1.4-4.5-4.5L5 15.4 3.6 14l4.5-4.5L3.6 5 5 3.6Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='19' height='19' viewBox='0 0 19 19' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m5 3.6 4.5 4.5L14 3.6 15.4 5l-4.5 4.5 4.5 4.5-1.4 1.4-4.5-4.5L5 15.4 3.6 14l4.5-4.5L3.6 5 5 3.6Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
}
@media (max-width: 620px) {
  .waiting-room-invite-popup {
    padding: 22px;
  }
  .waiting-room-invite-header {
    grid-template-columns: auto 1fr;
  }
  .waiting-room-invite-close {
    grid-column: 1 / -1;
    justify-self: end;
  }
  .received-invite-popup {
    padding: 22px;
  }
  .received-invite-header {
    grid-template-columns: auto 1fr;
  }
  .received-invite-close {
    grid-column: 1 / -1;
    justify-self: end;
  }
  .received-invite-facts {
    grid-template-columns: 1fr;
  }
  .received-invite-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}
@media (max-width: 720px) {
  .app-shell-with-chat > .waiting-room-overlay {
    right: 0;
  }
  .waiting-room-popup {
    min-height: auto;
    padding: 26px 20px;
  }
  .waiting-room-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* lobby chat */
.chat-shell {
  display: grid; gap: 14px;
  padding: 22px;
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  background: var(--inset);
}
.lobby-chat-shell { min-height: 100%; grid-template-rows: auto minmax(280px, 1fr) auto; }
.chat-shell-header {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
}
.lobby-section-title-group { display: grid; gap: 6px; }
.chat-feed { display: grid; gap: 10px; max-height: 360px; overflow: auto; padding-right: 4px; }
.chat-message {
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: rgba(41, 37, 36, 0.7);
  border: 1px solid var(--line);
  display: grid; gap: 4px;
}
.chat-message strong { font-size: 0.92rem; color: var(--text); font-weight: 700; }
.chat-message p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.chat-message-system { border-left: 3px solid var(--accent); background: rgba(245, 158, 11, 0.06); }
.chat-composer { display: grid; gap: 10px; grid-template-columns: 1fr auto; }
@media (max-width: 700px) { .chat-composer { grid-template-columns: 1fr; } }

/* ──────────────────────────────────────────────────────────────────
   10. Toggle switch
   ────────────────────────────────────────────────────────────────── */
.toggle { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track {
  width: 48px; height: 26px; border-radius: 999px;
  background: rgba(28, 25, 23, 0.85);
  border: 1px solid var(--line);
  position: relative;
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
.toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 999px;
  background: var(--muted-2);
  transition: transform 200ms cubic-bezier(.5,1.6,.6,1), background 180ms ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.toggle input:checked + .toggle-track {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: transparent;
  box-shadow: var(--glow-amber);
}
.toggle input:checked + .toggle-track .toggle-thumb {
  transform: translateX(22px);
  background: #fff;
}
.toggle-label { font-weight: 700; color: var(--text); font-size: 0.92rem; }

/* ──────────────────────────────────────────────────────────────────
   11. Slider
   ────────────────────────────────────────────────────────────────── */
.slider-row { display: grid; gap: 8px; }
.slider-row-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.slider-row-value {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  text-shadow: 0 0 12px var(--accent-glow);
  white-space: nowrap;
}
.slider-row-track {
  -webkit-appearance: none; appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) var(--fill, 0%), rgba(28, 25, 23, 0.85) var(--fill, 0%));
  border: 1px solid var(--line);
  outline: none;
}
.slider-row-track::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px; border-radius: 999px;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow: 0 0 16px var(--accent-glow), 0 2px 4px rgba(0,0,0,0.4);
  cursor: pointer;
  transition: transform 100ms ease;
}
.slider-row-track::-webkit-slider-thumb:hover { transform: scale(1.18); }
.slider-row-track::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 999px;
  background: #fff;
  border: 3px solid var(--accent);
  cursor: pointer;
}

/* ──────────────────────────────────────────────────────────────────
   12. Tabs (config) + sub-tabs (level workspace)
   ────────────────────────────────────────────────────────────────── */
.config-tab-row {
  display: inline-flex;
  gap: 4px;
  padding: 6px;
  border-radius: var(--r-pill);
  background: rgba(28, 25, 23, 0.7);
  border: 1px solid var(--line);
}
.config-tab-row .config-tab-button,
.config-tab-row .button {
  border: none !important;
  background: transparent !important;
  color: var(--muted);
  padding: 0 20px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.92rem;
  box-shadow: none !important;
  min-width: auto;
  white-space: nowrap;
  transform: none !important;
  transition: color 160ms ease, background 160ms ease !important;
}
.config-tab-row .config-tab-button:hover,
.config-tab-row .button:hover { color: var(--text); background: rgba(52, 46, 44, 0.6) !important; }
.config-tab-row .button-primary {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  color: #1c1100 !important;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.35), inset 0 1px 0 rgba(255,255,255,0.20) !important;
}

.subtab-row {
  display: inline-flex;
  gap: 4px;
  padding: 5px;
  border-radius: 14px;
  background: rgba(28, 25, 23, 0.6);
  border: 1px solid var(--line);
}
.subtab {
  padding: 8px 14px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  font-size: 0.88rem;
  transition: color 120ms ease, background 120ms ease;
}
.subtab:hover { color: var(--text); }
.subtab-active {
  background: rgba(41, 37, 36, 0.85);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line-2);
}

/* ──────────────────────────────────────────────────────────────────
   13. Avatar picker
   ────────────────────────────────────────────────────────────────── */
.nickname-panel { padding: 36px; }
.nickname-layout { display: grid; gap: 22px; }
.nickname-layout-single-column { grid-template-columns: minmax(0, 720px); justify-content: center; }
.nickname-form-column { display: grid; gap: 18px; }
.nickname-avatar-trigger {
  display: block; width: 100%; padding: 0; border: 0; background: transparent; color: inherit; cursor: pointer; text-align: left;
}
.nickname-avatar-preview-card {
  display: grid; gap: 14px; padding: 20px;
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  background: rgba(28, 25, 23, 0.5);
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}
.nickname-avatar-trigger:hover .nickname-avatar-preview-card {
  border-color: var(--line-glow);
  box-shadow: var(--glow-amber);
  transform: translateY(-2px);
}
.nickname-avatar-preview { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.nickname-avatar-preview-image {
  width: 96px; height: 96px;
  border-radius: var(--r-xl);
  object-fit: cover;
  border: 2px solid var(--accent);
  background: var(--bg-elev);
  box-shadow: var(--glow-amber);
}
.nickname-avatar-preview-copy { display: grid; gap: 8px; min-width: 0; }

.nickname-avatar-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  max-height: min(64vh, 600px);
  overflow: auto;
  padding-right: 6px;
}
.nickname-avatar-option {
  display: grid; gap: 8px; justify-items: center;
  padding: 12px 8px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: rgba(28, 25, 23, 0.6);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.nickname-avatar-option:hover {
  transform: translateY(-3px) scale(1.04);
  border-color: var(--line-glow);
  box-shadow: var(--glow-amber);
  background: rgba(52, 46, 44, 0.7);
}
.nickname-avatar-option-image {
  width: 64px; height: 64px;
  border-radius: var(--r-md);
  object-fit: cover;
  background: var(--bg-elev);
}
.nickname-avatar-option-label { font-size: 0.74rem; color: var(--muted); font-weight: 600; }
.nickname-avatar-option-active {
  border-color: var(--accent);
  background: rgba(245, 158, 11, 0.14);
  box-shadow: var(--glow-amber);
}

/* ──────────────────────────────────────────────────────────────────
   14. Modals
   ────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(10px);
  display: grid; place-items: center;
  padding: 24px;
  z-index: 40;
}
.modal-card {
  width: min(100%, 480px);
  display: grid; gap: 18px;
  padding: 28px;
  border-radius: var(--r-2xl);
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(20px) saturate(140%);
  box-shadow: var(--shadow-deep), 0 0 60px rgba(245, 158, 11, 0.14);
}
.modal-card-wide { width: min(100%, 820px); max-height: min(82vh, 740px); overflow: auto; }
.config-auth-shell { min-height: 56vh; }
.config-auth-backdrop { z-index: 30; }
.config-auth-card { width: min(100%, 420px); }
.config-auth-actions { justify-content: flex-end; }
.how-to-card {
  gap: 22px;
}
.how-to-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}
.how-to-title-group {
  display: grid;
  gap: 6px;
}
.how-to-close {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 999px;
  border: 1px solid rgba(248, 113, 113, 0.34);
  background: rgba(127, 29, 29, 0.18);
  color: #fecaca;
  cursor: pointer;
  position: relative;
}
.how-to-close::before,
.how-to-close::after {
  content: "";
  position: absolute;
  left: 11px;
  right: 11px;
  top: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}
.how-to-close::before { transform: rotate(45deg); }
.how-to-close::after { transform: rotate(-45deg); }
.how-to-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.how-to-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px;
  border-radius: var(--r-md);
  border: 1px solid rgba(168, 162, 158, 0.16);
  background: rgba(12, 10, 9, 0.32);
}
.how-to-item-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: #fde68a;
  background-color: currentColor;
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.14);
}
.how-to-item strong {
  display: block;
  margin-bottom: 5px;
  font-family: "Outfit", sans-serif;
}
.how-to-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}
.how-to-item-move .how-to-item-icon {
  color: #93c5fd;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg width='42' height='42' viewBox='0 0 42 42' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21 4 29 12h-5v6h6v-5l8 8-8 8v-5h-6v6h5l-8 8-8-8h5v-6h-6v5l-8-8 8-8v5h6v-6h-5l8-8Z' fill='black'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg width='42' height='42' viewBox='0 0 42 42' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21 4 29 12h-5v6h6v-5l8 8-8 8v-5h-6v6h5l-8 8-8-8h5v-6h-6v5l-8-8 8-8v5h6v-6h-5l8-8Z' fill='black'/%3E%3C/svg%3E");
}
.how-to-item-bomb .how-to-item-icon {
  color: #d6d3d1;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg width='42' height='42' viewBox='0 0 42 42' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M23 6h6v5h-6V6Zm6 2h5v3h-5V8Zm-8 8a11 11 0 1 1 0 22 11 11 0 0 1 0-22Zm-3 5a5 5 0 0 0-5 5h4a1 1 0 0 1 1-1v-4Z' fill='black'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg width='42' height='42' viewBox='0 0 42 42' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M23 6h6v5h-6V6Zm6 2h5v3h-5V8Zm-8 8a11 11 0 1 1 0 22 11 11 0 0 1 0-22Zm-3 5a5 5 0 0 0-5 5h4a1 1 0 0 1 1-1v-4Z' fill='black'/%3E%3C/svg%3E");
}
.how-to-item-powerups .how-to-item-icon {
  color: #86efac;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg width='42' height='42' viewBox='0 0 42 42' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21 4 25.5 15H37l-9.3 6.8L31.2 33 21 26.2 10.8 33l3.5-11.2L5 15h11.5L21 4Z' fill='black'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg width='42' height='42' viewBox='0 0 42 42' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21 4 25.5 15H37l-9.3 6.8L31.2 33 21 26.2 10.8 33l3.5-11.2L5 15h11.5L21 4Z' fill='black'/%3E%3C/svg%3E");
}
.how-to-item-win .how-to-item-icon {
  color: #facc15;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg width='42' height='42' viewBox='0 0 42 42' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 6h20v5h5v6c0 5.2-3.8 9.4-9 10.2A8.3 8.3 0 0 1 23 30v4h6v4H13v-4h6v-4a8.3 8.3 0 0 1-4-2.8c-5.2-.8-9-5-9-10.2v-6h5V6Zm20 9v7.4c1.9-1 3-2.9 3-5.4v-2h-3Zm-23 0v2c0 2.5 1.1 4.4 3 5.4V15H8Z' fill='black'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg width='42' height='42' viewBox='0 0 42 42' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 6h20v5h5v6c0 5.2-3.8 9.4-9 10.2A8.3 8.3 0 0 1 23 30v4h6v4H13v-4h6v-4a8.3 8.3 0 0 1-4-2.8c-5.2-.8-9-5-9-10.2v-6h5V6Zm20 9v7.4c1.9-1 3-2.9 3-5.4v-2h-3Zm-23 0v2c0 2.5 1.1 4.4 3 5.4V15H8Z' fill='black'/%3E%3C/svg%3E");
}
@keyframes modal-fade  { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-pop   { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ──────────────────────────────────────────────────────────────────
   15. Arena board
   ────────────────────────────────────────────────────────────────── */
.arena-board {
  display: grid;
  position: relative;
  padding: 18px;
  border-radius: var(--r-xl);
  background:
    radial-gradient(ellipse at center, rgba(245, 158, 11, 0.03) 0%, transparent 70%),
    rgba(0, 0, 0, 0.5);
  border: 1px solid var(--line);
  box-shadow:
    inset 0 0 80px rgba(0, 0, 0, 0.75),
    0 22px 60px rgba(0, 0, 0, 0.5),
    0 0 32px rgba(245, 158, 11, 0.06);
  isolation: isolate;
}
/* The three layers stack via grid-area auto-placement on a single cell. */
.arena-board > .arena-layer {
  grid-row: 1;
  grid-column: 1;
}
.arena-layer {
  display: grid;
  gap: 5px;
  width: 100%;
  height: 100%;
}
.arena-layer-static {
  z-index: 1;
}
.arena-layer-low {
  z-index: 2;
  pointer-events: none;
  will-change: transform;
  transform: translateZ(0);
}
.arena-layer-high {
  z-index: 3;
  pointer-events: none;
  will-change: transform;
  transform: translateZ(0);
  contain: layout style;
}
.arena-layer-players {
  z-index: 4;
  pointer-events: none;
  will-change: transform;
  transform: translateZ(0);
  contain: layout style;
}
.arena-overlay-slot {
  position: relative;
  display: grid;
  place-items: center;
  will-change: transform;
}
.arena-cell {
  aspect-ratio: 1/1;
  min-height: 36px;
  border-radius: 6px;
  position: relative;
  background: transparent;
}
.arena-cell.arena-floor { background: rgba(214, 211, 209, 0.03); border: 1px solid rgba(214, 211, 209, 0.04); }
.arena-cell.arena-wall-tile {
  background: linear-gradient(180deg, #6b6460 0%, #44403c 100%);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255,255,255,0.08), inset 0 0 0 1px rgba(107, 100, 96, 0.6);
}
.arena-cell.arena-wall-tile::after {
  content: "";
  position: absolute; inset: 18% 40%;
  background:
    linear-gradient(to right, transparent 48%, rgba(0,0,0,0.28) 48%, rgba(0,0,0,0.28) 52%, transparent 52%),
    linear-gradient(to bottom, transparent 48%, rgba(0,0,0,0.28) 48%, rgba(0,0,0,0.28) 52%, transparent 52%);
  opacity: 0.7;
}
.arena-cell.arena-block-tile {
  background: linear-gradient(180deg, #d97706 0%, #92400e 100%);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.30), inset 0 1px 0 rgba(254,243,199,0.22), inset 0 0 0 1px rgba(146, 64, 14, 0.7);
}
.arena-cell.arena-block-tile::before {
  content: "";
  position: absolute; inset: 12%;
  background:
    linear-gradient(45deg, transparent calc(50% - 1.5px), rgba(0,0,0,0.40) calc(50% - 1.5px), rgba(0,0,0,0.40) calc(50% + 1.5px), transparent calc(50% + 1.5px)),
    linear-gradient(-45deg, transparent calc(50% - 1.5px), rgba(0,0,0,0.40) calc(50% - 1.5px), rgba(0,0,0,0.40) calc(50% + 1.5px), transparent calc(50% + 1.5px));
  border-radius: 4px;
  border: 1px solid rgba(120, 53, 15, 0.7);
}
.arena-cell-explosion { animation: ex-flash 360ms ease-out 1; }

/* PNG-sprite soft block: no gradient/pseudo, just the spritesheet background */
.arena-cell.arena-png-block {
  background-repeat: no-repeat;
  background-color: transparent;
}

/* ──────────────────────────────────────────────────────────────────
   15b. Live HUD overlay (top-right, position: fixed)
   ────────────────────────────────────────────────────────────────── */
.hud-overlay {
  position: fixed;
  top: 96px;
  right: 24px;
  z-index: 30;
  width: 230px;
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: var(--r-lg);
  background:
    linear-gradient(135deg, rgba(74, 222, 128, 0.08), transparent 50%),
    linear-gradient(225deg, rgba(245, 158, 11, 0.07), transparent 50%),
    rgba(28, 25, 23, 0.96);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), 0 0 24px rgba(74, 222, 128, 0.12);
  color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.82rem;
}
.hud-overlay.hud-warn { border-color: rgba(239, 68, 68, 0.55); box-shadow: var(--shadow), 0 0 24px rgba(239, 68, 68, 0.30); }
.hud-row { display: flex; align-items: baseline; gap: 8px; }
.hud-row-thin { font-size: 0.74rem; color: var(--muted); }
.hud-label {
  font-family: "Outfit", sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
}
.hud-value {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.hud-value-large {
  font-family: "Outfit", sans-serif;
  font-size: 2rem;
  line-height: 1;
  font-weight: 800;
  background: linear-gradient(180deg, #f59e0b, #fb923c);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  text-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
}
.hud-warn .hud-value-large {
  background: linear-gradient(180deg, #f87171, #ef4444);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.hud-target { font-size: 0.76rem; color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }
.hud-bars { padding: 2px 0; }
.hud-fps-bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(28, 25, 23, 0.85);
  overflow: hidden;
  border: 1px solid var(--line);
}
.hud-fps-bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #4ade80 0%, #f59e0b 70%, #ef4444 100%);
  transition: width 120ms ease;
}
.hud-warn .hud-fps-bar-fill {
  background: linear-gradient(90deg, #ef4444, #f87171);
}
.hud-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.hud-stat {
  display: grid; gap: 2px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(28, 25, 23, 0.4);
  border: 1px solid var(--line);
}
.hud-stat-label {
  font-family: "Outfit", sans-serif;
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
}
.hud-stat-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 1180px) {
  .hud-overlay { position: relative; top: 0; right: 0; width: auto; }
}

/* Player stats card — fancier under the HUD */
.players-shell .metric-card {
  padding: 14px;
}
.players-shell .metric-card strong:first-child {
  font-family: "Outfit", sans-serif;
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

/* legend chip */
.arena-legend { display: flex; flex-wrap: wrap; gap: 10px; }

/* ──────────────────────────────────────────────────────────────────
   16. Sprite animations
   ────────────────────────────────────────────────────────────────── */
@keyframes bomb-bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-2px) scale(1.07); }
}
@keyframes spark-flicker {
  0%, 100% { opacity: 1; transform: scale(1); }
  30%      { opacity: 0.4; transform: scale(0.6); }
  60%      { opacity: 1; transform: scale(1.3); }
}
@keyframes spark-glow {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%      { opacity: 0.2; transform: scale(0.7); }
}
@keyframes ex-pulse {
  0%, 100% { transform: scale(0.9); opacity: 0.95; }
  50%      { transform: scale(1.1); opacity: 1; }
}
@keyframes ex-rotate {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes ex-flash {
  0%   { transform: scale(0.6); opacity: 0; }
  40%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes gift-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}
@keyframes gift-halo {
  0%, 100% { opacity: 0.35; transform: scale(1); }
  50%      { opacity: 0.75; transform: scale(1.18); }
}
@keyframes spawn-rotate {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes player-pulse {
  0%   { opacity: 0.9; transform: scale(1); }
  70%  { opacity: 0;   transform: scale(1.9); }
  100% { opacity: 0;   transform: scale(1.9); }
}
@keyframes player-cell-move {
  from { transform: translate(var(--player-move-from-x, 0%), var(--player-move-from-y, 0%)); }
  to   { transform: translate(0%, 0%); }
}
.sprite-bomb        { animation: bomb-bounce var(--anim-bomb-bounce-ms) ease-in-out infinite; transform-origin: 50% 90%; }
.sprite-bomb .spark { animation: spark-flicker var(--anim-bomb-spark-ms) ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
.sprite-bomb .spark-halo { animation: spark-glow var(--anim-bomb-spark-ms) ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
.sprite-explosion-inner { animation: ex-pulse var(--anim-explosion-pulse-ms) ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
.sprite-explosion-ring  { animation: ex-rotate var(--anim-explosion-rotate-ms) linear infinite; transform-origin: center; transform-box: fill-box; }
.sprite-gift          { animation: gift-bob var(--anim-gift-bob-ms) ease-in-out infinite; }
.sprite-gift .halo    { animation: gift-halo var(--anim-gift-bob-ms) ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
.sprite-spawn-ring    { animation: spawn-rotate var(--anim-spawn-rotate-ms) linear infinite; transform-origin: center; transform-box: fill-box; }
.sprite-player-local { border-radius: 999px; }
.sprite-player-local::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  border: 3px solid var(--accent);
  background: transparent;
  animation: player-pulse var(--anim-player-pulse-ms) ease-out infinite;
  pointer-events: none;
  transform-origin: center;
}
.sprite-bomb, .sprite-bomb .spark, .sprite-bomb .spark-halo,
.sprite-explosion-inner, .sprite-explosion-ring,
.sprite-gift, .sprite-gift .halo,
.sprite-spawn-ring, .sprite-player-local::after {
  animation-play-state: var(--anim-play-state, running);
}
.sprite-cell { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.sprite-cell svg { width: 82%; height: 82%; overflow: visible; }
.sprite-cell.sprite-cell-fill svg { width: 100%; height: 100%; }
@media (prefers-reduced-motion: reduce) {
  .sprite-bomb, .sprite-explosion-inner, .sprite-explosion-ring,
  .sprite-gift, .sprite-spawn-ring, .sprite-player-local::after,
  .sprite-bomb .spark, .sprite-bomb .spark-halo, .sprite-gift .halo,
  .arena-overlay-slot,
  body::before { animation: none !important; }
}

/* Disable animations inside the designer grid + brush palette */
.designer-grid .sprite-bomb,
.designer-grid .sprite-explosion-inner,
.designer-grid .sprite-explosion-ring,
.designer-grid .sprite-gift,
.designer-grid .sprite-spawn-ring,
.designer-grid .sprite-bomb .spark,
.designer-grid .sprite-bomb .spark-halo,
.designer-grid .sprite-gift .halo,
.brush-tile .sprite-bomb,
.brush-tile .sprite-explosion-inner,
.brush-tile .sprite-explosion-ring,
.brush-tile .sprite-gift,
.brush-tile .sprite-spawn-ring,
.brush-tile .sprite-bomb .spark,
.brush-tile .sprite-bomb .spark-halo,
.brush-tile .sprite-gift .halo,
.level-card .sprite-bomb,
.level-card .sprite-spawn-ring,
.level-card .sprite-gift,
.powerup-picker-sprite .sprite-gift,
.powerup-picker-sprite .sprite-gift .halo {
  animation: none !important;
}
.brush-tile:hover .sprite-bomb,
.brush-tile:hover .sprite-gift,
.brush-tile:hover .sprite-spawn-ring,
.designer-cell:hover .sprite-bomb,
.designer-cell:hover .sprite-gift,
.designer-cell:hover .sprite-spawn-ring {
  animation-play-state: running !important;
  animation: bomb-bounce var(--anim-bomb-bounce-ms) ease-in-out infinite;
}
.brush-tile:hover .sprite-gift { animation: gift-bob var(--anim-gift-bob-ms) ease-in-out infinite; }
.brush-tile:hover .sprite-spawn-ring { animation: spawn-rotate var(--anim-spawn-rotate-ms) linear infinite; }

/* player marker */
.player-marker {
  width: 84%; height: 84%;
  border-radius: 999px;
  background: rgba(28, 25, 23, 0.92);
  border: 3px solid;
  display: grid; place-items: center;
  font-family: "Outfit", sans-serif;
  font-weight: 900;
  font-size: 1rem;
  color: #fff;
  position: relative;
  z-index: 2;
}
.player-marker-A { border-color: var(--spawn-a); box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.22), 0 0 18px rgba(56, 189, 248, 0.5); }
.player-marker-B { border-color: var(--spawn-b); box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.22), 0 0 18px rgba(251, 146, 60, 0.5); }
.player-marker-C { border-color: var(--spawn-c); box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.22), 0 0 18px rgba(74, 222, 128, 0.5); }
.player-marker-D { border-color: var(--spawn-d); box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.22), 0 0 18px rgba(250, 204, 21, 0.5); }

/* ──────────────────────────────────────────────────────────────────
   16b. Entity animation configuration panel
   ────────────────────────────────────────────────────────────────── */

.entity-animation-panel,
.entity-animation-layout,
.entity-animation-editor,
.entity-animation-preview-card {
  min-width: 0;
}

.entity-animation-panel {
  gap: 18px;
}

.entity-animation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(220px, 0.75fr);
  gap: 18px;
  align-items: start;
}

.entity-animation-editor {
  display: grid;
  gap: 14px;
}

.entity-animation-field-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.entity-animation-top-config {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
}

.entity-animation-config-column {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
}

.entity-animation-pair-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

/* ── Section title with filmstrip icon ── */
.entity-animation-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.entity-animation-section-title::before {
  content: '';
  flex-shrink: 0;
  width: 22px; height: 16px;
  background-color: var(--accent);
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 16'%3E%3Crect width='22' height='16' rx='2'/%3E%3Crect x='1.5' y='2' width='3.5' height='2.5' rx='.5' fill='white'/%3E%3Crect x='1.5' y='6.8' width='3.5' height='2.5' rx='.5' fill='white'/%3E%3Crect x='1.5' y='11.5' width='3.5' height='2.5' rx='.5' fill='white'/%3E%3Crect x='17' y='2' width='3.5' height='2.5' rx='.5' fill='white'/%3E%3Crect x='17' y='6.8' width='3.5' height='2.5' rx='.5' fill='white'/%3E%3Crect x='17' y='11.5' width='3.5' height='2.5' rx='.5' fill='white'/%3E%3C/svg%3E");
  mask-repeat: no-repeat; mask-size: contain; mask-position: center;
  opacity: 0.85;
}

/* ── Custom select — SVG chevron + appearance reset ── */
.ea-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M0.5 0.5L5 5.5L9.5 0.5' fill='none' stroke='%23f59e0b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 10px 6px;
  padding-right: 36px;
  cursor: pointer;
}
.ea-select:focus { border-color: var(--accent); }

/* ── Number field: centered mono value, label as muted eyebrow ── */
.ea-num-field {
  text-align: center;
  gap: 6px;
}
.ea-num-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
.ea-num-input {
  text-align: center;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 700;
  font-size: 1rem;
  min-width: 0;
  padding: 8px 4px;
  -moz-appearance: textfield;
}
.ea-num-input::-webkit-outer-spin-button,
.ea-num-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.ea-stepper {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 30px;
  align-items: stretch;
  min-width: 0;
}

.ea-stepper .ea-num-input {
  border-radius: 0;
}

.ea-stepper-button {
  display: grid;
  place-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  background: rgba(28, 25, 23, 0.82);
  color: var(--accent);
  cursor: pointer;
  font-weight: 900;
  line-height: 1;
}

.ea-stepper-button:first-child {
  border-radius: var(--r-md) 0 0 var(--r-md);
  border-right: 0;
}

.ea-stepper-button:last-child {
  border-radius: 0 var(--r-md) var(--r-md) 0;
  border-left: 0;
}

.ea-stepper-button:hover {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.36);
  color: var(--text);
}

/* ── Generic number-stepper (matches ea-stepper design) ── */
.number-stepper-group {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 30px;
  align-items: stretch;
  min-width: 0;
}

.number-stepper-input {
  border-radius: 0;
  text-align: center;
  font-family: 'JetBrains Mono', 'Fira Mono', monospace;
  font-size: 0.85rem;
  background: rgba(28, 25, 23, 0.65);
  color: var(--text);
  border: 1px solid var(--line);
  border-left: 0;
  border-right: 0;
  width: 100%;
  min-width: 0;
  padding: 6px 4px;
}
.number-stepper-input::-webkit-outer-spin-button,
.number-stepper-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.number-stepper-input[type=number] { -moz-appearance: textfield; }

.number-stepper-button {
  display: grid;
  place-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  background: rgba(28, 25, 23, 0.82);
  color: var(--accent);
  cursor: pointer;
  font-weight: 900;
  line-height: 1;
}

.number-stepper-button:first-child {
  border-radius: var(--r-md) 0 0 var(--r-md);
  border-right: 0;
}

.number-stepper-button:last-child {
  border-radius: 0 var(--r-md) var(--r-md) 0;
  border-left: 0;
}

.number-stepper-button:hover {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.36);
  color: var(--text);
}

/* ── Full-width fields in the field grid ── */
.entity-animation-field-grid .ea-field-fullwidth {
  grid-column: 1 / -1;
}

/* ── Preview card — warm charcoal, contained ── */
.entity-animation-preview-card {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: linear-gradient(160deg, rgba(44, 37, 32, 0.97) 0%, rgba(24, 20, 17, 0.98) 100%);
  border-color: rgba(245, 158, 11, 0.22);
  box-shadow: 0 0 40px rgba(245, 158, 11, 0.06), 0 0 0 1px rgba(245, 158, 11, 0.08) inset, var(--shadow);
  overflow: hidden;
  min-height: 0;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.entity-animation-preview-card::before {
  content: '';
  position: absolute; top: 0; left: 20px; right: 20px; height: 1.5px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  border-radius: var(--r-pill); pointer-events: none;
}

/* ── Preview stage — responsive square, amber checkerboard ── */
.entity-animation-preview-stage {
  display: grid;
  place-items: center;
  box-sizing: border-box;
  min-height: 0;
  aspect-ratio: 1 / 1;
  max-height: min(260px, 100%);
  position: relative;
  border-radius: 18px;
  border: 1px solid rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.14);
  background:
    linear-gradient(45deg,  rgba(245, 158, 11, 0.055) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(245, 158, 11, 0.055) 25%, transparent 25%),
    linear-gradient(45deg,  transparent 75%, rgba(245, 158, 11, 0.055) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(245, 158, 11, 0.055) 75%),
    rgba(14, 11, 9, 0.72);
  background-size: 20px 20px, 20px 20px, 20px 20px, 20px 20px, auto;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0, 0 0;
  overflow: hidden;
  width: min(100%, 240px);
  justify-self: center;
  margin-bottom: -2px;
}

.entity-animation-preview-frame {
  /* width/height set by spritePreviewStyle() to match frame aspect ratio */
  max-width: 100%;
  max-height: 100%;
  background-repeat: no-repeat;
  background-color: transparent;
  filter: drop-shadow(0 16px 22px rgba(0, 0, 0, 0.32));
}

/* ── Corner bracket decorations ── */
.ea-corner {
  position: absolute; display: block;
  width: 14px; height: 14px;
  border-color: var(--accent); border-style: solid;
  opacity: 0.45; pointer-events: none;
  transition: opacity 200ms ease;
}
.entity-animation-preview-stage:hover .ea-corner { opacity: 0.75; }
.ea-corner-tl { top: 8px;    left: 8px;  border-width: 2px 0 0 2px; border-radius: 3px 0 0 0; }
.ea-corner-tr { top: 8px;    right: 8px; border-width: 2px 2px 0 0; border-radius: 0 3px 0 0; }
.ea-corner-bl { bottom: 8px; left: 8px;  border-width: 0 0 2px 2px; border-radius: 0 0 0 3px; }
.ea-corner-br { bottom: 8px; right: 8px; border-width: 0 2px 2px 0; border-radius: 0 0 3px 0; }

/* ── Playback toolbar — icon-only compact pill ── */
.entity-animation-toolbar {
  display: flex;
  gap: 4px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 4px;
  background: rgba(14, 11, 9, 0.72);
  border: 1px solid rgba(245, 158, 11, 0.14);
  border-radius: var(--r-pill);
  flex-shrink: 0;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.ea-ctrl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  line-height: 1;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
  flex-shrink: 0;
}
.ea-ctrl-btn:hover {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.28);
  color: var(--text);
}
.ea-ctrl-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ea-ctrl-btn-active {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.42);
  color: var(--accent);
}
.ea-ctrl-btn-active:hover {
  background: rgba(245, 158, 11, 0.26);
  border-color: rgba(245, 158, 11, 0.58);
}

.ea-loop-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(245, 158, 11, 0.16);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.ea-loop-toggle:hover {
  background: rgba(245, 158, 11, 0.10);
  border-color: rgba(245, 158, 11, 0.30);
  color: var(--text);
}

.ea-loop-toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent);
}

/* ── Info box — terminal / HUD readout ── */
.entity-animation-info-box {
  background: rgba(14, 11, 9, 0.82);
  border-color: rgba(245, 158, 11, 0.10);
  font-family: 'JetBrains Mono', ui-monospace, 'Cascadia Code', monospace;
  font-size: 0.78rem;
  gap: 0; padding: 10px 12px;
  flex-shrink: 0;
  display: grid;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.ea-info-row {
  display: flex; align-items: baseline; gap: 8px;
  min-width: 0;
  padding: 5px 0;
  border-bottom: 1px solid rgba(245, 158, 11, 0.07);
}
.ea-info-row:first-child { padding-top: 0; }
.ea-info-row:last-child  { border-bottom: none; padding-bottom: 0; }
.ea-info-label {
  flex-shrink: 0; min-width: 46px;
  font-size: 0.67rem; letter-spacing: 0.10em; text-transform: uppercase;
  color: var(--muted-2);
}
.ea-info-value {
  min-width: 0; color: var(--accent); font-weight: 700;
  flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ea-info-value-path { color: var(--cool); font-weight: 400; font-size: 0.74rem; }

@media (max-width: 980px) {
  .entity-animation-layout {
    grid-template-columns: 1fr;
  }

  .entity-animation-preview-card {
    position: static;
  }
}

@media (max-width: 760px) {
  .entity-animation-top-config {
    grid-template-columns: 1fr;
  }
}

/* ── Action bar — save / reset / reload icon buttons ── */
.ea-action-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.ea-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: var(--r-md);
  border: 1px solid rgba(245, 158, 11, 0.22);
  background: rgba(44, 37, 32, 0.90);
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.ea-action-btn:hover {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.42);
  color: var(--text);
}
.ea-action-btn:disabled { opacity: 0.35; cursor: progress; pointer-events: none; }
.ea-action-btn-save {
  color: var(--accent);
  border-color: rgba(245, 158, 11, 0.38);
  background: rgba(245, 158, 11, 0.08);
}
.ea-action-btn-save:hover {
  background: rgba(245, 158, 11, 0.22);
  border-color: rgba(245, 158, 11, 0.65);
}
.ea-action-btn-saving { opacity: 0.55; cursor: progress; }

/* ── Frame pattern chip editor ── */
.ea-pattern-editor {
  grid-column: 1 / -1;
  gap: 10px;
}
.ea-pattern-header {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.ea-pattern-title-row {
  display: flex; align-items: center; gap: 8px;
}
.ea-pattern-badge {
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em;
  background: rgba(245, 158, 11, 0.10);
  border: 1px solid rgba(245, 158, 11, 0.22);
  color: var(--muted);
}
.ea-pattern-badge-custom {
  background: rgba(74, 222, 128, 0.10);
  border-color: rgba(74, 222, 128, 0.30);
  color: var(--cool);
}

/* Sequence row — horizontally scrollable chip list */
.ea-pattern-sequence {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 52px;
  padding: 8px;
  border-radius: var(--r-md);
  background: rgba(14, 11, 9, 0.60);
  border: 1px solid rgba(245, 158, 11, 0.10);
  align-content: flex-start;
}
.ea-pattern-empty {
  color: var(--muted-2);
  font-size: 0.80rem;
  align-self: center;
  padding: 4px 4px;
}

/* Frame chip: clickable [N | ×] with selection state */
.ea-frame-chip {
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-sm);
  border: 1px solid rgba(245, 158, 11, 0.28);
  background: rgba(44, 37, 32, 0.90);
  overflow: hidden;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
  transition: border-color 100ms ease, box-shadow 100ms ease, background 100ms ease;
}
.ea-frame-chip:hover {
  border-color: rgba(245, 158, 11, 0.55);
  background: rgba(44, 37, 32, 1);
}
.ea-frame-chip-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25), 0 0 8px rgba(245, 158, 11, 0.18);
}
.ea-chip-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  padding: 0 6px;
  height: 30px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.80rem;
  font-weight: 700;
  color: var(--accent);
  transition: background 100ms ease, color 100ms ease;
}
.ea-frame-chip-selected .ea-chip-num {
  background: var(--accent);
  color: #1a1209;
}
.ea-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 30px;
  border: none;
  border-left: 1px solid rgba(245, 158, 11, 0.16);
  background: transparent;
  color: var(--muted-2);
  font-size: 0.80rem;
  cursor: pointer;
  line-height: 1;
  transition: background 100ms ease, color 100ms ease;
  padding: 0;
  font-family: inherit;
}
.ea-chip-remove:hover { background: rgba(239, 68, 68, 0.18); color: var(--danger-2); }

/* Global move arrows + add picker — unified control bar */
.ea-pattern-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.ea-move-btn {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(245, 158, 11, 0.30);
  background: rgba(44, 37, 32, 0.90);
  color: var(--accent);
  font-size: 0.80rem;
  cursor: pointer;
  transition: background 100ms ease, border-color 100ms ease, box-shadow 100ms ease;
  padding: 0;
  flex-shrink: 0;
}
.ea-move-btn:hover:not(:disabled) {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.60);
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.20);
}
.ea-move-btn:disabled {
  opacity: 0.28;
  cursor: default;
  pointer-events: none;
}
.ea-pattern-controls-sep {
  width: 1px;
  height: 28px;
  background: rgba(245, 158, 11, 0.15);
  flex-shrink: 0;
  margin: 0 3px;
}

/* Frame picker — numbered add buttons */
.ea-pattern-picker-label {
  font-size: 0.70rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted-2);
  margin-right: 2px; flex-shrink: 0;
}
.ea-frame-add-btn {
  display: inline-flex;
  align-items: center; justify-content: center;
  min-width: 28px; height: 28px;
  padding: 0 4px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(245, 158, 11, 0.22);
  background: rgba(44, 37, 32, 0.70);
  color: var(--muted);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.75rem; font-weight: 700;
  cursor: pointer;
  transition: background 100ms ease, color 100ms ease, border-color 100ms ease;
  line-height: 1;
}
.ea-frame-add-btn:hover {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.50);
  color: var(--accent);
}

/* ──────────────────────────────────────────────────────────────────
   17. Countdown overlay
   ────────────────────────────────────────────────────────────────── */
.arena-frame { position: relative; min-height: 220px; }
.game-shell-paused .arena-board { filter: brightness(0.55) saturate(0.7); }
.game-shell {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  overflow: hidden;
  background:
    radial-gradient(circle at 72% 18%, rgba(74, 222, 128, 0.07), transparent 32%),
    radial-gradient(circle at 22% 80%, rgba(245, 158, 11, 0.08), transparent 34%),
    rgba(41, 37, 36, 0.96);
}
.game-shell::before { display: none; }
.game-play-area {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 10px;
}
.game-action-sidebar {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-content: stretch;
  gap: 12px;
  padding: 10px;
  border-radius: 22px;
  border: 1px solid rgba(214, 211, 209, 0.13);
  background:
    linear-gradient(180deg, rgba(74, 222, 128, 0.08), rgba(245, 158, 11, 0.05)),
    rgba(28, 25, 23, 0.72);
  box-shadow: inset 0 0 26px rgba(0, 0, 0, 0.28);
}
.game-sidebar-hud {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(74, 222, 128, 0.18);
  background:
    linear-gradient(135deg, rgba(74, 222, 128, 0.10), transparent 56%),
    rgba(28, 25, 23, 0.62);
  overflow: hidden;
}
.game-sidebar-hud-warn {
  border-color: rgba(248, 113, 113, 0.38);
  box-shadow: inset 0 0 20px rgba(127, 29, 29, 0.18);
}
.game-sidebar-fps {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(214, 211, 209, 0.11);
}
.game-sidebar-fps .hud-fps-bar {
  grid-column: 1 / -1;
}
.game-sidebar-fps-main,
.game-sidebar-fps-worst {
  min-width: 0;
  display: grid;
  gap: 4px;
  align-content: start;
}
.game-sidebar-hud-label,
.game-sidebar-hud-stat span,
.game-sidebar-player-row span {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.game-sidebar-fps-main strong {
  color: var(--accent);
  font-family: "Outfit", sans-serif;
  font-size: 2.35rem;
  line-height: 0.95;
  text-shadow: 0 0 18px rgba(245, 158, 11, 0.28);
}
.game-sidebar-fps-worst strong {
  color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.95rem;
}
.game-sidebar-fps-main > span:last-of-type {
  color: var(--muted);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
}
.game-sidebar-hud-grid {
  min-height: 0;
  display: grid;
  gap: 7px;
  align-content: start;
  overflow: hidden;
}
.game-sidebar-hud-stat {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgba(214, 211, 209, 0.10);
  background: rgba(0, 0, 0, 0.16);
}
.game-sidebar-hud-stat strong {
  min-width: 0;
  color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.88rem;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.game-sidebar-players {
  min-height: 0;
  display: grid;
  gap: 7px;
  align-content: start;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(245, 158, 11, 0.16);
  background: rgba(28, 25, 23, 0.54);
  overflow: hidden;
}
.game-sidebar-player-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 12px;
  border: 1px solid rgba(214, 211, 209, 0.09);
  background: rgba(0, 0, 0, 0.14);
}
.game-sidebar-player-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.game-sidebar-player-row strong {
  color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  white-space: nowrap;
}
.game-sidebar-player-row-local {
  border-color: rgba(74, 222, 128, 0.36);
  background: rgba(74, 222, 128, 0.10);
}
.game-side-button {
  min-width: 0;
  min-height: 58px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 5px;
  padding: 8px 6px;
  border-radius: 16px;
  border: 1px solid rgba(214, 211, 209, 0.12);
  background: rgba(28, 25, 23, 0.74);
  color: var(--text);
  font-size: 0.66rem;
  font-weight: 900;
  cursor: pointer;
}
.game-side-button:hover {
  border-color: rgba(245, 158, 11, 0.34);
  background: rgba(52, 46, 44, 0.86);
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.12);
}
.game-side-button-icon {
  width: 22px;
  height: 22px;
  background: currentColor;
}
.game-side-button-home .game-side-button-icon {
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 10.2 11 3l8 7.2v8.3h-5.2v-5.4H8.2v5.4H3v-8.3Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 10.2 11 3l8 7.2v8.3h-5.2v-5.4H8.2v5.4H3v-8.3Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
}
.game-side-button-waiting .game-side-button-icon {
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 3h10v5.2L12.8 11l3.2 2.8V19H6v-5.2L9.2 11 6 8.2V3Zm2 2v2.3l4.2 3.7L8 14.7V17h6v-2.3L9.8 11 14 7.3V5H8Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 3h10v5.2L12.8 11l3.2 2.8V19H6v-5.2L9.2 11 6 8.2V3Zm2 2v2.3l4.2 3.7L8 14.7V17h6v-2.3L9.8 11 14 7.3V5H8Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
}
.game-side-button-reconnect .game-side-button-icon {
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M17.6 7.4A7.2 7.2 0 0 0 5.2 6L3.7 4.5v5.2H9L6.7 7.4a5.2 5.2 0 0 1 9.1 1.2l1.8-1.2ZM4.4 14.6A7.2 7.2 0 0 0 16.8 16l1.5 1.5v-5.2H13l2.3 2.3a5.2 5.2 0 0 1-9.1-1.2l-1.8 1.2Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M17.6 7.4A7.2 7.2 0 0 0 5.2 6L3.7 4.5v5.2H9L6.7 7.4a5.2 5.2 0 0 1 9.1 1.2l1.8-1.2ZM4.4 14.6A7.2 7.2 0 0 0 16.8 16l1.5 1.5v-5.2H13l2.3 2.3a5.2 5.2 0 0 1-9.1-1.2l-1.8 1.2Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
}
.game-side-button-results .game-side-button-icon {
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 4h12v3H5V4Zm0 5h12v9H5V9Zm2 2v5h8v-5H7Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 4h12v3H5V4Zm0 5h12v9H5V9Zm2 2v5h8v-5H7Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
}
.game-side-button-leave {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.25);
}
.game-side-button-leave .game-side-button-icon {
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 4h8v2H6v12h6v2H4V4Zm10.8 4.2 1.4-1.4L20.4 11l-4.2 4.2-1.4-1.4 1.8-1.8H10v-2h6.6l-1.8-1.8Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='22' height='22' viewBox='0 0 22 22' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 4h8v2H6v12h6v2H4V4Zm10.8 4.2 1.4-1.4L20.4 11l-4.2 4.2-1.4-1.4 1.8-1.8H10v-2h6.6l-1.8-1.8Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
}
.game-player-strip {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}
.game-player-chip {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(214, 211, 209, 0.12);
  background: rgba(28, 25, 23, 0.64);
  color: var(--muted);
  font-size: 0.76rem;
  white-space: nowrap;
}
.game-player-chip strong {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.18);
  color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, monospace;
}
.game-player-chip em {
  color: var(--muted);
  font-style: normal;
}
.game-player-chip-local {
  border-color: rgba(74, 222, 128, 0.36);
  background: rgba(74, 222, 128, 0.10);
  color: var(--text);
  box-shadow: 0 0 18px rgba(74, 222, 128, 0.10);
}
.game-shell .arena-frame {
  min-height: 0;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 10px;
  border-radius: 24px;
  border: 1px solid rgba(214, 211, 209, 0.10);
  background:
    linear-gradient(135deg, rgba(245, 158, 11, 0.07), rgba(74, 222, 128, 0.05)),
    rgba(28, 25, 23, 0.50);
  overflow: hidden;
}
.arena-mount-slot {
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}
.game-shell .arena-board {
  width: min(100%, calc((100dvh - 144px) * var(--arena-cols, 1) / var(--arena-rows, 1)));
  max-height: 100%;
  aspect-ratio: var(--arena-aspect, 1 / 1);
  padding: clamp(6px, 1vmin, 12px);
  border-radius: 20px;
}
.game-shell .arena-layer {
  gap: clamp(2px, 0.42vmin, 5px);
}
.game-shell .arena-cell {
  min-height: 0;
  border-radius: clamp(2px, 0.55vmin, 6px);
}
.game-countdown-overlay {
  position: absolute; inset: 0;
  z-index: 12;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  border-radius: var(--r-xl);
}
.game-countdown-card {
  width: min(100%, 440px);
  display: grid; gap: 16px;
  padding: 32px;
  border-radius: var(--r-2xl);
  border: 1px solid var(--line-2);
  background: var(--panel);
  box-shadow: var(--shadow-deep), 0 0 60px rgba(245, 158, 11, 0.30);
  text-align: center;
}
@keyframes cd-pop { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.game-countdown-card .page-title {
  font-size: clamp(4rem, 12vw, 7rem);
  line-height: 1;
  background: linear-gradient(180deg, #f59e0b 0%, #fb923c 70%, #d97706 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  text-shadow: 0 0 40px rgba(245, 158, 11, 0.5), 0 0 60px rgba(251, 146, 60, 0.3);
  animation: cd-flash 1s ease-in-out infinite alternate;
}
@keyframes cd-flash {
  from { opacity: 0.75; }
  to   { opacity: 1; }
}

/* Game-over overlay (neon theme) */
.game-shell-over .arena-board { filter: brightness(0.4) saturate(0.4); }

.game-over-overlay {
  position: absolute; inset: 0;
  z-index: 14;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(10px);
  border-radius: var(--r-xl);
}

@keyframes go-pop { from { transform: scale(0.92) translateY(8px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }

.game-over-card {
  width: min(100%, 500px);
  display: grid; gap: 14px;
  padding: 28px;
  border-radius: var(--r-2xl);
  border: 1px solid var(--line-2);
  background: var(--panel);
  box-shadow: var(--shadow-deep), 0 0 80px rgba(245, 158, 11, 0.18);
  text-align: center;
  animation: go-pop 0.28s cubic-bezier(.34,1.56,.64,1) both;
}

.game-over-banner {
  display: grid; gap: 6px;
  padding: 16px;
  border-radius: var(--r-xl);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line-2);
}

.game-over-banner-win {
  background: rgba(16, 44, 20, 0.65);
  border-color: rgba(74, 222, 128, 0.4);
  box-shadow: 0 0 40px rgba(74, 222, 128, 0.12);
}

.game-over-eyebrow {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; opacity: 0.6; margin: 0;
}

.game-over-winner-name {
  font-size: clamp(1.7rem, 5vw, 2.6rem); font-weight: 800; line-height: 1.1; margin: 0;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #fb923c 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.game-over-banner-win .game-over-winner-name {
  background: linear-gradient(135deg, #4ade80 0%, #22c55e 50%, #86efac 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.game-over-winner-sub { font-size: 0.8rem; opacity: 0.55; margin: 0; }

.game-over-players { display: grid; gap: 6px; text-align: left; }

.game-over-player-row {
  display: grid;
  grid-template-columns: 1.7rem 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line-1);
  background: rgba(255,255,255,0.03);
}

.game-over-player-row-winner {
  border-color: rgba(250, 204, 21, 0.35);
  background: rgba(40, 34, 0, 0.5);
}

.game-over-player-slot {
  display: grid; place-items: center;
  width: 1.5rem; height: 1.5rem;
  border-radius: 5px;
  font-size: 0.68rem; font-weight: 800; color: #020617;
}

.game-over-player-info { display: grid; gap: 2px; min-width: 0; }
.game-over-player-name { font-size: 0.86rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-over-player-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.game-over-tag { font-size: 0.6rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 5px; border-radius: 4px; }
.game-over-tag-winner { background: rgba(250,204,21,0.18); color: #fde047; }
.game-over-tag-you { background: rgba(148,163,184,0.12); color: #94a3b8; }

.game-over-player-status { font-size: 0.76rem; font-weight: 600; white-space: nowrap; }
.game-over-player-alive { color: var(--accent-green, #4ade80); }
.game-over-player-dead { color: var(--accent-red, #f87171); opacity: 0.65; }

.game-over-player-powerups { display: grid; gap: 1px; font-size: 0.65rem; opacity: 0.45; text-align: right; white-space: nowrap; }

.game-over-actions { display: flex; justify-content: center; gap: 10px; padding-top: 4px; }

@media (max-width: 760px) {
  .game-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .game-action-sidebar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto;
    align-content: stretch;
    padding: 8px;
  }
  .game-sidebar-hud {
    grid-template-rows: auto;
    grid-template-columns: auto minmax(0, 1fr);
  }
  .game-sidebar-players {
    display: none;
  }
  .game-sidebar-hud-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .game-side-button {
    min-height: 48px;
    font-size: 0;
  }
  .game-side-button-icon {
    width: 20px;
    height: 20px;
  }
  .game-shell .arena-board {
    width: min(100%, calc((100dvh - 300px) * var(--arena-cols, 1) / var(--arena-rows, 1)));
  }
}

/* ──────────────────────────────────────────────────────────────────
   18. Level designer — palette + interactive grid
   ────────────────────────────────────────────────────────────────── */
.brush-palette {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 10px;
}
.brush-tile {
  display: grid; place-items: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: rgba(28, 25, 23, 0.6);
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}
.brush-tile:hover { transform: translateY(-2px); border-color: var(--line-glow); box-shadow: var(--glow-amber); }
.brush-tile-active {
  border-color: var(--accent);
  background: rgba(245, 158, 11, 0.14);
  box-shadow: var(--glow-amber);
}
.brush-tile-sprite {
  width: 48px; height: 48px;
  position: relative;
  display: grid; place-items: center;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.4);
}
.brush-tile-label { font-size: 0.78rem; color: var(--muted); font-weight: 700; }
.brush-tile-active .brush-tile-label { color: #fde68a; }

.designer-grid {
  display: grid;
  gap: 3px;
  padding: 16px;
  border-radius: var(--r-xl);
  background:
    radial-gradient(ellipse at center, rgba(245, 158, 11, 0.03) 0%, transparent 60%),
    rgba(0, 0, 0, 0.65);
  border: 1px solid var(--line);
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.8);
  user-select: none;
  overflow: hidden;
}
.designer-row { display: grid; gap: 3px; }
.designer-cell {
  aspect-ratio: 1/1;
  min-height: 30px;
  border-radius: 6px;
  background: rgba(214, 211, 209, 0.03);
  border: 1px solid rgba(214, 211, 209, 0.05);
  position: relative;
  cursor: crosshair;
  transition: transform 80ms ease, background 80ms ease, border-color 80ms ease, box-shadow 80ms ease;
  display: grid; place-items: center;
}
.designer-cell:hover {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.40);
  box-shadow: inset 0 0 0 2px rgba(245, 158, 11, 0.50);
  z-index: 2;
}
.designer-cell-wall, .designer-cell-block { cursor: pointer; }
.designer-cell-wall {
  background: linear-gradient(180deg, #6b6460 0%, #44403c 100%);
  border-color: rgba(107, 100, 96, 0.6);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255,255,255,0.08);
}
.designer-cell-block {
  background: linear-gradient(180deg, #d97706 0%, #92400e 100%);
  border-color: rgba(217, 119, 6, 0.6);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(254,243,199,0.18);
}
.designer-cell-spawn-A { box-shadow: inset 0 0 0 2px #38bdf8; }
.designer-cell-spawn-B { box-shadow: inset 0 0 0 2px #fb923c; }
.designer-cell-spawn-C { box-shadow: inset 0 0 0 2px #4ade80; }
.designer-cell-spawn-D { box-shadow: inset 0 0 0 2px #facc15; }
.designer-cell-overlay {
  position: relative;
  z-index: 2;
  font-family: "Outfit", sans-serif;
  font-weight: 800;
  font-size: 0.95rem;
  color: #fff;
  text-shadow: 0 0 8px rgba(0,0,0,0.7), 0 1px 0 rgba(0,0,0,0.6);
}
.designer-cell-overlay-gift {
  color: #fde047;
  text-shadow: 0 0 10px #fde047;
}
.designer-cell-gift {
  background: linear-gradient(180deg, #d97706 0%, #92400e 100%);
  border-color: rgba(253, 224, 71, 0.55);
  box-shadow: inset 0 0 0 2px rgba(253, 224, 71, 0.45);
}

/* level library cards */
.level-card {
  display: grid;
  min-height: 142px;
  padding: 14px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 24% 18%, rgba(56, 189, 248, 0.16), transparent 32%),
    linear-gradient(135deg, rgba(28, 25, 23, 0.72), rgba(41, 37, 36, 0.54));
  text-align: left;
  cursor: pointer;
  transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
  user-select: none;
}
.level-card-select-btn {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.level-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.level-card:hover {
  transform: translateY(-4px);
  border-color: var(--line-glow);
  box-shadow: var(--shadow), var(--glow-amber);
}
.level-card-selected {
  border-color: var(--accent);
  background:
    radial-gradient(circle at 24% 18%, rgba(245, 158, 11, 0.22), transparent 34%),
    linear-gradient(135deg, rgba(120, 53, 15, 0.34), rgba(28, 25, 23, 0.62));
  box-shadow: var(--glow-amber);
}
.level-card-file-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: block;
  background:
    url("data:image/svg+xml,%3Csvg width='42' height='42' viewBox='0 0 42 42' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 5h14l6 6v26H11V5Z' fill='%23fff7ed'/%3E%3Cpath d='M25 5v7h7' fill='%23fed7aa'/%3E%3Cpath d='M15 18h13M15 23h13M15 28h9' stroke='%230f766e' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M11 5h14l6 6v26H11V5Z' fill='none' stroke='%23f59e0b' stroke-width='2'/%3E%3C/svg%3E") center / contain no-repeat,
    rgba(245, 158, 11, 0.10);
}
.level-card-header { display: grid; gap: 8px; align-content: start; min-width: 0; }
.level-card-header strong {
  overflow-wrap: anywhere;
  line-height: 1.1;
}
.level-card-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.level-card-file-name {
  display: block;
  color: var(--muted);
  font: 700 0.74rem/1.2 "JetBrains Mono", ui-monospace, monospace;
  overflow-wrap: anywhere;
}
.level-card-thumb {
  display: grid; gap: 1px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: var(--r-sm);
  padding: 6px;
  border: 1px solid var(--line);
  aspect-ratio: 13/11;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.6);
}
.level-card-thumb-row { display: grid; gap: 1px; }
.level-card-thumb-cell { border-radius: 1px; min-height: 0; }
.lct-wall    { background: #57534e; }
.lct-block   { background: #d97706; }
.lct-floor   { background: rgba(214, 211, 209, 0.05); }
.lct-spawn-a { background: var(--spawn-a); }
.lct-spawn-b { background: var(--spawn-b); }
.lct-spawn-c { background: var(--spawn-c); }
.lct-spawn-d { background: var(--spawn-d); }

/* validation chip */
.validation-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
}
.validation-chip-ok { background: rgba(52, 211, 153, 0.14); color: #a7f3d0; border: 1px solid rgba(52, 211, 153, 0.38); box-shadow: 0 0 18px rgba(52, 211, 153, 0.14); }
.validation-chip-warn { background: rgba(251, 146, 60, 0.14); color: #fed7aa; border: 1px solid rgba(251, 146, 60, 0.40); box-shadow: 0 0 18px rgba(251, 146, 60, 0.18); }
.validation-chip-err { background: rgba(239, 68, 68, 0.16); color: #fecaca; border: 1px solid rgba(239, 68, 68, 0.4); }
.validation-chip-dot { width: 8px; height: 8px; border-radius: 999px; background: currentColor; box-shadow: 0 0 10px currentColor; }

/* ──────────────────────────────────────────────────────────────────
   19. Misc fixes against legacy app.css
   ────────────────────────────────────────────────────────────────── */
.info-list { display: grid; gap: 6px; color: var(--muted); }
.info-list p { margin: 0; font-size: 0.92rem; }
.feedback-error { color: #fecaca; }

.checkbox-row { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.checkbox-label { font-weight: 700; color: var(--text); }

.system-footer-strip { padding: 12px 16px; border-radius: var(--r-md); background: rgba(28, 25, 23, 0.45); border: 1px solid var(--line); }
.system-footer-line { margin: 0; font-size: 0.82rem; color: var(--muted); font-family: "JetBrains Mono", ui-monospace, monospace; }

.participants-shell, .players-shell {
  display: grid; gap: 14px;
  padding: 22px;
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  background: var(--inset);
}
.participants-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.participant-item {
  padding: 12px 14px; border-radius: var(--r-md);
  background: rgba(41, 37, 36, 0.7);
  border: 1px solid var(--line);
  color: var(--text);
}
.invite-user-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.invite-user-card { padding: 14px; border-radius: var(--r-md); background: rgba(41, 37, 36, 0.7); border: 1px solid var(--line); display: grid; gap: 12px; }

.lobby-home-panel {
  gap: 16px;
  padding-top: 18px;
}
.lobby-home-grid { display: grid; gap: 18px; }
.lobby-home-grid-single { grid-template-columns: 1fr; }
.lobby-chat-feed { max-height: 360px; overflow: auto; }

.app-shell { padding-top: 0; }

/* hide native checkbox styling globally (we use Toggle) but keep working for power-up grid */
.powerup-picker-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.powerup-picker-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: rgba(28, 25, 23, 0.55);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}
.powerup-picker-item:hover { border-color: var(--line-glow); background: rgba(41, 37, 36, 0.7); transform: translateY(-2px); }
.powerup-picker-item-active {
  border-color: var(--accent); background: rgba(245, 158, 11, 0.12);
  box-shadow: var(--glow-amber);
}
.powerup-picker-sprite { width: 40px; height: 40px; position: relative; flex: none; }

/* Power-up chip selector */
.config-powerup-chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.config-powerup-chip {
  position: static;
  inset: auto;
  z-index: auto;
  min-width: 132px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(28, 25, 23, 0.55);
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  box-sizing: border-box;
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}
.config-powerup-chip:hover { border-color: var(--line-glow); background: rgba(41, 37, 36, 0.7); }
.config-powerup-chip-active { border-color: var(--accent); background: rgba(245, 158, 11, 0.10); box-shadow: var(--glow-amber); }
.config-powerup-chip-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex: none;
  background: rgba(214, 211, 209, 0.10);
  font-size: 0.68rem; font-weight: 700; color: var(--muted);
}
.config-powerup-chip-active .config-powerup-chip-dot { background: rgba(245, 158, 11, 0.28); color: var(--accent); }
.config-powerup-chip-label {
  min-width: 0;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}
.config-powerup-chip-active .config-powerup-chip-label { color: var(--text); }
.powerup-settings-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-top: 14px; border-top: 1px solid rgba(214, 211, 209, 0.10); }
.powerup-setting-field { display: grid; gap: 6px; }

/* Number + enable toggle */
.number-enable-row { display: grid; gap: 8px; }
.number-enable-row .input:disabled { opacity: 0.38; cursor: not-allowed; pointer-events: none; }

/* ──────────────────────────────────────────────────────────────────
   20. Hero illustration on lobby
   ────────────────────────────────────────────────────────────────── */
.lobby-hero-art {
  display: grid; place-items: center;
  padding: 28px;
  border-radius: var(--r-xl);
  background:
    radial-gradient(circle at 50% 60%, rgba(245, 158, 11, 0.14), transparent 70%),
    rgba(28, 25, 23, 0.5);
  border: 1px solid var(--line);
  position: relative;
  min-height: 240px;
  overflow: hidden;
}
.lobby-hero-art::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(74, 222, 128, 0.12), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(251, 146, 60, 0.10), transparent 40%);
  pointer-events: none;
}
.lobby-hero-art > * { position: relative; z-index: 1; }

/* level-mode selector */
.level-mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.level-mode-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--r-lg);
  background: rgba(28, 25, 23, 0.55);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
  color: inherit;
  font-family: inherit;
  text-align: left;
}
.level-mode-option:hover:not([disabled]) {
  border-color: var(--line-glow);
  background: rgba(41, 37, 36, 0.7);
  transform: translateY(-1px);
}
.level-mode-option[disabled] { opacity: 0.5; cursor: not-allowed; }
.level-mode-option-active {
  border-color: var(--accent);
  background: rgba(245, 158, 11, 0.10);
  box-shadow: var(--glow-amber);
}
.level-mode-icon {
  font-size: 1.8rem;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: rgba(28, 25, 23, 0.55);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  flex: none;
}
.level-mode-option-active .level-mode-icon { border-color: var(--accent); }
.level-mode-text { display: grid; gap: 2px; min-width: 0; }
.level-mode-text strong { font-family: "Outfit", sans-serif; font-weight: 700; font-size: 0.98rem; }
.level-mode-text small { font-family: "JetBrains Mono", monospace; font-size: 0.74rem; color: var(--muted); }
.level-mode-option-active .level-mode-text small { color: #fde68a; }

/* ─── Volume / audio control in topbar ──────────────────────────── */
.volume-control { position: relative; display: inline-flex; }
.volume-button {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: rgba(41, 37, 36, 0.85);
  color: var(--text);
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
  padding: 0;
}
.volume-button:hover { transform: translateY(-1px); border-color: var(--line-glow); box-shadow: var(--glow-green); }
.volume-icon { font-size: 1.25rem; line-height: 1; }
.volume-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 240px;
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: var(--r-lg);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-deep);
  z-index: 25;
  backdrop-filter: blur(12px);
}
@keyframes vp-pop { from { transform: translateY(-6px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.volume-popover::before {
  content: "";
  position: absolute;
  top: -6px; right: 14px;
  width: 12px; height: 12px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  transform: rotate(45deg);
}

/* ──────────────────────────────────────────────────────────────────
   21. Professional design system
   ────────────────────────────────────────────────────────────────── */

/* — Topbar: logo mark — */
.topbar-logo {
  width: 38px; height: 38px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, rgba(245,158,11,0.22), rgba(251,146,60,0.12));
  border: 1px solid rgba(245,158,11,0.38);
  display: grid; place-items: center;
  font-size: 1rem;
  font-weight: 900;
  font-family: "Outfit", sans-serif;
  color: var(--accent);
  flex: none;
  box-shadow: 0 0 18px rgba(245,158,11,0.16), inset 0 1px 0 rgba(255,255,255,0.08);
  letter-spacing: -0.01em;
  user-select: none;
}

/* — Topbar: nav pill — */
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: var(--r-pill);
  background: rgba(0,0,0,0.20);
  border: 1px solid var(--line);
  justify-self: center;
}
.topbar-nav-btn {
  position: relative;
  padding: 7px 18px;
  border-radius: var(--r-pill);
  font-size: 0.86rem;
  font-weight: 700;
  font-family: "Outfit", sans-serif;
  color: var(--muted);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: color 130ms ease, background 130ms ease;
  white-space: nowrap;
}
.topbar-nav-btn:hover { color: var(--text); background: rgba(214,211,209,0.07); }
.topbar-nav-btn-active {
  color: var(--accent);
  background: rgba(245,158,11,0.14);
  box-shadow: inset 0 0 0 1px rgba(245,158,11,0.28);
}

/* — Topbar: right cluster — */
.topbar-right { display: flex; align-items: center; gap: 8px; }

/* — Online status chip — */
.online-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: rgba(52,211,153,0.09);
  border: 1px solid rgba(52,211,153,0.26);
  color: #6ee7b7;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: "Outfit", sans-serif;
  cursor: pointer;
  transition: background 130ms ease, border-color 130ms ease;
  white-space: nowrap;
}
.online-chip:hover { background: rgba(52,211,153,0.17); border-color: rgba(52,211,153,0.42); }
.online-chip-dot {
  width: 7px; height: 7px;
  border-radius: 999px;
  background: #34d399;
  box-shadow: 0 0 8px rgba(52,211,153,0.85);
  animation: pulse-dot 2.5s ease-in-out infinite;
  flex: none;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.7); }
}

/* — Notification icon button — */
.notif-btn {
  position: relative;
  min-width: 44px;
  height: 38px;
  border-radius: var(--r-md);
  background: rgba(41,37,36,0.80);
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 0.82rem;
  font-weight: 800;
  font-family: "Outfit", sans-serif;
  transition: color 130ms ease, border-color 130ms ease, background 130ms ease;
  padding: 0 10px;
}
.notif-btn:hover { color: var(--text); border-color: var(--line-glow); background: rgba(52,46,44,0.95); }
.notif-btn-icon {
  width: 18px;
  height: 18px;
  flex: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9 1.8c-2.5 0-4.5 2-4.5 4.5v2.5L2.8 12v1.3h12.4V12l-1.7-3.2V6.3c0-2.5-2-4.5-4.5-4.5Zm0 14.4a2.2 2.2 0 0 0 2.1-1.5H6.9A2.2 2.2 0 0 0 9 16.2Zm5.8-13.6 1.4 1.4-1.5 1.5-1.4-1.4 1.5-1.5ZM3.2 2.6 4.7 4.1 3.3 5.5 1.8 4l1.4-1.4Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9 1.8c-2.5 0-4.5 2-4.5 4.5v2.5L2.8 12v1.3h12.4V12l-1.7-3.2V6.3c0-2.5-2-4.5-4.5-4.5Zm0 14.4a2.2 2.2 0 0 0 2.1-1.5H6.9A2.2 2.2 0 0 0 9 16.2Zm5.8-13.6 1.4 1.4-1.5 1.5-1.4-1.4 1.5-1.5ZM3.2 2.6 4.7 4.1 3.3 5.5 1.8 4l1.4-1.4Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
}
.notif-badge {
  min-width: 19px;
  height: 19px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-on);
  font-size: 0.64rem;
  font-weight: 800;
  font-family: "Outfit", sans-serif;
  display: grid;
  place-items: center;
  padding: 0 5px;
  border: 1px solid rgba(12, 10, 9, 0.72);
  box-shadow: 0 0 8px rgba(245,158,11,0.55);
}

/* — Page header: full-bleed hero at top of panel — */
.page-header {
  margin: -32px -32px 0;
  padding: 28px 32px 24px;
  background:
    linear-gradient(135deg, rgba(245,158,11,0.07) 0%, transparent 55%),
    linear-gradient(to bottom, rgba(0,0,0,0.10) 0%, transparent 100%);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 8px;
}
.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header-copy { display: grid; gap: 4px; flex: 1; min-width: 0; }
.page-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 8px;
  flex: none;
}

/* — Card component — */
.card {
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  background: var(--inset);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(0,0,0,0.14);
  min-height: 48px;
}
.card-header-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.card-icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.22);
  display: grid; place-items: center;
  font-size: 0.80rem;
  font-weight: 900;
  font-family: "Outfit", sans-serif;
  color: var(--accent);
  flex: none;
}
.card-icon-green {
  background: rgba(74,222,128,0.10);
  border-color: rgba(74,222,128,0.22);
  color: var(--go);
}
.card-icon-red {
  background: rgba(239,68,68,0.10);
  border-color: rgba(239,68,68,0.22);
  color: var(--danger);
}
.card-title {
  font-family: "Outfit", sans-serif;
  font-size: 0.90rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  letter-spacing: 0.01em;
}
.card-subtitle {
  font-size: 0.74rem;
  color: var(--muted);
  margin: 0;
  margin-top: 1px;
}
.card-body { padding: 14px 16px; display: grid; gap: 12px; }
.card-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: rgba(0,0,0,0.10);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* — Key-value table — */
.kv-table {
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--line);
}
.kv-row { display: grid; grid-template-columns: minmax(90px, 30%) 1fr; }
.kv-row + .kv-row { border-top: 1px solid var(--line); }
.kv-key {
  padding: 8px 12px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  border-right: 1px solid var(--line);
  background: rgba(0,0,0,0.14);
  display: flex;
  align-items: center;
  font-family: "JetBrains Mono", monospace;
}
.kv-val {
  padding: 8px 12px;
  font-size: 0.86rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  word-break: break-all;
}

/* — Stat strip: seamless grid of stats — */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--line);
  gap: 1px;
}
.stat-cell {
  background: var(--panel);
  padding: 16px 18px;
  display: grid;
  gap: 4px;
  position: relative;
}
.stat-cell::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0.35;
}
.stat-label {
  font-family: "Outfit", sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.stat-value {
  font-family: "Outfit", sans-serif;
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  letter-spacing: -0.02em;
}
.stat-detail {
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.35;
}

/* — Room card text polish — */
.room-card-meta,
.room-card-stats {
  min-width: 0;
  font-size: 0.84rem;
  line-height: 1.35;
}
.room-card-stats { color: var(--muted-2); }

/* — Section divider — */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line) 30%, var(--line) 70%, transparent);
}

/* — Metric card: always-on top accent — */
.metric-card::before { opacity: 0.4; }
.metric-card:hover::before { opacity: 1; }

/* — Responsive: updated topbar — */
@media (max-width: 1080px) {
  .topbar { grid-template-columns: 1fr !important; }
  .topbar-nav { justify-self: start; overflow-x: auto; max-width: 100%; }
  .topbar-right { justify-content: flex-start; }
}
@media (max-width: 600px) {
  .topbar-nav-btn { padding: 7px 12px; font-size: 0.82rem; }
  .page-header { margin: -28px -20px 0; padding: 20px 20px 18px; }
  .panel { padding: 20px; }
}

/* ──────────────────────────────────────────────────────────────────
   22. Popup & drawer theme overrides (warm charcoal)
   ────────────────────────────────────────────────────────────────── */

/* Profile popup */
.topbar-profile-popup {
  background: rgba(28,25,23,0.97);
  border-color: var(--line);
  box-shadow: 0 18px 44px rgba(0,0,0,0.50), 0 0 0 1px rgba(245,158,11,0.08);
}
.topbar-profile-popup::before {
  background: rgba(28,25,23,0.97);
  border-left-color: var(--line);
  border-top-color: var(--line);
}
.topbar-profile-popup-avatar {
  border-color: var(--line);
}
.topbar-avatar {
  border-color: var(--line);
  background: var(--panel);
}
.topbar-avatar-indicator {
  border-color: var(--bg);
}

/* Notifications drawer */
.notifications-drawer {
  width: min(440px, calc(100vw - 32px));
  display: grid;
  gap: 14px;
  padding: 18px;
  background:
    radial-gradient(circle at 16% 10%, rgba(245, 158, 11, 0.14), transparent 30%),
    rgba(28,25,23,0.97);
  border-color: var(--line);
  box-shadow: 0 18px 44px rgba(0,0,0,0.50), 0 0 0 1px rgba(245,158,11,0.06);
}
.notifications-drawer-header {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 38px 38px;
  align-items: center;
  gap: 12px;
}
.notifications-drawer-mark,
.notifications-empty-mark {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  border: 1px solid rgba(245, 158, 11, 0.30);
  background:
    radial-gradient(circle at 50% 42%, rgba(250, 204, 21, 0.26), transparent 40%),
    rgba(12, 10, 9, 0.42);
  position: relative;
}
.notifications-drawer-mark::before,
.notifications-empty-mark::before,
.notification-card-icon::before {
  content: "";
  position: absolute;
  inset: 11px;
  background: #facc15;
  -webkit-mask: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 2 20 6.5v7.2c0 4-3.3 7.2-8 8.3-4.7-1.1-8-4.3-8-8.3V6.5L12 2Zm0 4.1L7 8.9v4.8c0 2.4 1.8 4.3 5 5.2 3.2-.9 5-2.8 5-5.2V8.9l-5-2.8Zm0 2.5 1.1 2.2 2.4.3-1.8 1.7.5 2.4-2.2-1.1-2.2 1.1.5-2.4-1.8-1.7 2.4-.3L12 8.6Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 2 20 6.5v7.2c0 4-3.3 7.2-8 8.3-4.7-1.1-8-4.3-8-8.3V6.5L12 2Zm0 4.1L7 8.9v4.8c0 2.4 1.8 4.3 5 5.2 3.2-.9 5-2.8 5-5.2V8.9l-5-2.8Zm0 2.5 1.1 2.2 2.4.3-1.8 1.7.5 2.4-2.2-1.1-2.2 1.1.5-2.4-1.8-1.7 2.4-.3L12 8.6Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
}
.notifications-drawer-close,
.notifications-mark-read,
.notification-dismiss {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(248, 113, 113, 0.28);
  border-radius: 999px;
  background: rgba(127, 29, 29, 0.16);
  color: #fecaca;
  cursor: pointer;
  position: relative;
}
.notifications-drawer-close::before,
.notifications-drawer-close::after,
.notifications-mark-read::before,
.notifications-mark-read::after,
.notification-dismiss::before,
.notification-dismiss::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  top: 17px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}
.notifications-drawer-close::before,
.notification-dismiss::before { transform: rotate(45deg); }
.notifications-drawer-close::after,
.notification-dismiss::after { transform: rotate(-45deg); }
.notifications-mark-read {
  border-color: rgba(74, 222, 128, 0.28);
  background: rgba(22, 101, 52, 0.16);
  color: #bbf7d0;
}
.notifications-mark-read::before {
  left: 9px;
  right: auto;
  top: 18px;
  width: 7px;
  height: 2px;
  transform: rotate(42deg);
}
.notifications-mark-read::after {
  left: 14px;
  right: auto;
  top: 16px;
  width: 14px;
  height: 2px;
  transform: rotate(-45deg);
}
.notifications-list {
  display: grid;
  gap: 12px;
}

.notification-card {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 10px 12px;
  padding: 14px;
  background: var(--inset);
  border-color: var(--line);
  border-radius: var(--r-lg);
}
.notification-card-icon {
  grid-row: span 3;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid rgba(74, 222, 128, 0.24);
  background:
    radial-gradient(circle at 50% 50%, rgba(74, 222, 128, 0.20), transparent 58%),
    rgba(12, 10, 9, 0.36);
  position: relative;
}
.notification-card-icon::before {
  inset: 9px;
  background: #86efac;
}
.notification-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  align-items: center;
  gap: 10px;
}
.notification-card-header strong {
  min-width: 0;
  overflow-wrap: anywhere;
}
.notification-card .feedback,
.notification-meta,
.notification-action-row {
  grid-column: 2;
}
.notification-card-unread {
  background: rgba(52,211,153,0.07);
  border-color: rgba(52,211,153,0.28);
}
.notification-meta {
  margin: 0;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  color: var(--muted-2);
}
.notification-action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.notifications-empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  text-align: center;
  border-radius: var(--r-lg);
  border: 1px dashed rgba(245, 158, 11, 0.26);
  background: rgba(12, 10, 9, 0.26);
}

/* Invite popup details panel */
.invite-popup-details {
  background: var(--inset);
  border-color: var(--line);
  border-radius: var(--r-md);
}

/* Online players modal grid */
.online-players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  padding: 4px 0;
}
.online-player-card {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--inset);
  transition: border-color 130ms ease, background 130ms ease;
}
.online-player-card:hover {
  border-color: rgba(52,211,153,0.32);
  background: rgba(52,211,153,0.05);
}
.online-player-card strong {
  font-family: "Outfit", sans-serif;
  font-size: 0.90rem;
  font-weight: 700;
  color: var(--text);
}

/* ──────────────────────────────────────────────────────────────────
   23. Persistent chat sidebar
   ────────────────────────────────────────────────────────────────── */

/* 2-column app shell when chat sidebar is present */
.app-shell-with-chat {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 304px;
  grid-template-rows: auto 1fr;
  min-height: 100dvh;
  align-items: start;
  column-gap: 14px;
  padding-right: 14px;
  padding-bottom: 14px;
}
.app-shell-with-chat > header.topbar {
  grid-column: 1 / -1;
  grid-row: 1;
}
.app-shell-with-chat > .chat-sidebar {
  grid-column: 2;
  grid-row: 2;
  position: sticky;
  top: 14px;
  height: calc(100dvh - var(--topbar-h, 68px) - 28px);
  max-height: calc(100dvh - var(--topbar-h, 68px) - 28px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.012)),
    var(--panel);
  box-shadow: var(--shadow-md);
  z-index: 5;
}
/* The page content takes the left column */
.app-shell-with-chat > section,
.app-shell-with-chat > main {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
}

/* Chat sidebar inner structure */
.chat-sidebar-header {
  flex: none;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(0,0,0,0.10);
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-sidebar-title {
  font-family: "Outfit", sans-serif;
  font-size: 0.80rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  flex: 1;
  min-width: 0;
}
.chat-sidebar-feed {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 10px;
  scroll-behavior: smooth;
}
.chat-sidebar-feed::-webkit-scrollbar { width: 4px; }
.chat-sidebar-feed::-webkit-scrollbar-track { background: transparent; }
.chat-sidebar-feed::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }

.chat-sidebar-message {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: end;
  gap: 8px;
  max-width: 96%;
  align-self: flex-start;
}
.chat-sidebar-message-self {
  grid-template-columns: minmax(0, 1fr) 30px;
  align-self: flex-end;
}
.chat-sidebar-message-self .chat-sidebar-avatar { grid-column: 2; grid-row: 1; }
.chat-sidebar-message-self .chat-sidebar-bubble { grid-column: 1; grid-row: 1; align-items: end; }
.chat-sidebar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid color-mix(in srgb, var(--chat-author-color, var(--accent)) 50%, transparent);
  background: rgba(0,0,0,0.20);
  box-shadow: 0 6px 14px rgba(0,0,0,0.18);
}
.chat-sidebar-bubble {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 12px 12px 12px 4px;
  border: 1px solid color-mix(in srgb, var(--chat-author-color, var(--accent)) 30%, transparent);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--chat-author-color, var(--accent)) 10%, transparent), rgba(255,255,255,0.018)),
    rgba(0,0,0,0.12);
}
.chat-sidebar-message-self .chat-sidebar-bubble {
  border-radius: 12px 12px 4px 12px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--chat-author-color, var(--accent)) 18%, transparent), rgba(255,255,255,0.025)),
    rgba(0,0,0,0.14);
}
.chat-sidebar-author {
  font-family: "Outfit", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--chat-author-color, var(--accent));
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-sidebar-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.chat-sidebar-time {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.65);
  white-space: nowrap;
}
.chat-sidebar-text {
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.4;
  word-break: break-word;
}
.chat-sidebar-empty {
  padding: 16px 14px;
  font-size: 0.80rem;
  color: var(--muted);
  font-style: italic;
}

.chat-system-toast {
  position: fixed;
  bottom: 24px;
  left: 20px;
  z-index: 1000;
  max-width: 300px;
  width: max-content;
  padding: 10px 11px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  border-radius: var(--r-md);
  border: 1px solid rgba(245, 158, 11, 0.34);
  background:
    radial-gradient(circle at 16% 0%, rgba(245, 158, 11, 0.18), transparent 42%),
    linear-gradient(135deg, rgba(36, 24, 10, 0.96), rgba(16, 18, 24, 0.94));
  color: #f8e7bd;
  font-size: 0.78rem;
  line-height: 1.35;
  box-shadow: 0 14px 34px rgba(0,0,0,0.34), 0 0 0 1px rgba(255,255,255,0.035) inset;
  animation: chatSystemToastIn 260ms ease-out both, chatSystemToastPulse 1300ms ease-in-out 260ms 2;
}

.chat-system-toast-icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background:
    linear-gradient(135deg, #fbbf24, #f97316);
  position: relative;
  box-shadow: 0 8px 18px rgba(245, 158, 11, 0.28);
}

.chat-system-toast-icon::before {
  content: '';
  position: absolute;
  inset: 6px;
  background: #1a1308;
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 64 64' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16 29c0-9 7-16 16-16s16 7 16 16v8l5 8H11l5-8v-8Zm9 20c1.3 3 3.6 4.5 7 4.5s5.7-1.5 7-4.5H25Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 64 64' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16 29c0-9 7-16 16-16s16 7 16 16v8l5 8H11l5-8v-8Zm9 20c1.3 3 3.6 4.5 7 4.5s5.7-1.5 7-4.5H25Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
}

.chat-sidebar-composer {
  flex: none;
  border-top: 1px solid var(--line);
  padding: 10px 10px;
  display: flex;
  gap: 6px;
  background: rgba(0,0,0,0.10);
}
.chat-sidebar-composer .input {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  padding: 8px 10px;
}
.chat-sidebar-composer .button {
  flex: none;
  padding: 8px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}

@keyframes chatSystemToastIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes chatSystemToastPulse {
  0%, 100% { box-shadow: 0 14px 34px rgba(0,0,0,0.34), 0 0 0 1px rgba(255,255,255,0.035) inset; }
  50% { box-shadow: 0 16px 38px rgba(0,0,0,0.38), 0 0 0 1px rgba(245,158,11,0.16) inset, 0 0 22px rgba(245,158,11,0.12); }
}

/* Responsive: collapse sidebar on small screens */
@media (max-width: 820px) {
  .app-shell-with-chat {
    grid-template-columns: 1fr;
    padding-right: 0;
    padding-bottom: 0;
  }
  .app-shell-with-chat > .waiting-room-overlay {
    right: 0;
  }
  .app-shell-with-chat > .chat-sidebar {
    display: none;
  }
}

/* ──────────────────────────────────────────────────────────────────
   24. Viewport lock – no full-page scroll; panels scroll internally
   ────────────────────────────────────────────────────────────────── */

html, body { height: 100%; overflow: hidden; }
body { padding: 0; }

/* Shell: locked flex column filling the viewport */
.app-shell {
  height: 100dvh;
  max-width: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}

/* Floating topbar: outer margin creates the visual gutter */
.app-shell > header.topbar { flex: none; margin: 12px 16px 10px; }

/* Page panel: fills remaining height, scrolls with hidden scrollbar.
   Use margin (not padding) for outer gutter so panel's own padding:32px
   stays intact — the page-header uses margin:-32px to match it exactly. */
.app-shell > :is(section.panel, section.config-page-shell) {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  margin: 0 16px 16px;
}
.app-shell > :is(section.panel, section.config-page-shell)::-webkit-scrollbar { display: none; }

/* 2-column with-chat: grid replaces flex.
   minmax(0, 1fr) prevents the row from expanding beyond remaining viewport
   space (plain 1fr has an implicit min-content minimum that causes overflow).
   align-items: stretch is explicit (not 'unset') to guarantee it beats
   section 23's 'align-items: start' — without stretch the panel sizes to
   content height and overflow-y:auto never fires. */
.app-shell-with-chat {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 304px;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  align-items: stretch;
  column-gap: 14px;
  padding-right: 14px;
  padding-bottom: 14px;
}
.app-shell-with-chat > :is(section.panel, section.config-page-shell) {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  align-self: stretch; /* panel fills grid row → overflow-y:auto can fire */
  /* overflow-y:auto / scrollbar-width / margin come from .app-shell > section.panel */
}
/* Sidebar: fills grid row height exactly */
.app-shell-with-chat > .chat-sidebar {
  grid-column: 2;
  grid-row: 2;
  align-self: stretch;
  height: auto;
  max-height: none;
  position: static;
  top: unset;
  overflow: hidden;
}

/* Transparent fixed overlay — closes popups/drawers when clicking outside */
.click-trap {
  position: fixed;
  inset: 0;
  z-index: 25; /* below profile popup (30) and notifications drawer (35) */
  cursor: default;
  background: transparent;
}

@media (max-width: 820px) {
  .app-shell-with-chat { grid-template-columns: 1fr; padding-right: 0; padding-bottom: 0; }
  .app-shell-with-chat > :is(section.panel, section.config-page-shell) { grid-column: 1; }
}

/* Shared hidden-scrollbar behavior for internal vertical scroll regions. */
:is(
  .app-shell > section.panel,
  .app-shell > section.config-page-shell,
  .chat-sidebar-feed,
  .chat-feed,
  .lobby-chat-feed,
  .notifications-drawer,
  .modal-card-wide,
  .nickname-avatar-grid,
  .level-template-grid,
  .level-designer-grid
) {
  min-height: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
:is(
  .app-shell > section.panel,
  .app-shell > section.config-page-shell,
  .chat-sidebar-feed,
  .chat-feed,
  .lobby-chat-feed,
  .notifications-drawer,
  .modal-card-wide,
  .nickname-avatar-grid,
  .level-template-grid,
  .level-designer-grid
)::-webkit-scrollbar {
  display: none;
}

/* ──────────────────────────────────────────────────────────────────
   25. Game HUD — horizontal strip above the arena
   ────────────────────────────────────────────────────────────────── */

.hud-strip {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 8px 14px;
  border-radius: var(--r-lg);
  background:
    linear-gradient(135deg, rgba(74,222,128,0.08), transparent 50%),
    linear-gradient(225deg, rgba(245,158,11,0.07), transparent 50%),
    rgba(28,25,23,0.96);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), 0 0 16px rgba(74,222,128,0.10);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--text);
  overflow: hidden;
}
.hud-strip.hud-strip-warn {
  border-color: rgba(239,68,68,0.45);
  box-shadow: var(--shadow), 0 0 16px rgba(239,68,68,0.22);
}

/* FPS block: large number + mini bar */
.hud-strip-fps-block {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: none;
  padding-right: 14px;
  border-right: 1px solid var(--line);
}
.hud-strip-label {
  font-family: "Outfit", sans-serif;
  font-size: 0.57rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
}
.hud-strip-fps-value {
  font-family: "Outfit", sans-serif;
  font-size: 1.40rem;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(180deg, #f59e0b, #fb923c);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
}
.hud-strip-fps-warn {
  background: linear-gradient(180deg, #f87171, #ef4444) !important;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.hud-strip-fps-target {
  font-size: 0.70rem;
  color: var(--muted);
  margin-right: 4px;
}
/* Inline FPS bar */
.hud-strip .hud-fps-bar {
  width: 52px;
  height: 4px;
}

/* Per-stat cells */
.hud-strip-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 0 12px;
  border-left: 1px solid var(--line);
}
.hud-strip-stat-label {
  font-family: "Outfit", sans-serif;
  font-size: 0.55rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.hud-strip-stat-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.92rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* Worst-frame label pushed to the right */
.hud-strip-worst {
  margin-left: auto;
  padding-left: 14px;
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
  border-left: 1px solid var(--line);
}
