:root {
  color-scheme: light;
  --paper: #fff;
  --canvas: #f1f5fa;
  --ink: #132943;
  --muted: #4c617a;
  --blue: #204d7b;
  --deep: #142f52;
  --line: #cfdbe8;
  --highlight: #e7f0fb;
  --radius: 16px;
  font-family: "Avenir Next", Avenir, system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; }
h1, h2, h3, p, figure, form { margin: 0; }
h1, h2, h3 { line-height: 1.12; }
h1 { font-size: clamp(2.5rem, 6vw, 4.1rem); letter-spacing: -.06em; font-weight: 750; }
h2 { font-size: clamp(1.4rem, 4vw, 1.8rem); letter-spacing: -.035em; }
h3 { font-size: 1.05rem; }
p { line-height: 1.55; }
a { color: inherit; }
button, input, select { font: inherit; }
button, summary { cursor: pointer; }
button, input, select, a { touch-action: manipulation; }
:focus-visible { outline: 3px solid #1262a7; outline-offset: 4px; }
.skip { position: fixed; inset: 8px auto auto 8px; z-index: 5; background: var(--paper); padding: .7rem; transform: translateY(-150%); }
.skip:focus { transform: none; }
.frame { width: min(100% - 3rem, 69rem); margin-inline: auto; }
.eyebrow { color: var(--blue); font-size: .875rem; font-weight: 700; letter-spacing: .085em; text-transform: uppercase; }
.eyebrow + h1, .eyebrow + h2 { margin-top: .35rem; }
.masthead { background: var(--paper); border-bottom: 1px solid var(--line); }
.masthead-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.9rem; }
.brand { display: flex; align-items: center; gap: .7rem; font-size: 1.0625rem; font-weight: 750; line-height: 1.12; text-decoration: none; }
.brand small { display: block; font-weight: 550; color: var(--muted); letter-spacing: .01em; margin-top: .2rem; font-size: .8125rem; }
.brand-mark { position: relative; display: grid; align-items: center; flex: 0 0 2.45rem; width: 2.45rem; height: 2.45rem; overflow: hidden; border-radius: 50%; background: #214d78; }
.brand-mark i { position: absolute; width: 1.15rem; height: .24rem; border-radius: 1rem; background: white; transform: rotate(-28deg); left: .55rem; }
.brand-mark i:first-child { top: .8rem; left: .67rem; }
.brand-mark i:last-child { bottom: .8rem; width: .83rem; }
.navigation, .navigation nav { display: flex; align-items: center; gap: 1.3rem; }
.navigation nav a { font-weight: 650; text-decoration: none; }
.navigation nav a:hover, .text-link:hover { text-decoration: underline; }
.primary, .secondary, .text-button { border: 1px solid transparent; border-radius: 8px; min-height: 2.65rem; padding: .5rem .95rem; font-weight: 700; }
.primary { background: var(--blue); color: var(--paper); }
.primary:hover { background: var(--deep); }
.secondary { background: var(--paper); color: var(--blue); border-color: #aabfd5; }
.secondary:hover { background: var(--highlight); }
.text-button { padding-inline: 0; background: transparent; color: var(--blue); text-decoration: underline; }
.sign-out { white-space: nowrap; }
.text-link { color: var(--blue); font-weight: 680; text-underline-offset: .2em; }
.footer { display: flex; justify-content: space-between; gap: 1rem; border-top: 1px solid var(--line); padding-block: 1.25rem 2rem; margin-top: 3.5rem; color: var(--muted); font-size: .875rem; }
.auth { max-width: 61rem; display: grid; grid-template-columns: 1.15fr 1fr; border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius); margin-top: clamp(2rem, 8vw, 6rem); overflow: hidden; }
.welcome { position: relative; isolation: isolate; overflow: hidden; min-height: 28rem; padding: clamp(1.5rem, 5vw, 3.1rem); background: var(--deep); color: white; }
.welcome .eyebrow, .score-hero .eyebrow { color: #c5d8ef; }
.welcome h1 { font-size: clamp(2.75rem, 5vw, 4rem); margin-top: .8rem; }
.welcome > p:last-of-type { color: #dae6f3; max-width: 27ch; margin-top: 1rem; font-size: 1.0625rem; }
.wall-shape, .score-hero::after { position: absolute; z-index: -1; pointer-events: none; content: ""; width: 100%; height: 105%; right: -35%; bottom: -55%; transform: rotate(-32deg); background: repeating-linear-gradient(90deg, #8fb5de36 0 1px, transparent 1px 23px), linear-gradient(165deg, #426f9d, #234669 60%); border: 1px solid #658bb5; border-radius: 2rem; }
.auth-form { align-self: center; padding: clamp(1.5rem, 5vw, 3rem); }
.auth-form > p { margin-block: .75rem 1.4rem; color: var(--muted); }
.auth-form .local-note { margin-bottom: 0; font-size: .875rem; }
.auth-fields, .stack { display: grid; gap: .55rem; }
.auth-fields button { margin-top: .45rem; }
.auth-form .text-link { display: inline-block; margin-top: 1.1rem; }
input[type="email"], input[name="code"], select { width: 100%; min-height: 2.85rem; padding: .5rem .75rem; color: var(--ink); background: var(--paper); border: 1px solid #9db1c6; border-radius: 8px; }
select { appearance: none; padding-right: 2rem; background: linear-gradient(45deg, transparent 50%, var(--blue) 50%) calc(100% - 1.05rem) center / 6px 6px no-repeat, linear-gradient(135deg, var(--blue) 50%, transparent 50%) calc(100% - .7rem) center / 6px 6px no-repeat, var(--paper); }
input[type="file"] { width: 100%; }
label, legend { font-weight: 650; }
input[name="code"] { letter-spacing: .23em; font-variant-numeric: tabular-nums; }
.quiet-page { min-height: 46vh; padding-top: 4rem; }
.quiet-page p { margin-top: .8rem; color: var(--muted); }
.dashboard { padding-top: 2.7rem; }
.athlete-heading { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 1.1rem; margin-bottom: 1.4rem; }
.athlete-switch, .event-switch { display: flex; flex-wrap: wrap; gap: .35rem; padding: .32rem; background: #e4edf8; border-radius: 9px; }
.athlete-switch a, .event-switch a { border-radius: 6px; padding: .45rem .7rem; min-height: 2.3rem; text-decoration: none; color: var(--blue); font-weight: 650; }
.athlete-switch a[aria-current], .event-switch a[aria-current] { background: var(--paper); color: var(--deep); box-shadow: 0 1px 2px #2c496525; }
.athlete-switch a:hover, .event-switch a:hover { text-decoration: underline; }
.overview, .coach-top { display: grid; grid-template-columns: 1.12fr 1fr; gap: 1rem; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.score-hero { overflow: hidden; position: relative; isolation: isolate; padding: clamp(1.25rem, 4vw, 2rem); background: var(--deep); color: white; border-radius: var(--radius); min-height: 18.2rem; }
.score-hero::after { width: 78%; height: 128%; right: -32%; bottom: -58%; transform: rotate(-41deg); }
.hero-value { margin-top: .75rem; line-height: 1.06; font-size: clamp(3.4rem, 8vw, 5.15rem); font-weight: 750; letter-spacing: -.068em; font-variant-numeric: tabular-nums; }
.hero-value span { font-size: 1.2rem; letter-spacing: 0; color: #c5d8ef; }
.hero-detail, .hero-missing { color: #dbe8f8; margin-top: .35rem; }
.hero-missing { margin-top: 1.5rem; }
.hero-metrics { display: flex; flex-wrap: wrap; gap: .7rem 1.5rem; margin-top: 1rem; padding-top: .75rem; border-top: 1px solid #b5cde263; }
.hero-metrics strong { margin-right: .2rem; font-size: 1.15rem; }
.comparison, .inset { padding: clamp(1.15rem, 3vw, 1.65rem); }
.comparison-head { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center; gap: .6rem; }
.delta { display: flex; align-items: baseline; gap: .4rem; color: var(--blue); background: var(--highlight); padding: .28rem .55rem; border-radius: 6px; font-size: .875rem; white-space: nowrap; }
.delta strong { font-size: 1.05rem; }
.comparison-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-block: 1.15rem .9rem; }
.comparison-event + .comparison-event { border-left: 1px solid var(--line); padding-left: .9rem; }
.comparison-event p, .comparison-note, .rules p, .table-note, .subtle { color: var(--muted); font-size: .875rem; }
.comparison-event .comparison-score { margin-top: .36rem; font-size: 1.75rem; line-height: 1.17; font-weight: 750; letter-spacing: -.04em; color: var(--ink); font-variant-numeric: tabular-nums; }
.comparison-score span { font-size: .875rem; color: var(--muted); letter-spacing: 0; }
.rules { border-top: 1px solid var(--line); padding-top: .7rem; margin-top: .65rem; }
summary { font-size: .9375rem; font-weight: 700; color: var(--blue); }
.rules p { margin-top: .55rem; }
.route-section { margin-top: 2.1rem; scroll-margin-top: 1rem; }
.section-heading { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .65rem; margin-bottom: .8rem; }
.route-panel { overflow: hidden; }
table { border-collapse: collapse; text-align: left; width: 100%; font-variant-numeric: tabular-nums; }
td, th { padding: .7rem clamp(.38rem, 2vw, 1.35rem); border-bottom: 1px solid var(--line); }
thead th { font-size: .875rem; font-weight: 700; color: var(--muted); }
tbody th { font-weight: 700; }
tbody tr:last-child > * { border-bottom: 0; }
.counted { background: #edf4fc; }
.result-mark { color: var(--muted); }
.top, .zone { font-weight: 750; color: var(--ink); }
.counted-label { font-size: .875rem; font-weight: 700; color: var(--blue); }
.table-note { padding: .7rem 1.3rem; border-top: 1px solid var(--line); }
.empty { padding: 1.25rem; color: var(--muted); }
.gallery, .coach-gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; }
.photo-card, .coach-photo { overflow: hidden; }
.photo-card a { display: block; }
.photo-card a:focus-visible { outline-offset: -5px; }
.photo-card img, .coach-photo img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; background: #dce6f2; }
.photo-card figcaption { padding: .8rem; font-size: .9rem; color: var(--muted); }
.photo-card figcaption span { margin: 0 .14rem; }
.inset > p { margin-block: .55rem 1rem; color: var(--muted); }
.inset button, .stack button, .controls button { justify-self: start; }
.queues { width: fit-content; margin: 0 0 .9rem; }
.queues span { opacity: .77; font-weight: 600; }
.coach-photo-content { padding: .9rem; }
.coach-photo-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.coach-photo-heading p { color: var(--muted); margin-top: .3rem; font-size: .875rem; }
.state { text-transform: capitalize; background: var(--highlight); color: var(--blue); padding: .25rem .45rem; border-radius: 5px; font-size: .875rem; font-weight: 700; }
.check { display: flex; gap: .45rem; align-items: baseline; font-size: .9375rem; font-weight: 550; }
.check input { accent-color: var(--blue); margin: 0; flex: 0 0 auto; }
.bulk-check, .controls { margin-top: .75rem; }
.bulk-check { margin-bottom: .7rem; }
details > .stack, details > .text-link { margin-top: .6rem; }
details > .text-link { display: inline-block; }
.roster-picker { display: grid; gap: .35rem; border: 1px solid var(--line); border-radius: 8px; margin: 0; padding: .5rem .7rem .7rem; }
.roster-picker legend { padding-inline: .3rem; font-size: .875rem; }
.access-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: .75rem; padding: .7rem 1rem; overflow-wrap: anywhere; }
.access-row + .access-row, .audit li + li { border-top: 1px solid var(--line); }
.access-row div span, .audit time { font-size: .875rem; color: var(--muted); }
.audit { list-style: none; padding: 0; }
.audit li { padding: .7rem 1rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: .4rem; }
.notice { background: #e0eef9; padding: .7rem .85rem; margin-bottom: .9rem; border-radius: 8px; }
.notice.error { background: #fae9e6; color: #801e1d; }

@media (max-width: 730px) {
  .auth, .overview, .coach-top { grid-template-columns: 1fr; }
  .welcome { min-height: 14rem; }
  .welcome > p:last-of-type { max-width: 35ch; }
  .wall-shape { right: -41%; bottom: -65%; }
  .dashboard { padding-top: 1.9rem; }
  .score-hero { min-height: 0; }
  .coach-gallery, .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .frame { width: calc(100% - 1.5rem); }
  .masthead-inner { flex-wrap: wrap; gap: .5rem; padding-block: .6rem; }
  .navigation { gap: .6rem; margin-left: auto; }
  .navigation nav { gap: .6rem; }
  .navigation nav a, .sign-out { font-size: .875rem; }
  .sign-out { padding-inline: .5rem; }
  .coach-gallery, .gallery { grid-template-columns: 1fr; }
  td, th { font-size: .875rem; }
  thead th, .counted-label { font-size: .8125rem; }
  .access-row { padding-inline: .6rem; gap: .4rem; }
  .footer { flex-wrap: wrap; gap: .45rem; }
}
