:root {
  --paper: #F6F6F3;
  --surface: #FFFFFF;
  --surface-2: #F0F0EC;
  --line: #DEDDD7;
  --ink: #1B1B1D;
  --ink-dim: #6E6E71;
  --steel: #8B8F94;
  --steel-light: #C7CACD;
  --gold: #B8902E;
  --gold-bright: #D4A94A;
  --good: #2E7D4F;
  --bad: #B8422E;
  --font-display: 'Oswald', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: var(--paper);
  background-image: url('bg.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1000px; margin: 0 auto; padding: 0 20px; }

/* ---------------- header ---------------- */
.site-head {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.head-inner { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; gap: 16px; flex-wrap: wrap; }
.brand-logo { height: 56px; width: auto; }

.mega-tabs { gap: 6px; background: var(--surface-2); border-radius: 10px; padding: 4px; }
.tab {
  font-family: var(--font-display); font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-dim); background: transparent; border: none; padding: 9px 20px; border-radius: 7px;
  cursor: pointer; transition: background 0.15s, color 0.15s;
}
.tab:hover { color: var(--ink); }
.tab.active { background: var(--ink); color: #fff; font-weight: 600; }

.sub-nav-wrap { overflow-x: auto; scrollbar-width: none; }
.sub-nav-wrap::-webkit-scrollbar { display: none; }
.sub-tabs { display: flex; gap: 4px; padding: 8px 0; white-space: nowrap; }
.subtab {
  font-family: var(--font-display); font-size: 12px; letter-spacing: 0.03em; text-transform: uppercase;
  color: var(--ink-dim); background: transparent; border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 14px; cursor: pointer; transition: all 0.15s; flex-shrink: 0;
}
.subtab:hover { border-color: var(--gold); color: var(--ink); }
.subtab.active { background: var(--gold); border-color: var(--gold); color: #fff; font-weight: 600; }

/* ---------------- mega / view switching ---------------- */
.mega { display: none; }
.mega.active { display: block; }
.view { display: none; padding: 24px 0 60px; }
.view.active { display: block; animation: fadeUp 0.3s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.view-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
h1 {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(22px, 4vw, 30px);
  margin: 0 0 4px; letter-spacing: 0.005em; display: flex; align-items: center; gap: 8px;
}
.h1-logo { height: 0.85em; width: auto; vertical-align: middle; }
.page-subtitle { font-family: var(--font-mono); font-size: 12px; color: var(--ink-dim); margin-bottom: 14px; letter-spacing: 0.03em; }

/* ---------------- chips ---------------- */
.controls { margin-bottom: 16px; }
.control-group { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.03em;
  background: var(--surface); color: var(--ink-dim);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 14px; cursor: pointer; transition: all 0.15s;
}
.chip.small { padding: 6px 11px; font-size: 11px; opacity: 0.75; }
.chip:hover { border-color: var(--gold); color: var(--ink); }
.chip.active { background: var(--gold); border-color: var(--gold); color: #fff; font-weight: 600; opacity: 1; }

.fine-print { font-size: 12.5px; color: var(--ink-dim); margin: 6px 0 20px; line-height: 1.5; }

/* ---------------- rankings: table with record + trend ---------------- */
.rank-table { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.rk-row {
  display: grid;
  grid-template-columns: 34px 1fr 26px 26px 26px 32px 32px 36px 40px 30px;
  gap: 4px; align-items: center; padding: 7px 12px; font-size: 12.5px;
  border-bottom: 1px solid var(--surface-2);
}
.rk-row:last-child { border-bottom: none; }
.rk-row.rk-head {
  font-family: var(--font-mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ink-dim); background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.rk-row .n { font-family: var(--font-mono); font-weight: 600; color: var(--steel); }
.rk-team { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk-row .v { font-family: var(--font-mono); font-size: 12px; color: var(--ink-dim); text-align: right; }
.rk-row .v.prior { color: var(--steel); }
.rk-row.rk-hm { background: #FBF4E4; }
.hm-tag { font-family: var(--font-mono); font-size: 9px; color: var(--gold); border: 1px solid var(--gold); border-radius: 4px; padding: 0 3px; margin-left: 4px; }
.trend { font-size: 12px; display: inline-block; }
.trend-up { color: #D4A430; }      /* yellow */
.trend-down { color: var(--bad); } /* red */
.trend-same { color: #3B6FC6; }    /* blue */
.trend-none { color: var(--steel); }
@media (max-width: 640px) {
  .rk-row { grid-template-columns: 26px 1fr 30px 30px; }
  .rk-row span:nth-child(3), .rk-row span:nth-child(4), .rk-row span:nth-child(5),
  .rk-row span:nth-child(6), .rk-row span:nth-child(7) { display: none; }
}

/* ---------------- standings ---------------- */
.section-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.section-card h3 { font-family: var(--font-display); font-size: 16px; margin: 0 0 12px; }
.stx-scroll { overflow-x: auto; }
.stx-table { border-collapse: collapse; font-size: 11.5px; min-width: 100%; }
.stx-table th, .stx-table td { padding: 5px 6px; border-bottom: 1px solid var(--surface-2); white-space: nowrap; }
.stx-group-row th {
  font-family: var(--font-display); font-weight: 600; font-size: 10.5px; text-align: center;
  color: var(--ink-dim); border-bottom: 1px solid var(--line); padding-bottom: 4px;
}
.stx-group-row th .inline-logo { height: 18px; width: auto; vertical-align: middle; margin-right: 4px; }
.stx-group-row th { line-height: 1.4; }
.stx-head-row th {
  font-family: var(--font-mono); font-size: 9px; text-transform: uppercase; color: var(--ink-dim);
  border-bottom: 1px solid var(--line); text-align: right;
}
.stx-head-row th.n, .stx-head-row th:nth-child(2) { text-align: left; }
.stx-table .n { font-family: var(--font-mono); color: var(--steel); position: sticky; left: 0; background: var(--surface); text-align: left; }
.stx-table .stx-team { font-weight: 600; position: sticky; left: 22px; background: var(--surface); text-align: left; }
.stx-table td.v { font-family: var(--font-mono); color: var(--ink-dim); font-size: 11px; text-align: right; }
.stx-table td.v.strong { color: var(--ink); font-weight: 600; }
.stx-table .grp-start { border-left: 1px solid var(--line); }
.no-data { color: var(--ink-dim); font-size: 13px; font-style: italic; padding: 8px 0; }
.sched-date-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; }
.sched-date-label { font-family: var(--font-mono); font-weight: 600; font-size: 12px; color: var(--gold); margin-bottom: 8px; }
.sched-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 13.5px; border-bottom: 1px solid var(--surface-2); }
.sched-row:last-child { border-bottom: none; }
.sched-away { font-weight: 500; }
.sched-at { color: var(--ink-dim); font-family: var(--font-mono); font-size: 11px; }
.sched-home { font-weight: 600; }
.sched-tag { margin-left: auto; font-family: var(--font-mono); font-size: 9px; color: var(--ink-dim); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }

/* ---------------- predictor ---------------- */
.predict-panel { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 16px; margin-bottom: 20px; }
.predict-side { display: flex; flex-direction: column; gap: 6px; }
.predict-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-dim); }
.team-select, .year-select {
  font-family: var(--font-body); font-size: 14px; font-weight: 600;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px;
}
.year-select { font-family: var(--font-mono); font-size: 12px; font-weight: 500; }
.vs-mark { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--gold); padding-bottom: 12px; }

.predict-result { min-height: 120px; }
.pred-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.pred-score { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; gap: 10px; }
.pred-team-name { font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.pred-team-year { font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim); }
.pred-goals { font-family: var(--font-mono); font-weight: 600; font-size: 28px; }
.pred-prob-track { height: 10px; background: var(--surface-2); border-radius: 6px; overflow: hidden; display: flex; }
.pred-prob-a { background: var(--gold); height: 100%; }
.pred-prob-b { background: var(--steel); height: 100%; }
.pred-prob-labels { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 12px; color: var(--ink-dim); margin-top: 8px; }

/* ---------------- playoff bracket ---------------- */
.run-btn {
  font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: 0.03em; text-transform: uppercase;
  background: var(--gold); color: #fff; border: none; border-radius: 999px; padding: 11px 22px; cursor: pointer;
  transition: transform 0.1s; margin: 8px 0 20px;
}
.run-btn:hover { transform: translateY(-1px); }
.bracket-wrap { display: flex; gap: 22px; overflow-x: auto; padding: 10px 0 24px; }
.bracket-round { display: flex; flex-direction: column; justify-content: space-around; gap: 14px; min-width: 210px; }
.bracket-round-label { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-dim); text-align: center; margin-bottom: 4px; }
.b-match { display: flex; flex-direction: column; gap: 3px; }
.b-slot {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 12.5px;
}
.b-slot.winner { border-color: var(--gold); background: #FBF4E4; }
.b-slot .b-seed { font-family: var(--font-mono); color: var(--steel); width: 16px; flex-shrink: 0; }
.b-slot .b-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.b-slot .b-score { font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: var(--ink); flex-shrink: 0; }
.b-slot .b-so { font-family: var(--font-mono); font-size: 9px; font-weight: 600; color: var(--gold); border: 1px solid var(--gold); border-radius: 3px; padding: 0 3px; margin-left: 3px; }
.b-slot .b-pct { font-family: var(--font-mono); font-size: 11px; color: var(--steel); flex-shrink: 0; }

/* Champion sits in its own full-width block below the scrolling bracket, not squeezed
   into the horizontal-scroll row -- avoids long team names overflowing a narrow column. */
.b-champ {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 20px 16px; margin-top: 8px; border-top: 2px solid var(--gold);
}
.b-champ-label { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; color: var(--gold); letter-spacing: 0.06em; }
.b-champ-name { font-family: var(--font-display); font-weight: 700; font-size: 20px; text-align: center; max-width: 90%; overflow-wrap: break-word; }

.section-subhead {
  font-family: var(--font-display); font-weight: 600; font-size: 18px;
  margin: 28px 0 4px; padding-top: 20px; border-top: 1px solid var(--line);
}
.section-subhead:first-of-type { margin-top: 8px; padding-top: 0; border-top: none; }

.ptw-section-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; }
.ptw-section-title { font-family: var(--font-display); font-weight: 600; font-size: 14px; margin-bottom: 8px; color: var(--ink-dim); }
.ptw-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--surface-2); font-size: 13.5px; }
.ptw-row:last-child { border-bottom: none; }
.ptw-badge {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: 0.03em;
  padding: 2px 7px; border-radius: 999px; flex-shrink: 0; text-transform: uppercase;
}
.ptw-badge.America { background: #7B2D8E; color: #fff; }
.ptw-badge.State { background: var(--gold); color: #fff; }
.ptw-badge.WPIAL { background: var(--steel-light); color: var(--ink); }
.ptw-badge.Section { background: var(--surface-2); color: var(--ink-dim); border: 1px solid var(--line); }
.ptw-name { font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ptw-meta { font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim); flex-shrink: 0; }

.honors-tier-block { margin-bottom: 22px; }
.honors-tier-title { font-family: var(--font-display); font-weight: 600; font-size: 16px; margin-bottom: 10px; }
.honors-row { display: grid; grid-template-columns: 1fr 1fr 60px 55px; gap: 10px; align-items: center; padding: 7px 4px; border-bottom: 1px solid var(--surface-2); font-size: 13px; }
.honors-row.honors-head { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; color: var(--ink-dim); border-bottom: 1px solid var(--line); }
.honors-row .hname { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.honors-row .hteam { color: var(--ink-dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.honors-row .hpos { font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim); }
.honors-row .hstatus { font-family: var(--font-mono); font-size: 11px; }
@media (max-width: 640px) {
  /* Keep Player + Team always visible on mobile; drop only Position, since Grade and Team
     are what people actually scan for -- Team specifically must never disappear here. */
  .honors-row { grid-template-columns: 1fr 1fr 40px; }
  .honors-row .hpos { display: none; }
}
.wl-class-block { margin-bottom: 22px; }
.wl-class-title { font-family: var(--font-display); font-weight: 600; font-size: 15px; margin-bottom: 10px; color: var(--ink-dim); }
.wl-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .wl-cols { grid-template-columns: 1fr; } }
.wl-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.wl-card-head { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.wl-card.over .wl-card-head { color: var(--good); }
.wl-card.under .wl-card-head { color: var(--bad); }
.wl-item { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13px; border-bottom: 1px solid var(--surface-2); }
.wl-item:last-child { border-bottom: none; }
.wl-delta { font-family: var(--font-mono); font-weight: 600; }
.wl-item.over .wl-delta { color: var(--good); }
.wl-item.under .wl-delta { color: var(--bad); }

/* ---------------- under construction ---------------- */
.under-construction { text-align: center; padding: 100px 20px; }
.about-page { max-width: 640px; margin: 0 auto; }
.about-page h1 { margin-bottom: 20px; }
.about-page h2 { font-family: var(--font-display); font-size: 18px; margin: 28px 0 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.about-page h2:first-of-type { border-top: none; padding-top: 0; }
.about-page p { font-size: 14px; line-height: 1.65; color: var(--ink-dim); margin: 0 0 12px; }
.about-page a { color: var(--gold); }
.uc-badge { font-size: 48px; margin-bottom: 12px; }
.under-construction h1 { margin-bottom: 6px; }
.under-construction p { color: var(--ink-dim); }

/* ---------------- footer ---------------- */
.site-foot { border-top: 1px solid var(--line); padding: 20px 0 40px; font-size: 12px; color: var(--ink-dim); text-align: center; }
.updated-line { font-family: var(--font-mono); font-size: 11px; color: var(--steel); margin-bottom: 6px; letter-spacing: 0.04em; }

/* ---------------- accessibility ---------------- */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
