/* Read the Room. One blue room, ink outlines, one acid accent. */

:root {
  --ground: #2b35e0;
  --ground-deep: #2029bd;
  --ink: #12122b;
  --paper: #fffdf4;
  --accent: #e7ff3c;
  --mute: #5b5b78;
  --soft: #d3d6ff;
  --rule: #d9d9e6;
  --line: 3px solid var(--ink);
  --shadow: 5px 5px 0 var(--ink);
  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--ground);
  background-image: radial-gradient(var(--ground-deep) 1.6px, transparent 1.7px);
  background-size: 18px 18px;
  color: #fff;
  font: 500 16px/1.35 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px dashed currentColor; outline-offset: 3px; }

.wrap {
  max-width: 472px;
  margin: 0 auto;
  padding: 10px 16px 0;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

.plain { padding: 40px 0; font-weight: 700; }

/* ---------- top row ---------- */

.top {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  margin-bottom: 12px;
}
.mark {
  font-size: 21px;
  font-weight: 900;
  letter-spacing: -0.02em;
  white-space: nowrap;
  color: #fff;
  text-decoration: none;
}
.mark b {
  display: inline-block;
  background: var(--accent);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  border-radius: 8px;
  padding: 0 7px;
  margin-left: 2px;
  transform: rotate(-4deg);
  box-shadow: 2px 2px 0 var(--ink);
}
.daychip { font-weight: 800; font-size: 15px; color: var(--soft); white-space: nowrap; }
.spacer { flex: 1; }
.round {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  border: 2.5px solid #fff;
  background: transparent;
  color: #fff;
  font-weight: 900;
  font-size: 20px;
  line-height: 1;
}
.round:active { background: #fff; color: var(--ground); }

/* ---------- blocks ---------- */

.stack { display: grid; gap: 14px; }
.stack > * { min-width: 0; }

.card {
  background: var(--paper);
  color: var(--ink);
  border: var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin-right: 5px;
}
.card h2 { font-size: 19px; font-weight: 900; letter-spacing: -0.01em; }
.card h2 + * { margin-top: 10px; }

.tag {
  display: inline-block;
  background: var(--ink);
  color: var(--accent);
  font-weight: 800;
  font-size: 13px;
  padding: 3px 10px;
  border-radius: 8px;
  transform: rotate(-2.5deg);
}
.q {
  margin-top: 10px;
  font-size: clamp(22px, 6.6vw, 28px);
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
  overflow-wrap: break-word;
}
.sub { color: var(--mute); font-weight: 600; font-size: 15px; }
.on-ground { color: var(--soft); font-weight: 600; font-size: 15px; }
.center { text-align: center; }
.error { color: #b3002d; font-weight: 800; font-size: 15px; }
.error:empty { display: none; }

/* ---------- buttons ---------- */

.btn {
  display: block;
  width: 100%;
  min-height: 54px;
  padding: 8px 16px;
  border: var(--line);
  border-radius: 16px;
  background: var(--accent);
  color: var(--ink);
  font-weight: 900;
  font-size: 19px;
  letter-spacing: -0.01em;
  box-shadow: var(--shadow);
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }
.btn:disabled { background: #cfd0df; color: #6b6b85; box-shadow: none; cursor: default; }
.btn.alt { background: var(--paper); }
.btn.small { min-height: 46px; font-size: 16px; box-shadow: 3px 3px 0 var(--ink); }
.dock .btn, .card .btn, main > .btn { width: calc(100% - 5px); }

.link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 6px;
  border: 0;
  background: none;
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.card .link { color: var(--ink); }
.links { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 18px; }

.dock {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: grid;
  gap: 10px;
  margin-top: 4px;
  padding: 14px 0 calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(rgba(43, 53, 224, 0), var(--ground) 16px);
}
.foot { padding: 4px 0 calc(20px + env(safe-area-inset-bottom)); }

/* ---------- forms ---------- */

.field { display: grid; gap: 6px; }
.field label, .legend { font-weight: 800; font-size: 15px; }
.field input {
  width: 100%;
  min-height: 54px;
  border: var(--line);
  border-radius: 14px;
  padding: 0 14px;
  background: #fff;
  font-weight: 700;
  font-size: 19px;
}
.field input::placeholder { color: #9a9ab0; font-weight: 600; }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.packs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.pack {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 10px;
  border: var(--line);
  border-radius: 12px;
  background: #fff;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
}
.pack:has(input:checked) { background: var(--accent); }
.pack input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  border: var(--line);
  border-radius: 6px;
  background: #fff;
  display: grid;
  place-items: center;
}
.pack input:checked { background: var(--ink); }
.pack input:checked::after {
  content: "";
  width: 6px;
  height: 11px;
  margin-top: -2px;
  border: solid var(--accent);
  border-width: 0 3px 3px 0;
  transform: rotate(40deg);
}

/* ---------- landing ---------- */

.hero { padding: 6px 0 2px; }
.hero h1 {
  font-size: clamp(46px, 15vw, 68px);
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: -0.04em;
}
.hero h1 b {
  display: inline-block;
  background: var(--accent);
  color: var(--ink);
  border: 4px solid var(--ink);
  border-radius: 16px;
  padding: 2px 14px 6px;
  margin-top: 6px;
  transform: rotate(-4deg);
  box-shadow: var(--shadow);
}
.hero p { margin-top: 18px; font-size: 19px; font-weight: 700; line-height: 1.25; text-wrap: balance; }

/* ---------- people ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 2px 12px;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  font-weight: 800;
  font-size: 15px;
  overflow-wrap: anywhere;
}
button.chip { min-height: 46px; padding: 2px 16px; box-shadow: 3px 3px 0 var(--ink); }
button.chip:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }

.strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 8px 8px 14px;
  border: 2.5px dashed #fff;
  border-radius: 16px;
  font-weight: 700;
  font-size: 15px;
}
.strip button {
  flex: none;
  min-height: 44px;
  padding: 0 14px;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  font-size: 15px;
}

/* ---------- answering ---------- */

.steps { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.steps span { color: var(--mute); font-weight: 800; font-size: 14px; white-space: nowrap; }

.num { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 4px; }
.num output {
  min-width: 2.3ch;
  font-size: 76px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.05em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.num.untouched output { color: #b6b7c9; }
.nudge {
  width: 48px;
  height: 48px;
  flex: none;
  border: var(--line);
  border-radius: 50%;
  background: #fff;
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
  padding: 0 0 3px;
}
.nudge:active { background: var(--accent); }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 48px;
  margin: 4px 0 0;
  background: transparent;
  cursor: pointer;
  touch-action: pan-y;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 20px;
  border: var(--line);
  border-radius: 12px;
  background: linear-gradient(90deg, var(--accent) var(--fill, 50%), #fff var(--fill, 50%));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 40px;
  height: 40px;
  margin-top: -13px;
  border: var(--line);
  border-radius: 50%;
  background: var(--ink);
  box-shadow: inset 0 0 0 5px var(--accent);
}
input[type="range"]::-moz-range-track {
  height: 14px;
  border: var(--line);
  border-radius: 12px;
  background: linear-gradient(90deg, var(--accent) var(--fill, 50%), #fff var(--fill, 50%));
}
input[type="range"]::-moz-range-thumb {
  width: 34px;
  height: 34px;
  border: var(--line);
  border-radius: 50%;
  background: var(--ink);
  box-shadow: inset 0 0 0 5px var(--accent);
}
.ends { display: flex; justify-content: space-between; gap: 16px; font-weight: 800; font-size: 14px; line-height: 1.2; }
.ends span { max-width: 48%; }
.slider > .sub { margin-top: 10px; }
.ends span:last-child { text-align: right; }

.opts { display: grid; gap: 9px; }
.opts.who { grid-template-columns: 1fr 1fr; }
.opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 8px 12px;
  border: var(--line);
  border-radius: 14px;
  background: #fff;
  font-weight: 800;
  font-size: 17px;
  line-height: 1.15;
  text-align: left;
  overflow-wrap: anywhere;
}
.opt::after {
  content: "";
  flex: none;
  width: 22px;
  height: 22px;
  border: var(--line);
  border-radius: 50%;
  background: #fff;
}
.opt[aria-pressed="true"] { background: var(--accent); box-shadow: 3px 3px 0 var(--ink); }
.opt[aria-pressed="true"]::after { background: var(--ink); box-shadow: inset 0 0 0 4px var(--accent); }
.mini {
  display: inline-block;
  margin-left: 2px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  vertical-align: 2px;
}

/* ---------- waiting ---------- */

.stamp {
  display: inline-block;
  padding: 3px 12px;
  border: var(--line);
  border-radius: 10px;
  background: var(--accent);
  font-weight: 900;
  font-size: 18px;
  transform: rotate(-4deg);
  box-shadow: 3px 3px 0 var(--ink);
}
.tally { display: flex; align-items: baseline; gap: 10px; margin-top: 12px; }
.tally strong { font-size: 64px; font-weight: 900; line-height: 0.95; letter-spacing: -0.05em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tally span { font-weight: 800; font-size: 17px; line-height: 1.15; }

.rows { margin-top: 8px; }
.row { padding: 9px 0; border-top: 2px dashed var(--rule); }
.row:first-child { border-top: 0; }
.row-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 800; font-size: 17px; }
.row-top .name { min-width: 0; overflow-wrap: anywhere; }
.row-sub { margin-top: 1px; color: var(--mute); font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.pts { font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }

.pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 86px;
  justify-content: center;
  padding: 3px 10px;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  font-weight: 800;
  font-size: 14px;
}
.pill.in { background: var(--ink); color: var(--accent); }
.pill.in::before {
  content: "";
  width: 5px;
  height: 9px;
  margin-top: -3px;
  border: solid var(--accent);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(40deg);
}
.pill.wait { border-style: dashed; color: var(--mute); }

.count { font-variant-numeric: tabular-nums; font-weight: 900; color: #fff; white-space: nowrap; }
.card .count { color: var(--ink); }

/* ---------- reveal ---------- */

.said { font-weight: 800; font-size: 16px; }
.hugenum {
  font-size: 104px;
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.06em;
  font-variant-numeric: tabular-nums;
}
.winner {
  margin-top: 2px;
  font-size: clamp(28px, 9vw, 40px);
  font-weight: 900;
  line-height: 1.02;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.hist {
  position: relative;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  align-items: end;
  height: 76px;
  margin-top: 16px;
  border-bottom: var(--line);
}
.hist i {
  display: block;
  height: var(--h, 0%);
  min-height: 0;
  background: var(--ink);
  border-radius: 5px 5px 0 0;
  transition: height 0.7s cubic-bezier(0.2, 0.9, 0.25, 1.1);
}
.hist i.empty { height: 3px; background: var(--rule); border-radius: 0; }
.hist .avgmark {
  position: absolute;
  left: var(--x, 50%);
  top: -8px;
  bottom: -9px;
  width: 10px;
  margin-left: -5px;
  background: var(--accent);
  border: 2.5px solid var(--ink);
  border-radius: 5px;
  transition: left 0.9s cubic-bezier(0.2, 0.9, 0.25, 1.05);
}
.hist + .ends { margin-top: 12px; }

.bars { margin-top: 12px; display: grid; gap: 10px; }
.bar-label { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-weight: 800; font-size: 15px; line-height: 1.15; }
.bar-label span:first-child { min-width: 0; overflow-wrap: anywhere; }
.bar {
  height: 24px;
  margin-top: 4px;
  border: var(--line);
  border-radius: 9px;
  background: #fff;
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  width: var(--w, 0%);
  background: var(--ink);
  transition: width 0.8s cubic-bezier(0.2, 0.9, 0.25, 1.05);
}
.bar-row.win .bar i { background: var(--accent); box-shadow: 3px 0 0 var(--ink); }

.crowned {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
}
.crowned svg { flex: none; width: 46px; height: 38px; }
.crowned .who { font-size: 22px; font-weight: 900; line-height: 1.05; color: var(--accent); overflow-wrap: anywhere; }
.crowned .what { font-weight: 700; font-size: 14px; color: var(--soft); }
.pop .crowned svg { animation: pop 0.6s 0.9s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
.pop .crowned { animation: rise 0.45s 0.75s ease-out both; }
@keyframes pop {
  from { transform: translateY(-26px) rotate(-30deg) scale(0.3); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes rise {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.crownlet { display: inline-block; width: 22px; height: 18px; margin-right: 6px; vertical-align: -2px; }
.row.me .row-top .name::after {
  content: "you";
  margin-left: 7px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  vertical-align: 2px;
}

.lb { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 2px 8px; }
.lb .rank { font-weight: 900; font-size: 20px; font-variant-numeric: tabular-nums; }
.lb .who { font-weight: 800; font-size: 17px; overflow-wrap: anywhere; }
.lb .who small { display: block; color: var(--mute); font-weight: 600; font-size: 13px; }
.lb .pts { font-size: 22px; text-align: right; }
.lb > * { padding: 7px 0; }
.lb .sep { grid-column: 1 / -1; padding: 0; border-top: 2px dashed var(--rule); }

.next { text-align: center; font-weight: 700; color: var(--soft); }
.next .count { font-size: 18px; }

/* ---------- history ---------- */

.day {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--paper);
  color: var(--ink);
  border: var(--line);
  border-radius: 16px;
  box-shadow: 4px 4px 0 var(--ink);
  padding: 12px 14px;
  width: calc(100% - 5px);
}
.day:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.day-top { display: flex; justify-content: space-between; gap: 10px; font-weight: 800; font-size: 14px; color: var(--mute); }
.day-q { margin-top: 3px; font-weight: 900; font-size: 17px; line-height: 1.15; }
.day-a { margin-top: 4px; font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }

/* ---------- help and toast ---------- */

dialog {
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 20px;
  border: var(--line);
  border-radius: 20px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(18, 18, 43, 0.62); }
dialog h2 { font-size: 24px; font-weight: 900; letter-spacing: -0.02em; }
dialog ol { margin: 12px 0; padding-left: 22px; display: grid; gap: 8px; font-weight: 600; }
dialog p { margin: 10px 0; font-weight: 600; }
dialog li::marker { font-weight: 900; }

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

/* ---------- plain pages (privacy) ---------- */

.prose { font-weight: 600; line-height: 1.5; }
.prose h1 { font-size: 30px; font-weight: 900; letter-spacing: -0.02em; margin-bottom: 10px; }
.prose a { color: var(--ink); font-weight: 800; }

/* ---------- small phones ---------- */

@media (max-width: 350px) {
  .wrap { padding-left: 12px; padding-right: 12px; }
  .card { padding: 14px; }
  .num output { font-size: 64px; }
  .hugenum { font-size: 88px; }
  .tally strong { font-size: 54px; }
  .mark { font-size: 19px; }
  .opt { font-size: 16px; }
}
@media (max-height: 600px) {
  .num output { font-size: 60px; }
  .top { margin-bottom: 8px; }
  .stack { gap: 11px; }
}

/* ---------- laptop ---------- */

@media (min-width: 900px) {
  .wrap { max-width: 1000px; padding-top: 28px; }
  .top { margin-bottom: 28px; }
  .mark { font-size: 26px; }
  .cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 36px; align-items: start; }
  .narrow { max-width: 480px; margin: 0 auto; }
  .dock { position: static; background: none; padding-top: 6px; }
  .hero { padding-top: 40px; }
  .hero h1 { font-size: 104px; }
  .hero p { margin-top: 36px; font-size: 24px; max-width: 16em; }
  .toast { bottom: 32px; }
}

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