:root {
  --font-display: 'Fredoka', cursive, sans-serif;
  --font-body: 'Nunito', sans-serif;
  --bg-dark: #1b2818;
  --card-bg: rgba(255, 252, 240, 0.94);
  --card-border: #3a2614;
  --accent-green: #38d84e;
  --accent-purple: #b84eff;
  --accent-orange: #ff8a1e;
  --accent-yellow: #ffd93b;
  --accent-red: #ff4757;
  --text-main: #2a1b0e;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  font-family: var(--font-body);
  color: var(--text-main);
}

#game-wrapper {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

#game-canvas.sleeping {
  display: none !important;
}

/* ==================== TOP HUD ==================== */
#hud-top {
  position: absolute;
  top: 12px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  pointer-events: none;
  z-index: 10;
}

.hud-card {
  pointer-events: auto;
  background: var(--card-bg);
  border: 3.5px solid var(--card-border);
  border-radius: 18px;
  padding: 8px 14px;
  box-shadow: 0 5px 0 var(--card-border), 0 8px 20px rgba(0, 0, 0, 0.28);
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-badge {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: #1f7a1f;
  text-shadow: 0 2px 0 #d5f7b8;
  white-space: nowrap;
}

.level-selector {
  display: none !important;
}

/* Health Bar Card — Minimalist, displays on HP change or <= 10% HP */
.health-card {
  gap: 8px;
  padding: 6px 12px;
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.2, 0.9, 0.3, 1), transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.health-card.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.health-card.critical {
  border-color: #ff4757;
  box-shadow: 0 0 14px rgba(255, 71, 87, 0.7), 0 5px 0 var(--card-border);
  animation: criticalPulse 0.65s infinite alternate ease-in-out;
}

.health-card.critical .health-heart {
  animation: heartFastBeat 0.45s infinite ease-in-out;
}

@keyframes criticalPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.05); }
}

@keyframes heartFastBeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.35); }
}

.health-heart {
  font-size: 1.35rem;
  line-height: 1;
  display: inline-block;
  animation: heartPulse 2.2s infinite ease-in-out;
}

@keyframes heartPulse {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.22); }
  28% { transform: scale(1); }
  42% { transform: scale(1.14); }
}

.health-bar-wrap {
  width: 120px;
  height: 12px;
  background: #2a1b0e;
  border: 2px solid var(--card-border);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.3);
}

.health-bar-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #ff4757, #ffa502, #2ed573);
  background-size: 200% 100%;
  border-radius: 999px;
  transition: width 0.25s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.health-bar-fill.danger {
  background: #ff4757;
  animation: pulseHealth 0.7s infinite;
}

@keyframes pulseHealth {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* Power-Up HUD Card — Compact & Ergonomic Timer */
.powerup-card {
  gap: 8px;
  padding: 6px 12px;
  min-width: 90px;
  border-radius: 16px;
  border-color: #00d2d3;
  box-shadow: 0 4px 0 var(--card-border), 0 0 12px rgba(0, 210, 211, 0.45);
  animation: powerupPulse 1.2s infinite alternate ease-in-out;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

@keyframes powerupPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.03); }
}

.powerup-icon {
  font-size: 1.45rem;
  line-height: 1;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}

.powerup-timer-box {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 50px;
}

.powerup-timer {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 800;
  color: #2a1b0e;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.powerup-mini-track {
  width: 100%;
  height: 6px;
  background: rgba(42, 27, 14, 0.25);
  border: 1.5px solid var(--card-border);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.powerup-bar-fill {
  width: 100%;
  height: 100%;
  background: #00d2d3;
  border-radius: 999px;
  transition: width 0.1s linear;
}

/* Timer & Progress */
.timer-card {
  gap: 14px;
}

.timer-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 96px;
}

.timer-label {
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #7c5c38;
}

.timer-value {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  color: #2a1b0e;
  font-variant-numeric: tabular-nums;
}

.timer-record {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: #d48200;
  font-variant-numeric: tabular-nums;
}

.timer-divider {
  width: 2px;
  height: 32px;
  background: rgba(58, 38, 20, 0.2);
}

.progress-bar-wrap {
  position: relative;
  width: 145px;
  height: 16px;
  background: #e2d5b5;
  border: 2.5px solid var(--card-border);
  border-radius: 999px;
  overflow: visible;
  margin-left: 4px;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #43e97b 0%, #f9d423 100%);
  border-radius: 999px;
  transition: width 0.08s linear;
}

.progress-bug {
  position: absolute;
  top: -8px;
  left: 0%;
  transform: translateX(-50%);
  font-size: 1.05rem;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.35));
  transition: left 0.08s linear;
}

.progress-flag {
  position: absolute;
  right: -8px;
  top: -9px;
  font-size: 1.05rem;
}

/* Action Buttons */
.actions-card {
  gap: 6px;
  padding: 6px 10px;
}

.action-btn {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 800;
  padding: 7px 11px;
  border-radius: 12px;
  border: 2.5px solid var(--card-border);
  background: #fff5dc;
  color: var(--text-main);
  cursor: pointer;
  box-shadow: 0 3px 0 var(--card-border);
  transition: transform 0.1s ease, background 0.15s ease, box-shadow 0.1s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-btn:hover {
  background: #ffebb3;
  transform: translateY(-2px);
  box-shadow: 0 5px 0 var(--card-border);
}

.action-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--card-border);
}

.action-btn.icon-only {
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 1.22rem;
  line-height: 1;
}

kbd {
  display: inline-block;
  padding: 1px 6px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  background: #fff;
  border: 2px solid var(--card-border);
  border-radius: 6px;
  box-shadow: 0 2px 0 var(--card-border);
  color: var(--text-main);
}

/* ==================== BOTTOM HUD (ANCHORS Q & D) ==================== */
#hud-bottom {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 10;
  pointer-events: none;
}

.anchor-widget {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 20px;
  background: rgba(42, 27, 14, 0.88);
  border: 3.5px solid #59412a;
  color: #f4ead5;
  min-width: 235px;
  box-shadow: 0 6px 0 #1e1309, 0 10px 24px rgba(0, 0, 0, 0.45);
  transition: all 0.15s cubic-bezier(0.22, 1, 0.36, 1);
}

.key-cap {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: #3d2c1d;
  border: 3px solid #75593e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  color: #cbb69d;
  box-shadow: 0 4px 0 #1f140b;
  transition: all 0.12s ease;
}

.anchor-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.anchor-title {
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  opacity: 0.85;
}

.anchor-state {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
}

.suction-icon {
  font-size: 1.55rem;
  transition: transform 0.18s ease;
}

/* State: Anchored (Illuminated!) */
#anchor-rear-widget.anchored {
  background: linear-gradient(135deg, #521685 0%, #8624d6 100%);
  border-color: #f3c4ff;
  box-shadow: 0 6px 0 #310a52, 0 0 26px rgba(196, 92, 255, 0.85);
  transform: translateY(-3px) scale(1.03);
}

#anchor-rear-widget.anchored .key-cap {
  background: #ffdf4d;
  border-color: #fff;
  color: #2a1b0e;
  box-shadow: 0 0 14px #ffdf4d, 0 3px 0 #9c7a00;
}

#anchor-front-widget.anchored {
  background: linear-gradient(135deg, #0d6d28 0%, #24bd4c 100%);
  border-color: #c9ffda;
  box-shadow: 0 6px 0 #073d15, 0 0 26px rgba(56, 216, 78, 0.85);
  transform: translateY(-3px) scale(1.03);
}

#anchor-front-widget.anchored .key-cap {
  background: #ffdf4d;
  border-color: #fff;
  color: #2a1b0e;
  box-shadow: 0 0 14px #ffdf4d, 0 3px 0 #9c7a00;
}

/* State: Armed (Waiting for surface contact) */
.anchor-widget.armed {
  background: linear-gradient(135deg, #5c430e 0%, #997118 100%);
  border-color: #ffe380;
  box-shadow: 0 6px 0 #332406, 0 0 16px rgba(255, 217, 59, 0.55);
}

.anchor-widget.armed .key-cap {
  background: #ffe380;
  color: #2a1b0e;
}

/* State: Slipping on moss */
.anchor-widget.slipping {
  background: linear-gradient(135deg, #0d5e6d 0%, #1db5cf 100%);
  border-color: #b8f6ff;
  box-shadow: 0 6px 0 #06353d, 0 0 22px rgba(45, 224, 255, 0.8);
}

/* State: Stuck in sticky crumbs */
.anchor-widget.stuck {
  background: linear-gradient(135deg, #7d1935 0%, #d63447 100%);
  border-color: #ffb8c1;
  box-shadow: 0 6px 0 #450b1b, 0 0 24px rgba(255, 71, 87, 0.85);
  animation: shake-stuck 0.25s infinite;
}

@keyframes shake-stuck {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

/* Omega Arch Widget */
.omega-widget {
  pointer-events: auto;
  background: var(--card-bg);
  border: 3.5px solid var(--card-border);
  border-radius: 20px;
  padding: 9px 18px;
  min-width: 255px;
  box-shadow: 0 6px 0 var(--card-border), 0 10px 24px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.omega-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 800;
}

.omega-pct {
  font-family: var(--font-display);
  color: #d95300;
  font-weight: 700;
}

.omega-meter-track {
  width: 100%;
  height: 13px;
  background: #e2d4b7;
  border: 2.5px solid var(--card-border);
  border-radius: 999px;
  overflow: hidden;
}

.omega-meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffb703 0%, #fb8500 50%, #ff2a55 100%);
  border-radius: 999px;
  transition: width 0.04s linear;
}

.com-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.76rem;
  font-weight: 800;
  color: #664928;
  margin-top: 2px;
}

.com-arrow {
  font-size: 0.95rem;
  color: #b59e82;
  transition: transform 0.1s ease, color 0.1s ease;
}

.com-arrow.active {
  color: #ff6b00;
  transform: scale(1.4);
}

/* Coach Banner */
.coach-banner {
  position: absolute;
  bottom: 98px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 250, 224, 0.92);
  border: 2.5px solid var(--card-border);
  border-radius: 999px;
  padding: 6px 18px;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-main);
  box-shadow: 0 4px 0 var(--card-border);
  pointer-events: none;
  z-index: 9;
  white-space: nowrap;
  transition: opacity 0.3s ease;
}

/* ==================== MODALS ==================== */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 28, 14, 0.72);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  background: #fffcf0;
  border: 5px solid var(--card-border);
  border-radius: 28px;
  padding: 28px 34px;
  max-width: 620px;
  width: 92%;
  box-shadow: 0 12px 0 var(--card-border), 0 24px 50px rgba(0, 0, 0, 0.55);
  text-align: center;
  animation: pop-in 0.28s cubic-bezier(0.18, 1.25, 0.4, 1);
}

@keyframes pop-in {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.victory-crown {
  font-size: 2.6rem;
  margin-bottom: 6px;
}

.modal-card h1, .modal-card h2 {
  font-family: var(--font-display);
  color: #1f6e1f;
  font-size: 2.1rem;
  margin-bottom: 6px;
}

.victory-subtitle {
  font-size: 1.05rem;
  font-weight: 800;
  color: #6b4e2e;
  margin-bottom: 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

.stat-box {
  background: #f4ebd2;
  border: 3px solid var(--card-border);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 900;
  color: #7c5c38;
}

.stat-val {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
}

.stat-val.gold {
  color: #d48200;
}

.new-record-badge {
  background: var(--accent-yellow);
  border: 3px solid var(--card-border);
  border-radius: 12px;
  padding: 8px 14px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 18px;
  display: inline-block;
  box-shadow: 0 4px 0 var(--card-border);
}

.new-record-badge.hidden {
  display: none;
}

.modal-buttons {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 12px;
}

.big-btn {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: 16px;
  border: 3.5px solid var(--card-border);
  cursor: pointer;
  box-shadow: 0 5px 0 var(--card-border);
  transition: transform 0.12s ease;
}

.big-btn:hover {
  transform: translateY(-2px);
}

.big-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--card-border);
}

.big-btn.primary {
  background: var(--accent-green);
  color: #113311;
}

.big-btn.secondary {
  background: var(--accent-yellow);
  color: var(--text-main);
}

/* Help Modal specifics */
.help-intro {
  font-size: 0.95rem;
  line-height: 1.45;
  color: #543d22;
  margin-bottom: 16px;
}

.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  text-align: left;
  margin-bottom: 14px;
}

.ctrl-item {
  background: #f5ecd6;
  border: 2.5px solid var(--card-border);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.ctrl-keys {
  min-width: 72px;
  text-align: center;
}

.sub-key {
  display: block;
  font-size: 0.7rem;
  color: #7c5c38;
  margin-top: 2px;
}

.ctrl-desc {
  font-size: 0.83rem;
  line-height: 1.35;
}

.tech-tips {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  text-align: left;
  margin-bottom: 14px;
}

.tech-box {
  background: #eef8e8;
  border: 2.5px solid #2b5922;
  border-radius: 14px;
  padding: 10px 12px;
}

.tech-box h4 {
  font-family: var(--font-display);
  color: #1e5c1e;
  margin-bottom: 4px;
  font-size: 0.95rem;
}

.tech-box p {
  font-size: 0.78rem;
  line-height: 1.38;
}

/* Cosmetics Modal */
.cosmetics-card {
  max-width: 720px;
  max-height: 88vh;
  overflow-y: auto;
  text-align: left;
}

.cosmetics-card h2 {
  text-align: center;
}

.section-desc {
  font-size: 0.78rem;
  color: #6a4f33;
  margin-bottom: 8px;
  line-height: 1.3;
}

.class-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.class-card {
  background: #fffcf0;
  border: 2.5px solid var(--card-border);
  border-radius: 14px;
  padding: 10px 12px;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 5px;
  box-shadow: 0 3px 0 var(--card-border);
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.class-card:hover {
  transform: translateY(-2px);
  background: #fff9e6;
}

.class-card.active {
  background: #fff4cc;
  border-color: #2b7a2b;
  border-width: 3px;
  box-shadow: 0 4px 0 #2b7a2b;
}

.class-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.class-icon {
  font-size: 1.5rem;
}

.class-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: #1a1007;
}

.class-subtitle {
  font-size: 0.72rem;
  font-weight: 800;
  color: #7c5c38;
}

.class-desc {
  font-size: 0.76rem;
  color: #4a3420;
  line-height: 1.3;
  margin: 0;
}

.class-badges {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 3px;
}

.class-badges .badge {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 6px;
  display: inline-block;
  line-height: 1.25;
}

.class-badges .badge.pro {
  background: #d4f8d4;
  color: #156015;
  border: 1px solid #82d882;
}

.class-badges .badge.con {
  background: #fee7d6;
  color: #8c3b10;
  border: 1px solid #f6ab80;
}

.cosmetic-section {
  text-align: left;
  margin-bottom: 14px;
  background: #f5ecd6;
  border: 2.5px solid var(--card-border);
  border-radius: 16px;
  padding: 10px 14px;
}

.cosmetic-section h4 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: #2a1b0e;
  margin-bottom: 8px;
}

.cosmetic-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cos-btn {
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 11px;
  border: 2.5px solid var(--card-border);
  background: #fffcf0;
  color: var(--text-main);
  cursor: pointer;
  box-shadow: 0 3px 0 var(--card-border);
  transition: transform 0.1s ease, background 0.12s ease;
}

.cos-btn:hover {
  transform: translateY(-2px);
  background: #fff3c4;
}

.cos-btn.active {
  background: var(--accent-yellow);
  transform: translateY(-1px);
  box-shadow: 0 4px 0 var(--card-border);
}

@media (max-width: 1100px) {
  .coach-banner {
    display: none;
  }
  .progress-bar-wrap {
    display: none;
  }
}

/* ==================== TUNING & GAMEPLAY LAB MODAL ==================== */
.tuning-card {
  max-width: 720px;
  max-height: 88vh;
  overflow-y: auto;
  text-align: left;
}

.tuning-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.close-x-btn {
  background: none;
  border: 2px solid var(--card-border);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  color: var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease, background 0.12s ease;
}

.close-x-btn:hover {
  background: #ff7675;
  color: #fff;
  transform: scale(1.1);
}

.tuning-section {
  background: #f5ecd6;
  border: 2.5px solid var(--card-border);
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.tuning-section h4 {
  font-family: var(--font-display);
  font-size: 1rem;
  color: #2a1b0e;
  margin-bottom: 10px;
}

.preset-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.preset-btn {
  background: #fffcf0;
  border: 2.5px solid var(--card-border);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-shadow: 0 3px 0 var(--card-border);
  transition: transform 0.1s ease, background 0.12s ease;
}

.preset-btn:hover {
  transform: translateY(-2px);
  background: #fff3c4;
}

.preset-btn.active {
  background: var(--accent-yellow);
  box-shadow: 0 4px 0 var(--card-border);
  border-color: #533618;
}

.preset-btn strong {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: #1a1007;
}

.preset-btn span {
  font-size: 0.72rem;
  color: #6a4f33;
  line-height: 1.25;
}

.tuning-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
}

.tune-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tune-item label {
  font-size: 0.78rem;
  font-weight: 800;
  color: #3b2817;
  display: flex;
  justify-content: space-between;
}

.tune-val {
  font-family: var(--font-display);
  font-weight: 700;
  color: #1f6e1f;
}

.tune-item input[type="range"] {
  width: 100%;
  accent-color: #24bd4c;
  cursor: pointer;
}

.tune-item.checkbox-item {
  grid-column: 1 / -1;
  margin-top: 4px;
}

.tune-item.checkbox-item label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.85rem;
}

.tuning-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}

/* ==================== MULTIPLAYER CARTOON WOOD + DARK-GLASS UI ==================== */

#mp-ui-root {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 30;
}

#mp-ui-root .modal-backdrop,
#mp-ui-root .modal-card,
#mp-ui-root .mp-results-card,
#mp-ui-root .mp-podium-card,
#mp-ui-root .draft-mod-card,
#mp-ui-root button {
  pointer-events: auto;
}

.mp-screen {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  padding: 18px 24px;
  gap: 16px;
  overflow: hidden;
}

.mp-screen.hidden {
  display: none !important;
}

.mp-forest-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 25%, rgba(56, 216, 78, 0.22), transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(255, 138, 30, 0.16), transparent 55%),
    linear-gradient(180deg, rgba(16, 32, 20, 0.80) 0%, rgba(11, 22, 15, 0.90) 100%);
  backdrop-filter: blur(5px);
  z-index: -1;
}

/* Cartoon Wood Headers & Signs */
.mp-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.wood-sign-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 26px;
  background: linear-gradient(180deg, #9b622f 0%, #78471d 55%, #5e3513 100%);
  border: 4px solid #351c08;
  border-radius: 18px;
  box-shadow: 0 6px 0 #261304, inset 0 2px 0 rgba(255, 225, 175, 0.45), 0 10px 24px rgba(0, 0, 0, 0.45);
  color: #fff8e7;
  font-family: var(--font-display);
}

.wood-bolt {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #d2dae2, #485460);
  border: 2px solid #1e272e;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.wood-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: #fff3c4;
  text-shadow: 0 3px 0 #351c08;
}

.wood-sub {
  font-size: 0.78rem;
  font-weight: 900;
  padding: 3px 10px;
  border-radius: 999px;
  background: #2f8f38;
  border: 2px solid #15451b;
  color: #e8ffea;
  letter-spacing: 0.5px;
}

.wood-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  background: linear-gradient(180deg, #a56933 0%, #7e4b20 100%);
  border: 3.5px solid #351c08;
  border-radius: 14px;
  box-shadow: 0 5px 0 #261304, inset 0 2px 0 rgba(255, 230, 185, 0.4);
  color: #fff8e7;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.wood-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.wood-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #261304;
}

.wood-btn.danger-wood {
  background: linear-gradient(180deg, #d64545 0%, #9e2a2a 100%);
  border-color: #420e0e;
}

.mini-wood-btn {
  padding: 6px 12px;
  background: linear-gradient(180deg, #ffb142, #cc8e35);
  border: 2.5px solid #351c08;
  border-radius: 10px;
  color: #2a1b0e;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
  box-shadow: 0 3px 0 #261304;
}

.mini-wood-btn:hover {
  filter: brightness(1.08);
}

/* Home Top Right */
.home-top-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pseudo-pill, .cosmetics-counter-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(18, 32, 22, 0.88);
  border: 3px solid #4e3219;
  border-radius: 14px;
  padding: 7px 14px;
  color: #fff8e7;
  font-weight: 800;
  font-size: 0.92rem;
  box-shadow: 0 4px 0 #261304;
}

.pseudo-pill input {
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  padding: 4px 10px;
  color: #ffd93b;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  width: 135px;
  outline: none;
}

.pseudo-pill input:focus {
  border-color: #38d84e;
  background: rgba(255, 255, 255, 0.18);
}

/* Home Center Stage */
.home-center-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  min-height: 0;
}

.home-hero-panel {
  width: min(680px, 66vw);
  background: rgba(19, 31, 23, 0.90);
  border: 4px solid #6b4220;
  border-radius: 26px;
  padding: 24px 28px;
  box-shadow: 0 10px 0 #2b1708, 0 20px 50px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  color: #f5f9f6;
}

.hero-wood-header {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 10px 26px;
  background: linear-gradient(180deg, #8c5627, #5e3513);
  border: 3.5px solid #2b1708;
  border-radius: 16px;
  box-shadow: 0 5px 0 #221105;
}

.hero-wood-header h1 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  color: #ffd93b;
  text-shadow: 0 3px 0 #2b1708;
}

.hero-tagline {
  font-size: 0.96rem;
  line-height: 1.45;
  color: #d2e5d6;
  max-width: 580px;
}

.home-preview-stage {
  position: relative;
  background: radial-gradient(circle at 50% 60%, rgba(46, 94, 54, 0.55), rgba(12, 22, 15, 0.85));
  border: 3px solid #4a6b4e;
  border-radius: 20px;
  padding: 6px 14px 10px;
  box-shadow: inset 0 4px 14px rgba(0, 0, 0, 0.45);
}

#home-preview-canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.preview-stage-caption {
  font-family: var(--font-display);
  font-size: 0.88rem;
  color: #a8ff78;
  margin-top: -4px;
}

.home-main-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
}

.cartoon-cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 14px 20px;
  border-radius: 18px;
  border: 4px solid #1e272e;
  cursor: pointer;
  font-family: var(--font-display);
  color: #ffffff;
  text-align: left;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.cartoon-cta-btn.full-width {
  width: 100%;
}

.cartoon-cta-btn.green-cta {
  background: linear-gradient(180deg, #4cd137 0%, #24bd4c 60%, #1b943b 100%);
  border-color: #0e4a1e;
  box-shadow: 0 6px 0 #0a3515, inset 0 2px 0 rgba(255, 255, 255, 0.45);
}

.cartoon-cta-btn.orange-cta {
  background: linear-gradient(180deg, #ff9f43 0%, #ee5253 100%);
  border-color: #5c1919;
  box-shadow: 0 6px 0 #3d0f0f, inset 0 2px 0 rgba(255, 255, 255, 0.45);
}

.cartoon-cta-btn:hover {
  transform: translateY(-3px);
  filter: brightness(1.07);
}

.cartoon-cta-btn:active {
  transform: translateY(2px);
}

.cta-icon {
  font-size: 2rem;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.3));
}

.cta-text {
  display: flex;
  flex-direction: column;
}

.cta-text strong {
  font-size: 1.18rem;
  letter-spacing: 0.4px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.cta-text small {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 800;
  opacity: 0.92;
}

.home-secondary-actions {
  display: flex;
  gap: 12px;
}

/* LAN QR Signpost */
.lan-qr-signpost {
  width: 265px;
  background: rgba(22, 34, 26, 0.92);
  border: 4px solid #6b4220;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 8px 0 #261304, 0 14px 32px rgba(0, 0, 0, 0.5);
  color: #f1f7f2;
  text-align: center;
}

.wood-sign-header {
  background: linear-gradient(180deg, #8c5627, #5e3513);
  border-bottom: 3.5px solid #2b1708;
  padding: 10px 12px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  color: #ffd93b;
}

.lan-qr-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.lan-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 800;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-dot.online {
  background: #2ed573;
  box-shadow: 0 0 8px #2ed573;
}

.status-dot.offline {
  background: #ff4757;
}

.qr-box {
  background: #ffffff;
  padding: 8px;
  border-radius: 14px;
  border: 3px solid #351c08;
  width: 146px;
  height: 146px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-box img {
  width: 128px;
  height: 128px;
  display: block;
}

.lan-url-label {
  font-size: 0.78rem;
  color: #b8d1be;
}

.lan-url-code {
  background: rgba(0, 0, 0, 0.45);
  border: 1.5px solid rgba(56, 216, 78, 0.45);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  color: #ffd93b;
  font-weight: 800;
  word-break: break-all;
}

/* ==================== DARK-GLASS PANELS & OPEN LOBBIES ==================== */
.dark-glass-panel {
  background: rgba(18, 28, 22, 0.90);
  border: 3.5px solid #6b4220;
  border-radius: 20px;
  box-shadow: 0 7px 0 #261304, 0 12px 30px rgba(0, 0, 0, 0.45);
  color: #f1f7f2;
  overflow: hidden;
}

.panel-wood-header {
  background: linear-gradient(180deg, #8c5627 0%, #5e3513 100%);
  border-bottom: 3px solid #2b1708;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.98rem;
  color: #fff3c4;
  text-shadow: 0 2px 0 #2b1708;
}

.pill-badge {
  background: rgba(0, 0, 0, 0.38);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  color: #a8ff78;
}

.pill-badge.gold-pill {
  color: #ffd93b;
  border-color: rgba(255, 217, 59, 0.45);
}

.lobbies-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  min-height: 0;
}

.lobbies-action-bar {
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.join-code-group, .create-room-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lobbies-action-bar input {
  background: rgba(255, 255, 255, 0.10);
  border: 2px solid rgba(255, 255, 255, 0.26);
  border-radius: 10px;
  padding: 8px 12px;
  color: #ffffff;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.92rem;
  outline: none;
}

.lobbies-action-bar input:focus {
  border-color: #38d84e;
}

.cartoon-btn {
  padding: 9px 18px;
  border-radius: 12px;
  border: 3px solid #141b29;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  color: #ffffff;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.cartoon-btn.green-btn {
  background: linear-gradient(180deg, #38d84e, #1b943b);
  box-shadow: 0 4px 0 #0d4a1d;
}

.cartoon-btn.orange-btn {
  background: linear-gradient(180deg, #ff9f43, #e66723);
  box-shadow: 0 4px 0 #6e2c09;
}

.cartoon-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.lobbies-list-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.open-lobbies-grid {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lobby-room-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 2.5px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.lobby-room-card:hover {
  border-color: #38d84e;
  background: rgba(56, 216, 78, 0.10);
}

.lrc-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.lrc-code {
  background: #ffd93b;
  color: #2a1b0e;
  font-family: var(--font-display);
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 0.86rem;
}

.lrc-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: #ffffff;
}

.lrc-status {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(46, 213, 115, 0.18);
  color: #7bed9f;
}

.lrc-meta-row {
  display: flex;
  gap: 18px;
  font-size: 0.85rem;
  color: #c2d9c7;
}

.empty-lobbies-box {
  margin: auto;
  text-align: center;
  padding: 40px 20px;
  color: #a9c4b0;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 8px;
}

/* ==================== 3-COLUMN ROOM LOBBY ==================== */
.room-code-pill {
  background: #ffd93b;
  color: #2a1b0e;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 900;
}

.role-badge {
  padding: 7px 14px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.88rem;
  border: 3px solid #2b1708;
}

.role-badge.host {
  background: #ffd93b;
  color: #2a1b0e;
}

.role-badge.guest {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.room-three-cols {
  flex: 1;
  display: grid;
  grid-template-columns: 30fr 45fr 25fr;
  gap: 16px;
  min-height: 0;
}

.room-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Col 1: Players */
.room-pseudo-editor {
  padding: 12px 14px;
  border-bottom: 1.5px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.room-pseudo-editor label {
  font-size: 0.78rem;
  font-weight: 800;
  color: #a8ff78;
}

.pseudo-input-row {
  display: flex;
  gap: 8px;
}

.pseudo-input-row input {
  flex: 1;
  background: rgba(255, 255, 255, 0.10);
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  padding: 6px 10px;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.92rem;
}

.room-players-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.room-player-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
}

.room-player-row.is-me {
  border-color: #ffd93b;
  background: rgba(255, 217, 59, 0.10);
}

.rp-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid #13361f;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rp-info {
  flex: 1;
  min-width: 0;
}

.rp-name-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95rem;
}

.you-tag {
  font-size: 0.72rem;
  color: #ffd93b;
  font-weight: 800;
}

.rp-sub-line {
  display: flex;
  gap: 10px;
  font-size: 0.76rem;
  color: #b8d1be;
  margin-top: 2px;
}

.rp-pts {
  color: #ffd93b;
  font-weight: 800;
}

.rp-mods-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.mod-mini-pill {
  background: rgba(255, 255, 255, 0.14);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 800;
}

.ready-pill {
  font-size: 0.72rem;
  font-weight: 900;
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.ready-pill.ready {
  background: rgba(46, 213, 115, 0.22);
  color: #7bed9f;
  border: 1.5px solid #2ed573;
}

.ready-pill.waiting {
  background: rgba(255, 165, 2, 0.20);
  color: #ffd32a;
}

/* Col 2: Workshop */
.workshop-podium-box {
  padding: 10px 14px 6px;
  background: radial-gradient(circle at 50% 60%, rgba(56, 216, 78, 0.22), rgba(10, 18, 12, 0.75));
  border-bottom: 2px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
}

#room-preview-canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.podium-wooden-base {
  font-family: var(--font-display);
  font-size: 0.82rem;
  color: #ffd93b;
  margin-top: -4px;
  padding-bottom: 4px;
}

.workshop-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 12px 6px;
  border-bottom: 1.5px solid rgba(255, 255, 255, 0.10);
  overflow-x: auto;
}

.ws-tab {
  flex: 1;
  padding: 7px 8px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #d2e5d6;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.80rem;
  cursor: pointer;
  white-space: nowrap;
}

.ws-tab.active {
  background: #ffd93b;
  color: #2a1b0e;
  border-color: #ffffff;
}

.workshop-items-grid {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  align-content: start;
}

.ws-item-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 8px;
  border-radius: 14px;
  border: 2.5px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  cursor: pointer;
  text-align: center;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.ws-item-card:hover:not(.locked) {
  transform: translateY(-2px);
  border-color: #a8ff78;
}

.ws-item-card.active {
  border-color: #38d84e;
  background: rgba(56, 216, 78, 0.22);
  box-shadow: 0 0 12px rgba(56, 216, 78, 0.35);
}

.ws-item-card.locked {
  opacity: 0.55;
  cursor: not-allowed;
  border-style: dashed;
}

.ws-icon {
  font-size: 1.55rem;
}

.ws-name {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
}

.ws-sub {
  font-size: 0.68rem;
  color: #a8ff78;
}

.ws-item-card.locked .ws-sub {
  color: #ffd93b;
}

/* Col 3: Cup & Admin Settings */
.admin-scroll-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-block-title {
  font-family: var(--font-display);
  font-size: 0.86rem;
  color: #ffd93b;
}

/* Designated Cup Slot in Room Lobby (Square / Card) */
.room-cup-slot-container {
  width: 100%;
}

.cup-slot-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
  user-select: none;
}

.cup-slot-card.clickable {
  cursor: pointer;
}

.cup-slot-card.readonly {
  cursor: default;
}

.cup-slot-card.empty {
  border: 2px dashed rgba(255, 217, 59, 0.65);
  background: rgba(255, 217, 59, 0.07);
}

.cup-slot-card.empty.clickable:hover {
  border-color: #ffd93b;
  background: rgba(255, 217, 59, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(255, 217, 59, 0.25);
}

.cup-slot-card.selected {
  border: 2px solid #ffd93b;
  background: linear-gradient(135deg, rgba(255, 217, 59, 0.16) 0%, rgba(46, 125, 50, 0.22) 100%);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.cup-slot-card.selected.clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(255, 217, 59, 0.32);
  border-color: #ffe66d;
}

.cup-slot-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1.5px solid rgba(255, 217, 59, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cup-slot-icon-box.empty-icon-box {
  background: rgba(255, 217, 59, 0.15);
  border: 1.5px dashed #ffd93b;
}

.cup-slot-icon {
  font-size: 1.7rem;
  line-height: 1;
}

.cup-slot-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cup-slot-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.cup-slot-title {
  font-family: var(--font-display);
  font-size: 0.96rem;
  font-weight: 800;
  color: #ffd93b;
  letter-spacing: 0.03em;
}

.cup-slot-hint {
  font-size: 0.74rem;
  color: #b8d1be;
}

.cup-slot-desc {
  font-size: 0.72rem;
  color: #e0f2e9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cup-slot-action-btn {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 800;
  background: #ffd93b;
  color: #2b1f07;
  padding: 5px 10px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.cup-slot-change-badge {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  color: #ffd93b;
  background: rgba(255, 217, 59, 0.15);
  border: 1px solid rgba(255, 217, 59, 0.4);
  padding: 2px 7px;
  border-radius: 999px;
}

.cup-slot-maps-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.cup-slot-map-pill {
  font-size: 0.65rem;
  font-weight: 700;
  color: #a8ff78;
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid rgba(168, 255, 120, 0.3);
}

/* ==================== MODAL SÉLECTION DE COUPE (POPUP EN UN CLIC) ==================== */
.cup-picker-modal {
  width: 90%;
  max-width: 860px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.cup-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 18px 0;
  overflow-y: auto;
  max-height: 60vh;
  padding: 4px;
}

.picker-cup-card {
  background: linear-gradient(180deg, rgba(45, 60, 48, 0.85) 0%, rgba(25, 36, 28, 0.95) 100%);
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.picker-cup-card:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: #ffd93b;
  background: linear-gradient(180deg, rgba(60, 80, 64, 0.9) 0%, rgba(35, 50, 38, 0.98) 100%);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 18px rgba(255, 217, 59, 0.35);
}

.picker-cup-card.selected {
  border-color: #ffd93b;
  border-width: 2.5px;
  background: linear-gradient(180deg, rgba(70, 75, 45, 0.92) 0%, rgba(38, 48, 30, 0.98) 100%);
  box-shadow: 0 6px 20px rgba(255, 217, 59, 0.3);
}

.pcc-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.pcc-icon {
  font-size: 2.3rem;
  line-height: 1;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 12px;
  padding: 6px;
  border: 1.5px solid rgba(255, 217, 59, 0.3);
}

.pcc-titles {
  flex: 1;
}

.pcc-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffd93b;
  margin: 0 0 4px 0;
  letter-spacing: 0.02em;
}

.pcc-desc {
  font-size: 0.74rem;
  color: #b8d1be;
  margin: 0;
  line-height: 1.35;
}

.pcc-badge-selected {
  position: absolute;
  top: 10px;
  right: 12px;
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 800;
  color: #2b1f07;
  background: #ffd93b;
  padding: 3px 8px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.pcc-maps-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0, 0, 0, 0.32);
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.picker-map-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
}

.pmr-pill.pmr-step {
  font-family: var(--font-display);
  font-size: 0.64rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 2px 6px;
  border-radius: 6px;
  flex-shrink: 0;
}

.pmr-details {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.pmr-name {
  color: #ffffff;
  font-weight: 600;
}

.pmr-diff {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
}

.diff-lvl-1 {
  background: rgba(56, 216, 78, 0.25);
  color: #38d84e;
  border: 1px solid rgba(56, 216, 78, 0.4);
}

.diff-lvl-2 {
  background: rgba(255, 217, 59, 0.25);
  color: #ffd93b;
  border: 1px solid rgba(255, 217, 59, 0.4);
}

.diff-lvl-3 {
  background: rgba(255, 71, 87, 0.25);
  color: #ff6b81;
  border: 1px solid rgba(255, 71, 87, 0.4);
}

.pcc-select-btn {
  margin-top: 4px;
  font-size: 0.85rem;
  padding: 9px 12px;
}

.room-sliders-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.room-slider-item {
  background: rgba(0, 0, 0, 0.25);
  padding: 6px 10px;
  border-radius: 10px;
}

.rs-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  margin-bottom: 3px;
}

.rs-label-row strong {
  color: #38d84e;
}

.room-slider-item input[type="range"] {
  width: 100%;
  accent-color: #38d84e;
}

.room-launch-footer {
  padding: 12px;
  border-top: 1.5px solid rgba(255, 255, 255, 0.12);
}

/* ==================== MULTIPLAYER RACE HUD ==================== */
.mp-race-hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 15;
}

.mp-race-hud.hidden {
  display: none !important;
}

.mp-live-standings {
  position: absolute;
  top: 76px;
  left: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mp-rank-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(18, 28, 22, 0.86);
  border: 2.5px solid #4e3219;
  border-radius: 12px;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: 0 3px 0 #261304;
}

.mp-rank-card.local-player {
  border-color: #ffd93b;
  background: rgba(34, 56, 38, 0.92);
}

.mp-rank-pos {
  font-family: var(--font-display);
  color: #ffd93b;
  min-width: 44px;
}

.mp-rank-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #ffffff;
}

.mp-rank-name {
  flex: 1;
}

.mp-rank-pct {
  color: #a8ff78;
  font-family: var(--font-display);
}

.mp-center-banners {
  position: absolute;
  top: 74px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.mp-cup-race-pill {
  background: linear-gradient(180deg, #8c5627, #5e3513);
  border: 3px solid #2b1708;
  color: #ffd93b;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.9rem;
  padding: 5px 16px;
  border-radius: 999px;
  box-shadow: 0 4px 0 #261304;
}

.mp-finish-countdown {
  background: linear-gradient(180deg, #ff4757, #c0392b);
  border: 3px solid #ffffff;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 1.05rem;
  padding: 8px 20px;
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(255, 71, 87, 0.55);
  animation: criticalPulse 0.6s infinite alternate;
}

.mp-back-lobby-btn {
  position: absolute;
  top: 76px;
  right: 16px;
  pointer-events: auto;
  padding: 8px 14px;
  background: linear-gradient(180deg, #8c5627, #5e3513);
  border: 3px solid #2b1708;
  border-radius: 12px;
  color: #fff8e7;
  font-family: var(--font-display);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 0 #261304;
}

.mp-progress-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.mp-track-dot {
  position: absolute;
  top: 50%;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  transform: translate(-50%, -50%);
  transition: left 0.15s linear;
}

/* ==================== INTER-RACE RESULTS & MODIFIER DRAFT MODAL ==================== */
.mp-results-card {
  width: min(960px, 94vw);
  max-height: 90vh;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.big-wood-header {
  padding: 14px 22px;
  font-size: 1.25rem;
}

.results-two-cols {
  display: grid;
  grid-template-columns: 38fr 62fr;
  gap: 18px;
  padding: 20px;
  overflow-y: auto;
}

.results-standings-box h3, .results-draft-box h3 {
  font-family: var(--font-display);
  color: #ffd93b;
  margin-bottom: 10px;
  font-size: 1.05rem;
}

.results-rankings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.res-rank-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.07);
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  font-size: 0.9rem;
}

.res-rank-row.is-me {
  border-color: #38d84e;
  background: rgba(56, 216, 78, 0.15);
}

.res-rank-row.first-place {
  border-color: #ffd93b;
}

.res-pos {
  font-family: var(--font-display);
  font-weight: 800;
  color: #ffd93b;
}

.res-pseudo {
  flex: 1;
  font-weight: 800;
}

.res-race-pts {
  color: #a8ff78;
  font-weight: 800;
}

.res-total-pts {
  color: #ffd93b;
}

.draft-subtitle {
  font-size: 0.84rem;
  color: #c2d9c7;
  margin-bottom: 12px;
}

.draft-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.draft-mod-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 14px 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 3px solid var(--mod-color, #38d84e);
  border-radius: 16px;
  color: #ffffff;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.draft-mod-card * {
  pointer-events: none;
}

.draft-mod-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

.draft-mod-card.selected {
  background: rgba(56, 216, 78, 0.25);
  border-color: #ffd93b;
  transform: scale(1.04);
}

.draft-mod-card.dimmed {
  opacity: 0.42;
  cursor: default;
}

.dmc-icon {
  font-size: 2.3rem;
}

.dmc-title {
  font-family: var(--font-display);
  font-size: 0.96rem;
  font-weight: 800;
  color: #ffd93b;
}

.dmc-sub {
  font-size: 0.72rem;
  font-weight: 800;
  color: #a8ff78;
}

.dmc-desc {
  font-size: 0.74rem;
  color: #dcebe0;
  line-height: 1.3;
  flex: 1;
}

.dmc-select-pill {
  margin-top: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--mod-color, #38d84e);
  color: #141b29;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.75rem;
}

.draft-winner-notice {
  padding: 24px;
  background: rgba(255, 217, 59, 0.12);
  border: 2.5px solid #ffd93b;
  border-radius: 18px;
  text-align: center;
}

.winner-medal-big {
  font-size: 3.2rem;
  margin-bottom: 8px;
}

/* ==================== CUP PODIUM & MYSTERY GIFT MODAL ==================== */
.mp-podium-card {
  width: min(820px, 94vw);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 20px;
}

.podium-steps-container {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 18px;
  padding: 24px 24px 8px;
  min-height: 230px;
}

.podium-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 170px;
}

.podium-player-badge {
  background: rgba(255, 255, 255, 0.10);
  border: 3px solid #38d84e;
  border-radius: 16px;
  padding: 10px 14px;
  text-align: center;
  margin-bottom: 8px;
  width: 100%;
}

.podium-medal {
  font-size: 1.9rem;
}

.podium-name {
  display: block;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: #ffffff;
}

.podium-pts {
  font-size: 0.85rem;
  color: #ffd93b;
  font-weight: 900;
}

.podium-step-block {
  width: 100%;
  border: 3.5px solid #2b1708;
  border-radius: 14px 14px 6px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.45);
}

.podium-column.step-1 .podium-step-block { height: 110px; }
.podium-column.step-2 .podium-step-block { height: 80px; }
.podium-column.step-3 .podium-step-block { height: 60px; }

.podium-gift-section {
  padding: 0 24px;
}

.podium-gift-box {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 20px;
  background: linear-gradient(90deg, rgba(255, 217, 59, 0.18), rgba(56, 216, 78, 0.18));
  border: 3px solid #ffd93b;
  border-radius: 18px;
}

.gift-icon-anim {
  font-size: 3rem;
  animation: criticalPulse 0.7s infinite alternate;
}

.gift-info {
  flex: 1;
}

.gift-info h3 {
  font-family: var(--font-display);
  color: #ffd93b;
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.gift-info p {
  font-size: 0.86rem;
  color: #e2f1e6;
}

.gift-buttons-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.results-auto-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.results-draft-status {
  font-family: var(--font-display);
  color: #ffd93b;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.results-auto-launch-msg {
  color: #c2d9c7;
  font-size: 0.88rem;
  font-style: italic;
  text-align: center;
  padding: 4px 12px;
}

.solo-level-select {
  margin-left: 8px;
  padding: 5px 10px;
  border-radius: 10px;
  border: 2.5px solid #2b1708;
  background: linear-gradient(180deg, #fff8e7, #f5e2b8);
  color: #2b1708;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  outline: none;
}

.solo-level-select.hidden {
  display: none !important;
}

/* ==================== 15S DRAFT TIMER & AUTO LAUNCH ==================== */
.draft-timer-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 71, 87, 0.22);
  border: 2px solid #ff4757;
  color: #ffb8b8;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  padding: 4px 12px;
  border-radius: 999px;
  animation: draftTimerPulse 1s infinite alternate;
}

@keyframes draftTimerPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 rgba(255, 71, 87, 0); }
  100% { transform: scale(1.06); box-shadow: 0 0 14px rgba(255, 71, 87, 0.45); }
}

/* ==================== INTRO CINEMATIC & COUNTDOWN OVERLAY ==================== */
.race-countdown-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.25s ease-out;
}

.race-countdown-overlay.hidden {
  display: none !important;
}

.race-countdown-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: radial-gradient(circle, rgba(16, 32, 20, 0.94) 0%, rgba(10, 20, 12, 0.86) 100%);
  border: 4px solid #ffd93b;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.65), 0 0 30px rgba(255, 217, 59, 0.35);
  border-radius: 32px;
  padding: 24px 50px;
  text-align: center;
  backdrop-filter: blur(8px);
  animation: countdownBoxFloat 2s ease-in-out infinite alternate;
}

@keyframes countdownBoxFloat {
  0% { transform: translateY(0); }
  100% { transform: translateY(-6px); }
}

.race-countdown-map {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  color: #a8ff78;
  letter-spacing: 0.05em;
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 16px;
  border-radius: 999px;
  border: 1.5px solid rgba(168, 255, 120, 0.4);
}

.race-countdown-sub {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffd93b;
  letter-spacing: 0.12em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}

.race-countdown-text {
  font-family: var(--font-display);
  font-size: 6.2rem;
  font-weight: 900;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 6px 0 #b33939, 0 10px 25px rgba(0, 0, 0, 0.8);
  display: inline-block;
  animation: countdownPop 0.45s cubic-bezier(0.18, 1.25, 0.4, 1);
}

.race-countdown-text.go {
  font-size: 4.8rem;
  color: #38d84e;
  text-shadow: 0 6px 0 #1b6c27, 0 10px 30px rgba(56, 216, 78, 0.7);
  animation: countdownPopGo 0.55s cubic-bezier(0.18, 1.35, 0.4, 1);
}

@keyframes countdownPop {
  0% { transform: scale(1.6); opacity: 0; }
  50% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes countdownPopGo {
  0% { transform: scale(1.8) rotate(-4deg); opacity: 0; }
  50% { transform: scale(1.12) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}


