/* ── Reset & base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red:      #e53935;
  --red-glow: #ff1744;
  --green:    #43a047;
  --green-glow:#00e676;
  --bg:       #0a0a0a;
  --surface:  #141414;
  --border:   #2a2a2a;
  --text:     #f0f0f0;
  --muted:    #888;
  --gold:     #ffd700;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
}

.hidden { display: none !important; }

/* ── Screens ───────────────────────────────────────────────────────── */
.screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Game screen ───────────────────────────────────────────────────── */
.game-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  padding: 40px 20px;
}

.buttons-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(32px, 8vw, 80px);
  flex-wrap: wrap;
}

.btn-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.timer {
  font-size: clamp(2rem, 8vw, 4rem);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 2px;
  min-width: 200px;
  text-align: center;
}

.red-button {
  width: clamp(160px, 40vw, 240px);
  height: clamp(160px, 40vw, 240px);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff5252, var(--red) 60%, #b71c1c);
  border: none;
  cursor: pointer;
  box-shadow:
    0 0 40px rgba(229,57,53,0.5),
    0 0 80px rgba(229,57,53,0.2),
    inset 0 -8px 20px rgba(0,0,0,0.4);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  position: relative;
}

.red-button::after {
  content: '';
  position: absolute;
  top: 18%;
  left: 22%;
  width: 28%;
  height: 18%;
  background: rgba(255,255,255,0.25);
  border-radius: 50%;
  transform: rotate(-30deg);
}

.red-button:hover {
  box-shadow:
    0 0 60px rgba(255,23,68,0.7),
    0 0 120px rgba(255,23,68,0.3),
    inset 0 -8px 20px rgba(0,0,0,0.4);
  transform: scale(1.03);
}

.red-button:active {
  transform: scale(0.97);
  box-shadow:
    0 0 20px rgba(229,57,53,0.4),
    inset 0 4px 20px rgba(0,0,0,0.5);
}

.warning {
  font-size: clamp(0.8rem, 2.5vw, 0.95rem);
  color: var(--muted);
  letter-spacing: 0.5px;
  text-align: center;
  max-width: 220px;
}

.permission {
  font-size: clamp(0.8rem, 2.5vw, 0.95rem);
  color: #66bb6a;
  letter-spacing: 0.5px;
  text-align: center;
  max-width: 220px;
}

.green-counter {
  font-size: 1.4rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--green-glow);
  text-align: center;
}

.green-counter span {
  font-size: 2rem;
}

/* ── Green button ──────────────────────────────────────────────────── */
.green-button {
  width: clamp(120px, 28vw, 180px);
  height: clamp(120px, 28vw, 180px);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #69f0ae, var(--green) 60%, #1b5e20);
  border: none;
  cursor: pointer;
  box-shadow:
    0 0 30px rgba(67,160,71,0.4),
    0 0 60px rgba(67,160,71,0.15),
    inset 0 -6px 16px rgba(0,0,0,0.4);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
  position: relative;
  touch-action: manipulation; /* prevents double-tap zoom on mobile */
  -webkit-tap-highlight-color: transparent;
}

.green-button::after {
  content: '';
  position: absolute;
  top: 18%;
  left: 22%;
  width: 28%;
  height: 18%;
  background: rgba(255,255,255,0.25);
  border-radius: 50%;
  transform: rotate(-30deg);
}

.green-button:hover {
  box-shadow:
    0 0 50px rgba(0,230,118,0.6),
    0 0 100px rgba(0,230,118,0.2),
    inset 0 -6px 16px rgba(0,0,0,0.4);
  transform: scale(1.04);
}

.green-button:active {
  transform: scale(0.94);
  box-shadow:
    0 0 15px rgba(67,160,71,0.3),
    inset 0 4px 16px rgba(0,0,0,0.5);
}

/* ── Game Over screen ──────────────────────────────────────────────── */
.gameover-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 48px 24px;
  max-width: 480px;
  width: 100%;
  text-align: center;
}

.gameover-title {
  font-size: clamp(2.5rem, 10vw, 4.5rem);
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--red);
  text-shadow: 0 0 40px rgba(229,57,53,0.6);
}

.gameover-reason {
  font-size: 1.1rem;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.gameover-score {
  font-size: 1.3rem;
  color: var(--text);
}

.highlight {
  color: var(--gold);
  font-weight: 700;
  font-size: 1.6rem;
}

.gameover-green {
  font-size: 1.1rem;
  color: var(--muted);
  margin-top: -8px;
}

.highlight-green {
  color: var(--green-glow);
  font-weight: 700;
  font-size: 1.3rem;
}

/* ── Submit form ───────────────────────────────────────────────────── */
.submit-label {
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 6px;
}

.submit-row {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 360px;
}

.name-input {
  flex: 1;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.name-input:focus { border-color: var(--red); }

.btn-submit {
  padding: 12px 24px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  white-space: nowrap;
}

.btn-submit:hover { background: var(--red-glow); }
.btn-submit:disabled { opacity: 0.5; cursor: default; }

.submit-error {
  color: #ef9a9a;
  font-size: 0.85rem;
}

.already-text {
  color: #81c784;
  font-size: 1rem;
}

.btn-play-again {
  margin-top: 8px;
  padding: 10px 24px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

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

/* ── Plays remaining (game screen) ────────────────────────────────── */
.plays-remaining {
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: -20px;
}

/* ── Share button ──────────────────────────────────────────────────── */
.btn-share {
  padding: 10px 24px;
  background: transparent;
  border: 1px solid var(--red);
  border-radius: 8px;
  color: var(--red);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  letter-spacing: 0.3px;
}

.btn-share:hover { background: var(--red); color: #fff; }

.share-panel {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: -8px;
}

.btn-share-opt {
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  white-space: nowrap;
}

.btn-share-opt:hover { border-color: var(--muted); }

/* ── Mulligan upsell ───────────────────────────────────────────────── */
.mulligan-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border: 1px solid #444;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  width: 100%;
  max-width: 360px;
}

.mulligan-out {
  font-size: 1rem;
  color: var(--muted);
}

.btn-mulligan {
  width: 100%;
  padding: 13px 24px;
  background: var(--gold);
  color: #000;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-mulligan:hover  { opacity: 0.85; }
.btn-mulligan:active { opacity: 0.7; }
.btn-mulligan:disabled { opacity: 0.45; cursor: default; }

.mulligan-sub {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.4;
}

/* ── Leaderboard ───────────────────────────────────────────────────── */
.leaderboard-section {
  padding: 40px 20px 60px;
  max-width: 560px;
  margin: 0 auto;
}

.lb-title {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
}

.lb-subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 24px;
}

.lb-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.2s;
}

.lb-row.lb-first {
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(255,215,0,0.1);
}

.lb-rank {
  font-size: 1.2rem;
  min-width: 32px;
  text-align: center;
}

.lb-name {
  flex: 1;
  font-weight: 600;
  font-size: 1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-green {
  font-size: 0.85rem;
  color: var(--green-glow);
  white-space: nowrap;
  min-width: 60px;
  text-align: right;
}

.lb-time {
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
  color: var(--gold);
  font-weight: 700;
  white-space: nowrap;
}

.lb-empty {
  text-align: center;
  color: var(--muted);
  padding: 32px;
}

/* ── Challenge banner (game screen) ────────────────────────────────── */
.challenge-banner {
  background: rgba(229,57,53,0.08);
  border: 1px solid rgba(229,57,53,0.3);
  border-radius: 10px;
  padding: 10px 20px;
  text-align: center;
  font-size: 0.95rem;
  color: var(--text);
  max-width: 420px;
  width: 100%;
  line-height: 1.5;
}

/* ── Challenge result (game over screen) ───────────────────────────── */
.challenge-result {
  padding: 10px 20px;
  border-radius: 10px;
  text-align: center;
  font-size: 1rem;
  width: 100%;
  max-width: 360px;
  line-height: 1.5;
}

.challenge-result--won {
  background: rgba(0,230,118,0.08);
  border: 1px solid rgba(0,230,118,0.3);
  color: var(--green-glow);
}

.challenge-result--lost {
  background: rgba(229,57,53,0.08);
  border: 1px solid rgba(229,57,53,0.25);
  color: var(--muted);
}

/* ── Challenge link section ─────────────────────────────────────────── */
.challenge-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 360px;
}

.btn-challenge {
  width: 100%;
  padding: 11px 24px;
  background: transparent;
  border: 1px solid var(--gold);
  border-radius: 8px;
  color: var(--gold);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  letter-spacing: 0.3px;
}

.btn-challenge:hover { background: var(--gold); color: #000; }

.challenge-link-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.challenge-url-input {
  flex: 1;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  outline: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Email capture section ──────────────────────────────────────────── */
.email-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 360px;
}

.email-label {
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}

/* ── Leaderboard flair ──────────────────────────────────────────────── */
.lb-flair {
  font-size: 0.85rem;
}
