/* ===== CSS Custom Properties ===== */
:root {
  /* Colors */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);

  --accent-violet: #8b5cf6;
  --accent-cyan: #06b6d4;
  --accent-pink: #ec4899;
  --accent-gradient: linear-gradient(135deg, var(--accent-violet), var(--accent-cyan));

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(139, 92, 246, 0.5);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Radius */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 9999px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== Animated Background ===== */
.bg-gradient {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(139, 92, 246, 0.15), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(6, 182, 212, 0.1), transparent),
    radial-gradient(ellipse 50% 30% at 0% 100%, rgba(236, 72, 153, 0.08), transparent);
  pointer-events: none;
  z-index: 0;
}

.bg-orbs {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: float 20s ease-in-out infinite;
}

.orb-1 {
  width: 400px;
  height: 400px;
  background: var(--accent-violet);
  top: -100px;
  right: -100px;
  animation-delay: 0s;
}

.orb-2 {
  width: 300px;
  height: 300px;
  background: var(--accent-cyan);
  bottom: -50px;
  left: -50px;
  animation-delay: -7s;
}

.orb-3 {
  width: 250px;
  height: 250px;
  background: var(--accent-pink);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -14s;
  opacity: 0.2;
}

@keyframes float {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  25% {
    transform: translate(30px, -30px) scale(1.05);
  }

  50% {
    transform: translate(-20px, 20px) scale(0.95);
  }

  75% {
    transform: translate(-30px, -20px) scale(1.02);
  }
}

.noise-overlay {
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  z-index: 1;
}

/* ===== App Container ===== */
.app {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-md);
}

@media (min-width: 768px) {
  .app {
    padding: var(--space-xl);
  }
}

/* ===== Header ===== */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) 0;
  margin-bottom: var(--space-xl);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
}

.logo-icon svg {
  width: 24px;
  height: 24px;
  color: white;
}

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

.logo-title {
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

.header-badge {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  color: var(--text-secondary);
  backdrop-filter: blur(10px);
}

.badge-dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {

  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  }

  50% {
    opacity: 0.8;
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
  }
}

/* ===== Main Content ===== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2xl);
}

/* ===== Mode Toggle ===== */
.mode-toggle {
  display: flex;
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 4px;
  backdrop-filter: blur(20px);
}

.mode-btn {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.3s var(--ease-out);
}

@media (min-width: 640px) {
  .mode-btn {
    padding: var(--space-md) var(--space-xl);
    font-size: 1rem;
  }
}

.mode-btn.active {
  color: var(--text-primary);
}

.mode-btn:hover:not(.active) {
  color: var(--text-secondary);
}

.mode-icon {
  font-size: 1.125rem;
}

.mode-slider {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  transition: transform 0.4s var(--ease-bounce);
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.3);
}

.mode-slider.track {
  transform: translateX(100%);
}

/* ===== Effect Cards ===== */
.cards-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  width: 100%;
  max-width: 700px;
}

@media (min-width: 640px) {
  .cards-container {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-lg);
  }
}

.effect-card {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-xl);
  cursor: default;
  transition: transform 0.3s var(--ease-out);
}

.effect-card:hover {
  transform: translateY(-4px);
}

.card-glow {
  position: absolute;
  inset: -2px;
  background: var(--accent-gradient);
  border-radius: inherit;
  opacity: 0;
  filter: blur(8px);
  transition: opacity 0.3s var(--ease-out);
  z-index: 0;
}

.effect-card:hover .card-glow,
.effect-card.active .card-glow {
  opacity: 0.4;
}

.effect-card.generating .card-glow {
  opacity: 0.6;
  animation: glow-pulse 0.6s ease-in-out infinite;
}

@keyframes glow-pulse {

  0%,
  100% {
    opacity: 0.4;
  }

  50% {
    opacity: 0.8;
  }
}

.card-inner {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: inherit;
  backdrop-filter: blur(20px);
  overflow: hidden;
  transition: background 0.3s var(--ease-out), border-color 0.3s var(--ease-out);
}

.effect-card:hover .card-inner {
  background: var(--bg-card-hover);
  border-color: rgba(139, 92, 246, 0.3);
}

.card-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

.card-effect {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 var(--space-sm);
}

.effect-text {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  transition: all 0.4s var(--ease-bounce);
}

@media (min-width: 640px) {
  .effect-text {
    font-size: 1rem;
  }
}

.effect-text.generating {
  animation: text-flicker 0.1s linear infinite;
}

@keyframes text-flicker {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }

  100% {
    opacity: 1;
  }
}

.effect-text.revealed {
  animation: effect-reveal 0.5s var(--ease-bounce);
}

@keyframes effect-reveal {
  0% {
    transform: scale(0.5) translateY(10px);
    opacity: 0;
  }

  60% {
    transform: scale(1.1) translateY(-5px);
  }

  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.card-indicator {
  width: 4px;
  height: 4px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all 0.3s var(--ease-out);
}

.effect-card.active .card-indicator {
  background: var(--accent-violet);
  box-shadow: 0 0 10px var(--accent-violet);
}

/* ===== Generate Button ===== */
.action-area {
  display: flex;
  justify-content: center;
  padding: var(--space-lg) 0;
}

.generate-btn {
  position: relative;
  width: 180px;
  height: 180px;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: transform 0.3s var(--ease-out);
}

@media (min-width: 640px) {
  .generate-btn {
    width: 200px;
    height: 200px;
  }
}

.generate-btn:hover {
  transform: scale(1.05);
}

.generate-btn:active {
  transform: scale(0.95);
}

.generate-btn:disabled {
  cursor: not-allowed;
}

.btn-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  background:
    linear-gradient(var(--bg-secondary), var(--bg-secondary)) padding-box,
    var(--accent-gradient) border-box;
  transition: all 0.3s var(--ease-out);
}

.generate-btn:hover .btn-ring {
  border-width: 3px;
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.3);
}

.generate-btn.generating .btn-ring {
  animation: ring-spin 2s linear infinite;
}

@keyframes ring-spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.btn-inner {
  position: absolute;
  inset: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  background: var(--bg-card);
  border-radius: 50%;
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
}

.btn-icon {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s var(--ease-out);
}

@media (min-width: 640px) {
  .btn-icon {
    width: 70px;
    height: 70px;
  }
}

.generate-btn.generating .btn-icon {
  animation: icon-spin 1s ease-in-out infinite;
}

@keyframes icon-spin {
  0% {
    transform: rotate(0deg) scale(1);
  }

  50% {
    transform: rotate(180deg) scale(1.1);
  }

  100% {
    transform: rotate(360deg) scale(1);
  }
}

.randomizer-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
}

.btn-text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--text-primary);
  transition: color 0.3s var(--ease-out);
}

.generate-btn:hover .btn-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.btn-pulse {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid var(--accent-violet);
  opacity: 0;
  pointer-events: none;
}

.generate-btn:not(:disabled):hover .btn-pulse {
  animation: pulse-ring 1.5s ease-out infinite;
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.9);
    opacity: 0.5;
  }

  100% {
    transform: scale(1.2);
    opacity: 0;
  }
}

/* ===== Info Section ===== */
.info-section {
  text-align: center;
  max-width: 500px;
}

.info-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.info-text strong {
  color: var(--text-secondary);
  font-weight: 500;
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: var(--space-xl) 0 var(--space-md);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.footer a {
  color: var(--accent-violet);
  text-decoration: none;
  transition: color 0.2s;
}

.footer a:hover {
  color: var(--accent-cyan);
}

/* ===== Card Animation States ===== */
.effect-card.slide-out {
  animation: card-slide-out 0.4s var(--ease-out) forwards;
}

.effect-card.slide-in {
  animation: card-slide-in 0.5s var(--ease-bounce) forwards;
}

@keyframes card-slide-out {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }

  100% {
    transform: translateY(-20px) scale(0.9);
    opacity: 0;
  }
}

@keyframes card-slide-in {
  0% {
    transform: translateY(20px) scale(0.9);
    opacity: 0;
  }

  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* ===== Generating State ===== */
.generate-btn.generating .btn-inner {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(6, 182, 212, 0.1));
}