/* Varsity Field Hockey - one family (Archivo), used wide for headings and normal width for text.
   Turf green and ball yellow come from the pitch itself. */

:root {
  --ink: #16302c;
  --muted: #566a65;
  --paper: #f4f7f5;
  --surface: #ffffff;
  --rule: #dce5e1;
  --field: #b7c8c1;
  --turf: #1e6b52;
  --turf-deep: #0e4a3a;
  --turf-tint: #e3f1ea;
  --ball: #f0c419;
  --ball-ink: #4a3a00;
  --danger: #b3372b;
  --danger-tint: #fbe9e6;
  --focus: #2a6fdb;
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.5 var(--font); font-stretch: 100%;
}
a { color: var(--turf-deep); }
a:hover { color: var(--turf); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
[hidden] { display: none !important; }

/* ---- header ---- */
.top { background: var(--surface); border-bottom: 1px solid var(--rule); }
.bar { display: flex; align-items: center; gap: 8px 24px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 0; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 6px 0; }
.ball {
  width: 15px; height: 15px; border-radius: 50%; background: var(--ball);
  box-shadow: inset -2px -3px 0 rgba(74, 58, 0, .22);
}
.brand-name { font-weight: 800; font-stretch: 125%; font-size: 18px; letter-spacing: -.01em; color: var(--ink); }
.nav { display: flex; gap: 2px; margin-bottom: -1px; }
.nav a {
  padding: 12px 14px; text-decoration: none; color: var(--muted); font-weight: 600;
  border-bottom: 3px solid transparent;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--turf); }
.season { margin-left: auto; padding-bottom: 8px; }

/* ---- page title ---- */
h1 {
  font-size: clamp(28px, 5.2vw, 46px); font-stretch: 125%; font-weight: 800; line-height: 1.04;
  letter-spacing: -.02em; margin: 30px 0 8px;
}
h2 { font-size: 20px; font-stretch: 112%; font-weight: 800; letter-spacing: -.01em; margin: 34px 0 12px; }
.lede { color: var(--muted); max-width: 62ch; margin: 0 0 22px; }
.muted { color: var(--muted); }

/* ---- controls ---- */
select, input[type="text"], input[type="date"], input[type="number"] {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--field); border-radius: 8px; padding: 9px 12px; min-height: 42px;
  max-width: 100%;
}
select:hover, input:hover { border-color: var(--turf); }
input.invalid, select.invalid { border-color: var(--danger); background: var(--danger-tint); }
.seg { display: inline-flex; border: 1.5px solid var(--turf); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button {
  font: inherit; font-weight: 700; color: var(--turf-deep); background: transparent; border: 0;
  padding: 9px 18px; cursor: pointer; min-height: 42px;
}
.seg button + button { border-left: 1.5px solid var(--turf); }
.seg button[aria-pressed="true"] { background: var(--turf); color: #fff; }
.seg .n { font-weight: 500; opacity: .8; margin-left: 6px; font-size: 14px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: end; margin: 0 0 16px; }
.toolbar label { display: grid; gap: 4px; font-size: 14px; font-weight: 600; color: var(--muted); }

.btn {
  font: inherit; font-weight: 700; background: var(--turf); color: #fff; border: 1.5px solid var(--turf);
  border-radius: 8px; padding: 10px 18px; min-height: 44px; cursor: pointer;
}
.btn:hover { background: var(--turf-deep); border-color: var(--turf-deep); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--turf-deep); }
.btn.ghost:hover { background: var(--turf-tint); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.small { min-height: 34px; padding: 5px 12px; font-size: 14px; }

/* ---- tables ---- */
.scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; }
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-stretch: 95%; }
.tbl th {
  font-weight: 600; font-size: 13px; color: var(--muted); text-align: right; padding: 11px 12px;
  border-bottom: 1px solid var(--rule); vertical-align: bottom; line-height: 1.25;
}
.tbl td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #f0f7f3; }
.tbl .l { text-align: left; }
.tbl .name { font-weight: 700; text-align: left; }
.tbl .name a { color: var(--ink); text-decoration: none; }
.tbl .name a:hover { text-decoration: underline; color: var(--turf-deep); }
.tbl .pos { font-weight: 800; font-stretch: 125%; text-align: left; width: 48px; }
.tbl .key { font-weight: 800; }
.tbl th button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; font-weight: 600; }
.tbl th button:hover { color: var(--ink); }
.tbl th[aria-sort="descending"] button::after { content: " \25BE"; }
.tbl th[aria-sort="ascending"] button::after { content: " \25B4"; }
.tbl th[aria-sort] { color: var(--ink); }
.rk { margin-left: 6px; font-size: 12px; color: var(--muted); font-weight: 500; }
.cut td { border-bottom: 2px solid var(--turf); }
.result-W { color: var(--turf); font-weight: 800; }
.result-L { color: var(--danger); font-weight: 800; }
.result-T { color: var(--muted); font-weight: 800; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: #e6eeea; margin-left: 6px; }
.tag.off { background: #f1e4e1; color: var(--danger); }
.struck { color: var(--muted); text-decoration: line-through; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 18px; margin-bottom: 4px; }

/* ---- team summary ---- */
.stats { display: flex; flex-wrap: wrap; margin: 18px 0 22px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.stat { padding: 12px 28px 12px 0; }
.stat b { display: block; font-size: 22px; font-weight: 800; font-stretch: 118%; line-height: 1.2; }
.stat span { font-size: 13px; color: var(--muted); }

/* ---- seeding ---- */
.pitch {
  position: relative; border-radius: 14px; color: #fff; padding: 26px 26px 28px; overflow: hidden;
  background-color: var(--turf-deep);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 360' preserveAspectRatio='xMidYMid slice'%3E%3Cg fill='none' stroke='white' stroke-opacity='.2' stroke-width='3'%3E%3Crect x='6' y='6' width='788' height='348'/%3E%3Cpath d='M400 6V354'/%3E%3Ccircle cx='400' cy='180' r='46'/%3E%3Cpath d='M6 70A110 110 0 0 1 116 180A110 110 0 0 1 6 290'/%3E%3Cpath d='M6 20A160 160 0 0 1 166 180A160 160 0 0 1 6 340' stroke-dasharray='10 9'/%3E%3Cpath d='M794 70A110 110 0 0 0 684 180A110 110 0 0 0 794 290'/%3E%3Cpath d='M794 20A160 160 0 0 0 634 180A160 160 0 0 0 794 340' stroke-dasharray='10 9'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover; background-position: center;
}
.pitch h2 { color: #fff; margin: 0 0 4px; font-size: 24px; }
.pitch p { margin: 0 0 18px; color: rgba(255, 255, 255, .82); max-width: 60ch; }
.matchups { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 16px; }
.match { background: rgba(8, 40, 31, .55); border: 1px solid rgba(255, 255, 255, .38); border-radius: 10px; overflow: hidden; }
.match .side { display: flex; align-items: center; gap: 12px; padding: 12px 14px; font-weight: 700; }
.match .side + .side { border-top: 1px solid rgba(255, 255, 255, .25); font-weight: 500; }
.seedno {
  display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .85); font-size: 13px; font-weight: 800; font-stretch: 100%;
}
.seedno.top { background: var(--ball); border-color: var(--ball); color: var(--ball-ink); }
.pairs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
@media (min-width: 980px) { .pairs { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; } }
.mx { border-collapse: collapse; font-stretch: 95%; }
.mx th, .mx td { padding: 0; }
.mx thead th { height: 128px; vertical-align: bottom; }
.mx thead th span { display: inline-block; writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; font-size: 12px; font-weight: 600; color: var(--muted); padding: 4px 0; }
.mx tbody th { text-align: right; font-size: 13px; font-weight: 600; padding-right: 8px; white-space: nowrap; }
.mx td { width: 30px; height: 28px; text-align: center; border: 1px solid var(--rule); cursor: pointer; font-size: 14px; }
.mx td.self { background: #eef2f0; cursor: default; }
.mx td.w { background: var(--turf-tint); color: var(--turf-deep); font-weight: 800; }
.mx td.sel { outline: 3px solid var(--ball); outline-offset: -3px; }
.mx td:not(.self):hover { background: #cfe8da; }
.cmp td.win { background: var(--turf-tint); font-weight: 800; }
.cmp td, .cmp th { white-space: normal; }
.verdict { margin: 12px 0 0; font-weight: 600; }

/* ---- admin ---- */
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 22px; }
.form-grid { display: grid; gap: 18px; }
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { display: grid; gap: 5px; align-content: start; }
.field > label, .field > .lab { font-size: 14px; font-weight: 700; }
.field .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.field select, .field input[type="text"], .field input[type="date"] { width: 100%; }
.field input.score { width: 110px; font-size: 22px; font-weight: 800; text-align: center; }
.err { color: var(--danger); font-size: 14px; font-weight: 600; min-height: 0; }
.hint { color: var(--muted); font-size: 14px; }
.checks { display: flex; gap: 20px; flex-wrap: wrap; align-items: center; }
.checks label { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; min-height: 42px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.status { font-weight: 700; min-height: 24px; }
.status.ok { color: var(--turf); }
.status.bad { color: var(--danger); }
.alert { border-left: 5px solid var(--ball); background: #fff8dc; padding: 12px 16px; border-radius: 6px; }
.alert .actions { margin-top: 10px; }
.editing { border-left: 5px solid var(--turf); background: var(--turf-tint); padding: 8px 14px; border-radius: 6px; font-weight: 600; }
details.tools { margin-top: 32px; }
details.tools summary, details.how summary { cursor: pointer; font-weight: 700; padding: 8px 0; }
details.how { margin-top: 24px; max-width: 74ch; }
details.how p, details.how li { color: var(--ink); }
.foot { margin: 56px 0 36px; color: var(--muted); font-size: 14px; }

@media (max-width: 720px) {
  .hide-sm { display: none; }
  .teams { grid-template-columns: 1fr; }
  .tbl th, .tbl td { padding: 9px 8px; }
  .nav a { padding: 11px 10px; }
  .season { margin-left: 0; width: 100%; padding-bottom: 10px; }
  .panel { padding: 16px; }
  .pitch { padding: 20px 16px 22px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
