/**
 * Color with Numbers - Retrowave & Kid-Friendly Stylesheet
 * Dual Canvas (Pixel Art) & SVG (Organic Vector Coloring Pages & Mandalas)
 */

.color-number-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  max-width: 820px;
  margin: 0 auto;
  padding: 14px;
  box-sizing: border-box;
  background: linear-gradient(145deg, #120d24 0%, #17112d 50%, #0c1222 100%);
  border-radius: 24px;
  border: 2px solid rgba(236, 72, 153, 0.4);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 30px rgba(236, 72, 153, 0.15);
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  font-family: 'Fredoka', 'Quicksand', -apple-system, sans-serif;
  user-select: none;
}

/* --- TOP HUD BAR --- */
.color-hud-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 10px;
  gap: 10px;
  flex-shrink: 0;
}

.color-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.color-category-badge {
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(236, 72, 153, 0.2);
  border: 1px solid #ec4899;
  color: #f472b6;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.color-art-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 6px;
}

.color-hud-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.color-hud-btn {
  padding: 7px 13px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: #1e293b;
  color: #e2e8f0;
  font-family: 'Fredoka', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.color-hud-btn:hover {
  transform: translateY(-2px);
  background: #334155;
  border-color: #ec4899;
}

.color-hud-btn:active {
  transform: scale(0.96);
}

.color-hud-btn.gallery-btn {
  background: linear-gradient(135deg, #ec4899, #be185d);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 14px rgba(236, 72, 153, 0.4);
}

.color-hud-btn.magic-btn.active {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: #ffffff;
  border-color: #a78bfa;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.6);
}

.color-hud-btn.hint-btn {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
  color: #fbbf24;
}

/* --- PROGRESS & MOTIVATION STATUS BAR --- */
.color-status-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  background: rgba(15, 23, 42, 0.6);
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.color-progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.color-progress-track {
  flex: 1;
  height: 12px;
  background: rgba(30, 41, 59, 0.9);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
}

.color-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ec4899, #fbbf24, #10b981);
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 12px rgba(236, 72, 153, 0.6);
}

.color-progress-text {
  font-size: 13px;
  font-weight: 800;
  color: #fbbf24;
  white-space: nowrap;
}

.color-instruction-banner {
  font-size: 13.5px;
  font-weight: 600;
  color: #cbd5e1;
  text-align: center;
  transition: all 0.2s ease;
  min-height: 22px;
}

.color-instruction-banner strong {
  color: #f472b6;
  font-weight: 800;
}

.color-instruction-banner.complete-banner {
  color: #34d399;
  background: rgba(16, 185, 129, 0.15);
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(16, 185, 129, 0.3);
  animation: pulse-glow 1.5s infinite;
}

/* --- STAGE WRAPPER (DUAL CANVAS & SVG) --- */
.color-stage-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 0;
  position: relative;
  padding: 4px 0;
  margin: 4px 0;
}

.color-canvas-wrapper {
  position: relative;
  max-width: min(390px, 46vh);
  max-height: min(390px, 46vh);
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 0 4px rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}

/* Canvas Mode (Pixel Art) */
#color-canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: pointer;
  background-color: #ffffff;
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
}

/* SVG Mode (Vector Mandalas & Coloring Pages) */
#color-svg {
  width: 100%;
  height: 100%;
  cursor: pointer;
  display: block;
}

.mandala-region {
  cursor: pointer;
  transition: filter 0.15s ease, opacity 0.15s ease;
}

.mandala-region:hover {
  filter: brightness(1.1);
}

.mandala-region.active-target path,
.mandala-region.active-target polygon,
.mandala-region.active-target circle {
  stroke: #f59e0b !important;
  stroke-width: 2.5px !important;
  stroke-dasharray: 4 2;
  filter: drop-shadow(0 0 3px rgba(245, 158, 11, 0.45));
}

.mandala-region.active-target text {
  fill: #ea580c !important;
  font-weight: 900 !important;
  font-size: 16px !important;
}

.mandala-region.hint-flash path,
.mandala-region.hint-flash polygon,
.mandala-region.hint-flash circle {
  animation: hint-glow 0.6s ease-in-out 3 alternate !important;
}

/* --- PALETTE CHIPS BAR --- */
.color-palette-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  padding: 12px 6px;
  flex-shrink: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(236, 72, 153, 0.5) rgba(15, 23, 42, 0.4);
}

.color-palette-bar::-webkit-scrollbar {
  height: 6px;
}
.color-palette-bar::-webkit-scrollbar-thumb {
  background: rgba(236, 72, 153, 0.5);
  border-radius: 4px;
}

.palette-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px 7px 8px;
  background: #1e293b;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
  color: #f1f5f9;
}

.palette-chip:hover {
  transform: translateY(-2px);
  background: #273549;
  border-color: rgba(255, 255, 255, 0.3);
}

.palette-chip.active {
  border-color: #ffd54f;
  background: rgba(255, 213, 79, 0.15);
  box-shadow: 0 0 16px rgba(255, 213, 79, 0.45);
  transform: scale(1.06);
}

.palette-chip.completed {
  opacity: 0.6;
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.chip-swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 15px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.85);
  flex-shrink: 0;
}

.chip-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
}

.chip-num {
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
}

.chip-count {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
}

.palette-chip.completed .chip-count {
  color: #34d399;
}

/* --- ANIMATIONS --- */
@keyframes hint-glow {
  0% { fill: #f59e0b !important; }
  100% { fill: #ffffff !important; }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 rgba(16, 185, 129, 0); }
  50% { box-shadow: 0 0 12px rgba(16, 185, 129, 0.4); }
}

.wobble {
  animation: wobble-shake 0.28s ease-in-out;
}

@keyframes wobble-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px) rotate(-1deg); }
  75% { transform: translateX(6px) rotate(1deg); }
}

/* --- CONFETTI CANVAS --- */
#color-confetti-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

/* --- ARTWORKS GALLERY MODAL --- */
.color-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.color-modal-overlay.hidden {
  display: none !important;
}

.color-gallery-card {
  background: #0f172a;
  border: 2px solid #ec4899;
  border-radius: 24px;
  width: 100%;
  max-width: 860px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(236, 72, 153, 0.25);
  overflow: hidden;
}

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

.color-gallery-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-gallery-close {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  font-size: 1.1rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.color-gallery-close:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}

/* Category Filter Tabs */
.color-category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  scrollbar-width: thin;
}

.color-cat-pill {
  padding: 6px 14px;
  border-radius: 999px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  font-family: 'Fredoka', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.color-cat-pill:hover {
  background: #334155;
  color: #ffffff;
}

.color-cat-pill.active {
  background: linear-gradient(135deg, #ec4899, #be185d);
  color: #ffffff;
  border-color: #ec4899;
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.4);
}

/* Gallery Grid */
.color-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  overflow-y: auto;
  padding: 6px 2px;
  max-height: calc(85vh - 160px);
}

.color-art-card {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.color-art-card:hover {
  transform: translateY(-4px);
  background: #273549;
  border-color: #ec4899;
  box-shadow: 0 10px 24px rgba(236, 72, 153, 0.25);
}

.color-art-card.active-art {
  border: 2px solid #38bdf8;
  background: rgba(56, 189, 248, 0.12);
}

.color-art-card.completed {
  border-color: #10b981;
}

.color-card-icon {
  font-size: 2.4rem;
  margin-bottom: 8px;
}

.color-card-title {
  font-size: 14px;
  font-weight: 800;
  color: #f1f5f9;
  margin-bottom: 4px;
}

.color-card-badge {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 6px;
}

.color-card-star {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 16px;
  color: #fbbf24;
}

/* --- VICTORY CELEBRATION MODAL --- */
.color-win-card {
  background: #0f172a;
  border: 3px solid #fbbf24;
  border-radius: 28px;
  max-width: 480px;
  width: 100%;
  padding: 32px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.9), 0 0 50px rgba(251, 191, 36, 0.35);
  animation: win-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes win-pop {
  0% { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.color-win-icon {
  font-size: 3.5rem;
  margin-bottom: 10px;
  animation: bounce-trophy 1.2s infinite ease-in-out;
}

@keyframes bounce-trophy {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.color-win-title {
  font-size: 1.8rem;
  font-weight: 900;
  color: #fbbf24;
  margin-bottom: 6px;
}

.color-win-sub {
  font-size: 14px;
  color: #cbd5e1;
  margin-bottom: 18px;
}

.color-win-prizes {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
  flex-wrap: wrap;
  justify-content: center;
}

.color-prize-pill {
  padding: 8px 14px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 6px;
}

.color-prize-pill.aura-pill {
  background: rgba(236, 72, 153, 0.2);
  border-color: #ec4899;
  color: #f472b6;
}

.color-win-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.color-win-btn {
  width: 100%;
  padding: 13px;
  border-radius: 14px;
  font-family: 'Fredoka', sans-serif;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  border: none;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.color-win-btn.primary {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.color-win-btn.download-btn {
  background: linear-gradient(135deg, #ec4899, #be185d);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(236, 72, 153, 0.4);
}

.color-win-btn.secondary {
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid #475569;
}

.color-win-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .color-number-container {
    height: calc(100vh - 80px);
    padding: 8px;
  }
  .color-hud-bar {
    padding: 8px 10px;
  }
  .color-art-title {
    font-size: 1rem;
  }
  .color-hud-btn {
    padding: 6px 10px;
    font-size: 12px;
  }
  .color-gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
