:root {
  --bg: #f4f7f2; --surface: #fff; --surface2: #eef3ea; --text: #17231a; --muted: #5a6b5d; --line: #dbe4d7;
  --accent: #2b8a3e; --accent-ink: #fff; --accent-soft: #dff2dc; --warn: #b45309; --warn-soft: #fff1d6;
  --danger: #c92a2a; --danger-soft: #fde4e4; --gold: #d6a100; --silver: #8d99a6; --bronze: #b0703a;
  --shadow: 0 1px 2px rgb(20 40 20 / .06), 0 4px 14px rgb(20 40 20 / .06);
  --r: 14px; --tap: 48px; --header-h: 60px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1711; --surface: #172019; --surface2: #1d2920; --text: #e8f1ea; --muted: #9db0a1; --line: #2a3a2e;
    --accent: #4cc15f; --accent-ink: #072b0f; --accent-soft: #1f3d25; --warn: #f0b04a; --warn-soft: #3a2c10;
    --danger: #ff7b7b; --danger-soft: #3d1c1c; --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 4px 14px rgb(0 0 0 / .3);
  }
}
:root[data-theme="dark"] {
  --bg: #0f1711; --surface: #172019; --surface2: #1d2920; --text: #e8f1ea; --muted: #9db0a1; --line: #2a3a2e;
  --accent: #4cc15f; --accent-ink: #072b0f; --accent-soft: #1f3d25; --warn: #f0b04a; --warn-soft: #3a2c10;
  --danger: #ff7b7b; --danger-soft: #3d1c1c; --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 4px 14px rgb(0 0 0 / .3);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
main:focus, main:focus-visible { outline: none; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 90px); }
body { margin: 0; font: 16px/1.5 var(--font); background: var(--bg); color: var(--text); min-height: 100dvh; display: flex; flex-direction: column; overflow-x: hidden; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.5rem, 5vw, 2.1rem); } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; } a { color: var(--accent); }
code { background: var(--surface2); padding: .1em .35em; border-radius: 6px; font-size: .9em; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; z-index: 99; top: 8px; left: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); } .small { font-size: .875rem; } .num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); text-align: center; padding: 1rem; margin: 0; }

/* ---- layout ---- */
main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 16px 16px 96px; outline: none; }
.page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.page-title { margin: 4px 0 0; }
.cols { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .cols { grid-template-columns: 1.7fr 1fr; align-items: start; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card.narrow { max-width: 460px; margin: 24px auto; width: 100%; }
.modebar { background: var(--warn-soft); color: var(--warn); text-align: center; font-size: .82rem; padding: 6px 12px; }
.foot { text-align: center; color: var(--muted); font-size: .78rem; padding: 18px 16px 90px; }

/* ---- header / nav ---- */
.top { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1100px; margin: 0 auto; padding: 0 16px; height: var(--header-h); display: flex; align-items: center; gap: 16px; }
.brand { min-height: 44px; min-width: 44px; display: flex; align-items: center; gap: 10px; color: var(--accent); text-decoration: none; flex: none; }
.bn { white-space: nowrap; display: flex; flex-direction: column; color: var(--text); font-weight: 600; font-size: 1.1rem; line-height: 1.05; }
.bn b { color: var(--accent); } .bn small { font-weight: 500; color: var(--muted); font-size: .66rem; letter-spacing: .06em; text-transform: uppercase; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; min-height: 40px; display: inline-flex; align-items: center; }
.nav a:hover { background: var(--surface2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.user { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; }
.badge { background: var(--accent-soft); color: var(--accent); font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 999px; font-weight: 700; }
@media (max-width: 719px) {
  :root { --header-h: 56px; }
  .nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; justify-content: space-around; gap: 0; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgb(0 0 0 / .08); }
  .nav a { flex: 1; justify-content: center; border-radius: 12px; padding: 8px 4px; min-height: 48px; font-size: .88rem; }
  .bn small { display: none; } .user b { max-width: 7ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top-in { gap: 8px; padding: 0 12px; }
}

@media (max-width: 440px) { .bn, .user b { display: none; } .top-right { gap: 6px; } }

/* ---- buttons / inputs ---- */
.btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 0 18px; min-height: 44px; border-radius: 12px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; gap: 6px; }
.btn:hover { background: var(--surface2); } .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; } .btn.small { min-height: 40px; padding: 0 12px; font-size: .9rem; } .btn.icon { padding: 0; width: 40px; min-width: 40px; flex: none; }
.btn.big { width: 100%; min-height: 56px; font-size: 1.1rem; } .btn.danger { color: var(--danger); }
.field { display: grid; gap: 4px; font-size: .9rem; min-width: 0; }
.field > span { font-weight: 600; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; padding: 0 12px; min-height: 48px; width: 100%; min-width: 0; }
textarea { padding: 10px 12px; } input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
form .field + .field, form .field + .error, form .error + .btn { margin-top: 12px; }
.error { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: 10px; font-weight: 600; font-size: .9rem; }
.status.warn { background: var(--warn-soft); color: var(--warn); padding: 10px 12px; border-radius: 10px; font-size: .9rem; margin-top: 12px; }
.inline { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; } .inline .grow { flex: 1 1 200px; } .inline .field { flex: 0 1 140px; } .inline .field.grow { flex: 1 1 200px; }
.grid-user { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; }
.demo-hint { margin-top: 16px; background: var(--surface2); border-radius: 12px; padding: 12px 14px; font-size: .9rem; } .demo-hint ul { margin: 6px 0 0; padding-left: 18px; }
.linkish { background: none; border: 0; color: var(--text); font: inherit; cursor: pointer; text-align: left; padding: 6px 0; min-height: 44px; }
.linkish small { color: var(--muted); margin-left: 6px; }

/* ---- dashboard ---- */
.hero { display: grid; gap: 16px; padding: 22px 18px; border-radius: 20px; color: #fff;
  background: radial-gradient(1200px 300px at 90% -20%, rgb(255 255 255 / .18), transparent), linear-gradient(135deg, #1f6f2e, #34a548 60%, #7bc043); }
.hero h1 { margin: 0; } .hero .muted { color: rgb(255 255 255 / .85); margin: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: .75rem; font-weight: 700; margin: 0 0 6px; display: flex; align-items: center; gap: 8px; }
.live { width: 9px; height: 9px; border-radius: 50%; background: #ff5d5d; box-shadow: 0 0 0 0 rgb(255 93 93 / .7); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgb(255 93 93 / 0); } 100% { box-shadow: 0 0 0 0 rgb(255 93 93 / 0); } }
@media (min-width: 720px) { .hero { grid-template-columns: 1fr auto; align-items: end; padding: 28px; } }
.stats { display: grid; grid-template-columns: repeat(4, auto); gap: 8px 22px; margin: 0; } .stats div { text-align: center; }
.stats dt { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; opacity: .85; } .stats dd { margin: 0; font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.search input { max-width: 100%; }
.standings, .feed { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.row { display: grid; grid-template-columns: 40px 1fr auto; grid-template-areas: "rk who best" "rk rounds rounds"; gap: 4px 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--surface); min-height: 64px; }
.row:hover { background: var(--surface2); }
.rk { grid-area: rk; font-weight: 800; font-size: 1.2rem; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.medal-1 .rk { color: var(--gold); } .medal-2 .rk { color: var(--silver); } .medal-3 .rk { color: var(--bronze); }
.medal-1 { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 7%, var(--surface)); }
.who { grid-area: who; display: grid; min-width: 0; } .who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .who small { color: var(--muted); }
.tie { color: var(--warn); font-weight: 700; }
.rounds { grid-area: rounds; display: flex; gap: 6px; flex-wrap: wrap; }
.rd { font-size: .85rem; background: var(--surface2); border-radius: 8px; padding: 2px 8px; font-variant-numeric: tabular-nums; } .rd i { font-style: normal; color: var(--muted); margin-right: 5px; font-size: .72rem; }
.rd.best { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.bestv { grid-area: best; text-align: right; display: grid; } .bestv b { font-size: 1.6rem; line-height: 1; font-variant-numeric: tabular-nums; } .bestv small { color: var(--muted); font-size: .7rem; text-transform: uppercase; }
@media (min-width: 720px) { .row { grid-template-columns: 48px 1fr auto 90px; grid-template-areas: "rk who rounds best"; } }
.feed li { display: flex; gap: 12px; align-items: center; padding: 8px 4px; border-bottom: 1px dashed var(--line); } .feed li:last-child { border: 0; }
.feed .fs { font-weight: 800; font-size: 1.25rem; min-width: 52px; text-align: center; background: var(--accent-soft); color: var(--accent); border-radius: 10px; padding: 4px 6px; font-variant-numeric: tabular-nums; }
.feed small { display: block; color: var(--muted); }

/* ---- modal ---- */
.modal { border: 0; padding: 0; border-radius: 18px; background: var(--surface); color: var(--text); width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); box-shadow: 0 20px 60px rgb(0 0 0 / .35); }
.modal::backdrop { background: rgb(0 0 0 / .5); } .modal-in header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.modal-in h2 { margin: 0; } .modal-body { padding: 14px 16px 18px; overflow: auto; max-height: calc(100dvh - 100px); }
.round { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; padding: 0 12px; } .round summary { cursor: pointer; display: flex; justify-content: space-between; padding: 12px 0; min-height: 44px; }
.sigimg { width: 100%; background: #fff; border-radius: 10px; border: 1px solid var(--line); }

/* ---- scorer ---- */
.scorer { display: grid; gap: 16px; }
.grid-setup { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.totalbar { position: sticky; top: var(--header-h); z-index: 20; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 16px; box-shadow: var(--shadow); }
.totalbar > div:first-child { display: flex; align-items: baseline; gap: 8px; }
.tl { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; } .tv { font-size: 2.1rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; color: var(--accent); } .tmax { color: var(--muted); }
.tbar { height: 6px; background: var(--surface2); border-radius: 99px; margin-top: 8px; overflow: hidden; } .tbar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .25s; }
.missions { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 820px) { .missions { grid-template-columns: 1fr 1fr; align-items: start; } }
.mission { padding: 0; overflow: hidden; }
.mission header { position: relative; }
.mimg { display: block; width: 100%; height: 220px; object-fit: contain; object-position: center; padding: 10px; background: #fff; border-bottom: 1px solid var(--line); } /* contain: show the WHOLE model, never crop */
@media (min-width: 720px) { .mimg { height: 240px; } }
[data-theme="dark"] .mimg { background: #f4f6f1; }
.mtitle { display: flex; align-items: center; gap: 10px; padding: 12px 14px 4px; flex-wrap: wrap; }
.mtitle h3 { margin: 0; flex: 1 1 140px; font-size: 1.05rem; } .mnum { background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: .78rem; padding: 3px 8px; border-radius: 8px; }
.mscore { font-weight: 800; font-variant-numeric: tabular-nums; background: var(--surface2); padding: 3px 10px; border-radius: 99px; }
.mission.scored { border-color: var(--accent); } .mission.scored .mscore { background: var(--accent-soft); color: var(--accent); }
.mission.voided { border-color: var(--danger); } .mission.voided .mscore { background: var(--danger-soft); color: var(--danger); }
.fields { display: grid; gap: 8px; padding: 8px 12px 12px; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: var(--tap); padding: 8px 12px; text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; }
button.opt { cursor: pointer; } button.opt:hover:not(:disabled) { background: var(--surface2); }
.opt.locked, .opt:disabled { opacity: .45; }
.opt .lbl { flex: 1; font-size: .95rem; display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.note { font-style: normal; font-size: .78rem; color: var(--muted); } .note.danger { color: var(--danger); }
.pts { font-weight: 800; color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; } .pts.bonus { font-size: .85rem; }
.box { width: 26px; height: 26px; border: 2px solid var(--muted); border-radius: 8px; flex: none; display: grid; place-items: center; }
[aria-checked="true"] > .box { background: var(--accent); border-color: var(--accent); }
[aria-checked="true"] > .box::after { content: ""; width: 7px; height: 13px; border: solid var(--accent-ink); border-width: 0 3px 3px 0; transform: rotate(45deg) translate(-1px, -1px); }
.opt.chk[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.opt.chk.danger[aria-checked="true"] { border-color: var(--danger); background: var(--danger-soft); } .opt.chk.danger[aria-checked="true"] > .box { background: var(--danger); border-color: var(--danger); }
.opt.cnt, .opt.segf { flex-wrap: wrap; } .segf { align-items: stretch; flex-direction: column; gap: 8px; }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button { width: var(--tap); height: var(--tap); border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface2); color: var(--text); font-size: 1.5rem; font-weight: 700; cursor: pointer; line-height: 1; }
.stepper button:hover:not(:disabled) { background: var(--accent-soft); } .stepper button:disabled { opacity: .35; cursor: not-allowed; }
.stepper output { min-width: 40px; text-align: center; font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; } .seg button { flex: 1 1 auto; min-height: var(--tap); padding: 6px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; display: grid; place-items: center; line-height: 1.15; }
.seg button small { color: var(--accent); font-weight: 800; font-size: .78rem; }
.seg button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); } .seg button[aria-checked="true"] small { color: var(--accent-ink); }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
#sc-tokens button { flex: 1 1 0; min-width: 44px; }
.eqflag { display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 8px 12px; border-radius: 12px; border: 1.5px dashed var(--line); background: transparent; color: var(--muted); font: inherit; font-size: .88rem; text-align: left; cursor: pointer; }
.eqflag small { color: var(--danger); font-weight: 700; } .eqflag[aria-checked="true"] { border: 1.5px solid var(--danger); background: var(--danger-soft); color: var(--danger); }
.mnotes { padding: 0 14px 12px; font-size: .85rem; color: var(--muted); } .mnotes summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; } .mnotes ul { margin: 4px 0 0; padding-left: 18px; }
.rv-table { width: 100%; border-collapse: collapse; font-size: .92rem; } .rv-table td, .rv-table th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.rv-table th.num, .rv-table td.num { text-align: right; } .rv-table td small { display: block; color: var(--muted); font-size: .76rem; } .rv-table tr:not(.has) td { color: var(--muted); }
.rv-table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); } .rv-table tfoot th { font-size: 1.3rem; border-bottom: 0; padding-top: 12px; }
.gp { margin-top: 14px; }
.sigwrap { position: relative; border: 2px dashed var(--line); border-radius: 12px; background: #fff; height: 170px; } .sigwrap canvas { width: 100%; height: 100%; display: block; border-radius: 10px; cursor: crosshair; }
.sighint { position: absolute; inset: 0; display: grid; place-items: center; color: #9aa5b1; pointer-events: none; font-size: 1.1rem; }
.sign .field { margin-top: 12px; } .agree { display: flex; gap: 12px; align-items: flex-start; margin-top: 14px; min-height: 44px; font-weight: 600; } .agree input { width: 26px; height: 26px; min-height: 0; flex: none; accent-color: var(--accent); }
.actions { display: grid; gap: 10px; }

.rules-ref summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.rules-ref ul { margin: 6px 0 0; padding-left: 18px; font-size: .9rem; color: var(--muted); } .rules-ref li { margin-bottom: 6px; }

/* ---- stats ---- */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); } @media (min-width: 720px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow); display: grid; } .kpi span { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; } .kpi b { font-size: 1.9rem; font-variant-numeric: tabular-nums; }
.spark { width: 100%; height: auto; max-height: 140px; } .chips { list-style: none; padding: 0; margin: 6px 0 0; display: flex; gap: 8px; flex-wrap: wrap; } .chips li { background: var(--surface2); border-radius: 99px; padding: 4px 12px; }
.focus { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; } .focus li { background: var(--surface2); border-radius: 12px; padding: 10px 12px; display: grid; } .focus small { color: var(--muted); }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; } .bars li { display: grid; grid-template-columns: minmax(0, 1fr) 54px; gap: 4px 10px; align-items: center; } .bl { grid-column: 1 / -1; font-size: .88rem; }
.bt { height: 10px; background: var(--surface2); border-radius: 99px; overflow: hidden; } .bt i { display: block; height: 100%; background: var(--accent); border-radius: 99px; } .bv { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; } .bv small { color: var(--muted); font-weight: 400; }
@media (min-width: 720px) { .bars li { grid-template-columns: 230px 1fr 64px; } .bl { grid-column: auto; } }
.history { list-style: none; padding: 0; margin: 0; } .history li { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); gap: 8px; }

/* ---- admin ---- */
.admin-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; } .admin-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; background: var(--surface2); border-radius: 10px; min-height: 48px; }
.bulk { margin-top: 12px; } .bulk summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; font-weight: 600; } .bulk textarea { margin: 8px 0; }
.table-scroll { overflow-x: auto; margin-top: 12px; } .data { width: 100%; border-collapse: collapse; font-size: .92rem; } .data th, .data td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; } .data th.num, .data td.num { text-align: right; }
.acts { display: flex; gap: 6px; justify-content: flex-end; } .row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- toasts ---- */
.toasts { position: fixed; z-index: 80; left: 12px; right: 12px; bottom: 84px; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
@media (min-width: 720px) { .toasts { bottom: 20px; } }
.toast { background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-weight: 600; box-shadow: 0 8px 24px rgb(0 0 0 / .3); max-width: 100%; animation: tin .2s ease-out; }
.toast.ok { background: var(--accent); color: var(--accent-ink); } .toast.err { background: var(--danger); color: #fff; } .toast.out { opacity: 0; transition: opacity .4s; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print { .top, .nav, .foot, .modebar, .toasts { display: none; } }

.or{display:flex;align-items:center;gap:.75rem;margin:1rem 0;color:var(--muted)}
.or::before,.or::after{content:"";flex:1;height:1px;background:var(--line,currentColor);opacity:.3}
.uidrow{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;margin:.5rem 0}
.uidrow code{overflow-wrap:anywhere;user-select:all}

.demo-roles{display:grid;gap:.5rem;margin-top:.75rem}
.demo-roles .btn{flex-direction:column;align-items:flex-start;gap:0;padding-block:.5rem;text-align:left}
.demo-roles small{font-weight:400;opacity:.7}
.block{display:block}
.badge.live-b{background:var(--accent);color:#fff}
.evsel select{min-height:48px}
.checklist{display:grid;gap:.25rem;max-height:50vh;overflow:auto;margin:.5rem 0 1rem}
.check{display:flex;align-items:center;gap:.6rem;min-height:44px}
.check input{width:20px;height:20px}
#a-users h3{margin:1rem 0 .25rem}
.toolbar{display:flex;gap:.75rem;flex-wrap:wrap;align-items:flex-end;margin:0 0 1rem}
.toolbar .search{flex:1 1 220px}
.toolbar .evsel{flex:1 1 220px;margin:0}
.admin-list li .acts{flex-wrap:wrap}
@media (max-width:420px){.admin-list li{flex-wrap:wrap}}
.top-in .brand { flex: none; }
.user b { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 720px) and (max-width: 940px) { .nav a { padding: 8px 10px; } .user .badge { display: none; } .bn small { display: none; } }
.sched th, .sched td { white-space: nowrap; } .sched td.hit { background: var(--accent-soft); font-weight: 600; }
.sched-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: end; margin: 12px 0; }
.sched-form .row-actions { grid-column: 1 / -1; }
.sched-meta { margin: 8px 0; } .chip { display: inline-block; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 4px 10px; margin: 2px 2px; font-weight: 600; font-size: .9rem; }
.mine { margin: 0 0 12px; line-height: 2; } .badge.warnb { background: #f59f00; color: #1d1d1d; }
.evtitle { margin: 0 0 12px; }
@media (min-width: 720px) and (max-width: 940px) { .bn, .user b { display: none; } }

/* ---- nav icons + roomy phone tabs (+ "More" sheet when there are more than 5) ---- */
.ni { font-size: 1.05rem; line-height: 1; margin-right: 6px; }
@media (min-width: 720px) and (max-width: 940px) { .ni { display: none; } }
@media (max-width: 719px) {
  .nav a, .nav .more { flex: 1 1 0; min-width: 0; flex-direction: column; justify-content: center; align-items: center; gap: 3px; padding: 6px 2px; min-height: 56px; font-size: .78rem; line-height: 1.1; border-radius: 12px; }
  .nav .ni { margin: 0; font-size: 1.35rem; }
  .nav .more { background: none; border: 0; color: var(--muted); font-family: inherit; font-weight: 600; display: inline-flex; cursor: pointer; }
  .nav .more.on, .nav .more[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
  .nav-sheet { position: absolute; bottom: calc(100% + 8px); right: 8px; min-width: 200px; display: grid; gap: 2px; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 28px rgb(0 0 0 / .18); }
  .nav-sheet[hidden] { display: none; }
  .nav .nav-sheet a { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 12px 14px; min-height: 48px; font-size: 1rem; }
  .nav .nav-sheet .ni { font-size: 1.2rem; }
  main { padding-bottom: 96px; }
}
.rel { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 10px; } .rel li { display: grid; grid-template-columns: 1fr 90px 44px; align-items: center; gap: 10px; }
.bt.good i { background: #2f9e44; } .bt.bad i { background: #e03131; }
.bl small { display: block; opacity: .75; font-weight: 400; font-size: .8rem; }
.kpi small { display: block; font-size: .75rem; opacity: .8; } .kpi small.up { color: #2f9e44; } .kpi small.down { color: #e03131; }
.mlist { display: grid; gap: 6px; } .mrow { background: var(--surface2); border-radius: 12px; padding: 4px 12px; }
.mrow summary { display: grid; grid-template-columns: 1fr 90px 64px; align-items: center; gap: 10px; min-height: 52px; cursor: pointer; list-style: none; }
.mrow summary::-webkit-details-marker { display: none; } .mrow .bars.sub { margin: 4px 0 10px; }
.bv small { font-weight: 400; opacity: .7; }
@media (max-width: 480px) { .rel li, .mrow summary { grid-template-columns: 1fr 64px 44px; } }
/* backdrop-filter makes the header a containing block for position:fixed, which pinned the phone tab bar under the header */
@media (max-width: 719px) { .top { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--surface); } }
@media (max-width: 719px) { .nav > a > .nl[data-short] { font-size: 0; } .nav > a > .nl[data-short]::after { content: attr(data-short); font-size: .78rem; } }

.pwbox { display: flex; align-items: center; gap: 12px; margin: 10px 0; flex-wrap: wrap; } .pwbox code { font-size: 2rem; font-weight: 800; letter-spacing: .18em; background: var(--surface2); padding: 8px 16px; border-radius: 12px; user-select: all; }
.checkrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; } .checkrow .check { flex: 1; }
.tl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } @media (max-width: 420px) { .tl-grid { grid-template-columns: 1fr; } }
.or span { white-space: nowrap; }
#tl button[type=submit] { margin-top: 12px; }
/* teams tab, team colors, password state */
.cdots { display: inline-flex; gap: 3px; margin-right: 7px; vertical-align: middle; } .cdots i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
.teamlist { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 8px; }
.trow { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--border, rgba(127,127,127,.3)); border-radius: 12px; background: var(--surface2); }
.trow.on { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); } .trow .tmain { min-width: 0; flex: 1 1 180px; } .trow .acts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.badge.on { background: var(--accent); color: #fff; }
.pwbox.off code { opacity: .45; text-decoration: line-through; } .pwstate { margin: 6px 0; } .okt { color: #2e9e5b; } .offt { color: #d9480f; }
.colorrow { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0; } .colorpick { display: inline-flex; align-items: center; gap: 4px; }
.colorpick input[type=color] { width: 46px; height: 40px; padding: 2px; border-radius: 10px; border: 1px solid var(--border, rgba(127,127,127,.4)); background: var(--surface2); cursor: pointer; }
.teamswitch { max-width: 360px; margin-bottom: 10px; }
.colorpick .btn { min-width: 44px; min-height: 44px; }
/* desktop: when the links don't fit the header, the extras go under a "More" drop-down */
@media (min-width: 720px) {
  .nav { position: relative; }
  .nav .more { background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 999px; min-height: 40px; display: inline-flex; align-items: center; cursor: pointer; }
  .nav .more:hover, .nav .more.on, .nav .more[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
  .nav-sheet { position: absolute; top: calc(100% + 6px); right: 0; min-width: 190px; display: grid; gap: 2px; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 28px rgb(0 0 0 / .18); z-index: 60; }
  .nav-sheet[hidden] { display: none; }
  .nav .nav-sheet a { border-radius: 10px; }
}
.trow { cursor: pointer; } .backlink { margin: 0 0 6px; } .teamdetail h3 { margin-top: 14px; }
/* Analytics */
.chart { width: 100%; height: auto; display: block; } .chart .gl { stroke: var(--line, rgba(127,127,127,.25)); stroke-width: 1; } .chart .ax { fill: var(--muted); font-size: 11px; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 0; margin: 6px 0 0; font-size: .85rem; } .legend i, .chip i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.cardhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; } .cardhead h2 { margin: 0; }
.ln { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.1s ease forwards; animation-delay: var(--d, 0s); } .ln.dash { stroke-dasharray: .03 .02; animation-name: fadein; stroke-dashoffset: 0; }
.dt { opacity: 0; animation: fadein .4s ease forwards; animation-delay: var(--d, 0s); }
.bar { transform-box: fill-box; transform-origin: center bottom; animation: grow .6s ease backwards; animation-delay: var(--d, 0s); } .bt i.grow { animation: growx .8s ease backwards; transform-origin: left; }
.chips-pick { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; } .chips-pick .chip { position: relative; display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: 99px; background: var(--surface2); cursor: pointer; font-size: .85rem; } .chips-pick .chip.on { outline: 2px solid var(--accent); } .chips-pick input { position: absolute; opacity: 0; pointer-events: none; }
.hm-wrap { overflow-x: auto; } .hm { display: grid; grid-template-columns: 46px repeat(var(--n), minmax(10px, 1fr)); gap: 2px; min-width: min(100%, calc(46px + var(--n) * 12px)); } .hm-l { font-size: .7rem; color: var(--muted); align-self: center; }
.hm-c { display: block; height: 18px; border-radius: 3px; background: color-mix(in srgb, var(--accent) var(--p), var(--surface2)); animation: fadein .5s ease backwards; animation-delay: var(--d, 0s); }
.an-table th { cursor: pointer; white-space: nowrap; user-select: none; } .an-table th.sorted { color: var(--accent); } .an-table td { white-space: nowrap; font-variant-numeric: tabular-nums; } .an-table td.zero { color: var(--muted); }
.an-table .cbar { display: inline-block; width: 46px; height: 8px; background: var(--surface2); border-radius: 99px; overflow: hidden; margin-right: 6px; vertical-align: middle; } .an-table .cbar i { display: block; height: 100%; width: var(--w); background: var(--accent); animation: growx .8s ease backwards; transform-origin: left; }
.rowin { animation: rowin .45s ease backwards; animation-delay: var(--d, 0s); } .up { color: var(--accent); } .down { color: #c92a2a; }
@keyframes draw { to { stroke-dashoffset: 0; } } @keyframes fadein { from { opacity: 0; } to { opacity: 1; } } @keyframes grow { from { transform: scaleY(0); } } @keyframes growx { from { transform: scaleX(0); } } @keyframes rowin { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .ln, .dt, .bar, .hm-c, .rowin, .bt i.grow, .an-table .cbar i { animation: none !important; stroke-dashoffset: 0 !important; opacity: 1 !important; } }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; } .tabs button { min-height: 44px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line, rgba(127,127,127,.3)); background: var(--surface2); color: inherit; font: inherit; cursor: pointer; } .tabs button.on, .tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.teamdetail { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); } .tabpanel { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); } .tabpanel[hidden] { display: none; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; } .tabs button { min-height: 44px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line, rgba(127,127,127,.3)); background: var(--surface2); color: inherit; font: inherit; cursor: pointer; } .tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.teamdetail { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); } .tabpanel { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); } .tabpanel[hidden], .teamdetail[hidden] { display: none; }

/* ---- big screen (projector) scoreboard: fixed dark theme, every team always fits ---- */
body.bs-open { overflow: hidden; }
.bs { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; background: #0b1410; color: #f2f8f3; padding: 1.2vh 2vw 1.5vh; }
.bs-head { display: flex; justify-content: space-between; align-items: center; gap: 2vw; flex: 0 0 auto; padding-bottom: .8vh; }
.bs-head h1 { margin: 0; font-size: clamp(1.1rem, 4vh, 2.6rem); } .bs-head p { margin: 0; color: #9fb7a6; font-size: clamp(.75rem, 2vh, 1.2rem); }
.bs-x { font: inherit; font-size: clamp(.8rem, 2vh, 1.1rem); color: #f2f8f3; background: transparent; border: 1px solid #3b5444; border-radius: 10px; padding: .4em .9em; cursor: pointer; opacity: .6; }
.bs-x:hover, .bs-x:focus-visible { opacity: 1; }
.bs-table { flex: 1 1 0; min-height: 0; display: grid; font-variant-numeric: tabular-nums; overflow: hidden; }
.bs-r { display: grid; grid-template-columns: .8fr 1.4fr 4fr 1.2fr 1.2fr 1.2fr 1.4fr; align-items: center; gap: 0 .5em; min-height: 0; padding: 0 .5em; border-bottom: 1px solid #1f3328; line-height: 1; }
.bs-r > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bs-r .bs-n { text-align: right; } .bs-r .bs-rk { font-weight: 800; text-align: center; } .bs-r .bs-tn { color: #9fb7a6; text-align: center; } .bs-r .bs-nm { font-weight: 700; }
.bs-r .bs-best { font-weight: 800; color: #6ee27f; } .bs-r .bs-top { font-weight: 700; color: #fff; } .bs-r .bs-n:not(.bs-top):not(.bs-best) { color: #b9cdbf; }
.bs-h { font-size: .7em; color: #9fb7a6; text-transform: uppercase; letter-spacing: .06em; border-bottom: 2px solid #3b5444; } .bs-h > span { font-weight: 600; }
.bs-r.m1 { background: #2b2508; } .bs-r.m1 .bs-rk { color: #ffd23f; } .bs-r.m2 { background: #1d2328; } .bs-r.m2 .bs-rk { color: #c4cfd8; } .bs-r.m3 { background: #2a1d12; } .bs-r.m3 .bs-rk { color: #e39a5c; }
.bs-empty { color: #9fb7a6; align-self: center; text-align: center; }
