/* Trials Scoring Pro results site */
:root {
  --bg: #f5f4ef; --card: #ffffff; --ink: #18211b; --muted: #5d685f; --line: #dedccf;
  --brand: #d9531e; --brand-ink: #ffffff; --head: #1b2a20; --head-ink: #f3f1e8;
  --soft: #eceadf; --live: #d62828; --gold: #b98a00; --ok: #1f7a3d; --danger: #b3261e;
  --s0: #1f8a45; --s1: #7a9a12; --s2: #c28a00; --s3: #d9631e; --s5: #c62828;
  --radius: 10px; --cls: var(--brand);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111512; --card: #1a201c; --ink: #e9ece6; --muted: #9aa69d; --line: #2c352f;
    --head: #0c100d; --head-ink: #eef0ea; --soft: #232b26; --brand: #f0703a; --gold: #e0b33a;
    --ok: #57c27c; --danger: #ef6a62;
    --s0: #2fa85b; --s1: #93b526; --s2: #d9a21a; --s3: #e87b3a; --s5: #e04b46;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: inherit; }
main a:not([class]) { color: var(--brand); }
h1, h2 { line-height: 1.2; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(1.5rem, 4.5vw, 2.1rem); letter-spacing: -.01em; }
small { font-weight: 400; color: var(--muted); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 20px; padding-bottom: 56px; min-height: 70vh; }
.muted { color: var(--muted); } .small { font-size: .875rem; }
code { font: .9em ui-monospace, SFMono-Regular, Consolas, monospace; background: var(--soft); padding: 2px 6px; border-radius: 5px; word-break: break-all; }

/* header / footer */
.top { background: var(--head); color: var(--head-ink); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-size: 1.1rem; letter-spacing: .01em; }
.brand b { color: var(--brand); font-weight: 700; }
.brand-mark { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--brand); position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--head-ink); }
.top nav { display: flex; gap: 18px; font-size: .95rem; }
.top nav a { text-decoration: none; opacity: .85; padding: 6px 0; }
.top nav a:hover { opacity: 1; text-decoration: underline; }
.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: .875rem; }
.foot .wrap { display: flex; justify-content: space-between; gap: 12px; padding-top: 18px; padding-bottom: 28px; flex-wrap: wrap; }

.hero { padding: 18px 0 6px; }
.hero p { color: var(--muted); margin: 8px 0 0; max-width: 60ch; }
.sec { font-size: 1.05rem; text-transform: uppercase; letter-spacing: .06em; margin: 30px 0 12px; color: var(--muted); font-weight: 700; }
.sec small { letter-spacing: 0; text-transform: none; margin-left: 6px; }
.sec-row { display: flex; align-items: end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sec-row .sec { margin-bottom: 12px; }
.filter { margin-bottom: 12px; max-width: 260px; }
.crumb { font-size: .9rem; color: var(--muted); margin: 0 0 14px; }
.empty { text-align: center; color: var(--muted); padding: 36px 12px; }
.hint { color: var(--muted); font-size: .875rem; margin: 18px 0 0; }

/* logos */
.logo { width: 84px; height: 84px; object-fit: contain; border-radius: 12px; background: #fff; border: 1px solid var(--line); padding: 6px; flex: none; }
.logo.sm { width: 52px; height: 52px; border-radius: 9px; padding: 4px; }
.logo.lg { width: 104px; height: 104px; }
.logo-ph { display: grid; place-items: center; padding: 0; border: 0; color: #fff; font-weight: 800; letter-spacing: .03em; font-size: 1.5rem;
  background: linear-gradient(140deg, hsl(var(--hue) 45% 34%), hsl(calc(var(--hue) + 40) 50% 24%)); }
.logo-ph.sm { font-size: 1rem; } .logo-ph.lg { font-size: 1.9rem; }

/* live badge */
.live { display: inline-flex; align-items: center; gap: 5px; background: var(--live); color: #fff; font-size: .68rem; font-weight: 800; letter-spacing: .08em; padding: 2px 7px 2px 6px; border-radius: 4px; vertical-align: middle; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .live i { animation: none; } }

/* event cards */
.evgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.evcard, .evrow { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; text-decoration: none; }
.evcard:hover, .evrow:hover, .club:hover { border-color: var(--brand); }
.evcard.is-live { border-color: var(--live); }
.evcard-b, .evrow-b { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.evcard-t { font-weight: 700; overflow-wrap: anywhere; }
.evcard-m { color: var(--muted); font-size: .875rem; }
.evlist { display: grid; gap: 8px; }
.evdate { display: flex; flex-direction: column; align-items: center; width: 62px; flex: none; background: var(--soft); border-radius: 8px; padding: 6px 4px; line-height: 1.2; }
.evdate small { text-transform: uppercase; font-size: .7rem; letter-spacing: .06em; }
.evrow-n { color: var(--muted); font-size: .875rem; white-space: nowrap; }
.tag { font-size: .7rem; background: var(--soft); color: var(--muted); border-radius: 4px; padding: 2px 6px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; vertical-align: middle; }

/* club grid */
.clubgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.club { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 12px 14px; text-decoration: none; }
.club .logo { margin-bottom: 8px; }
.club-n { font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.club-p, .club-c { color: var(--muted); font-size: .85rem; }
.club-e { font-size: .85rem; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line); width: 100%; }

.clubhead, .evhead { display: flex; gap: 18px; align-items: center; }
.clubhead p, .evhead p { margin: 4px 0 0; }
.about { max-width: 70ch; }
.meta { font-size: .9rem; color: var(--muted); }

/* results */
.jump { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 2px; position: sticky; top: 0; background: var(--bg); z-index: 2; }
main .jump a { color: var(--ink); white-space: nowrap; text-decoration: none; font-size: .875rem; font-weight: 600; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 5px 13px; }
.jump a:hover { border-color: var(--brand); }
.class { margin-top: 22px; scroll-margin-top: 56px; }
.class h2 { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 1.15rem; padding: 9px 12px; background: var(--head); color: var(--head-ink); border-radius: var(--radius) var(--radius) 0 0; border-left: 6px solid var(--cls); }
.class h2 small { color: inherit; opacity: .7; font-size: .8rem; }
.tbl { background: var(--card); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 7px 8px; text-align: center; border-bottom: 1px solid var(--line); }
td { padding: 9px 8px; text-align: center; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
.c-name { text-align: left; width: 100%; }
th.c-name { text-align: left; }
.c-pos { width: 3.2em; } .c-pos b { display: inline-grid; place-items: center; min-width: 1.9em; height: 1.9em; border-radius: 50%; font-size: .95rem; }
.p1 .c-pos b { background: var(--gold); color: #fff; }
.p2 .c-pos b, .p3 .c-pos b { background: var(--soft); }
.nm { font-weight: 600; display: block; overflow-wrap: anywhere; }
.sub { display: block; color: var(--muted); font-size: .8rem; }
.c-loop { color: var(--muted); min-width: 2.4em; }
.c-loop.part { font-style: italic; }
.c-loop.part::after { content: "*"; }
.c-tot b { font-size: 1.1rem; }
.c-cl, .c-pen { color: var(--muted); }
tr.can { cursor: pointer; }
tr.can:hover td, tr.can:focus-visible td { background: var(--soft); }
tr.can:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
tr.st-dnf .c-pos b, tr.st-exh .c-pos b, tr.st-ns .c-pos b { font-size: .7rem; color: var(--muted); letter-spacing: .04em; }
tr.st-dnf .nm, tr.st-ns .nm { color: var(--muted); font-weight: 500; }
tr.d td { background: var(--soft); padding: 10px 8px 12px; text-align: left; }
.detail { overflow-x: auto; width: 0; min-width: 100%; }
.sgrid { display: inline-grid; gap: 4px; }
.srow { display: flex; align-items: center; gap: 4px; }
.sl { width: 4.2em; font-size: .8rem; color: var(--muted); flex: none; }
.st { width: 2.6em; text-align: right; font-weight: 700; flex: none; }
.shead .st { font-weight: 400; font-size: .72rem; color: var(--muted); text-transform: uppercase; }
.sc { font-style: normal; width: 1.75em; height: 1.75em; display: grid; place-items: center; border-radius: 5px; font-weight: 700; font-size: .875rem; color: #fff; flex: none; }
.sc-0 { background: var(--s0); } .sc-1 { background: var(--s1); } .sc-2 { background: var(--s2); } .sc-3 { background: var(--s3); } .sc-5 { background: var(--s5); }
.sc-o { background: var(--muted); }
.sc-x { background: transparent; color: var(--muted); border: 1px dashed var(--line); }
.sc-h { background: transparent; color: var(--muted); font-weight: 400; font-size: .72rem; height: 1.2em; }
.tally { margin: 8px 0 0; display: flex; gap: 14px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.tally b { color: var(--ink); }
.flashrow td { animation: flashrow 2.5s ease-out; }
@keyframes flashrow { from { background: color-mix(in srgb, var(--brand) 30%, transparent); } }

/* photos */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.ph { display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 8px; background: var(--soft); }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.ph:hover img { transform: scale(1.04); }
#lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .92); z-index: 20; display: grid; place-items: center; }
#lightbox[hidden] { display: none; }
#lightbox img { max-width: 96vw; max-height: 84vh; object-fit: contain; }
#lightbox p { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: #fff; margin: 0; padding: 0 16px; }
#lightbox button { position: absolute; background: rgba(255, 255, 255, .14); color: #fff; border: 0; width: 46px; height: 46px; border-radius: 50%; font-size: 1.7rem; line-height: 1; cursor: pointer; }
.lb-x { top: 14px; right: 14px; } .lb-p { left: 10px; top: 50%; } .lb-n { right: 10px; top: 50%; }

/* forms / management */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-top: 16px; }
.card h2 { font-size: 1.1rem; margin-bottom: 10px; }
.card p { margin: 0 0 12px; }
.narrow { max-width: 440px; margin: 32px auto; } .narrow-l { max-width: 440px; }
.narrow h1 { margin-bottom: 10px; }
label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: 12px; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
input[type=file] { padding: 7px; }
.btn { display: inline-block; font: inherit; font-weight: 700; background: var(--brand); color: var(--brand-ink); border: 1px solid var(--brand); border-radius: 8px; padding: 9px 16px; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: .85rem; font-weight: 600; }
.btn[disabled] { opacity: .5; cursor: default; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; }
.flash { border-radius: 8px; padding: 10px 14px; margin: 0 0 14px; background: color-mix(in srgb, var(--ok) 14%, var(--card)); border: 1px solid var(--ok); }
.flash.err { background: color-mix(in srgb, var(--danger) 12%, var(--card)); border-color: var(--danger); }
.flash.warn { background: var(--soft); border-color: var(--line); }
.mhead { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.mhead > div { flex: 1; min-width: 200px; } .mhead p { margin: 4px 0 0; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.two { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
.inline { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.inline label { margin-bottom: 0; flex: 1; min-width: 130px; }
.keybox { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.keybox code { font-size: 1rem; padding: 9px 12px; }
.secret { border-color: var(--brand); border-width: 2px; }
.secret pre { background: var(--soft); padding: 12px; border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; font: .9rem/1.5 ui-monospace, Consolas, monospace; margin: 0 0 12px; }
.mphotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.mph { border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: grid; gap: 8px; }
.mph img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; display: block; }
.cap { display: flex; gap: 6px; } .cap input { margin: 0; padding: 5px 8px; font-size: .85rem; }
.upstatus { margin-top: 12px; } .upstatus p { margin: 6px 0 0; font-size: .9rem; }
.bar { height: 8px; background: var(--soft); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s; }
.aclubs { display: grid; gap: 10px; }
.aclub { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.aclub.off { opacity: .6; }
.aclub-b { flex: 1; min-width: 180px; display: flex; flex-direction: column; }

@media (max-width: 640px) {
  .cols { grid-template-columns: 1fr; }
  .c-cl, .c-pen { display: none; }
  td, th { padding-left: 5px; padding-right: 5px; }
  .logo.lg { width: 72px; height: 72px; }
  .clubhead, .evhead { gap: 12px; align-items: flex-start; }
  .clubgrid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .evrow-n { display: none; }
  .sc { width: 1.5em; height: 1.5em; font-size: .8rem; }
  .sl { width: 3.6em; }
  .c-pos { width: 2.6em; }
  .top nav { gap: 14px; }
}
