:root {
  --navy: #061a5f;
  --navy-dark: #04103b;
  --orange: #ff6b00;
  --orange-dark: #d95700;
  --ink: #17202a;
  --muted: #5b6876;
  --line: #dfe6ee;
  --surface: #ffffff;
  --soft: #f6f8fc;
  --court-jump-top: 64px;
  --court-title-top: 122px;
  --game-jump-top: 166px;
  --score-scroll-margin: 230px;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--soft);
  scroll-behavior: smooth;
}
* { box-sizing: border-box; }
body { background: linear-gradient(180deg, #ffffff 0, var(--soft) 240px); margin: 0; overflow-x: hidden; }
html { scroll-padding-top: 12px; }
header { background: white; border-bottom: 1px solid var(--line); border-top: 5px solid var(--orange); padding: 18px 22px; display: flex; justify-content: space-between; gap: 16px; align-items: center; }
h1 { color: var(--navy); margin: 0 0 4px; font-size: 30px; }
p { margin: 0; }
main { padding: 20px; display: grid; grid-template-columns: repeat(2, minmax(300px, 1fr)); gap: 18px; }
.panel { background: white; border: 1px solid var(--line); border-radius: 8px; padding: 18px; box-shadow: 0 8px 24px rgba(6, 26, 95, .07); }
.wide { grid-column: 1 / -1; }
h2 { color: var(--navy); margin: 0 0 14px; font-size: 20px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
input, select, button { font-size: 15px; max-width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid #cfd8e3; }
input:focus, select:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255, 107, 0, .16); outline: none; }
button { background: var(--navy); color: white; cursor: pointer; border: none; font-weight: 700; }
button:hover { opacity: .9; }
button.ghost { background: #eef2f7; color: var(--navy); }
button.danger { background: #fff1f2; color: #be123c; }
button:disabled, input:disabled, select:disabled { cursor: not-allowed; opacity: .58; }
button, input, select { min-height: 42px; }
.headerLink { align-items: center; background: #eef2f7; border-radius: 8px; color: var(--navy); display: inline-flex; font-size: 15px; font-weight: 700; justify-content: center; min-height: 42px; padding: 10px 12px; text-decoration: none; }
.headerLink:hover { opacity: .9; }
.hint { color: var(--muted); font-size: 14px; margin-top: 8px; }
.setupField { align-items: stretch; display: inline-flex; flex-direction: column; gap: 4px; }
.setupField span { color: #364657; font-size: 13px; font-weight: 700; }
.list, .checkboxGrid { display: grid; gap: 8px; margin-top: 12px; }
.playerCard, .checkCard { border: 1px solid #e3e9f0; border-radius: 8px; padding: 10px; display: flex; justify-content: space-between; gap: 12px; align-items: center; min-width: 0; }
.checkCard input[type="checkbox"] { height: 16px; margin: 0 8px 0 0; min-height: 0; padding: 0; vertical-align: -2px; width: 16px; }
.playerPickerRow { align-items: flex-end; }
.playerPickerRow .setupField { flex: 1 1 320px; }
.selectedPlayerCard .removeEligiblePlayer { margin-left: auto; padding: 8px 10px; width: auto; }
.genderTag { background: #eef2f7; border-radius: 4px; color: var(--navy); display: inline-block; font-size: 12px; line-height: 1; margin-left: 5px; min-width: 22px; padding: 4px 5px; text-align: center; }
.playerCard.inactive { opacity: .62; background: #f8fafc; }
.playerCard small { color: var(--muted); }
.managedPlayerCard { align-items: center; cursor: pointer; display: grid; grid-template-columns: 24px minmax(140px, 2fr) 70px 70px minmax(110px, 1fr); }
.managedPlayerHeader { color: var(--muted); display: grid; font-size: 12px; font-weight: 700; gap: 12px; grid-template-columns: 24px minmax(140px, 2fr) 70px 70px minmax(110px, 1fr); margin: 12px 10px -6px; text-transform: uppercase; }
.managedPlayerCard input[type="checkbox"] { height: 16px; margin: 0; min-height: 0; padding: 0; width: 16px; }
.managedPlayerCard .playerMetaLabel { color: var(--muted); display: none; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.playerActionBar { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; margin-top: 12px; padding: 12px; }
.duplicateAudit { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; margin: 10px 0; padding: 12px; }
.duplicateAudit h3 { color: var(--navy); font-size: 16px; margin: 0 0 8px; }
.duplicateGroup { align-items: center; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: space-between; padding: 10px 0; }
.duplicateGroup:first-of-type { border-top: 0; padding-top: 0; }
.duplicateGroup button { flex: 0 0 auto; width: auto; }
.checkboxGrid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.status { padding: 12px; background: #eef4ff; border-left: 4px solid var(--orange); border-radius: 8px; color: var(--navy); font-weight: 700; margin-bottom: 14px; }
.status[data-type="success"] { background: #e8f7ee; border-left-color: #16a34a; color: #166534; }
.status[data-type="error"] { background: #fff1f2; border-left-color: #e11d48; color: #9f1239; }
.courts { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.court { border: 1px solid #dfe6ee; border-top: 4px solid var(--orange); border-radius: 8px; padding: 14px; background: #fbfcfe; min-width: 0; scroll-margin-top: var(--score-scroll-margin); }
.court h3 { background: #fbfcfe; border-bottom: 1px solid var(--line); color: var(--navy); margin: 0 -4px 8px; padding: 6px 4px; position: sticky; top: var(--court-title-top); z-index: 13; }
.courtJumpNav { background: white; border: 1px solid var(--line); border-radius: 8px; display: flex; gap: 8px; margin: 0 0 12px; overflow-x: auto; padding: 8px; position: sticky; top: var(--court-jump-top); z-index: 14; }
.courtJumpNav button { flex: 0 0 auto; min-height: 40px; white-space: nowrap; width: auto; }
.courtJumpNav span { background: rgba(6, 26, 95, .1); border-radius: 999px; display: inline-block; font-size: 12px; margin-left: 6px; padding: 2px 6px; }
.gameJumpNav { background: #fbfcfe; border-bottom: 1px solid var(--line); display: flex; gap: 6px; margin: 8px -4px; overflow-x: auto; padding: 6px 4px; position: sticky; top: var(--game-jump-top); z-index: 12; }
.gameJumpNav button { flex: 0 0 auto; font-size: 13px; min-height: 34px; padding: 7px 10px; width: auto; }
.gameJumpNav button.complete { background: #e8f7ee; color: #166534; }
.roster { margin: 8px 0 12px; padding-left: 20px; }
.game { border-top: 1px dashed #cfd8e3; padding-top: 10px; margin-top: 10px; scroll-margin-top: var(--score-scroll-margin); }
.gameSummary { align-items: center; background: #e8f7ee; color: #166534; display: none; justify-content: space-between; margin-bottom: 6px; min-height: 38px; text-align: left; width: 100%; }
.game.complete.collapsed { padding-bottom: 4px; }
.game.complete.collapsed .gameSummary { display: flex; }
.game.complete.collapsed strong, .game.complete.collapsed .teams, .game.complete.collapsed .scoreRow, .game.complete.collapsed .confirmRow { display: none; }
.teams { font-size: 14px; color: #364657; margin: 6px 0; }
.scoreRow { display: flex; gap: 8px; flex-wrap: wrap; }
.scoreRow label { color: #364657; font-size: 14px; }
.scoreRow input { width: 72px; }
.confirmRow { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.confirmRow label { align-items: center; color: #364657; display: inline-flex; font-size: 14px; gap: 6px; }
.confirmRow input { height: 18px; width: 18px; }
table { width: 100%; border-collapse: collapse; margin-top: 12px; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid #e3e9f0; }
th { background: #eef4ff; color: var(--navy); }
.hidden { display: none; }
.badge { font-size: 12px; border-radius: 999px; padding: 3px 8px; background: #eef2f7; }
.selectedCount { align-items: center; background: var(--navy); border: 2px solid var(--orange); border-radius: 8px; color: white; display: inline-flex; font-size: 18px; font-weight: 800; justify-content: center; min-height: 46px; min-width: 132px; padding: 10px 14px; text-align: center; }
.groupTotalCount { background: #fff7ed; color: var(--navy); margin-left: auto; }
.rankingGroup { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; }
.rankingGroup:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.rankingGroup h3 { color: var(--navy); margin: 0 0 8px; }
@media (max-width: 760px) { main { grid-template-columns: 1fr; padding: 12px; } header { align-items: flex-start; flex-direction: column; } }

.brandBlock { align-items: center; display: flex; gap: 16px; min-width: 0; }
.brandBlock h1 { margin-bottom: 0; }
.brandLogo { display: block; height: 74px; max-width: 300px; object-fit: contain; width: auto; }
.headerActions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: flex-end; flex: 1; }
#signOutBtn { margin-left: auto; }
.accessStatus { border: 1px solid #cfd8e3; border-radius: 999px; color: var(--navy); font-size: 13px; font-weight: 700; padding: 7px 10px; background: #f8fafc; }
.feedbackButton { background: var(--orange); }
.betaBanner { background: #fff7ed; border-bottom: 1px solid #fed7aa; color: #7c2d12; padding: 10px 22px; font-size: 14px; }
.accessBanner { background: #eef4ff; border-bottom: 1px solid #bfdbfe; color: var(--navy); font-weight: 700; padding: 10px 22px; font-size: 14px; }
.quickNav { align-items: center; background: var(--navy); border-bottom: 1px solid var(--navy-dark); display: flex; gap: 12px; overflow-x: auto; padding: 10px 22px; position: sticky; top: 0; z-index: 20; }
.quickNav label { align-items: center; display: flex; gap: 8px; min-width: 0; max-width: 100%; }
.quickNav span { color: white; flex: 0 0 auto; font-size: 13px; font-weight: 700; }
.quickNav select { min-width: 210px; }
#sectionNav { min-width: min(460px, 55vw); }
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .48); display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 1000; }
.modal.hidden { display: none; }
.modalCard { background: white; width: min(680px, 100%); border-radius: 8px; max-height: calc(100vh - 36px); overflow-y: auto; overscroll-behavior: contain; padding: 18px; box-shadow: 0 18px 48px rgba(0,0,0,.24); }
.accessModalCard { width: min(560px, 100%); }
.modalHeader { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 10px; }
.modalHeader h2 { margin: 0; }
textarea { width: 100%; font-size: 15px; padding: 12px; border: 1px solid #cfd8e3; border-radius: 8px; resize: vertical; }
@media (max-width: 960px) {
  main { grid-template-columns: 1fr; padding: 16px; }
  .courts { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
  .scoresPanel .courts { display: block; }
  .scoresPanel .court { margin-bottom: 12px; }
  .scoresPanel .eventActions { clear: both; }
}
@media (max-width: 820px) {
  :root { --court-jump-top: 118px; --court-title-top: 176px; --game-jump-top: 222px; --score-scroll-margin: 292px; }
  body { width: var(--app-width, 100vw); }
  header { align-items: flex-start; flex-direction: column; }
  main { display: block; padding: 8px; width: var(--app-width, 100vw); }
  .headerActions { width: 100%; }
  .headerActions button, .headerActions .headerLink { flex: 1; }
  #signOutBtn { margin-left: 0; }
  .betaBanner, .accessBanner { padding: 10px 12px; }
  .accessStatus { width: 100%; text-align: center; }
  .quickNav { align-items: stretch; flex-direction: column; padding: 10px 12px; }
  .quickNav label { align-items: stretch; flex-direction: column; gap: 4px; }
  .quickNav select, #sectionNav { min-width: 0; width: 100%; }
  .panel { margin-bottom: 10px; max-width: calc(var(--app-width, 100vw) - 16px); width: calc(var(--app-width, 100vw) - 16px); }
  .row { align-items: stretch; flex-direction: column; max-width: 100%; }
  .setupField { width: 100%; }
  input, select, button, .headerLink { width: 100%; }
  .selectedCount { margin-left: 0; width: 100%; }
  .courts { grid-template-columns: 1fr; }
  .scoresPanel .courts { display: block; }
  .scoresPanel .court { margin-bottom: 12px; }
  .court, .game, .status, .checkboxGrid, .eventActions { max-width: 100%; width: 100%; }
}
.utilityRow input { min-width: min(260px, 100%); }
.historyList { display: grid; gap: 18px; padding-left: 22px; }
.historyList table { margin-bottom: 4px; }
.compactField { align-items: center; display: inline-flex; gap: 6px; }
.compactField span { color: #364657; font-size: 14px; font-weight: 700; }
.compactField input { width: 78px; }
.socialControls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.socialControls select { min-width: 120px; }
.socialRound { border-top: 1px solid #e3e9f0; margin-top: 16px; padding-top: 14px; }
.socialRound.complete { opacity: .72; }
.socialRoundHeader { align-items: center; display: flex; gap: 12px; justify-content: space-between; margin-bottom: 10px; }
.socialRound h3 { margin: 0 0 10px; }
.socialRoundHeader h3 { margin: 0; }
.roundComplete { align-items: center; color: var(--navy); display: inline-flex; flex: 0 0 auto; font-size: 13px; font-weight: 700; gap: 6px; }
.roundComplete input[type="checkbox"] { height: 18px; margin: 0; min-height: 0; padding: 0; width: 18px; }
.socialSchedule { margin-top: 12px; }
.socialSchedule p, .teams, .court p, .checkCard span, .playerCard div { overflow-wrap: anywhere; }
.manualSeeding { border: 1px solid #dfe6ee; border-radius: 8px; margin-top: 12px; padding: 12px; }
.manualSeeding h3 { margin: 0 0 8px; }
.manualSeedGrid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.manualSeedRow { align-items: center; display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr) 120px; }
.manualSeedRow span { font-weight: 700; overflow-wrap: anywhere; }
.manualSeedPreview { background: #f6f8fb; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); font-family: inherit; font-size: 13px; line-height: 1.35; margin: 8px 0 0; overflow-x: auto; padding: 8px; white-space: pre-wrap; }
@media (max-width: 560px) {
  :root { --court-jump-top: 112px; --court-title-top: 170px; --game-jump-top: 216px; --score-scroll-margin: 286px; }
  body { background: white; }
  header { gap: 10px; padding: 12px; }
  .brandBlock { align-items: flex-start; flex-direction: column; gap: 8px; width: 100%; }
  .brandBlock h1 { line-height: 1.15; }
  .brandLogo { height: auto; max-width: 260px; width: min(260px, 80vw); }
  h1 { font-size: 24px; }
  header p { font-size: 13px; line-height: 1.35; }
  main { gap: 10px; padding: 8px; }
  .panel { border-left: 0; border-radius: 0; border-right: 0; box-shadow: none; padding: 12px; }
  h2 { font-size: 18px; margin-bottom: 10px; }
  input, select, button, .headerLink { font-size: 16px; min-height: 46px; width: 100%; }
  .row { align-items: stretch; flex-direction: column; gap: 8px; margin: 8px 0; max-width: 100%; }
  .status { font-size: 14px; line-height: 1.35; margin-bottom: 10px; }
  .courts { grid-template-columns: 1fr; gap: 12px; }
  .court { padding: 12px; }
  .courtJumpNav { border-left: 0; border-radius: 0; border-right: 0; margin-left: -12px; margin-right: -12px; }
  .court h3 { font-size: 20px; }
  .roster { columns: 2; font-size: 14px; margin-bottom: 8px; }
  .game { background: white; border: 1px solid #e3e9f0; border-radius: 8px; margin-top: 8px; padding: 10px; }
  .game strong { display: block; font-size: 16px; margin-bottom: 6px; }
  .teams { font-size: 13px; line-height: 1.35; }
  .scoreRow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .scoreRow label { display: grid; gap: 4px; }
  .scoreRow input { font-size: 24px; height: 54px; text-align: center; width: 100%; }
  .confirmRow { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .confirmRow label { background: #f8fafc; border: 1px solid #dfe6ee; border-radius: 8px; min-height: 44px; padding: 8px 10px; }
  .eventActions { background: #f8fafc; border: 1px solid #dfe6ee; border-radius: 8px; margin-top: 14px; padding: 10px; position: static; }
  .eventActions button { min-height: 50px; }
  .playerCard, .checkCard { align-items: flex-start; flex-direction: column; }
  .managedPlayerCard { align-items: start; display: grid; grid-template-columns: 22px 1fr; }
  .managedPlayerHeader { display: none; }
  .managedPlayerCard > span:not(:first-of-type) { grid-column: 2; }
  .managedPlayerCard .playerMetaLabel { display: inline; margin-right: 5px; }
  .playerActionBar .row { margin-bottom: 0; }
  .playerCard > div:last-child { display: flex; gap: 8px; width: 100%; }
  .playerCard > div:last-child select, .playerCard > div:last-child button { flex: 1; }
  .compactField { flex-direction: row; width: 100%; }
  .compactField input { flex: 1; width: auto; }
  .socialControls { justify-content: stretch; width: 100%; }
  .socialControls select { flex: 1; min-width: 0; }
  .checkboxGrid { grid-template-columns: 1fr; }
  .manualSeedGrid { grid-template-columns: 1fr; }
  .manualSeedRow { grid-template-columns: 1fr; }
  .modal { align-items: flex-start; padding: 8px; }
  .modalCard { max-height: calc(100vh - 16px); overflow: auto; padding: 14px; }
  table { display: block; font-size: 13px; overflow-x: auto; white-space: nowrap; }
  th, td { padding: 8px; }
}
@media (min-width: 961px) {
  .scoresPanel .courts { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
}
