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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #fff0f5;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: '🐶 🐱 🦊 🐰 🐻 🐼 🦁 🐹 🦉 🐺 🐶 🐱 🦊 🐰 🐻 🐼 🦁 🐹 🦉 🐺 🐶 🐱 🦊 🐰 🐻 🐼 🦁 🐹 🦉 🐺 🐶 🐱 🦊 🐰 🐻 🐼 🦁 🐹 🦉 🐺 🐶 🐱 🦊 🐰 🐻 🐼 🦁 🐹 🦉 🐺 🐶 🐱 🦊 🐰 🐻 🐼 🦁 🐹 🦉 🐺';
  position: fixed;
  top: 0;
  left: 0;
  width: 200%;
  height: 200%;
  font-size: 40px;
  line-height: 80px;
  letter-spacing: 30px;
  word-spacing: 20px;
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
  transform: rotate(-15deg) translateX(-10%) translateY(-10%);
}

.container {
  text-align: center;
  max-width: 500px;
  width: 100%;
  position: relative;
  z-index: 1;
}

h1 {
  color: #e75480;
  font-size: 2rem;
  margin-bottom: 10px;
}

.subtitle {
  color: #888;
  margin-bottom: 30px;
  font-size: 1.1rem;
}

.camera-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  background: #000;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

#video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

#overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: scaleX(-1);
}

.loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: white;
}

.loading.hidden {
  display: none;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

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

.capture-btn {
  margin-top: 25px;
  padding: 18px 50px;
  font-size: 1.2rem;
  font-weight: bold;
  color: white;
  background: linear-gradient(135deg, #ff9a9e, #e75480);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 10px 30px rgba(231, 84, 128, 0.3);
}

.capture-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 15px 40px rgba(0,0,0,0.3);
}

.capture-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.result {
  margin-top: 30px;
}

.result.hidden {
  display: none;
}

.result-card {
  background: white;
  border-radius: 25px;
  padding: 40px 30px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: slideUp 0.5s ease;
}

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

.animal-emoji {
  font-size: 80px;
  margin-bottom: 15px;
  animation: bounce 0.6s ease;
}

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

.result-card h2 {
  color: #333;
  font-size: 1.8rem;
  margin-bottom: 10px;
}

.result-card p {
  color: #666;
  line-height: 1.6;
}

.match-bar {
  width: 100%;
  height: 12px;
  background: #eee;
  border-radius: 10px;
  margin: 20px 0 10px;
  overflow: hidden;
}

.match-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff9a9e, #e75480);
  border-radius: 10px;
  transition: width 1s ease;
  width: 0%;
}

.match-text {
  font-weight: bold;
  color: #e75480 !important;
  font-size: 1.1rem;
}

.retry-btn {
  margin-top: 20px;
  padding: 15px 40px;
  font-size: 1rem;
  font-weight: bold;
  color: white;
  background: linear-gradient(135deg, #ff9a9e, #e75480);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.retry-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(231, 84, 128, 0.4);
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.5rem;
  }

  .subtitle {
    font-size: 0.95rem;
  }

  .capture-btn {
    padding: 15px 40px;
    font-size: 1rem;
  }

  .animal-emoji {
    font-size: 60px;
  }
}
