:root {
  --bg: #07111f;
  --bg-2: #101a2e;
  --ink: #f5f7fb;
  --muted: #9aa8bd;
  --line: rgba(255, 255, 255, 0.1);
  --violet: #8b5cf6;
  --cyan: #67e8f9;
  --pink: #fb7185;
  --lime: #d9f99d;
  --amber: #fbbf24;
  --card: rgba(16, 26, 46, 0.78);
  --display: "Fraunces", "Iowan Old Style", Palatino, serif;
  --sans: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-foot {
  margin-top: auto;
  padding: 1.75rem 4vw 1.4rem;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}
.site-foot p { margin: 0; }
.site-foot .love {
  font-size: 1.05rem;
  vertical-align: -0.18em;
  color: var(--pink);
}
.site-foot .foot-sep { margin: 0 0.35rem; }
.site-foot .app-version { font-variant-numeric: tabular-nums; color: var(--ink); }

button, input, textarea, select { font: inherit; color: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(139, 92, 246, 0.45), transparent 60%),
    radial-gradient(700px 480px at 110% 10%, rgba(103, 232, 249, 0.22), transparent 55%),
    radial-gradient(600px 400px at 50% 120%, rgba(251, 113, 133, 0.18), transparent 50%),
    var(--bg);
  animation: drift 18s ease-in-out infinite alternate;
}

@keyframes drift {
  from { transform: scale(1) translate3d(0, 0, 0); }
  to { transform: scale(1.06) translate3d(0, -12px, 0); }
}

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.top {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 4vw;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.25rem;
}
.brand:hover,
.brand:focus {
  color: var(--ink);
  text-decoration: none;
}
.brand .material-symbols-outlined {
  font-size: 1.55rem;
  font-weight: 400;
  letter-spacing: normal;
  color: var(--lime);
}

.title-block { flex: 1; min-width: 10rem; }
.title-block h1, .title-block p { margin: 0; }
.title-block h1 { font-size: 1.35rem; }

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.code-block { display: flex; flex-direction: column; }
.code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 1.6rem;
  letter-spacing: 0.18em;
}

.nav { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: #475569;
  box-shadow: 0 0 0 0 rgba(217, 249, 157, 0.6);
}
.dot.on {
  background: var(--lime);
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 8px rgba(217, 249, 157, 0); }
  100% { box-shadow: 0 0 0 0 rgba(217, 249, 157, 0); }
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem 1.1rem 1.15rem;
  backdrop-filter: blur(10px);
}

.btn {
  appearance: none;
  border: 0;
  background: linear-gradient(90deg, #7c3aed, #22d3ee);
  color: #07111f;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.7rem 1.1rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.text {
  background: transparent;
  color: var(--lime);
  padding-left: 0;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.92rem; color: var(--muted); }
input, textarea, select {
  background: rgba(7, 17, 31, 0.65);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.8rem;
  font-size: 1rem;
}
textarea { resize: vertical; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

.home { padding: 0 4vw 4rem; max-width: 1100px; margin: 0 auto; }
.hero h1 {
  font-family: var(--display);
  font-size: clamp(3.2rem, 8vw, 6.4rem);
  line-height: 0.92;
  font-weight: 560;
  margin: 0.2rem 0 0.8rem;
}
.hero h1 .line { display: block; }
.lede { max-width: 38rem; font-size: 1.15rem; color: var(--muted); }
.sim-card {
  display: block;
  margin-top: 1.4rem;
  text-decoration: none;
  color: inherit;
  background:
    linear-gradient(120deg, rgba(217, 249, 157, 0.14), transparent 42%),
    linear-gradient(300deg, rgba(253, 186, 116, 0.16), transparent 40%),
    var(--card);
}
.sim-card h2 { margin: 0.2rem 0; font-size: 1.8rem; }
.sim-card p:last-child { margin: 0; color: var(--muted); }
.sim-card:hover { text-decoration: none; border-color: rgba(217, 249, 157, 0.45); }
.cta-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-top: 1rem; }
.try { max-width: 720px; margin: 0 auto; padding: 0 4vw 3rem; }
body[data-page="try"] #prompt { text-align: center; font-size: clamp(2.6rem, 7vw, 4.4rem); }
body[data-page="try"] .answers { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
body[data-page="try"] .choice {
  min-height: 7.5rem;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
}
body[data-page="try"] .choice .letter { display: none; }
body[data-page="try"] .choice[data-label="tea"] {
  background: linear-gradient(180deg, rgba(217, 249, 157, 0.22), rgba(101, 163, 13, 0.28));
  border-color: rgba(217, 249, 157, 0.5);
}
body[data-page="try"] .choice[data-label="coffee"] {
  background: linear-gradient(180deg, rgba(253, 186, 116, 0.22), rgba(120, 53, 15, 0.5));
  border-color: rgba(253, 186, 116, 0.5);
}
body[data-page="try"] .choice[data-label="tea"]::before { content: "🍵"; margin-right: 0.45rem; }
body[data-page="try"] .choice[data-label="coffee"]::before { content: "☕"; margin-right: 0.45rem; }
body[data-page="try"] .answer-note { grid-column: 1 / -1; text-align: center; }
.share-note { text-align: center; color: var(--muted); }
@media (max-width: 560px) {
  body[data-page="try"] .answers { grid-template-columns: 1fr; }
}
.cta-card { display: flex; flex-direction: column; gap: 0.8rem; }
.cta-card h2, .use-card h2 { margin: 0; font-size: 1.15rem; }
.use-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin-top: 2rem; }
.use-card p { color: var(--muted); margin: 0.4rem 0 0; }
.error { color: #fecdd3; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; padding: 0 4vw 1rem; }
.stat { padding: 0.8rem 1rem; }
.stat b { display: block; font-size: 1.8rem; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 0.85rem; }

.host-grid, .report {
  display: grid;
  gap: 1rem;
  padding: 0 4vw 2rem;
}
.host-grid {
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  grid-template-areas:
    "compose stage"
    "questions board";
}
.composer, .stage, #questions, .board-card { min-width: 0; }
.composer { grid-area: compose; display: flex; flex-direction: column; gap: 0.8rem; }
.composer form, .composer-row { display: flex; flex-direction: column; gap: 0.75rem; }
.composer-row { flex-direction: row; align-items: center; justify-content: space-between; }
.check { flex-direction: row; align-items: center; color: var(--ink); }
.stage { grid-area: stage; min-height: 280px; }
#questions { grid-area: questions; }
.board-card { grid-area: board; }
.history-card { margin: 0 4vw 3rem; }
.stage-head, .q-top { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.stage-head h2, #questions h2, .board-card h2, .history-card h2 { margin: 0 0 0.6rem; }
#people { color: var(--muted); }

#prompt {
  font-family: var(--display);
  font-weight: 560;
  line-height: 1.1;
  margin: 0 0 1rem;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  overflow-wrap: anywhere;
}

.present-stage { padding: 1rem 6vw 1rem; min-height: 58vh; display: flex; flex-direction: column; justify-content: center; }
body[data-page="present"] #prompt { font-size: clamp(2.2rem, 5vw, 4.5rem); }
.present-foot {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 1rem;
  padding: 0 4vw 2rem;
}
.present-top .code { font-size: clamp(1.8rem, 4vw, 3rem); }

.join { padding: 0 4vw 3rem; max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 1rem; }
.name-row, #ask { display: flex; gap: 0.6rem; align-items: end; }
.name-row label, #ask input { flex: 1; }
.score-pill { margin-left: auto; font-weight: 700; }
.score-pill span { font-variant-numeric: tabular-nums; }

.bars, .q-list, .history, #board { display: flex; flex-direction: column; gap: 0.55rem; position: relative; }
.hist .fill { background: linear-gradient(90deg, #7c3aed, #22d3ee); }
.bar, .choice, .q, .hist, .row {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 14px;
  padding: 0.55rem 0.7rem;
}
.bar-label, .who, .q-text { font-weight: 700; }
.track {
  margin-top: 0.35rem;
  height: 0.7rem;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}
.fill { height: 100%; width: 0; border-radius: inherit; position: relative; }
.bar:nth-child(4n+1) .fill { background: linear-gradient(90deg, #7c3aed, #22d3ee); }
.bar:nth-child(4n+2) .fill { background: linear-gradient(90deg, #e11d48, #fb7185); }
.bar:nth-child(4n+3) .fill { background: linear-gradient(90deg, #65a30d, #d9f99d); }
.bar:nth-child(4n+4) .fill { background: linear-gradient(90deg, #d97706, #fde68a); }
body[data-page="try"] .bar[data-label="tea"] .fill { background: linear-gradient(90deg, #65a30d, #fde68a); }
body[data-page="try"] .bar[data-label="coffee"] .fill { background: linear-gradient(90deg, #9a3412, #fdba74); }
.fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: translateX(-120%);
  animation: sheen 2.8s ease-in-out infinite;
}
@keyframes sheen { to { transform: translateX(120%); } }
.bar-meta, .hist-meta, .q-meta { display: flex; gap: 0.7rem; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.9rem; margin-top: 0.25rem; }
.bar.is-correct { box-shadow: inset 0 0 0 2px var(--lime); }
.bar.is-correct .bar-label::after { content: "  · correct"; color: var(--lime); font-weight: 600; }

.choice, .rate, .rank-row { width: 100%; text-align: left; cursor: pointer; }
.choice, .rate {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  min-height: 3.4rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 16px;
  padding: 0.8rem 1rem;
}
.letter {
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(139, 92, 246, 0.35);
  font-weight: 800;
}
.answers { display: flex; flex-direction: column; gap: 0.6rem; }
.answer-note { min-height: 1.4rem; font-weight: 700; color: var(--lime); margin: 0.4rem 0 0; }
.rank-row { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; border: 1px solid var(--line); background: transparent; color: inherit; }
.nudge { display: flex; gap: 0.3rem; }
.nudge button { border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--ink); min-width: 2.2rem; min-height: 2.2rem; }

.cloud { display: flex; flex-wrap: wrap; gap: 0.55rem 0.9rem; align-items: center; justify-content: center; min-height: 8rem; }
.word { font-weight: 800; line-height: 1; color: var(--cyan); display: inline-block; }
.word:nth-child(4n+2) { color: var(--pink); }
.word:nth-child(4n+3) { color: var(--lime); }
.word:nth-child(4n+4) { color: var(--amber); }
.word-tilt { display: inline-block; }

.texts { display: flex; flex-direction: column; gap: 0.45rem; }
.chip { padding: 0.65rem 0.8rem; border-radius: 12px; background: rgba(103, 232, 249, 0.08); }

.clock { position: relative; width: min(240px, 70vw); margin: 0 auto; text-align: center; }
.clock svg { width: 100%; height: auto; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255, 255, 255, 0.08); stroke-width: 8; }
.ring { fill: none; stroke: var(--cyan); stroke-width: 8; stroke-linecap: round; }
.time-left {
  position: absolute;
  inset: 22% 0 auto;
  font-size: 3.2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.time-left.urgent { color: var(--pink); }
.clock-caption { color: var(--muted); }
body[data-page="join"] .clock { width: 140px; }
body[data-page="join"] .time-left { font-size: 2rem; }

.rating-avg { font-family: var(--display); font-size: 4rem; margin: 0; line-height: 1; }
.row { display: grid; grid-template-columns: 2.2rem 1fr auto; gap: 0.6rem; align-items: center; }
.rank { font-weight: 800; color: var(--lime); }
.score { font-variant-numeric: tabular-nums; font-weight: 700; }

.q { display: flex; flex-direction: column; gap: 0.35rem; }
.q-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.pill { font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--amber); }

.empty, .muted { color: var(--muted); }
.empty { text-align: center; padding: 2rem 0; }
.mark { font-family: var(--display); font-size: 2.4rem; color: var(--lime); }

#toast {
  position: fixed;
  left: 50%;
  bottom: 1.2rem;
  transform: translateX(-50%);
  margin: 0;
  background: #f8fafc;
  color: #07111f;
  padding: 0.65rem 0.9rem;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  font-weight: 700;
}

.message { min-height: 80vh; display: grid; align-content: center; padding: 2rem 8vw; }
.message h1 { font-family: var(--display); font-size: clamp(2.4rem, 6vw, 4.5rem); margin: 0.2rem 0; }

.confetti { position: fixed; width: 10px; height: 14px; border-radius: 2px; pointer-events: none; z-index: 20; }

.noscript { padding: 1rem; }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .host-grid, .present-foot { grid-template-columns: 1fr; grid-template-areas: none; }
  .composer, .stage, #questions, .board-card { grid-area: auto; }
  .history-card { margin: 0 4vw 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .atmosphere, .dot.on, .fill::after { animation: none; }
}
