:root {
  --bg: #f5f8f7; --panel: #ffffff; --ink: #14201d; --muted: #5b6b67; --line: #dfe7e4;
  --accent: #0d6b5a; --accent-ink: #ffffff; --accent-soft: #e0f1ec; --gold: #b26a00; --gold-soft: #fbefd9;
  --silver: #6b7a86; --bronze: #9a5b2e; --warn: #8a5a00; --warn-soft: #fff6e0; --bad: #b23a2e;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1614; --panel: #16201d; --ink: #e4ece9; --muted: #9aaba6; --line: #2a3834;
    --accent: #5cc9b0; --accent-ink: #062b23; --accent-soft: #183a32; --gold: #f0b54d; --gold-soft: #3a2c12;
    --silver: #b4c0c9; --bronze: #d9a074; --warn: #f0c46b; --warn-soft: #33290f; --bad: #f08a7f;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--body); }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 8vw, 2.6rem); letter-spacing: -0.01em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
.wrap { max-width: 640px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 56px max(16px, env(safe-area-inset-left)); display: flex; flex-direction: column; gap: 18px; }
.wrap.wide { max-width: 1100px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { font-family: var(--display); font-weight: 700; letter-spacing: 0.14em; font-size: 0.95rem; color: var(--accent); text-decoration: none; }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--panel); }
.lang button { border: 0; background: transparent; color: var(--muted); font: 600 0.8rem var(--body); padding: 6px 12px; cursor: pointer; min-height: 32px; }
.lang button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.hero { display: flex; flex-direction: column; gap: 6px; }
.eyebrow { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.banner { background: var(--warn-soft); color: var(--warn); border-radius: 12px; padding: 10px 14px; font-size: 0.9rem; }
.banner.info { background: var(--accent-soft); color: var(--accent); }
.stamp { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 0.85rem; color: var(--muted); }
.stamp b { color: var(--ink); font-weight: 600; }

.tabs { display: flex; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.tabs button { flex: 1; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: 600 0.9rem var(--body); padding: 9px 8px; min-height: 40px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }

ol.board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
ol.board li { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
ol.board li:last-child { border-bottom: 0; }
.rank { font-family: var(--display); font-weight: 700; font-size: 1.05rem; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.r1 .rank, .r2 .rank, .r3 .rank { border-radius: 999px; width: 2rem; height: 2rem; display: grid; place-items: center; justify-self: center; font-size: 0.95rem; }
.r1 .rank { background: var(--gold-soft); color: var(--gold); }
.r2 .rank { background: color-mix(in srgb, var(--silver) 18%, transparent); color: var(--silver); }
.r3 .rank { background: color-mix(in srgb, var(--bronze) 18%, transparent); color: var(--bronze); }
.handle { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amount { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.prize-tag { display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--gold-soft); color: var(--gold); margin-left: 6px; vertical-align: 1px; }
.empty { text-align: center; padding: 22px 8px; color: var(--muted); }
ol.board li.empty { display: block; }

.ladder { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ladder li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--bg); }
.ladder li.top { background: var(--gold-soft); }
.ladder .win { font-family: var(--display); font-weight: 700; color: var(--gold); white-space: nowrap; }
.ladder li.top .win { white-space: normal; text-align: right; }
.ladder li.reached { outline: 2px solid var(--accent); }

.weeks { display: flex; flex-direction: column; gap: 10px; }
.week { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 10px; background: var(--bg); }
.week-head { display: flex; justify-content: space-between; gap: 8px; font-size: 0.9rem; }
.pill { font-size: 0.72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--line); color: var(--muted); white-space: nowrap; }
.pill.live { background: var(--accent); color: var(--accent-ink); }
.winners { display: flex; flex-direction: column; gap: 2px; font-size: 0.92rem; }
.winners div { display: flex; justify-content: space-between; gap: 8px; }

.big { font-family: var(--display); font-weight: 700; font-size: clamp(2.2rem, 11vw, 3rem); line-height: 1; font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--bg); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-family: var(--display); font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.stat span { font-size: 0.8rem; color: var(--muted); }
.meter { position: relative; height: 12px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; }
.meter > i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 999px; }
.marks { position: relative; height: 34px; font-size: 0.72rem; color: var(--muted); }
.marks span { position: absolute; top: 0; transform: translateX(-50%); text-align: center; white-space: nowrap; line-height: 1.25; }
.marks span:last-child { transform: translateX(-100%); text-align: right; }
.marks span.hit { color: var(--accent); font-weight: 600; }
.next { font-weight: 600; }
.next em { font-style: normal; color: var(--gold); }

ul.rules { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 6px; font-size: 0.92rem; }
footer { font-size: 0.8rem; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }

/* admin */
form.login { display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--muted); }
input, select { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; min-height: 40px; }
button.primary, a.button, button.ghost { font: 600 0.9rem var(--body); border-radius: 8px; padding: 9px 14px; min-height: 40px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
button.primary { background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); }
button.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.toolbar label { flex: 1 1 180px; }
.scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
thead th { font-size: 0.72rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); background: var(--bg); position: sticky; top: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.copy { font: 600 0.78rem var(--body); border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.error { color: var(--bad); font-size: 0.9rem; }
[hidden] { display: none !important; }
