/* ==========================================================================
   Leopards v2 - "Matchday" design system
   Shared tokens, shell (top bar / phone tabs), and components.
   Rules of the look: white pages, hairline borders, 6px corners, no shadows
   (only pop-outs float), condensed capitals for headings and numbers,
   club blue in solid blocks, red as a sharp accent.
   Reference: Markdowns/Design_System.md
   ========================================================================== */

:root {
    /* colour */
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #f4f6fb;          /* quiet fill: table heads, tracks, wells */
    --ink: #0b1530;
    --muted: #5a6681;
    --line: #dde2ee;
    --line-strong: #b9c2d8;
    --blue: #0849df;               /* club blue (was --BRANGYBLUE) */
    --blue-deep: #06309a;
    --blue-tint: #e9effe;
    --on-blue: #ffffff;
    --red: #cf1b2b;
    --red-tint: #fdecee;
    --win: #11804a;
    --win-tint: #e4f5ec;
    --draw: #6f7a91;
    --draw-tint: #eef0f5;
    --gold: #b8860b;
    --scored: #078a6c;             /* goals we score (charts, bars, tiles) */
    --conceded: #d42a1e;           /* goals against */
    --backdrop: rgba(6, 12, 30, .55);
    --shadow-pop: 0 24px 60px -12px rgba(6, 12, 30, .35), 0 0 0 1px rgba(6, 12, 30, .06);

    /* type */
    --f-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", Impact, sans-serif;
    --f-body: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

    /* shape + rhythm */
    --r: 6px;
    --r-sm: 4px;
    --gap: 16px;
    --gutter: clamp(16px, 4vw, 32px);
    --bar-h: 56px;
    --tab-h: 58px;

    /* motion */
    --ease-out: cubic-bezier(.22, 1, .36, 1);
    --ease-sheet: cubic-bezier(.32, .72, 0, 1);
    --t-quick: 140ms;
    --t-move: 280ms;

    color-scheme: light;
}

html.dark {
    --bg: #080d1a;
    --surface: #0e1629;
    --surface-2: #151f38;
    --ink: #eef1f8;
    --muted: #9aa5be;
    --line: #222d49;
    --line-strong: #37446a;
    --blue: #2f66ff;
    --blue-deep: #0849df;
    --blue-tint: #14224a;
    --on-blue: #ffffff;
    --red: #ff5a66;
    --red-tint: #3a151c;
    --win: #3ccb8a;
    --win-tint: #10301f;
    --draw: #8d98b3;
    --draw-tint: #1b2440;
    --gold: #e0b341;
    --scored: #1fa583;
    --conceded: #f25a3c;
    --backdrop: rgba(0, 0, 0, .66);
    --shadow-pop: 0 24px 60px -12px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .08);
    color-scheme: dark;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar-h) + 12px); }
body.v2 {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 400 15px/1.5 var(--f-body);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    min-height: 100vh; min-height: 100dvh;
}
:where(.v2) :where(h1, h2, h3, h4, p, ul, ol, figure, dl, dd) { margin: 0; padding: 0; }
:where(.v2) :where(ul, ol) { list-style: none; }
:where(.v2) img { max-width: 100%; display: block; }
:where(.v2) a { color: inherit; text-decoration: none; }
:where(.v2) :where(button, input, select, textarea) { font: inherit; color: inherit; }
:where(.v2) button { cursor: pointer; background: none; border: 0; padding: 0; }
:where(.v2) table { border-collapse: collapse; width: 100%; }
.v2 [hidden] { display: none !important; }
.v2 :focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 2px; }
.v2 ::selection { background: var(--blue); color: #fff; }

.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: var(--r-sm); }
.skip:focus { left: 8px; }

/* ---------- type ---------- */
.v2 h1, .v2 h2, .v2 h3, .display {
    font-family: var(--f-display);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .005em;
    line-height: .95;
    text-wrap: balance;
}
.v2 h1 { font-size: clamp(38px, 7vw, 60px); }
.v2 h2 { font-size: 26px; }
.v2 h3 { font-size: 20px; font-weight: 700; }
.eyebrow, .label {
    font: 700 12px/1.2 var(--f-display);
    letter-spacing: .14em;
    text-transform: uppercase;
}
.eyebrow { color: var(--red); }
.label { color: var(--muted); }
.num { font-family: var(--f-display); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.muted { color: var(--muted); }
.icon { flex: none; }

/* ---------- top bar ---------- */
.bar {
    position: sticky; top: 0; z-index: 40;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding-top: env(safe-area-inset-top, 0px);
}
.bar-in {
    height: var(--bar-h);
    max-width: 1240px; margin: 0 auto;
    padding: 0 var(--gutter);
    display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand img { width: 36px; height: 36px; border-radius: var(--r-sm); object-fit: cover; }
.brand-text { display: grid; line-height: 1; }
.brand-text b { font: 800 21px/0.95 var(--f-display); text-transform: uppercase; letter-spacing: .01em; white-space: nowrap; }
.brand-text i { font: 700 11px/1.3 var(--f-display); font-style: normal; color: var(--red); letter-spacing: .16em; text-transform: uppercase; white-space: nowrap; }

.bar-nav { display: flex; align-self: stretch; gap: 2px; margin-left: auto; }
.bar-nav a {
    display: flex; align-items: center; padding: 0 12px;
    font: 700 16px/1 var(--f-display); letter-spacing: .08em; text-transform: uppercase;
    color: var(--muted);
    border-bottom: 3px solid transparent; border-top: 3px solid transparent;
    transition: color var(--t-quick);
}
.bar-nav a:hover { color: var(--ink); }
.bar-nav a.is-active { color: var(--ink); border-bottom-color: var(--blue); }

.bar-tools { display: flex; align-items: center; gap: 6px; flex: none; }
.tool {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-width: 40px; height: 40px; padding: 0 10px;
    border: 1px solid var(--line); border-radius: var(--r);
    color: var(--ink); background: var(--surface);
    transition: border-color var(--t-quick), transform var(--t-quick);
}
.tool:hover { border-color: var(--line-strong); }
.tool:active { transform: scale(.96); }
.v2 kbd {
    font: 600 11px/1 var(--f-body); color: var(--muted);
    border: 1px solid var(--line); border-radius: 3px; padding: 3px 5px; background: var(--surface-2);
}
.when-dark { display: none; }
html.dark .when-dark { display: inline-flex; }
html.dark .when-light { display: none; }
.when-light { display: inline-flex; }
.tool-menu { display: none; }

/* ---------- phone tab bar ---------- */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: none; grid-template-columns: repeat(4, 1fr);
    background: var(--bg); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabbar a, .tabbar button {
    height: var(--tab-h);
    display: grid; place-content: center; justify-items: center; gap: 3px;
    color: var(--muted);
    font: 700 12px/1 var(--f-display); letter-spacing: .1em; text-transform: uppercase;
    position: relative;
}
.tabbar .is-active { color: var(--blue); }
.tabbar .is-active::before { content: ""; position: absolute; top: -1px; left: 22%; right: 22%; height: 3px; background: var(--blue); }
.tabbar a:active, .tabbar button:active { background: var(--surface-2); }

@media (max-width: 699px) {
    .bar-nav { display: none; }
    .bar-tools { margin-left: auto; }
    .brand-text b { font-size: 19px; }
    html[data-nav="bottom"] .tabbar { display: grid; }
    html[data-nav="bottom"] body.v2 { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); }
    html[data-nav="top"] .tool-menu { display: inline-flex; }
}
/* the smallest phones (iPhone SE and similar): tighten the bar so the buttons fit */
@media (max-width: 359px) {
    .bar-in { gap: 8px; }
    .brand { gap: 8px; }
    .brand-text b { font-size: 16px; }
    .brand-text i { font-size: 9px; }
    .bar-tools { gap: 4px; }
}
@media (min-width: 700px) and (max-width: 979px) {
    .brand-text b { font-size: 17px; }
    .brand-text i { font-size: 10px; }
    .bar-in { gap: 10px; }
    .bar-nav a { padding: 0 9px; font-size: 15px; }
}
/* narrow tablets: the full menu needs the room, so the badge stands in for the club name */
@media (min-width: 700px) and (max-width: 899px) { .brand-text { display: none; } }
@media (min-width: 700px) { .pref-nav { display: none !important; } }

/* ---------- page frame ---------- */
.page { max-width: 1240px; margin: 0 auto; padding: 24px var(--gutter) 64px; display: grid; gap: 24px; }
.page > * { min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.page-head .eyebrow { margin-bottom: 8px; }
.page-head-side { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head .label a { color: var(--blue); }

.grid { display: grid; gap: var(--gap); }
.grid > * { min-width: 0; }
@media (min-width: 700px)  { .cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------- tile ---------- */
.tile {
    display: block; position: relative; width: 100%; text-align: left;
    background: var(--surface); color: var(--ink);
    border: 1px solid var(--line); border-radius: var(--r);
    padding: 16px;
}
.tile-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.tile-head h2, .tile-head h3 { font-size: 20px; font-weight: 700; }
.tile--flush { padding: 0; overflow: hidden; }
.tile--blue { background: var(--blue-deep); color: var(--on-blue); border-color: var(--blue-deep); }
html:not(.dark) .tile--blue { background: var(--blue); border-color: var(--blue); }
.tile--blue .label, .tile--blue .muted { color: rgba(255, 255, 255, .78); }
.tile--blue .eyebrow { color: #fff; }

/* a tile you can open */
.is-click { cursor: pointer; transition: border-color var(--t-quick), transform var(--t-quick), background-color var(--t-quick); }
.is-click:active { transform: scale(.985); }
@media (hover: hover) { .is-click:hover { border-color: var(--ink); } .tile--blue.is-click:hover { border-color: #fff; } }
.tile-open {
    position: absolute; top: 10px; right: 10px; width: 28px; height: 28px;
    display: grid; place-items: center; color: var(--muted);
    border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
    pointer-events: none;
}
.tile-open .icon { width: 14px; height: 14px; }
.is-click:hover .tile-open { color: var(--ink); border-color: var(--ink); }

/* leopard-spot texture for the blue hero blocks (the one decorative flourish) */
.spots { isolation: isolate; overflow: hidden; }
.spots::after {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
    background:
        radial-gradient(ellipse 9px 6px at 18% 30%, transparent 55%, rgba(255,255,255,.14) 58% 92%, transparent 96%),
        radial-gradient(ellipse 7px 9px at 68% 62%, transparent 50%, rgba(255,255,255,.12) 55% 90%, transparent 95%),
        radial-gradient(ellipse 5px 4px at 44% 84%, rgba(255,255,255,.12) 0 90%, transparent 95%),
        radial-gradient(ellipse 4px 5px at 88% 16%, rgba(255,255,255,.1) 0 90%, transparent 95%);
    background-size: 74px 62px, 96px 80px, 58px 66px, 84px 72px;
    -webkit-mask-image: linear-gradient(105deg, transparent 35%, #000 100%);
            mask-image: linear-gradient(105deg, transparent 35%, #000 100%);
}

/* ---------- small parts ---------- */
.big-num { font: 800 clamp(40px, 9vw, 64px)/.85 var(--f-display); font-variant-numeric: tabular-nums; }
.stat { display: grid; gap: 6px; padding-top: 10px; border-top: 3px solid var(--blue); }
.stat b { font: 800 40px/.85 var(--f-display); font-variant-numeric: tabular-nums; }
.stat span { font: 700 11px/1.2 var(--f-display); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.stat--red { border-top-color: var(--red); }
.stat--ink { border-top-color: var(--ink); }
.stat--green { border-top-color: var(--win); }
.stat--scored { border-top-color: var(--scored); }
.stat--gold { border-top-color: var(--gold); }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 14px; }

.avatar, .crest { flex: none; object-fit: cover; background: var(--surface-2); }
.avatar { width: 40px; height: 40px; border-radius: var(--r-sm); object-position: 50% 20%; }
.crest { width: 32px; height: 32px; border-radius: var(--r-sm); object-fit: contain; background: #fff; }
.is-initials {
    display: inline-grid; place-items: center;
    background: var(--blue-tint); color: var(--blue);
    font: 800 15px/1 var(--f-display); letter-spacing: .04em;
}
html.dark .is-initials { color: #9db8ff; }
.crest.is-initials { background: var(--surface-2); color: var(--muted); }

.res {
    display: inline-grid; place-items: center; flex: none;
    width: 24px; height: 24px; border-radius: 3px;
    font: 800 14px/1 var(--f-display); color: #fff;
}
.res.win { background: var(--win); } .res.draw { background: var(--draw); } .res.loss { background: var(--red); }
html.dark .res { color: #06101f; }
.form-strip { display: flex; gap: 4px; padding-bottom: 6px; }
/* newest result is first: underline it in its own result colour so the order is clear */
.form-strip .res:first-child { position: relative; }
.form-strip .res:first-child::after { content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 3px; border-radius: 2px; background: inherit; }

.chip {
    display: inline-flex; align-items: center; gap: 6px;
    font: 700 12px/1 var(--f-display); letter-spacing: .1em; text-transform: uppercase;
    padding: 5px 8px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); white-space: nowrap;
}
.chip--blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip--red { background: var(--red-tint); border-color: transparent; color: var(--red); }
.chip--ink { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.score {
    display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 58px;
    font: 800 22px/1 var(--f-display); font-variant-numeric: tabular-nums;
    padding: 6px 8px; border-radius: 3px;
    background: var(--ink); color: var(--bg);
}
.score.win { background: var(--win); color: #fff; } .score.loss { background: var(--red); color: #fff; } .score.draw { background: var(--draw); color: #fff; }
html.dark .score.win, html.dark .score.loss, html.dark .score.draw { color: #06101f; }
.score.upcoming { background: transparent; color: var(--muted); border: 1px solid var(--line); font-size: 16px; letter-spacing: .08em; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 42px; padding: 0 16px;
    font: 700 15px/1 var(--f-display); letter-spacing: .1em; text-transform: uppercase; white-space: nowrap;
    background: var(--blue); color: #fff; border: 1px solid var(--blue); border-radius: var(--r-sm);
    transition: transform var(--t-quick), background-color var(--t-quick), border-color var(--t-quick);
}
.btn:hover { background: var(--blue-deep); border-color: var(--blue-deep); }
html.dark .btn:hover { background: #4a7bff; border-color: #4a7bff; }
.btn:active { transform: scale(.97); }
.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover, html.dark .btn--ghost:hover { background: var(--surface-2); border-color: var(--ink); }
.btn--danger { background: var(--red); border-color: var(--red); }
html.dark .btn--danger { color: #1a0508; }
.btn--sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn--block { width: 100%; }

/* segmented switch */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; }
.seg button, .seg a {
    padding: 8px 12px; min-height: 36px;
    font: 700 13px/1 var(--f-display); letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
    display: inline-flex; align-items: center;
}
.seg button + button, .seg a + a { border-left: 1px solid var(--line-strong); }
.seg .is-on, .seg .is-active, .seg [aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* tabs */
.tabs { display: flex; gap: 4px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-width: none; box-shadow: inset 0 -1px 0 var(--line); margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter); }
.tabs::-webkit-scrollbar { display: none; }
.tab {
    flex: none; padding: 12px 12px 10px;
    font: 700 16px/1 var(--f-display); letter-spacing: .08em; text-transform: uppercase;
    color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; cursor: pointer;
    transition: color var(--t-quick);
}
.tab:hover { color: var(--ink); }
.tab.is-active, .tab.active, .tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--blue); }
.tab .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--red); margin-left: 6px; vertical-align: 2px; }

/* ranked bars (leaderboards) */
.rank { display: grid; gap: 10px; }
.rank-row { display: grid; grid-template-columns: 22px 32px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.rank-row .pos { font: 700 14px/1 var(--f-display); color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.rank-row .avatar { width: 32px; height: 32px; }
.rank-row .who { min-width: 0; display: grid; gap: 5px; }
.rank-row .who span { font-weight: 600; font-size: 14px; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .track { height: 5px; background: var(--surface-2); border-radius: 1px; overflow: hidden; }
.rank-row .track i { display: block; height: 100%; background: var(--blue); transform-origin: left; animation: grow var(--t-move) var(--ease-out) both; }
.rank-row .val { font: 800 24px/1 var(--f-display); font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }
.rank-row:first-child .val { color: var(--blue); }
html.dark .rank-row:first-child .val { color: #86a8ff; }
.rank--scored .track i { background: var(--scored); }
.rank--scored .rank-row:first-child .val, html.dark .rank--scored .rank-row:first-child .val { color: var(--scored); }
a.rank-row:hover .who span { text-decoration: underline; text-underline-offset: 3px; }
@keyframes grow { from { transform: scaleX(0); } }

/* key / value list */
.kv { display: grid; }
.kv > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 9px 0; border-top: 1px solid var(--line); }
.kv > div:first-child { border-top: 0; }
.kv dt { color: var(--muted); font-size: 14px; }
.kv dd { font-weight: 600; text-align: right; }
.kv dd.num { font-size: 20px; }

/* data table */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); -webkit-overflow-scrolling: touch; }
table.data { font-size: 14px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 10px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data th {
    position: sticky; top: 0;
    font: 700 12px/1.2 var(--f-display); letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
    background: var(--surface-2); user-select: none;
}
table.data th:first-child, table.data td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; }
table.data th:first-child { background: var(--surface-2); z-index: 2; }
table.data th[data-sort], table.data th[onclick], table.data th.sortable { cursor: pointer; }
table.data th[data-sort]:hover, table.data th[onclick]:hover, table.data th.sortable:hover { color: var(--ink); }
table.data th[aria-sort] { color: var(--ink); box-shadow: inset 0 -3px 0 var(--blue); }
table.data th[aria-sort="ascending"]::after { content: " \25B2"; font-size: 9px; }
table.data th[aria-sort="descending"]::after { content: " \25BC"; font-size: 9px; }
table.data td.strong, table.data td:first-child { font-weight: 600; }
@media (hover: hover) { table.data tbody tr:hover td { background: var(--surface-2); } }
table.data td .cellbar--scored { background: var(--scored); }
table.data td .cellbar { display: inline-block; height: 4px; background: var(--blue); border-radius: 1px; vertical-align: middle; margin-left: 8px; opacity: .85; }
.sortIcon { font-size: 9px; margin-left: 3px; }

/* phones: tighter tables so more fits on screen */
@media (max-width: 699px) {
    table.data { font-size: 12.5px; }
    table.data th, table.data td { padding: 7px 8px; }
    table.data th { font-size: 10.5px; letter-spacing: .06em; }
    table.data td .cellbar { display: none; }
    table.data td:first-child { white-space: normal; max-width: 34vw; min-width: 96px; line-height: 1.25; overflow-wrap: anywhere; }
}

/* forms */
.field { display: grid; gap: 6px; }
.field > label, .v2 .form-group > label, .v2 .training-form-group > label { font: 700 13px/1.2 var(--f-display); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.v2 input[type="text"], .v2 input[type="password"], .v2 input[type="number"], .v2 input[type="search"],
.v2 input[type="datetime-local"], .v2 select, .v2 textarea {
    width: 100%; min-height: 44px; padding: 10px 12px;
    font: 500 16px/1.3 var(--f-body);
    background: var(--surface); color: var(--ink);
    border: 1px solid var(--line-strong); border-radius: var(--r-sm);
    transition: border-color var(--t-quick), box-shadow var(--t-quick);
}
.v2 textarea { min-height: 120px; resize: vertical; }
.v2 select[multiple] { min-height: 260px; padding: 4px; }
.v2 select[multiple] option { padding: 8px 10px; border-radius: 3px; }
.v2 input:focus, .v2 select:focus, .v2 textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-tint); }
.v2 input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--blue); }
.v2 input[type="range"] { accent-color: var(--blue); }

.alert, .v2 .success-message, .v2 .error-message, .v2 p.success, .v2 p.error {
    padding: 12px 14px; border-radius: var(--r-sm); font-weight: 600; font-size: 14px;
    border: 1px solid transparent; border-left-width: 4px;
}
.alert.success, .v2 .success-message, .v2 p.success { background: var(--win-tint); color: var(--win); border-color: var(--win); }
.alert.error, .v2 .error-message, .v2 p.error { background: var(--red-tint); color: var(--red); border-color: var(--red); }

.empty { padding: 28px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--r); font-size: 14px; }

/* ---------- pop-out sheet ---------- */
dialog.sheet { border: 0; padding: 0; color: var(--ink); max-width: 100%; }
dialog.sheet::backdrop { background: var(--backdrop); animation: fade var(--t-move) ease both; }
dialog.sheet {
    background: var(--surface);
    width: min(100% - 32px, 560px); max-height: 86vh; max-height: min(86dvh, 780px);
    border-radius: 8px; box-shadow: var(--shadow-pop);
    flex-direction: column; overflow: hidden;
}
dialog.sheet[open] { display: flex; animation: pop-in var(--t-move) var(--ease-out) both; }
dialog.sheet.is-wide { width: min(100% - 32px, 920px); }
dialog.sheet.is-closing { animation: pop-out 160ms ease-in both; }
dialog.sheet.is-closing::backdrop { animation: fade 160ms ease-in reverse both; }
.sheet-grab { display: none; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 16px 14px; border-bottom: 1px solid var(--line); flex: none; }
.sheet-titles { min-width: 0; display: grid; gap: 6px; }
.sheet-titles h2 { font-size: 28px; overflow-wrap: anywhere; }
.sheet-titles .eyebrow:empty { display: none; }
.sheet-body { padding: 16px; overflow-y: auto; overscroll-behavior: contain; display: grid; gap: 16px; align-content: start; }
.sheet-body > * { min-width: 0; }
.sheet-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sheet-actions .btn { flex: 1 1 auto; }

@media (max-width: 699px) {
    dialog.sheet, dialog.sheet.is-wide {
        width: 100%; margin: auto 0 0; max-height: 88vh; max-height: 90dvh;
        border-radius: 12px 12px 0 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    dialog.sheet[open] { animation: sheet-up 360ms var(--ease-sheet) both; }
    dialog.sheet.is-closing { animation: sheet-down 200ms ease-in both; }
    .sheet-grab { display: grid; place-items: center; height: 18px; flex: none; touch-action: none; cursor: grab; }
    .sheet-grab i { width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); }
    .sheet-head { padding-top: 4px; touch-action: none; }
    html[data-nav="top"] dialog.sheet.is-menu { margin: 0 0 auto; border-radius: 0 0 12px 12px; padding-top: env(safe-area-inset-top, 0px); padding-bottom: 0; }
    html[data-nav="top"] dialog.sheet.is-menu[open] { animation-name: sheet-drop; }
    html[data-nav="top"] dialog.sheet.is-menu.is-closing { animation-name: sheet-lift; }
    html[data-nav="top"] dialog.sheet.is-menu .sheet-grab { display: none; }
    html[data-nav="top"] dialog.sheet.is-menu .sheet-head { padding-top: 14px; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(.975); } }
@keyframes pop-out { to { opacity: 0; transform: translateY(6px) scale(.985); } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(100%); } }
@keyframes sheet-drop { from { transform: translateY(-100%); } }
@keyframes sheet-lift { to { transform: translateY(-100%); } }

/* menu inside the sheet */
.menu-list { display: grid; }
.menu-list a {
    display: grid; grid-template-columns: 24px 1fr 18px; align-items: center; gap: 12px;
    padding: 14px 4px; border-bottom: 1px solid var(--line);
    font: 700 20px/1 var(--f-display); letter-spacing: .06em; text-transform: uppercase;
}
.menu-list a .icon:last-child { color: var(--muted); width: 16px; height: 16px; }
.menu-list a.is-active { color: var(--blue); }
html.dark .menu-list a.is-active { color: #86a8ff; }
.menu-prefs { display: grid; gap: 12px; }
.pref { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pref > span { font-weight: 600; font-size: 14px; }
.menu-logout { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 600; font-size: 14px; padding: 6px 0; }
.menu-logout:hover { color: var(--red); }

/* ---------- toasts ---------- */
.toasts { position: fixed; z-index: 90; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; pointer-events: none; }
html[data-nav="bottom"] .toasts { bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 700px) { html[data-nav="bottom"] .toasts { bottom: 16px; } }
.toast { background: var(--ink); color: var(--bg); padding: 11px 14px; border-radius: var(--r-sm); font-weight: 600; font-size: 14px; box-shadow: var(--shadow-pop); animation: pop-in var(--t-move) var(--ease-out) both; max-width: min(360px, calc(100vw - 32px)); }
.toast.is-leaving { animation: pop-out 180ms ease-in both; }

/* classic / preview strip (only shown to accounts that can switch) */
.ui-switch { font-size: 12.5px; color: var(--muted); text-align: center; padding: 0 var(--gutter) 28px; }
.ui-switch a { color: var(--blue); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
html.dark .ui-switch a { color: #86a8ff; }

/* ---------- match rows + match pop-out (used on several pages) ---------- */
.crest--lg { width: 64px; height: 64px; border-radius: var(--r); }
.crest--lg.is-initials { font-size: 24px; }
/* fixture / result rows */
.fixtures { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.fixture { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px 14px; border-top: 1px solid var(--line); }
.fixture:first-child { border-top: 0; }
.fixture[hidden] + .fixture { border-top: 1px solid var(--line); }
@media (hover: hover) { .fixture:hover { background: var(--surface-2); } }
.fx-date { display: grid; justify-items: center; gap: 2px; padding-right: 12px; border-right: 1px solid var(--line); }
.fx-date b { font-size: 24px; line-height: .9; }
.fx-date span { font: 700 11px/1 var(--f-display); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.fx-teams { display: grid; gap: 7px; min-width: 0; }
.fx-team { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.fx-team .crest { width: 24px; height: 24px; border-radius: 3px; }
.fx-team .crest.is-initials { font-size: 11px; }
.fx-name { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.2; overflow-wrap: anywhere; font-size: 15px; color: var(--muted); }
.fx-team.is-us .fx-name { color: var(--ink); font-weight: 700; }
.fx-team b { font-size: 22px; line-height: 1; min-width: 1.4ch; text-align: right; color: var(--muted); }
.fx-team.is-us b { color: var(--ink); }
.fx-side { display: grid; justify-items: end; gap: 6px; padding-left: 12px; border-left: 1px solid var(--line); min-width: 64px; }
.fx-comp { font: 700 11px/1 var(--f-display); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-ko { font-size: 20px; }
@media (min-width: 1000px) {
    .fixtures.is-2col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-bottom: 0; }
    .fixtures.is-2col .fixture, .fixtures.is-2col .fixture[hidden] + .fixture { border-top: 0; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); margin-right: -1px; }
}
.season-extra { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.season-extra .stat b { font-size: 30px; }

/* match pop-out */
.scoreboard { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 12px; align-items: start; }
.sb-team { display: grid; justify-items: center; gap: 8px; text-align: center; min-width: 0; }
.sb-team span { font: 700 18px/1 var(--f-display); text-transform: uppercase; color: var(--muted); overflow-wrap: anywhere; text-wrap: balance; max-width: 100%; }
.sb-team.is-us span { color: var(--ink); }
.sb-score { display: flex; align-items: center; gap: 8px; padding-top: 10px; }
.sb-score b { font-size: 54px; line-height: .85; font-weight: 800; }
.sb-score i { font-style: normal; color: var(--muted); font-size: 28px; }
.sb-score .sb-vs { font-size: 34px; color: var(--blue); }
html.dark .sb-score .sb-vs { color: #86a8ff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip--wrap { white-space: normal; text-align: left; line-height: 1.2; }

.timeline { display: grid; border-top: 1px solid var(--line); }
.timeline li { display: grid; grid-template-columns: 38px 10px minmax(0, 1fr); align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.tl-min { font-size: 18px; color: var(--muted); text-align: right; }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--scored); }
.is-them .tl-dot { background: transparent; border: 2px solid var(--conceded); }
.tl-text { display: grid; min-width: 0; }
.tl-text b { font-weight: 600; overflow-wrap: anywhere; }
.tl-text small { color: var(--muted); font-size: 12.5px; }
.is-them .tl-text b { color: var(--muted); font-weight: 500; }
.note { display: grid; gap: 6px; padding: 12px; background: var(--surface-2); border-radius: var(--r); }
.note p { font-size: 14px; }

html.is-locked, html.is-locked body { overflow: hidden; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* [data-tab-panel] panels */
[data-tab-panel]:not(.is-active) { display: none; }

@media (prefers-reduced-motion: reduce) {
    .v2 *, .v2 *::before, .v2 *::after, dialog::backdrop { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
