/* ==========================================================================
   Pickleball Ladder League
   ========================================================================== */

@font-face {
  font-family: 'Inter';
  src: url('/static/fonts/inter-latin-wght-normal.woff2') format('woff2-variations'),
       url('/static/fonts/inter-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --forest: #0f3d2e;
  --forest-2: #145239;
  --lime: #c6f432;
  --lime-ink: #0f3d2e;

  --bg: #f3f5f0;
  --surface: #ffffff;
  --surface-2: #f8faf6;
  --ink: #15201a;
  --muted: #5b6961;
  --line: #e0e6de;
  --brand: #157a4f;
  --brand-ink: #ffffff;
  --brand-soft: #e6f4ec;
  --gold: #a46a00;
  --gold-soft: #fff4d6;
  --dupr: #1d4ed8;
  --pos: #157a4f;
  --neg: #b42318;

  --ok-bg: #e6f4ec; --ok-ink: #11603d;
  --info-bg: #e8eefc; --info-ink: #1e3a8a;
  --err-bg: #fdecea; --err-ink: #9f1d14;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 32, 24, .05), 0 4px 16px rgba(16, 32, 24, .06);
  --shadow-lg: 0 2px 4px rgba(16, 32, 24, .06), 0 12px 32px rgba(16, 32, 24, .12);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c120f;
    --surface: #141c18;
    --surface-2: #19231e;
    --ink: #e6ece8;
    --muted: #97a59d;
    --line: #26322c;
    --brand: #43c286;
    --brand-ink: #06140d;
    --brand-soft: #16352a;
    --gold: #f0b54a;
    --gold-soft: #3a2c10;
    --dupr: #7aa2ff;
    --pos: #43c286;
    --neg: #ff8a7a;
    --ok-bg: #133325; --ok-ink: #9de2bd;
    --info-bg: #17243f; --info-ink: #aac4ff;
    --err-bg: #3b1915; --err-ink: #ffb4a8;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 8px 28px rgba(0, 0, 0, .5);
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 var(--font); font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column; min-height: 100vh;
}
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.2rem); margin: .1em 0 .35em; font-weight: 750; }
h2 { font-size: 1.15rem; margin: 0 0 .8em; font-weight: 700; }
h3 { font-size: 1rem; margin: 0; font-weight: 650; }
p { margin: 0 0 .8em; }
code.readonly { background: var(--surface-2); border: 1px solid var(--line); padding: .15em .5em; border-radius: 6px; font-size: 1em; font-weight: 600; letter-spacing: .04em; }
:focus-visible { outline: 3px solid var(--lime); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.main { padding-top: 28px; padding-bottom: 48px; flex: 1; }
.icon { width: 18px; height: 18px; flex: none; }

/* ---------- header ---------- */
.topbar { background: var(--forest); color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 750; letter-spacing: -0.01em; font-size: 1.05rem; }
.logo { width: 32px; height: 32px; color: var(--forest); flex: none; }
.topbar .logo { color: #0b2c21; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a, .nav-btn {
  color: rgba(255, 255, 255, .78); text-decoration: none; padding: 8px 12px; border-radius: 999px;
  font: inherit; font-size: .95rem; font-weight: 550; background: none; border: 0; cursor: pointer;
}
.nav a:hover, .nav-btn:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.nav a.active { color: var(--lime); }
.nav a.btn { color: var(--lime-ink); background: var(--lime); margin-left: 6px; }
.nav a.btn:hover { background: var(--lime); filter: brightness(1.05); }
.menu-toggle { display: none; background: none; border: 0; padding: 10px; cursor: pointer; }
.menu-toggle span { display: block; width: 22px; height: 2px; background: #fff; margin: 4px 0; border-radius: 2px; transition: transform .2s, opacity .2s; }
.devbanner { background: var(--lime); color: var(--lime-ink); text-align: center; font-size: .82rem; font-weight: 600; padding: 4px 16px; }

@media (max-width: 760px) {
  .menu-toggle { display: block; }
  .js .nav { display: none; }
  .js.nav-open .nav { display: flex; }
  .nav { position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0;
    background: var(--forest); padding: 8px 12px 16px; box-shadow: var(--shadow-lg); }
  .nav a, .nav-btn { padding: 12px 14px; border-radius: 10px; text-align: left; width: 100%; }
  .nav form { display: block; }
  .nav a.btn { margin: 8px 0 0; text-align: center; }
  .nav-open .menu-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .nav-open .menu-toggle span:nth-child(2) { opacity: 0; }
  .nav-open .menu-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
}

/* ---------- footer ---------- */
.footer { background: var(--surface); border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.footer-inner { display: grid; grid-template-columns: auto 1fr; gap: 6px 24px; align-items: center; padding-top: 24px; padding-bottom: 28px; }
.footer-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); }
.footer-brand .logo { width: 26px; height: 26px; color: var(--forest); }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; justify-content: flex-end; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--ink); }
.footer-note { grid-column: 1 / -1; margin: 6px 0 0; font-size: .85rem; }
@media (max-width: 640px) { .footer-inner { grid-template-columns: 1fr; } .footer-links { justify-content: flex-start; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--brand); color: var(--brand-ink); border: 1px solid transparent; border-radius: 999px;
  padding: 10px 20px; font: inherit; font-weight: 650; font-size: .95rem; line-height: 1.2;
  cursor: pointer; text-decoration: none; transition: transform .06s, filter .15s, background .15s; white-space: nowrap;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); font-weight: 600; }
.btn-ghost:hover { background: var(--surface-2); filter: none; }
.btn-lime { background: var(--lime); color: var(--lime-ink); }
.btn-on-dark { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .3); }
.btn-dupr { background: var(--dupr); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: .88rem; }
.btn-lg { padding: 13px 26px; font-size: 1.02rem; }
.btn[disabled] { opacity: .5; cursor: default; }
.linklike { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.linklike:hover { color: var(--ink); }
.linklike[disabled] { opacity: .25; cursor: default; }

/* ---------- layout bits ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 20px; box-shadow: var(--shadow); }
.card.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.card > h2:first-child { margin-top: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.inline { display: inline; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.prewrap { white-space: pre-wrap; }
.nowrap { white-space: nowrap; }
.scroll-x { overflow-x: auto; }
.label { display: block; font-size: .75rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 2px; }
.count { display: inline-block; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; font-size: .8rem; padding: 0 9px; color: var(--muted); vertical-align: middle; }
.section-title { font-size: 1.35rem; margin: 36px 0 16px; }
.empty { text-align: center; color: var(--muted); padding: 36px 22px; }
.empty .icon { width: 36px; height: 36px; color: var(--brand); margin-bottom: 8px; }
.empty-line { margin: 0; }

.page-head { margin-bottom: 22px; }
.page-head .lead { max-width: 70ch; color: var(--muted); font-size: 1.05rem; }
.back { display: inline-block; color: var(--muted); text-decoration: none; font-size: .9rem; margin-bottom: 10px; }
.back:hover { color: var(--ink); }

.layout-2 { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.side-col { position: sticky; top: 84px; }
.side-help { padding: 0 6px; }
@media (max-width: 900px) {
  .layout-2 { grid-template-columns: 1fr; }
  .side-col { position: static; order: -1; }
}

/* chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.chip { display: inline-flex; align-items: center; font-size: .75rem; font-weight: 650; letter-spacing: .02em; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.chip-groups, .chip-ladder { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.chip-rotating, .chip-fixed, .chip-singles { background: var(--info-bg); color: var(--info-ink); border-color: transparent; }
.chip-gold { background: var(--gold-soft); color: var(--gold); border-color: transparent; }
.tag { display: inline-block; font-size: .72rem; font-weight: 650; border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; color: var(--muted); }

/* progress (spots) */
.spots { display: grid; gap: 6px; }
progress { appearance: none; -webkit-appearance: none; width: 100%; height: 8px; border: 0; border-radius: 999px; background: var(--line); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--line); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--brand); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--brand); border-radius: 999px; }
.full { color: var(--gold); font-weight: 600; }

/* ---------- flash ---------- */
.flash { border-radius: var(--radius-sm); padding: 12px 16px; margin: 0 0 18px; font-weight: 500; }
.flash ul { margin: 0; padding-left: 18px; }
.flash-success { background: var(--ok-bg); color: var(--ok-ink); }
.flash-info { background: var(--info-bg); color: var(--info-ink); }
.flash-error { background: var(--err-bg); color: var(--err-ink); }

/* ---------- forms ---------- */
.form { display: grid; gap: 16px; }
.form.two-col { grid-template-columns: 1fr 1fr; }
.form .span2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form.two-col { grid-template-columns: 1fr; } }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .92rem; }
input, select, textarea {
  font: inherit; font-weight: 400; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); width: 100%; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.inline-label { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.inline-label input, .inline-label select { width: auto; }
.narrow-input { width: 72px !important; }
label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; }
label.check:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
label.check input { width: 18px; height: 18px; accent-color: var(--brand); }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tr.dim td { color: var(--muted); }
.table .actions { white-space: nowrap; text-align: right; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

.standings .rank { width: 44px; }
.rank-badge { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 999px; font-size: .82rem; font-weight: 700; color: var(--muted); }
.standings .top-1 .rank-badge { background: #f5c542; color: #3d2b00; }
.standings .top-2 .rank-badge { background: #d5dbe1; color: #2b3138; }
.standings .top-3 .rank-badge { background: #e3a877; color: #3b1f08; }
.standings .top .player { font-weight: 650; }

/* ---------- home ---------- */
.hero {
  position: relative; overflow: hidden; display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: center;
  background: radial-gradient(120% 140% at 100% 0%, #1d6b4c 0%, var(--forest) 55%, #0a2c20 100%);
  color: #fff; border-radius: 22px; padding: clamp(28px, 5vw, 56px); box-shadow: var(--shadow-lg);
}
.hero h1 { color: #fff; font-size: clamp(2rem, 1.3rem + 3vw, 3.2rem); line-height: 1.05; letter-spacing: -0.035em; margin-bottom: 14px; }
.hero .lead { color: rgba(255, 255, 255, .8); font-size: 1.08rem; max-width: 46ch; margin-bottom: 24px; }
.eyebrow { display: inline-block; color: var(--lime); font-weight: 700; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 12px; }
.hero-art { color: rgba(255, 255, 255, .22); justify-self: center; }
.hero-art svg { width: min(220px, 100%); height: auto; transform: rotate(-8deg); }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; } .hero-art { display: none; } }

.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 18px; }
.how-step { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.how-step p { margin: 2px 0 0; color: var(--muted); font-size: .92rem; }
.how-n { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 999px; background: var(--lime); color: var(--lime-ink); font-weight: 800; }
@media (max-width: 820px) { .how { grid-template-columns: 1fr; } }

/* league cards */
.league-card {
  display: flex; flex-direction: column; gap: 12px; color: inherit; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.league-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.league-card h2 { margin: 0; font-size: 1.2rem; }
.lc-top { display: flex; gap: 6px; flex-wrap: wrap; }
.lc-facts { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: .93rem; }
.lc-facts li { display: flex; gap: 10px; align-items: flex-start; }
.lc-facts .icon { color: var(--brand); margin-top: 2px; }
.lc-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.lc-foot .spots { flex: 1; }
.price { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; }

/* ---------- league page ---------- */
.facts-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.facts-list li { display: flex; gap: 14px; align-items: flex-start; }
.facts-list .icon { width: 22px; height: 22px; color: var(--brand); background: var(--brand-soft); padding: 7px; box-sizing: content-box; border-radius: 10px; }
.signup-card { display: grid; gap: 16px; }
.price-big { font-size: 2.1rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.price-big span { font-size: .95rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.signup { display: grid; gap: 10px; }
.signup .btn, .signup form .btn { width: 100%; }
.signup .row { flex-direction: column; align-items: stretch; }
.signup .flash { margin: 0; }
.night-list { list-style: none; margin: 0; padding: 0; }
.night-list a { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.night-list li:last-child a { border-bottom: 0; }
.night-list a:hover .night-date { color: var(--brand); }
.night-date { font-weight: 600; flex: 1; }
.player-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.player-grid li { display: flex; gap: 10px; align-items: center; line-height: 1.3; }
.avatar { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: .82rem; }
.live { color: var(--neg); font-weight: 600; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 999px; background: #e5484d; margin-right: 6px; box-shadow: 0 0 0 0 rgba(229, 72, 77, .6); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(229, 72, 77, 0); } 100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, 0); } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } .league-card, .btn { transition: none; } }

/* facts dl (profile) */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 10px 22px; margin: 16px 0; }
.facts dt { color: var(--muted); font-size: .9rem; }
.facts dd { margin: 0; }
@media (max-width: 520px) { .facts { grid-template-columns: 1fr; gap: 2px; } .facts dd { margin-bottom: 10px; } }

/* ---------- league nights ---------- */
.status { font-weight: 650; }
.status-playing { color: var(--brand); }
.status-complete { color: var(--muted); }
details > summary { cursor: pointer; }
.checkin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin: 14px 0; }

.round { padding: 0; overflow: hidden; }
.round > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; }
.round > summary::-webkit-details-marker { display: none; }
.round > summary::after { content: ''; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin: 0 4px 4px 8px; transition: transform .15s; }
.round[open] > summary::after { transform: rotate(-135deg); margin-bottom: 0; }
.round > summary h3 { flex: 1; }
.round-status { font-size: .82rem; color: var(--muted); font-weight: 600; }
.round-status.ok { color: var(--brand); }
.round-done:not([open]) { background: var(--surface-2); box-shadow: none; }
.round[open] > summary { border-bottom: 1px solid var(--line); }
.courts { display: grid; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); gap: 12px; padding: 18px 22px 6px; }
.sitting { padding: 4px 22px 18px; margin: 0; font-size: .9rem; color: var(--muted); }
.sitting .label { display: inline; margin-right: 6px; }
.court { position: relative; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface); }
.court.scored { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.court-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.court-no { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--forest); color: var(--lime); font-weight: 800; font-size: .85rem; }
.court-label { font-weight: 650; font-size: .9rem; flex: 1; }
.team { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 8px; margin: 0 -8px; border-radius: 8px; }
.team-names { line-height: 1.3; }
.team.won { background: var(--brand-soft); }
.team.won .team-names { font-weight: 700; }
.team.won .team-names::after { content: ' ✓'; color: var(--brand); }
.team.lost .team-names { color: var(--muted); }
.games { display: flex; gap: 6px; }
.games input { width: 46px; height: 42px; text-align: center; padding: 4px; font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.games-ro { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.court-actions { margin-top: 8px; }
.delete-match { position: absolute; right: 10px; bottom: 12px; }
.dispute { display: inline-block; margin-top: 6px; color: var(--muted); }
.tag.dupr-sent { border-color: var(--brand); color: var(--brand); }
.tag.dupr-needs_update, .tag.dupr-error { border-color: var(--neg); color: var(--neg); }

/* group ladder tables */
.group-tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); gap: 14px; }
.group-table { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 12px 4px; }
.group-table h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; }
.group-table .table th, .group-table .table td { padding: 7px 5px; }
.move { font-size: .8em; margin-left: 4px; }
tr.move-up td { background: color-mix(in srgb, var(--brand) 8%, transparent); }
tr.move-down td { background: color-mix(in srgb, var(--neg) 6%, transparent); }
tr.move-up .move { color: var(--pos); }
tr.move-down .move { color: var(--neg); }

/* seeding */
.seed-input { width: 60px !important; text-align: center; padding: 6px !important; font-weight: 700; }
.seed-table .group-row td { background: var(--surface-2); font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; color: var(--brand); padding: 8px; }
.seed-table tbody tr:hover td { background: inherit; }

/* ---------- SSO / modal / misc ---------- */
.sso-box { margin: 16px 0; }
.sso-frame { width: 100%; height: 580px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.sso-status { min-height: 1.5em; color: var(--muted); }
.sso-status.error { color: var(--err-ink); }
.modal { position: fixed; inset: 0; background: rgba(6, 20, 13, .6); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 40; }
.modal-card { background: var(--surface); border-radius: 18px; padding: 24px; width: 100%; max-width: 560px; max-height: 100%; overflow: auto; box-shadow: var(--shadow-lg); }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.ticket form { margin-top: 10px; }
.mock-dupr { padding: 16px; background: #fff; color: #15201a; display: block; }
.mock-list { display: grid; gap: 8px; }
.mock-player { text-align: left; padding: 10px; border: 1px solid #e0e6de; border-radius: 10px; background: #f8faf6; cursor: pointer; font: inherit; color: inherit; }
.mock-player:hover { border-color: #1d4ed8; }

/* ---------- court board (big screen, always dark) ---------- */
body.board {
  --surface: #12201a; --ink: #f2f7f3; --muted: #9db3a7; --line: #23382e; --brand: #c6f432; --brand-soft: rgba(198, 244, 50, .12);
  --pos: #c6f432; --neg: #ff8a7a; --surface-2: #172a21;
  background: radial-gradient(140% 120% at 0% 0%, #154532 0%, #0a1f17 60%); color: var(--ink);
  padding: 28px 32px; font-size: 22px; min-height: 100vh; display: block;
}
.board-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.board-head h1 { font-size: 2.3rem; margin: 0; color: #fff; display: flex; align-items: center; gap: 14px; }
.board-head h1 .logo { width: 44px; height: 44px; color: #0b2c21; }
.board-head span { color: var(--lime); font-weight: 700; font-size: 1.2rem; }
.board-main { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 28px; }
@media (max-width: 1000px) { .board-main { grid-template-columns: 1fr; } body.board { font-size: 18px; padding: 18px; } }
.board-courts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 700px) { .board-courts { grid-template-columns: 1fr; } }
.board-court { background: rgba(255, 255, 255, .04); border: 2px solid var(--line); border-radius: 18px; padding: 18px 20px; }
.board-court.scored { border-color: var(--lime); }
.board-court-no { display: inline-block; background: var(--lime); color: var(--lime-ink); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; font-size: .75em; padding: 3px 12px; border-radius: 999px; margin-bottom: 12px; }
.board-team { display: flex; justify-content: space-between; gap: 12px; font-size: 1.15em; font-weight: 600; }
.board-team.won { color: var(--lime); }
.board-vs { color: var(--muted); font-size: .7em; text-transform: uppercase; letter-spacing: .12em; margin: 6px 0; }
.board-sit, .board-empty { color: var(--muted); margin-top: 18px; }
body.board aside h2 { color: #fff; font-size: 1.1rem; text-transform: uppercase; letter-spacing: .08em; }
body.board .table { font-size: .8em; }
body.board .table tbody tr:hover td { background: transparent; }
body.board .group-tables { grid-template-columns: 1fr 1fr; gap: 12px; }
body.board .group-table .table { font-size: .68em; }
body.board .group-table td:nth-child(2) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 9em; }
body.board .group-table h3 span { display: none; }
body.board .group-tables + p { display: none; }
body.board .group-table { background: rgba(255, 255, 255, .03); }

/* ---------- print ---------- */
@media print {
  .topbar, .footer, .noprint, .delete-match, .score-form button, .flash, .skip { display: none !important; }
  body { background: #fff; color: #000; display: block; }
  .card { border: 0; box-shadow: none; padding: 0; break-inside: avoid; }
  .round > summary::after { display: none; }
  .games input { border: 1px solid #999; }
}

/* ---------- refinements ---------- */
.seed-table th:nth-child(1), .seed-table td:nth-child(1) { width: 76px; }
.seed-table th:nth-child(2), .seed-table td:nth-child(2) { width: 64px; }
.seed-table th:nth-child(4), .seed-table td:nth-child(4),
.seed-table th:nth-child(5), .seed-table td:nth-child(5) { width: 90px; }
.chip-status-setup { background: var(--info-bg); color: var(--info-ink); border-color: transparent; }
.chip-status-playing { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.chip-status-complete, .chip-status-closed, .chip-status-draft { background: var(--surface-2); color: var(--muted); }
.chip-status-open { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
@media (max-width: 520px) {
  .standings th:nth-child(5), .standings td:nth-child(5) { display: none; }
  .table th, .table td { padding: 9px 5px; }
  .card { padding: 18px; }
  .courts { padding: 14px; }
  .round > summary { padding: 14px 18px; }
  .sitting { padding: 4px 18px 16px; }
}

/* DUPR sync */
.dupr-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin: 4px 0 18px; }
.dupr-stats div { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.dupr-stats strong { display: block; font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.dupr-stats span { font-size: .78rem; color: var(--muted); font-weight: 600; }
.dupr-stats .bad { border-color: var(--neg); }
.dupr-stats .bad strong { color: var(--neg); }
@media (max-width: 720px) { .dupr-stats { grid-template-columns: repeat(3, 1fr); } }
.tag.dupr-not_sent { color: var(--muted); }
.tag.dupr-deleted { color: var(--muted); text-decoration: line-through; }
.dupr-err { margin: 8px 0 0; font-size: .82rem; color: var(--neg); background: var(--err-bg); border-radius: 8px; padding: 6px 8px; }
.court-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- league landing page ---------- */
.league-hero { margin-bottom: 20px; grid-template-columns: minmax(0, 1.6fr) minmax(220px, 1fr); }
.league-hero .lead { margin-bottom: 18px; }
.chip-on-dark { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .25); }
.hero-facts { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 8px; color: rgba(255, 255, 255, .9); }
.hero-facts li { display: flex; gap: 10px; align-items: flex-start; }
.hero-facts .icon { color: var(--lime); margin-top: 2px; flex: none; }
.hero-panel { display: grid; gap: 12px; align-content: start; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16); border-radius: var(--radius); padding: 22px; }
.hero-panel progress { background: rgba(255, 255, 255, .2); }
.hero-panel progress::-webkit-progress-bar { background: rgba(255, 255, 255, .2); }
.hero-panel progress::-webkit-progress-value { background: var(--lime); }
.hero-panel progress::-moz-progress-bar { background: var(--lime); }
.hero-panel p { margin: 0; color: rgba(255, 255, 255, .8); }
.hp-stat { display: flex; align-items: baseline; gap: 10px; }
.hp-stat strong { font-size: 2.6rem; line-height: 1; letter-spacing: -0.04em; color: var(--lime); }
.hp-stat span { color: rgba(255, 255, 255, .8); }
.hp-next { display: grid; gap: 2px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .16); }
.hp-next span { font-size: .75rem; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: rgba(255, 255, 255, .6); }
.hp-next strong { color: #fff; font-size: 1.1rem; }
.hero-panel .btn { justify-self: start; display: inline-flex; gap: 8px; align-items: center; }
.btn.is-static { cursor: default; display: inline-flex; gap: 8px; align-items: center; }
@media (max-width: 760px) { .league-hero { grid-template-columns: 1fr; } }

.live-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; padding: 14px 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid color-mix(in srgb, #e5484d 45%, var(--line)); box-shadow: var(--shadow); color: inherit; text-decoration: none; }
.live-banner strong { color: #e5484d; }
.live-banner span:not(.live-dot) { color: var(--muted); }
.live-banner:hover span:last-child { color: var(--brand); }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; display: flex; align-items: center; gap: 10px; }
.card-head h2 .icon { color: var(--brand); }
.player-grid li.me .avatar { background: var(--lime); color: var(--lime-ink); }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.steps li { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .93rem; }
.steps li.current { color: inherit; font-weight: 650; }
.steps li.done { color: inherit; }
.step-n { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 999px; font-size: .8rem; font-weight: 800;
  background: var(--surface-2); border: 1px solid var(--line); }
.steps li.current .step-n { background: var(--brand); color: #fff; border-color: transparent; }
.steps li.done .step-n { background: var(--lime); color: var(--lime-ink); border-color: transparent; }
.step-n .icon { width: 14px; height: 14px; stroke-width: 3; }
.form.compact { gap: 12px; }
.center { text-align: center; }
.signup p.center { margin: 0; }

.input-prefix { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); font-weight: 400; }
.input-prefix:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.input-prefix > span { display: flex; align-items: center; padding: 0 10px; background: var(--surface-2); color: var(--muted); font-size: .9rem; white-space: nowrap; border-right: 1px solid var(--line); }
.input-prefix input, .input-prefix input:focus { border: 0; border-radius: 0; box-shadow: none; min-width: 0; flex: 1; }
.share-link { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.share-link code { flex: 1; min-width: 0; overflow-wrap: anywhere; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }

/* ---------- sessions ---------- */
.session-form { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); align-items: end; margin-bottom: 18px; }
.session-form-btn .btn { width: 100%; }
.hp-first { padding-top: 0; border-top: 0; }
.session-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.session { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.session.is-booked { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); background: color-mix(in srgb, var(--brand-soft) 45%, var(--surface)); }
.session-when { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.session-when strong { font-size: 1.08rem; }
.session-when span { color: var(--muted); font-weight: 600; }
.session-meta { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: .9rem; color: var(--muted); margin-top: 2px; }
.session-action { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.session-action form { margin: 0; }
.booked-tag { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--brand); }
.booked-tag .icon { width: 18px; height: 18px; stroke-width: 2.6; }
.session-players { grid-column: 1 / -1; }
.session-players summary { cursor: pointer; font-size: .9rem; color: var(--brand); font-weight: 600; }
.session-players .player-grid { margin-top: 10px; }
.my-sessions { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.my-sessions li { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.my-sessions li:last-child { border-bottom: 0; padding-bottom: 0; }
.my-sessions a { font-weight: 600; }
@media (max-width: 520px) {
  .session { grid-template-columns: 1fr; }
  .session-action { flex-direction: row; align-items: center; justify-content: space-between; text-align: left; }
}
.price .per { font-size: .8rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
/* Landing page on narrow screens: sessions first, the sign-up box after them. */
@media (max-width: 900px) {
  .landing .main-col { display: contents; }
  .landing #sessions { order: -2; }
  .landing .side-col { order: -1; }
  .landing .main-col > .card { margin-bottom: 0; }
}
