/* ═══ THE ATELIER ═══ */

.atelier {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--z-atelier);
  font-family: var(--font-body);
}

/* Toggle Button */
.atelier-btn {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--color-bg);
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background var(--duration-normal) var(--ease-primary),
    border-color var(--duration-normal) var(--ease-primary),
    transform 0.4s var(--ease-hover),
    box-shadow 0.4s var(--ease-primary);
  position: relative;
}

.atelier-btn:hover {
  background: var(--color-surface);
  border-color: rgba(232, 200, 114, 0.4);
  transform: scale(1.12);
  box-shadow: 0 0 28px rgba(232, 200, 114, 0.2), 0 0 8px rgba(232, 200, 114, 0.1);
}

/* Orbital ring — outer arc, slow clockwise */
.atelier-btn::before {
  content: '';
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(232, 200, 114, 0.55) 45deg,
    transparent 90deg,
    transparent 180deg,
    rgba(232, 200, 114, 0.2) 220deg,
    transparent 260deg
  );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 1.5px), #000 calc(100% - 1.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 1.5px), #000 calc(100% - 1.5px));
  animation: orbitalSpin 8s linear infinite;
  pointer-events: none;
  opacity: 0.7;
  transition: opacity 0.4s ease;
}

.atelier-btn:hover::before {
  opacity: 1;
}

/* Breathing glow aura */
.atelier-btn .atelier-btn-icon::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232, 200, 114, 0.06) 0%, transparent 70%);
  animation: breathe 4s ease-in-out infinite;
  pointer-events: none;
}

.atelier-btn-icon {
  font-size: 18px;
  color: var(--color-accent);
  line-height: 1;
  transition: color var(--duration-normal) var(--ease-primary);
  position: relative;
}

/* First-visit pulse */
.atelier-pulse::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-accent);
  animation: atelierPulse 2s ease-out infinite;
}

@keyframes atelierPulse {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.4); opacity: 0; }
}

/* Old first-visit tooltip removed — replaced by .ctrl-tooltip */

/* Panel */
.atelier-panel {
  position: absolute;
  bottom: 60px;
  right: 0;
  width: 300px;
  background: var(--color-surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--duration-normal) var(--ease-out),
    visibility var(--duration-normal);
}

.atelier.open .atelier-panel {
  opacity: 1;
  visibility: visible;
}

.atelier.open .atelier-btn {
  background: var(--color-surface);
  border-color: var(--color-accent);
}

/* Panel Header */
.atelier-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.atelier-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
}

.atelier-theme-toggle {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--color-text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  transition: color var(--duration-fast) var(--ease-primary);
}

.atelier-theme-toggle:hover {
  color: var(--color-accent);
}

.atelier-close {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--color-text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--duration-fast) var(--ease-primary);
}

.atelier-close:hover {
  color: var(--color-text-primary);
}

/* World Picker */
.atelier-worlds {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  overflow: hidden;
}

.atelier-world {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 4px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-primary),
    box-shadow var(--duration-fast) var(--ease-primary);
}

.atelier-world:hover {
  background: var(--color-surface-hover);
}

.atelier-world.active {
  background: var(--color-accent-dim);
  box-shadow: inset 0 0 0 1px var(--color-accent);
}

.atelier-world-swatch {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  transition: border-color var(--duration-fast) var(--ease-primary);
}

/* Swatch colors per world */
.atelier-world-swatch[data-world="editorial"] {
  background: linear-gradient(135deg, #0A0A0B 0%, #16161A 50%, #E8C872 100%);
}
.atelier-world-swatch[data-world="brutalist"] {
  background: linear-gradient(135deg, #000000 0%, #000000 60%, #FF3333 100%);
  border-radius: 0;
}
.atelier-world-swatch[data-world="organic"] {
  background: linear-gradient(135deg, #0B1622 0%, #132538 50%, #7BAE7F 100%);
  border-radius: 50%;
}
.atelier-world-swatch[data-world="retro"] {
  background: linear-gradient(135deg, #0A0E1A 0%, #141A32 50%, #FFA629 100%);
  border-radius: 2px;
}
.atelier-world-swatch[data-world="minimalist"] {
  background: linear-gradient(135deg, #0A0A0A 0%, #141414 80%, #A3A3A3 100%);
  border-radius: 0;
}

.atelier-world.active .atelier-world-swatch {
  border-color: var(--color-accent);
  box-shadow: 0 0 8px rgba(var(--color-accent-rgb), 0.3);
}

.atelier-world-name {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--color-text-tertiary);
  text-align: center;
  transition: color var(--duration-fast) var(--ease-primary);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.atelier-world.active .atelier-world-name {
  color: var(--color-text-primary);
}

/* Tunable Sliders */
.atelier-tunables,
.atelier-canvas-sliders {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.atelier-slider {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.atelier-slider-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.atelier-slider-value {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-text-tertiary);
}

/* Custom range slider */
.atelier-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  background: var(--color-border-strong);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.atelier-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 2px solid var(--color-bg);
  box-shadow: 0 0 0 1px var(--color-accent);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.atelier-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.atelier-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 2px solid var(--color-bg);
  box-shadow: 0 0 0 1px var(--color-accent);
  cursor: pointer;
}

/* ═══ Atelier Sections ═══ */

.atelier-divider {
  border: none;
  height: 1px;
  background: var(--color-border);
  margin: 16px 0;
}

.atelier-section {
  margin-bottom: 4px;
}

.atelier-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.atelier-section-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  margin-bottom: 10px;
}

.atelier-section-header .atelier-section-title {
  margin-bottom: 0;
}

/* Gravity Picker */
.atelier-gravity {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.atelier-gravity-btn {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--color-text-secondary);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-primary),
    border-color var(--duration-fast) var(--ease-primary),
    color var(--duration-fast) var(--ease-primary);
}

.atelier-gravity-btn:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-primary);
}

.atelier-gravity-btn.active {
  background: var(--color-accent-dim);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* Light Source Controls */
.atelier-light-toggle {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--color-text-tertiary);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-primary),
    border-color var(--duration-fast) var(--ease-primary),
    color var(--duration-fast) var(--ease-primary);
}

.atelier-light-toggle.active {
  background: var(--color-accent-dim);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.atelier-light-controls {
  display: flex;
  gap: 12px;
}

.atelier-light-pad {
  width: 80px;
  height: 80px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  position: relative;
  cursor: crosshair;
  flex-shrink: 0;
  overflow: hidden;
}

.atelier-light-pad::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, var(--color-border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--color-border) 1px, transparent 1px);
  background-size: 25% 25%;
  opacity: 0.5;
}

.atelier-light-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 8px rgba(var(--color-accent-rgb), 0.5);
  transform: translate(-50%, -50%);
  pointer-events: none;
  left: 25%;
  top: 20%;
}

.atelier-light-sliders {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.atelier-light-sliders .atelier-slider {
  gap: 3px;
}

.atelier-light-sliders .atelier-slider-label {
  font-size: 10px;
}

.atelier-light-sliders .atelier-slider-value {
  font-size: 9px;
}

/* Light Type Picker */
.atelier-light-types {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-bottom: 10px;
}

.atelier-light-type-btn {
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--color-text-tertiary);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-primary),
    border-color var(--duration-fast) var(--ease-primary),
    color var(--duration-fast) var(--ease-primary);
}

.atelier-light-type-btn:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-primary);
}

.atelier-light-type-btn.active {
  background: var(--color-accent-dim);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* Light Source Indicator */
.light-source {
  position: fixed;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0.1) 50%, transparent 70%);
  box-shadow: 0 0 30px 10px rgba(255, 255, 255, 0.1);
  cursor: grab;
  z-index: 350;
  pointer-events: auto;
  transform: translate(-50%, -50%);
  transition: opacity 0.3s, box-shadow 0.3s;
}

.light-source:active {
  cursor: grabbing;
}

.light-source.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ═══ Light Theme Swatch Overrides ═══ */
[data-theme="light"] .atelier-world-swatch[data-world="editorial"] {
  background: linear-gradient(135deg, #F5F2EE 0%, #EBE7E1 50%, #A07830 100%);
}
[data-theme="light"] .atelier-world-swatch[data-world="brutalist"] {
  background: linear-gradient(135deg, #F0F0F0 0%, #DCDCDC 60%, #CC2222 100%);
}
[data-theme="light"] .atelier-world-swatch[data-world="organic"] {
  background: linear-gradient(135deg, #EFF5F0 0%, #DAE4DB 50%, #3D8A5A 100%);
}
[data-theme="light"] .atelier-world-swatch[data-world="retro"] {
  background: linear-gradient(135deg, #F5F0E8 0%, #E0D8CC 50%, #CC7A10 100%);
}
[data-theme="light"] .atelier-world-swatch[data-world="minimalist"] {
  background: linear-gradient(135deg, #F8F8F8 0%, #E8E8E8 80%, #737373 100%);
}

/* Light source indicator adapts to light theme */
[data-theme="light"] .light-source {
  background: radial-gradient(circle, rgba(160, 120, 48, 0.8) 0%, rgba(160, 120, 48, 0.1) 50%, transparent 70%);
  box-shadow: 0 0 30px 10px rgba(160, 120, 48, 0.15);
}

/* ═══ Responsive ═══ */
@media (max-width: 768px) {
  .atelier {
    bottom: 16px;
    right: 16px;
  }

  .atelier-panel {
    width: 260px;
    right: -8px;
  }

  .atelier-btn {
    width: 44px;
    height: 44px;
  }
}

/* ═══ SPACE CONTROLS — Separate floating panel (bottom-left) ═══ */

.space-controls {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: var(--z-atelier);
  font-family: var(--font-body);
}

.space-controls-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  background: var(--color-bg);
  border: 1px solid rgba(130, 160, 200, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  color: #82A0C8;
  position: relative;
  transition:
    background var(--duration-normal) var(--ease-primary),
    border-color var(--duration-normal) var(--ease-primary),
    color var(--duration-normal) var(--ease-primary),
    transform 0.4s var(--ease-hover),
    box-shadow 0.4s var(--ease-primary);
}

/* Orbital ring — outer arc, counter-clockwise */
.space-controls-btn::before {
  content: '';
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(130, 160, 200, 0.55) 55deg,
    transparent 110deg,
    transparent 200deg,
    rgba(130, 160, 200, 0.2) 245deg,
    transparent 290deg
  );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 1.5px), #000 calc(100% - 1.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 1.5px), #000 calc(100% - 1.5px));
  animation: orbitalSpin 10s linear infinite reverse;
  pointer-events: none;
  opacity: 0.7;
  transition: opacity 0.4s ease;
}

/* Inner ring — clockwise, faster */
.space-controls-btn::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: conic-gradient(
    from 120deg,
    transparent 0deg,
    rgba(130, 160, 200, 0.35) 30deg,
    transparent 60deg,
    transparent 360deg
  );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 1px), #000 calc(100% - 1px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 1px), #000 calc(100% - 1px));
  animation: orbitalSpin 6s linear infinite;
  pointer-events: none;
  opacity: 0.5;
  transition: opacity 0.4s ease;
}

.space-controls-btn:hover {
  color: #A0BDE0;
  border-color: rgba(130, 160, 200, 0.5);
  transform: scale(1.12);
  box-shadow: 0 0 28px rgba(130, 160, 200, 0.18), 0 0 8px rgba(130, 160, 200, 0.1);
}

.space-controls-btn:hover::before {
  opacity: 1;
}

.space-controls-btn:hover::after {
  opacity: 0.8;
}

.space-controls.open .space-controls-btn {
  background: var(--color-surface);
  border-color: rgba(130, 160, 200, 0.5);
  color: #A0BDE0;
}

.space-controls-panel {
  position: absolute;
  bottom: 54px;
  left: 0;
  width: 240px;
  background: var(--color-surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition:
    opacity var(--duration-normal) var(--ease-out),
    visibility var(--duration-normal),
    transform var(--duration-normal) var(--ease-out);
}

.space-controls.open .space-controls-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

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

.space-controls-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
}

.space-controls-reset {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  cursor: pointer;
  background: none;
  border: none;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: color var(--duration-fast) var(--ease-primary);
}

.space-controls-reset:hover {
  color: var(--color-accent);
}

.space-controls-close {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--color-text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  transition: color var(--duration-fast) var(--ease-primary);
}

.space-controls-close:hover {
  color: var(--color-text-primary);
}

.space-presets {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}

.space-preset-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0 4px;
  color: var(--color-text-tertiary);
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    color var(--duration-fast) var(--ease-primary),
    border-color var(--duration-fast) var(--ease-primary),
    background var(--duration-fast) var(--ease-primary);
}

.space-preset-icon {
  font-size: 14px;
  line-height: 1;
}

.space-preset-label {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.7;
}

.space-preset-btn:hover {
  color: var(--color-text-secondary);
  border-color: var(--color-text-tertiary);
}

.space-preset-btn.active {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: rgba(200, 160, 100, 0.06);
}

.space-preset-btn.active .space-preset-label {
  opacity: 1;
}

.space-sliders {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.space-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
}

.space-group:first-child {
  padding-top: 0;
}

.space-group-label {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  opacity: 0.6;
  padding-bottom: 2px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.space-slider {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.space-slider-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.space-slider-value {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--color-text-tertiary);
}

.space-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  background: var(--color-border-strong);
  border-radius: 1px;
  outline: none;
  cursor: pointer;
}

.space-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 2px solid var(--color-bg);
  box-shadow: 0 0 0 1px var(--color-accent);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.space-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.space-range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 2px solid var(--color-bg);
  box-shadow: 0 0 0 1px var(--color-accent);
  cursor: pointer;
}

@media (max-width: 768px) {
  .space-controls {
    bottom: 16px;
    left: 16px;
  }
  .space-controls-btn {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }
  .space-controls-panel {
    width: 200px;
  }
}

/* ═══ Custom Tooltips ═══ */

.ctrl-tooltip {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%) translateY(5px) scale(0.96);
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-primary);
  background: rgba(20, 20, 26, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 8px 16px 7px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: 0.2s;
}

/* Accent underline — scans left to right */
.ctrl-tooltip::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10px;
  right: 10px;
  height: 1px;
  border-radius: 1px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: 0.35s;
}

/* Show on hover */
.atelier-btn:hover .ctrl-tooltip,
.space-controls-btn:hover .ctrl-tooltip,
.footer-tree:hover .ctrl-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

.atelier-btn:hover .ctrl-tooltip::after,
.space-controls-btn:hover .ctrl-tooltip::after,
.footer-tree:hover .ctrl-tooltip::after {
  transform: scaleX(1);
}

/* Per-button accent colors */
.space-controls-btn .ctrl-tooltip {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45), 0 2px 12px rgba(130, 160, 200, 0.06);
}
.space-controls-btn .ctrl-tooltip::after {
  background: rgba(130, 160, 200, 0.6);
}

.footer-tree .ctrl-tooltip {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45), 0 2px 12px rgba(123, 174, 127, 0.06);
}
.footer-tree .ctrl-tooltip::after {
  background: rgba(123, 174, 127, 0.6);
}

.atelier-btn .ctrl-tooltip {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45), 0 2px 12px rgba(232, 200, 114, 0.06);
}
.atelier-btn .ctrl-tooltip::after {
  background: rgba(232, 200, 114, 0.6);
}

/* Hide tooltips when panels are open */
.atelier.open .ctrl-tooltip,
.space-controls.open .ctrl-tooltip {
  display: none;
}

/* ═══ Shared Keyframes ═══ */

@keyframes orbitalSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes breathe {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* ═══ Light Theme — Atelier & Controls ═══ */

[data-theme="light"] .atelier-btn {
  background: var(--color-surface);
  border-color: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .atelier-btn:hover {
  background: var(--color-surface-hover);
  border-color: rgba(160, 120, 48, 0.5);
  box-shadow: 0 0 28px rgba(160, 120, 48, 0.15), 0 0 8px rgba(160, 120, 48, 0.08);
}

[data-theme="light"] .atelier-btn::before {
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(160, 120, 48, 0.55) 45deg,
    transparent 90deg,
    transparent 180deg,
    rgba(160, 120, 48, 0.2) 220deg,
    transparent 260deg
  );
}

[data-theme="light"] .atelier-panel {
  background: var(--color-surface);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .atelier.open .atelier-btn {
  background: var(--color-surface);
  border-color: var(--color-accent);
}

[data-theme="light"] .atelier-range {
  background: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .atelier-range::-webkit-slider-thumb {
  border-color: var(--color-surface);
  box-shadow: 0 0 0 1px var(--color-accent), 0 1px 3px rgba(0,0,0,0.15);
}

[data-theme="light"] .atelier-range::-moz-range-thumb {
  border-color: var(--color-surface);
  box-shadow: 0 0 0 1px var(--color-accent), 0 1px 3px rgba(0,0,0,0.15);
}

[data-theme="light"] .atelier-gravity-btn {
  background: var(--color-surface-hover);
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .atelier-gravity-btn:hover {
  background: var(--color-surface-active);
}

[data-theme="light"] .atelier-light-pad {
  background: var(--color-surface-hover);
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .atelier-light-pad::before {
  background:
    linear-gradient(to right, rgba(0,0,0,0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0,0,0,0.06) 1px, transparent 1px);
  background-size: 25% 25%;
}

[data-theme="light"] .atelier-light-toggle {
  background: var(--color-surface-hover);
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .atelier-light-type-btn {
  background: var(--color-surface-hover);
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .atelier-light-type-btn:hover {
  background: var(--color-surface-active);
}

[data-theme="light"] .atelier-divider {
  background: rgba(0, 0, 0, 0.08);
}

/* Space controls — light theme */
[data-theme="light"] .space-controls-btn {
  background: var(--color-surface);
  border-color: rgba(60, 90, 140, 0.2);
  color: #4A6A9A;
}

[data-theme="light"] .space-controls-btn::before {
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(60, 90, 140, 0.5) 55deg,
    transparent 110deg,
    transparent 200deg,
    rgba(60, 90, 140, 0.2) 245deg,
    transparent 290deg
  );
}

[data-theme="light"] .space-controls-btn::after {
  background: conic-gradient(
    from 120deg,
    transparent 0deg,
    rgba(60, 90, 140, 0.3) 30deg,
    transparent 60deg,
    transparent 360deg
  );
}

[data-theme="light"] .space-controls-btn:hover {
  color: #3A5A8A;
  border-color: rgba(60, 90, 140, 0.4);
  box-shadow: 0 0 28px rgba(60, 90, 140, 0.12), 0 0 8px rgba(60, 90, 140, 0.06);
}

[data-theme="light"] .space-controls.open .space-controls-btn {
  background: var(--color-surface);
  border-color: rgba(60, 90, 140, 0.4);
  color: #3A5A8A;
}

[data-theme="light"] .space-controls-panel {
  background: var(--color-surface);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .space-range {
  background: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .space-range::-webkit-slider-thumb {
  border-color: var(--color-surface);
  box-shadow: 0 0 0 1px var(--color-accent), 0 1px 3px rgba(0,0,0,0.15);
}

[data-theme="light"] .space-range::-moz-range-thumb {
  border-color: var(--color-surface);
  box-shadow: 0 0 0 1px var(--color-accent), 0 1px 3px rgba(0,0,0,0.15);
}

[data-theme="light"] .space-preset-btn {
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .space-preset-btn:hover {
  border-color: rgba(0, 0, 0, 0.18);
}

[data-theme="light"] .space-preset-btn.active {
  background: rgba(160, 120, 48, 0.08);
  border-color: var(--color-accent);
}

[data-theme="light"] .space-group-label {
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

/* Tooltips — light theme */
[data-theme="light"] .ctrl-tooltip {
  background: rgba(255, 255, 252, 0.92);
  border-color: rgba(0, 0, 0, 0.08);
  color: var(--color-text-primary);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .space-controls-btn .ctrl-tooltip {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 2px 12px rgba(60, 90, 140, 0.06);
}

[data-theme="light"] .space-controls-btn .ctrl-tooltip::after {
  background: rgba(60, 90, 140, 0.5);
}

[data-theme="light"] .footer-tree .ctrl-tooltip {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 2px 12px rgba(45, 106, 68, 0.06);
}

[data-theme="light"] .footer-tree .ctrl-tooltip::after {
  background: rgba(45, 106, 68, 0.5);
}

[data-theme="light"] .atelier-btn .ctrl-tooltip {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 2px 12px rgba(160, 120, 48, 0.06);
}

[data-theme="light"] .atelier-btn .ctrl-tooltip::after {
  background: rgba(160, 120, 48, 0.5);
}

/* Footer — light theme */
[data-theme="light"] .footer-tree {
  border-color: rgba(45, 106, 68, 0.25);
  color: #2D6A44;
}

[data-theme="light"] .footer-tree::before {
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(45, 106, 68, 0.45) 50deg,
    transparent 100deg,
    transparent 220deg,
    rgba(45, 106, 68, 0.18) 260deg,
    transparent 300deg
  );
}

[data-theme="light"] .footer-tree:hover {
  border-color: rgba(45, 106, 68, 0.4);
  box-shadow: 0 0 24px rgba(45, 106, 68, 0.1), 0 0 8px rgba(45, 106, 68, 0.05);
}
