
:root {
  --ink: #10222e;
  --paper: #edf3f6;
  --card: #ffffff;
  --pool: #0b5d8a;
  --pool-ink: #ffffff;
  --rope: #d9472b;
  --flag: #f2c230;
  --rule: #c8d6de;
  --muted: #546874;
  --good: #1d7a4c;
  --display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --body: "Familjen Grotesk", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e1ebf0;
    --paper: #0c171e;
    --card: #13222c;
    --pool: #5cb3e0;
    --pool-ink: #0c171e;
    --rope: #f0846c;
    --flag: #f2c230;
    --rule: #263a46;
    --muted: #92a8b4;
    --good: #6fd29e;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.5 var(--body); -webkit-font-smoothing: antialiased; }
.wrap { max-width: 40rem; margin: 0 auto; padding: env(safe-area-inset-top) max(1rem, env(safe-area-inset-right)) calc(4rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left)); }
header.top { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 1.25rem 0 1rem; }
.mark { display: inline-flex; align-items: center; gap: .5rem; font: 800 1.6rem/1 var(--display); letter-spacing: .01em; color: var(--pool); text-decoration: none; }
.mark svg { width: 2rem; height: 2rem; flex: none; }
.who { font-size: .875rem; color: var(--muted); text-align: right; }
.who form { display: inline; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--rule); margin-bottom: 1.5rem; }
.tabs a { padding: .8rem .25rem; text-align: center; font-weight: 600; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--pool); }
a { color: var(--pool); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--flag); outline-offset: 2px; }
h1 { font: 800 2rem/1.05 var(--display); margin: 0 0 .25rem; }
h2 { font-size: 1.125rem; font-weight: 600; margin: 0 0 .75rem; }
section { margin-top: 2.25rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.num { font-variant-numeric: tabular-nums; }
.msg { padding: .75rem 1rem; border-radius: .5rem; background: var(--card); border-left: 4px solid var(--pool); margin-bottom: 1rem; }
.msg.bad { border-left-color: var(--rope); }

.card { background: var(--card); border: 1px solid var(--rule); border-radius: .75rem; padding: 1rem; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.swimmer-card { display: flex; justify-content: space-between; align-items: center; gap: 1rem; text-decoration: none; color: inherit; }
.swimmer-card strong { font-size: 1.1rem; display: block; }
.swimmer-card .go { color: var(--pool); font-weight: 600; white-space: nowrap; }

form.search { display: flex; gap: .5rem; }
input[type=text], input[type=password], input[type=search] { flex: 1; min-width: 0; font: inherit; padding: .65rem .8rem; border: 1px solid var(--rule); border-radius: .5rem; background: var(--card); color: var(--ink); }
button, .button { font: 600 1rem var(--body); padding: .65rem 1rem; border-radius: .5rem; border: 0; background: var(--pool); color: var(--pool-ink); cursor: pointer; text-decoration: none; display: inline-block; }
button.plain, .button.plain { background: transparent; color: var(--pool); border: 1px solid var(--rule); }
button.link { background: none; color: var(--muted); padding: 0; font-weight: 400; text-decoration: underline; }
label { display: block; font-weight: 600; margin: 1rem 0 .3rem; }
.pw { position: relative; }
.pw input { padding-right: 4.25rem; }
.pw-toggle { position: absolute; top: 50%; right: .35rem; transform: translateY(-50%); padding: .35rem .65rem; font-size: .85rem; font-weight: 600; background: transparent; color: var(--pool); border-radius: .35rem; }
.pw-toggle:hover { background: color-mix(in srgb, var(--pool) 12%, transparent); }
.stack input { width: 100%; }

.facts { display: flex; flex-wrap: wrap; gap: .4rem .9rem; color: var(--muted); margin: .25rem 0 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { font-size: .8rem; padding: .15rem .55rem; border-radius: 999px; border: 1px solid var(--rule); color: var(--muted); }
.chip.on { border-color: var(--pool); color: var(--pool); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .4rem; border-bottom: 1px solid var(--rule); vertical-align: middle; }
th { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
td.t, th.t { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.ev a { color: inherit; text-decoration: none; font-weight: 600; }
tr.ev a::after { content: " ›"; color: var(--pool); }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.pb { display: inline-block; font-size: .7rem; font-weight: 700; padding: 0 .35rem; border-radius: .25rem; background: var(--flag); color: #10222e; vertical-align: .1em; }
.down { color: var(--good); }
.up { color: var(--rope); }
.rank { white-space: nowrap; }
.spark { width: 72px; height: 22px; display: block; }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font: 11px var(--body); }
.chart .grid { stroke: var(--rule); }
.chart .best { stroke: var(--pool); fill: none; stroke-width: 2; }
.chart .dot { fill: var(--card); stroke: var(--pool); stroke-width: 1.5; }
.chart .dot.pbdot { fill: var(--flag); stroke: var(--ink); }
.laps td.fast { color: var(--good); font-weight: 600; }
.laps td.slow { color: var(--rope); }
.course-h { margin-top: 1.5rem; }
.ids { font-size: .875rem; }
.ids li { margin-bottom: .3rem; }
code { font-size: .85em; }
.qual { margin-top: 1.5rem; }
.qual h2 { margin-bottom: .4rem; }
.gaps { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.gaps li { display: grid; grid-template-columns: 1fr auto auto; gap: .1rem .6rem; align-items: baseline; }
.gaps li > a { grid-column: 1; }
.gaps li > .num { grid-column: 2; text-align: right; }
.gaps li > .muted { grid-column: 3; }
.gaps li > .small:not(.muted) { grid-column: 1; color: var(--muted); }
.gaps li > .up { grid-column: 2 / span 2; text-align: right; }
.qt-table td:first-child { white-space: nowrap; }
.qt-table td.made { color: var(--good); font-weight: 600; }
.qt-table td.pbmade { background: color-mix(in srgb, var(--good) 12%, transparent); }
.pbrow { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; padding: .5rem 0; border-bottom: 1px solid var(--rule); }
.pbrow a { font-weight: 600; text-decoration: none; display: block; }
.chartbox { position: relative; margin: 0; }
.chart:focus { outline: none; }
.chart:focus-visible { outline: 3px solid var(--flag); outline-offset: 2px; border-radius: .25rem; }
.chart .guide { stroke: var(--muted); stroke-dasharray: 2 3; }
.chart .dot.on { r: 7; stroke-width: 2.5; }
.chart .qt { stroke-dasharray: 5 4; stroke-width: 1.25; }
.chart .qt-L2 { stroke: var(--muted); }
.chart .qt-L3 { stroke: var(--rope); }
.chart .qt-SANJ { stroke: var(--good); }
.chart .qt-label { font-size: 10px; }
.tip { position: absolute; z-index: 2; pointer-events: none; background: var(--card); border: 1px solid var(--rule); border-radius: .5rem; padding: .4rem .6rem; font-size: .8rem; line-height: 1.35; box-shadow: 0 4px 14px rgb(0 0 0 / .15); white-space: nowrap; max-width: 90%; overflow: hidden; text-overflow: ellipsis; }
.tip strong { font-size: .95rem; font-variant-numeric: tabular-nums; }
.tabs.two { grid-template-columns: 1fr 1fr; margin-bottom: 1rem; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin: 1rem 0; }
.stats div { background: var(--card); border: 1px solid var(--rule); border-radius: .6rem; padding: .55rem .6rem; text-align: center; }
.stats strong { display: block; font: 800 1.45rem/1.1 var(--display); color: var(--pool); }
.stats span { font-size: .75rem; color: var(--muted); }
.mine-chip { display: inline-block; font-size: .72rem; font-weight: 600; padding: .05rem .5rem; border-radius: 999px; background: color-mix(in srgb, var(--flag) 30%, transparent); color: var(--ink); white-space: nowrap; }
.meet-cards { display: grid; gap: .75rem; }
.meet-card { padding: .85rem 1rem; }
.meet-card.is-mine { border-left: 4px solid var(--flag); }
.meet-card header { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .6rem; margin-bottom: .4rem; }
.meet-card header a { color: inherit; text-decoration: none; }
.meet-card .tally { margin-left: auto; color: var(--muted); }
.swim-lines { list-style: none; margin: 0; padding: 0; }
.swim-lines li { display: grid; grid-template-columns: 1fr auto auto 2.4rem; gap: .6rem; align-items: center; padding: .45rem 0; border-top: 1px solid var(--rule); }
.swim-lines .ev { color: inherit; text-decoration: none; font-weight: 600; }
.swim-lines .t { text-align: right; white-space: nowrap; }
.medal { display: inline-grid; place-items: center; min-width: 1.6em; height: 1.6em; padding: 0 .3em; border-radius: 999px; font-size: .78rem; font-weight: 700; color: #10222e; }
.medal.gold { background: #f2c230; }
.medal.silver { background: #c9d1d6; }
.medal.bronze { background: #d99a5f; }
.nowrap { white-space: nowrap; }
details.day { border-bottom: 1px solid var(--rule); }
details.day summary { display: flex; align-items: baseline; justify-content: space-between; cursor: pointer; padding: .9rem 0; list-style: none; }
details.day summary::-webkit-details-marker { display: none; }
details.day summary h3 { margin: 0; font-size: 1.05rem; }
details.day summary::after { content: "▾"; color: var(--muted); margin-left: .5rem; }
details.day[open] summary::after { content: "▴"; }
.programme { list-style: none; margin: 0 0 .75rem; padding: 0; }
.programme a { display: grid; grid-template-columns: 2.6rem 1fr auto auto; gap: .6rem; align-items: center; padding: .6rem .25rem; border-radius: .5rem; color: inherit; text-decoration: none; }
.programme a:hover, .programme a:focus-visible { background: var(--card); }
.programme .evno { font: 700 .95rem var(--display); color: var(--muted); text-align: center; }
.programme .evname { display: flex; flex-direction: column; font-weight: 600; }
.programme .go { color: var(--pool); font-size: 1.2rem; }
.eyebrow { margin: 0 0 .2rem; font-size: .8rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--pool); }
.evnavs { display: flex; justify-content: space-between; gap: .75rem; }
.evnav { font-size: .875rem; text-decoration: none; max-width: 48%; }
.evnav.next { text-align: right; margin-left: auto; }
.results { list-style: none; margin: 0; padding: 0; }
.results li { display: grid; grid-template-columns: 2.4rem 1fr; gap: .5rem; align-items: start; padding: .55rem .25rem; border-top: 1px solid var(--rule); scroll-margin-top: 4rem; }
.results li.is-mine { background: color-mix(in srgb, var(--flag) 14%, transparent); border-radius: .4rem; }
.results li:target { outline: 2px solid var(--flag); border-radius: .4rem; }
.results .pl { text-align: center; padding-top: .1rem; font-weight: 600; }
.who-swam summary { display: flex; justify-content: space-between; gap: .75rem; cursor: pointer; list-style: none; }
.who-swam summary::-webkit-details-marker { display: none; }
.who-swam .nm { display: flex; flex-direction: column; min-width: 0; }
.who-swam .nm a { font-weight: 600; text-decoration: none; color: inherit; }
.who-swam .tm { display: flex; flex-direction: column; align-items: flex-end; white-space: nowrap; }
.laps-inline { display: flex; flex-wrap: wrap; gap: .3rem .8rem; margin-top: .45rem; font-size: .82rem; font-variant-numeric: tabular-nums; }
.laps-inline em { font-style: normal; color: var(--muted); margin-right: .25rem; font-size: .72rem; }
table.clubs tr.is-mine td:first-child { box-shadow: inset 4px 0 0 var(--flag); }
#busy { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--flag); z-index: 10; opacity: 0; }
#busy.on { opacity: 1; animation: busy 8s cubic-bezier(.1,.7,.2,1) forwards; }
@keyframes busy { from { width: 0; } to { width: 92%; } }
.spinner { display: inline-block; width: .95em; height: .95em; margin-right: .45em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -.12em; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
button.busy, button:disabled { opacity: .85; cursor: progress; }
@media (prefers-reduced-motion: reduce) { #busy.on { animation: none; width: 60%; } .spinner { animation-duration: 2.4s; } }
.more { margin: .75rem 0 0; }
.more button { width: 100%; }
.loading { color: var(--muted); padding: .6rem 0; margin: 0; }
details.sources { margin-top: 2.25rem; border-top: 1px solid var(--rule); }
body.nav-busy main { opacity: .55; transition: opacity .15s .12s; pointer-events: none; }
a.loading { cursor: progress; }
a.loading:not(:has(.go))::after { content: ""; display: inline-block; width: .8em; height: .8em; margin-left: .4em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -.1em; animation: spin .7s linear infinite; }
#busy { height: 4px; }
footer { margin-top: 3rem; font-size: .8rem; color: var(--muted); }
