/* ==========================================================================
   Scratch Card Game Styles
   ========================================================================== */

:root {
  --primary-color: #6366f1;
  --secondary-color: #ec4899;
  --background-color: #0f172a;
  --surface-color: #1e293b;
  --text-color: #f8fafc;
  --text-muted: #94a3b8;
  --success-color: #22c55e;
  --gold-color: #fbbf24;
  --scratch-overlay: linear-gradient(135deg, #c0c0c0 0%, #a0a0a0 50%, #c0c0c0 100%);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--background-color);
  color: var(--text-color);
}

#game-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* ==========================================================================
   Screens
   ========================================================================== */

.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.screen.active {
  display: flex;
  opacity: 1;
}

/* ==========================================================================
   Title Screen
   ========================================================================== */

.title-content {
  text-align: center;
  max-width: 400px;
}

.title-content h1 {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.title-content p {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.prize-preview {
  background: var(--surface-color);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 2rem;
}

.prize-preview span {
  font-size: 0.9rem;
  color: var(--text-muted);
}

#prize-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 0.5rem;
}

.prize-tag {
  background: linear-gradient(135deg, var(--gold-color), #f59e0b);
  color: #000;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* ==========================================================================
   Game Screen
   ========================================================================== */

#game-screen {
  justify-content: space-between;
  padding: 20px;
}

.game-header {
  width: 100%;
  max-width: 400px;
}

.scratch-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--surface-color);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  border-radius: 4px;
  transition: width 0.2s ease;
}

.scratch-area-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.scratch-card {
  position: relative;
  width: 320px;
  height: 200px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  cursor: crosshair;
  touch-action: none;
}

.prize-layer,
.scratch-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 16px;
}

.scratch-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.2rem;
  color: #666;
  pointer-events: none;
  animation: pulse 2s infinite;
  z-index: 10;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.7; transform: translate(-50%, -50%) scale(1.05); }
}

.scratch-hint.hidden {
  display: none;
}

.game-footer {
  width: 100%;
  max-width: 400px;
  text-align: center;
}

#hint-text {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ==========================================================================
   Result Screen
   ========================================================================== */

.result-content {
  text-align: center;
  max-width: 400px;
}

.result-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: bounce 0.6s ease;
}

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

.result-content h2 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  color: var(--gold-color);
}

.prize-display {
  background: var(--surface-color);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.prize-image-container {
  width: 80px;
  height: 80px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, var(--gold-color), #f59e0b);
  display: flex;
  align-items: center;
  justify-content: center;
}

.prize-image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.prize-text {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--gold-color), #f59e0b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.prize-description {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.prize-code {
  background: var(--surface-color);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.prize-code span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.discount-code {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: monospace;
  letter-spacing: 2px;
  margin: 0.5rem 0;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border: none;
  padding: 14px 32px;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 30px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  width: 100%;
  max-width: 280px;
  margin-bottom: 0.75rem;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 2px solid var(--surface-color);
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 500;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.5rem;
}

.btn-text:hover {
  color: var(--text-color);
}

/* ==========================================================================
   Modal
   ========================================================================== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--surface-color);
  border-radius: 20px;
  padding: 2rem;
  max-width: 360px;
  width: 100%;
  text-align: center;
}

.modal-content h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.modal-content p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

#email-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#email-input {
  padding: 14px 16px;
  border: 2px solid var(--surface-color);
  border-radius: 12px;
  background: var(--background-color);
  color: var(--text-color);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

#email-input:focus {
  border-color: var(--primary-color);
}

/* ==========================================================================
   Overlay
   ========================================================================== */

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.overlay.hidden {
  display: none;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--surface-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

/* ==========================================================================
   Particles (for win effects)
   ========================================================================== */

.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  pointer-events: none;
  z-index: 50;
  animation: confetti-fall 3s ease-out forwards;
}

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

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 400px) {
  .scratch-card {
    width: 280px;
    height: 175px;
  }
  
  .title-content h1 {
    font-size: 2rem;
  }
  
  .prize-text {
    font-size: 1.5rem;
  }
}

@media (min-width: 600px) {
  .scratch-card {
    width: 400px;
    height: 250px;
  }
}
