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

:root {
  --green: #1D9E75;
  --green-dark: #158a63;
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2a2d3a;
  --text: #f0f0f0;
  --text-muted: #8b8fa8;
  --gold: #f5c842;
  --danger: #e05252;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.screen { display: none; width: 100%; max-width: 600px; padding: 1.5rem; }
.screen.active { display: block; }

/* Error / loading */
.center-box {
  text-align: center;
  padding: 3rem 1.5rem;
}
.center-box h2 { font-size: 1.5rem; margin-bottom: 0.75rem; }
.center-box p { color: var(--text-muted); }

/* Welcome */
.welcome-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  text-align: center;
}
.welcome-card .store-name { font-size: 1.75rem; font-weight: 700; color: var(--green); margin-bottom: 0.5rem; }
.welcome-card p { color: var(--text-muted); margin-bottom: 2rem; }

.btn-spin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 1rem 2.5rem;
  font-size: 1.125rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-spin:hover { background: var(--green-dark); }
.btn-spin:active { transform: scale(0.97); }

/* Explain card */
.explain-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  text-align: center;
}
.explain-card .explain-text {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 2.5rem;
}
.explain-card .btn-spin {
  display: block;
  margin: 0 auto;
  width: fit-content;
}

/* Prize bar */
.prize-bar {
  display: flex;
  gap: 0.375rem;
  margin-bottom: 2rem;
}
.prize-step {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.25rem;
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: all 0.3s;
}
.prize-step .level-num { font-weight: 700; font-size: 0.65rem; color: var(--text-muted); display: block; }
.prize-step .level-label { display: block; margin-top: 0.125rem; font-size: 0.75rem; font-weight: 600; line-height: 1.2; }
.prize-step.reached { background: #1a3329; border-color: var(--green); color: var(--green); }
.prize-step.reached .level-num { color: var(--green); }
.prize-step.current { background: var(--green); border-color: var(--green); color: #fff; }
.prize-step.current .level-num { color: #fff; }

/* Lives */
.lives {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.25rem;
  font-size: 1.25rem;
}
.life { transition: opacity 0.3s; }
.life.lost { opacity: 0.2; filter: grayscale(1); }

/* Reels */
.reels-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.reels {
  display: flex;
  gap: 0.5rem;
}
.reel {
  flex: 1;
  height: 72px;
  overflow: hidden;
  position: relative;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.reel-inner {
  display: flex;
  flex-direction: column;
  transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}
.reel-item {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 0.25rem;
  text-align: center;
  line-height: 1.2;
  overflow: hidden;
  word-break: break-word;
}
.reel-item.active { color: var(--green); }
.reel::before, .reel::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 20px;
  z-index: 2;
  pointer-events: none;
}
.reel::before { top: 0; background: linear-gradient(to bottom, var(--bg), transparent); }
.reel::after { bottom: 0; background: linear-gradient(to top, var(--bg), transparent); }

.category-badge {
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--green);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 0.5rem;
  min-height: 1.2em;
}

/* Question */
.question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  user-select: none;
  -webkit-user-select: none;
}
.timer-wrap { margin-bottom: 1rem; }
.timer-bar-bg {
  background: var(--border);
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
}
.timer-bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: 99px;
  transition: width 1s linear, background 0.5s;
}
.timer-bar-fill.warning { background: var(--gold); }
.timer-bar-fill.danger { background: var(--danger); }
.timer-text {
  text-align: right;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.question-text {
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.options { display: grid; gap: 0.5rem; }
.option-btn {
  width: 100%;
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  line-height: 1.4;
}
@media (hover: hover) {
  .option-btn:hover:not(:disabled) { border-color: var(--green); background: #1a3329; }
}
.option-btn.correct { border-color: var(--green); background: #1a3329; color: var(--green); }
.option-btn.wrong { border-color: var(--danger); background: #2d1515; color: var(--danger); }
.option-btn:disabled { cursor: default; }

.feedback-correct, .feedback-wrong {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.75rem;
}
.feedback-correct { background: #1a3329; color: var(--green); }
.feedback-wrong { background: #2d1515; color: var(--danger); }

.explanation {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--bg);
  border-radius: 8px;
  font-size: 0.8375rem;
  color: var(--text-muted);
  border-left: 3px solid var(--green);
  display: none;
}

/* Level complete overlay */
.level-complete {
  background: var(--surface);
  border: 1px solid var(--green);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  margin-bottom: 1rem;
}
.level-complete h2 { font-size: 1.5rem; color: var(--green); margin-bottom: 0.5rem; }
.level-complete .prize-name { font-size: 1.125rem; font-weight: 600; margin-bottom: 0.25rem; }
.level-complete .prize-code { font-family: monospace; font-size: 1.375rem; color: var(--gold); letter-spacing: 0.1em; margin-bottom: 1.5rem; }
.level-complete p { color: var(--text-muted); margin-bottom: 1.5rem; font-size: 0.9rem; }
#lc-next-msg { font-size: 1.2rem; font-weight: 600; color: var(--text); }
.level-complete-btns { display: flex; flex-direction: column; align-items: center; gap: 1rem; }

.btn-continue {
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 1rem 2.5rem;
  font-size: 1.125rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  animation: pulse-green 2s ease infinite;
}
.btn-continue:hover { background: var(--green-dark); animation: none; }

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(29,158,117,0.5); }
  60% { box-shadow: 0 0 0 10px rgba(29,158,117,0); }
}

.btn-cashout {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 0.25rem;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-cashout:hover { color: var(--text); }

/* Result */
.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  text-align: center;
}
.result-card.winner { border-color: var(--gold); }
.result-card h2 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.result-card .result-prize { font-size: 1.1rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.result-card .discount-label { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 0.375rem; }
.result-card .discount-code {
  display: inline-block;
  font-family: monospace;
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.12em;
  background: #1a1500;
  border: 1px solid var(--gold);
  border-radius: 10px;
  padding: 0.5rem 1.5rem;
  margin-bottom: 1.5rem;
}
.result-card .result-msg { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 2rem; }
.powered {
  margin-top: 2rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.powered a { color: var(--green); }

.game-footer {
  width: 100%;
  text-align: center;
  padding: 0.75rem 1rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.game-footer a { color: var(--green); text-decoration: none; }
.game-footer a:hover { text-decoration: underline; }

@keyframes spin-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.spin-in { animation: spin-in 0.3s ease forwards; }
