:root {
  --primary: #ef4444;
  --primary-hover: #dc2626;
  --secondary: #eab308;
  --bg-dark: rgba(15, 15, 20, 0.85);
  --text-light: #f8fafc;
  --font-display: 'Orbitron', sans-serif;
  --font-body: 'Montserrat', sans-serif;
}

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

body {
  font-family: var(--font-body);
  color: var(--text-light);
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

/* Background setup */
.background-container {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  z-index: -1;
  background-color: #000;
}

.bg {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background-size: cover;
  background-position: center;
  transition: opacity 0.2s ease-out, transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.5s;
}

.bg.cockpit {
  background-image: url('https://offertabs.s3.amazonaws.com/offer/u9nws3/site/media/6aa26702cce734.80509535.jpg');
  opacity: 1;
}

.bg.speed {
  background-image: url('https://offertabs.s3.amazonaws.com/offer/u9nws3/site/media/6aa26702abfe43.13486718.jpg');
  opacity: 0;
}

/* Launch effect classes */
.bg.cockpit.launch {
  transform: scale(1.15);
  filter: blur(8px);
}
.bg.speed.launch {
  opacity: 0.8;
  transform: scale(1.05);
}

/* App container */
.app-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
  z-index: 1;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 20px;
  margin-top: 20px;
}
.site-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 900;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 4px 10px rgba(0,0,0,0.6);
  background: linear-gradient(135deg, #fff, #94a3b8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Screens */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  animation: fadeIn 0.4s ease;
}

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

/* Cards */
.card {
  background: var(--bg-dark);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 600px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
}

.card h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  margin-bottom: 15px;
  color: var(--secondary);
  text-align: center;
}

.card p {
  font-size: 1.05rem;
  line-height: 1.6;
  margin-bottom: 20px;
  color: #e2e8f0;
}

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

.instructions {
  margin-bottom: 30px;
  padding-left: 20px;
  color: #cbd5e1;
}
.instructions li {
  margin-bottom: 12px;
  font-size: 1rem;
}

/* Buttons */
.btn {
  display: inline-block;
  width: 100%;
  padding: 16px 24px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
}
.btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-secondary {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
}
.btn-secondary:hover {
  background: rgba(255,255,255,0.2);
}

.btn-yellow {
  background: linear-gradient(135deg, var(--secondary), #f59e0b);
  color: #000;
  box-shadow: 0 4px 15px rgba(234, 179, 8, 0.4);
}
.btn-yellow:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(234, 179, 8, 0.6);
}
.btn-yellow:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.mt-1 { margin-top: 15px; }
.mt-2 { margin-top: 30px; }

/* Game Elements */
.game-hud {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  margin-top: 20px;
  pointer-events: none; /* Crucial: allows clicks to pass through to tap-area */
  z-index: 10;
}

.lights-housing {
  display: flex;
  gap: 15px;
  background: linear-gradient(to bottom, #222, #000);
  padding: 15px 25px;
  border-radius: 12px;
  border: 4px solid #333;
  box-shadow: 0 10px 30px rgba(0,0,0,0.8), inset 0 2px 5px rgba(255,255,255,0.1);
}

.light-group {
  width: 50px;
  height: 50px;
  background: #111;
  border-radius: 50%;
  padding: 6px;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.8);
  border: 2px solid #222;
}

.light {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: #333;
  transition: background-color 0.05s, box-shadow 0.05s;
}

.light.on {
  background-color: #ef4444;
  box-shadow: 0 0 20px #ef4444, inset 0 0 10px rgba(255,255,255,0.8);
}

.game-message {
  margin-top: 50px;
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 900;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 0 20px rgba(0,0,0,0.9);
  letter-spacing: 4px;
}

.game-message.false-start {
  color: var(--primary);
  text-shadow: 0 0 30px rgba(239, 68, 68, 1);
}

.game-message.time {
  color: var(--secondary);
  text-shadow: 0 0 30px rgba(234, 179, 8, 1);
}

/* Tap Area */
.tap-area {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  z-index: 5;
  cursor: pointer;
}

/* Results grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-bottom: 25px;
}
.stat-box {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 15px 10px;
  border-radius: 8px;
  text-align: center;
}
.stat-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 8px;
  letter-spacing: 1px;
}
.stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
}
.stat-value.highlight {
  color: var(--secondary);
}

.final-stats {
  display: flex;
  justify-content: space-around;
  margin-bottom: 25px;
  padding: 20px 0;
  border-top: 1px solid rgba(255,255,255,0.1);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.main-stat { text-align: center; }
.main-stat .stat-value { font-size: 2rem; }

.ranking-box {
  text-align: center;
  margin-bottom: 30px;
}
.ranking-box h3 {
  font-size: 1.4rem;
  color: #fff;
}
#res-rating { color: var(--secondary); font-family: var(--font-display); margin-left: 5px; }

/* Forms */
.submit-section {
  background: rgba(0,0,0,0.3);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.05);
}
.submit-section h3 { margin-bottom: 5px; color: #fff; font-family: var(--font-display); }
.submit-desc { font-size: 0.9rem !important; color: #94a3b8 !important; margin-bottom: 15px !important; }

.form-group { margin-bottom: 15px; }
.form-group input {
  width: 100%;
  padding: 14px 16px;
  font-size: 1rem;
  font-family: var(--font-body);
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  color: #fff;
  transition: all 0.2s;
}
.form-group input:focus {
  outline: none;
  border-color: var(--secondary);
  background: rgba(255,255,255,0.15);
  box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.2);
}
.form-group input::placeholder { color: #cbd5e1; }
#form-error-msg { color: var(--primary); font-weight: 600; margin-bottom: 15px; text-align: center; }

/* Coupon Panel */
.coupon-panel {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.4);
  padding: 25px 20px;
  border-radius: 12px;
  margin-top: 25px;
}
.coupon-panel h3 { font-size: 1.2rem; margin-bottom: 10px; color: #86efac; font-family: var(--font-display); }
.coupon-panel p { font-size: 0.95rem; margin-bottom: 15px; color: #e2e8f0; }
.coupon-code-box {
  background: rgba(0,0,0,0.4);
  border: 2px dashed rgba(134, 239, 172, 0.5);
  padding: 15px;
  border-radius: 8px;
  font-size: 1.5rem;
  font-family: var(--font-display);
  color: #fff;
  letter-spacing: 2px;
}

.tc-link {
  color: #86efac;
  text-decoration: underline;
}
.tc-link:hover {
  text-decoration: none;
}

/* Share panel */
.share-panel {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.4);
  padding: 25px 20px;
  border-radius: 12px;
  margin-top: 25px;
}
.share-panel h3 { font-size: 1.2rem; margin-bottom: 10px; color: #93c5fd; font-family: var(--font-display); }
.share-panel p { font-size: 0.95rem; margin-bottom: 15px; color: #e2e8f0; }
.share-controls { display: flex; gap: 10px; }
.share-controls input {
  flex: 1;
  padding: 12px 15px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  border-radius: 6px;
  font-family: monospace;
}
.share-controls button {
  width: auto;
  padding: 10px 20px;
  font-size: 0.95rem;
}

/* Wbx Power By Slot */
#wbx-powered-by-slot { margin-top: auto; padding-top: 30px; }

/* Responsive */
@media (max-width: 600px) {
  .site-title { font-size: 1.6rem; }
  .card { padding: 30px 20px; }
  .lights-housing { padding: 12px 15px; gap: 8px; border-width: 2px; }
  .light-group { width: 40px; height: 40px; padding: 4px; }
  .game-message { font-size: 2.2rem; }
  .stats-grid { gap: 8px; }
  .stat-value { font-size: 1.1rem; }
  .main-stat .stat-value { font-size: 1.6rem; }
  .ranking-box h3 { font-size: 1.2rem; }
  .share-controls { flex-direction: column; }
  .share-controls button { width: 100%; }
}