/* Public tool pages: the Baloot calculator (/calculator/baloot/) and the weekly leaderboard (/leaderboard/).
   Built on site.css's tokens; nothing here restyles the landing or the legal pages. */
.sadu + header.top { padding-block: 16px; }
.tool { padding-block: 8px 64px; display: grid; gap: 20px; max-width: 760px; }
.tool h1 { font-size: clamp(30px, 7vw, 46px); margin: 0; }
.tool .lead { margin: 0; max-width: 60ch; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: 0 12px 32px -22px rgba(21,23,24,.35); min-width: 0; }
.card h2 { font: 800 19px/1.4 var(--display); margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tool p { overflow-wrap: anywhere; }

/* Segmented choices: radio inputs inside labels, each at least 48px tall. */
.seg { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 8px; }
.seg legend { font: 700 15px var(--text); padding: 0; margin-bottom: 8px; }
.seg .opts { display: flex; flex-wrap: wrap; gap: 8px; }
.seg .opts label { position: relative; flex: 1 1 0; min-width: 64px; }
.seg .opts input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg .opts span { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 48px; padding: 6px 12px; border: 1.5px solid var(--line); border-radius: 14px; font: 600 16px/1.25 var(--text); background: var(--sand); color: var(--ink); cursor: pointer; }
.seg .opts input:checked + span { background: var(--table); border-color: var(--table); color: #fff; }
.seg .opts input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.seg .opts label[hidden] { display: none; }
.seg .opts input:disabled + span { opacity: .45; cursor: not-allowed; }

/* Totals */
.totals { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.totals > div { text-align: center; border-radius: 16px; padding: 10px 8px 12px; background: var(--sand); border: 1px solid var(--line); min-width: 0; }
.totals small { display: block; font: 700 16px var(--text); color: var(--muted); }
.totals b { display: block; font: 900 clamp(44px, 14vw, 64px)/1.05 var(--display); font-variant-numeric: tabular-nums; }
.totals .bar { height: 6px; border-radius: 99px; background: var(--line); margin-top: 8px; overflow: hidden; }
.totals .bar i { display: block; height: 100%; width: 0; background: var(--gold); border-radius: inherit; transition: width .3s; }
.status { margin: 12px 0 0; text-align: center; font-weight: 700; min-height: 1.65em; }
.status.win { color: var(--accent); font-size: 20px; }

/* Calculator form */
.calc { display: grid; gap: 18px; }
.calc[hidden], .manual[hidden] { display: none; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.num { display: grid; gap: 6px; font-weight: 600; font-size: 15px; min-width: 0; }
.num input { width: 100%; min-height: 56px; border-radius: 14px; border: 1.5px solid var(--field); background: var(--surface); color: var(--ink); font: 700 24px var(--text); text-align: center; padding: 6px; }
.num input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.num input:disabled { opacity: .5; }
.check { display: flex; gap: 10px; align-items: center; min-height: 48px; font-weight: 600; cursor: pointer; }
.check input { width: 24px; height: 24px; accent-color: var(--table); flex: none; }
.check[hidden] { display: none; }
.projects { display: grid; gap: 8px; margin-top: 6px; }
.projects .prow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.projects .pname { font-weight: 600; overflow-wrap: anywhere; }
.projects .pname small { color: var(--muted); font-weight: 400; font-size: 14px; }
.step { display: inline-grid; grid-template-columns: 48px 44px 48px; align-items: center; }
.step button { min-height: 48px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--sand); color: var(--ink); font: 700 22px/1 var(--text); cursor: pointer; padding: 0; }
.step button:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.step output { text-align: center; font: 700 20px var(--text); font-variant-numeric: tabular-nums; }
.preview { border-radius: 14px; background: var(--sand); border: 1px dashed var(--field); padding: 12px 14px; font-weight: 600; }
.preview b { font-size: 20px; }
.why { color: var(--err); font-weight: 600; margin: 0; }
.why:empty { display: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; text-align: center; min-height: 56px; border-radius: 14px; border: 0; padding: 8px 22px; font: 700 18px var(--display); cursor: pointer; text-decoration: none; background: var(--table); color: #fff; }
.btn:hover { background: var(--table-deep); }
.btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--field); min-height: 48px; font-size: 16px; }
.btn.ghost:hover { border-color: var(--ink); }
.btn.gold { background: #e0a526; color: #151718; box-shadow: 0 10px 30px -12px rgba(224,165,38,.7); }
.btn.gold:hover { background: #f0b83a; }
.btn.wide { width: 100%; }
.btn[hidden] { display: none; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.actions .btn { flex: 1 1 140px; }

/* Score sheet and leaderboard tables */
.sheet { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; table-layout: fixed; }
.sheet th, .sheet td { padding: 10px 6px; text-align: center; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.sheet th { font-size: 14px; color: var(--muted); font-weight: 700; }
.sheet td small { display: block; color: var(--muted); font-size: 12px; line-height: 1.3; }
.sheet .tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--gold); color: #151718; }
.sheet tbody tr:last-child td { border-bottom: 0; }
.cta-box { display: grid; gap: 12px; text-align: center; justify-items: center; }
.cta-box p { margin: 0; }
.rules { margin: 0; padding-inline-start: 20px; display: grid; gap: 6px; }

/* Leaderboard */
.tabs label { flex: 1 1 auto; }
.board th:first-child, .board td:first-child { width: 44px; }
.board th:nth-child(3), .board td:nth-child(3), .board th:nth-child(4), .board td:nth-child(4) { width: 76px; }
.board td.name { text-align: start; font-weight: 600; }
.board .medal { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-weight: 800; background: var(--sand); }
.board tr.r1 .medal { background: #e0a526; color: #151718; }
.board tr.r2 .medal { background: #c9ccd1; color: #151718; }
.board tr.r3 .medal { background: #c98a55; color: #151718; }
.state { text-align: center; padding: 24px 8px; color: var(--muted); }
.state b { display: block; color: var(--ink); font-size: 18px; margin-bottom: 4px; }
.state .btn { margin-top: 12px; }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.tool [hidden] { display: none !important; }
@media (max-width: 420px) {
  .card { padding: 14px 12px; }
  .sheet th, .sheet td { padding: 8px 3px; }
  .board th:first-child, .board td:first-child { width: 36px; }
  .board th:nth-child(3), .board td:nth-child(3), .board th:nth-child(4), .board td:nth-child(4) { width: 52px; }
  .board th { font-size: 12px; }
  .board .medal { width: 26px; height: 26px; font-size: 13px; }
}
