:root {
  --bg: #f6f1ea;
  --surface: #fffaf3;
  --ink: #23191a;
  --muted: #7b6c69;
  --line: #e4d9cc;
  --wine: #8c1c2b;
  --wine-soft: #f3dfe0;
  --gold: #9a6f1c;
  --gold-soft: #f4e9d2;
  --green: #3e7a52;
  --bad: #c0392b;
  --news: #2f4a6b;
  --news-soft: #e2e9f2;
  --love: #b03a6b;
  --love-soft: #f6e1ea;
  --freegan: #5d7a2a;
  --freegan-soft: #e8efda;
  --fight: #b5521b;
  --fight-soft: #f6e4d8;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141011; --surface: #1d1718; --ink: #f1e8e3; --muted: #a2928e; --line: #33292a;
    --wine: #e0566a; --wine-soft: #3a1c22; --gold: #e0b45a; --gold-soft: #332816; --green: #6fbf87; --bad: #ff6b5e;
    --news: #8fb3e0; --news-soft: #1c2533; --love: #ec7fae; --love-soft: #361d29;
    --freegan: #a6c66a; --freegan-soft: #232b17; --fight: #f08a4f; --fight-soft: #35221a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141011; --surface: #1d1718; --ink: #f1e8e3; --muted: #a2928e; --line: #33292a;
  --wine: #e0566a; --wine-soft: #3a1c22; --gold: #e0b45a; --gold-soft: #332816; --green: #6fbf87; --bad: #ff6b5e;
  --news: #8fb3e0; --news-soft: #1c2533; --love: #ec7fae; --love-soft: #361d29;
  --freegan: #a6c66a; --freegan-soft: #232b17; --fight: #f08a4f; --fight-soft: #35221a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 "Onest", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ——— intro / ending ——— */
.screen.intro, .screen.ending {
  max-width: 620px; margin: 0 auto; padding: 12vh 16px 48px;
  display: flex; flex-direction: column; gap: 18px;
}
.ka { font-family: "Noto Sans Georgian", serif; color: var(--wine); font-size: 22px; letter-spacing: .08em; }
h1 { font-family: "Unbounded", sans-serif; font-weight: 700; font-size: clamp(34px, 8vw, 58px); line-height: 1.02; margin: 0; letter-spacing: -.02em; }
.lead { font-size: 18px; margin: 0; text-wrap: pretty; }
.charcard { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.charcard p { margin: 0; }
.charcard p + p { margin-top: 6px; font-size: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.primary, .ghost { border-radius: 999px; padding: 12px 22px; font-weight: 600; border: 1px solid var(--wine); }
.primary { background: var(--wine); color: #fff; }
.ghost { background: transparent; color: var(--wine); }
.primary:hover { filter: brightness(1.08); }
.ghost:hover { background: var(--wine-soft); }
.fine { font-size: 13px; color: var(--muted); margin: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 6px 0; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { margin: 0; font: 600 20px "Unbounded", sans-serif; font-variant-numeric: tabular-nums; }

/* ——— карта выборов ——— */
.pathwrap h2 { font: 700 20px "Unbounded", sans-serif; margin: 18px 0 4px; }
.pathwrap h2 span { font: 400 14px "Onest", sans-serif; }
.pathwrap > p { margin: 0 0 14px; }
.path { list-style: none; margin: 0; padding: 0 0 0 22px; position: relative; }
.path::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.node { position: relative; padding: 0 0 22px; }
.node .dot { position: absolute; left: -22px; top: 5px; width: 14px; height: 14px; border-radius: 50%; background: var(--bg); border: 3px solid var(--wine); }
.node.tag-news .dot { border-color: var(--news); }
.node.tag-love .dot { border-color: var(--love); }
.node.tag-freegan .dot { border-color: var(--freegan); }
.node.tag-fight .dot, .node.tag-drama .dot { border-color: var(--fight); }
.node.tag-bar .dot { border-color: var(--gold); }
.node.final .dot { background: var(--gold); border-color: var(--gold); }
.nmeta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.autotag { font-size: 11px; border: 1px dashed var(--muted); border-radius: 999px; padding: 0 7px; }
.ntext { margin: 4px 0 6px; font-size: 15px; text-wrap: pretty; }
.opts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.opts .yes { color: var(--wine); font-weight: 600; }
.opts .no { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 50%, transparent); }
.nres { margin: 6px 0 0; font-size: 14px; color: var(--muted); padding-left: 10px; border-left: 2px solid var(--gold); }

/* ——— game ——— */
.game { max-width: 1120px; margin: 0 auto; padding: 0 16px 96px; }
.top {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  display: grid; grid-template-columns: auto auto 1fr; gap: 10px 28px; align-items: center;
  padding: 16px 0 12px; border-bottom: 1px solid var(--line);
}
.date { font: 700 26px/1.1 "Unbounded", sans-serif; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.money #money { font: 600 22px "Unbounded", sans-serif; color: var(--green); font-variant-numeric: tabular-nums; }
.money #money.neg { color: var(--bad); }
.bars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.bar label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.bar label b { color: var(--ink); font-variant-numeric: tabular-nums; }
.track { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 4px; }
.track i { display: block; height: 100%; background: var(--wine); border-radius: 3px; transition: width .5s ease; }
.bar.low .track i { background: var(--bad); }
.bar.low label b { color: var(--bad); }
.counters { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.counters b { color: var(--ink); font-variant-numeric: tabular-nums; }
.counters em { font-style: normal; }
.timeline { grid-column: 1 / -1; position: relative; display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); padding-top: 8px; }
.timeline::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--line); border-radius: 2px; }
.timeline i { position: absolute; left: 0; top: 0; height: 3px; background: var(--gold); border-radius: 2px; transition: width .5s ease; }

.tabs { display: none; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; margin-top: 18px; }
.feed { display: flex; flex-direction: column; gap: 10px; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px;
  animation: in .35s ease both;
}
@keyframes in { from { opacity: 0; transform: translateY(-6px); } }
.card:first-child { border-color: var(--ink); }
.card .meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.card time { font-variant-numeric: tabular-nums; }
.badge { padding: 1px 8px; border-radius: 999px; font-weight: 600; font-size: 11px; letter-spacing: .02em; text-transform: uppercase; }
.card p { margin: 0; text-wrap: pretty; }
.card .result { margin-top: 10px; padding-left: 12px; border-left: 3px solid var(--gold); }
.card.tag-filler { background: transparent; border-style: dashed; padding: 10px 18px; color: var(--muted); font-size: 15px; }
.card.tag-filler:first-child { border-color: var(--muted); }
.tag-news .badge { background: var(--news-soft); color: var(--news); }
.tag-news { border-left: 4px solid var(--news); }
.tag-life .badge { background: var(--wine-soft); color: var(--wine); }
.tag-love .badge { background: var(--love-soft); color: var(--love); }
.tag-love { border-left: 4px solid var(--love); }
.tag-freegan .badge { background: var(--freegan-soft); color: var(--freegan); }
.tag-freegan { border-left: 4px solid var(--freegan); }
.tag-fight .badge { background: var(--fight-soft); color: var(--fight); }
.tag-fight { border-left: 4px solid var(--fight); }
.tag-bar .badge { background: var(--gold-soft); color: var(--gold); }
.tag-bar { border-left: 4px solid var(--gold); }
.tag-drama .badge { background: var(--fight-soft); color: var(--fight); }
.tag-drama { border-left: 4px dashed var(--fight); }

.choices { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.choice {
  text-align: left; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px;
  transition: border-color .15s, background .15s;
}
.choice:hover:not(:disabled) { border-color: var(--wine); background: var(--wine-soft); }
.choice:disabled { cursor: default; }
.choice.picked { border-color: var(--wine); background: var(--wine-soft); font-weight: 600; }
.choice.faded { opacity: .4; }
body.awaiting .card:first-child { box-shadow: 0 0 0 3px var(--wine-soft); border-color: var(--wine); }

.tlwrap { position: sticky; top: 210px; align-self: start; max-height: calc(100vh - 300px); display: flex; flex-direction: column; }
.tlwrap h2 { font: 700 16px "Unbounded", sans-serif; margin: 0 0 10px; }
.tl { overflow-y: auto; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.tl:empty::after { content: "Пока тихо. Твиттер просыпается."; padding: 16px; color: var(--muted); font-size: 14px; }
.tweet { display: grid; grid-template-columns: 36px 1fr; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); animation: in .35s ease both; }
.tweet:last-child { border-bottom: 0; }
.ava { width: 36px; height: 36px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.who { font-size: 13px; font-weight: 600; }
.who span { font-weight: 400; color: var(--muted); }
.ttext { font-size: 14px; line-height: 1.4; }

.controls {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 10;
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  box-shadow: 0 6px 24px rgba(0,0,0,.12); max-width: calc(100vw - 32px);
}
.pause { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--wine); color: #fff; font-size: 13px; flex: none; }
.speeds { display: flex; gap: 2px; }
.speeds button { border: 0; background: transparent; padding: 8px 10px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.speeds button.on { background: var(--wine-soft); color: var(--wine); }
.auto { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; padding-right: 8px; white-space: nowrap; }
.auto input { accent-color: var(--wine); }

@media (max-width: 860px) {
  .top { grid-template-columns: 1fr auto; gap: 8px 16px; padding-top: 12px; }
  .bars { grid-column: 1 / -1; }
  .date { font-size: 20px; }
  .money #money { font-size: 18px; text-align: right; }
  .money { text-align: right; }
  .counters em { display: none; }
  .tabs { display: flex; gap: 6px; margin-top: 12px; }
  .tabs button { flex: 1; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px; font-weight: 600; }
  .tabs button.on { border-color: var(--wine); color: var(--wine); background: var(--wine-soft); }
  .count { background: var(--wine); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 12px; margin-left: 4px; }
  .cols { grid-template-columns: minmax(0, 1fr); margin-top: 12px; }
  .tlwrap { position: static; max-height: none; }
  .tlwrap h2 { display: none; }
  body.mob-feed .tlwrap { display: none; }
  body.mob-tl .feed { display: none; }
  .speeds button { padding: 8px 7px; }
  .auto { padding-right: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .card, .tweet { animation: none; }
  .track i, .timeline i { transition: none; }
}
