/* Barangay-court look: painted-concrete grey, key-paint blue, line-marking white, one red for actions. */
:root {
  --concrete: #e4e8ec;
  --paper: #ffffff;
  --paint: #1b3f9e;
  --paint-deep: #14307a;
  --red: #c23a44;
  --red-deep: #9f2b34;
  --green: #1e7f5c;
  --amber: #a86a12;
  --ink: #162033;
  --muted: #4e5c70;
  --rule: #b9c3cf;
  --radius: 6px;
  --display: 'Big Shoulders Display', 'Arial Narrow', Impact, sans-serif;
  --body: 'Atkinson Hyperlegible', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--concrete); color: var(--ink);
  font-family: var(--body); font-size: 1.0625rem; line-height: 1.55;
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--paper); padding: .5rem 1rem; z-index: 20; }
.skip:focus { left: .5rem; top: .5rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- header: key paint with a three-point arc ---- */
.site-head { background: var(--paint); color: #fff; border-bottom: 4px solid #fff; position: relative; overflow: hidden; }
.site-head .inner { max-width: 40rem; margin: 0 auto; padding: .9rem 1.1rem; }
.brand { font-family: var(--display); font-weight: 800; font-size: 1.7rem; letter-spacing: .01em; color: #fff; text-decoration: none; line-height: 1; }
.arc { position: absolute; right: -2.2rem; top: -1.4rem; width: 8rem; height: 8rem; opacity: .35; pointer-events: none; }

/* ---- layout ---- */
main { display: block; outline: none; }
.wrap { max-width: 40rem; margin: 0 auto; padding: 1.6rem 1.1rem 3rem; }
.wrap.wide { max-width: 68rem; }
.section { padding: 1.6rem 0; border-top: 2px solid var(--paper); }
.section:first-child { border-top: 0; padding-top: 0; }

h1, h2, h3 { font-family: var(--display); line-height: 1; margin: 0 0 .6rem; letter-spacing: .005em; }
h1 { font-size: clamp(2.5rem, 9vw, 3.7rem); font-weight: 800; }
h2 { font-size: 1.9rem; font-weight: 700; }
h3 { font-size: 1.35rem; font-weight: 700; }
p { margin: 0 0 .9rem; max-width: 62ch; }
.lede { font-size: 1.2rem; color: var(--ink); max-width: 34rem; }
.muted, .hint { color: var(--muted); }
.hint { font-size: .92rem; margin: .35rem 0 0; }
a { color: var(--paint); text-underline-offset: 3px; }
a:hover { color: var(--paint-deep); }
.small { font-size: .92rem; }

/* ---- scoreboard: the pot, split like a court ---- */
.scoreboard { background: var(--paint); color: #fff; border-radius: var(--radius); padding: 1.4rem .9rem 1rem;
  outline: 2px solid #fff; outline-offset: -8px; margin: 1.1rem 0 1.2rem; }
.sb-grid { display: grid; grid-template-columns: 1fr 1.35fr 1fr; align-items: center; text-align: center; }
.sb-cell { padding: .2rem .3rem; }
.sb-pot { border-left: 2px solid rgba(255,255,255,.65); border-right: 2px solid rgba(255,255,255,.65); }
.sb-num { display: block; font-family: var(--display); font-weight: 800; font-size: clamp(1.8rem, 8vw, 2.6rem);
  font-variant-numeric: tabular-nums; line-height: 1; }
.sb-pot .sb-num { font-size: clamp(2.5rem, 12vw, 4rem); }
.sb-label { display: block; font-size: .9rem; margin-top: .35rem; opacity: .92; }
.sb-foot { margin: .9rem 0 0; text-align: center; font-size: .98rem; max-width: none; }
.sb-you { font-weight: 700; }

/* ---- progress steps (a real sequence) ---- */
.steps { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; margin: 0 0 1.4rem; padding: 0; }
.steps li { position: relative; text-align: center; font-size: .82rem; line-height: 1.2; padding-top: 1.6rem; color: var(--muted); }
.steps li::before { content: ''; position: absolute; top: .35rem; left: 50%; width: .9rem; height: .9rem; margin-left: -.45rem;
  border-radius: 50%; background: var(--concrete); border: 3px solid var(--rule); z-index: 1; }
.steps li::after { content: ''; position: absolute; top: .72rem; left: -50%; width: 100%; height: 3px; background: var(--rule); }
.steps li:first-child::after { display: none; }
.steps li.done { color: var(--ink); }
.steps li.done::before { background: var(--paint); border-color: var(--paint); }
.steps li.done::after, .steps li.current::after { background: var(--paint); }
.steps li.current { color: var(--ink); font-weight: 700; }
.steps li.current::before { background: #fff; border-color: var(--red); }

/* ---- status banner ---- */
.banner { background: var(--paper); border-left: 8px solid var(--paint); padding: 1rem 1.1rem 1rem 1rem; border-radius: 0 var(--radius) var(--radius) 0; margin-bottom: 1.4rem; }
.banner h2 { margin-bottom: .45rem; }
.banner p:last-child { margin-bottom: 0; }
.banner.ok { border-left-color: var(--green); }
.banner.warn { border-left-color: var(--amber); }
.banner.bad { border-left-color: var(--red); }

.alert { background: #fff; border-left: 8px solid var(--red); padding: .8rem 1rem; margin: 0 0 1.2rem; border-radius: 0 var(--radius) var(--radius) 0; }
.alert p { margin: 0; }

/* ---- forms ---- */
.field { margin-bottom: 1.15rem; }
label { display: block; font-weight: 700; margin-bottom: .35rem; }
input[type=text], input[type=url], input[type=number], input[type=password], input[type=datetime-local], select, textarea {
  width: 100%; min-height: 3rem; padding: .6rem .75rem; font: inherit; color: var(--ink);
  background: var(--paper); border: 2px solid #8997a9; border-radius: var(--radius);
}
textarea { min-height: 5.5rem; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--paint); outline: 3px solid var(--red); outline-offset: 1px; }
.pair { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 34rem) { .pair { grid-template-columns: 1fr 1fr; } }
.money { position: relative; }
.money span { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); font-weight: 700; pointer-events: none; }
.money input { padding-left: 1.9rem; font-variant-numeric: tabular-nums; }
.check { display: flex; gap: .7rem; align-items: flex-start; margin: 0 0 .9rem; font-weight: 400; }
.check input { width: 1.4rem; height: 1.4rem; margin-top: .15rem; flex: none; accent-color: var(--paint); }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 3.1rem; padding: .6rem 1.4rem;
  font: inherit; font-weight: 700; border: 2px solid transparent; border-radius: var(--radius); cursor: pointer; text-decoration: none; }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover:not([disabled]) { background: var(--red-deep); color: #fff; }
.btn-secondary { background: transparent; color: var(--paint); border-color: var(--paint); }
.btn-secondary:hover:not([disabled]) { background: var(--paint); color: #fff; }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--rule); min-height: 2.6rem; padding: .4rem 1rem; }
.btn-quiet:hover:not([disabled]) { border-color: var(--ink); }
.btn-block { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1rem; }
.actions .btn { flex: 1 1 12rem; }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.bar h1 { margin: 0; }

/* ---- pay panel ---- */
.pay-panel { background: var(--paper); border: 4px solid var(--paint); border-radius: var(--radius); padding: 1.2rem; text-align: center; margin-bottom: 1.4rem; }
.pay-amount { font-family: var(--display); font-weight: 800; font-size: 2.6rem; line-height: 1; margin: 0; font-variant-numeric: tabular-nums; }
.qr-box { display: flex; justify-content: center; margin: 1rem auto; min-height: 15rem; align-items: center; }
.qr-box img, .qr-box canvas { max-width: 100%; height: auto; }
.qr-fallback { width: 100%; font-size: .85rem; min-height: 5rem; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 700; }
.pay-panel p { margin-left: auto; margin-right: auto; }

/* ---- copy row ---- */
.copyrow { display: flex; gap: .6rem; }
.copyrow input { flex: 1; min-width: 0; font-size: .95rem; }
.copyrow .btn { flex: none; }

/* ---- lists and tables ---- */
dl.terms { margin: 0; display: grid; gap: .9rem; }
dl.terms dt { font-weight: 700; margin: 0; }
dl.terms dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.saved { list-style: none; margin: 0; padding: 0; }
.saved li { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; padding: .7rem 0; border-top: 1px solid var(--rule); }
.saved li:first-child { border-top: 0; }
.saved a { font-weight: 700; overflow-wrap: anywhere; }
.table-scroll { overflow-x: auto; background: var(--paper); border-radius: var(--radius); margin-bottom: 1rem; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 700; background: #f2f4f7; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.inline-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline-form input { min-height: 2.5rem; width: 12rem; padding: .3rem .6rem; }
.inline-form .btn { min-height: 2.5rem; padding: .3rem .9rem; }
.mono-ish { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
details summary { cursor: pointer; }
pre.json { margin: .4rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .82rem; }
.empty { background: var(--paper); border-radius: var(--radius); padding: 1rem; color: var(--muted); }

/* ---- dialog + toast ---- */
dialog { border: 4px solid var(--paint); border-radius: var(--radius); padding: 1.4rem; max-width: 26rem; width: calc(100% - 2rem); color: var(--ink); }
dialog::backdrop { background: rgba(22, 32, 51, .6); }
dialog h2 { font-size: 1.6rem; }
#toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: .7rem 1.1rem; border-radius: var(--radius); font-size: .95rem; max-width: calc(100% - 2rem); opacity: 0; pointer-events: none; z-index: 30; }
#toast.show { opacity: 1; }
@media (prefers-reduced-motion: no-preference) { #toast { transition: opacity .2s; } }

.site-foot { max-width: 40rem; margin: 0 auto; padding: 0 1.1rem 2.5rem; color: var(--muted); font-size: .9rem; }
.site-foot p { max-width: none; }
