/* Layout: a single matchday-programme column — form strip up top, ranked ballot below */
:root {
  --bg: #f4f5f7; --surface: #ffffff; --fg: #16181d; --muted: #5d6270; --line: #dcdfe5;
  --red: #c8102e; --red-soft: #fbe7ea;
  --win: #1f7a46; --draw: #8a6d00; --loss: #b3261e;
  --display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root {
  --bg: #121318; --surface: #1b1d24; --fg: #eceef2; --muted: #9aa0ad; --line: #2d303a;
  --red: #ff4d5e; --red-soft: #3a1a20;
  --win: #4cc283; --draw: #e0c04a; --loss: #ff6b61; color-scheme: dark } }

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 15px; line-height: 1.5; }
[hidden] { display: none !important; }
.wrap { max-width: 760px; margin: 0 auto; padding-block: 28px 140px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid; gap: 28px; }
h1, h2 { font-family: var(--display); text-transform: uppercase; letter-spacing: .01em; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(2.4rem, 8vw, 3.6rem); line-height: .95; font-weight: 800; }
h1 em { font-style: normal; color: var(--red); }
h2 { font-size: 1.5rem; font-weight: 600; }
.eyebrow { font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.lede { color: var(--muted); max-width: 62ch; margin: 0; }
header, section { display: grid; gap: 12px; }

.form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.res { display: inline-flex; gap: 8px; align-items: center; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-size: .85rem; }
.res b { font-family: var(--mono); width: 1.4em; height: 1.4em; display: grid; place-items: center; border-radius: 4px; color: var(--surface); font-size: .8rem; }
.res .L { background: var(--loss); } .res .D { background: var(--draw); } .res .W { background: var(--win); }
.res span { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.status { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; align-items: baseline; border-top: 3px solid var(--fg); padding-top: 12px; }
.note { font-size: .85rem; color: var(--muted); margin: 0; }
.tokens { display: flex; gap: 6px; align-items: center; font-size: .85rem; color: var(--muted); }
.tok { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--red); }
.tok.used { background: var(--red); }
.tok.picked { background: repeating-linear-gradient(45deg, var(--red) 0 2px, transparent 2px 4px); }
.chip.fan { background: transparent; border: 1px solid var(--red); }
.chip.warn { background: transparent; color: var(--draw); border: 1px solid var(--draw); }
#rising .rank { font-size: 1.5rem; }
.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: .9rem; }
.log li { display: grid; gap: 2px; border-bottom: 1px solid var(--line); padding-bottom: 8px; min-width: 0; overflow-wrap: anywhere; }
.log time { font-family: var(--mono); font-size: .75rem; color: var(--muted); }
.count-total { font-family: var(--mono); font-size: .85rem; color: var(--muted); }

ol.ballot { list-style: none; margin: 0; padding: 0; display: grid; }
.item { display: grid; grid-template-columns: 2.4rem 1fr auto; gap: 4px 14px; padding: 16px 0; border-bottom: 1px solid var(--line); align-items: start; }
.item.picked { background: var(--red-soft); margin-inline: -10px; padding-inline: 10px; border-radius: 6px; }
.rank { font-family: var(--display); font-weight: 800; font-size: 2rem; line-height: 1; color: var(--muted); font-variant-numeric: tabular-nums; }
.item.top .rank { color: var(--red); }
.body { min-width: 0; display: grid; gap: 4px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; padding: 2px 7px; border-radius: 3px; background: var(--red-soft); color: var(--red); }
.when { font-size: .75rem; color: var(--muted); }
.title { font-weight: 600; font-size: 1.05rem; margin: 0; }
.detail { color: var(--muted); margin: 0; font-size: .9rem; }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--red); width: 0; transition: width .4s ease; }
.count { font-family: var(--mono); font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.side { display: grid; gap: 6px; justify-items: end; }

button { font: inherit; cursor: pointer; border-radius: 6px; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.vote { border: 2px solid var(--red); background: transparent; color: var(--red); font-weight: 600; padding: 6px 14px; min-width: 6.5rem; }
.vote[aria-pressed="true"] { background: var(--red); color: var(--surface); }
.mine { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--red); }
.ghost { border: 1px solid var(--line); background: var(--surface); color: var(--fg); padding: 4px 10px; font-size: .8rem; }
.danger { border-color: var(--loss); color: var(--loss); }
.primary { border: 0; background: var(--red); color: #fff; padding: 10px 18px; font-weight: 600; }
.primary:disabled { opacity: .45; cursor: not-allowed; }
.empty { padding: 28px 0; color: var(--muted); border-bottom: 1px solid var(--line); }

.confirm { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 3px solid var(--red);
  box-shadow: 0 -8px 24px rgb(0 0 0 / .12);
  padding-block: 14px calc(14px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.confirm-in { max-width: 760px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; }
.confirm-text { min-width: 0; flex: 1 1 260px; }
.confirm-text strong { display: block; }
.confirm-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.msg { font-size: .85rem; min-height: 1.3em; margin: 0; }
.msg.err { color: var(--loss); }

.admin { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px; display: grid; gap: 14px; }
.admin form { display: grid; gap: 10px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label { display: grid; gap: 4px; font-size: .8rem; font-weight: 600; color: var(--muted); }
input, textarea, select { font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; min-width: 0; }
textarea { resize: vertical; min-height: 4.5em; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
footer { font-size: .8rem; color: var(--muted); display: grid; gap: 4px; }
footer a { color: inherit; }

@media (max-width: 520px) {
  .item { grid-template-columns: 2rem 1fr; }
  .side { grid-column: 2; justify-items: start; grid-auto-flow: column; align-items: center; justify-content: start; gap: 10px; }
  .row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .bar i { transition: none; } }
