/* ============ Refind design system ============
   Calm, utilitarian, sunlight-readable, one-handed.
   Status + recency dominate. Nothing decorative.  */

:root {
  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --ink: #1a1e24;
  --ink-2: #4a5462;
  --ink-3: #717c8a;
  --line: #d7dde4;
  --brand: #1f4f77;
  --brand-ink: #ffffff;
  --live: #c22f10;
  --live-bg: #fdeee9;
  --recent: #156c40;
  --recent-bg: #e9f5ee;
  --stale: #8a5c00;
  --stale-bg: #f8f1df;
  --ended: #667085;
  --ended-bg: #eef0f3;
  --mega: #6d28d9;
  --mega-bg: #f1eafd;
  --rare: #1d4ed8;
  --rare-bg: #e8effc;
  --notable: #47566a;
  --notable-bg: #ecf0f4;
  --danger: #b42318;
  --focus: #1d4ed8;
  --shadow: 0 1px 2px rgba(18, 24, 32, .05), 0 4px 16px rgba(18, 24, 32, .06);
  --radius: 14px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) { color-scheme: dark; } }

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg: #111519;
    --surface: #1a2026;
    --surface-2: #20262d;
    --ink: #e9edf1;
    --ink-2: #aeb8c2;
    --ink-3: #828d99;
    --line: #2f3843;
    --brand: #7fb5e0;
    --brand-ink: #0d1f30;
    --live: #ff6a45;
    --live-bg: #391b12;
    --recent: #4cc98a;
    --recent-bg: #142e20;
    --stale: #e0a93e;
    --stale-bg: #33290f;
    --ended: #9aa3b2;
    --ended-bg: #262a31;
    --mega: #b195f5;
    --mega-bg: #2b2144;
    --rare: #8ab0f7;
    --rare-bg: #1a2643;
    --notable: #9fb0c4;
    --notable-bg: #242b34;
    --danger: #ff7d70;
    --focus: #8ab0f7;
    --shadow: 0 1px 2px rgba(0,0,0,.35), 0 6px 20px rgba(0,0,0,.3);
  }
}
html[data-theme="dark"] {
  --bg: #111519;
  --surface: #1a2026;
  --surface-2: #20262d;
  --ink: #e9edf1;
  --ink-2: #aeb8c2;
  --ink-3: #828d99;
  --line: #2f3843;
  --brand: #7fb5e0;
  --brand-ink: #0d1f30;
  --live: #ff6a45;
  --live-bg: #391b12;
  --recent: #4cc98a;
  --recent-bg: #142e20;
  --stale: #e0a93e;
  --stale-bg: #33290f;
  --ended: #9aa3b2;
  --ended-bg: #262a31;
  --mega: #b195f5;
  --mega-bg: #2b2144;
  --rare: #8ab0f7;
  --rare-bg: #1a2643;
  --notable: #9fb0c4;
  --notable-bg: #242b34;
  --danger: #ff7d70;
  --focus: #8ab0f7;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 6px 20px rgba(0,0,0,.3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  font-size: 16px;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
::placeholder { color: var(--ink-3); }

.wrap { max-width: 660px; margin: 0 auto; padding: 0 14px; }

/* ---------- App bar ---------- */
.appbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding-top: var(--sat);
}
.appbar-in {
  max-width: 660px; margin: 0 auto; padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; letter-spacing: -.02em; }
.brand svg { display: block; }
.brand .tag { font-size: 11px; font-weight: 600; color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase; margin-top: 3px; }
.state-btn {
  display: flex; align-items: center; gap: 6px;
  font-weight: 700; font-size: 16px;
  padding: 10px 14px; margin-left: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  box-shadow: var(--shadow);
  max-width: 55%;
}
.state-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 999px; flex: none;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line);
}

/* ---------- Feed header ---------- */
.feed-head { padding: 18px 0 4px; }
.feed-title { font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.feed-live {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px; font-size: 14px; font-weight: 700; color: var(--ink-2);
  text-transform: uppercase; letter-spacing: .05em;
}
.pulse {
  width: 9px; height: 9px; border-radius: 50%; background: var(--live); flex: none;
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 45%, transparent); }
  75% { box-shadow: 0 0 0 9px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) { .pulse, .dot-live { animation: none !important; } }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 14px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 9px 15px; border-radius: 999px; font-size: 14px; font-weight: 650;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-2);
  min-height: 40px;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
select.chip { appearance: none; -webkit-appearance: none; padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23888' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }

/* ---------- Cards ---------- */
.cards { display: flex; flex-direction: column; gap: 12px; padding-bottom: 110px; }
.card {
  display: block; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
  position: relative;
  transition: transform .06s ease;
}
.card:active { transform: scale(.985); }
@media (hover: hover) { .card:hover { border-color: var(--ink-3); } }
.card.ended { opacity: .72; }
.card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.card-top .spacer { flex: 1; }
.card-county { font-size: 13px; font-weight: 650; color: var(--ink-3); }
.tier-chip {
  font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 6px;
}
.tier-mega { background: var(--mega-bg); color: var(--mega); }
.tier-rare { background: var(--rare-bg); color: var(--rare); }
.tier-notable { background: var(--notable-bg); color: var(--notable); }
.demo-chip {
  font-size: 11px; font-weight: 800; letter-spacing: .1em;
  padding: 3px 8px; border-radius: 6px;
  background: var(--stale-bg); color: var(--stale);
  border: 1.5px dashed color-mix(in srgb, var(--stale) 60%, transparent);
}
.demo-banner {
  margin-top: 14px; padding: 10px 14px; border-radius: 10px;
  font-size: 13.5px; font-weight: 800; letter-spacing: .05em; text-align: center;
  background: var(--stale-bg); color: var(--stale);
  border: 1.5px dashed color-mix(in srgb, var(--stale) 60%, transparent);
}
.btn-primary.is-demo { background: var(--stale); color: #fff; }
.card h3 { font-size: 21px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.card .place { margin-top: 2px; font-size: 15px; font-weight: 600; color: var(--ink-2); }

.status-line {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 10px; padding: 7px 12px; border-radius: 9px;
  font-size: 14px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
}
.status-line .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.status-live { background: var(--live-bg); color: var(--live); }
.status-live .dot { background: var(--live); animation: pulse 1.6s ease-out infinite; }
.status-recent { background: var(--recent-bg); color: var(--recent); }
.status-recent .dot { background: var(--recent); }
.status-stale { background: var(--stale-bg); color: var(--stale); }
.status-ended { background: var(--ended-bg); color: var(--ended); }
.status-line svg { flex: none; }

.card .latest {
  margin-top: 10px; font-size: 15px; color: var(--ink-2);
  border-left: 3px solid var(--line); padding-left: 10px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card .meta { margin-top: 9px; font-size: 13px; color: var(--ink-3); font-weight: 550; }
.card .meta strong { color: var(--ink-2); }

.section-label {
  margin: 22px 0 10px; font-size: 13px; font-weight: 800; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-3);
}

/* ---------- Empty / notices ---------- */
.empty {
  text-align: center; padding: 46px 20px; color: var(--ink-2);
  background: var(--surface-2); border: 1px dashed var(--line); border-radius: var(--radius);
}
.empty h3 { font-size: 18px; margin-bottom: 6px; color: var(--ink); }
.empty p { font-size: 14.5px; }
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-size: 13.5px; color: var(--ink-2); margin: 10px 0;
}

/* ---------- Report FAB ---------- */
.fab-wrap {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  padding: 10px 14px calc(12px + var(--sab));
  background: linear-gradient(transparent, color-mix(in srgb, var(--bg) 92%, transparent) 40%);
  pointer-events: none;
}
.fab {
  pointer-events: auto;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  max-width: 660px; margin: 0 auto; width: 100%;
  min-height: 56px; border-radius: 16px;
  background: var(--brand); color: var(--brand-ink);
  font-size: 17px; font-weight: 800; letter-spacing: .02em;
  box-shadow: 0 6px 24px rgba(0,0,0,.18);
}
.fab:active { transform: scale(.985); }

/* ---------- Event page ---------- */
.eventpage { padding-bottom: 40px; }
.backrow { display: flex; align-items: center; gap: 8px; padding: 12px 0 4px; }
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 700; font-size: 15px; color: var(--ink-2);
  padding: 8px 12px 8px 6px; border-radius: 10px; min-height: 44px;
}
.event-head { padding: 4px 0 0; }
.event-head h1 { font-size: 28px; font-weight: 800; letter-spacing: -.03em; line-height: 1.12; }
.event-head .sci { font-style: italic; color: var(--ink-3); font-size: 15px; margin-top: 2px; }
.event-head .where { margin-top: 6px; font-size: 16px; font-weight: 600; color: var(--ink-2); }

.status-hero {
  margin-top: 14px; border-radius: var(--radius); padding: 16px;
  border: 1px solid var(--line);
}
.status-hero.live { background: var(--live-bg); border-color: color-mix(in srgb, var(--live) 30%, transparent); }
.status-hero.recent { background: var(--recent-bg); border-color: color-mix(in srgb, var(--recent) 30%, transparent); }
.status-hero.stale { background: var(--stale-bg); border-color: color-mix(in srgb, var(--stale) 35%, transparent); }
.status-hero.ended { background: var(--ended-bg); }
.status-hero .big {
  display: flex; align-items: center; gap: 10px;
  font-size: 20px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase;
}
.status-hero.live .big { color: var(--live); }
.status-hero.recent .big { color: var(--recent); }
.status-hero.stale .big { color: var(--stale); }
.status-hero.ended .big { color: var(--ended); }
.status-hero .big .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.status-hero.live .dot { background: var(--live); animation: pulse 1.6s ease-out infinite; }
.status-hero.recent .dot { background: var(--recent); }
.status-hero .sub { margin-top: 6px; font-size: 14px; color: var(--ink-2); font-weight: 550; }
.evidence { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ev-chip {
  font-size: 12.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 65%, transparent); color: var(--ink-2);
  border: 1px solid var(--line);
}
.ev-chip.good { color: var(--recent); border-color: color-mix(in srgb, var(--recent) 40%, transparent); }
.ev-chip.warn { color: var(--stale); border-color: color-mix(in srgb, var(--stale) 45%, transparent); }
.ev-chip.alert { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }

.block {
  margin-top: 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
}
.block h4 {
  font-size: 12.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 8px;
}
.access-row { display: flex; align-items: flex-start; gap: 8px; font-size: 14.5px; color: var(--ink-2); }
.access-tag { font-weight: 800; font-size: 12.5px; letter-spacing: .05em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); flex: none; }
.access-tag.warn { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }

.map-box {
  margin-top: 10px; height: 220px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: var(--surface-2);
  position: relative;
  z-index: 0; /* cap Leaflet's internal z-indexes so sheets/scrims stay on top */
}
#rp-map { position: relative; z-index: 0; }
.map-box .leaflet-container { height: 100%; width: 100%; background: var(--surface-2); }
.map-fallback {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; color: var(--ink-2); font-size: 14px;
}
.map-links { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.map-links a, .map-links button {
  font-size: 13.5px; font-weight: 700; text-decoration: none;
  padding: 8px 13px; border-radius: 999px; min-height: 38px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 6px;
}

/* ---------- One-tap actions ---------- */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.action-btn {
  min-height: 62px; border-radius: 14px; padding: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-weight: 800; font-size: 15.5px; letter-spacing: .02em;
  border: 1.5px solid var(--line); background: var(--surface); box-shadow: var(--shadow);
}
.action-btn small { font-weight: 600; font-size: 12px; color: var(--ink-3); letter-spacing: 0; }
.action-btn:active { transform: scale(.97); }
.action-see { background: var(--recent); border-color: var(--recent); color: #fff; }
.action-see small { color: color-mix(in srgb, #fff 75%, transparent); }
.action-still { color: var(--recent); border-color: color-mix(in srgb, var(--recent) 45%, transparent); }
.action-notseen { color: var(--stale); border-color: color-mix(in srgb, var(--stale) 50%, transparent); }
.action-wide { grid-column: 1 / -1; min-height: 50px; flex-direction: row; gap: 8px; font-size: 14.5px; }
.signin-cue {
  grid-column: 1 / -1; text-align: center; font-size: 14px; color: var(--ink-2);
  background: var(--surface-2); border: 1px dashed var(--line); border-radius: 12px; padding: 12px;
}
.signin-cue button, .linky { color: var(--brand); font-weight: 800; text-decoration: underline; }

/* ---------- Timeline ---------- */
.timeline { margin-top: 6px; }
.tl-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.tl-item:last-child { border-bottom: 0; }
.tl-time { flex: none; width: 74px; text-align: right; }
.tl-time .t { font-weight: 800; font-size: 14px; }
.tl-time .d { font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.tl-body { flex: 1; min-width: 0; }
.tl-kind {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: 2.5px 8px; border-radius: 6px;
}
.tl-kind.k-first, .tl-kind.k-seen, .tl-kind.k-still { background: var(--recent-bg); color: var(--recent); }
.tl-kind.k-notseen { background: var(--stale-bg); color: var(--stale); }
.tl-kind.k-location { background: var(--rare-bg); color: var(--rare); }
.tl-kind.k-note { background: var(--notable-bg); color: var(--notable); }
.tl-note { margin-top: 5px; font-size: 15px; color: var(--ink); overflow-wrap: break-word; }
.tl-author { margin-top: 4px; font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.tl-item.pending { opacity: .55; }

/* ---------- Sheets (overlays) ---------- */
.sheet-scrim {
  position: fixed; inset: 0; z-index: 60; background: rgba(10, 12, 10, .45);
  animation: fadein .15s ease;
}
@keyframes fadein { from { opacity: 0; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61;
  max-height: calc(100dvh - 40px - var(--sat));
  background: var(--bg); border-radius: 20px 20px 0 0;
  display: flex; flex-direction: column;
  animation: sheetup .22s cubic-bezier(.3,.9,.4,1);
  box-shadow: 0 -8px 40px rgba(0,0,0,.25);
}
@keyframes sheetup { from { transform: translateY(40px); opacity: .6; } }
@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; transform: translateX(-50%); width: 620px; bottom: 24px; border-radius: 20px; }
  @keyframes sheetup { from { transform: translateX(-50%) translateY(40px); opacity: .6; } }
}
.sheet-head {
  display: flex; align-items: center; gap: 10px; padding: 16px 18px 10px; flex: none;
}
.sheet-head h2 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; flex: 1; }
.sheet-close {
  width: 40px; height: 40px; border-radius: 999px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); font-size: 17px;
}
.sheet-body { overflow-y: auto; padding: 4px 18px calc(20px + var(--sab)); -webkit-overflow-scrolling: touch; }

.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 13px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 7px; }
.field .hint { font-size: 12.5px; color: var(--ink-3); margin-top: 5px; }
.text-input, .select-input, textarea.text-input {
  width: 100%; min-height: 50px; padding: 12px 14px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 16px; font-weight: 550;
}
.text-input:focus, .select-input:focus { border-color: var(--focus); outline: none; }
textarea.text-input { resize: none; line-height: 1.4; }
.charcount { text-align: right; font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }

.opt-row { display: flex; gap: 8px; flex-wrap: wrap; }
.opt {
  padding: 10px 14px; min-height: 46px; border-radius: 11px;
  font-size: 14.5px; font-weight: 700;
  background: var(--surface); border: 1.5px solid var(--line); color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 7px;
}
.opt[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.opt:active { transform: scale(.97); }
.opt.small { min-height: 40px; padding: 7px 12px; font-size: 13.5px; }

/* species autocomplete */
.ac-wrap { position: relative; }
.ac-list {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 5;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); max-height: 264px; overflow-y: auto;
}
.ac-item {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left; padding: 12px 14px; min-height: 48px;
  border-bottom: 1px solid var(--line); font-size: 15.5px; font-weight: 650;
}
.ac-item:last-child { border-bottom: 0; }
.ac-item .sci { font-style: italic; font-weight: 450; color: var(--ink-3); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-item.hl, .ac-item:hover { background: var(--surface-2); }
.ac-item .rarity-hint { font-size: 11px; font-weight: 800; letter-spacing: .05em; }

.selected-species {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1.5px solid var(--brand); border-radius: 12px;
  padding: 12px 14px;
}
.selected-species .names { flex: 1; min-width: 0; }
.selected-species .cn { font-weight: 800; font-size: 17px; }
.selected-species .sn { font-style: italic; color: var(--ink-3); font-size: 13px; }
.selected-species button { color: var(--ink-3); font-weight: 700; font-size: 13.5px; flex: none; padding: 6px; }

.btn-primary {
  width: 100%; min-height: 56px; border-radius: 14px;
  background: var(--brand); color: var(--brand-ink);
  font-size: 17px; font-weight: 800; letter-spacing: .02em;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary:disabled { opacity: .5; }
.btn-secondary {
  width: 100%; min-height: 50px; border-radius: 14px;
  background: var(--surface); border: 1.5px solid var(--line);
  font-size: 15.5px; font-weight: 750; color: var(--ink-2);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-danger-ghost { color: var(--danger); font-weight: 750; font-size: 14.5px; padding: 12px; width: 100%; text-align: center; }

.dup-card {
  border: 1.5px solid var(--rare); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px;
  background: var(--rare-bg);
}
.dup-card .t { font-weight: 800; font-size: 16px; }
.dup-card .s { font-size: 13.5px; color: var(--ink-2); margin-top: 2px; }

.code-boxes { letter-spacing: .35em; text-align: center; font-size: 24px; font-weight: 800; }
.demo-code {
  margin-top: 10px; padding: 12px; border-radius: 10px; text-align: center;
  background: var(--stale-bg); color: var(--stale); font-size: 14px; font-weight: 650;
  border: 1px dashed color-mix(in srgb, var(--stale) 50%, transparent);
}
.demo-code strong { font-size: 22px; letter-spacing: .2em; display: block; margin-top: 2px; color: var(--ink); }

/* ---------- State picker ---------- */
.state-list { display: flex; flex-direction: column; }
.state-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 14px 6px; min-height: 52px; border-bottom: 1px solid var(--line);
  font-size: 16.5px; font-weight: 650;
}
.state-row .ab { flex: none; width: 40px; font-size: 12.5px; font-weight: 800; color: var(--ink-3); letter-spacing: .05em; }
.state-row .n-live { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--live); }

/* ---------- Sign-in gate (private beta) ---------- */
.gate {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: 24px 18px calc(24px + var(--sab));
}
.gate-card { width: 100%; max-width: 400px; text-align: center; }
.gate-card .g-mark { margin-bottom: 10px; }
.gate-card h1 { font-size: 36px; font-weight: 800; letter-spacing: -.03em; }
.g-tag { font-size: 16.5px; color: var(--ink-2); margin-top: 6px; font-weight: 550; }
.g-beta {
  display: inline-block; margin: 12px 0 22px;
  font-size: 11.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--brand); border: 1.5px solid color-mix(in srgb, var(--brand) 45%, transparent);
  padding: 4px 12px; border-radius: 999px;
}
.gate-card .field { text-align: left; }
.g-check { font-size: 15.5px; margin-bottom: 16px; line-height: 1.5; }
.g-links { display: flex; justify-content: center; gap: 22px; margin-top: 14px; }
.g-links .linky { font-size: 14px; padding: 8px 4px; }
.g-small { margin-top: 26px; font-size: 12.5px; color: var(--ink-3); }

/* ---------- Landing ---------- */
.landing { text-align: center; padding: 40px 18px 30px; }
.landing .mark { margin: 0 auto 14px; width: 64px; height: 64px; }
.landing h1 { font-size: 34px; font-weight: 800; letter-spacing: -.03em; }
.landing p.tag { font-size: 17px; color: var(--ink-2); margin-top: 8px; }
.landing p.sub { font-size: 14px; color: var(--ink-3); margin-top: 10px; max-width: 420px; margin-left: auto; margin-right: auto; }

/* ---------- Settings ---------- */
.setting-row {
  display: flex; align-items: center; gap: 12px; padding: 14px 2px;
  border-bottom: 1px solid var(--line); font-size: 15.5px;
}
.setting-row:last-child { border-bottom: 0; }
.setting-row .grow { flex: 1; min-width: 0; }
.setting-row .lbl { font-weight: 700; }
.setting-row .sub { font-size: 13px; color: var(--ink-3); }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { padding: 8px 12px; font-size: 12.5px; font-weight: 750; color: var(--ink-3); min-height: 40px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* ---------- Toasts ---------- */
#toast-root { position: fixed; left: 0; right: 0; bottom: calc(84px + var(--sab)); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: var(--ink); color: var(--bg); font-size: 14.5px; font-weight: 650;
  padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow);
  max-width: min(90vw, 480px); text-align: center;
  animation: toastin .2s ease;
}
.toast.err { background: var(--danger); color: #fff; }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Offline banner ---------- */
.offline-bar {
  background: var(--stale-bg); color: var(--stale); font-size: 13.5px; font-weight: 700;
  text-align: center; padding: 7px 12px; border-bottom: 1px solid var(--line);
}

/* ---------- Skeletons ---------- */
.skel { border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); height: 148px; position: relative; overflow: hidden; }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--ink) 5%, transparent), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%);} to { transform: translateX(100%);} }

/* ---------- Utility ---------- */
.muted { color: var(--ink-3); }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
details.more > summary {
  cursor: pointer; list-style: none; font-size: 14px; font-weight: 750; color: var(--brand);
  padding: 10px 0; user-select: none;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "+ "; }
details.more[open] > summary::before { content: "− "; }

/* ---------- Refinement round: regions, votes, guidance, aggregation ---------- */
.region-label {
  margin: 18px 0 2px; font-size: 12px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-3);
}
.us-row { font-weight: 750; }
.us-row .us-sub { margin-left: 6px; font-size: 12px; color: var(--ink-3); font-weight: 600; }

.vote-btn {
  margin-left: 10px; font-size: 12.5px; font-weight: 750; color: var(--ink-3);
  padding: 4px 11px; border-radius: 999px; min-height: 30px;
  border: 1px solid var(--line); background: var(--surface-2);
}
.vote-btn.voted {
  color: var(--brand);
  border-color: color-mix(in srgb, var(--brand) 45%, transparent);
  background: color-mix(in srgb, var(--brand) 10%, transparent);
}

.tl-agg .tl-kind { font-size: 12.5px; text-transform: none; letter-spacing: .01em; }

.howto { border: 1.5px solid color-mix(in srgb, var(--brand) 40%, transparent); }
.howto h4 { color: var(--brand); }
.tip { padding: 9px 0; border-bottom: 1px solid var(--line); }
.tip:last-child { border-bottom: 0; padding-bottom: 2px; }
.tip-note { font-size: 15px; font-weight: 600; }
.tip-meta { margin-top: 3px; font-size: 12px; color: var(--ink-3); font-weight: 600; }

.hero-stat { margin-top: 8px; font-size: 14.5px; font-weight: 750; color: var(--ink); }

.tl-sort button { min-height: 34px; padding: 6px 11px; }

.g-spam {
  margin-top: 10px; font-size: 13px; color: var(--ink-2); text-align: center;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}

.about { padding-bottom: 44px; }
.about h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin: 6px 0 10px; }
.about .lede { font-size: 16px; color: var(--ink-2); line-height: 1.55; }
.about h2 { font-size: 17px; font-weight: 800; margin: 24px 0 6px; }
.about p, .about li { font-size: 14.5px; line-height: 1.55; color: var(--ink-2); }
.about ul { padding-left: 20px; margin-top: 6px; display: flex; flex-direction: column; gap: 7px; }
.about strong { color: var(--ink); }
