:root {
  --bg-warm-1: #ffb347;
  --bg-warm-2: #ff5e62;
  --bg-hot-3: #4a0e10;
  --boom-1:   #ffe28a;
  --text:     #fff;
  --pill-bg:  rgba(255,255,255,.25);
  --pill-border: rgba(255,255,255,.6);
  --btn-bg:   #fff;
  --btn-fg:   #ff5e62;
  --btn-shadow: 0 8px 0 rgba(0,0,0,.18), 0 12px 24px rgba(0,0,0,.2);
}

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

html, body {
  height: 100%;
  font-family: 'Comic Sans MS', 'Chalkboard SE', 'Marker Felt', sans-serif;
  color: var(--text);
  background: linear-gradient(160deg, var(--bg-warm-1) 0%, var(--bg-warm-2) 100%);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

#app-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(env(safe-area-inset-top) + 8px) 16px 8px;
  background: rgba(0,0,0,.1);
  position: sticky; top: 0; z-index: 10;
}
.header-btn {
  background: none; border: 1px solid rgba(255,255,255,.4);
  color: var(--text); border-radius: 999px;
  padding: 4px 10px; font-family: inherit; font-size: 14px;
  cursor: pointer;
}
.header-title { font-weight: bold; font-size: 14px; }

#app {
  flex: 1; padding: 24px;
  display: flex; flex-direction: column; align-items: center;
}

.pill {
  background: var(--pill-bg);
  border: 2px solid var(--pill-border);
  border-radius: 999px;
  padding: 6px 18px;
  font-weight: bold;
  letter-spacing: .5px;
}

.btn {
  background: var(--btn-bg);
  color: var(--btn-fg);
  padding: 16px 40px;
  border-radius: 999px;
  font-weight: bold;
  font-size: 22px;
  font-family: inherit;
  border: none;
  box-shadow: var(--btn-shadow);
  cursor: pointer;
}
.btn:active { transform: translateY(4px); box-shadow: 0 4px 0 rgba(0,0,0,.18); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ----- Setup screen ----- */
.setup-title { text-align: center; font-size: 36px; margin-bottom: 8px; }
#setup-form { display: flex; flex-direction: column; gap: 14px; max-width: 480px; width: 100%; }
.setup-section { background: rgba(255,255,255,.12); border-radius: 14px; padding: 14px; }
.setup-section h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; opacity: .9; margin-bottom: 8px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg-btn {
  flex: 1; min-width: 90px;
  background: rgba(255,255,255,.2); color: var(--text);
  border: 2px solid transparent; border-radius: 12px;
  padding: 10px; font-family: inherit; font-weight: bold;
  cursor: pointer;
}
.seg-btn.on { background: var(--btn-bg); color: var(--btn-fg); border-color: rgba(0,0,0,.1); }
.end-value { margin-top: 10px; }
.end-value input { width: 80px; padding: 6px; border-radius: 6px; border: none; font-family: inherit; font-size: 16px; text-align: center; }
.timer-row { display: flex; gap: 16px; align-items: center; }
.timer-row label { display: flex; align-items: center; gap: 6px; }
.timer-row input { width: 64px; padding: 6px; border-radius: 6px; border: none; font-family: inherit; font-size: 16px; text-align: center; }
.hint { font-size: 12px; opacity: .85; margin-top: 8px; }
.player-stepper { display: flex; align-items: center; gap: 14px; justify-content: center; margin-bottom: 10px; }
.player-stepper button { width: 36px; height: 36px; border-radius: 50%; border: none; background: var(--btn-bg); color: var(--btn-fg); font-size: 22px; font-weight: bold; cursor: pointer; }
#player-count { font-size: 24px; font-weight: bold; min-width: 28px; text-align: center; }
#player-list { display: flex; flex-direction: column; gap: 6px; }
.player-name { padding: 8px 12px; border-radius: 8px; border: none; font-family: inherit; font-size: 16px; }
#los-btn { align-self: center; margin-top: 6px; }

/* ----- Game screens ----- */
.centered { display: flex; flex-direction: column; align-items: center; gap: 18px; flex: 1; width: 100%; }
.hint.big { font-size: 16px; max-width: 360px; text-align: center; }
.potato { font-size: 160px; line-height: 1; filter: drop-shadow(0 10px 20px rgba(0,0,0,.3)); }
.potato.wiggle { animation: wiggle 1.6s infinite ease-in-out; }
.potato.static { animation: none; }
.potato.shake-hard { animation: shake .08s infinite linear; }
@keyframes wiggle { 0%,100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }
@keyframes shake {
  0%   { transform: translate(0,0)   rotate(0); }
  25%  { transform: translate(-3px,2px) rotate(-3deg); }
  50%  { transform: translate(2px,-2px) rotate(3deg); }
  75%  { transform: translate(-2px,3px) rotate(-2deg); }
  100% { transform: translate(0,0) rotate(0); }
}

body.suspense-classic { background: linear-gradient(160deg, #ff5e62 0%, #b9272a 100%); transition: background 1s ease; }

.scoreboard { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: auto; padding: 12px; background: rgba(0,0,0,.15); border-radius: 12px; width: 100%; max-width: 480px; }
.score-cell { display: flex; flex-direction: column; align-items: center; padding: 4px 10px; min-width: 56px; }
.score-cell strong { font-size: 18px; }
.score-cell.out { opacity: .35; text-decoration: line-through; }

#pause-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.overlay-card { background: var(--btn-bg); color: var(--btn-fg); padding: 28px 32px; border-radius: 18px; text-align: center; max-width: 320px; }
.overlay-card h2 { margin-bottom: 8px; }
.overlay-card .hint { color: var(--btn-fg); opacity: .8; margin-bottom: 14px; }

/* ----- Boom + Pick-Loser ----- */
.boom-screen {
  position: fixed; inset: 0;
  background: radial-gradient(circle at center, var(--boom-1) 0%, var(--bg-warm-2) 50%, var(--bg-hot-3) 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 24px;
  z-index: 50;
}
.boom-emoji { font-size: 200px; line-height: 1; animation: shake .12s infinite linear; filter: drop-shadow(0 0 30px #ffea00); }
.boom-title { font-size: 56px; font-weight: bold; text-shadow: 0 4px 0 rgba(0,0,0,.3); letter-spacing: 2px; }

.pick-title { font-size: 24px; margin-bottom: 8px; }
.pick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 480px; }
.pick-btn { padding: 18px 12px; font-size: 18px; }

/* ----- Round-Done + Game-Over ----- */
.scoreboard.standalone { margin-top: 0; max-width: 480px; }
.winner-title { font-size: 24px; text-align: center; max-width: 480px; }
.final-scores { width: 100%; max-width: 480px; display: flex; flex-direction: column; gap: 6px; }
.final-row { display: flex; justify-content: space-between; padding: 10px 14px; background: rgba(255,255,255,.15); border-radius: 10px; }
.final-row.win { background: rgba(255,255,255,.45); color: var(--btn-fg); font-weight: bold; }
.final-row.out { opacity: .4; text-decoration: line-through; }
.end-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.btn.secondary { background: rgba(255,255,255,.25); color: var(--text); box-shadow: none; padding: 14px 32px; font-size: 18px; }

.audio-debug {
  font-family: ui-monospace, monospace;
  font-size: 10px;
  opacity: 0.55;
  margin-top: 6px;
  letter-spacing: 0.5px;
}
