:root {
  --bg: #fbf8f3;
  --surface: #ffffff;
  --text: #1f1b16;
  --muted: #6b6258;
  --line: #e6dfd3;
  --accent: #b45309;
  --ok: #166534;
  --ok-bg: #dcfce7;
  --warn: #92400e;
  --warn-bg: #fef3c7;
  --none: #57534e;
  --none-bg: #ece8e1;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17140f;
    --surface: #211d16;
    --text: #f3ede2;
    --muted: #a39a8c;
    --line: #38322a;
    --accent: #f59e0b;
    --ok: #86efac;
    --ok-bg: #14301f;
    --warn: #fcd34d;
    --warn-bg: #3a2c0a;
    --none: #d6d0c6;
    --none-bg: #2e2922;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }

main, .site-header {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 16px;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.lang-switch { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; }

h1 { font-size: 1.6rem; line-height: 1.2; margin: 1rem 0 0.5rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.5rem; }
h3 { font-size: 1.05rem; margin: 0 0 0.25rem; }

.basis { margin: 1rem 0 0; font-weight: 600; }
.fictional, .coverage, .constituencies, .status, .crumbs { color: var(--muted); font-size: 0.9rem; margin: 0.25rem 0; }
.status.error { color: var(--warn); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 12px 0;
}

.areas, .stations, .totals, .languages { list-style: none; margin: 0; padding: 0; }
.areas { display: grid; gap: 0 12px; grid-template-columns: 1fr; }
.constituencies a { display: inline-block; margin-right: 10px; }

.stations { display: grid; grid-template-columns: 1fr; gap: 4px 12px; }
.stations li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 6px 0; border-top: 1px solid var(--line); }

.total { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; margin: 10px 0; }
.total .votes { font-variant-numeric: tabular-nums; }
.total .track { grid-column: 1 / -1; height: 10px; background: var(--none-bg); border-radius: 5px; overflow: hidden; }
.total .bar { display: block; height: 100%; background: var(--accent); }

.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; background: var(--none-bg); color: var(--none); }
.chip-published { background: var(--ok-bg); color: var(--ok); }
.chip-held { background: var(--warn-bg); color: var(--warn); }
.chip:empty { display: none; }

.figures { width: 100%; border-collapse: collapse; }
.figures th, .figures td { padding: 8px 0; border-top: 1px solid var(--line); text-align: left; }
.figures td { text-align: right; font-variant-numeric: tabular-nums; }

.sheet { margin: 0; }
.sheet img { display: block; max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); }

.languages a { display: inline-block; padding: 12px 0; font-size: 1.2rem; }

@media (min-width: 640px) {
  .areas, .stations { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1000px) {
  .areas { grid-template-columns: 1fr 1fr 1fr; }
  .stations { grid-template-columns: repeat(3, 1fr); }
}
