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

body {
  background-color: #0a0a0f;
  overflow-x: hidden;
}

/* Animated grid background */
.bg-grid {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  background-image: 
    linear-gradient(rgba(0, 240, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: gridShift 20s linear infinite;
}

@keyframes gridShift {
  0% { background-position: 0 0; }
  100% { background-position: 40px 40px; }
}

/* Glassmorphism panel */
.glass-panel {
  background: rgba(22, 22, 31, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
}

.glass-panel-strong {
  background: rgba(22, 22, 31, 0.85);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
}

/* Upload zone */
.upload-zone {
  border: 2px dashed rgba(0, 240, 255, 0.3);
  border-radius: 16px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.upload-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(0, 240, 255, 0.04), transparent 70%);
  pointer-events: none;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: rgba(0, 240, 255, 0.6);
  box-shadow: 0 0 40px rgba(0, 240, 255, 0.1), inset 0 0 40px rgba(0, 240, 255, 0.03);
}

.upload-zone.has-image {
  border-style: solid;
  border-color: rgba(0, 240, 255, 0.4);
}

/* Glow effects */
.glow-cyber {
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.15);
}

.glow-neon {
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.15);
}

.glow-text-cyber {
  text-shadow: 0 0 20px rgba(0, 240, 255, 0.5);
}

.glow-text-neon {
  text-shadow: 0 0 20px rgba(168, 85, 247, 0.5);
}

/* Pulse indicator */
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00f0ff;
  animation: pulse 2s ease-in-out infinite;
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.6);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* Generate button */
.btn-generate {
  background: linear-gradient(135deg, #00f0ff, #a855f7);
  border: none;
  border-radius: 12px;
  padding: 16px 40px;
  font-size: 18px;
  font-weight: 700;
  color: #0a0a0f;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  font-family: 'JetBrains Mono', monospace;
}

.btn-generate::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(135deg, #00f0ff, #a855f7, #00f0ff);
  border-radius: 14px;
  z-index: -1;
  animation: borderGlow 3s linear infinite;
  background-size: 200% 200%;
}

@keyframes borderGlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.btn-generate:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 40px rgba(0, 240, 255, 0.3), 0 8px 40px rgba(168, 85, 247, 0.2);
}

.btn-generate:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: linear-gradient(135deg, #333, #444);
}

.btn-generate:disabled::before {
  display: none;
}

/* Skeleton shimmer */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
  border-radius: 12px;
}

/* Sticker card */
.sticker-card {
  transition: all 0.3s ease;
  border-radius: 16px;
}

.sticker-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 240, 255, 0.08), 0 4px 20px rgba(0, 0, 0, 0.25);
}

/* Checkerboard pattern for transparency (legacy, kept for fallback) */
.checkerboard {
  background-image:
    linear-gradient(45deg, #1a1a24 25%, transparent 25%),
    linear-gradient(-45deg, #1a1a24 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1a1a24 75%),
    linear-gradient(-45deg, transparent 75%, #1a1a24 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  background-color: #111118;
}

/* Adaptive sticker background — blends on light & dark */
.sticker-bg-adaptive {
  background: radial-gradient(ellipse at center, rgba(22, 22, 31, 0.6) 0%, rgba(22, 22, 31, 0.15) 60%, transparent 100%);
  background-color: rgba(22, 22, 31, 0.25);
}

/* Sticker image — soft shadow & smooth edges, no hard outline */
.sticker-image {
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35)) drop-shadow(0 0 12px rgba(0, 0, 0, 0.15));
  image-rendering: auto;
  /* Smooth edge blending for transparent PNGs */
  mix-blend-mode: normal;
}

/* On hover, enhance the glow subtly */
.sticker-card:hover .sticker-image {
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4)) drop-shadow(0 0 20px rgba(0, 240, 255, 0.08));
  transition: filter 0.3s ease;
}

/* Dark mode context (default) — slightly brighter glow */
@media (prefers-color-scheme: dark) {
  .sticker-bg-adaptive {
    background: radial-gradient(ellipse at center, rgba(30, 30, 45, 0.5) 0%, rgba(18, 18, 26, 0.1) 60%, transparent 100%);
  }
  .sticker-image {
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45)) drop-shadow(0 0 14px rgba(0, 0, 0, 0.2));
  }
}

/* Light mode context — softer shadow for bright backgrounds */
@media (prefers-color-scheme: light) {
  .sticker-bg-adaptive {
    background: radial-gradient(ellipse at center, rgba(240, 240, 245, 0.3) 0%, rgba(255, 255, 255, 0.05) 60%, transparent 100%);
  }
  .sticker-image {
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.18)) drop-shadow(0 0 10px rgba(0, 0, 0, 0.08));
  }
}

/* Toggle switch */
.toggle-container {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.toggle-option {
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  flex: 1;
}

.toggle-option.active {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.15), rgba(168, 85, 247, 0.15));
  color: #00f0ff;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.1);
}

/* Input styling */
.input-cyber {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px 20px;
  color: white;
  font-size: 16px;
  transition: all 0.3s ease;
  width: 100%;
  font-family: 'IBM Plex Sans', sans-serif;
}

.input-cyber:focus {
  outline: none;
  border-color: rgba(0, 240, 255, 0.5);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.1);
}

.input-cyber::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

/* Action buttons */
.btn-action {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 20px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 500;
}

.btn-action:hover {
  border-color: rgba(0, 240, 255, 0.3);
  color: #00f0ff;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.1);
  transform: translateY(-1px);
}

/* Download button on card */
.btn-download {
  background: rgba(0, 240, 255, 0.1);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: 8px;
  padding: 6px 12px;
  color: #00f0ff;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 12px;
}

.btn-download:hover {
  background: rgba(0, 240, 255, 0.2);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.15);
}

/* Fade in animation */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in-up {
  animation: fadeInUp 0.5s ease forwards;
}

/* Spinner */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(10, 10, 15, 0.3);
  border-top-color: #0a0a0f;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Sticker image with meme text overlay — smooth edge wrapper */
.sticker-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 16px;
  /* Smooth outer edge masking for natural blending */
  -webkit-mask-image: radial-gradient(ellipse at center, black 70%, transparent 100%);
  mask-image: radial-gradient(ellipse at center, black 70%, transparent 100%);
  /* Alternative: soft vignette that fades sticker edges */
  -webkit-mask-image: linear-gradient(to bottom, 
    transparent 0%, black 3%, black 97%, transparent 100%),
    linear-gradient(to right, 
    transparent 0%, black 3%, black 97%, transparent 100%);
  -webkit-mask-composite: destination-in;
  mask-composite: intersect;
}

.meme-text-overlay {
  position: absolute;
  bottom: 8%;
  left: 5%;
  right: 5%;
  text-align: center;
  font-family: 'Impact', 'Arial Black', sans-serif;
  font-size: clamp(14px, 4vw, 22px);
  font-weight: 900;
  color: white;
  text-transform: uppercase;
  -webkit-text-stroke: 2px black;
  text-shadow: 
    2px 2px 0 #000,
    -2px -2px 0 #000,
    2px -2px 0 #000,
    -2px 2px 0 #000,
    0 2px 0 #000,
    0 -2px 0 #000,
    2px 0 0 #000,
    -2px 0 0 #000;
  line-height: 1.2;
  word-wrap: break-word;
  pointer-events: none;
}

/* Emoji buttons */
.emoji-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 20px;
}

.emoji-btn:hover {
  background: rgba(0, 240, 255, 0.1);
  border-color: rgba(0, 240, 255, 0.3);
  transform: scale(1.1);
}

/* Retry button */
.btn-retry {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  padding: 8px 16px;
  color: #ef4444;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
}

.btn-retry:hover {
  background: rgba(239, 68, 68, 0.25);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: #0a0a0f;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 240, 255, 0.2);
  border-radius: 3px;
}

/* Tooltip */
.tooltip-text {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(22, 22, 31, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  transition: all 0.2s ease;
  z-index: 10;
}

.tooltip-parent:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Ambient gradient */
.ambient-gradient {
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  pointer-events: none;
  z-index: 0;
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(0, 240, 255, 0.03), transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(168, 85, 247, 0.03), transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(245, 166, 35, 0.01), transparent 60%);
  animation: ambientShift 15s ease-in-out infinite alternate;
}

@keyframes ambientShift {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(-5%, -5%) rotate(3deg); }
}

/* Strength slider */
.strength-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #00ff88 0%, #00f0ff 35%, #f5a623 65%, #ef4444 100%);
  outline: none;
  opacity: 0.9;
  transition: opacity 0.2s;
  cursor: pointer;
}

.strength-slider:hover {
  opacity: 1;
}

.strength-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #0a0a0f;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.4), 0 2px 6px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: all 0.2s ease;
}

.strength-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.6), 0 2px 8px rgba(0, 0, 0, 0.6);
}

.strength-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #0a0a0f;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.4), 0 2px 6px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

/* Strength preset buttons */
.strength-preset-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 6px 14px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'JetBrains Mono', monospace;
}

.strength-preset-btn:hover {
  border-color: rgba(0, 240, 255, 0.3);
  color: rgba(0, 240, 255, 0.8);
  background: rgba(0, 240, 255, 0.05);
}

.strength-preset-btn.active {
  border-color: rgba(0, 240, 255, 0.5);
  color: #00f0ff;
  background: rgba(0, 240, 255, 0.1);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.1);
}

/* Small retry button on sticker card */
.btn-retry-small {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 12px;
  line-height: 1;
}

.btn-retry-small:hover {
  background: rgba(0, 240, 255, 0.1);
  border-color: rgba(0, 240, 255, 0.3);
}

/* Collapsible tips */
.tips-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.tips-content.open {
  max-height: 400px;
}

/* Footer link */
footer a {
  color: #00f0ff;
  text-decoration: none;
  transition: all 0.2s ease;
}

footer a:hover {
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}