:root {
  --bg: #0e0a18;
  --surface: #1b1530;
  --surface2: #261d42;
  --line: #3a2e62;
  --text: #fff6e6;
  --muted: #b8acd6;
  --beer: #ffb81c;
  --pink: #ff3d81;
  --cyan: #22e3d0;
  --violet: #a78bfa;
  --orange: #ff8a3d;
  --ink: #160f26;
  --radius: 20px;
  color-scheme: dark;
  font-family: 'Baloo 2', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  min-height: 100dvh;
  background: radial-gradient(1100px 560px at 50% -220px, #33205f 0%, transparent 62%), var(--bg);
  background-attachment: fixed;
  font-size: 18px;
  line-height: 1.35;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input { font: inherit; }
[hidden] { display: none !important; }
h2, h3 { font-weight: 800; }

.screen {
  max-width: 520px;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 16px calc(120px + env(safe-area-inset-bottom));
}
#game.screen { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }

/* ---------- Home ---------- */
.hero { text-align: center; padding: 8px 0 4px; }
.logo {
  font-size: 88px; font-weight: 800; line-height: 1; letter-spacing: 2px;
  color: var(--beer);
  text-shadow: 0 0 28px rgba(255, 184, 28, .45), 0 5px 0 #a86a00;
}
.logo span { color: var(--pink); text-shadow: 0 0 28px rgba(255, 61, 129, .5), 0 5px 0 #9c1046; }
.tag { color: var(--muted); margin: 8px 0 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 14px 0;
}
.card h3, .section-title { margin: 0 0 8px; font-size: 20px; }
.card h3 small { font-size: 15px; font-weight: 600; }
.section-title { margin: 22px 4px 10px; }
.hint { color: var(--muted); font-size: 15px; margin: 0 0 10px; }

.add-row { display: flex; gap: 8px; }
.add-row input {
  flex: 1; min-width: 0;
  background: var(--bg); color: var(--text);
  border: 2px solid var(--line); border-radius: 14px;
  padding: 10px 14px; font-size: 18px;
}
.add-row input:focus { outline: none; border-color: var(--beer); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 20px;
  border-radius: 16px; font-weight: 800; font-size: 18px;
  transition: transform .08s, opacity .2s;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn-beer { background: var(--beer); color: var(--ink); }
.btn-pink { background: var(--pink); color: #fff; }
.btn-ghost { background: var(--surface2); color: var(--text); border: 1px solid var(--line); }
.btn-big { width: 100%; min-height: 68px; font-size: 24px; border-radius: 20px; margin-top: 14px; }
.link-btn {
  display: block; margin: 10px auto 0; padding: 8px 12px;
  color: var(--muted); text-decoration: underline; text-underline-offset: 3px; font-size: 16px;
}

.chips { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips:empty { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface2); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 4px 4px 6px; font-weight: 700;
}
.chip .num {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--beer); color: var(--ink);
  display: grid; place-items: center; font-size: 14px; font-weight: 800;
}
.chip .x {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255, 255, 255, .08); color: var(--muted);
  display: grid; place-items: center; font-size: 20px; line-height: 1;
}
.chip-btn { padding: 10px 18px; font-size: 18px; }
.chip-btn:active { background: var(--beer); color: var(--ink); }

.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.seg-sm { grid-template-columns: repeat(3, 1fr); margin-bottom: 8px; }
.seg-btn {
  background: var(--surface2); border: 2px solid var(--line); border-radius: 14px;
  padding: 8px 4px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; line-height: 1.2; min-height: 60px;
}
.seg-btn .ico { font-size: 18px; }
.seg-btn small { color: var(--muted); font-size: 12px; font-weight: 600; }
.seg-btn.on { border-color: var(--beer); background: rgba(255, 184, 28, .14); color: var(--beer); }
.seg-btn.on small { color: var(--beer); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gcard {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 14px; text-align: left;
  display: flex; flex-direction: column; gap: 2px; min-height: 140px;
  transition: transform .08s;
}
.gcard::after {
  content: ''; position: absolute; right: -34px; bottom: -34px;
  width: 100px; height: 100px; border-radius: 50%;
  background: var(--glow); opacity: .22; filter: blur(6px);
}
.gcard:active { transform: scale(.97); }
.gcard .ge { font-size: 38px; line-height: 1; }
.gcard .gn { font-weight: 800; font-size: 19px; line-height: 1.15; margin-top: 8px; }
.gcard .gd { color: var(--muted); font-size: 14px; line-height: 1.25; }

.tools { display: flex; gap: 10px; margin-top: 18px; }
.tools .btn { flex: 1; padding: 0 10px; }
.safe { text-align: center; color: var(--muted); font-size: 14px; margin: 18px 0 0; }

.zo-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 18px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 45%);
  display: flex; justify-content: center;
}
.btn-zo {
  width: 100%; max-width: 488px; min-height: 64px; border-radius: 20px;
  background: linear-gradient(90deg, var(--beer), var(--orange));
  color: var(--ink); font-weight: 800; font-size: 26px;
  box-shadow: 0 8px 30px rgba(255, 160, 40, .35);
  transition: transform .08s;
}
.btn-zo:active { transform: scale(.97); }

/* ---------- Game shell ---------- */
.topbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.back {
  width: 48px; height: 48px; border-radius: 14px; flex: none;
  background: var(--surface2); border: 1px solid var(--line);
  font-size: 32px; line-height: 1; padding-bottom: 4px;
}
.topbar h2 { margin: 0; font-size: 21px; flex: 1; text-align: center; line-height: 1.2; }
.spacer { width: 48px; flex: none; }

.turn { text-align: center; margin: 2px 0 8px; }
.turn small { color: var(--muted); font-size: 15px; }
.turn-name { font-size: 40px; font-weight: 800; color: var(--beer); line-height: 1.1; word-break: break-word; }
.order { color: var(--muted); font-size: 14px; text-align: center; margin: 0; }

.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.row { display: flex; gap: 10px; margin-top: 14px; }
.row .btn { flex: 1; padding: 0 12px; line-height: 1.15; }
.penalty-line { font-size: 21px; color: var(--beer); font-weight: 800; text-align: center; margin: 10px 0 0; }

.pop { animation: pop .35s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop { from { transform: scale(.86); opacity: 0; } }

/* ---------- Wheel ---------- */
.wheel-wrap {
  position: relative; width: min(86vw, 380px); aspect-ratio: 1; margin: 18px auto 0;
  filter: drop-shadow(0 12px 30px rgba(0, 0, 0, .55));
}
.wheel-svg { width: 100%; height: 100%; display: block; transform-origin: 50% 50%; }
.wheel-svg text { font-family: inherit; font-weight: 800; font-size: 10.5px; fill: var(--ink); }
.wheel-pointer {
  position: absolute; left: 50%; top: -14px; z-index: 2;
  width: 0; height: 0;
  border-left: 17px solid transparent; border-right: 17px solid transparent;
  border-top: 32px solid #fff;
  transform: translateX(-50%); transform-origin: 50% 0;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .6));
}
.wheel-pointer.tick { animation: tick .12s; }
@keyframes tick { 50% { transform: translateX(-50%) rotate(-16deg); } }
.wheel-hub {
  position: absolute; inset: 0; margin: auto; z-index: 2;
  width: 26%; height: 26%; border-radius: 50%;
  background: var(--bg); border: 4px solid var(--beer); color: var(--beer);
  font-weight: 800; font-size: clamp(16px, 5vw, 22px);
  display: grid; place-items: center;
  box-shadow: 0 0 24px rgba(255, 184, 28, .4);
}
.wheel-hub:disabled { opacity: 1; }

.rcard {
  background: var(--surface); border: 2px solid var(--beer); border-radius: var(--radius);
  padding: 16px; text-align: center; margin-top: 18px;
}
.rcard-title { font-size: 30px; font-weight: 800; color: var(--beer); line-height: 1.1; }
.rcard-text { font-size: 22px; margin: 8px 0 0; line-height: 1.3; }
.rcard .btn-big { margin-top: 14px; }

/* ---------- Finger chooser ---------- */
.finger-area {
  position: relative; overflow: hidden;
  height: calc(100dvh - 104px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  min-height: 380px;
  border-radius: 24px; border: 2px dashed var(--line);
  background: radial-gradient(circle at 50% 50%, #221a3d 0%, var(--bg) 70%);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.finger-hint {
  position: absolute; inset: 0; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px; color: var(--muted);
}
.finger-hint p { margin: 6px 0; font-size: 20px; }
.finger-hint p.small { font-size: 14px; }
.big-emoji { font-size: 76px; line-height: 1; animation: float 2s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-10px); } }
.finger-status {
  position: absolute; top: 14px; left: 0; right: 0; z-index: 3;
  text-align: center; font-size: 26px; font-weight: 800; pointer-events: none;
}
.fdot {
  position: absolute; left: 0; top: 0; pointer-events: none;
  width: 100px; height: 100px; margin: -50px 0 0 -50px; border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 10px color-mix(in srgb, var(--c) 30%, transparent), 0 0 44px var(--c);
  animation: dotin .2s ease-out;
  transition: opacity .3s, scale .3s;
}
@keyframes dotin { from { scale: .3; opacity: 0; } }
.fdot.win { z-index: 2; animation: winpulse .6s ease-in-out infinite alternate; }
@keyframes winpulse { from { scale: 1.35; } to { scale: 1.7; } }
.fdot.lose { opacity: .25; scale: .7; }
.finger-banner {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 4;
  background: rgba(14, 10, 24, .94); border: 2px solid var(--beer); border-radius: 20px;
  padding: 14px; text-align: center;
}
.banner-title { font-size: 30px; font-weight: 800; color: var(--beer); line-height: 1.1; }
.finger-banner p { margin: 4px 0 10px; font-size: 21px; }
.finger-banner .btn { width: 100%; }

/* ---------- Bomb ---------- */
.bomb { text-align: center; }
.bomb-icon { font-size: 120px; line-height: 1.1; margin: 6px 0; display: inline-block; }
.bomb-icon.beat { animation: beat .16s; }
@keyframes beat { 50% { transform: scale(1.16) rotate(-7deg); } }
.topic-card {
  background: var(--surface); border: 2px solid var(--cyan); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 8px;
}
.topic-card small { color: var(--cyan); font-weight: 800; letter-spacing: 1px; text-transform: uppercase; font-size: 13px; }
.topic { font-size: 28px; font-weight: 800; line-height: 1.2; }
.topic-mini { font-size: 22px; font-weight: 800; color: var(--cyan); line-height: 1.2; margin-top: 4px; }
.pass { min-height: 130px; font-size: 36px; }
.boom-text { font-size: 76px; font-weight: 800; color: var(--pink); line-height: 1.1; margin-top: 24px; animation: shake .5s; }
.boom-sub { font-size: 24px; margin: 8px 0; }
@keyframes shake { 20%, 60% { transform: translateX(-12px); } 40%, 80% { transform: translateX(12px); } }

/* ---------- Question cards ---------- */
.qcard {
  background: linear-gradient(160deg, var(--surface2), var(--surface));
  border: 2px solid var(--line); border-radius: 24px;
  padding: 22px 20px; min-height: 230px; margin: 6px 0;
  display: flex; flex-direction: column; justify-content: center;
}
.qcard-tag { font-size: 15px; font-weight: 800; letter-spacing: 1px; color: var(--muted); margin-bottom: 8px; }
.qcard-text { font-size: 28px; font-weight: 800; line-height: 1.25; }
.qcard-truth { border-color: var(--cyan); } .qcard-truth .qcard-tag { color: var(--cyan); }
.qcard-dare { border-color: var(--pink); } .qcard-dare .qcard-tag { color: var(--pink); }
.qcard-never { border-color: var(--violet); cursor: pointer; } .qcard-never .qcard-tag { color: var(--violet); }
.qcard-likely { border-color: var(--beer); } .qcard-likely .qcard-tag { color: var(--beer); }

.td-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
.td-btn {
  min-height: 210px; border-radius: 24px; font-size: 32px; font-weight: 800;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  transition: transform .08s;
}
.td-btn:active { transform: scale(.96); }
.td-btn.truth { background: var(--cyan); color: var(--ink); }
.td-btn.dare { background: var(--pink); color: #fff; }
.td-emoji { font-size: 52px; line-height: 1; }

.who { text-align: center; margin-top: 16px; }
.who-title { font-weight: 800; font-size: 20px; margin: 0 0 8px; }
.chips-pick { justify-content: center; margin-top: 0; }

/* ---------- Overlay ---------- */
#overlay {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(8, 5, 16, .93); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.count-num {
  font-size: min(52vw, 260px); font-weight: 800; line-height: 1;
  color: var(--beer); text-shadow: 0 0 44px rgba(255, 184, 28, .6);
  animation: countin .6s ease-out; text-align: center;
}
.count-num.final { font-size: min(20vw, 112px); color: var(--pink); text-shadow: 0 0 44px rgba(255, 61, 129, .6); }
@keyframes countin { from { transform: scale(2.2); opacity: 0; } }
.pop-box { text-align: center; max-width: 440px; }
.pop-emoji { font-size: 80px; line-height: 1; }
.pop-text { font-size: 42px; font-weight: 800; color: var(--beer); line-height: 1.15; margin-top: 8px; }
.pop-sub { color: var(--muted); margin-top: 14px; }

.sheet {
  width: 100%; max-width: 480px; max-height: 82dvh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 20px;
}
.sheet h3 { margin: 0 0 4px; font-size: 24px; }
.tally-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; margin: 12px 0; }
.tally-name { font-weight: 800; font-size: 19px; }
.tally-count { color: var(--beer); font-weight: 800; }
.tally-bar { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--surface2); overflow: hidden; }
.tally-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--beer), var(--pink)); border-radius: 4px; }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; display: none; }
#confetti.on { display: block; }
#flash { position: fixed; inset: 0; background: #ff2d55; pointer-events: none; opacity: 0; z-index: 25; }
#flash.on { animation: flash .7s ease-out; }
@keyframes flash { 0% { opacity: .85; } 100% { opacity: 0; } }

#toast {
  position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 40;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #fff; color: var(--ink); font-weight: 700;
  padding: 10px 18px; border-radius: 999px; max-width: 90vw; text-align: center;
  transition: opacity .25s, transform .25s;
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 360px) {
  .logo { font-size: 72px; }
  .seg-btn { font-size: 13px; }
  .gcard .gn { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
