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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #000;
  color: #fff;
  overflow-x: hidden;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

/* Barcode Background */
.barcode-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.barcode-line {
  position: absolute;
  top: 0;
  height: 100%;
  background: rgba(255, 255, 255, 0.15);
  animation: barcodeScroll linear infinite;
}

@keyframes barcodeScroll {
  0% {
    transform: translateY(-100%);
  }
  100% {
    transform: translateY(100vh);
  }
}

/* App Container */
.app-container {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.content-wrapper {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  width: 100%;
}

/* Header */
.app-header {
  text-align: center;
  margin-bottom: 3rem;
  animation: fadeIn 0.8s ease-out;
}

.app-title {
  font-size: 3.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, #fff, #FF6B9D);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1rem;
  text-shadow: 0 0 30px rgba(255, 107, 157, 0.3);
}

.app-subtitle {
  font-size: 1.5rem;
  color: #fff;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.app-instructions {
  font-size: 1.125rem;
  color: #aaa;
  font-weight: 400;
}

/* Camera Section */
.camera-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  animation: fadeIn 0.6s ease-out;
}

.camera-container {
  width: 100%;
  max-width: 640px;
  aspect-ratio: 4/3;
  border-radius: 1rem;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.camera-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-error {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.capture-button {
  background: linear-gradient(135deg, #FF6B9D, #FF3D71);
  color: white;
  border: none;
  padding: 1.25rem 3rem;
  font-size: 1.5rem;
  font-weight: 700;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(255, 107, 157, 0.4);
  animation: pulse 2s infinite;
}

.capture-button:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 30px rgba(255, 107, 157, 0.6);
}

.upload-button {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.2);
  padding: 1rem 2rem;
  font-size: 1.125rem;
  font-weight: 600;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-block;
}

.upload-button:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: #FF6B9D;
}

.privacy-notice {
  text-align: center;
  color: #888;
  font-size: 0.875rem;
  margin-top: 1rem;
}

/* Processing Section */
.processing-section {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
  animation: fadeIn 0.6s ease-out;
}

.processing-container {
  text-align: center;
  max-width: 500px;
}

.processing-preview {
  width: 200px;
  height: 200px;
  border-radius: 1rem;
  object-fit: cover;
  margin-bottom: 2rem;
  opacity: 0.6;
  filter: blur(2px);
}

.pixel-loader {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  width: 120px;
  margin: 0 auto 2rem;
}

.pixel-block {
  width: 30px;
  height: 30px;
  background: #FF6B9D;
  animation: pixelPulse 1.5s infinite;
}

.pixel-block:nth-child(1) { animation-delay: 0s; }
.pixel-block:nth-child(2) { animation-delay: 0.1s; }
.pixel-block:nth-child(3) { animation-delay: 0.2s; }
.pixel-block:nth-child(4) { animation-delay: 0.3s; }
.pixel-block:nth-child(5) { animation-delay: 0.4s; }
.pixel-block:nth-child(6) { animation-delay: 0.5s; }
.pixel-block:nth-child(7) { animation-delay: 0.6s; }
.pixel-block:nth-child(8) { animation-delay: 0.7s; }
.pixel-block:nth-child(9) { animation-delay: 0.8s; }

@keyframes pixelPulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1); }
}

.loading-message {
  font-size: 1.5rem;
  color: #fff;
  font-weight: 600;
  animation: fadeInOut 2s infinite;
}

@keyframes fadeInOut {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* Result Section */
.result-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  animation: fadeIn 0.6s ease-out;
}

.result-container {
  position: relative;
  width: 100%;
  max-width: 600px;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.portrait-frame {
  position: relative;
  width: 90%;
  max-width: 500px;
  aspect-ratio: 1;
  border-radius: 1rem;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.9);
  border: 3px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
  animation: scaleIn 0.6s ease-out;
}

.portrait-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

.frame-badge {
  position: absolute;
  bottom: 1.5rem;
  left: 1.5rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
}

.frame-berrry {
  background: linear-gradient(135deg, #FF6B9D, #FF3D71);
  color: #fff;
}

.result-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.action-button {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.2);
  padding: 1rem 2rem;
  font-size: 1.125rem;
  font-weight: 600;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.action-button:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.2);
}

.action-button.primary {
  background: linear-gradient(135deg, #FF6B9D, #FF3D71);
  border-color: transparent;
}

.action-button.primary:hover {
  box-shadow: 0 4px 20px rgba(255, 107, 157, 0.5);
}

/* Error Section */
.error-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  animation: fadeIn 0.6s ease-out;
}

/* Gallery */
.gallery-section {
  margin-top: 3rem;
  animation: fadeIn 0.8s ease-out;
}

.gallery-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: #fff;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  max-width: 800px;
  margin: 0 auto;
}

.gallery-thumbnail {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid rgba(255, 255, 255, 0.1);
  image-rendering: pixelated;
}

.gallery-thumbnail:hover {
  transform: scale(1.05);
  border-color: #FF6B9D;
  box-shadow: 0 4px 20px rgba(255, 107, 157, 0.4);
}

/* Settings */
.settings-toggle {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 100;
}

.settings-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: rotate(90deg);
}

.settings-panel {
  position: fixed;
  bottom: 6rem;
  right: 2rem;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(20px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 1rem;
  padding: 1.5rem;
  min-width: 320px;
  max-width: 400px;
  z-index: 100;
  animation: slideUp 0.3s ease-out;
}

.settings-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: #fff;
}

.settings-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  color: #ccc;
  font-size: 0.95rem;
}

.settings-label-block {
  display: block;
  margin-bottom: 1.5rem;
  color: #ccc;
  font-size: 0.95rem;
}

.settings-textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  resize: vertical;
  min-height: 80px;
}

.settings-textarea::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.settings-textarea:focus {
  outline: none;
  border-color: #FF6B9D;
}

.reset-settings-button {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 0.5rem;
}

.reset-settings-button:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: #FF6B9D;
}

/* Footer */
.app-footer {
  margin-top: 4rem;
  padding: 2rem;
  text-align: center;
  color: #888;
  font-size: 0.95rem;
}

.footer-link {
  color: #FF6B9D;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease;
}

.footer-link:hover {
  color: #fff;
}

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

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -10px;
  animation: confettiFall 3s linear forwards;
}

@keyframes confettiFall {
  to {
    transform: translateY(100vh) rotate(720deg);
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* Responsive */
@media (max-width: 768px) {
  .app-title {
    font-size: 2.5rem;
  }
  
  .app-subtitle {
    font-size: 1.25rem;
  }
  
  .camera-container {
    max-width: 100%;
  }
  
  .capture-button {
    padding: 1rem 2rem;
    font-size: 1.25rem;
  }
  
  .result-actions {
    flex-direction: column;
    width: 100%;
  }
  
  .action-button {
    width: 100%;
  }
  
  .settings-panel {
    right: 1rem;
    left: 1rem;
    width: auto;
    min-width: auto;
    max-width: none;
  }
  
  .settings-toggle {
    right: 1rem;
  }
}

@media (max-width: 480px) {
  .content-wrapper {
    padding: 1rem;
  }
  
  .app-title {
    font-size: 2rem;
  }
  
  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.5rem;
  }
}