/* ==========================================================================
   Football Leagues Platform — Design System
   All colors come from CSS variables injected per active theme.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: hidden; }
body {
    margin: 0;
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    background: var(--c-bg);
    color: var(--c-text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    max-width: 100%;
}
img { max-width: 100%; display: block; height: auto; }

/* Prevent long words / URLs from forcing horizontal overflow */
.card, .table-wrap, .detail-list, td, th, p, h1, h2, h3, h4 { overflow-wrap: anywhere; word-break: break-word; }

/* Responsive two-column layout: collapses to one column on small screens */
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
.cols-2.ratio { grid-template-columns: 1.15fr .85fr; }
@media (max-width: 820px) { .cols-2, .cols-2.ratio { grid-template-columns: 1fr; } }
a { color: var(--c-link); text-decoration: none; transition: color .18s ease; }
a:hover { color: var(--c-link-hover); }
h1,h2,h3,h4,h5 { line-height: 1.18; margin: 0 0 .5em; font-weight: 800; letter-spacing: -.01em; }
p { margin: 0 0 1rem; }
:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 2px; border-radius: 4px; }

.container { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: clamp(16px, 4vw, 32px); }
.muted { color: var(--c-text-muted); }
.subtle { color: var(--c-text-subtle); }
.text-center { text-align: center; }
.mt-0{margin-top:0}.mt-1{margin-top:.5rem}.mt-2{margin-top:1rem}.mt-3{margin-top:1.5rem}.mt-4{margin-top:2.5rem}
.mb-0{margin-bottom:0}.mb-2{margin-bottom:1rem}.mb-3{margin-bottom:1.5rem}
.flex{display:flex}.items-center{align-items:center}.justify-between{justify-content:space-between}
.gap-1{gap:.5rem}.gap-2{gap:1rem}.gap-3{gap:1.5rem}.wrap{flex-wrap:wrap}
.grid{display:grid;gap:1.25rem}
.hidden{display:none !important}

/* ---- Buttons ------------------------------------------------------------- */
.btn {
    --btn-bg: var(--c-primary);
    --btn-fg: var(--c-on-primary);
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .72rem 1.35rem; border-radius: 12px; border: 1px solid transparent;
    background: var(--btn-bg); color: var(--btn-fg);
    font-weight: 700; font-size: .95rem; cursor: pointer; line-height: 1;
    transition: transform .12s ease, box-shadow .18s ease, background .18s ease, filter .18s ease;
    box-shadow: 0 6px 18px rgba(var(--c-primary-rgb), .22);
    text-decoration: none; white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); background: var(--c-primary-hover); box-shadow: 0 10px 26px rgba(var(--c-primary-rgb), .32); }
.btn:active { transform: translateY(0); }
.btn-accent { --btn-bg: var(--c-accent); --btn-fg: var(--c-on-accent); box-shadow: 0 6px 18px rgba(var(--c-accent-rgb), .22); }
.btn-accent:hover { background: var(--c-accent-hover); }
.btn-ghost {
    background: transparent; color: var(--c-text); border-color: var(--c-border-strong); box-shadow: none;
}
.btn-ghost:hover { background: var(--c-surface-2); transform: translateY(-2px); box-shadow: none; }
.btn-danger { --btn-bg: var(--c-danger); --btn-fg: #fff; box-shadow: none; }
.btn-sm { padding: .5rem .9rem; font-size: .85rem; border-radius: 9px; }
.btn-lg { padding: .95rem 1.9rem; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ---- Cards --------------------------------------------------------------- */
.card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 18px;
    padding: 1.5rem;
    color: var(--c-text-on-surface);
    box-shadow: 0 2px 6px rgba(var(--c-shadow-rgb), .06);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card-hover:hover { transform: translateY(-4px); box-shadow: 0 16px 40px rgba(var(--c-shadow-rgb), .16); border-color: var(--c-border-strong); }
.card-pad-lg { padding: 2rem; }

/* ---- Badges & pills ------------------------------------------------------ */
.badge {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .28rem .7rem; border-radius: 999px; font-size: .74rem; font-weight: 800;
    letter-spacing: .03em; text-transform: uppercase;
    background: rgba(var(--c-primary-rgb), .16); color: var(--c-link);
    border: 1px solid rgba(var(--c-primary-rgb), .30);
}
.badge-accent { background: rgba(var(--c-accent-rgb), .16); color: var(--c-link-hover); border-color: rgba(var(--c-accent-rgb), .30); }
.badge-success { background: color-mix(in srgb, var(--c-success) 18%, transparent); color: var(--c-success); border-color: color-mix(in srgb, var(--c-success) 40%, transparent); }
.badge-warning { background: color-mix(in srgb, var(--c-warning) 18%, transparent); color: var(--c-warning); border-color: color-mix(in srgb, var(--c-warning) 40%, transparent); }
.badge-danger  { background: color-mix(in srgb, var(--c-danger) 18%, transparent);  color: var(--c-danger);  border-color: color-mix(in srgb, var(--c-danger) 40%, transparent); }
.badge-muted   { background: var(--c-surface-2); color: var(--c-text-muted); border-color: var(--c-border); }

/* card colored dots for cards e.g. yellow/red */
.dot { width: 12px; height: 16px; border-radius: 3px; display: inline-block; }
.dot-yellow { background: #F2C500; }
.dot-red { background: #E53935; }

/* ---- Forms --------------------------------------------------------------- */
.field { margin-bottom: 1.15rem; }
.field label { display: block; font-weight: 700; font-size: .88rem; margin-bottom: .4rem; color: var(--c-text); }
.field .help { font-size: .78rem; color: var(--c-text-muted); margin-top: .35rem; }
.input, .select, .textarea {
    width: 100%; padding: .72rem .9rem; border-radius: 11px;
    border: 1px solid var(--c-input-border);
    background: var(--c-input-bg); color: var(--c-input-text);
    font-size: .95rem; font-family: inherit; transition: border-color .16s ease, box-shadow .16s ease;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none; border-color: var(--c-accent);
    box-shadow: 0 0 0 3px rgba(var(--c-accent-rgb), .28);
}
.textarea { min-height: 120px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--c-text-subtle); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
select.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 2.2rem; }

/* ---- Tables -------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: 16px; border: 1px solid var(--c-border); background: var(--c-surface); }
table.data { width: 100%; border-collapse: collapse; min-width: 560px; }
table.data th, table.data td { padding: .85rem 1rem; text-align: left; white-space: nowrap; }
table.data thead th {
    background: var(--c-surface-2); color: var(--c-text); font-size: .74rem;
    text-transform: uppercase; letter-spacing: .05em; font-weight: 800;
    border-bottom: 2px solid var(--c-border-strong);
    position: sticky; top: 0;
}
table.data tbody tr { border-bottom: 1px solid var(--c-border); transition: background .14s ease; }
table.data tbody tr:hover { background: var(--c-surface-2); }
table.data tbody tr:last-child { border-bottom: none; }
table.data td.num, table.data th.num { text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data thead th { white-space: nowrap; }
table.data td.pts { font-weight: 800; color: var(--c-link); }

/* Standings position accents */
.standings tbody tr td:first-child { font-weight: 800; }
.pos-badge { display:inline-flex; width: 26px; height: 26px; align-items:center; justify-content:center; border-radius: 8px; font-weight: 800; font-size: .82rem; background: var(--c-surface-2); }
.pos-1 .pos-badge, .zone-champion .pos-badge { background: var(--c-accent); color: var(--c-on-accent); }
.zone-final td:first-child { box-shadow: inset 4px 0 0 var(--c-primary); }

/* ============ STANDINGS TABLE — frozen column (rebuilt, NO position:sticky) = *
 * Two real tables side by side. LEFT (POS + escudo + equipo) is fixed and never
 * scrolls. RIGHT (PJ PG PE PP GF GC DG PTS) scrolls horizontally on its own.
 * Row heights are locked equal so both tables line up. This works on EVERY
 * browser/mobile because it does not rely on position:sticky.                  */
.postable { display: flex; align-items: stretch; border: 1px solid var(--c-border);
    border-radius: 16px; overflow: hidden; background: var(--c-surface); }
.postable table { border-collapse: collapse; }
.postable th, .postable td { box-sizing: border-box; white-space: nowrap; vertical-align: middle; text-align: left; }
.postable thead th { height: 48px; background: var(--c-surface-2); color: var(--c-text);
    font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 800;
    border-bottom: 2px solid var(--c-border-strong); }
.postable tbody td { height: 56px; border-bottom: 1px solid var(--c-border); }
.postable tbody tr:last-child td { border-bottom: none; }

/* Left, fixed block ------------------------------------------------------- */
.postable-fixed { flex: 0 0 auto; z-index: 1; box-shadow: 8px 0 14px -9px rgba(var(--c-shadow-rgb), .55); }
.postable-fixed table { width: auto; }
.postable-fixed .c-pos { width: 46px; min-width: 46px; text-align: center; padding: 0 .35rem; font-weight: 800; }
.postable-fixed .c-team { padding: 0 .8rem 0 .25rem; }
.postable-fixed .c-team .team-logo, .postable-fixed .c-team img {
    width: 30px; height: 30px; vertical-align: middle; margin-right: .55rem; flex: 0 0 auto; }
.pt-name { display: inline-block; vertical-align: middle; font-weight: 800;
    max-width: clamp(150px, 46vw, 340px);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Right, scrollable block ------------------------------------------------- */
.postable-scroll { flex: 1 1 auto; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.postable-scroll table { width: 100%; min-width: max-content; }
.postable-scroll th, .postable-scroll td { width: 46px; min-width: 46px; text-align: center;
    padding: 0 .55rem; font-variant-numeric: tabular-nums; }
.postable-scroll td.pts, .postable-scroll thead th:last-child { color: var(--c-link); font-weight: 800; }

@media (max-width: 559px) {
    .postable tbody td { height: 52px; }
    .postable-fixed .c-team .team-logo, .postable-fixed .c-team img { width: 26px; height: 26px; margin-right: .45rem; }
    .pt-name { max-width: clamp(130px, 44vw, 230px); font-size: .95rem; }
    .postable-scroll th, .postable-scroll td { width: 40px; min-width: 40px; padding: 0 .45rem; font-size: .93rem; }
}

/* ---- PWA install invitation ---------------------------------------------- */
.pwa-invite { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 200; animation: fadeInUp .35s ease; }
.pwa-invite-in { display: flex; align-items: center; gap: .8rem; max-width: 560px; margin: 0 auto;
    background: var(--c-elevated); border: 1px solid var(--c-border-strong); border-radius: 16px;
    padding: .8rem 1rem; box-shadow: 0 18px 46px rgba(var(--c-shadow-rgb), .5); }
.pwa-ico { font-size: 1.7rem; flex: 0 0 auto; }
.pwa-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pwa-text strong { font-size: .98rem; }
.pwa-text span { font-size: .82rem; color: var(--c-text-muted); line-height: 1.35; }
.pwa-actions { display: flex; align-items: center; gap: .35rem; flex: 0 0 auto; }
.pwa-close { background: none; border: none; color: var(--c-text-muted); font-size: 1.05rem; cursor: pointer; padding: .2rem .45rem; border-radius: 8px; }
.pwa-close:hover { background: var(--c-surface-2); }

/* ---- Breadcrumbs --------------------------------------------------------- */
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; font-size: .85rem; color: var(--c-text-muted); margin-bottom: 1rem; }
.crumbs a { color: var(--c-link); font-weight: 600; }
.crumbs a:hover { text-decoration: underline; }
.crumbs span { color: var(--c-text-subtle); }

/* ---- Tournament cards (home landing) ------------------------------------- */
.tourney-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1.25rem; }
.tc-meta { display: flex; flex-wrap: wrap; gap: .4rem; margin: .1rem 0 .5rem; }
.tourney-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.tc-media { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--c-surface-2); }
.tc-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .45s ease; }
.tourney-card:hover .tc-media img { transform: scale(1.06); }
.tc-badge { position: absolute; top: .6rem; right: .6rem; background: rgba(0,0,0,.62); color: #fff; font-size: .74rem; font-weight: 800; padding: .28rem .65rem; border-radius: 999px; backdrop-filter: blur(4px); }
.tc-body { padding: 1.05rem 1.15rem 1.2rem; display: flex; flex-direction: column; flex: 1; }
.tc-title { margin: 0 0 .35rem; font-size: 1.18rem; }
.tc-desc { color: var(--c-text-muted); font-size: .9rem; line-height: 1.5; margin: 0; flex: 1; }
.rich :first-child { margin-top: 0; } .rich :last-child { margin-bottom: 0; }

/* ---- Team cell ----------------------------------------------------------- */
.team-cell { display: flex; align-items: center; gap: .65rem; font-weight: 700; white-space: nowrap; }
.team-cell img, .team-cell .team-logo, .team-cell .avatar { flex: 0 0 auto; }
.team-logo, .avatar {
    width: 34px; height: 34px; border-radius: 9px; object-fit: cover;
    background: var(--c-surface-2); border: 1px solid var(--c-border);
    display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: .8rem; color: var(--c-text-muted);
    flex: 0 0 auto;
}
.avatar-round { border-radius: 50%; }
.avatar-lg { width: 56px; height: 56px; }

/* ---- Public header ------------------------------------------------------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--c-bg) 86%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--c-border);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 900; font-size: 1.15rem; color: var(--c-text); letter-spacing: -.02em; }
.brand .brand-mark { width: 38px; height: 38px; border-radius: 11px; background: var(--c-primary); color: var(--c-on-primary); display: grid; place-items: center; font-size: 1.2rem; }
.nav { display: flex; align-items: center; gap: .35rem; }
.nav a { padding: .5rem .9rem; border-radius: 10px; font-weight: 600; color: var(--c-text); font-size: .93rem; }
.nav a.nav-link { display: inline-flex; align-items: center; gap: .5rem; }
.nav .nav-ico { display: inline-flex; opacity: .85; }
.nav a:hover, .nav a.active { background: var(--c-surface-2); color: var(--c-link); }
.nav a.active .nav-ico { opacity: 1; }
.nav-toggle { display: none; background: var(--c-surface-2); border: 1px solid var(--c-border); color: var(--c-text); width: 44px; height: 44px; border-radius: 11px; cursor: pointer; font-size: 1.3rem; }

/* ---- Hero ---------------------------------------------------------------- */
.hero {
    position: relative; overflow: hidden; border-radius: 0;
    min-height: clamp(320px, 46vw, 520px); display: flex; align-items: flex-end;
    background: var(--c-surface-2);
}
/* Banner-only tournament header (image only, name goes below it). */
.banner-head { position: relative; width: 100%; aspect-ratio: 2172 / 724; max-height: 420px; overflow: hidden; background: var(--c-surface-2); }
.banner-head > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.hero-overlay { position: absolute; inset: 0; z-index: 1; }
.hero-inner { position: relative; z-index: 2; width: 100%; padding: clamp(24px, 5vw, 56px) 0; }
.hero-inner .container { display: flex; flex-direction: column; gap: 1rem; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.6rem); margin: 0; color: #fff; text-shadow: 0 2px 24px rgba(0,0,0,.5); }
.hero .hero-sub { font-size: clamp(1rem, 2.2vw, 1.3rem); max-width: 640px; color: rgba(255,255,255,.92); text-shadow: 0 1px 12px rgba(0,0,0,.5); }
.hero-league-logo { width: 84px; height: 84px; border-radius: 18px; object-fit: cover; border: 3px solid rgba(255,255,255,.7); background: #fff; }
.hero-actions { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: .5rem; }
.hero-pattern { /* subtle sport pattern when no banner */
    position: absolute; inset: 0; z-index: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(var(--c-primary-rgb), .18), transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(var(--c-accent-rgb), .18), transparent 42%),
        var(--c-bg);
}

/* ---- Section headers ----------------------------------------------------- */
.section { padding: clamp(36px, 6vw, 72px) 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; flex-wrap: wrap; }
.section-head h2 { font-size: clamp(1.5rem, 3.4vw, 2.2rem); margin: 0; }
.eyebrow { display: inline-block; font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--c-link); margin-bottom: .4rem; }

/* ---- League cards -------------------------------------------------------- */
.league-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.league-card { position: relative; overflow: hidden; padding: 0; border-radius: 18px; }
.league-card .lc-banner { height: 130px; background: var(--c-surface-2); position: relative; }
.league-card .lc-banner img { width: 100%; height: 100%; object-fit: cover; }
.league-card .lc-body { padding: 1.25rem; display: flex; gap: .85rem; align-items: center; }
.league-card .lc-logo { width: 54px; height: 54px; border-radius: 13px; object-fit: cover; margin-top: -42px; border: 3px solid var(--c-surface); background: var(--c-surface-2); position: relative; z-index: 2; }

/* ---- Match / fixture cards ----------------------------------------------- */
.match-card { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; padding: 1.1rem 1.25rem; }
.match-team { display: flex; align-items: center; gap: .6rem; font-weight: 700; }
.match-team.away { flex-direction: row-reverse; text-align: right; }
.match-score { font-size: 1.4rem; font-weight: 900; min-width: 68px; text-align: center; font-variant-numeric: tabular-nums; }
.match-score .vs { font-size: .85rem; color: var(--c-text-muted); font-weight: 700; }
.match-meta { text-align: center; font-size: .8rem; color: var(--c-text-muted); margin-top: .3rem; }

/* ---- Tabs ---------------------------------------------------------------- */
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--c-border); margin-bottom: 1.5rem; overflow-x: auto; }
.tab { padding: .7rem 1.1rem; border: none; background: none; color: var(--c-text-muted); font-weight: 700; cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; font-size: .95rem; transition: color .16s ease, border-color .16s ease; }
.tab:hover { color: var(--c-text); }
.tab.active { color: var(--c-link); border-bottom-color: var(--c-primary); }
.tab-panel { animation: fadeInUp .35s ease; }

/* ---- Footer -------------------------------------------------------------- */
.site-footer { background: var(--c-surface); border-top: 1px solid var(--c-border); margin-top: 3rem; padding: 2.5rem 0 1.5rem; color: var(--c-text-muted); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.site-footer h4 { color: var(--c-text); font-size: .9rem; text-transform: uppercase; letter-spacing: .05em; }
.site-footer a { color: var(--c-text-muted); display: block; padding: .2rem 0; }
.site-footer a:hover { color: var(--c-link); }
.footer-bottom { border-top: 1px solid var(--c-border); padding-top: 1.25rem; font-size: .85rem; text-align: center; }

/* ---- Fixtures (friendly calendar) ---------------------------------------- */
.jornada { padding: 0; overflow: hidden; }
.jornada-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 1.1rem; background: var(--c-surface-2); border-bottom: 1px solid var(--c-border); }
.jornada-head strong { font-size: 1rem; }
.jornada-head .muted { font-size: .82rem; }
.fixture { padding: .5rem 1.1rem; border-bottom: 1px solid var(--c-border); }
.fixture:last-child { border-bottom: none; }
.fx-row { display: flex; align-items: center; gap: .6rem; padding: .3rem 0; }
.fx-team { display: flex; align-items: center; gap: .6rem; min-width: 0; flex: 1; font-weight: 700; }
.fx-team .team-logo, .fx-team img { width: 30px; height: 30px; flex: 0 0 auto; }
.fx-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fx-win .fx-name { font-weight: 800; }
.fx-goals { font-weight: 900; font-size: 1.15rem; min-width: 1.6rem; text-align: center; font-variant-numeric: tabular-nums; color: var(--c-text); }
.fx-dash { color: var(--c-text-subtle); font-weight: 700; }
.fx-meta { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-top: .3rem; font-size: .78rem; color: var(--c-text-muted); }
.fx-meta .liga-acta-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; border: 1px solid var(--c-border); cursor: zoom-in; }

/* ---- Empty state --------------------------------------------------------- */
.empty-state { text-align: center; padding: clamp(40px, 8vw, 90px) 1rem; }
.empty-state .es-icon { font-size: 3.4rem; margin-bottom: 1rem; }
.empty-state h2 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
.empty-state p { max-width: 460px; margin: 0 auto 1.75rem; color: var(--c-text-muted); }

/* ---- Alerts / flashes ---------------------------------------------------- */
.alert { padding: .9rem 1.15rem; border-radius: 12px; margin-bottom: 1rem; font-weight: 600; border: 1px solid; display: flex; gap: .6rem; align-items: flex-start; }
.alert-success { background: color-mix(in srgb, var(--c-success) 14%, transparent); border-color: color-mix(in srgb, var(--c-success) 45%, transparent); color: var(--c-success); }
.alert-danger  { background: color-mix(in srgb, var(--c-danger) 14%, transparent);  border-color: color-mix(in srgb, var(--c-danger) 45%, transparent);  color: var(--c-danger); }
.alert-warning { background: color-mix(in srgb, var(--c-warning) 14%, transparent); border-color: color-mix(in srgb, var(--c-warning) 45%, transparent); color: var(--c-warning); }
.alert-info    { background: color-mix(in srgb, var(--c-info) 14%, transparent);    border-color: color-mix(in srgb, var(--c-info) 45%, transparent);    color: var(--c-info); }

/* ---- Modal --------------------------------------------------------------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 100; display: none; align-items: center; justify-content: center; padding: 1rem; backdrop-filter: blur(3px); }
.modal-backdrop.open { display: flex; animation: fadeIn .2s ease; }
.modal { background: var(--c-surface); color: var(--c-text-on-surface); border: 1px solid var(--c-border); border-radius: 18px; max-width: 560px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 30px 80px rgba(0,0,0,.4); animation: fadeInUp .28s ease; }
.modal-head { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--c-border); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 1.5rem; }
.modal-foot { padding: 1.15rem 1.5rem; border-top: 1px solid var(--c-border); display: flex; justify-content: flex-end; gap: .7rem; }
.modal-close { background: none; border: none; color: var(--c-text-muted); font-size: 1.6rem; cursor: pointer; line-height: 1; }

/* ---- Skeleton loaders ---------------------------------------------------- */
.skeleton { background: linear-gradient(90deg, var(--c-surface-2) 25%, var(--c-elevated) 37%, var(--c-surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ---- Stat tiles ---------------------------------------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1.1rem; }
.stat { padding: 1.4rem; border-radius: 16px; background: var(--c-surface); border: 1px solid var(--c-border); }
.stat .stat-num { font-size: 2.1rem; font-weight: 900; color: var(--c-link); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .stat-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--c-text-muted); font-weight: 700; }

/* ---- Animations ---------------------------------------------------------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
/* Content is visible by default; the reveal animation only applies when JS is
   active (html.js), so primary content is never stuck invisible. */
.reveal { opacity: 1; transform: none; }
html.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
html.js .reveal.in { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
    html.js .reveal { opacity: 1; transform: none; }
}

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 860px) {
    .footer-grid { grid-template-columns: 1fr; gap: 1.25rem; }
    .nav { display: none; }
    .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .nav.open { display: flex; position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; background: var(--c-surface); border-bottom: 1px solid var(--c-border); padding: .75rem; gap: .25rem; }
    .nav.open a { width: 100%; }
}
@media (max-width: 560px) {
    .match-card { grid-template-columns: 1fr auto 1fr; gap: .5rem; padding: .9rem; }
    .btn { width: auto; }
}