/* ===== Font ===== */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=Teko:wght@400;500;600;700&family=Rajdhani:wght@400;500;600;700&display=swap');

/* ===== Reset ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: #131318;
  display: flex; justify-content: center; align-items: center;
  height: 100vh; overflow: hidden;
  font-family: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
canvas#game { image-rendering: auto; }
canvas#three-overlay { image-rendering: auto; }
.hidden { display: none !important; }

/* ===== Design tokens ===== */
:root {
  --bg: #131318;
  --bg-surface: #1a1a22;
  --bg-deep: #0f0f14;
  --primary: #ff8906;
  --primary-glow: rgba(255,137,6,0.35);
  --secondary: #ff6b8a;
  --secondary-glow: rgba(255,107,138,0.25);
  --accent: #56d4a5;
  --accent-glow: rgba(86,212,165,0.25);
  --info: #c4b5fd;
  --info-glow: rgba(196,181,253,0.25);
  --text: #fffffe;
  --text-body: #e8e0f5;
  --text-muted: #bfaed8;
  --surface: rgba(255,255,255,0.08);
  --surface-hover: rgba(255,255,255,0.14);
  --stroke: rgba(255,255,255,0.10);
  --radius: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --max-w: 460px;
  --font-display: 'Teko', sans-serif;
  --font-ui: 'Rajdhani', sans-serif;
  --font-body: 'Nunito', 'Segoe UI', system-ui, sans-serif;
}

/* ==================================================
   1. SCREEN CONTAINERS
   ================================================== */
#splash-screen, #color-select, #room-lobby {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center;
  z-index: 100; color: var(--text);
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
#color-select, #room-lobby {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #1a1a22 0%, #141418 40%, #0f0f14 100%);
  background-size: 200px 200px, 100% 100%;
}
#splash-screen {
  justify-content: flex-end; align-items: flex-start;
  padding: 0 clamp(32px, 4vw, 80px) clamp(32px, 4vh, 72px);
  background: var(--bg-home) center/cover no-repeat;
}
#color-select, #room-lobby {
  justify-content: flex-start;
  padding: 48px 24px 40px;
}

/* Subtle warm glow on dark bg */
#color-select::before, #room-lobby::before {
  content: ''; position: absolute; border-radius: 50%;
  pointer-events: none; filter: blur(180px); opacity: 0.08;
  width: 500px; height: 500px; top: -120px; right: -120px;
  background: #ff8906;
}
/* Vignette for depth */
#color-select::after, #room-lobby::after {
  content: ''; position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.35) 100%);
}

/* ==================================================
   2. SPLASH SCREEN
   ================================================== */
.splash-title {
  text-align: left; margin-bottom: clamp(24px, 3vh, 48px);
  position: relative; z-index: 1;
}
.splash-title .title {
  font-family: var(--font-display);
  font-size: clamp(60px, 7vw, 130px); color: var(--text); font-weight: 700;
  letter-spacing: clamp(4px, 0.5vw, 12px); text-transform: uppercase;
  line-height: 1;
  text-shadow: 0 2px 20px rgba(0,0,0,0.3), 0 0 60px rgba(255,137,6,0.2);
}
.splash-title .title span { color: var(--primary); }
.splash-title .subtitle {
  font-family: var(--font-ui);
  font-size: clamp(11px, 1.1vw, 18px); color: rgba(255,255,255,0.5);
  letter-spacing: clamp(6px, 0.8vw, 14px); margin-top: clamp(4px, 0.5vh, 10px);
  font-weight: 600; text-transform: uppercase;
}

.splash-menu {
  display: flex; flex-direction: column; gap: clamp(8px, 1vh, 16px);
  width: clamp(320px, 30vw, 500px);
  position: relative; z-index: 1;
}

/* ==================================================
   3. SCREEN HEADER
   ================================================== */
.screen-header {
  display: flex; align-items: center; gap: clamp(10px, 1vw, 20px);
  width: 100%; max-width: clamp(360px, 32vw, 600px);
  margin-bottom: clamp(6px, 0.6vh, 14px);
}
.screen-header h2 {
  font-family: var(--font-display);
  font-size: clamp(28px, 2.5vw, 48px); font-weight: 700; color: var(--text);
  letter-spacing: 1px; margin: 0; text-transform: uppercase;
}
.screen-header .btn-header-back {
  display: flex; align-items: center; gap: clamp(6px, 0.5vw, 10px);
  padding: clamp(8px, 0.8vw, 14px) clamp(14px, 1.2vw, 24px);
  background: rgba(8,6,16,0.6);
  border: 1px solid rgba(255,255,255,0.08);
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
  color: rgba(255,255,255,0.7);
  font-family: var(--font-ui); font-weight: 600;
  font-size: clamp(12px, 1vw, 18px);
  letter-spacing: 1px; text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(8px);
  flex-shrink: 0;
  position: relative; overflow: hidden;
}
.screen-header .btn-header-back::before {
  content: ''; position: absolute; left: 0; bottom: 0; right: 0;
  height: 2px; background: var(--primary);
  opacity: 0; transition: opacity 0.2s;
}
.screen-header .btn-header-back:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.18);
  color: #fff;
  transform: translateX(-4px);
}
.screen-header .btn-header-back:hover::before {
  opacity: 1;
}

.screen-subtitle {
  font-family: var(--font-ui);
  font-size: clamp(12px, 1vw, 18px); color: var(--text-muted);
  margin-bottom: clamp(20px, 2.5vh, 40px);
  font-weight: 600; max-width: clamp(360px, 32vw, 600px); width: 100%;
}

/* Legacy titles (fallback) */
#color-select h2, #room-lobby h2 {
  font-family: var(--font-display);
  font-size: 24px; color: var(--text); margin-bottom: 8px;
  letter-spacing: 0.5px; font-weight: 700; text-transform: uppercase;
}

/* ==================================================
   4. BUTTONS
   ================================================== */
/* (legacy .mode-buttons removed — splash now uses .splash-menu + mode-cards) */

/* Shared button base */
.btn, .mode-buttons > button,
.btn-gold, .btn-blue, .btn-red, .btn-green, .btn-orange, .btn-purple,
.btn-primary, .btn-secondary, .btn-outline {
  font-family: var(--font-display); font-weight: 600; border: none; cursor: pointer;
  color: #fff; font-size: 16px; letter-spacing: 2px; text-transform: uppercase;
  padding: 12px 32px;
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; position: relative;
}
.mode-buttons > button { width: 100%; }

/* Hover / Active */
.btn:hover, .mode-buttons > button:hover,
.btn-gold:hover, .btn-blue:hover, .btn-red:hover, .btn-green:hover,
.btn-orange:hover, .btn-purple:hover, .btn-primary:hover, .btn-secondary:hover {
  transform: scale(1.03);
}
.btn:active, .mode-buttons > button:active,
.btn-gold:active, .btn-blue:active, .btn-red:active, .btn-green:active,
.btn-orange:active, .btn-purple:active, .btn-primary:active, .btn-secondary:active {
  transform: scale(0.97);
}

/* Primary — warm orange */
.btn-primary, .btn-gold, .btn-start {
  background: linear-gradient(135deg, #ffb347 0%, #ff8906 100%);
  color: #1a1018;
  box-shadow: 0 4px 20px var(--primary-glow);
}
.btn-primary:hover, .btn-gold:hover { box-shadow: 0 8px 28px var(--primary-glow); }

/* Secondary — pink */
.btn-secondary, .btn-red {
  background: linear-gradient(135deg, #ff6b8a 0%, var(--secondary) 100%);
  box-shadow: 0 4px 20px var(--secondary-glow);
}
.btn-secondary:hover, .btn-red:hover { box-shadow: 0 8px 28px var(--secondary-glow); }

/* Accent — teal/green */
.btn-green {
  background: linear-gradient(135deg, #56d4a5 0%, var(--accent) 100%);
  color: #0a1a14; box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-green:hover { box-shadow: 0 8px 28px var(--accent-glow); }

/* Info — purple */
.btn-purple, .btn-blue {
  background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
  box-shadow: 0 4px 16px var(--info-glow);
}
.btn-purple:hover, .btn-blue:hover { box-shadow: 0 8px 28px var(--info-glow); }

/* Orange variant */
.btn-orange {
  background: linear-gradient(135deg, #fdba74 0%, #f97316 100%);
  color: #1a1018; box-shadow: 0 4px 20px rgba(249,115,22,0.25);
}
.btn-orange:hover { box-shadow: 0 8px 28px rgba(249,115,22,0.35); }

/* Outline / ghost / back */
.btn-outline, .btn-back {
  padding: 10px 24px; font-size: 14px; font-weight: 600;
  border: 1.5px solid rgba(255,255,255,0.12);
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
  cursor: pointer; background: rgba(255,255,255,0.06); color: var(--text-body);
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: 1px;
}
.btn-outline:hover, .btn-back:hover {
  border-color: rgba(255,255,255,0.2); color: var(--text);
  background: var(--surface);
}

/* Start / CTA button */
.btn-start {
  font-family: var(--font-display);
  padding: 14px 48px; font-size: 16px; font-weight: 600; border: none;
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
  cursor: pointer;
  letter-spacing: 2px; text-transform: uppercase;
  transition: transform 0.15s, box-shadow 0.2s;
}
.btn-start:hover { transform: scale(1.03); box-shadow: 0 8px 28px var(--primary-glow); }
.btn-start:active { transform: scale(0.97); }

/* ==================================================
   5. MODE CARDS
   ================================================== */
.mode-card-list {
  display: flex; flex-direction: column; gap: clamp(8px, 0.8vh, 16px);
  width: 100%; max-width: clamp(360px, 32vw, 600px);
}
.mode-card {
  display: flex; align-items: center; gap: clamp(12px, 1.2vw, 24px);
  padding: clamp(14px, 1.4vw, 24px) clamp(16px, 1.6vw, 28px); width: 100%;
  background: rgba(8,6,16,0.6);
  border: 1px solid rgba(255,255,255,0.08);
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  position: relative; overflow: hidden;
  backdrop-filter: blur(8px);
}
.mode-card::before {
  content: ''; position: absolute; left: 0; bottom: 0; right: 0;
  height: 2px; background: var(--card-accent, var(--text-muted));
}
.mode-card:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.18);
  transform: translateX(4px);
}
.mode-card:active { transform: translateY(0) scale(0.98); }
.mode-card-icon {
  width: clamp(40px, 3.5vw, 64px); height: clamp(40px, 3.5vw, 64px);
  clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%);
  background: rgba(255,255,255,0.06);
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(18px, 1.6vw, 30px); flex-shrink: 0; color: var(--text);
}
.mode-card-info { flex: 1; min-width: 0; }
.mode-card-title {
  font-family: var(--font-display);
  font-size: clamp(18px, 1.5vw, 28px); font-weight: 600; color: var(--text);
  line-height: 1.1; text-transform: uppercase; letter-spacing: 1px;
}
.mode-card-desc {
  font-family: var(--font-ui);
  font-size: clamp(11px, 0.9vw, 16px); color: rgba(255,255,255,0.5); margin-top: 2px;
  line-height: 1.3; font-weight: 500;
}
.mode-card-arrow {
  color: rgba(255,255,255,0.4); font-size: clamp(14px, 1.3vw, 24px); flex-shrink: 0;
  transition: transform 0.2s;
}
.mode-card:hover .mode-card-arrow { transform: translateX(4px); color: rgba(255,255,255,0.7); }

/* Card accent colors */
.mode-card.accent-pink::before { background: var(--secondary); }
.mode-card.accent-green::before { background: var(--accent); }
.mode-card.accent-purple::before { background: var(--info); }
.mode-card.accent-orange::before { background: #f97316; }
.mode-card.accent-primary::before { background: var(--primary); }

/* Section label for card groups */
.section-label {
  font-family: var(--font-ui);
  font-size: clamp(10px, 0.9vw, 16px); color: rgba(255,255,255,0.4);
  letter-spacing: clamp(3px, 0.4vw, 8px);
  text-transform: uppercase; font-weight: 700;
  padding: 0 0 clamp(6px, 0.6vh, 12px);
  width: 100%;
}

/* ==================================================
   MODE SELECT — two-column bottom layout
   ================================================== */
.mode-select-screen {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  display: flex; flex-direction: column;
  justify-content: flex-end;
  padding: 0 clamp(32px, 4vw, 80px) clamp(32px, 4vh, 72px);
  box-sizing: border-box;
  background: var(--bg-home) center/cover no-repeat;
  z-index: 1;
}
.mode-select-back {
  position: absolute;
  top: clamp(16px, 2vh, 32px);
  left: clamp(16px, 2vw, 32px);
  z-index: 2;
}
.mode-select-back .btn-header-back,
.options-screen .mode-select-back .btn-header-back {
  display: flex; align-items: center; gap: clamp(6px, 0.5vw, 10px);
  padding: clamp(8px, 0.8vw, 14px) clamp(14px, 1.2vw, 24px);
  background: rgba(8,6,16,0.6);
  border: 1px solid rgba(255,255,255,0.08);
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
  color: rgba(255,255,255,0.7);
  font-family: var(--font-ui); font-weight: 600;
  font-size: clamp(12px, 1vw, 18px);
  letter-spacing: 1px; text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(8px);
  position: relative; overflow: hidden;
}
.mode-select-back .btn-header-back::before,
.options-screen .mode-select-back .btn-header-back::before {
  content: ''; position: absolute; left: 0; bottom: 0; right: 0;
  height: 2px; background: var(--primary);
  opacity: 0; transition: opacity 0.2s;
}
.mode-select-back .btn-header-back:hover,
.options-screen .mode-select-back .btn-header-back:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.18);
  color: #fff;
  transform: translateX(-4px);
}
.mode-select-back .btn-header-back:hover::before,
.options-screen .mode-select-back .btn-header-back:hover::before {
  opacity: 1;
}
.mode-select-grid {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
}
.mode-select-grid--center {
  justify-content: center;
}
.mode-select-col {
  display: flex; flex-direction: column;
  width: clamp(280px, 28vw, 480px);
  flex-shrink: 0;
}
.mode-select-col .mode-card-list {
  max-width: none;
}
.mode-select-col .section-label {
  max-width: none;
}

/* Reusable surface card */
.surface-card {
  background: rgba(8,6,16,0.5);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  padding: clamp(14px, 1.2vw, 24px) clamp(16px, 1.4vw, 28px);
  width: 100%; max-width: var(--max-w);
  margin-bottom: 10px;
  backdrop-filter: blur(8px);
}
/* (cust-right removed — layout is now centered vertical) */

/* ==================================================
   5b. UNIFIED ROOM
   ================================================== */
.unified-card {
  width: 100%; max-width: var(--max-w);
}
.unified-section {
  padding: 12px 0;
  border-bottom: 1px solid var(--stroke);
}
.unified-section:first-child { padding-top: 0; }
.unified-section:last-child { border-bottom: none; padding-bottom: 0; }
.unified-section-label {
  font-family: var(--font-ui);
  font-size: clamp(10px, 0.75vw, 14px); color: var(--text-muted); letter-spacing: 2px;
  text-transform: uppercase; font-weight: 700; margin-bottom: clamp(6px, 0.6vh, 14px);
}

/* ==================================================
   CUSTOMIZE SCREEN — centered vertical layout
   ================================================== */
.cust-screen {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  padding: 0;
}
#color-select:has(.cust-screen) {
  padding: 0; justify-content: stretch; align-items: stretch;
}

/* Header — back + title + play button */
.cust-header {
  display: flex; align-items: center; gap: clamp(12px, 1.2vw, 22px);
  padding: clamp(12px, 1.5vh, 24px) clamp(24px, 3vw, 56px);
  flex-shrink: 0;
}
.cust-header .btn-header-back {
  display: flex; align-items: center; gap: clamp(6px, 0.5vw, 10px);
  padding: clamp(8px, 0.8vw, 14px) clamp(14px, 1.2vw, 24px);
  background: rgba(8,6,16,0.6);
  border: 1px solid rgba(255,255,255,0.08);
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
  color: rgba(255,255,255,0.7);
  font-family: var(--font-ui); font-weight: 600;
  font-size: clamp(12px, 1vw, 18px);
  letter-spacing: 1px; text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(8px);
  flex-shrink: 0;
  position: relative; overflow: hidden;
}
.cust-header .btn-header-back::before {
  content: ''; position: absolute; left: 0; bottom: 0; right: 0;
  height: 2px; background: var(--primary);
  opacity: 0; transition: opacity 0.2s;
}
.cust-header .btn-header-back:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.18);
  color: #fff;
  transform: translateX(-4px);
}
.cust-header .btn-header-back:hover::before {
  opacity: 1;
}
.cust-title {
  display: flex; flex-direction: column; flex: 1;
}
.cust-mode-label {
  font-family: var(--font-ui);
  font-size: clamp(9px, 0.7vw, 14px); color: var(--text-muted); letter-spacing: 3px;
  text-transform: uppercase; font-weight: 700;
}
.cust-mode-name {
  font-family: var(--font-display);
  font-size: clamp(28px, 2.5vw, 48px); font-weight: 700; color: var(--text);
  line-height: 1; letter-spacing: 2px; text-transform: uppercase;
}
.cust-play-btn {
  font-family: var(--font-display);
  font-size: clamp(16px, 1.3vw, 24px); font-weight: 600;
  letter-spacing: 3px; text-transform: uppercase;
  padding: clamp(10px, 1vh, 16px) clamp(28px, 3vw, 56px);
  flex-shrink: 0;
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
}

/* Center — blob(s) */
.cust-center {
  flex: 1; display: flex;
  align-items: center; justify-content: center;
  min-height: 0;
  padding: 0 clamp(16px, 2vw, 40px);
}

/* Blobs zone: players side by side */
.cust-blobs-zone {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
}

/* Each player: vertical column (nametag → blob → colors → keys) */
.cust-player {
  display: flex; flex-direction: column;
  align-items: center;
  gap: clamp(4px, 0.5vh, 10px);
}

/* ── HUD-style name tag ── */
.cust-nametag {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
}
.cust-nametag-input {
  background: rgba(8,6,16,0.7);
  border: none; border-top: 2.5px solid var(--tag-color, #e74c3c);
  color: #fff; font-family: var(--font-ui);
  font-size: clamp(13px, 1.1vw, 20px); font-weight: 600;
  text-align: center;
  padding: clamp(5px, 0.5vh, 10px) clamp(14px, 1.2vw, 28px);
  min-width: clamp(100px, 10vw, 200px);
  clip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 100%, 0% 100%);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.cust-nametag-input::placeholder {
  color: rgba(255,255,255,0.4); font-weight: 500;
}
.cust-nametag-input:focus {
  border-top-color: var(--primary);
  background: rgba(0,0,0,0.55);
}
.cust-nametag-arrow {
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--tag-color, #e74c3c);
  margin-top: -1px;
}

/* ── Blob canvas ── */
.cust-blob-col { flex-shrink: 0; }
.cust-blob-col canvas {
  width: clamp(140px, min(14vw, 28vh), 400px);
  height: clamp(165px, min(16.5vw, 33vh), 470px);
  display: block;
}

/* ── Colors below blob ── */
.cust-colors-col {
  display: flex;
  gap: clamp(4px, 0.5vw, 10px);
  justify-content: center;
  flex-wrap: wrap;
}
.cust-colors-col.two-rows {
  flex-direction: column; align-items: center;
  gap: clamp(3px, 0.3vh, 6px);
}
.cust-colors-row {
  display: flex;
  gap: clamp(3px, 0.4vw, 8px);
  justify-content: center;
}
.cust-swatch {
  width: clamp(24px, 2vw, 46px); height: clamp(24px, 2vw, 46px);
  border-radius: 50%;
  cursor: pointer;
  border: 2.5px solid transparent;
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.cust-swatch:hover { transform: scale(1.15); }
.cust-swatch.selected {
  border-color: #fff;
  box-shadow: 0 0 10px rgba(255,255,255,0.3);
}

/* ── Keybinds below colors ── */
/* ── Unified key-bind buttons (kb-*) — 3D keycap style ── */
.kb-strip {
  display: flex; align-items: flex-start; justify-content: center;
  gap: clamp(6px, 0.6vw, 12px);
  margin-top: clamp(8px, 0.8vh, 14px);
}
.kb-group {
  display: flex; flex-direction: column; align-items: center;
  gap: 3px; flex: 0 0 auto;
}
.kb-action {
  font-family: var(--font-ui);
  font-size: clamp(9px, 0.7vw, 12px);
  font-weight: 600;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  line-height: 1;
  white-space: nowrap;
}
.kb-key {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: clamp(42px, 3.4vw, 60px);
  aspect-ratio: 1;
  background: linear-gradient(180deg, rgba(60,56,80,0.9) 0%, rgba(30,28,45,0.95) 100%);
  border: 1.5px solid rgba(255,255,255,0.12);
  border-bottom: 3px solid rgba(0,0,0,0.5);
  border-radius: 6px;
  box-shadow:
    0 2px 0 0 rgba(0,0,0,0.45),
    0 4px 8px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.08);
  cursor: pointer;
  transition: all 0.12s ease;
  font-family: var(--font-ui);
  padding: 0;
}
.kb-key:hover {
  background: linear-gradient(180deg, rgba(80,72,110,0.95) 0%, rgba(45,40,65,0.98) 100%);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow:
    0 3px 0 0 rgba(0,0,0,0.5),
    0 6px 14px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.12),
    0 0 12px rgba(255,137,6,0.15);
}
.kb-key:active {
  transform: translateY(2px);
  border-bottom-width: 1.5px;
  box-shadow:
    0 0 0 0 rgba(0,0,0,0.5),
    0 1px 4px rgba(0,0,0,0.3),
    inset 0 2px 4px rgba(0,0,0,0.2);
}
.kb-listening {
  border-color: var(--secondary) !important;
  background: linear-gradient(180deg, rgba(255,107,138,0.2) 0%, rgba(180,50,80,0.25) 100%) !important;
  animation: pulse 0.8s infinite;
  box-shadow:
    0 2px 0 0 rgba(180,50,80,0.5),
    0 4px 12px rgba(255,107,138,0.25),
    inset 0 1px 0 rgba(255,255,255,0.08) !important;
}
.kb-listening .kb-cap { color: var(--secondary); }
.kb-cap {
  font-size: clamp(10px, 0.85vw, 14px);
  font-weight: 700;
  color: rgba(255,255,255,0.88);
  line-height: 1;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 6px);
  text-align: center;
}

.map-random-info {
  font-family: var(--font-display);
  font-size: clamp(16px, 1.3vw, 24px);
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: clamp(8px, 1vh, 16px) 0;
}

/* ── Multi-blob: side-by-side ── */
.cust-blobs-zone.multi-blob {
  gap: clamp(24px, 4vw, 80px);
}
.cust-blobs-zone.multi-blob .cust-swatch {
  width: clamp(18px, 1.5vw, 34px); height: clamp(18px, 1.5vw, 34px);
}

/* ── Single blob: bigger canvas ── */
.cust-blobs-zone.single-blob .cust-blob-col canvas {
  width: clamp(180px, min(18vw, 36vh), 520px);
  height: clamp(215px, min(21vw, 42vh), 610px);
}
.cust-blobs-zone.single-blob .cust-swatch {
  width: clamp(28px, 2.5vw, 56px); height: clamp(28px, 2.5vw, 56px);
}

/* ==================================================
   BOTTOM — map carousel centered
   ================================================== */
.cust-bottom {
  flex-shrink: 0;
  border-top: 2px solid var(--primary);
  background: rgba(8,6,16,0.5);
  backdrop-filter: blur(10px);
  padding: clamp(10px, 1.2vh, 18px) clamp(12px, 1vw, 24px) clamp(12px, 1.4vh, 20px);
  display: flex; justify-content: center; align-items: center;
  align-self: center;
  width: clamp(520px, 52vw, 980px);
}

/* Map strip — carousel with centered active item */
.map-strip {
  display: flex; align-items: center;
  gap: clamp(6px, 0.6vw, 14px);
  /* 5 items visible: item width × 5 + gaps */
  width: clamp(460px, 48vw, 900px);
}
.map-strip-arrow {
  flex-shrink: 0;
  width: clamp(30px, 2.5vw, 46px); height: clamp(30px, 2.5vw, 46px);
  border: none;
  clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%);
  background: rgba(255,255,255,0.06);
  color: var(--primary); font-size: clamp(20px, 2vw, 38px);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; font-family: inherit; line-height: 1;
  z-index: 2;
}
.map-strip-arrow:hover {
  background: var(--primary); color: #1a1018;
  transform: scale(1.1);
}

/* Viewport: clips content, fades edges */
.map-strip-viewport {
  flex: 1; overflow: hidden; position: relative;
  -webkit-mask-image: linear-gradient(to right,
    transparent 0%, black 12%, black 88%, transparent 100%);
  mask-image: linear-gradient(to right,
    transparent 0%, black 12%, black 88%, transparent 100%);
}

/* Track: slides via transform */
.map-strip-track {
  display: flex;
  gap: clamp(6px, 0.6vw, 12px);
  transition: transform 0.35s cubic-bezier(.4,0,.2,1);
  padding: clamp(4px, 0.4vh, 8px) 0;
  will-change: transform;
}

.map-strip-item {
  flex-shrink: 0;
  width: clamp(70px, 7vw, 140px); height: clamp(50px, 5vw, 100px);
  border-radius: var(--radius);
  overflow: hidden; cursor: pointer;
  border: 2.5px solid rgba(255,255,255,0.10);
  position: relative;
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s, opacity 0.25s;
}
.map-strip-item img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.map-strip-item:hover {
  border-color: rgba(255,255,255,0.3);
}
.map-strip-item.active {
  border-color: var(--primary);
  box-shadow: 0 0 14px var(--primary-glow), inset 0 0 0 1px var(--primary);
  transform: scale(1.08);
  z-index: 1;
}
.map-strip-label {
  font-family: var(--font-ui);
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: #fff;
  font-size: clamp(8px, 0.65vw, 13px); font-weight: 600;
  text-align: center; padding: clamp(8px, 0.8vw, 16px) 2px clamp(2px, 0.2vh, 4px);
  letter-spacing: 0.5px; text-transform: uppercase;
}
.map-strip-random {
  background: var(--bg-deep);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.map-strip-dice {
  font-size: clamp(18px, 1.8vw, 36px);
  line-height: 1;
}

/* ==================================================
   HEADER ACTIONS — play / room buttons
   ================================================== */
.cust-header-actions {
  display: flex; align-items: center;
  gap: clamp(8px, 0.8vw, 16px);
  flex-shrink: 0;
}

/* Room join popup on hover */
.room-join-wrap {
  position: relative;
}
.room-join-popup {
  position: absolute; top: 100%; right: 0;
  margin-top: 8px;
  display: flex; gap: 6px; align-items: center;
  background: rgba(8,6,16,0.95);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  opacity: 0; pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 10;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  backdrop-filter: blur(12px);
}
.room-join-popup.visible {
  opacity: 1; pointer-events: auto;
  transform: translateY(0);
}
.room-join-popup .room-code-field {
  width: 100px; font-size: 16px;
  padding: 6px 10px;
}
.room-join-popup .room-join-go {
  padding: 6px 14px; font-size: 13px;
  min-width: auto;
}

/* Waiting state inline */
.waiting-text-inline {
  font-family: var(--font-ui);
  font-size: clamp(11px, 0.9vw, 15px);
  color: var(--text-muted); font-weight: 600;
}
.waiting-text-inline::after {
  content: ''; animation: dots 1.5s infinite steps(3);
}
.room-code-display {
  font-family: var(--font-display);
  font-size: clamp(20px, 1.8vw, 34px);
  letter-spacing: 6px; color: var(--primary);
  font-weight: 700;
}

/* Responsive: stack on narrow */
@media (max-width: 700px) {
  .cust-header { padding: 12px 16px; }
  .cust-center { padding: 0 12px; }
  .cust-blob-col canvas { width: 120px; height: 140px; }
  .cust-blobs-zone.single-blob .cust-blob-col canvas { width: 160px; height: 190px; }
  .cust-swatch { width: 20px; height: 20px; }
  .cust-nametag-input { font-size: 12px; min-width: 90px; }
  .cust-play-btn { padding: 8px 16px; font-size: 13px; }
  .map-strip-item { width: 64px; height: 44px; }
  .cust-bottom-extra { flex-direction: column; }
  .room-actions { flex-direction: column; }
}

/* Legacy compat */
.color-picker-row { display: flex; align-items: center; gap: 14px; justify-content: center; }
.blob-preview-sm { width: 110px; height: 128px; flex-shrink: 0; }
.blob-preview-sm canvas { width: 110px; height: 128px; }
.compact-grid { grid-template-columns: repeat(5, 1fr); gap: 4px; justify-content: center; }
.color-swatch.mini { width: 100%; aspect-ratio: 1; height: auto; }

/* ==================================================
   6. OPTIONS (right-aligned panel with label : content rows)
   ================================================== */
.options-screen {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  display: flex;
  align-items: center; justify-content: center;
  box-sizing: border-box;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at 30% 20%, rgba(255,137,6,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(100,60,180,0.03) 0%, transparent 50%),
    linear-gradient(180deg, #1c1c26 0%, #131318 50%, #0e0e13 100%);
  background-size: 200px 200px, 100% 100%, 100% 100%, 100% 100%;
  z-index: 1;
}
.options-screen .mode-select-back {
  position: absolute; top: clamp(16px, 2vh, 32px); left: clamp(16px, 2vw, 32px);
}
.options-panel {
  display: flex; flex-direction: column;
  gap: clamp(14px, 1.6vh, 24px);
  width: clamp(380px, 40vw, 640px);
  padding: clamp(24px, 3vh, 40px) clamp(28px, 3vw, 48px);
  background: rgba(20, 18, 28, 0.6);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 32px rgba(0,0,0,0.4);
}
.options-panel-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 3vw, 48px);
  font-weight: 700; color: #fff;
  letter-spacing: 4px; text-transform: uppercase;
  text-align: center;
  margin-bottom: clamp(4px, 0.5vh, 8px);
}

/* Each row: label on left, content on right */
.opt-row {
  display: flex; align-items: center;
  gap: clamp(12px, 1.5vw, 28px);
}
.opt-row-label {
  font-family: var(--font-ui);
  font-size: clamp(10px, 0.85vw, 15px);
  font-weight: 700; color: rgba(255,255,255,0.4);
  letter-spacing: clamp(2px, 0.3vw, 5px);
  text-transform: uppercase;
  width: clamp(80px, 8vw, 130px);
  flex-shrink: 0; text-align: right;
}
.opt-row-content {
  flex: 1; min-width: 0;
}
.opt-row-footer { margin-top: clamp(4px, 0.4vh, 8px); }
.opt-separator {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: clamp(2px, 0.3vh, 4px) 0;
}

/* Language selector */
.opt-lang-select {
  background: rgba(255,255,255,0.08);
  color: var(--text-main, #fff);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: border-color .2s;
}
.opt-lang-select:hover,
.opt-lang-select:focus {
  border-color: rgba(255,255,255,0.35);
}
.opt-lang-select option {
  background: #1a1a2e;
  color: #fff;
}

/* Nickname input */
.opt-nick-input {
  width: 100%; box-sizing: border-box;
  padding: clamp(10px, 0.8vw, 16px) clamp(14px, 1.1vw, 20px);
  border: 1.5px solid rgba(255,255,255,0.10);
  border-radius: var(--radius);
  background: rgba(8,6,16,0.5);
  color: var(--text); font-family: var(--font-ui);
  font-size: clamp(14px, 1.1vw, 18px); font-weight: 600;
  transition: border-color 0.15s, box-shadow 0.15s;
  backdrop-filter: blur(8px);
}
.opt-nick-input::placeholder { color: var(--text-muted); font-weight: 500; }
.opt-nick-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 16px rgba(255,137,6,0.12); }

/* Gamepad row */
.opt-gamepad-row {
  display: flex; align-items: center; gap: clamp(12px, 1vw, 20px);
}
.opt-gamepad-toggle {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; font-family: var(--font-ui);
  font-size: clamp(12px, 0.9vw, 15px);
  font-weight: 600; color: rgba(255,255,255,0.7);
}
.opt-gamepad-toggle input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--primary);
}
.gp-status { font-family: var(--font-ui); font-size: clamp(11px, 0.85vw, 14px); }
.gp-ok { color: #2ecc71; font-weight: 600; }
.gp-none { color: var(--text-muted); }

/* Reset button */
.opt-reset-btn {
  font-family: var(--font-ui); font-weight: 600;
  font-size: clamp(11px, 0.8vw, 14px);
  color: var(--text-muted); background: transparent;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius);
  padding: clamp(6px, 0.5vw, 10px) clamp(14px, 1.2vw, 22px);
  cursor: pointer; transition: all 0.15s;
  text-transform: uppercase; letter-spacing: 1px;
}
.opt-reset-btn:hover {
  border-color: var(--secondary); color: var(--secondary);
  background: rgba(255,107,138,0.08);
}

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ==================================================
   PAUSE MENU OVERLAY
   ================================================== */
.pause-menu {
  position: fixed; inset: 0;
  z-index: 300;
  display: flex; align-items: center; justify-content: center;
}
.pause-menu.hidden { display: none; }
.pause-backdrop {
  position: absolute; inset: 0;
  background: rgba(10, 8, 18, 0.75);
  backdrop-filter: blur(6px);
}
.pause-panel {
  position: relative;
  z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(12px, 1.5vh, 24px);
  padding: clamp(28px, 3vh, 48px) clamp(40px, 4vw, 80px);
  background: linear-gradient(135deg, rgba(30,28,40,0.95), rgba(20,18,30,0.98));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  animation: pauseIn 0.25s ease-out;
}
@keyframes pauseIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}
.pause-title {
  font-family: var(--font-display);
  font-size: clamp(36px, 4vw, 64px);
  font-weight: 700;
  color: #fff;
  letter-spacing: 6px;
  text-transform: uppercase;
}
.pause-buttons {
  display: flex; flex-direction: column;
  gap: clamp(6px, 0.8vh, 12px);
  width: 100%;
  min-width: clamp(200px, 20vw, 320px);
}
.pause-btn {
  font-family: var(--font-ui);
  font-size: clamp(14px, 1.2vw, 20px);
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: clamp(10px, 1.2vh, 18px) clamp(20px, 2vw, 36px);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.pause-btn:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-color: rgba(255,255,255,0.2);
}
.pause-btn--quit {
  color: rgba(231, 76, 60, 0.85);
  border-color: rgba(231, 76, 60, 0.2);
}
.pause-btn--quit:hover {
  background: rgba(231, 76, 60, 0.12);
  color: #e74c3c;
  border-color: rgba(231, 76, 60, 0.35);
}
.pause-options-container {
  width: 100%;
  max-height: 60vh;
  overflow-y: auto;
}
.pause-options-container.hidden { display: none; }

/* Inline pause options — compact keybind rows */
.pause-opt-section {
  display: flex; flex-direction: column; gap: 8px;
  padding: clamp(8px, 1vh, 16px) 0;
}
.pause-opt-row {
  display: flex; align-items: center; gap: 10px;
}
.pause-opt-label {
  font-family: var(--font-ui); font-weight: 600;
  font-size: clamp(12px, 1vw, 16px);
  color: rgba(255,255,255,0.5);
  width: clamp(60px, 6vw, 100px);
  text-align: right; flex-shrink: 0;
}
.pause-opt-keys {
  display: flex; gap: clamp(4px, 0.4vw, 8px); flex: 1;
}
.pause-opt-back-btn {
  margin-top: 8px;
  font-family: var(--font-ui); font-weight: 600;
  font-size: clamp(12px, 1vw, 16px);
  color: rgba(255,255,255,0.6);
  background: none; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.15s;
}
.pause-opt-back-btn:hover { background: rgba(255,255,255,0.06); }

/* Color swatches in pause options */
.pause-swatch-row {
  display: flex; gap: 4px; flex: 1; align-items: center;
  flex-wrap: wrap;
}
.pause-swatch {
  width: clamp(22px, 1.8vw, 32px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.pause-swatch:hover {
  transform: scale(1.2);
  border-color: rgba(255,255,255,0.5);
}
.pause-swatch.selected {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--primary), 0 2px 8px rgba(255,137,6,0.4);
  transform: scale(1.15);
}

/* ==================================================
   WIN ACTIONS OVERLAY — Replay / Menu buttons
   ================================================== */
.win-actions {
  position: fixed; bottom: clamp(28px, 4vh, 56px);
  left: 50%; transform: translateX(-50%);
  display: flex; gap: clamp(10px, 1vw, 20px);
  z-index: 200;
  animation: winActionsIn 0.5s ease-out both;
}
.win-actions.hidden { display: none; }
@keyframes winActionsIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.win-replay-btn {
  font-size: clamp(14px, 1.2vw, 20px) !important;
  padding: clamp(10px, 1vh, 16px) clamp(28px, 2.5vw, 48px) !important;
  letter-spacing: 2px;
}
.win-menu-btn {
  font-size: clamp(12px, 1vw, 16px) !important;
  padding: clamp(8px, 0.8vh, 14px) clamp(20px, 1.8vw, 36px) !important;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.7) !important;
  border-color: rgba(255,255,255,0.2) !important;
  background: rgba(8,6,16,0.6) !important;
  backdrop-filter: blur(8px);
}

/* Rematch status (online) */
.rematch-status {
  position: fixed; bottom: clamp(72px, 8vh, 110px);
  left: 50%; transform: translateX(-50%);
  z-index: 201;
  font-family: var(--font-ui); font-weight: 600;
  font-size: clamp(13px, 1vw, 17px);
  color: rgba(255,255,255,0.8);
  background: rgba(8,6,16,0.7);
  backdrop-filter: blur(8px);
  padding: clamp(8px, 0.7vh, 14px) clamp(16px, 1.4vw, 28px);
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.10);
  text-align: center;
}
.rematch-status.hidden { display: none; }
.rematch-timer {
  color: var(--primary); font-weight: 700;
}
.rematch-accept-btns {
  display: flex; gap: 10px; justify-content: center; margin-top: 8px;
}
.rematch-accept-btns button {
  font-family: var(--font-display); font-weight: 600;
  font-size: 14px; letter-spacing: 1px; text-transform: uppercase;
  padding: 8px 20px; border: none; cursor: pointer;
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
  transition: transform 0.15s;
}
.rematch-accept-btns button:hover { transform: scale(1.04); }
.rematch-accept-btn { background: var(--primary); color: #1a1018; }
.rematch-decline-btn { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.6); }

/* ==================================================
   7. NICKNAME INPUT
   ================================================== */
.nick-input {
  padding: 10px 14px; border-radius: var(--radius);
  border: 1.5px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.06);
  color: var(--text); font-family: var(--font-ui); font-size: 14px; font-weight: 600;
  text-align: center; width: 220px; transition: border-color 0.15s, box-shadow 0.15s;
}
.nick-input::placeholder { color: var(--text-muted); font-weight: 600; }
.nick-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 16px rgba(255,137,6,0.10); }

/* ==================================================
   8. COLOR SELECTION
   ================================================== */
.color-players {
  display: flex; gap: 48px; margin-bottom: 28px;
  flex-wrap: wrap; justify-content: center;
}
.color-section { text-align: center; min-width: 200px; flex: 1; }
.color-section h3 {
  font-family: var(--font-ui);
  font-size: 12px; margin-bottom: 8px; color: var(--text-body);
  font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px;
}

.input-hint {
  font-size: 10px; color: var(--text-muted); margin-bottom: 8px;
  font-weight: 600; letter-spacing: 0.3px;
  padding: 3px 10px; border-radius: var(--radius);
  background: rgba(255,255,255,0.03); display: inline-block;
}

.blob-preview-container {
  width: 120px; height: 120px; margin: 0 auto 12px;
  background: radial-gradient(circle, rgba(255,255,255,0.02) 0%, transparent 70%);
  border-radius: 50%;
}

.color-grid {
  display: grid; grid-template-columns: repeat(5, 40px); gap: 8px;
  justify-content: center;
}
.color-swatch {
  width: 40px; height: 40px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,0.05);
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(.34,1.56,.64,1), border-color 0.15s, box-shadow 0.15s;
}
.color-swatch:hover { transform: scale(1.18); border-color: rgba(255,255,255,0.25); }
.color-swatch.selected {
  border-color: #fff; transform: scale(1.12);
  box-shadow: 0 0 16px rgba(255,255,255,0.15);
}

.color-actions {
  display: flex; gap: 14px; align-items: center; justify-content: center;
  margin-top: 16px;
}

/* ==================================================
   9. MAP CAROUSEL (legacy — kept for compat)
   ================================================== */

/* ==================================================
   10. STATUS BAR
   ================================================== */
#status-bar {
  pointer-events: none; position: absolute;
  top: 16px; left: 50%; transform: translateX(-50%);
  background: rgba(10,10,20,0.92); color: var(--primary);
  padding: 8px 24px; border-radius: var(--radius); font-size: 13px;
  display: none; z-index: 200; backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.04); font-weight: 700;
  font-family: var(--font-ui);
}

/* ==================================================
   11. ROOM LOBBY (1v1)
   ================================================== */
.room-actions-card { text-align: center; }
.room-join-row { display: flex; gap: 8px; align-items: center; justify-content: center; }

#room-code-input {
  padding: 12px 16px; border-radius: var(--radius);
  border: 1.5px solid rgba(255,255,255,0.06);
  background: var(--surface); color: var(--text); font-size: 22px; width: 150px;
  text-align: center; font-family: var(--font-display); letter-spacing: 5px;
  font-weight: 700; text-transform: uppercase; transition: border-color 0.15s, box-shadow 0.15s;
}
#room-code-input::placeholder { color: var(--text-muted); font-size: 13px; letter-spacing: 1px; }
#room-code-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 16px rgba(255,137,6,0.10); }

#room-status {
  text-align: center; padding: 20px 32px; border-radius: var(--radius-md);
  background: var(--surface); border: 1px solid var(--stroke);
  min-width: 260px; backdrop-filter: blur(8px);
}
/* room-code-display moved to standalone class in section 5b */
#room-status .room-hint { font-size: 11px; color: var(--text-muted); margin-top: 6px; font-weight: 600; }
@keyframes dots { 0% { content: ''; } 33% { content: '.'; } 66% { content: '..'; } 100% { content: '...'; } }
#room-status .waiting-text { color: var(--text-body); font-size: 14px; font-weight: 600; }
#room-status .waiting-text::after { content: ''; animation: dots 1.5s infinite steps(3); }

/* (room-nick-row removed — nickname now set in color select) */

/* ==================================================
   12. QUEUE
   ================================================== */
.queue-status-box {
  text-align: center; margin-top: 24px; font-size: 15px;
  color: var(--text-body); font-weight: 600;
  padding: 20px 32px; border-radius: var(--radius-md);
  background: var(--surface); border: 1px solid var(--stroke);
  max-width: var(--max-w); width: 100%;
}

/* ==================================================
   13. 2v2 LOBBY — SETUP
   ================================================== */
.lobby-2v2-setup {
  display: flex; flex-direction: column; align-items: center; gap: 0;
  margin-bottom: 20px;
  width: 100%; max-width: var(--max-w);
}
.room-code-field {
  padding: 8px 12px; border-radius: var(--radius);
  border: 1.5px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.06); color: var(--text);
  font-family: var(--font-display); font-size: 20px; width: 110px;
  text-align: center; letter-spacing: 4px;
  font-weight: 600; text-transform: uppercase;
}
.room-code-field::placeholder { color: var(--text-muted); font-size: 13px; letter-spacing: 1px; }
.room-code-field:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 16px rgba(255,137,6,0.10); }

/* ── Room choice screen (Créer / Rejoindre) ── */
.room-choice-grid {
  display: flex; flex-direction: column; gap: 14px; align-items: center;
  max-width: 440px; margin: 0 auto; padding: 60px 0 20px;
}
.room-choice-card { max-width: 420px; }

/* Join card content states */
.room-join-default {
  display: flex; align-items: center; gap: 12px; width: 100%;
}
.room-join-default.hidden { display: none; }
.room-join-input {
  display: flex; align-items: center; justify-content: center;
  width: 100%; animation: fadeIn 0.2s ease;
}
.room-join-input.hidden { display: none; }
.room-join-field-wrap {
  position: relative; display: flex; align-items: center;
  width: 100%; max-width: 260px;
}
.room-code-field-inline {
  font-size: clamp(20px, 2vw, 28px); width: 100%;
  padding: 10px 48px 10px 16px; letter-spacing: 6px;
}
.room-join-go-btn {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff;
  border: none; border-radius: 6px;
  font-size: 18px; cursor: pointer;
  transition: background 0.15s, transform 0.12s;
}
.room-join-go-btn:hover {
  background: #e08a00;
  transform: translateY(-50%) scale(1.08);
}

.mode-select-title-inline {
  display: flex; flex-direction: column; gap: 2px; margin-left: 16px;
}
.mode-select-title-inline .cust-mode-label { font-size: 10px; text-transform: uppercase; letter-spacing: 2px; color: var(--text-muted); }
.mode-select-title-inline .cust-mode-name { font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--text); }
.mode-select-back { display: flex; align-items: center; }

/* ==================================================
   14. 2v2 LOBBY — ROOM
   ================================================== */
.lobby-2v2-room { text-align: center; width: 100%; max-width: 520px; }

.room-code-banner {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  margin-bottom: 20px; padding: 12px 24px;
  background: var(--surface); border-radius: var(--radius-md);
  border: 1px solid var(--stroke);
}
.room-code-label {
  font-family: var(--font-ui);
  font-size: 9px; color: var(--text-muted); letter-spacing: 3px;
  text-transform: uppercase; font-weight: 700;
}
.room-code-value {
  font-family: var(--font-display);
  font-size: 36px; letter-spacing: 8px;
  color: var(--primary); font-weight: 700; line-height: 1.2;
}

.lobby-teams-grid {
  display: flex; gap: 12px; justify-content: center; align-items: stretch;
  margin-bottom: 16px;
}
.lobby-vs {
  display: flex; align-items: center; font-size: 18px; font-weight: 900;
  color: rgba(255,255,255,0.12); letter-spacing: 2px; padding: 0 2px;
  font-family: var(--font-display);
}

.lobby-team-card {
  background: var(--surface); border-radius: var(--radius-md); padding: 14px 18px;
  min-width: 180px; flex: 1; max-width: 220px;
  border: 1.5px solid var(--stroke); transition: border-color 0.15s, box-shadow 0.15s;
}
.lobby-team-card.my-team {
  border-color: var(--primary); box-shadow: 0 0 16px rgba(255,137,6,0.10);
}
.team-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--stroke);
}
.team-header h3 {
  margin: 0; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  font-family: var(--font-display);
}
.team-red .team-header h3 { color: var(--secondary); }
.team-blue .team-header h3 { color: var(--info); }
.team-player-count {
  font-size: 11px; color: var(--text-muted); font-weight: 700;
  background: rgba(255,255,255,0.04); padding: 2px 7px; border-radius: var(--radius);
  font-family: var(--font-ui);
}

.lobby-player {
  padding: 8px 12px; margin: 5px 0; border-radius: var(--radius);
  background: rgba(255,255,255,0.03); transition: background 0.15s;
}
.lobby-player.is-me {
  background: rgba(255,137,6,0.06); border: 1px solid rgba(255,137,6,0.15);
}
.lobby-player.empty {
  background: rgba(255,255,255,0.015); border: 1px dashed rgba(255,255,255,0.05);
}
.lobby-player-name {
  font-size: 13px; font-weight: 600; color: var(--text-body);
  display: flex; align-items: center; gap: 5px; justify-content: center;
  font-family: var(--font-ui);
}
.lobby-player.is-me .lobby-player-name { color: var(--primary); font-weight: 700; }
.empty-slot-text { color: var(--text-muted); font-style: italic; font-size: 12px; }

.host-badge {
  font-size: 8px; font-weight: 700; letter-spacing: 1px;
  background: linear-gradient(135deg, #ffb347, var(--primary));
  color: #1a1018; padding: 1px 5px;
  clip-path: polygon(2px 0, calc(100% - 2px) 0, 100% 100%, 0 100%);
  font-family: var(--font-display); text-transform: uppercase;
}
.you-tag {
  font-size: 9px; font-weight: 700; color: var(--primary); opacity: 0.6;
  font-family: var(--font-ui);
}

.btn-join-team {
  margin-top: 8px; width: 100%; padding: 6px; font-size: 11px; font-weight: 700;
  border: 1px dashed rgba(255,137,6,0.3); border-radius: var(--radius);
  background: transparent; color: var(--primary); cursor: pointer;
  transition: all 0.15s; font-family: var(--font-ui);
}
.btn-join-team:hover {
  background: rgba(255,137,6,0.08); border-color: var(--primary);
}

.lobby-bottom {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.lobby-status-text { font-size: 13px; color: var(--text-muted); font-weight: 600; font-family: var(--font-ui); }
.lobby-status-text .player-counter { color: var(--primary); font-weight: 700; }
.lobby-status-text.warn { color: var(--secondary); }
.lobby-status-text.ready { color: var(--accent); }

.btn-launch { min-width: 180px; }
.btn-launch.disabled { opacity: 0.3; cursor: not-allowed; pointer-events: none; }

.team-toast {
  font-size: 12px; color: #e74c3c; margin-top: 8px; opacity: 0; transition: opacity 0.15s;
  min-height: 18px; text-align: center;
}
.team-toast.show { opacity: 1; }

/* ==================================================
   15. LIVE ROOM LOBBY
   ================================================== */
.lobby-screen { position: relative; }

/* Connecting state */
.lobby-connecting {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 60px 20px;
  font-family: var(--font-ui); font-size: 16px; font-weight: 600;
  color: var(--text-muted); letter-spacing: 1px;
}

/* Room code in header */
.lobby-code {
  font-family: var(--font-display);
  font-size: clamp(18px, 1.6vw, 28px); font-weight: 700;
  letter-spacing: 6px; color: var(--primary);
  background: rgba(255,137,6,0.08);
  padding: 4px 16px; border-radius: var(--radius);
  border: 1px solid rgba(255,137,6,0.2);
}

/* Player zone for empty slot */
.lobby-empty-blob {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: clamp(165px, min(16.5vw, 33vh), 470px);
  gap: 12px;
}
.lobby-empty-waiting-text {
  font-size: 13px; color: var(--text-muted); font-weight: 500;
  letter-spacing: 0.02em; opacity: 0.8;
}

/* Bouncing dots animation */
.lobby-waiting-dots {
  display: inline-flex; gap: 4px; align-items: center;
  margin-left: 4px;
}
.lobby-waiting-dots span {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: lobbyDotBounce 1.2s ease-in-out infinite;
}
.lobby-waiting-dots span:nth-child(2) { animation-delay: 0.15s; }
.lobby-waiting-dots span:nth-child(3) { animation-delay: 0.3s; }
.lobby-waiting-dots.big span {
  width: 14px; height: 14px;
  background: var(--primary);
  opacity: 0.5;
}
@keyframes lobbyDotBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-10px); opacity: 1; }
}

/* Actions bar (ready button, status text) */
.lobby-actions {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: clamp(10px, 1.2vh, 18px) clamp(12px, 1vw, 24px);
  flex-shrink: 0;
}

/* Ready button */
.lobby-ready-btn {
  min-width: 180px;
  font-size: clamp(14px, 1.2vw, 20px);
  padding: clamp(10px, 1vh, 16px) clamp(28px, 3vw, 56px);
}
.lobby-ready-btn.ready {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #1a1018;
}
.lobby-ready-btn:disabled {
  opacity: 0.6; cursor: not-allowed;
}

/* Ready status text */
.ready-text { color: var(--accent); font-weight: 700; }

/* Map display in lobby */
.lobby-map-readonly {
  display: flex; align-items: center; gap: 10px; justify-content: center;
}
.lobby-map-thumb {
  width: clamp(50px, 5vw, 80px); height: auto; border-radius: var(--radius);
  border: 1px solid var(--stroke);
}
.lobby-map-label {
  font-family: var(--font-ui); font-size: clamp(13px, 1.1vw, 18px);
  font-weight: 600; color: var(--text-body); letter-spacing: 1px;
}
.lobby-map-strip {
  display: flex; align-items: center; gap: 12px; justify-content: center;
}
.lobby-map-current {
  display: flex; align-items: center; gap: 10px;
}

/* 2v2 lobby grid */
.lobby-2v2-grid {
  display: flex; align-items: stretch; justify-content: center;
  gap: clamp(16px, 2vw, 40px); width: 100%;
}
.lobby-team-side {
  flex: 1; max-width: 280px;
  display: flex; flex-direction: column; gap: 8px;
}
.lobby-team-label {
  font-family: var(--font-display); font-size: 14px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 2px; color: var(--text-muted);
  text-align: center;
}
.lobby-team-slots {
  display: flex; flex-direction: column; gap: 12px;
}
.lobby-vs-divider {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 24px; font-weight: 900; color: rgba(255,255,255,0.1);
  letter-spacing: 2px; gap: 10px;
}
.lobby-vs-text { display: block; }
.lobby-team-switch-btn {
  padding: 8px 16px; font-size: 22px;
  background: transparent; border: 1.5px solid rgba(255,137,6,0.3);
  border-radius: var(--radius); color: var(--primary);
  cursor: pointer; transition: all 0.15s;
}
.lobby-team-switch-btn:hover {
  background: rgba(255,137,6,0.12); border-color: var(--primary);
  transform: scale(1.1);
}
.lobby-2v2-slot {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px; border-radius: var(--radius-md);
  background: var(--surface); border: 1px solid var(--stroke);
  transition: border-color 0.15s;
}
.lobby-2v2-slot.is-me {
  border-color: var(--primary); box-shadow: 0 0 12px rgba(255,137,6,0.08);
}
.lobby-2v2-slot.empty {
  background: rgba(255,255,255,0.02); border-style: dashed;
  min-height: 100px; justify-content: center;
}
.lobby-2v2-name {
  font-family: var(--font-ui); font-size: 13px; font-weight: 600;
  color: var(--text-body);
}
.lobby-2v2-name-input {
  font-family: var(--font-ui); font-size: 13px; font-weight: 600;
  color: var(--text-body); background: rgba(255,255,255,0.05);
  border: 1px solid var(--stroke); border-radius: var(--radius);
  padding: 4px 8px; text-align: center; width: 100%;
  outline: none; transition: border-color 0.15s;
}
.lobby-2v2-name-input:focus {
  border-color: var(--primary);
}
.lobby-2v2-empty-label {
  font-size: 11px; color: var(--text-muted); font-style: italic;
}
.lobby-2v2-player-info {
  display: flex; align-items: center; gap: 6px; width: 100%;
}
.lobby-ready-led {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.1);
  transition: background 0.2s, box-shadow 0.2s;
}
.lobby-ready-led.ready {
  background: #4ade80; border-color: #22c55e;
  box-shadow: 0 0 6px rgba(74,222,128,0.5);
}
.lobby-team-colors {
  display: flex; flex-direction: column; gap: 3px;
  margin-top: 8px; justify-content: center;
}
.lobby-team-colors .cust-colors-row {
  display: flex; gap: 3px; justify-content: center;
}
.lobby-team-colors .cust-swatch {
  width: 18px; height: 18px;
}

/* Readonly swatch (no hover effects) */
.cust-swatch.readonly { cursor: default; pointer-events: none; }

/* ==================================================
   16. ANIMATIONS
   ================================================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.2s ease-out; }

/* ==================================================
   16. RESPONSIVE
   ================================================== */
@media (max-width: 640px) {
  :root { --max-w: 100%; }

  #color-select, #room-lobby { padding: 32px 16px 32px; }

  .splash-title .title { font-size: 36px; letter-spacing: 1px; }
  .splash-title .subtitle { font-size: 10px; letter-spacing: 4px; }
  .splash-title { margin-bottom: 36px; }

  .mode-buttons > button { padding: 12px 24px; font-size: 14px; }

  .color-players { gap: 24px; }
  .color-section { min-width: 160px; }
  .blob-preview-container { width: 100px; height: 100px; }
  .color-grid { grid-template-columns: repeat(5, 36px); gap: 6px; }
  .color-swatch { width: 36px; height: 36px; }


  .lobby-teams-grid { flex-direction: column; align-items: center; }
  .lobby-team-card { min-width: 0; max-width: 100%; width: 100%; }
  .lobby-vs { padding: 4px 0; font-size: 14px; }

  .room-code-value { font-size: 28px; letter-spacing: 6px; }

  .screen-header h2 { font-size: 20px; }

}

@media (max-width: 400px) {
  .color-players { flex-direction: column; gap: 20px; }
  .room-join-row { flex-direction: column; }
  #room-code-input { width: 100%; }
}
