/* Closest — a dark table with a paper card on it. One committed look:
   this is a game played in the evening, so it does not follow the system into
   a white screen halfway through the deep round. */

:root {
  color-scheme: dark;
  --ink: #FAF6EE;
  --dim: #A69C8E;
  --faint: #6D6459;
  --paper: #FAF6EE;
  --paper-ink: #17140F;
  --paper-dim: #6B6255;
  --r: 20px;
  --ui: "DM Sans", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --serif: "Fraunces", ui-serif, Georgia, "Times New Roman", serif;
}

[data-depth="1"] { --accent: #F2A340; --glow: 242 163 64; --table: #14110F; }
[data-depth="2"] { --accent: #3CB79A; --glow: 60 183 154;  --table: #0E1412; }
[data-depth="3"] { --accent: #9C8BF2; --glow: 156 139 242; --table: #100F16; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--ui);
  color: var(--ink);
  background: #14110F;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.table {
  min-height: 100dvh;
  background:
    radial-gradient(120% 70% at 50% -10%, rgb(var(--glow) / 0.16), transparent 62%),
    radial-gradient(90% 50% at 50% 110%, rgb(var(--glow) / 0.07), transparent 60%),
    var(--table);
  transition: background-color .6s ease;
  display: flex;
  flex-direction: column;
  padding: max(18px, env(safe-area-inset-top)) 18px calc(20px + env(safe-area-inset-bottom));
}

.screen {
  width: 100%;
  max-width: 33rem;
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  animation: rise .32s cubic-bezier(.2, .8, .3, 1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) { .screen { animation: none; } }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: -.01em; }

/* ── buttons ──────────────────────────────────────────────────────────── */

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { opacity: .35; cursor: default; }

.big {
  width: 100%;
  padding: 16px 20px;
  border-radius: 14px;
  background: var(--accent);
  color: #16130E;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -.01em;
  transition: transform .12s ease, filter .2s ease;
}
.big:hover:not(:disabled) { filter: brightness(1.06); }
.big:active:not(:disabled) { transform: scale(.985); }

.quiet {
  display: block;
  width: 100%;
  padding: 13px;
  margin-top: 8px;
  color: var(--dim);
  font-size: .92rem;
  border-radius: 12px;
  transition: color .2s ease, background .2s ease;
}
.quiet:hover { color: var(--ink); background: #ffffff0a; }
.quiet.tiny { width: auto; padding: 6px 10px; margin: 0; font-size: .82rem; }

.link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; padding: 0; }

/* ── setup ────────────────────────────────────────────────────────────── */

.mast { padding: 2.2vh 0 1.8vh; text-align: center; }
.mast h1 {
  font-size: clamp(2.4rem, 11.5vw, 3.5rem);
  font-variation-settings: "SOFT" 40, "WONK" 1;
  letter-spacing: -.035em;
  line-height: .95;
}
.mast .line {
  margin: 10px auto 0;
  max-width: 20rem;
  color: var(--dim);
  font-size: .95rem;
  line-height: 1.4;
}

.block { margin-bottom: 15px; }
.block h2 { font-size: 1.05rem; margin-bottom: 9px; }

.names { list-style: none; display: flex; flex-wrap: wrap; gap: 7px; padding: 0; margin: 0 0 9px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 9px 8px 14px;
  border-radius: 999px;
  background: #ffffff12;
  font-size: .96rem; font-weight: 500;
}
.chip.ghost { color: var(--faint); background: none; border: 1px dashed #ffffff20; padding: 8px 14px; }
.chip .x {
  width: 20px; height: 20px; line-height: 18px; border-radius: 999px;
  background: #ffffff14; color: var(--dim); font-size: 15px; padding: 0;
}
.chip .x:hover { background: var(--accent); color: #16130E; }

.addname { display: flex; gap: 8px; }
.addname input {
  flex: 1; min-width: 0;
  font: inherit; color: var(--ink);
  padding: 12px 15px;
  border-radius: 12px;
  border: 1px solid #ffffff1c;
  background: #ffffff08;
}
.addname input::placeholder { color: var(--faint); }
.addname input:focus { outline: none; border-color: rgb(var(--glow) / .55); background: #ffffff0e; }
.addname button {
  padding: 0 18px; border-radius: 12px;
  background: #ffffff14; font-weight: 600; font-size: .94rem;
}
.addname button:hover { background: #ffffff22; }

.groups { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.group {
  text-align: left;
  padding: 9px 12px;
  border-radius: 13px;
  border: 1px solid #ffffff14;
  background: #ffffff06;
  transition: border-color .18s ease, background .18s ease;
}
.group b { display: block; font-size: .92rem; font-weight: 600; }
.group i { display: block; margin-top: 2px; font-style: normal; font-size: .72rem; color: var(--faint); line-height: 1.25; }
.group:hover { background: #ffffff0c; }
.group.on { border-color: var(--accent); background: rgb(var(--glow) / .12); }
.group.on i { color: var(--dim); }

.note { color: var(--dim); font-size: .86rem; line-height: 1.5; margin: 0 0 14px; }
.note b { color: var(--ink); }

.cta { margin-top: auto; }
.minor { display: flex; gap: 8px; }
.minor .quiet { margin-top: 6px; }
.foot { color: var(--faint); font-size: .76rem; line-height: 1.45; text-align: center; margin: 12px 0 0; }
.foot .link { font-size: .78rem; }

/* ── the deal ─────────────────────────────────────────────────────────── */

.deal { justify-content: center; }
.dealtitle { font-size: 1.7rem; margin-bottom: 22px; }
.rules { margin: 0 0 22px; padding-left: 1.3em; }
.rules li { margin-bottom: 15px; line-height: 1.5; color: var(--dim); font-size: .97rem; }
.rules li::marker { color: var(--accent); font-weight: 700; }
.rules b { color: var(--ink); font-weight: 600; }
.rules i { font-style: italic; }
.dealnote {
  border-left: 2px solid var(--accent);
  padding: 4px 0 4px 14px;
  margin: 0 0 26px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.4;
}

/* ── play ─────────────────────────────────────────────────────────────── */

.hud {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.badge {
  font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent);
  padding: 5px 10px; border-radius: 999px;
  background: rgb(var(--glow) / .14);
}
.count { color: var(--faint); font-size: .82rem; font-variant-numeric: tabular-nums; margin-left: auto; }
.hud .quiet.tiny { margin-left: 0; }

.card {
  position: relative;
  flex: 1;
  min-height: 44dvh;
  display: flex; flex-direction: column;
  padding: 26px 24px 22px;
  border-radius: var(--r);
  background:
    linear-gradient(168deg, #FFFDF8, var(--paper) 55%, #F1EADC);
  color: var(--paper-ink);
  box-shadow: 0 26px 60px -22px rgb(0 0 0 / .8), 0 2px 0 rgb(255 255 255 / .1) inset;
  animation: deal .34s cubic-bezier(.2, .85, .3, 1) both;
}
@keyframes deal { from { opacity: 0; transform: translateY(14px) rotate(-.7deg); } }
@media (prefers-reduced-motion: reduce) { .card { animation: none; } }

.card.own::after {
  content: "yours";
  position: absolute; top: 16px; right: 18px;
  font-size: .64rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--paper-dim);
}

.subject {
  margin: 0 0 14px;
  font-size: .78rem; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase;
  color: #B0762A;
}
[data-depth="2"] .subject { color: #1F7A65; }
[data-depth="3"] .subject { color: #5B49B8; }

.qwrap { flex: 1; display: flex; flex-direction: column; justify-content: center; padding-bottom: 6%; }

.q {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.55rem, 6.4vw, 2.15rem);
  line-height: 1.16;
  letter-spacing: -.02em;
  font-variation-settings: "SOFT" 20;
  text-wrap: balance;
}
.kindhint {
  margin: 16px 0 0;
  color: var(--paper-dim);
  font-size: .84rem;
  line-height: 1.45;
}
.skip {
  align-self: flex-start;
  padding: 9px 0 0;
  color: var(--paper-dim);
  font-size: .82rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: #0000002e;
}
.skip:hover { color: var(--paper-ink); }

.acts { margin-top: 16px; }
.asklabel {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 1.1rem;
}
.picks { display: flex; flex-wrap: wrap; gap: 8px; }
.pick {
  flex: 1 1 40%;
  padding: 15px 12px;
  border-radius: 13px;
  border: 1px solid #ffffff1e;
  background: #ffffff0a;
  font-weight: 600; font-size: 1rem;
  transition: background .15s ease, border-color .15s ease, transform .12s ease;
}
.pick:hover { background: rgb(var(--glow) / .16); border-color: var(--accent); }
.pick:active { transform: scale(.97); }
.pick.none {
  flex: none; width: 100%; margin-top: 8px;
  font-weight: 500; color: var(--dim);
  border-style: dashed;
}
.pick.none:hover { color: var(--ink); }

.scores { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 16px 0 0; }
.sc {
  display: flex; align-items: baseline; gap: 6px;
  padding: 6px 11px; border-radius: 999px;
  background: #ffffff0a;
  font-size: .82rem;
}
.sc b { font-weight: 500; color: var(--dim); }
.sc span { font-weight: 700; font-variant-numeric: tabular-nums; }
.sc.pop { background: rgb(var(--glow) / .22); animation: pop .45s ease; }
.sc.pop b, .sc.pop span { color: var(--ink); }
@keyframes pop { 40% { transform: scale(1.12); } }

/* ── gate + end ───────────────────────────────────────────────────────── */

.gate, .end { justify-content: center; text-align: center; }
.gatekicker, .endkicker { color: var(--faint); font-size: .82rem; letter-spacing: .12em; text-transform: uppercase; margin: 0 0 10px; }
.gatetitle, .endtitle {
  font-size: clamp(2.6rem, 12vw, 3.6rem);
  letter-spacing: -.035em;
  color: var(--accent);
  font-variation-settings: "SOFT" 40;
  margin-bottom: 14px;
  line-height: 1.05;
}
.gatenote { color: var(--dim); font-size: 1rem; line-height: 1.5; max-width: 22rem; margin: 0 auto 34px; }
.gate .big, .end .big { max-width: 22rem; margin-inline: auto; }
.gate .quiet, .end .quiet { max-width: 24rem; margin-inline: auto; }

.final { list-style: none; padding: 0; margin: 0 auto 20px; width: 100%; max-width: 22rem; text-align: left; }
.final li {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 13px 4px;
  border-bottom: 1px solid #ffffff12;
}
.final li:last-child { border-bottom: 0; }
.final .who { display: flex; flex-direction: column; gap: 3px; }
.final b { font-weight: 500; font-size: 1.05rem; }
.final i { font-style: normal; font-size: .76rem; color: var(--faint); }
.final span { font-family: var(--serif); font-size: 1.4rem; font-variant-numeric: tabular-nums; color: var(--dim); }
.final .top span { color: var(--accent); }
.endnote { color: var(--faint); font-size: .84rem; margin: 0 0 26px; }

/* ── the questions ────────────────────────────────────────────────────── */

.deck h2, .about h2 { font-size: 1.7rem; margin-bottom: 16px; }
.deck .hud { margin-bottom: 8px; }

.write { margin-bottom: 22px; }
.write label { display: block; font-size: .84rem; color: var(--dim); margin-bottom: 7px; }
.write textarea {
  width: 100%; font: inherit; color: var(--ink);
  padding: 13px 15px; border-radius: 12px;
  border: 1px solid #ffffff1c; background: #ffffff08;
  resize: vertical;
}
.write textarea:focus { outline: none; border-color: rgb(var(--glow) / .55); }
.wrow { display: flex; gap: 8px; margin-top: 8px; }
.wrow select {
  flex: 1; min-width: 0; font: inherit; color: var(--ink);
  padding: 11px 12px; border-radius: 11px;
  border: 1px solid #ffffff1c; background: #ffffff08;
}
.wrow button { padding: 0 20px; border-radius: 11px; background: var(--accent); color: #16130E; font-weight: 700; }

.mine h3 { font-size: 1rem; margin-bottom: 8px; color: var(--dim); }
.mine .quiet { text-align: left; padding-left: 0; color: var(--accent); }

.filters { display: flex; gap: 6px; margin: 18px 0 12px; }
.filt {
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid #ffffff16; background: #ffffff06;
  font-size: .85rem; color: var(--dim);
}
.filt.on { background: rgb(var(--glow) / .16); border-color: var(--accent); color: var(--ink); }

.qlist { list-style: none; padding: 0; margin: 0; }
.qlist li {
  display: flex; align-items: baseline; gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid #ffffff0d;
  font-size: .95rem; line-height: 1.4;
}
.qlist .qt { flex: 1; }
.qlist .d {
  flex: none; width: 3.1rem;
  font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 700;
}
.qlist .d1 { color: #F2A340; }
.qlist .d2 { color: #3CB79A; }
.qlist .d3 { color: #9C8BF2; }
.qlist .tag { font-size: .66rem; color: var(--faint); text-transform: uppercase; letter-spacing: .1em; }
.qlist .x { color: var(--faint); font-size: 1.1rem; padding: 0 4px; }
.qlist .x:hover { color: #E4674F; }

/* ── about ────────────────────────────────────────────────────────────── */

.about p { color: var(--dim); line-height: 1.65; font-size: .97rem; margin: 0 0 16px; max-width: 32rem; }
.about i { color: var(--ink); font-style: italic; }
.about h3 { font-size: 1.1rem; margin: 26px 0 10px; }
.about a { color: var(--accent); }
.colophon { font-size: .84rem !important; color: var(--faint) !important; margin-top: 30px !important; }

/* ── toast ────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  left: 50%; top: calc(10px + env(safe-area-inset-top));
  transform: translateX(-50%);
  padding: 11px 18px;
  border-radius: 999px;
  background: #241F18;
  border: 1px solid #ffffff1c;
  color: var(--ink);
  font-size: .88rem; font-weight: 500;
  box-shadow: 0 14px 40px -12px #000;
  animation: toastin .26s ease both;
  z-index: 10;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast.gold { background: var(--accent); color: #16130E; border-color: transparent; font-weight: 700; }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, -10px); } }

@media (min-width: 700px) {
  .table { padding-top: 4vh; }
  .card { min-height: 40dvh; padding: 34px 32px 26px; }
}
