:root {
  /* Colors */
  --color-lime-spark: #d2e823;
  --color-lavender-mist: #e9c0e9;
  --color-cobalt-band: #2665d6;
  --color-maroon-plate: #780016;
  --color-cobalt-deep: #061492;
  --color-forest-ink: #254f1a;
  --color-mustard-pop: #d6a337;
  --color-linen-canvas: #f3f3f1;
  --color-white: #ffffff;
  --color-black: #000000;
  
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--color-linen-canvas);
  color: var(--color-black);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Animations */
@keyframes fadeInZoom {
  0% { opacity: 0; transform: scale(0.95); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes fadeInSlideUp {
  0% { opacity: 0; transform: translateY(32px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInSlideLeft {
  0% { opacity: 0; transform: translateX(32px); }
  100% { opacity: 1; transform: translateX(0); }
}

.animate-fade-in-zoom {
  animation: fadeInZoom 0.5s ease-out forwards;
}

.animate-fade-in-up {
  animation: fadeInSlideUp 0.5s ease-out forwards;
}

.animate-fade-in-left {
  animation: fadeInSlideLeft 0.5s ease-out forwards;
}

/* Layout Utilities */
.container {
  max-width: 1024px;
  margin: 0 auto;
  padding: 16px;
}

@media (min-width: 640px) {
  .container {
    padding: 32px;
  }
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-1 { flex: 1 1 0%; }
.shrink-0 { flex-shrink: 0; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.hidden { display: none !important; }
.block { display: block; }
.relative { position: relative; }
.absolute { position: absolute; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.overflow-hidden { overflow: hidden; }

.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.gap-8 { gap: 32px; }

@media (min-width: 640px) {
  .sm\:gap-12 { gap: 48px; }
}

/* Grid */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (min-width: 768px) {
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Typography */
.text-center { text-align: center; }
.font-medium { font-weight: 500; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.tracking-tight { letter-spacing: -0.025em; }
.tracking-tighter { letter-spacing: -0.05em; }
.tracking-display { letter-spacing: -0.043em; }
.leading-none { line-height: 1; }

.text-xs { font-size: 12px; }
.text-sm { font-size: 14px; }
.text-base { font-size: 16px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }
.text-4xl { font-size: 36px; }
.text-5xl { font-size: 48px; }

@media (min-width: 640px) {
  .sm\:text-sm { font-size: 14px; }
  .sm\:text-base { font-size: 16px; }
  .sm\:text-lg { font-size: 18px; }
  .sm\:text-xl { font-size: 20px; }
  .sm\:text-2xl { font-size: 24px; }
  .sm\:text-6xl { font-size: 60px; }
  .sm\:text-7xl { font-size: 72px; }
}

/* Borders and Radii */
.border-2 { border: 2px solid; }
.border-3 { border: 3px solid; }
.border-black { border-color: var(--color-black); }
.border-transparent { border-color: transparent; }
.border-dashed { border-style: dashed; }

.rounded-lg { border-radius: 8px; }
.rounded-2xl { border-radius: 16px; }
.rounded-3xl { border-radius: 24px; }
.rounded-4xl { border-radius: 32px; }
.rounded-pill { border-radius: 99px; }
.rounded-full { border-radius: 1000px; }

@media (min-width: 640px) {
  .sm\:rounded-4xl { border-radius: 32px; }
  .sm\:rounded-5xl { border-radius: 48px; }
}

/* Colors and Backgrounds */
.bg-lime-spark { background-color: var(--color-lime-spark); }
.bg-lavender-mist { background-color: var(--color-lavender-mist); }
.bg-cobalt-deep { background-color: var(--color-cobalt-deep); }
.bg-maroon-plate { background-color: var(--color-maroon-plate); }
.bg-mustard-pop { background-color: var(--color-mustard-pop); }
.bg-linen-canvas { background-color: var(--color-linen-canvas); }
.bg-white { background-color: var(--color-white); }
.bg-black { background-color: var(--color-black); }

.text-white { color: var(--color-white); }
.text-black { color: var(--color-black); }
.text-lime-spark { color: var(--color-lime-spark); }

.opacity-80 { opacity: 0.8; }
.opacity-90 { opacity: 0.9; }
.opacity-0 { opacity: 0; }
.opacity-70 { opacity: 0.7; }

/* Interactive Elements */
.cursor-pointer { cursor: pointer; }
.cursor-crosshair { cursor: crosshair; }
.transition-all { transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.transition-opacity { transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.transition-transform { transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.transition-colors { transition: background-color 0.3s, color 0.3s, border-color 0.3s; }

button, a {
  text-decoration: none;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

button:hover:not(:disabled), a:hover, label:hover {
  transform: translateY(-4px);
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.group:hover .group-hover\:scale-110 {
  transform: scale(1.1);
}

.nav-logo {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-logo:hover {
  transform: scale(1.05);
}

/* Specific Component Styles */
.header-bar {
  margin-bottom: 32px;
  background-color: var(--color-white);
  border-radius: 99px;
  padding: 16px 24px;
  border: 3px solid var(--color-black);
}

@media (min-width: 640px) {
  .header-bar { margin-bottom: 48px; }
}

.step-indicator {
  width: 12px;
  height: 12px;
  border-radius: 99px;
  border: 2px solid var(--color-black);
  background-color: var(--color-white);
  transition: background-color 0.3s;
}
.step-indicator.active {
  background-color: var(--color-black);
}

.upload-box {
  background-color: rgba(255, 255, 255, 0.4);
  border: 3px dashed var(--color-black);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4/3;
  width: 100%;
}
@media (min-width: 640px) {
  .upload-box { aspect-ratio: 16/9; }
}
.upload-box:hover {
  background-color: rgba(255, 255, 255, 0.6);
}

.icon-box {
  background-color: var(--color-white);
  padding: 16px;
  border-radius: 99px;
  border: 2px solid var(--color-black);
  margin-bottom: 24px;
}
.icon-box.black {
  background-color: var(--color-black);
  color: var(--color-white);
}

.btn-primary {
  background-color: var(--color-lime-spark);
  color: var(--color-black);
  border: 3px solid var(--color-black);
  padding: 16px 32px;
  border-radius: 99px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 18px;
}
.btn-primary:hover {
  background-color: #c2d61a;
}

.btn-white {
  background-color: var(--color-white);
  color: var(--color-black);
  border: 2px solid var(--color-black);
  padding: 12px 24px;
  border-radius: 99px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-white:hover {
  background-color: #f3f4f6;
}

.btn-ghost {
  background-color: transparent;
  color: inherit;
  border: 2px solid transparent;
  padding: 12px 24px;
  border-radius: 99px;
  font-weight: 700;
}
.btn-ghost:hover {
  border-color: rgba(255,255,255,0.2);
}

.btn-icon {
  background-color: var(--color-white);
  color: var(--color-black);
  border: 3px solid var(--color-black);
  padding: 12px;
  border-radius: 99px;
  font-weight: 700;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-icon:hover { background-color: #f3f4f6; }

/* Desktop view splits */
@media (min-width: 1024px) {
  .lg\:flex-row { flex-direction: row; }
  .lg\:flex-row-reverse { flex-direction: row-reverse; }
  .lg\:text-left { text-align: left; }
  .lg\:w-72 { width: 288px; }
  .lg\:block { display: block; }
}

.glass-card {
  background-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  border: 3px solid var(--color-black);
  border-radius: 24px;
  padding: 24px;
  display: flex;
  flex-direction: column;
}
@media (min-width: 640px) {
  .glass-card { border-radius: 32px; padding: 32px; }
}

.number-badge {
  background-color: var(--color-lime-spark);
  color: var(--color-black);
  border: 2px solid var(--color-black);
  width: 40px;
  height: 40px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  margin-bottom: 24px;
  flex-shrink: 0;
}

.preview-circle {
  width: 160px;
  height: 160px;
  border-radius: 1000px;
  overflow: hidden;
  border: 3px solid var(--color-black);
  position: relative;
}
@media (min-width: 640px) {
  .preview-circle { width: 256px; height: 256px; }
}
.preview-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.preview-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(6, 20, 146, 0.2);
  mix-blend-mode: multiply;
}

.canvas-container {
  position: relative;
  width: 100%;
  flex: 1;
  border-radius: 16px;
  overflow: hidden;
  background-color: var(--color-white);
  border: 3px solid var(--color-black);
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: crosshair;
}
@media (min-width: 640px) {
  .canvas-container { border-radius: 24px; }
}

canvas {
  max-width: 100%;
  max-height: 50vh;
  width: auto;
  height: auto;
  margin: 0 auto;
  display: block;
}

.mask-canvas {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  mix-blend-mode: screen;
  pointer-events: none;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-pill {
  background-color: var(--color-white);
  color: var(--color-black);
  padding: 16px 24px;
  border-radius: 99px;
  border: 2px solid var(--color-black);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
}

.spinner {
  animation: spin 1s linear infinite;
  border-radius: 50%;
  height: 20px;
  width: 20px;
  border-bottom: 2px solid var(--color-black);
  border-left: 2px solid var(--color-black);
  border-top: 2px solid transparent;
  border-right: 2px solid transparent;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.palette-btn {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 99px;
  border: 2px solid var(--color-black);
  transition: transform 0.3s;
}
.palette-btn.active {
  transform: scale(1.1);
  box-shadow: 0 0 0 2px var(--color-linen-canvas), 0 0 0 4px var(--color-black);
}

.color-input-wrapper {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 99px;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--color-black);
}
@media (min-width: 640px) {
  .color-input-wrapper { width: 48px; height: 48px; }
}
.color-input-wrapper input[type="color"] {
  position: absolute;
  top: -16px;
  left: -16px;
  width: 80px;
  height: 80px;
  cursor: pointer;
  border: none;
  padding: 0;
}

.step-panel {
  padding: 24px;
  border-radius: 32px;
  border: 3px solid var(--color-black);
  display: flex;
  flex-direction: column;
  gap: 32px;
}
@media (min-width: 640px) {
  .step-panel { padding: 64px; border-radius: 48px; }
}

.p-4 { padding: 16px; }
.p-6 { padding: 24px; }
.px-2 { padding-left: 8px; padding-right: 8px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.px-8 { padding-left: 32px; padding-right: 32px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }
@media (min-width: 640px) {
  .sm\:p-8 { padding: 32px; }
  .sm\:px-4 { padding-left: 16px; padding-right: 16px; }
}

.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; }
.mt-auto { margin-top: auto; }
.max-w-md { max-width: 28rem; }
.mx-auto { margin-left: auto; margin-right: auto; }

.font-mono { font-family: monospace; }
.uppercase { text-transform: uppercase; }

@media (max-width: 768px) {
  .hidden-mobile {
    display: none !important;
  }
}

/* Dynamic Brand Palette Grid */
#brand-palette {
  grid-template-columns: repeat(4, 1fr) !important;
}
.swatch-mobile-only {
  display: none !important;
}
.swatch-full-view {
  display: flex !important;
  width: 100%;
  height: 100%;
}
.palette-btn {
  grid-column: span 1;
}

@media (max-width: 768px) {
  #brand-palette:not(.is-searching) {
    grid-template-columns: repeat(4, 1fr) !important;
  }
  
  #brand-palette:not(.is-searching) .palette-btn .swatch-mobile-only {
    display: block !important;
    border-radius: 6px;
  }
  
  #brand-palette:not(.is-searching) .palette-btn .swatch-full-view {
    display: none !important;
  }
}
