:root {
  --ink: #141019;
  --surface: #1F1826;
  --surface-2: #2A2233;
  --paper: #FBF7FF;
  --coral: #FF6B4A;
  --pink: #FF3D8B;
  --lime: #C6FF4D;
  --cyan: #38E1FF;
  --muted: #9B8FAE;
  --border: #362C42;
  --radius: 18px;
  --ok: var(--lime);
  --no: #FF5470;
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  background: var(--ink);
  color: var(--paper);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
em { font-style: normal; color: var(--muted); }

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100%;
  padding: max(env(safe-area-inset-top), 18px) 20px max(env(safe-area-inset-bottom), 24px);
  display: flex;
  flex-direction: column;
}

/* screens */
.screen { display: none; flex: 1; flex-direction: column; animation: rise .32s cubic-bezier(.2,.8,.2,1); }
.screen.is-active { display: flex; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .screen { animation: none; } }

/* wordmark */
.home-head { text-align: center; padding: 8vh 0 6vh; }
.wordmark {
  font-family: "Bricolage Grotesque", Inter, sans-serif;
  font-weight: 800;
  font-size: clamp(3rem, 18vw, 5rem);
  color: var(--coral);
  letter-spacing: -.03em;
  line-height: 1;
  display: inline-flex;
  align-items: flex-start;
}
.wordmark .dots { width: .5em; height: 1em; display: inline-block; position: relative; }
.wordmark .dots::before, .wordmark .dots::after {
  content: ""; position: absolute; width: .16em; height: .16em; border-radius: 50%; top: .1em;
}
.wordmark .dots::before { left: 0; background: var(--pink); }
.wordmark .dots::after { left: .24em; background: var(--lime); top: .28em; }
.tagline { color: var(--muted); font-size: 1.05rem; margin-top: .6rem; }

/* mode grid */
.mode-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 380px) { .mode-grid { grid-template-columns: 1fr; } }
.mode-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px 18px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 148px;
  transition: transform .14s ease, border-color .14s ease, background .14s ease;
  border-top: 3px solid var(--c);
}
.mode-card:active { transform: scale(.97); }
.mode-card:hover { border-color: var(--c); background: var(--surface-2); }
.mode-card:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }
.mode-emoji { font-size: 1.7rem; }
.mode-name { font-family: "Bricolage Grotesque", sans-serif; font-weight: 700; font-size: 1.15rem; margin-top: auto; }
.mode-blurb { color: var(--muted); font-size: .85rem; line-height: 1.35; }

.home-foot { text-align: center; color: var(--muted); font-size: .9rem; margin-top: auto; padding-top: 22px; }
.offline-tag { color: var(--lime); }

/* setup */
.back { color: var(--muted); font-size: .95rem; padding: 6px 0; align-self: flex-start; }
.back:active { color: var(--paper); }
h1 { font-family: "Bricolage Grotesque", sans-serif; font-weight: 800; font-size: 1.8rem; letter-spacing: -.02em; margin: 8px 0 20px; text-wrap: balance; }
.setup-body { display: flex; flex-direction: column; gap: 26px; flex: 1; }
.field > span { display: block; font-weight: 600; margin-bottom: 10px; font-size: .95rem; }
.players { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.player-row { display: flex; gap: 8px; }
input[type=text] {
  flex: 1; background: var(--surface); border: 1px solid var(--border); color: var(--paper);
  border-radius: 12px; padding: 12px 14px; font: inherit;
}
input[type=text]:focus-visible { outline: 2px solid var(--coral); outline-offset: 1px; }
.player-row .rm { color: var(--muted); font-size: 1.3rem; padding: 0 8px; }

.choice-set { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 9px 16px; font-size: .92rem; transition: all .12s ease;
}
.chip[aria-pressed=true] { background: var(--coral); border-color: var(--coral); color: #2a0e06; font-weight: 600; }

/* buttons */
.btn { border-radius: 14px; font-weight: 600; padding: 13px 20px; transition: transform .12s ease, filter .12s ease; text-align: center; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--coral); color: #2a0e06; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: var(--surface); border: 1px solid var(--border); color: var(--paper); }
.btn-lg { padding: 16px 24px; font-size: 1.05rem; margin-top: 18px; }
.btn-sm { padding: 9px 14px; font-size: .88rem; }
.btn:focus-visible { outline: 2px solid var(--paper); outline-offset: 2px; }
.btn[disabled] { opacity: .4; pointer-events: none; }

/* play */
.play-turn { text-align: center; color: var(--muted); font-weight: 600; font-size: .95rem; min-height: 22px; margin-bottom: 6px; }
.play-turn b { color: var(--paper); }
.play-body { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 16px; padding: 10px 0; }
.play-actions { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; }

.prompt-lg {
  font-family: "Bricolage Grotesque", sans-serif; font-weight: 700;
  font-size: clamp(1.5rem, 6.5vw, 2rem); line-height: 1.2; text-align: center; text-wrap: balance;
}
.counter { text-align: center; color: var(--muted); font-size: .85rem; }

/* would you rather */
.wyr-options { display: grid; gap: 12px; }
.wyr-opt {
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 20px 18px; font-size: 1.15rem; font-weight: 600; line-height: 1.3; text-align: center;
  transition: all .13s ease;
}
.wyr-opt:active { transform: scale(.98); }
.wyr-opt.pick-a:hover, .wyr-opt.pick-a.chosen { border-color: var(--coral); background: color-mix(in srgb, var(--coral) 16%, var(--surface)); }
.wyr-opt.pick-b:hover, .wyr-opt.pick-b.chosen { border-color: var(--cyan); background: color-mix(in srgb, var(--cyan) 16%, var(--surface)); }
.wyr-or { text-align: center; color: var(--muted); font-family: "Bricolage Grotesque"; font-weight: 700; }
.reveal-quip { text-align: center; color: var(--lime); font-size: 1rem; line-height: 1.4; padding: 4px 6px; text-wrap: pretty; }

/* trivia */
.tri-cat { text-align: center; color: var(--cyan); font-weight: 600; font-size: .82rem; letter-spacing: .06em; text-transform: uppercase; }
.tri-options { display: grid; gap: 10px; }
.tri-opt {
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 14px;
  padding: 15px 16px; font-size: 1.02rem; text-align: left; transition: all .12s ease;
}
.tri-opt:active { transform: scale(.98); }
.tri-opt.correct { border-color: var(--ok); background: color-mix(in srgb, var(--lime) 18%, var(--surface)); color: var(--paper); }
.tri-opt.wrong { border-color: var(--no); background: color-mix(in srgb, var(--no) 16%, var(--surface)); }
.tri-opt[disabled] { opacity: 1; pointer-events: none; }
.tri-fact { text-align: center; color: var(--muted); font-size: .92rem; line-height: 1.4; padding-top: 4px; text-wrap: pretty; }

/* hot seat */
.hs-name { text-align: center; }
.hs-name b { font-family: "Bricolage Grotesque"; color: var(--pink); font-size: 1.1rem; }

/* story */
.story-line { font-size: 1.15rem; line-height: 1.4; text-align: center; text-wrap: balance; color: var(--muted); }
.story-line b { color: var(--paper); }
.story-options { display: grid; gap: 10px; }
.story-opt {
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 14px;
  padding: 14px 16px; text-align: left; font-size: 1rem; transition: all .12s ease;
}
.story-opt:active { transform: scale(.98); }
.story-opt:hover { border-color: var(--lime); }
.story-final { font-size: 1.12rem; line-height: 1.65; text-wrap: pretty; }
.story-final b { color: var(--lime); font-weight: 700; }
.story-final .st-title { display: block; font-family: "Bricolage Grotesque"; font-weight: 800; font-size: 1.3rem; color: var(--paper); margin-bottom: 10px; text-align: center; }

/* results */
[data-screen=results] { justify-content: center; text-align: center; position: relative; }
[data-screen=results] h1 { font-size: 2.1rem; }
.results-body { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 8px; }
.score-row { display: flex; justify-content: space-between; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; font-size: 1.05rem; }
.score-row.lead { border-color: var(--lime); }
.score-row .pts { font-weight: 700; font-family: "Bricolage Grotesque"; }
.results-line { color: var(--muted); line-height: 1.5; }
.results-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }

.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti i {
  position: absolute; top: -12px; width: 9px; height: 14px; opacity: .9;
  animation: fall linear forwards;
}
@keyframes fall { to { transform: translateY(115vh) rotate(680deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } }
