/* ScrapNJ: dark palette. Black and iron grey, midnight blue, steel-blue
   links, muted gold for ratings, crimson and green for results. */
:root {
  --bg: #08090c;
  --bg-deep: #050608;
  --surface: #11141b;
  --surface-2: #171b24;
  --midnight: #131c33;
  --midnight-2: #1c2a4a;
  --line: #252b38;
  --line-strong: #343c4e;
  --text: #d9dce4;
  --muted: #8b92a3;
  --silver: #b9bfcc;
  --link: #93acdf;
  --link-hover: #c3d2f0;
  --gold: #c9b37e;
  --crimson: #7a1f2b;
  --loss: #e06c7a;
  --win: #6fb79b;
  --chart-line: #7f9ed6;

  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Cinzel", Georgia, serif;
}

* { box-sizing: border-box; }
html { background: var(--bg-deep); }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.5;
  background:
    radial-gradient(ellipse 80% 40% at 50% -10%, rgba(28, 42, 74, 0.4), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; text-decoration-color: var(--midnight-2); text-underline-offset: 3px; }
code { font-size: 0.9em; background: var(--surface-2); border: 1px solid var(--line); padding: 0.05rem 0.35rem; border-radius: 3px; }

/* ---------- header / footer ---------- */
.top {
  display: flex;
  gap: 1.75rem;
  align-items: center;
  padding: 0.7rem 1.5rem;
  background: var(--midnight);
  border-bottom: 1px solid var(--line-strong);
  flex-wrap: wrap;
}
.brand {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.06em;
  line-height: 1;
  color: var(--text);
}
.brand:hover { color: var(--text); text-decoration: none; }
.top .top-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.top .top-nav a { white-space: nowrap; }
.top .top-nav a {
  font-weight: 500;
  color: var(--muted);
  padding: 0.25rem 0;
  border-bottom: 1px solid transparent;
}
.top .top-nav a:hover { color: var(--text); text-decoration: none; }
.top .top-nav a.active { color: var(--text); border-bottom-color: var(--chart-line); }
.counts { margin-left: auto; color: var(--muted); font-size: 0.85rem; }

main { width: 100%; max-width: 1180px; margin: 0 auto; padding: 1.75rem 1.5rem 3rem; flex: 1; }

.foot {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 1.5rem;
  border-top: 1px solid var(--line);
  background: var(--bg-deep);
}

/* ---------- type ---------- */
h1 { font-family: var(--font-head); font-weight: 700; letter-spacing: 0.03em; margin: 0 0 0.4rem; font-size: 1.9rem; }
h2 { margin: 2rem 0 0.75rem; font-size: 1.05rem; font-weight: 600; color: var(--silver); }
.lede, .meta, .muted, .crumb { color: var(--muted); }
.lede { font-size: 1rem; }
.crumb { font-size: 0.95rem; margin: 0 0 0.25rem; }
.small { font-size: 0.9rem; }

/* ---------- home ---------- */
.hero { text-align: center; padding: 1.5rem 0 0.5rem; }
/* The wordmark inside New Jersey (_macros.html nj_mark). */
.hero-mark { margin: 0; line-height: 0; }
.nj-mark {
  display: block; width: auto; height: clamp(230px, 28vw, 300px); margin: 0 auto;
  overflow: visible;
  filter: drop-shadow(0 0 18px rgba(201, 179, 126, 0.12));
}
.nj-edge { fill: none; stroke: var(--gold); stroke-width: 1.8; stroke-linejoin: round; }
.nj-words text { font-family: var(--font-head); font-weight: 700; }
.hero-sub { font-size: 1rem; color: var(--muted); margin: 0.35rem 0 0; }
.divider { margin: 1.5rem auto 0; max-width: 360px; height: 1px; background: linear-gradient(90deg, transparent, var(--line-strong), transparent); }
.section-title { text-align: center; margin-top: 1.5rem; }

.weights {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}
.weight-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.9rem 1rem 0.75rem;
  display: flex;
  flex-direction: column;
}
.weight-card header { display: flex; align-items: baseline; gap: 0.4rem; border-bottom: 1px solid var(--line); padding-bottom: 0.45rem; margin-bottom: 0.35rem; }
.weight-name { font-size: 1.3rem; font-weight: 700; color: var(--text); }
.weight-unit { color: var(--muted); font-size: 0.8rem; }
.weight-card ol { list-style: none; margin: 0; padding: 0; flex: 1; }
.weight-card li {
  display: grid;
  grid-template-columns: 1.5rem 1fr auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.42rem 0;
  border-bottom: 1px solid rgba(37, 43, 56, 0.6);
}
.weight-card li:last-child { border-bottom: 0; }
.weight-card .rk { color: var(--muted); text-align: center; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.weight-card li.first .rk { color: var(--gold); }
.weight-card li.first .who > a { font-weight: 600; }
.weight-card .who { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.weight-card .who > a, .weight-card .who .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.weight-card .who .muted { font-size: 0.8rem; }
.weight-card .elo { font-size: 1rem; }
.weight-card .more { margin-top: 0.5rem; font-size: 0.85rem; align-self: flex-end; color: var(--muted); }
.weight-card .more:hover { color: var(--link); }
.empty { margin: 0.6rem 0; font-style: italic; }
.notice {
  max-width: 640px; margin: 1rem auto; text-align: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 1.25rem 1.5rem;
}

/* ---------- filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.1rem 0; align-items: center; }
.filters input, .filters select, .filters button {
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 0.42rem 0.65rem;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
}
.filters input:focus, .filters select:focus { outline: 1px solid var(--chart-line); outline-offset: 1px; }
.filters input[type="search"] { min-width: 230px; }
.filters button {
  font-weight: 600;
  background: var(--midnight-2);
  border-color: #2c3f69;
  cursor: pointer;
}
.filters button:hover { background: #24365e; }
.check { display: flex; align-items: center; gap: 0.35rem; color: var(--muted); font-size: 0.88rem; }
.filters .check input { min-width: 0; accent-color: var(--chart-line); }
.reset { align-self: center; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); }
th {
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--midnight);
}
tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.015); }
tbody tr:hover { background: rgba(127, 158, 214, 0.06); }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.elo { font-weight: 600; color: var(--gold); font-variant-numeric: tabular-nums; }
.result { font-weight: 600; }
.result.win, .up { color: var(--win); }
.result.loss, .down { color: var(--loss); }
td.short { color: var(--loss); }
td.rank-top { color: var(--gold); font-weight: 700; }  /* lineup missing a weight */

.pager { margin-top: 1rem; display: flex; gap: 0.6rem; flex-wrap: wrap; }
.pager a { padding: 0.3rem 0.8rem; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface); }
.pager a:hover { background: var(--midnight); text-decoration: none; }

.plain { list-style: none; padding: 0; margin: 0; columns: 2 280px; column-gap: 2rem; }
.plain li { padding: 0.3rem 0; border-bottom: 1px solid var(--line); break-inside: avoid; }

/* ---------- wrestler cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.75rem; margin: 1.1rem 0 0.5rem; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.7rem 1rem;
  display: flex;
  flex-direction: column;
}
.card .label { color: var(--muted); font-size: 0.75rem; font-weight: 500; }
.card .value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Elo chart ---------- */
.chart {
  position: relative;
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.6rem 0.75rem 0.4rem;
}
.chart-note { margin: 0.1rem 0 0.3rem; font-size: 0.85rem; color: var(--muted); }
.chart-key { display: flex; gap: 1.1rem; justify-content: flex-end; font-size: 0.82rem; color: var(--muted); }
.chart-key span { display: inline-flex; align-items: center; gap: 0.35rem; }
.chart-plot { width: 100%; }
.chart-plot svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .ref { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 4; opacity: 0.7; }
.chart .tick { fill: var(--muted); font-family: var(--font-body); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke: var(--chart-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .mk-win { fill: var(--chart-line); stroke: var(--surface); stroke-width: 2; }
.chart .mk-loss { fill: var(--surface); stroke: var(--chart-line); stroke-width: 2; }
.chart .mk-place { fill: var(--gold); stroke: var(--surface); stroke-width: 2; }
.chart .mk-dot { fill: var(--chart-line); stroke: var(--surface); stroke-width: 2; }
.chart .mk-hover { fill: none; stroke: var(--text); stroke-width: 2; }
.chart .cross { stroke: var(--line-strong); stroke-width: 1; }
.chart-tip {
  position: absolute;
  pointer-events: none;
  background: var(--bg-deep);
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  line-height: 1.3;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
}
.chart-tip .tip-head { font-size: 0.75rem; font-weight: 600; color: var(--muted); }
.chart-tip .tip-val { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-tip .tip-vs { color: var(--silver); }

/* ---------- small screens ---------- */

/* ---------- fan vote ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.section-head { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; margin-bottom: 1rem; }
.section-head .section-title { margin-bottom: 0; }
.section-head p { margin: 0; text-align: center; }
.seg { display: inline-flex; padding: 3px; gap: 3px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px; }
.seg a { padding: 0.32rem 1rem; border-radius: 999px; color: var(--muted); font-weight: 500; font-size: 0.9rem; }
.seg a:hover { color: var(--text); text-decoration: none; }
.seg a.on { background: var(--midnight-2); color: var(--text); box-shadow: inset 0 0 0 1px #2c3f69; }
.ballot-count { margin-left: auto; color: var(--muted); font-size: 0.8rem; }
.pts { font-weight: 600; color: var(--chart-line); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pts small { color: var(--muted); font-weight: 400; }

.vote-card { color: var(--text); transition: border-color 0.15s, background 0.15s; }
.vote-card:hover { text-decoration: none; border-color: var(--line-strong); background: var(--surface-2); }
.vote-card dl { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 0.75rem; margin: 0.5rem 0 0.75rem; font-size: 0.9rem; }
.vote-card dt { color: var(--muted); font-size: 0.8rem; align-self: center; }
.vote-card dd { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vote-cta { margin-top: auto; align-self: flex-end; font-size: 0.85rem; color: var(--link); }
.vote-cta.done { color: var(--win); }

.weight-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.75rem 0 1rem; }
.weight-chips a { padding: 0.2rem 0.6rem; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.weight-chips a:hover { color: var(--text); text-decoration: none; border-color: var(--chart-line); }
.weight-chips a.on { background: var(--midnight-2); color: var(--text); border-color: #2c3f69; }
.flash { background: rgba(111, 183, 155, 0.1); border: 1px solid rgba(111, 183, 155, 0.4); color: var(--text); border-radius: 6px; padding: 0.6rem 0.9rem; }

.ballot-layout { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 1.25rem; align-items: start; margin-top: 1rem; }
.pool, .ballot-panel { min-width: 0; }
.ballot-panel { position: sticky; top: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 0.9rem 1rem; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; }
.panel-head h2 { margin: 0; }
.ballot { list-style: none; margin: 0; padding: 0; }
.slot { display: grid; grid-template-columns: 1.6rem 1fr auto; align-items: center; gap: 0.5rem; padding: 0.4rem 0; border-bottom: 1px solid var(--line); min-height: 2.9rem; }
.slot:last-child { border-bottom: 0; }
.slot .place { width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; font-size: 0.8rem; font-weight: 600; background: var(--midnight); color: var(--silver); }
.slot:first-child .place { background: rgba(201, 179, 126, 0.18); color: var(--gold); }
.slot.empty .place { background: transparent; border: 1px dashed var(--line-strong); color: var(--muted); }
.slot .who { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.slot .who a, .slot .who .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot .who .muted { font-size: 0.8rem; }
.slot-actions { display: flex; gap: 0.2rem; }
.icon-btn { width: 1.9rem; height: 1.9rem; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface-2); color: var(--silver); cursor: pointer; font: inherit; font-size: 0.85rem; }
.icon-btn:hover:not(:disabled) { border-color: var(--chart-line); color: var(--text); }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.icon-btn.remove:hover:not(:disabled) { border-color: var(--loss); color: var(--loss); }

.btn { font: inherit; font-size: 0.88rem; font-weight: 600; padding: 0.45rem 0.85rem; border-radius: 5px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); cursor: pointer; }
.btn:hover:not(:disabled) { border-color: var(--chart-line); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--midnight-2); border-color: #2c3f69; }
.btn.primary:hover:not(:disabled) { background: #24365e; }
.btn.ghost { background: transparent; font-weight: 500; }
.btn.add { padding: 0.25rem 0.7rem; font-size: 0.8rem; }
.ballot-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.85rem; }
.ballot-actions .primary { margin-left: auto; }
.ballot-status { min-height: 1.3em; margin: 0.6rem 0 0; font-size: 0.85rem; color: var(--muted); }
.ballot-status.error { color: var(--loss); }

.pool-filters { margin: 0 0 0.75rem; }
.pool-filters input[type="search"] { flex: 1 1 220px; min-width: 0; }
.pool-table td { vertical-align: middle; }
.pool-name { font-weight: 500; margin-right: 0.4rem; }
.pool-school { display: block; font-size: 0.8rem; }
.pool-table tr.picked { background: rgba(127, 158, 214, 0.07); }
.on-ballot { font-size: 0.8rem; color: var(--chart-line); white-space: nowrap; }
.badge { display: inline-block; font-size: 0.68rem; font-weight: 600; padding: 0.05rem 0.4rem; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--silver); vertical-align: 1px; white-space: nowrap; }
.badge.gold { border-color: rgba(201, 179, 126, 0.5); color: var(--gold); }
.more-btn { margin-top: 0.75rem; }
#standings { margin-top: 2rem; }


/* ---------- mock dual ---------- */
.dual-pick { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 1rem 0 0.5rem; }
.dual-pick select { font: inherit; font-size: 0.95rem; padding: 0.45rem 0.6rem; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface); color: var(--text); flex: 1 1 200px; min-width: 0; }
.dual-pick .btn { text-decoration: none; }
.dual-mode { margin: 1rem 0; }
.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 0.25rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 1rem 1.25rem; }
.scoreboard .team { display: flex; align-items: center; gap: 0.9rem; min-width: 0; }
.scoreboard .team-b { justify-content: flex-end; }
.team-name { font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-score { font-size: 2.4rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); }
.team.lead .team-score { color: var(--text); }
.team-a .team-name { color: var(--chart-line); }
.team-b .team-name { color: var(--gold); }
.vs { color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.1em; }
.verdict { grid-column: 1 / -1; text-align: center; margin: 0.5rem 0 0.25rem; font-weight: 600; }
.odds { grid-column: 1 / -1; display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--line); gap: 2px; }
.odds span { display: block; height: 100%; transition: width 0.25s; }
.odds-a { background: var(--chart-line); }
.odds-tie { background: var(--muted); }
.odds-b { background: var(--gold); }
.scoreboard > .small { grid-column: 1 / -1; text-align: center; margin: 0.35rem 0 0; }

.dual-bouts { margin-top: 1rem; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.bout { display: grid; grid-template-columns: 3.4rem minmax(0, 1fr) 9.5rem minmax(0, 1fr) 4.2rem; align-items: center; gap: 0.75rem; padding: 0.55rem 0.9rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.bout:nth-child(even) { background: var(--surface-2); }
.bout:last-child { border-bottom: 0; }
.bout-wt { font-weight: 700; font-variant-numeric: tabular-nums; }
.bout-score { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.9rem; }
.side { min-width: 0; padding: 0.3rem 0.5rem; border-radius: 5px; border: 1px solid transparent; }
.side-b { text-align: right; }
.side select { width: 100%; font: inherit; font-size: 0.9rem; padding: 0.3rem 0.4rem; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--bg); color: var(--text); }
.side .meta { font-size: 0.78rem; color: var(--muted); margin-top: 0.2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .profile { color: var(--link); }
.side-a.win { background: rgba(127, 158, 214, 0.1); border-color: rgba(127, 158, 214, 0.45); }
.side-b.win { background: rgba(201, 179, 126, 0.1); border-color: rgba(201, 179, 126, 0.45); }
.call { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "arrow method" "arrow prob" "src src"; align-items: center; column-gap: 0.4rem; text-align: center; }
.call.b-wins { grid-template-columns: 1fr auto; grid-template-areas: "method arrow" "prob arrow" "src src"; }
.call-arrow { grid-area: arrow; font-size: 0.9rem; }
.a-wins .call-arrow { color: var(--chart-line); }
.b-wins .call-arrow { color: var(--gold); }
.call-method { grid-area: method; font-weight: 600; font-size: 0.9rem; }
.call-prob { grid-area: prob; font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.call-who { display: none; }
.call-src { grid-area: src; font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 0.15rem; }
.call.fallback .call-src { font-style: italic; }
.call.none { display: block; }
.dual-notes { margin-top: 1rem; }

@media (max-width: 760px) {
  .scoreboard { padding: 0.8rem; gap: 0.25rem 0.5rem; }
  .scoreboard .team { flex-direction: column-reverse; align-items: flex-start; gap: 0; }
  .scoreboard .team-b { align-items: flex-end; }
  .team-name { font-size: 1rem; max-width: 100%; white-space: normal; line-height: 1.2; }
  .scoreboard .team-b .team-name { text-align: right; }
  .team-score { font-size: 2rem; }
  .bout { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "wt score" "a a" "call call" "b b"; gap: 0.35rem 0.5rem; padding: 0.7rem 0.8rem; }
  .bout .side-b { text-align: left; }
  .bout .call { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 0.15rem 0.45rem; text-align: center; padding: 0.15rem 0; }
  .bout .call-arrow { display: none; }
  .bout .call-who { display: inline; font-weight: 600; }
  .bout .call.a-wins .call-who { color: var(--chart-line); }
  .bout .call.b-wins .call-who { color: var(--gold); }
  .bout .call-method { font-weight: 500; }
  .bout .call-src { margin-top: 0; }
  .bout-wt { grid-area: wt; }
  .bout-score { grid-area: score; }
  .bout .side-a { grid-area: a; }
  .bout .side-b { grid-area: b; }
  .bout .call { grid-area: call; }
}

@media (max-width: 860px) {
  .ballot-layout { grid-template-columns: minmax(0, 1fr); }
  .ballot-panel { position: static; }
}

/* ---------- state / region / district ranks ---------- */
.area-ranks-title { margin: 1.1rem 0 0.4rem; color: var(--muted); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.area-ranks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; margin: 0 0 0.25rem; }
.area-rank {
  display: flex; flex-direction: column; padding: 0.65rem 0.9rem; border-radius: 6px;
  background: var(--midnight); border: 1px solid #2c3f69; color: var(--text);
}
.area-rank:hover { text-decoration: none; border-color: var(--chart-line); }
.area-rank .label { color: var(--muted); font-size: 0.78rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.area-rank .value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.area-rank .of { color: var(--muted); font-size: 0.78rem; }
.area-rank.top { border-color: rgba(201, 179, 126, 0.55); }
.area-rank.top .value { color: var(--gold); }

.scope-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin: 1rem 0 0.75rem; }
.scope-bar select { font: inherit; font-size: 0.95rem; padding: 0.45rem 0.6rem; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface); color: var(--text); }
.rank-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem; margin: 0.5rem 0; }
.rank-head h2 { margin: 0; }

/* ---------- boys / girls ---------- */
.brand-tag {
  display: inline-block; margin-left: 0.45rem; padding: 0.1rem 0.45rem; border-radius: 999px; vertical-align: middle;
  font-family: var(--font-body); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--gold); border: 1px solid rgba(201, 179, 126, 0.5);
}
.division-switch a { padding: 0.18rem 0.8rem; font-size: 0.82rem; }
.menu-division { display: none; }

/* ---------- phones ---------- */
/* Desktop shows full tables and the top nav; phones get a slim title bar
   that hides while scrolling down, a dropdown menu instead of the nav,
   compact rows (secondary columns fold into .m-meta), 16px form text so iOS
   doesn't zoom on focus, and tap targets of at least 44px. */
.m-meta { display: none; }
.menu, .ballot-tray, .toast { display: none; }

@media (max-width: 640px) {
  main { padding: 1rem 1rem 1.5rem; }
  h1 { font-size: 1.55rem; }
  h2 { margin-top: 1.6rem; }
  .lede { font-size: 0.95rem; }

  /* slim title bar: hides while scrolling down, back on scroll up (site.js) */
  .top {
    position: sticky; top: 0; z-index: 20; flex-wrap: nowrap; justify-content: space-between;
    padding: calc(0.5rem + env(safe-area-inset-top)) 1rem 0.5rem;
    transition: transform 0.25s ease;
  }
  .top.top-hidden { transform: translateY(-100%); }
  .top .top-nav, .top .counts, .top .division-switch { display: none; }
  .menu-division { display: flex; margin: 0.15rem 0.15rem 0.35rem; }
  .menu-division a { flex: 1; justify-content: center; min-height: 40px; }
  .brand { font-size: 1.2rem; display: inline-flex; align-items: center; min-height: 44px; margin: -0.35rem 0; }

  /* the menu: a pill naming the current page, dropping down every page */
  .menu { display: block; margin-left: auto; }
  .menu > summary {
    list-style: none; display: inline-flex; align-items: center; gap: 0.4rem;
    min-height: 40px; padding: 0 0.75rem 0 0.65rem; border-radius: 999px; cursor: pointer;
    background: var(--surface); border: 1px solid var(--line-strong); color: var(--text);
    font-weight: 600; font-size: 0.92rem; -webkit-tap-highlight-color: transparent; user-select: none;
  }
  .menu > summary::-webkit-details-marker { display: none; }
  .menu > summary:focus-visible { outline: 2px solid var(--chart-line); outline-offset: 2px; }
  .menu svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .menu-icon { width: 18px; height: 18px; color: var(--chart-line); }
  .menu-chevron { width: 16px; height: 16px; color: var(--muted); transition: transform 0.2s ease; }
  .menu[open] > summary { border-color: var(--chart-line); }
  .menu[open] .menu-chevron { transform: rotate(180deg); }
  .menu[open]::before {   /* dims the page; a tap on it closes the menu (site.js) */
    content: ""; position: fixed; inset: 0; z-index: -1; background: rgba(3, 5, 9, 0.6);
    animation: menu-fade 0.18s ease-out;
  }
  .menu-panel {
    position: absolute; left: 0.5rem; right: 0.5rem; top: calc(100% + 0.35rem);
    display: grid; gap: 2px; padding: 0.4rem; border-radius: 12px;
    background: var(--surface-2); border: 1px solid var(--line-strong);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
    transform-origin: top right; animation: menu-drop 0.2s cubic-bezier(0.2, 0.7, 0.2, 1);
  }
  .menu-panel a {
    display: flex; align-items: center; gap: 0.85rem; min-height: 54px; padding: 0.45rem 0.75rem;
    border-radius: 8px; color: var(--text); -webkit-tap-highlight-color: transparent;
  }
  .menu-panel a:hover, .menu-panel a:focus-visible { text-decoration: none; background: rgba(127, 158, 214, 0.08); }
  .menu-panel a.active { background: var(--midnight-2); }
  .menu-panel svg { width: 22px; height: 22px; flex: none; color: var(--muted); }
  .menu-panel a.active svg { color: var(--chart-line); }
  .menu-panel strong { display: block; font-weight: 600; }
  .menu-panel small { display: block; color: var(--muted); font-size: 0.8rem; margin-top: 0.05rem; }
  html.menu-open { overflow: hidden; }
  .foot { padding: 1rem 1rem 1.25rem; }

  /* forms */
  input, select, textarea, button, .btn { font-size: 16px !important; }
  input[type="search"], select, .btn, .filters button { min-height: 44px; }
  .check { min-height: 44px; font-size: 0.95rem; }
  .check input { width: 20px; height: 20px; }
  .filters input[type="search"], .filters select { flex: 1 1 100%; min-width: 0; }
  .list-filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.5rem; }
  .list-filters input[type="search"], .list-filters select[name="school"], .list-filters .check { grid-column: 1 / -1; }
  .list-filters .reset { display: flex; align-items: center; justify-content: center; min-height: 44px; }

  /* compact tables: rank · name (+ meta line) · key number */
  .m-hide, .d-inline { display: none; }
  .m-meta { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 0.1rem; line-height: 1.35; }
  th, td { padding: 0.6rem 0.6rem; }
  .row-link { display: block; font-weight: 500; padding: 0.1rem 0; }
  .pager { justify-content: center; align-items: center; gap: 0.5rem; }
  .pager a { min-height: 44px; display: inline-flex; align-items: center; padding: 0 1.1rem; }
  .pager-pos { color: var(--muted); padding: 0 0.5rem; font-variant-numeric: tabular-nums; }

  /* home */
  .hero { padding: 0.25rem 0 0; }
  .nj-mark { height: 220px; }
  .hero-sub { font-size: 0.9rem; }
  .divider { margin-top: 1rem; }
  .seg a { min-height: 44px; display: inline-flex; align-items: center; padding: 0 1.25rem; }
  .weights { grid-template-columns: 1fr; }
  .weight-card li { position: relative; padding: 0.55rem 0; }
  .weight-card .who > a::after { content: ""; position: absolute; inset: 0; }  /* whole row taps through */
  .weight-card .more { min-height: 44px; display: inline-flex; align-items: center; }
  .weight-card header .weight-name { display: inline-flex; align-items: center; min-height: 44px; margin: -0.4rem 0; }

  /* wrestler page */
  .area-ranks { gap: 0.4rem; }
  .area-rank { padding: 0.55rem 0.6rem; }
  .area-rank .value { font-size: 1.3rem; }
  .scope-bar { display: grid; grid-template-columns: minmax(0, 1fr); }
  .scope-bar .seg { justify-self: start; }
  .scope-bar select { min-height: 44px; width: 100%; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
  .card { padding: 0.6rem 0.8rem; }
  .card .value { font-size: 1.3rem; }
  .chart-key { justify-content: flex-start; flex-wrap: wrap; }
  .plain li { position: relative; padding: 0.6rem 0; }
  .plain li > a::after { content: ""; position: absolute; inset: 0; }

  /* fan vote */
  .weight-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0.5rem -1rem 0.75rem; padding: 0 1rem 0.25rem; scrollbar-width: none; }
  .weight-chips::-webkit-scrollbar { display: none; }
  .weight-chips a { min-height: 40px; display: inline-flex; align-items: center; padding: 0 0.85rem; flex: none; }
  .ballot-panel { padding: 0.8rem; }
  .slot { grid-template-columns: 1.8rem minmax(0, 1fr) auto; gap: 0.4rem; }
  .icon-btn { width: 44px; height: 44px; font-size: 1rem; }
  .slot-actions { gap: 0.25rem; }
  .ballot-actions .btn { flex: 1 1 auto; }
  .ballot-actions .primary { flex-basis: 100%; margin-left: 0; }
  .btn.add { min-height: 44px; padding: 0 1rem; }
  .pool-table td { padding: 0.5rem 0.5rem; }
  .pool-school { font-size: 0.78rem; }
  .ballot-tray:not([hidden]) {
    display: flex; align-items: center; gap: 0.5rem;
    position: fixed; left: 0.6rem; right: 0.6rem; z-index: 25;
    bottom: calc(0.6rem + env(safe-area-inset-bottom));
    padding: 0.45rem 0.45rem 0.45rem 0.6rem; border-radius: 10px;
    background: var(--midnight); border: 1px solid #2c3f69; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  }
  .tray-view { flex: 1; min-height: 44px; display: flex; align-items: center; gap: 0.6rem; background: none; border: 0; color: var(--text); font: inherit; text-align: left; padding: 0; }
  .tray-count { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--chart-line); }
  .tray-label { color: var(--silver); font-size: 0.9rem; }
  .ballot-tray .btn { min-width: 6.5rem; }
  .toast:not([hidden]) {
    display: block; position: fixed; left: 50%; transform: translateX(-50%); z-index: 26;
    bottom: calc(5rem + env(safe-area-inset-bottom)); max-width: calc(100% - 2rem);
    padding: 0.55rem 0.9rem; border-radius: 999px; font-size: 0.88rem;
    background: var(--surface-2); border: 1px solid var(--line-strong); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  }
  .vote-card { min-height: 0; }

  /* mock dual */
  .dual-pick { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 0.5rem; }
  .dual-pick select { grid-column: 1; min-width: 0; }
  .dual-pick #swap { grid-column: 2; grid-row: 1 / span 2; align-self: center; padding: 0; height: 44px; }
  .dual-pick .btn.primary, .dual-pick a.btn { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; }
  .side select { min-height: 44px; }
  .side .meta { white-space: normal; }
}


/* Any touchscreen (tablets included): 16px form text so iOS Safari doesn't
   zoom in when a field is tapped. */
@media (pointer: coarse) {
  input, select, textarea { font-size: 16px !important; }
}

/* ---------- home: first place written in gold ---------- */
/* Each card's #1 name is gold script. With motion allowed (and ink.js
   running), cards float in and the name is revealed left to right behind a
   bobbing pen, then a shine sweeps across it. The mask's soft edge sits at
   50% of a 200%-wide gradient, so the edge travels 0 -> 106% of the name as
   mask-position goes 100% -> -6%, in step with the pen's `left`. */
.ink { position: relative; display: inline-block; max-width: 100%; align-self: flex-start; font-size: 1.32rem; }
.ink-name {
  display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: "Dancing Script", "Brush Script MT", cursive; font-weight: 700; font-size: 1em;
  line-height: 1.3; padding: 0 0.3em 0.05em 0;
  background: linear-gradient(100deg, #a8894c 0%, #e9d39a 28%, #c9b37e 48%, #f6e7ba 66%, #b2924f 100%);
  background-size: 220% 100%; background-position: 100% 0;
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ink-name:hover, .ink-name:focus-visible { text-decoration: underline; text-decoration-color: rgba(201, 179, 126, 0.6); }
.ink-pen {
  position: absolute; left: 106%; bottom: 0.18em; width: 1.3em; height: 1.3em;
  opacity: 0; pointer-events: none; transform-origin: 0 100%;
  filter: drop-shadow(0 0 4px rgba(233, 211, 154, 0.55));
}
.ink-pen svg { display: block; width: 100%; height: 100%; }

@media (prefers-reduced-motion: no-preference) {
  .ink-js .weights .weight-card { opacity: 0; transform: translateY(14px); }
  .ink-js .weights .weight-card.in {
    opacity: 1; transform: none;
    transition: opacity 0.45s ease, transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1);
  }
  .ink-js .ink-name {
    -webkit-mask-image: linear-gradient(90deg, #000 49%, transparent 51%);
            mask-image: linear-gradient(90deg, #000 49%, transparent 51%);
    -webkit-mask-size: 200% 100%; mask-size: 200% 100%;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    -webkit-mask-position: 100% 0; mask-position: 100% 0;
  }
  /* Failsafe: if ink.js never runs, show everything after a few seconds. */
  .ink-js:not(.ink-live) .weights .weight-card { animation: card-failsafe 0s 4s forwards; }
  .ink-js:not(.ink-live) .ink-name { animation: ink-failsafe 0s 4s forwards; }

  .ink-js .ink.play .ink-name { animation: ink-write var(--dur, 1.4s) linear forwards; }
  .ink-js .ink.play .ink-pen {
    opacity: 1;
    animation: pen-move var(--dur, 1.4s) linear forwards, pen-bob 0.16s ease-in-out infinite alternate;
  }
  .ink-js .ink.done .ink-name {
    -webkit-mask-image: none; mask-image: none;
    animation: ink-shine 1.2s ease-out forwards;
  }
  .ink-js .ink.done .ink-pen { animation: pen-lift 0.5s ease-in forwards; }
}

@keyframes ink-write {
  from { -webkit-mask-position: 100% 0; mask-position: 100% 0; }
  to   { -webkit-mask-position: -6% 0; mask-position: -6% 0; }
}
@keyframes ink-failsafe { to { -webkit-mask-position: -6% 0; mask-position: -6% 0; } }
@keyframes card-failsafe { to { opacity: 1; transform: none; } }
@keyframes pen-move { from { left: 0; } to { left: 106%; } }
@keyframes pen-bob {
  from { transform: translate(-0.1em, 0) rotate(0deg); }
  to   { transform: translate(-0.1em, -0.18em) rotate(-7deg); }
}
@keyframes pen-lift {
  from { opacity: 1; transform: translate(-0.1em, 0); }
  to   { opacity: 0; transform: translate(0.6em, -0.9em) rotate(14deg); }
}
@keyframes ink-shine { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* The border draws itself, the land and words fade in, then a band of light
   sweeps across the gold every few seconds. */
@media (prefers-reduced-motion: no-preference) {
  .nj-edge { stroke-dasharray: 1 1; stroke-dashoffset: 1; animation: nj-draw 1.8s cubic-bezier(0.45, 0.05, 0.25, 1) 0.1s forwards; }
  .nj-land { opacity: 0; animation: nj-fade 1.2s ease 0.5s forwards; }
  .nj-mark > .nj-words { opacity: 0; animation: nj-fade 1s ease 1s forwards; }
  .nj-glint { animation: nj-glint 7s ease-in-out 2s infinite; }
}
@keyframes nj-draw { to { stroke-dashoffset: 0; } }
@keyframes nj-fade { to { opacity: 1; } }
@keyframes nj-glint { from { transform: translateX(0); } 55%, to { transform: translateX(540px); } }

@keyframes menu-drop { from { opacity: 0; transform: translateY(-6px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes menu-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .menu-panel, .menu[open]::before { animation: none; }
  .top { transition: none; }
}
