/* ============================================================
   Configurator stage + floating panels
   ============================================================ */

.configurator {
  padding: 80px 0 120px;
  position: relative;
}

.config-stage {
  position: relative;
  max-width: 1600px;
  margin: 0 auto;
  height: 720px;
  background:
    radial-gradient(ellipse at 50% 70%, rgba(29, 142, 255, 0.08) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 100%);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.config-canvas {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
}

/* Floating panels */
.config-panel {
  position: absolute;
  width: 320px;
  padding: 22px;
  z-index: 10;
  animation: panel-float 6s ease-in-out infinite;
}
.config-panel-left {
  top: 32px;
  left: 32px;
}
.config-panel-right {
  top: 32px;
  right: 32px;
  animation-delay: -3s;
}

@keyframes panel-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.config-panel-head {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--ink-0);
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.config-panel-id {
  color: var(--accent-red);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
}

.config-group {
  margin-bottom: 22px;
}
.config-group:last-child { margin-bottom: 0; }

.config-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--ink-2);
  margin-bottom: 12px;
}

/* Swatch row (paint, neon) */
.swatch-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.swatch {
  position: relative;
  aspect-ratio: 1;
  background: var(--c, var(--bg-3));
  border: 1px solid var(--line-strong);
  display: flex; align-items: flex-end;
  padding: 6px;
  transition: all 0.25s var(--ease-out);
  overflow: hidden;
}
.swatch::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.18), transparent 50%);
  opacity: 0.5;
  pointer-events: none;
}
.swatch:hover {
  border-color: var(--ink-1);
  transform: translateY(-2px);
}
.swatch[data-active] {
  border-color: var(--accent-red);
  box-shadow: 0 0 16px rgba(255, 45, 58, 0.4);
}
.swatch[data-active]::after {
  content: '';
  position: absolute;
  top: 4px; right: 4px;
  width: 8px; height: 8px;
  background: var(--accent-red);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-red);
}
.swatch-name {
  position: relative;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.15em;
  color: rgba(255,255,255,0.85);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Neon swatches glow */
.swatch-neon[data-value="off"] {
  background: var(--bg-2);
}
.swatch-neon[data-value="off"] .swatch-name { color: var(--ink-2); }
.swatch-neon:not([data-value="off"]) {
  box-shadow: inset 0 0 20px rgba(0,0,0,0.6), 0 0 12px rgba(0,0,0,0.4);
}
.swatch-neon:not([data-value="off"])[data-active] {
  box-shadow: 0 0 24px var(--c), inset 0 0 20px rgba(0,0,0,0.4);
}
.swatch-x {
  position: absolute;
  inset: 4px;
  background:
    linear-gradient(45deg, transparent 47%, var(--ink-2) 47%, var(--ink-2) 53%, transparent 53%),
    linear-gradient(-45deg, transparent 47%, var(--ink-2) 47%, var(--ink-2) 53%, transparent 53%);
  opacity: 0.4;
}

/* Slider */
.slider-wrap { padding: 4px 0; }
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--bg-3);
  outline: none;
  border-radius: 0;
  cursor: pointer;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px; height: 14px;
  background: var(--accent-red);
  border: 2px solid var(--ink-0);
  cursor: grab;
  box-shadow: 0 0 12px var(--accent-red);
  border-radius: 50%;
}
.slider::-moz-range-thumb {
  width: 14px; height: 14px;
  background: var(--accent-red);
  border: 2px solid var(--ink-0);
  cursor: grab;
  box-shadow: 0 0 12px var(--accent-red);
  border-radius: 50%;
}
.slider-meta {
  display: flex; justify-content: space-between;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--ink-2);
}
.slider-val { color: var(--accent-red); }

/* Option buttons (wheels, body kit, etc) */
.opt-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.opt-row[data-config="wheels"] { grid-template-columns: repeat(2, 1fr); }
.opt-row[data-config="headlights"] { grid-template-columns: repeat(2, 1fr); }
.opt-row[data-config="bodykit"],
.opt-row[data-config="spoiler"] { grid-template-columns: repeat(3, 1fr); }

.opt {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 8px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--ink-1);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  transition: all 0.25s var(--ease-out);
}
.opt:hover {
  border-color: var(--line-strong);
  color: var(--ink-0);
  background: var(--bg-3);
}
.opt[data-active] {
  border-color: var(--accent-red);
  color: var(--accent-red);
  background: rgba(255, 45, 58, 0.08);
}
.opt-sm {
  flex-direction: row;
  padding: 10px 8px;
  font-size: 10px;
}
.opt svg { color: currentColor; }

/* Dots for headlights */
.dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-white { background: #ffffff; box-shadow: 0 0 8px #ffffff; }
.dot-amber { background: #ffaa33; box-shadow: 0 0 8px #ffaa33; }
.dot-ice { background: #a8e6ff; box-shadow: 0 0 8px #a8e6ff; }
.dot-laser { background: #d8c0ff; box-shadow: 0 0 12px #b88dff; }

/* Bottom toolbar */
.config-toolbar {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 4px;
  padding: 8px;
}
.tool {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.25em;
  color: var(--ink-1);
  border: 1px solid transparent;
  transition: all 0.2s var(--ease-out);
}
.tool:hover {
  color: var(--ink-0);
  background: rgba(255,255,255,0.04);
}
.tool[data-active] {
  color: var(--accent-red);
  border-color: rgba(255, 45, 58, 0.4);
  background: rgba(255, 45, 58, 0.08);
  box-shadow: 0 0 12px rgba(255, 45, 58, 0.2);
}
.tool-race {
  color: var(--ink-3);
  position: relative;
}
.tool-race::before {
  content: '✦';
  position: absolute;
  top: 4px; right: 4px;
  color: var(--accent-red);
  font-size: 7px;
  opacity: 0.6;
}
.tool-race[data-active] {
  color: #fff;
  background: linear-gradient(90deg, var(--accent-red), var(--accent-violet));
  border-color: transparent;
  box-shadow: 0 0 24px rgba(255, 45, 58, 0.5);
  animation: race-pulse 1.4s ease-in-out infinite;
}
@keyframes race-pulse {
  0%, 100% { box-shadow: 0 0 24px rgba(255, 45, 58, 0.5); }
  50% { box-shadow: 0 0 36px rgba(255, 45, 58, 0.8); }
}

.config-hint {
  position: absolute;
  left: 50%;
  top: 32px;
  transform: translateX(-50%);
  z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: rgba(14, 16, 22, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  color: var(--ink-2);
  pointer-events: none;
  transition: opacity 0.5s var(--ease-out);
}
.config-hint.is-hidden { opacity: 0; }

/* RACE MODE — overlay state */
body.is-race-mode {
  --accent-red: #ff0040;
}
body.is-race-mode .config-stage {
  background:
    radial-gradient(ellipse at 50% 50%, rgba(255, 0, 64, 0.18) 0%, transparent 60%),
    linear-gradient(180deg, #100204 0%, #1a0408 100%);
}
body.is-race-mode .hero-grid {
  animation: race-grid 0.6s linear infinite;
}
@keyframes race-grid {
  from { background-position: 0 0, 0 0; }
  to { background-position: 0 60px, 60px 0; }
}

/* DAY MODE — light reversal in stage */
.config-stage.is-day {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 230, 180, 0.18) 0%, transparent 60%),
    linear-gradient(180deg, #1a1d24 0%, #2a2d35 100%);
}

/* Responsive */
@media (max-width: 1100px) {
  .config-stage { height: 880px; }
  .config-panel-left,
  .config-panel-right {
    position: static;
    width: 100%;
    max-width: none;
  }
  .config-panel { animation: none; }
  /* Layout panels horizontally above + below canvas on tablet */
}

@media (max-width: 900px) {
  .config-stage {
    height: auto;
    min-height: 1000px;
    display: grid;
    grid-template-rows: 360px auto auto auto;
    padding: 16px;
    gap: 16px;
  }
  .config-canvas {
    position: relative;
    height: 360px;
    width: 100%;
    border: 1px solid var(--line);
    grid-row: 1;
  }
  .config-panel-left,
  .config-panel-right {
    position: relative;
    width: 100%;
    top: auto; left: auto; right: auto;
    grid-row: auto;
  }
  .config-toolbar {
    position: relative;
    left: auto;
    bottom: auto;
    transform: none;
    flex-wrap: wrap;
    justify-content: center;
    grid-row: auto;
  }
  .tool { font-size: 9px; padding: 8px 10px; }
  .config-hint { display: none; }
}
