/* VoteProof — built for budget phones, bright sun and weak networks.
   One typeface, high contrast, big targets. The figure grid mirrors the
   ruled result sheet so people copy line-for-line. Nigerian flag green
   throughout; the one flourish is the holographic map in the top band. */

:root {
  --paper: #F1F6F3;
  --surface: #FFFFFF;
  --ink: #13231B;
  --muted: #4E5F56;
  --rule: #C4D3CA;
  --brand: #008751;           /* Nigerian flag green: primary actions */
  --brand-soft: #E2F2E9;
  --deep: #03291B;            /* night green: header and hologram band */
  --holo: #3FF2C0;            /* hologram glow */
  --verified: #00703F;
  --single: #8F5400;
  --disputed: #B3261E;
  --focus: #F2B705;
  --radius: 6px;
  --font: 'Public Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
}
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
a { color: var(--brand); }
h1 { font-size: 1.75rem; line-height: 1.2; font-weight: 800; margin: 0.5rem 0 0.5rem; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; line-height: 1.3; font-weight: 800; margin: 0 0 0.75rem; }
p { margin: 0 0 0.75rem; }

/* ---------- chrome ---------- */
.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.6rem 16px; background: var(--deep); color: #fff;
  border-bottom: 4px solid transparent;
  border-image: linear-gradient(90deg, var(--brand) 0 33.3%, #fff 33.3% 66.6%, var(--brand) 66.6%) 1;
}
.brand img { border-radius: 7px; }
.brand { display: flex; align-items: center; gap: 0.5rem; color: #fff; text-decoration: none; font-weight: 800; font-size: 1.1rem; }
.bar nav { display: flex; gap: 0.25rem; }
.bar nav a { color: #fff; text-decoration: none; padding: 0.45rem 0.7rem; border-radius: var(--radius); font-weight: 600; }
.bar nav a[aria-current="page"] { background: var(--brand); }

.page { max-width: 640px; margin: 0 auto; padding: 1rem 16px 3rem; }
.page.wide { max-width: 980px; }
.lede { color: var(--muted); max-width: 60ch; }
.foot { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 1.5rem 16px 2.5rem; border-top: 1px solid var(--rule); }

.net { background: #FFF4CC; border: 1px solid #E8C55A; padding: 0.6rem 0.8rem; border-radius: var(--radius); }

/* ---------- form steps ---------- */
.step { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem; margin: 1rem 0; }
.step h2 { display: flex; align-items: center; gap: 0.6rem; }
.n {
  display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem; flex: none;
  border-radius: 50%; background: var(--brand); color: #fff; font-size: 0.95rem;
}
label { display: block; font-weight: 600; margin: 0.75rem 0 0.3rem; }
input, select, button { font: inherit; color: inherit; }
input:not([type=checkbox]):not([type=file]), select {
  width: 100%; min-height: 48px; padding: 0.5rem 0.75rem;
  border: 2px solid var(--rule); border-radius: var(--radius); background: #fff;
}
input:focus, select:focus { border-color: var(--brand); }
select:disabled { background: var(--paper); color: var(--muted); }
.row { display: flex; gap: 0.5rem; }
.row input { flex: 1; }
.hint { color: var(--muted); font-size: 0.92rem; margin: 0.4rem 0 0; }
.warn { background: #FFF4CC; border-left: 4px solid var(--single); padding: 0.6rem 0.8rem; margin-top: 0.75rem; }
.error { background: #FCE8E6; border-left: 4px solid var(--disputed); padding: 0.6rem 0.8rem; margin: 0.75rem 0; }
.invalid { border-color: var(--disputed) !important; background: #FCE8E6 !important; }

details { margin-top: 1rem; }
summary { cursor: pointer; color: var(--brand); font-weight: 600; min-height: 44px; display: flex; align-items: center; }

.chosen {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
  margin-top: 1rem; padding: 0.75rem; border: 2px solid var(--brand); border-radius: var(--radius); background: var(--brand-soft);
}
.chosen div { display: grid; gap: 0.1rem; }
.chosen span { color: var(--muted); font-size: 0.92rem; }

.btn, .btn-quiet {
  min-height: 48px; padding: 0.6rem 1.1rem; border-radius: var(--radius); cursor: pointer; font-weight: 700;
}
.btn { width: 100%; border: 0; background: var(--brand); color: #fff; font-size: 1.1rem; margin-top: 0.75rem; }
.btn:active { transform: translateY(1px); }
.btn-quiet { border: 2px solid var(--brand); background: #fff; color: var(--brand); white-space: nowrap; }
.btn-danger { border-color: var(--disputed); color: var(--disputed); }
.btn-ok { border-color: var(--verified); background: var(--verified); color: #fff; }

.camera {
  position: relative; display: grid; place-items: center; min-height: 96px; margin: 0.75rem 0 0;
  border: 2px dashed var(--brand); border-radius: var(--radius); background: var(--brand-soft);
  color: var(--brand); font-weight: 800; font-size: 1.15rem; cursor: pointer;
}
.camera input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
button.camera { width: 100%; font: inherit; font-weight: 800; font-size: 1.15rem; }
.camera-small { min-height: 60px; font-size: 1rem; }
.check-small { font-weight: 400; margin-top: 0.6rem; }
.countdown { margin: 0.2rem 0 0.9rem; font-weight: 700; color: #DFFBEF; text-shadow: 0 1px 8px rgba(0,0,0,.5); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.hero-btn { min-height: 40px; padding: 0.3rem 0.9rem; border-radius: 999px; border: 1px solid rgba(255,255,255,.55);
  background: rgba(3,41,27,.55); color: #fff; font: inherit; font-weight: 600; font-size: 0.9rem; cursor: pointer; }
.hero-btn:hover { background: rgba(0,135,81,.6); }
.ios-tip { margin: 0.6rem 0 0; color: #DFFBEF; font-size: 0.9rem; }
.next-sheet { background: #E4F4EA; border-left: 4px solid var(--verified); padding: 0.7rem 0.85rem; border-radius: var(--radius); font-weight: 600; }
.cam-torch { justify-self: end; }
.cam-torch[aria-pressed="true"] { color: #F2B705; }
.no-photo { display: grid; place-items: center; aspect-ratio: 3/4; background: var(--paper); color: var(--muted); font-size: 0.75rem; text-align: center; border-radius: 4px; border: 1px dashed var(--rule); }
.about h2 { margin-top: 1.75rem; }
.about p, .about li { max-width: 68ch; }
.steps { padding-left: 1.3rem; margin: 0 0 1rem; }
.steps li { margin: 0.5rem 0; padding-left: 0.2rem; }
.about details { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 0 0.9rem; margin: 0.5rem 0; }
.about details[open] { padding-bottom: 0.6rem; }
.about details p { margin: 0; }
.practice-note { margin: 0.75rem 0 0; padding: 0.7rem 0.85rem; border-radius: var(--radius); background: #FFF4CC; border-left: 4px solid #C98A00; font-size: 0.93rem; }
.add-pu { margin-top: 1rem; padding: 1rem; border: 2px dashed var(--brand); border-radius: var(--radius); background: var(--brand-soft); }
.add-pu h3 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.add-pu-ward { font-weight: 700; margin: 0.6rem 0 0; }
.linkish { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; min-height: 32px; }
.chosen .pending-note { color: #A63D00; font-size: 0.88rem; }
.proposal { background: #fff; border: 1px solid var(--rule); border-left: 5px solid #A63D00; border-radius: var(--radius); padding: 1rem; margin: 0.75rem 0; }
.proposal h3 { margin: 0 0 0.25rem; font-size: 1.05rem; }

/* ---------- full-screen camera ---------- */
.cam { position: fixed; inset: 0; z-index: 50; background: #000; display: grid; grid-template-rows: 1fr auto; }
.cam video { width: 100%; height: 100%; object-fit: cover; grid-row: 1; grid-column: 1; }
.cam-frame { grid-row: 1; grid-column: 1; margin: 6% 6% 12%; border: 2px solid rgba(255,255,255,.85); border-radius: 8px;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); pointer-events: none; }
.cam-tip { grid-row: 1; grid-column: 1; align-self: end; justify-self: center; margin: 0 16px 3%; color: #fff;
  background: rgba(0,0,0,.55); padding: 0.4rem 0.8rem; border-radius: 6px; font-size: 0.95rem; text-align: center; }
.cam-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 1rem 16px calc(1rem + env(safe-area-inset-bottom)); background: #000; }
.cam-btn { color: #fff; background: none; border: 0; font: inherit; font-weight: 600; min-height: 48px; justify-self: start; cursor: pointer; }
.cam-shutter { width: 72px; height: 72px; border-radius: 50%; border: 5px solid #fff; background: var(--brand); cursor: pointer; }
.cam-shutter:active { transform: scale(.94); }
.cam-shutter:disabled { opacity: .5; }
.camera:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.preview { display: block; width: 100%; margin-top: 0.75rem; border-radius: var(--radius); border: 1px solid var(--rule); }

.check { display: flex; gap: 0.6rem; align-items: flex-start; font-weight: 600; margin: 0; }
.check input { width: 24px; height: 24px; flex: none; margin-top: 2px; accent-color: var(--brand); }

/* ---------- the result-sheet grid ---------- */
.sheet { border: 2px solid var(--ink); border-radius: 2px; background: #fff; margin-top: 0.75rem; }
.sheet-row, .sheet-head {
  display: grid; grid-template-columns: 1fr 8.5rem; align-items: center;
  border-bottom: 1px solid var(--rule);
}
.sheet-row > label, .sheet-row > span { margin: 0; padding: 0.4rem 0.75rem; border-right: 1px solid var(--rule); }
.sheet-row label b { display: block; font-size: 1.05rem; }
.sheet-row label small { display: block; color: var(--muted); font-weight: 400; font-size: 0.8rem; line-height: 1.3; }
.sheet-row input {
  border: 0 !important; border-radius: 0 !important; height: 100%; min-height: 52px;
  text-align: right; font-size: 1.3rem; font-weight: 700; padding: 0.4rem 0.75rem !important;
}
.sheet-row input:focus { background: var(--brand-soft); outline: 3px solid var(--brand); outline-offset: -3px; }
.sheet-key { background: var(--paper); }
.sheet-key input { background: var(--paper); }
.sheet-head { background: var(--ink); color: #fff; font-weight: 700; font-size: 0.9rem; }
.sheet-head span { padding: 0.35rem 0.75rem; }
.sheet-head span:last-child { text-align: right; }
.sheet-total { border-bottom: 0; border-top: 2px solid var(--ink); font-weight: 800; }
.sheet-total output { text-align: right; padding: 0.6rem 0.75rem; font-size: 1.3rem; }

/* ---------- stamps ---------- */
.stamp {
  display: inline-block; padding: 0.1rem 0.5rem; border: 2px solid currentColor; border-radius: 3px;
  font-weight: 800; font-size: 0.85rem; line-height: 1.4; white-space: nowrap;
}
.stamp-verified { color: var(--verified); }
.stamp-single { color: var(--single); }
.stamp-disputed { color: var(--disputed); }
.stamp-review { color: #A63D00; border-style: dashed; }
.stamp-none { color: var(--muted); border-style: dashed; }
.stamp-big { font-size: 1.2rem; padding: 0.2rem 0.75rem; transform: rotate(-2deg); border-width: 3px; }

/* ---------- outbox ---------- */
.outbox { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.job { display: flex; justify-content: space-between; gap: 1rem; align-items: center; background: #fff; border: 1px solid var(--rule); border-left: 5px solid var(--muted); border-radius: var(--radius); padding: 0.75rem; }
.job div { display: grid; gap: 0.15rem; }
.job span { font-size: 0.92rem; color: var(--muted); }
.job-sent { border-left-color: var(--verified); }
.job-failed { border-left-color: var(--disputed); }
.job-err { color: var(--disputed) !important; }

/* ---------- results ---------- */
.notice { background: var(--brand-soft); border-radius: var(--radius); padding: 0.75rem 1rem; font-size: 0.95rem; }
.controls { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; align-items: end; margin: 1rem 0; }
.controls label { margin: 0 0 0.3rem; }
.controls .check { font-weight: 400; }
.crumbs { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; margin: 0.5rem 0 0; font-size: 0.95rem; }
.crumbs a, .crumbs span { padding: 0.15rem 0; }
.crumbs .sep { color: var(--muted); }

.coverage { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; margin: 1rem 0; }
.coverage div { background: #fff; padding: 0.75rem; }
.coverage b { display: block; font-size: 1.5rem; font-weight: 800; }
.coverage span { color: var(--muted); font-size: 0.88rem; }
.meter { height: 8px; background: var(--paper); border-radius: 4px; overflow: hidden; margin-top: 0.35rem; }
.meter i { display: block; height: 100%; background: var(--verified); }

.bars { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.bars li { display: grid; grid-template-columns: 4.5rem 1fr auto; gap: 0.75rem; align-items: center; }
.bars .who b { display: block; }
.bars .who small { display: block; color: var(--muted); font-size: 0.75rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; }
.bars .track { height: 22px; background: var(--paper); border-radius: 3px; overflow: hidden; }
.bars .track { position: relative; }
.bars .track i { position: absolute; inset: 0 auto 0 0; display: block; background: var(--brand); min-width: 2px; transition: width .6s ease; }
.bars .track i.pending { background: repeating-linear-gradient(135deg, #9FD8B8 0 6px, #C9EBD7 6px 12px); }
.bars li:first-child .track i.ver { background: var(--deep); }
.bars .num .plus { display: block; color: var(--muted); font-size: 0.78rem; }
.irev { margin-top: 0.75rem; padding: 0.75rem; border-radius: var(--radius); background: var(--paper); border: 1px solid var(--rule); font-size: 0.92rem; }
.irev b { display: block; margin-bottom: 0.2rem; }
.irev-matches { border-color: var(--verified); background: #E4F4EA; }
.irev-differs { border-color: var(--disputed); background: #FCE8E6; }
.irev .path { font-family: inherit; font-weight: 600; word-break: break-word; }
.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; font-size: 0.85rem; color: var(--muted); margin: 0 0 0.9rem; }
.legend i { display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin-right: 0.35rem; vertical-align: 0; background: var(--brand); }
.legend i.pending { background: repeating-linear-gradient(135deg, #9FD8B8 0 4px, #C9EBD7 4px 8px); }
.bars .num { text-align: right; min-width: 7.5rem; }
.bars .num b { display: block; }
.bars .num small { color: var(--muted); }

.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem; margin: 1rem 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
td.r, th.r { text-align: right; }
tbody tr:hover { background: var(--paper); }
.empty { color: var(--muted); padding: 1rem 0; }

/* ---------- polling unit page ---------- */
.version { border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem; margin: 1rem 0; background: #fff; }
.version.lead { border: 2px solid var(--ink); }
.version h3 { font-size: 1rem; line-height: 1.35; margin: 0 0 0.5rem; }
.figs { display: grid; grid-template-columns: 1fr auto; gap: 0.2rem 1rem; margin: 0.75rem 0; }
.figs dt { color: var(--muted); }
.figs dd { margin: 0; text-align: right; font-weight: 700; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.5rem; }
.photos a { display: block; }
.photos img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 4px; border: 1px solid var(--rule); background: var(--paper); }
.photos figcaption { font-size: 0.8rem; color: var(--muted); }
.flags { margin: 0.25rem 0 0; padding-left: 1.1rem; color: var(--disputed); font-size: 0.85rem; }

/* ---------- moderation ---------- */
.mod-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem; margin: 1rem 0; }
.mod-card img { width: 100%; border-radius: 4px; border: 1px solid var(--rule); }
.mod-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }

/* ---------- hologram band ---------- */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  background:
    radial-gradient(ellipse 70% 90% at 78% 45%, rgba(0,135,81,.55), transparent 70%),
    linear-gradient(160deg, #04382A 0%, var(--deep) 60%, #021A11 100%);
  color: #fff;
}
.hero::before {                       /* the map */
  content: ""; position: absolute; z-index: -2;
  right: max(-6%, calc((100% - 980px) / 2 - 20px)); top: 50%; width: min(78%, 520px); aspect-ratio: 1000 / 820;
  transform: translateY(-50%);
  background: url(../img/nigeria-holo.svg) center / contain no-repeat;
  opacity: .62;
  filter: drop-shadow(0 0 6px rgba(63,242,192,.55)) drop-shadow(0 0 22px rgba(0,194,168,.35));
}
.hero::after {                        /* one slow scan line sweeping the map */
  content: ""; position: absolute; z-index: -1; left: 0; right: 0; height: 40%; top: -40%;
  background: linear-gradient(180deg, transparent, rgba(63,242,192,.06) 80%, rgba(63,242,192,.16) 100%);
  animation: scan 8s cubic-bezier(.5,0,.5,1) infinite; animation-delay: .6s;
}
@keyframes scan { to { transform: translateY(350%); } }
.hero-in { max-width: 640px; margin: 0 auto; padding: 1.6rem 16px 1.9rem; }
.hero-in.wide { max-width: 980px; }
.hero h1 { color: #fff; max-width: 18ch; text-shadow: 0 1px 12px rgba(0,0,0,.45); }
.hero .lede { color: #CBE9DA; max-width: 46ch; text-shadow: 0 1px 8px rgba(0,0,0,.5); }
.hero a { color: #fff; }
.hero .crumbs .sep { color: #8DC7AA; }
.hero-small .hero-in { padding: 1.1rem 16px 1.3rem; }
.hero-small h1 { font-size: 1.45rem; }
.hero-small::before { width: min(48%, 300px); opacity: .5; right: -2%; }

.live {
  display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0.7rem;
  border: 1px solid rgba(63,242,192,.55); border-radius: 999px; background: rgba(3,41,27,.6);
  font-size: 0.88rem; font-weight: 600; color: #DFFBEF;
}
.live .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--holo); box-shadow: 0 0 0 0 rgba(63,242,192,.7); animation: pulse 2s infinite; }
.live.stale .dot { background: #F2B705; animation: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(63,242,192,0); } 100% { box-shadow: 0 0 0 0 rgba(63,242,192,0); } }

.hero-stats { display: flex; flex-wrap: wrap; gap: 1.25rem 2.25rem; margin-top: 1.25rem; }
.hero-stats div { display: grid; }
.hero-stats b { font-size: 2.1rem; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; text-shadow: 0 0 18px rgba(63,242,192,.35); }
.hero-stats span { color: #A9D9C1; font-size: 0.88rem; max-width: 16ch; }
.hero .controls { margin-bottom: 0; }
.hero .controls label { color: #DFFBEF; }
.hero select { background: rgba(255,255,255,.96); color: var(--ink); border-color: transparent; max-width: 320px; }

/* ---------- results layout ---------- */
.grid2 { display: grid; gap: 0 1rem; }
@media (min-width: 900px) {
  .grid2 { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); grid-template-areas: "bars feed" "table feed"; grid-template-rows: auto 1fr; align-items: start; }
  .grid2 > #p-bars { grid-area: bars; } .grid2 > #p-feed { grid-area: feed; } .grid2 > #p-table { grid-area: table; }
}

/* ---------- live feed ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 52px 1fr; gap: 0.7rem; padding: 0.6rem 0.25rem; border-bottom: 1px solid var(--rule); }
.feed li:last-child { border-bottom: 0; }
.feed img { width: 52px; height: 64px; object-fit: cover; border-radius: 4px; border: 1px solid var(--rule); background: var(--paper); }
.feed .t { display: grid; gap: 0.1rem; min-width: 0; }
.feed .t a { font-weight: 700; text-decoration: none; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed .t small { color: var(--muted); font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed .meta { display: flex; flex-wrap: wrap; gap: 0.35rem 0.6rem; align-items: center; font-size: 0.85rem; }
.feed .stamp { font-size: 0.72rem; padding: 0 0.35rem; }
.feed li.new { animation: arrive 2.4s ease-out; }
@keyframes arrive { from { background: #C9F5DF; } to { background: transparent; } }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.panel-head small { color: var(--muted); }

@media (max-width: 640px) { .mod-card { grid-template-columns: 1fr; } }

@media (max-width: 430px) {
  .brand span { display: none; }
  .bar nav a { padding: 0.45rem 0.55rem; font-size: 0.95rem; }
}
@media (max-width: 560px) {
  .opt { display: none; }
  th, td { padding: 0.5rem 0.35rem; }
  .bars li { grid-template-columns: 3.5rem 1fr auto; gap: 0.5rem; }
  .bars .num { min-width: 5.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
