:root {
  --bg: #f6f1e7;
  --card: #fffdf8;
  --ink: #1f2a24;
  --muted: #5f6b63;
  --line: #e2d9c7;
  --felt: #1f5a43;
  --chip: #b8402f;
  --good: #dcebe2;
  --luck: #f3e6c8;
  --bad: #f2d8d2;
  --bar: #e9e1d0;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14231c;
    --card: #1b2e25;
    --ink: #ece6d8;
    --muted: #a7b2aa;
    --line: #2c4337;
    --felt: #7cc4a1;
    --chip: #ee8a74;
    --good: #23463a;
    --luck: #3e3a24;
    --bad: #4a2c27;
    --bar: #253b30;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 18px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100svh;
}
body.host { padding-bottom: 96px; }

.top {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 560px; margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) 18px 6px;
}
.brand { font-weight: 700; color: var(--chip); letter-spacing: .01em; }
.dots { display: flex; gap: 5px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.dots i.past { background: var(--muted); opacity: .5; }
.dots i.on { background: var(--chip); }

main { max-width: 560px; margin: 0 auto; padding: 18px 18px 28px; }
.wait { color: var(--muted); }

h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 2.4rem; }
h2 { font-size: 1.7rem; }
h3 { font-size: 1.05rem; margin-bottom: .4em; }
.kicker { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 700; color: var(--felt); margin: 0 0 .6em; }
.lede { font-size: 1.12rem; color: var(--muted); }
.hint { margin-top: 2em; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.story { font-size: 1.15rem; padding: 16px 18px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--chip); border-radius: 12px; margin: 0 0 1em; }
.ask { font-size: 1.45rem; }
.foot { margin-top: 1.6em; font-size: 1.1rem; }

.points { padding: 0; list-style: none; margin: 1em 0 0; }
.points li { padding: 12px 0 12px 26px; border-top: 1px solid var(--line); position: relative; }
.points li::before { content: ""; position: absolute; left: 4px; top: 22px; width: 9px; height: 9px; border-radius: 50%; background: var(--chip); }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 1.1em 0; }
.choice {
  font: inherit; font-size: 1.25rem; font-weight: 700; padding: 18px 0; border-radius: 14px; cursor: pointer;
  border: 2px solid var(--felt); background: var(--card); color: var(--felt);
}
.choice.on { background: var(--felt); color: var(--bg); }
.choice:active { transform: scale(.98); }

.bar { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 10px; margin: 8px 0; }
.bar .name { font-weight: 600; }
.bar .fill { height: 26px; min-width: 3px; width: 0; border-radius: 6px; background: var(--muted); opacity: .55; justify-self: start; }
.bar.mine .fill { background: var(--chip); opacity: 1; }
.bar .num { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 74px; text-align: right; }
.bar .num small { font-weight: 400; color: var(--muted); }
.results { padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.total { color: var(--muted); font-size: .92rem; margin: .5em 0 0; }
.after { margin-top: 1.2em; padding: 14px 16px; border-radius: 12px; background: var(--good); }
.pair { padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 12px; }

.grid { display: grid; grid-template-columns: auto 1fr 1fr; gap: 8px; margin: 1.2em 0; align-items: stretch; }
.axis { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-align: center; align-self: end; }
.axis.side { writing-mode: vertical-rl; transform: rotate(180deg); align-self: center; padding: 0 2px; }
.cell { border-radius: 12px; padding: 14px 12px; min-height: 108px; display: flex; flex-direction: column; gap: 6px; }
.cell b { font-size: 1.02rem; }
.cell small { font-size: .85rem; color: var(--muted); line-height: 1.35; }
.cell.good { background: var(--good); }
.cell.luck { background: var(--luck); }
.cell.bad { background: var(--bad); }
.score .cell { min-height: 72px; justify-content: center; text-align: center; }

.offline {
  max-width: 560px; margin: 6px auto 0; padding: 8px 14px; width: calc(100% - 36px);
  border-radius: 10px; background: var(--bad); font-size: .9rem; text-align: center;
}
.notes {
  max-width: 560px; margin: 8px auto 0; padding: 12px 16px; font-size: .92rem; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 12px; width: calc(100% - 36px);
}
.notes::before { content: "Only you see this · "; font-weight: 700; color: var(--chip); }

.hostbar {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 10px 16px max(10px, env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line);
}
.hostbar button {
  font: inherit; font-size: 1.6rem; width: 64px; height: 50px; border-radius: 12px; border: 0;
  background: var(--chip); color: var(--bg); cursor: pointer;
}
.hostbar button:disabled { opacity: .35; }
.hostbar button.small { font-size: .8rem; width: auto; padding: 0 12px; background: transparent; color: var(--muted); border: 1px solid var(--line); }
#count { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 52px; text-align: center; }

@media (max-width: 360px) {
  h1 { font-size: 2rem; }
  .cell { padding: 10px 8px; }
  .hostbar { gap: 8px; }
}
.sub { margin-top: 1.4em; color: var(--chip); }
.book {
  display: block; width: min(52%, 210px); height: auto; margin: 4px auto 22px;
  border-radius: 4px; box-shadow: 0 10px 28px rgba(0, 0, 0, .22);
}
