:root {
  color-scheme: light;
  --ink: #17291f;
  --muted: #657168;
  --paper: #f5f5ed;
  --line: #dce1d7;
  --mine: #edf5dc;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--ink); padding: 8px 12px; font-size: 12px; }
button:disabled { opacity: .5; cursor: wait; }
button:focus-visible, a:focus-visible, input:focus-visible, .table-wrap:focus-visible { outline: 3px solid #729844; outline-offset: 3px; }
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px max(24px, calc((100vw - 1100px) / 2)); background: var(--ink); color: white; }
.wordmark { color: inherit; font-size: 33px; font-weight: 800; letter-spacing: -2px; text-decoration: none; }
.wordmark span { color: #d9eea5; font-size: 10px; margin-left: 4px; }
.header-actions { display: flex; gap: 10px; align-items: center; }
.header-actions button { background: transparent; color: white; border-color: #65735e; }
.badge { color: #d9eea5; font-size: 9px; font-weight: 650; letter-spacing: 1px; }
main { max-width: 1148px; padding: 32px 24px 60px; margin: auto; }
.page-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 20px; }
h1 { font-size: 26px; letter-spacing: -.7px; }
h2 { font-size: 21px; font-weight: 650; letter-spacing: -.4px; }
.page-heading p { color: var(--muted); font-size: 13px; }
.chart-panel { border: 1px solid var(--line); background: white; border-radius: 10px; padding: 22px; }
.chart-description { color: var(--muted); font-size: 13px; }
.team-chart { width: 100%; min-width: 0; }
.team-chart svg { display: block; width: 100%; }
.chart-readout { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; margin: 18px 0 10px; font-size: 12px; font-variant-numeric: tabular-nums; }
.chart-readout span { display: inline-flex; gap: 7px; align-items: center; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-label { fill: var(--muted); font: 11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.chart-empty { fill: var(--muted); font-size: 13px; }
.chart-cursor { stroke: #879387; stroke-dasharray: 4 4; pointer-events: none; }
.chart-day { cursor: pointer; }
.chart-day:focus-visible { outline: none; fill: #17291f12; }
.team-dot { display: inline-block; flex: none; width: 9px; height: 9px; border-radius: 50%; }
.red { background: #d9695b; }
.blue { background: #659ddd; }
.green { background: #73ba90; }
.unassigned { background: #9b9f97; }
.table-note { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 16px 0 24px; }
.teams { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.team-card { min-width: 0; overflow: hidden; background: white; border: 1px solid var(--line); border-top: 4px solid var(--team-color); border-radius: 10px; }
.team-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 20px 16px 0; }
.team-heading h2 { display: flex; align-items: center; gap: 8px; }
.member-count { color: var(--muted); font-size: 12px; }
.team-score { padding: 20px 16px 24px; }
.team-score strong { font-size: 34px; letter-spacing: -1px; font-weight: 650; font-variant-numeric: tabular-nums; }
.team-score span { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.table-wrap { overflow-x: auto; background: white; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; font-variant-numeric: tabular-nums; }
th, td { padding: 13px 8px; border-bottom: 1px solid var(--line); text-align: right; }
th { font-weight: 500; }
th:first-child { text-align: left; }
thead th { background: #eff2e9; font-size: 11px; font-weight: 600; white-space: nowrap; }
tbody tr:last-child > * { border-bottom: 0; }
.roster th:first-child { padding-left: 16px; }
.roster th:last-child, .roster td:last-child { padding-right: 16px; }
.roster tbody th { width: 100%; }
.roster td { white-space: nowrap; }
.member-link { color: inherit; text-decoration: none; line-height: 1.4; }
.member-link:hover { text-decoration: underline; }
.mine { background: var(--mine); }
.medal { display: inline-block; margin-right: 5px; font-size: 16px; vertical-align: middle; }
.outside-competition { color: var(--muted); }
.day-note { display: inline-block; font-size: 10px; margin-left: 8px; font-weight: 400; }
.chart-panel h2 { font-size: 18px; margin-bottom: 7px; }
#profile { max-width: 680px; margin: auto; }
.back-link { display: inline-block; color: var(--muted); font-size: 13px; text-decoration: none; margin: 8px 0 24px; }
.back-link:hover { color: var(--ink); }
.profile-heading .member-count { margin-top: 6px; }
.profile-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 24px 0 32px; }
.profile-summary span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.profile-summary strong { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.history th, .history td { padding: 13px 18px; font-size: 13px; }
.team-card .empty { padding: 20px 16px; }
.empty { color: var(--muted); font-size: 13px; padding: 20px 0; }
.error { color: #a13224; font-size: 13px; margin-top: 16px; }
.error:empty { display: none; }
#loading { color: var(--muted); padding: 48px 0; }
.login-card { max-width: 370px; margin: 60px auto; padding: 28px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.login-card h1 { margin-bottom: 24px; }
.login-card label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 12px; }
#code { display: block; width: 100%; padding: 14px; font-size: 28px; font-family: ui-monospace, monospace; letter-spacing: 10px; text-transform: uppercase; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; }
.primary { width: 100%; background: var(--ink); color: white; margin-top: 16px; padding: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media(max-width:600px) {
  .masthead { padding: 15px 16px; }
  .wordmark { font-size: 29px; }
  .header-actions { gap: 8px; }
  .header-actions button { padding: 7px 9px; }
  .badge { font-size: 8px; letter-spacing: .3px; }
  main { padding: 24px 16px 44px; }
  .page-heading { display: block; }
  .page-heading p { margin-top: 7px; }
  .chart-panel { padding: 16px 10px; }
  .chart-description { font-size: 11px; }
  .chart-readout { gap: 10px 13px; font-size: 10px; }
  .chart-readout strong { width: 100%; }
  .profile-summary strong { font-size: 23px; }
  .login-card { margin: 30px auto; padding: 24px; }
}

@media(max-width:850px) {
  .teams { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(310px, 1fr); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 12px; }
  .team-card { scroll-snap-align: start; }
}
@media(max-width:600px) {
  .teams { grid-auto-columns: calc(100% - 24px); }
}
