:root {
  color-scheme: dark;
  --active-color: #38bdf8;
  --gradient-preview: linear-gradient(135deg, #38bdf8, #34d399);
  --studio-bg: #0d1117;
  --studio-panel: rgba(17, 24, 39, 0.78);
  --studio-line: rgba(148, 163, 184, 0.16);
  --studio-cyan: #38bdf8;
  --studio-mint: #34d399;
  --studio-rose: #fb7185;
}

body {
  background:
    radial-gradient(circle at 12% 0%, rgba(56, 189, 248, 0.14), transparent 26rem),
    radial-gradient(circle at 90% 8%, rgba(52, 211, 153, 0.10), transparent 30rem),
    linear-gradient(180deg, #0d1117 0%, #0a0f17 45%, #0d1117 100%);
}

.glass {
  background: var(--studio-panel);
  backdrop-filter: blur(18px);
  border: 1px solid var(--studio-line);
}

.tool-tab {
  position: relative;
  isolation: isolate;
}

.tool-tab::after {
  position: absolute;
  right: 0.75rem;
  bottom: 0.5rem;
  left: 0.75rem;
  height: 2px;
  content: "";
  background: linear-gradient(90deg, var(--studio-cyan), var(--studio-mint));
  border-radius: 999px;
  opacity: 0;
  transform: scaleX(0.58);
  transform-origin: left;
  transition: opacity 180ms ease, transform 180ms ease;
}

.tab-active {
  color: #f8fafc;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(52, 211, 153, 0.12));
  border-color: rgba(56, 189, 248, 0.38);
}

.tab-active::after {
  opacity: 1;
  transform: scaleX(1);
}

#heroSwatch,
.swatch-surface {
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.12) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.12) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.12) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.12) 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.format-card,
.palette-card,
.image-color-card {
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.format-card:hover,
.palette-card:hover,
.image-color-card:hover {
  border-color: rgba(56, 189, 248, 0.46);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.24);
  transform: translateY(-2px);
}

.gradient-preview {
  background: var(--gradient-preview);
  background-size: 160% 160%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 24px 80px rgba(0, 0, 0, 0.28);
}

input[type="range"] {
  height: 0.5rem;
  cursor: pointer;
  background: linear-gradient(90deg, var(--studio-cyan), var(--studio-mint));
  border-radius: 999px;
  outline: none;
  appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  width: 1.15rem;
  height: 1.15rem;
  appearance: none;
  background: #f8fafc;
  border: 3px solid var(--studio-cyan);
  border-radius: 999px;
  box-shadow: 0 0 0 5px rgba(56, 189, 248, 0.14);
}

input[type="range"]::-moz-range-thumb {
  width: 1.15rem;
  height: 1.15rem;
  background: #f8fafc;
  border: 3px solid var(--studio-cyan);
  border-radius: 999px;
  box-shadow: 0 0 0 5px rgba(56, 189, 248, 0.14);
}

.image-drop-zone {
  min-height: 15rem;
  border: 1px dashed rgba(251, 113, 133, 0.34);
  background:
    linear-gradient(135deg, rgba(251, 113, 133, 0.08), rgba(56, 189, 248, 0.06)),
    rgba(255, 255, 255, 0.035);
}

.image-drop-zone.is-dragging {
  border-color: rgba(56, 189, 248, 0.82);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
}

input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: rgba(251, 113, 133, 0.78);
  box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.14);
}

#mobileMenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 220ms ease, border-color 220ms ease;
}

#mobileMenu.is-open {
  max-height: 28rem;
  border-color: rgba(148, 163, 184, 0.16);
}

#toast {
  display: block;
  opacity: 0;
  transform: translate(-50%, 0.7rem) scale(0.96);
  transition: opacity 180ms ease, transform 180ms ease;
}

#toast.toast-visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

#toast.hidden {
  display: block;
  opacity: 0;
  pointer-events: none;
}

.copy-flash {
  animation: flash 900ms ease;
}

@keyframes flash {
  0% {
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.55);
  }
  100% {
    box-shadow: 0 0 0 12px rgba(56, 189, 248, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
  }
}
