:root {
  --coral: #FF6B6B;
  --violet: #845EC2;
  --teal: #00C9A7;
  --cream: #FFF8F0;
  --peach: #FFE5D9;
  --lavender: #E8E0F0;
  --charcoal: #2D3436;
  --amber: #FFC75F;
}

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

body {
  font-family: 'Quicksand', sans-serif;
  background: linear-gradient(135deg, var(--cream) 0%, var(--peach) 50%, var(--lavender) 100%);
  min-height: 100vh;
  color: var(--charcoal);
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* Glass Card Effect */
.glass-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 24px;
  box-shadow: 
    0 8px 32px rgba(132, 94, 194, 0.15),
    0 2px 8px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* Floating Particles */
.particles-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  bottom: -20px;
  background: linear-gradient(135deg, var(--coral), var(--violet));
  border-radius: 50%;
  opacity: 0.3;
  animation: float-up linear infinite;
}

@keyframes float-up {
  0% { transform: translateY(0) rotate(0deg); opacity: 0; }
  10% { opacity: 0.3; }
  90% { opacity: 0.3; }
  100% { transform: translateY(-100vh) rotate(360deg); opacity: 0; }
}

/* Confetti */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
}

.confetti-piece {
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  animation: confetti-fall 2s ease-out forwards;
}

@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg) scale(0); opacity: 0; }
}

/* Header */
.app-header {
  background: linear-gradient(135deg, var(--coral) 0%, var(--violet) 100%);
  padding: 2rem 1rem 3rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.app-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h60v60H0z' fill='none'/%3E%3Ccircle cx='30' cy='30' r='2' fill='white' fill-opacity='0.1'/%3E%3C/svg%3E");
  pointer-events: none;
}

.header-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
}

.header-icon {
  margin-bottom: 1rem;
}

.app-title {
  font-family: 'Quicksand', sans-serif;
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  color: white;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
  margin-bottom: 0.5rem;
  animation: title-glow 3s ease-in-out infinite;
}

@keyframes title-glow {
  0%, 100% { text-shadow: 0 2px 20px rgba(0, 0, 0, 0.2); }
  50% { text-shadow: 0 2px 40px rgba(255, 255, 255, 0.3); }
}

.app-subtitle {
  font-size: 1.25rem;
  color: rgba(255, 255, 255, 0.9);
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* Animated Pencil */
.animated-pencil {
  display: inline-block;
}

.pencil-group {
  animation: pencil-draw 2s ease-in-out infinite;
  transform-origin: 50px 50px;
}

@keyframes pencil-draw {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  25% { transform: translateX(5px) rotate(-5deg); }
  75% { transform: translateX(-5px) rotate(5deg); }
}

.drawing-line {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: draw-line 2s ease-in-out infinite;
}

@keyframes draw-line {
  0% { stroke-dashoffset: 100; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -100; }
}

/* Main Content */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1rem;
  position: relative;
  z-index: 1;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
}

@media (max-width: 1024px) {
  .content-grid {
    grid-template-columns: 1fr;
  }
  .side-column {
    order: -1;
  }
}

.main-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Upload Zone */
.upload-zone {
  padding: 3rem 2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px dashed var(--coral);
  animation: border-dance 10s linear infinite;
}

@keyframes border-dance {
  0% { border-color: var(--coral); }
  33% { border-color: var(--violet); }
  66% { border-color: var(--teal); }
  100% { border-color: var(--coral); }
}

.upload-zone:hover, .upload-zone.drag-over {
  transform: scale(1.01);
  border-style: solid;
  box-shadow: 0 12px 40px rgba(132, 94, 194, 0.25);
}

.upload-content {
  text-align: center;
}

.upload-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: bounce 2s ease-in-out infinite;
}

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

.upload-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--charcoal);
  margin-bottom: 0.5rem;
}

.upload-subtitle {
  color: #666;
  margin-bottom: 1.5rem;
}

.camera-btn {
  background: linear-gradient(135deg, var(--teal), #00A896);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.camera-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 20px rgba(0, 201, 167, 0.4);
}

/* Examples */
.examples-section {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.examples-label {
  font-weight: 600;
  color: #666;
  margin-bottom: 1rem;
}

.examples-carousel {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.example-card {
  background: linear-gradient(135deg, var(--cream), var(--peach));
  border: none;
  padding: 0.75rem;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  animation: fade-in 0.5s ease forwards;
  opacity: 0;
}

@keyframes fade-in {
  to { opacity: 1; }
}

.example-card:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.example-img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 0.5rem;
}

.example-name {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--charcoal);
}

/* Preview Zone */
.preview-zone {
  padding: 1.5rem;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.preview-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.change-btn {
  background: linear-gradient(135deg, var(--coral), #E85A5A);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

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

.preview-container {
  background: linear-gradient(135deg, var(--cream), var(--peach));
  padding: 1rem;
  border-radius: 16px;
}

.preview-image {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Controls Panel */
.controls-panel {
  padding: 2rem;
}

.controls-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--charcoal);
}

.control-group {
  margin-bottom: 1.5rem;
}

.control-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--charcoal);
}

.step-selector {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.step-option {
  width: 48px;
  height: 48px;
  border: 2px solid #ddd;
  border-radius: 12px;
  background: white;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
}

.step-option:hover {
  border-color: var(--violet);
}

.step-option.selected {
  background: linear-gradient(135deg, var(--coral), var(--violet));
  color: white;
  border-color: transparent;
  transform: scale(1.1);
}

.style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.style-card {
  background: white;
  border: 2px solid #eee;
  border-radius: 12px;
  padding: 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.style-card:hover {
  border-color: var(--violet);
  transform: translateY(-2px);
}

.style-card.selected {
  background: linear-gradient(135deg, rgba(132, 94, 194, 0.1), rgba(255, 107, 107, 0.1));
  border-color: var(--violet);
  box-shadow: 0 4px 12px rgba(132, 94, 194, 0.2);
}

.style-icon {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 0.25rem;
}

.style-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--charcoal);
}

.difficulty-selector {
  display: flex;
  gap: 0.5rem;
}

.difficulty-btn {
  flex: 1;
  padding: 0.75rem;
  border: 2px solid #eee;
  border-radius: 12px;
  background: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.difficulty-btn:hover {
  border-color: var(--violet);
}

.difficulty-btn.selected {
  background: linear-gradient(135deg, var(--coral), var(--violet));
  color: white;
  border-color: transparent;
}

.difficulty-btn.selected.from-emerald-400 {
  background: linear-gradient(135deg, #34D399, #14B8A6);
}

.difficulty-btn.selected.from-amber-400 {
  background: linear-gradient(135deg, #FBBF24, #F97316);
}

.difficulty-btn.selected.from-rose-400 {
  background: linear-gradient(135deg, #FB7185, #EF4444);
}

/* Generate Button */
.generate-btn {
  width: 100%;
  padding: 1.25rem 2rem;
  border: none;
  border-radius: 16px;
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--coral), var(--violet));
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.generate-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s ease;
}

.generate-btn:hover::before {
  left: 100%;
}

.generate-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 30px rgba(132, 94, 194, 0.4);
}

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

/* Loading Zone */
.loading-zone {
  padding: 3rem 2rem;
  text-align: center;
}

.loading-animation {
  margin-bottom: 1.5rem;
}

.loading-message {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--charcoal);
  margin-bottom: 1.5rem;
  min-height: 2rem;
}

.loading-bar {
  width: 100%;
  max-width: 300px;
  height: 12px;
  background: #eee;
  border-radius: 6px;
  margin: 0 auto 1.5rem;
  overflow: hidden;
}

.loading-progress {
  height: 100%;
  background: linear-gradient(90deg, var(--coral), var(--violet), var(--teal));
  background-size: 200% 100%;
  border-radius: 6px;
  animation: loading-slide 1.5s ease-in-out infinite;
}

@keyframes loading-slide {
  0% { width: 0%; background-position: 0% 0%; }
  50% { width: 70%; background-position: 100% 0%; }
  100% { width: 100%; background-position: 0% 0%; }
}

.loading-tip {
  background: linear-gradient(135deg, var(--cream), var(--peach));
  padding: 1rem;
  border-radius: 12px;
  font-size: 0.95rem;
}

.tip-label {
  font-weight: 700;
  color: var(--violet);
  margin-right: 0.5rem;
}

/* Results Zone */
.results-zone {
  padding: 2rem;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.results-header h3 {
  font-size: 1.5rem;
  font-weight: 700;
}

.results-actions {
  display: flex;
  gap: 0.75rem;
}

.action-btn {
  padding: 0.75rem 1.25rem;
  border: 2px solid var(--violet);
  border-radius: 50px;
  background: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.action-btn:hover {
  background: var(--lavender);
}

.action-btn.primary {
  background: linear-gradient(135deg, var(--teal), #00A896);
  color: white;
  border-color: transparent;
}

.action-btn.primary:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 20px rgba(0, 201, 167, 0.4);
}

.tutorial-display {
  background: linear-gradient(135deg, var(--cream), white);
  padding: 1rem;
  border-radius: 16px;
  margin-bottom: 1rem;
}

.tutorial-image {
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.tutorial-info {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.info-badge {
  background: linear-gradient(135deg, var(--lavender), var(--peach));
  padding: 0.5rem 1rem;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
}

.tutorial-instruction {
  color: #666;
  text-align: center;
  font-size: 0.95rem;
}

.completion-message {
  margin-top: 1.5rem;
  padding: 1rem;
  background: linear-gradient(135deg, #34D399, #10B981);
  border-radius: 12px;
  color: white;
  text-align: center;
  font-weight: 700;
  font-size: 1.25rem;
  animation: celebration 0.5s ease;
}

@keyframes celebration {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.completion-icon {
  font-size: 1.5rem;
  margin-right: 0.5rem;
}

/* Side Panel */
.side-column {
  position: relative;
}

.panel-toggle {
  position: absolute;
  left: -20px;
  top: 1rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--violet);
  color: var(--violet);
  font-weight: bold;
  cursor: pointer;
  z-index: 10;
  transition: all 0.3s ease;
  display: none;
}

@media (max-width: 1024px) {
  .panel-toggle {
    display: block;
  }
}

.side-panel {
  padding: 1.5rem;
  position: sticky;
  top: 1rem;
}

.panel-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.tab-btn {
  flex: 1;
  padding: 0.75rem 0.5rem;
  border: none;
  border-radius: 12px;
  background: transparent;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #666;
}

.tab-btn:hover {
  background: var(--lavender);
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--coral), var(--violet));
  color: white;
}

.tab-content {
  animation: fade-in 0.3s ease;
}

.tips-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tip-card {
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.1), rgba(132, 94, 194, 0.1));
  padding: 1rem;
  border-radius: 12px;
}

.tip-card h4 {
  font-weight: 700;
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
}

.tip-card p {
  font-size: 0.85rem;
  color: #666;
}

.recent-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.recent-card {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  background: linear-gradient(135deg, var(--cream), var(--peach));
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.recent-card:hover {
  transform: translateX(5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.recent-thumb {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
}

.recent-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.recent-steps {
  font-weight: 700;
  font-size: 0.9rem;
}

.recent-date {
  font-size: 0.75rem;
  color: #888;
}

.empty-state {
  text-align: center;
  color: #888;
  padding: 2rem;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}

.modal-content {
  max-width: 600px;
  width: 100%;
  padding: 2rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
}

.close-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--coral);
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
}

.camera-preview {
  background: black;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.camera-video {
  width: 100%;
  display: block;
}

.modal-actions {
  display: flex;
  gap: 1rem;
}

.primary-btn {
  flex: 1;
  padding: 1rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--coral), var(--violet));
  color: white;
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
}

.primary-btn:hover {
  transform: scale(1.02);
}

.secondary-btn {
  padding: 1rem 1.5rem;
  border: 2px solid #ddd;
  border-radius: 12px;
  background: white;
  font-weight: 600;
  cursor: pointer;
}

/* Footer */
.app-footer {
  background: linear-gradient(135deg, var(--coral), var(--violet));
  padding: 2rem 1rem;
  margin-top: 2rem;
  position: relative;
}

.app-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--amber), var(--teal), var(--coral));
}

.footer-content {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
  color: white;
}

.footer-link {
  color: white;
  font-weight: 700;
  text-decoration: underline;
}

.footer-link:hover {
  color: var(--amber);
}

.footer-powered {
  font-size: 0.9rem;
  opacity: 0.9;
  margin: 0.5rem 0;
}

.remix-link {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.5rem 1.5rem;
  background: white;
  color: var(--violet);
  border-radius: 50px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.3s ease;
}

.remix-link:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* Responsive */
@media (max-width: 768px) {
  .app-header {
    padding: 1.5rem 1rem 2rem;
  }
  
  .app-title {
    font-size: 1.75rem;
  }
  
  .app-subtitle {
    font-size: 1rem;
  }
  
  .upload-zone {
    padding: 2rem 1rem;
  }
  
  .upload-title {
    font-size: 1.25rem;
  }
  
  .examples-carousel {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.5rem;
  }
  
  .example-card {
    flex-shrink: 0;
  }
  
  .style-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .difficulty-selector {
    flex-direction: column;
  }
  
  .generate-btn {
    font-size: 1.25rem;
    padding: 1rem;
  }
  
  .results-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .results-actions {
    width: 100%;
    justify-content: space-between;
  }
}