/* ---------- Tokens ---------- */
:root {
  --bg: #eef3f9;
  --surface: #ffffff;
  --surface-2: #f4f7fb;
  --text: #0b1726;
  --muted: #64748b;
  --line: rgba(15, 23, 42, .08);
  --line-strong: rgba(15, 23, 42, .16);
  --accent: #1d6fe0;
  --accent-2: #0ea5e9;
  --on-accent: #ffffff;
  --grad: linear-gradient(135deg, #0ea5e9 0%, #2563eb 55%, #4f46e5 100%);
  --hero: linear-gradient(140deg, #0b2a4a 0%, #1e4fd8 62%, #38bdf8 100%);
  --gold: #f5b301;
  --silver: #9aa7b5;
  --bronze: #cd7f3a;
  --danger: #e11d48;
  --ok: #10b981;
  --cold: #6366f1;
  --cool: #0ea5e9;
  --zero: #14b8a6;
  --warm: #f97316;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(15, 23, 42, .18);
  --shadow-lg: 0 20px 40px -18px rgba(29, 78, 216, .55);
  --glass: rgba(255, 255, 255, .72);
  --r: 18px;
  --r-sm: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #060b14;
    --surface: #0e1724;
    --surface-2: #142032;
    --text: #e8eef6;
    --muted: #8ea0b5;
    --line: rgba(255, 255, 255, .07);
    --line-strong: rgba(255, 255, 255, .16);
    --accent: #4f9dff;
    --accent-2: #38bdf8;
    --on-accent: #ffffff;
    --grad: linear-gradient(135deg, #38bdf8 0%, #3b82f6 55%, #6366f1 100%);
    --hero: linear-gradient(140deg, #0a1f3a 0%, #1d3fb0 62%, #0ea5e9 100%);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .7);
    --shadow-lg: 0 20px 44px -16px rgba(56, 189, 248, .45);
    --glass: rgba(10, 17, 28, .72);
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(1200px 500px at 100% -10%, color-mix(in srgb, var(--accent-2) 14%, transparent), transparent 60%),
    radial-gradient(900px 400px at -20% 0%, color-mix(in srgb, var(--cold) 10%, transparent), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { letter-spacing: -.02em; line-height: 1.15; }
h1 { font-size: 1.75rem; font-weight: 800; margin: .2em 0 .3em; }
h2 { font-size: 1.05rem; font-weight: 700; margin: 0; }
p { margin: .4em 0; }
code { font: .85em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: .15em .45em; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.notes { white-space: pre-wrap; }
.i { width: 1.2em; height: 1.2em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }

html, body { overflow-x: clip; }
main { max-width: 680px; margin: 0 auto; padding: .5rem 1rem 1rem; }

/* ---------- App bar ---------- */
.appbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: calc(.7rem + env(safe-area-inset-top)) 1rem .7rem;
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--line);
}
.appbar-inner { max-width: 680px; width: 100%; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.1rem; letter-spacing: -.02em; color: var(--text); }
.logo-mark {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  background: var(--grad); color: #fff; box-shadow: 0 6px 16px -6px rgba(37, 99, 235, .7);
}
.logo-mark .i { width: 18px; height: 18px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); color: var(--text); font-weight: 700; border: 1px solid var(--line);
}
.back { display: inline-flex; align-items: center; gap: .25rem; color: var(--muted); font-weight: 600; font-size: .9rem; margin: .5rem 0 0; }
.back .i { transform: rotate(180deg); }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 30;
  bottom: calc(12px + env(safe-area-inset-bottom));
  width: min(420px, calc(100% - 24px));
  display: grid; grid-template-columns: 1fr 1fr 80px 1fr 1fr; align-items: center;
  height: 64px; border-radius: 24px;
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--line);
  box-shadow: 0 12px 40px -12px rgba(15, 23, 42, .35);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .72rem; font-weight: 600; color: var(--muted); }
.tabbar a .i { width: 22px; height: 22px; }
.tabbar a.active { color: var(--accent); }
.tabbar .fab {
  justify-self: center; width: 64px; height: 64px; margin-top: -30px; border-radius: 22px;
  background: var(--grad); color: #fff; display: grid; place-items: center;
  box-shadow: var(--shadow-lg), 0 0 0 5px var(--bg);
  transition: transform .15s ease;
}
.tabbar .fab .i { width: 28px; height: 28px; }
.tabbar .fab:active { transform: scale(.94); }

/* ---------- Flash (toast) ---------- */
.flash {
  display: flex; align-items: center; gap: .6rem;
  padding: .75rem 1rem; border-radius: 14px; margin: .75rem 0;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  font-weight: 500; animation: drop .35s ease;
}
.flash::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent); }
.flash.error::before { background: var(--danger); box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 20%, transparent); }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden; color: #fff;
  border-radius: 24px; padding: 1.4rem 1.25rem 1.25rem; margin: .75rem 0 1rem;
  background: var(--hero); box-shadow: var(--shadow-lg);
}
.hero::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 70%; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 120' preserveAspectRatio='none'%3E%3Cpath d='M0 120 L0 80 L60 40 L95 62 L150 14 L205 70 L240 48 L300 92 L345 56 L400 84 L400 120Z' fill='white' fill-opacity='.10'/%3E%3Cpath d='M0 120 L0 98 L70 70 L120 92 L180 58 L250 100 L320 76 L400 104 L400 120Z' fill='white' fill-opacity='.14'/%3E%3C/svg%3E") bottom / 100% 100% no-repeat;
}
.hero > * { position: relative; z-index: 1; }
.hero .eyebrow { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; opacity: .8; }
.hero h1 { margin: .15em 0 .35em; font-size: 1.9rem; }
.hero .sub { opacity: .85; }
.hero .chip { background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .2); }
.hero-actions { display: flex; gap: .5rem; margin-top: 1rem; }
.hero-actions .btn.white { flex: 1; }
.hero .btn.glass { background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .25); backdrop-filter: blur(8px); }
.hero .btn.white { background: #fff; color: #0b2a4a; border-color: #fff; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin-top: 1.1rem; }
.stat { background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18); border-radius: 14px; padding: .6rem .75rem; }
.stat b { display: block; font-size: 1.45rem; font-weight: 800; line-height: 1.1; }
.stat span { font-size: .75rem; opacity: .8; }

/* ---------- Action tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin: 1rem 0 1.5rem; }
.tile {
  display: flex; flex-direction: column; gap: .9rem; padding: 1rem;
  border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  color: var(--text); transition: transform .15s ease;
}
.tile:active { transform: scale(.98); }
.tile .ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--grad); color: #fff; }
.tile .ico.alt { background: linear-gradient(135deg, #f59e0b, #f97316); }
.tile .ico .i { width: 22px; height: 22px; }
.tile strong { display: block; font-size: 1rem; }
.tile span { font-size: .8rem; color: var(--muted); }

/* ---------- Section ---------- */
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 1.6rem 0 .7rem; }
.section-head h1 { margin: 0; }
.section-head .count { color: var(--muted); font-weight: 600; margin-left: .3rem; }

/* ---------- Lists / rows ---------- */
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.row {
  display: flex; align-items: center; gap: .85rem; padding: .85rem .9rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); color: var(--text); transition: transform .15s ease, border-color .15s ease;
}
a.row:active { transform: scale(.985); }
@media (hover: hover) { a.row:hover { border-color: var(--line-strong); } }
.row .body { flex: 1; min-width: 0; }
.row .title { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .meta { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .3rem; font-size: .82rem; color: var(--muted); }
.row .chev { color: var(--line-strong); }
.row.retired { opacity: .5; }

.lead {
  width: 46px; height: 46px; border-radius: 14px; flex: none; display: grid; place-items: center;
  font-weight: 800; font-size: 1.05rem; color: #fff; background: var(--grad);
}
.lead.klassisch { background: linear-gradient(135deg, #10b981, #0d9488); }
.lead.none { background: linear-gradient(135deg, #94a3b8, #64748b); }
.datebox {
  width: 52px; flex: none; text-align: center; border-radius: 14px; padding: .35rem 0;
  background: var(--surface-2); border: 1px solid var(--line);
}
.datebox b { display: block; font-size: 1.3rem; font-weight: 800; line-height: 1.1; }
.datebox span { font-size: .7rem; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; }

/* ---------- Chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap;
  padding: .2rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.chip .i { width: 14px; height: 14px; }
.chip.t-cold { color: var(--cold); background: color-mix(in srgb, var(--cold) 12%, transparent); border-color: transparent; }
.chip.t-cool { color: var(--cool); background: color-mix(in srgb, var(--cool) 12%, transparent); border-color: transparent; }
.chip.t-zero { color: var(--zero); background: color-mix(in srgb, var(--zero) 13%, transparent); border-color: transparent; }
.chip.t-warm { color: var(--warm); background: color-mix(in srgb, var(--warm) 13%, transparent); border-color: transparent; }
.chip.gold { color: #a16207; background: color-mix(in srgb, var(--gold) 20%, transparent); border-color: transparent; }
@media (prefers-color-scheme: dark) { .chip.gold { color: var(--gold); } }

/* ---------- Condition tiles ---------- */
.conds { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; margin: .75rem 0; }
.cond { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: .55rem .6rem; min-width: 0; }
.cond .lbl { display: flex; align-items: center; gap: .25rem; font-size: .7rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cond .lbl .i { width: 13px; height: 13px; }
.cond .val { display: block; font-weight: 800; font-size: 1.05rem; margin-top: .15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cond .val.sm { font-size: .85rem; }
.cond.t-cold .val { color: var(--cold); } .cond.t-cool .val { color: var(--cool); }
.cond.t-zero .val { color: var(--zero); } .cond.t-warm .val { color: var(--warm); }
.hero .cond { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .18); }
.hero .cond .lbl { color: rgba(255, 255, 255, .75); }
.hero .cond .val { color: #fff !important; }

/* ---------- Cards / timeline ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1.1rem; margin: .75rem 0; box-shadow: var(--shadow); }
.card h2 { margin-bottom: .6rem; }
.timeline { display: grid; gap: .75rem; }
.entry { position: relative; padding: 1rem 1rem .9rem; margin: 0; }
.entry-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.entry-head strong { display: block; }
.entry .wax { display: flex; align-items: center; gap: .4rem; font-weight: 600; margin-top: .4rem; }
.entry .wax .i { color: var(--accent); }
.stars { color: var(--gold); letter-spacing: 1px; font-size: 1rem; white-space: nowrap; }
.stars .off { color: var(--line-strong); }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); flex: none; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); border: 1.5px dashed var(--line-strong); border-radius: var(--r); }
.empty .i { width: 36px; height: 36px; color: var(--accent); margin-bottom: .4rem; }

/* ---------- Ranking ---------- */
.rank-row .medal {
  width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 800; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.rank-1 { border-color: color-mix(in srgb, var(--gold) 60%, transparent); background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 12%, var(--surface)), var(--surface)); }
.rank-1 .medal { background: linear-gradient(135deg, #fde047, #f5b301); color: #5b3b00; border: 0; box-shadow: 0 6px 16px -6px rgba(245, 179, 1, .8); }
.rank-2 .medal { background: linear-gradient(135deg, #e2e8f0, #9aa7b5); color: #1f2937; border: 0; }
.rank-3 .medal { background: linear-gradient(135deg, #f3b37a, #cd7f3a); color: #3b1d06; border: 0; }

/* ---------- Buttons ---------- */
.btn, button {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  font: inherit; font-weight: 700; cursor: pointer; text-align: center;
  padding: .7rem 1.1rem; border-radius: 14px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  transition: transform .12s ease, filter .12s ease;
}
.btn:active, button:active { transform: scale(.97); }
.btn.primary, button.primary { background: var(--grad); color: #fff; border-color: transparent; box-shadow: var(--shadow-lg); }
.btn.sm, button.sm { padding: .4rem .8rem; font-size: .85rem; border-radius: 11px; }
.btn.block, button.block { width: 100%; padding: .95rem; font-size: 1.02rem; }
button.danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.ghost, button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.danger-zone { margin-top: 1.5rem; text-align: center; }

/* ---------- Forms ---------- */
.form-title { margin-top: 1rem; }
.group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; margin: .75rem 0; box-shadow: var(--shadow); }
.group-title { display: flex; align-items: center; gap: .45rem; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 .6rem; }
.group-title .i { width: 15px; height: 15px; color: var(--accent); }
label.field { display: block; margin: .7rem 0 0; }
label.field:first-of-type { margin-top: 0; }
.label { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: .3rem; }
input, select, textarea {
  display: block; width: 100%;
  font: inherit; font-size: 16px; /* prevents iOS zoom */
  padding: .75rem .85rem; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
  -webkit-appearance: none; appearance: none;
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
input[type="date"] { min-height: 48px; }
textarea { resize: vertical; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.grid2 > label.field { margin-top: 0; }
.grid2 + .grid2, .grid2 + label.field { margin-top: .7rem; }

.input-group { position: relative; display: flex; align-items: stretch; }
.input-group input { padding-right: 2.6rem; min-width: 0; flex: 1; }
.input-group .suffix { position: absolute; right: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85rem; pointer-events: none; }
.input-group .sign {
  flex: none; width: 44px; margin-right: .35rem; padding: 0; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--accent); font-size: 1.1rem; font-weight: 800;
}

/* chip radios (snow type, technique) */
.pills { display: flex; flex-wrap: wrap; gap: .4rem; }
.pills label { margin: 0; }
.pills input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.pills span {
  display: inline-block; padding: .5rem .85rem; border-radius: 999px; font-size: .88rem; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--text); cursor: pointer;
  transition: all .15s ease;
}
.pills input:checked + span { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 6px 16px -8px rgba(37, 99, 235, .8); }
.pills input:focus-visible + span { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.pills.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 14px; padding: 4px; gap: 4px; }
.pills.seg span { display: block; text-align: center; border: 0; background: transparent; border-radius: 10px; }
.pills.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.pills.num span { min-width: 2.6rem; text-align: center; padding: .45rem .6rem; }

/* star rating input (DOM order 5..1, shown 1..5) */
.star-input { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: .2rem; }
.star-input input { position: absolute; opacity: 0; pointer-events: none; }
.star-input label { margin: 0; cursor: pointer; font-size: 2.1rem; line-height: 1; color: var(--line-strong); transition: transform .1s ease, color .1s ease; }
.star-input label:active { transform: scale(1.2); }
.star-input input:checked ~ label { color: var(--gold); }

/* switch */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 1rem; cursor: pointer; margin: 0; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { position: relative; width: 50px; height: 30px; flex: none; border-radius: 999px; background: var(--line-strong); transition: background .2s ease; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); transition: transform .2s ease; }
.switch input:checked + .track { background: var(--ok); }
.switch input:checked + .track::after { transform: translateX(20px); }

.race-ski { border: 1px solid var(--line); border-radius: 14px; padding: .8rem .9rem; margin-top: .6rem; background: var(--surface-2); transition: background .2s ease, border-color .2s ease; }
.race-ski .race-fields { display: none; margin-top: .8rem; }
.race-ski:has(.switch input:checked) { background: var(--surface); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.race-ski:has(.switch input:checked) .race-fields { display: block; }
.race-ski .race-fields label.field { margin-top: .6rem; }

.hint { display: flex; align-items: center; gap: .5rem; font-size: .85rem; padding: .6rem .8rem; border-radius: 12px; margin: .5rem 0; background: color-mix(in srgb, var(--ok) 12%, transparent); color: color-mix(in srgb, var(--ok) 70%, var(--text)); }

details.manage summary { list-style: none; cursor: pointer; }
details.manage summary::-webkit-details-marker { display: none; }
details.manage[open] { padding-bottom: .5rem; }
form.inline { display: flex; gap: .5rem; align-items: center; margin: .6rem 0 0; }

/* ---------- Auth ---------- */
.auth { min-height: calc(100vh - 140px); display: grid; place-items: center; }
.auth-card { width: 100%; max-width: 380px; text-align: center; }
.auth-card .logo-mark { width: 72px; height: 72px; border-radius: 24px; margin: 0 auto 1rem; }
.auth-card .logo-mark .i { width: 38px; height: 38px; }
.auth-card form { text-align: left; margin-top: 1.5rem; }
.auth-card label.field { margin-top: .8rem; }
.auth-card button { margin-top: 1.2rem; }

/* ---------- Scanner ---------- */
.scanner { position: relative; border-radius: 26px; overflow: hidden; background: #000; aspect-ratio: 1 / 1; box-shadow: var(--shadow-lg); }
.scanner #reader { width: 100%; height: 100%; }
.scanner #reader video { width: 100% !important; height: 100% !important; object-fit: cover; }
.scanner #reader img, .scanner #reader #qr-shaded-region { display: none !important; }
.scan-frame { position: absolute; inset: 15%; pointer-events: none; }
.scan-frame::before, .scan-frame::after { content: ""; position: absolute; inset: 0; border-radius: 22px; }
.scan-frame::before {
  border: 4px solid transparent;
  background: linear-gradient(#fff, #fff) top left / 34px 4px no-repeat, linear-gradient(#fff, #fff) top left / 4px 34px no-repeat,
              linear-gradient(#fff, #fff) top right / 34px 4px no-repeat, linear-gradient(#fff, #fff) top right / 4px 34px no-repeat,
              linear-gradient(#fff, #fff) bottom left / 34px 4px no-repeat, linear-gradient(#fff, #fff) bottom left / 4px 34px no-repeat,
              linear-gradient(#fff, #fff) bottom right / 34px 4px no-repeat, linear-gradient(#fff, #fff) bottom right / 4px 34px no-repeat;
  border: 0;
}
.scan-frame::after { box-shadow: 0 0 0 2000px rgba(0, 0, 0, .35); }
.scan-line { position: absolute; left: 18%; right: 18%; height: 2px; top: 20%; background: linear-gradient(90deg, transparent, #38bdf8, transparent); box-shadow: 0 0 14px 2px #38bdf8; animation: scan 2.2s ease-in-out infinite; }
@keyframes scan { 50% { top: 78%; } }
.scan-status { text-align: center; margin: 1rem 0; color: var(--muted); }

/* ---------- QR label ---------- */
.qr-card { display: flex; flex-direction: column; align-items: center; gap: .4rem; text-align: center; padding: 1.6rem; }
.qr-card img { width: min(64vw, 260px); background: #fff; padding: 12px; border-radius: 16px; }
.qr-card strong { font-size: 1.15rem; }

/* ---------- Responsive / print ---------- */
@media (max-width: 400px) {
  .conds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  h1 { font-size: 1.55rem; }
  .hero h1 { font-size: 1.65rem; }
}
@media print {
  .appbar, .tabbar, .noprint { display: none !important; }
  body { background: #fff; color: #000; padding: 0; }
  .card { border: 0; box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* visually hidden native controls (pills, stars, switches) must not affect layout */
.pills input, .star-input input, .switch input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; padding: 0; pointer-events: none; }
.pills label, .star-input, .switch { position: relative; }
.rank-1 > .i:last-child { color: var(--gold); width: 22px; height: 22px; }

/* ---------- Events (training / race) ---------- */
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.hero-icons { display: flex; gap: .4rem; }
.hero .icon-btn.glass { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .25); color: #fff; }
.hero-race { background: linear-gradient(140deg, #3b1d06 0%, #c2410c 55%, #f59e0b 100%); box-shadow: 0 20px 40px -18px rgba(234, 88, 12, .55); }
.hero-actions form { margin: 0; }
.hero-actions .grow { flex: 1; min-width: 0; }
.hero-actions .grow .btn { width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chip.kind-race { color: #c2410c; background: color-mix(in srgb, #f97316 14%, transparent); border-color: transparent; }
.chip.kind-training { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); border-color: transparent; }
.datebox.kind-race { background: color-mix(in srgb, #f97316 12%, var(--surface)); border-color: color-mix(in srgb, #f97316 35%, transparent); }
.datebox.kind-race span { color: #c2410c; }
@media (prefers-color-scheme: dark) { .chip.kind-race, .datebox.kind-race span { color: #fb923c; } }

.filter { margin: 0 0 1rem; }
.filter a { display: block; text-align: center; padding: .5rem; border-radius: 10px; font-weight: 600; font-size: .9rem; color: var(--muted); }
.filter a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.pills.seg span .i { width: 16px; height: 16px; }

.race-ski.focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); }
.race-ski { scroll-margin-top: 90px; }
.ski-label { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.ski-label strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.race-fields .star-input label { font-size: 1.8rem; }

.entry-title { color: var(--text); display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.entry-title .meta { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; font-size: .82rem; color: var(--muted); }
.entry-side { display: flex; gap: .5rem; align-items: center; }
.entry-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.entry.rank-1 { border-color: color-mix(in srgb, var(--gold) 60%, transparent); }
.medal { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 800; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.medal.sm { width: 32px; height: 32px; font-size: .9rem; }
.medal.m1 { background: linear-gradient(135deg, #fde047, #f5b301); color: #5b3b00; border: 0; }
.medal.m2 { background: linear-gradient(135deg, #e2e8f0, #9aa7b5); color: #1f2937; border: 0; }
.medal.m3 { background: linear-gradient(135deg, #f3b37a, #cd7f3a); color: #3b1d06; border: 0; }

/* ---------- Finder ---------- */
details.finder-form > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin: 0; }
details.finder-form > summary::-webkit-details-marker { display: none; }
details.finder-form[open] > summary { margin-bottom: .8rem; }
details.finder-form > summary::after { content: "▾"; margin-left: auto; transition: transform .2s; }
details.finder-form[open] > summary::after { transform: rotate(180deg); }
.finder-summary { display: flex; flex-wrap: wrap; gap: .3rem; text-transform: none; letter-spacing: 0; font-weight: 600; }
.finder-form form > .grid2, .finder-form form > label.field { margin-top: .7rem; }
.finder-form .btn.block { margin-top: .8rem; }
.row .body > .meta + .meta { margin-top: .35rem; }
button.row.assign { width: 100%; text-align: left; font: inherit; cursor: pointer; }
