/* ========================================
   Pixel Series V2.1 — Design System & Utilities
   Supports dark/light/auto themes via data-theme attribute
   ======================================== */

/* Default: dark color scheme */
:root {
    color-scheme: dark;
    --mp-default: #fff;
}

/* ---- Theme Toggle Button ---- */
#theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-ps-surface, #1C1B1F);
    border: 1px solid var(--color-ps-border, #2A2A2E);
    color: var(--color-ps-muted, #7B7FA0);
    transition: color 0.2s, border-color 0.2s, background 0.2s;
    padding: 6px 10px;
    font: inherit;
    flex-shrink: 0;
    cursor: pointer;
}
#theme-toggle:hover {
    color: var(--color-ps-primary, #2C12D9);
    border-color: var(--color-ps-primary, #2C12D9);
}
#theme-toggle[data-tooltip] {
    position: relative;
}
#theme-toggle[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    padding: 5px 10px;
    background: var(--color-ps-elevated, #252429);
    color: var(--color-ps-dark, #fff);
    border: 1px solid var(--color-ps-border, #2A2A2E);
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -4px);
    transition: opacity 0.15s, transform 0.15s;
    z-index: 100;
}
#theme-toggle[data-tooltip]:hover::after {
    opacity: 1;
    transform: translate(-50%, 0);
}
.theme-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ---- Custom Cursor (dot <-> cross morph, GSAP-driven) ---- */
@media (pointer: fine) {
    html, html * {
        cursor: none !important;
    }
    /* Hide any legacy cursor markup left in older pages */
    #cursor-crosshair, #cursor-frame { display: none !important; }

    #cc-cursor {
        position: fixed;
        top: 0; left: 0;
        width: 35px; height: 35px;
        pointer-events: none;
        z-index: 10001;
        mix-blend-mode: difference;
        opacity: 0;
        will-change: transform, opacity;
    }
    #cc-cursor.is-visible { opacity: 1; transition: opacity 0.25s ease; }
    #cc-cursor .cc-dot,
    #cc-cursor .cc-cross,
    #cc-cursor .cc-pulse {
        position: absolute;
        inset: 0;
        width: 35px; height: 35px;
        display: block;
        overflow: visible;
    }
    #cc-cursor .cc-dot {
        will-change: transform, opacity;
    }
    #cc-cursor .cc-dot circle { fill: #fff; }
    #cc-cursor .cc-cross {
        will-change: transform, opacity;
    }
    /* Inverse of --color-ps-primary (#2C12D9) so mix-blend-mode: difference
       yields the primary color on white backgrounds, and a mint contrast
       on primary-colored backgrounds. */
    #cc-cursor .cc-cross .cc-arm { fill: #D3ED26; }
    #cc-cursor .cc-pulse {
        pointer-events: none;
        opacity: 0;
    }
    #cc-cursor .cc-pulse circle {
        fill: none;
        stroke: #fff;
        stroke-width: 1.5;
    }
}
@media (pointer: coarse) {
    #cc-cursor, #cursor-crosshair, #cursor-frame { display: none !important; }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #3A3A4E; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #4A35E0; }

/* ---- Body background with subtle radial accents ---- */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background-image:
        radial-gradient(ellipse 60% 50% at 10% 20%, rgba(44,18,217,0.06) 0%, transparent 60%),
        radial-gradient(ellipse 50% 40% at 90% 80%, rgba(44,18,217,0.05) 0%, transparent 60%);
}

/* ---- Diagonal stripe accents ---- */
.stripe-diagonal {
    background-image: repeating-linear-gradient(-45deg, #2C12D9 0, #2C12D9 6px, transparent 6px, transparent 22px);
}
.hero-stripe {
    position: absolute; top: -10%; right: -5%; width: 45%; height: 120%;
    background: #2C12D9; transform: skewX(-12deg); opacity: 0.10;
    pointer-events: none; border-radius: 0 0 0 80px;
}
.hero-stripe-bold {
    position: absolute; top: 15%; right: 8%; width: 4px; height: 70%;
    background: #2C12D9; transform: skewX(-12deg); opacity: 0.25; pointer-events: none;
}

/* ---- Pulse animation for live indicators ---- */
@keyframes pulse-green {
    0%   { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
    70%  { box-shadow: 0 0 0 8px rgba(34,197,94,0); }
    100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
.pulse-dot {
    display: inline-block; width: 10px; height: 10px;
    background: #22C55E; border-radius: 50%;
    animation: pulse-green 2s infinite; flex-shrink: 0;
}

/* ---- Section fade-in on scroll ---- */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(28px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-section { opacity: 0; transform: translateY(28px); }
.fade-section.visible { animation: fadeUp 0.7s cubic-bezier(0.22,1,0.36,1) forwards; }
.stagger-1 { animation-delay: 0.08s !important; }
.stagger-2 { animation-delay: 0.16s !important; }
.stagger-3 { animation-delay: 0.24s !important; }
.stagger-4 { animation-delay: 0.32s !important; }
.stagger-5 { animation-delay: 0.40s !important; }

/* ---- ELO Badges ---- */
.badge {
    padding: 2px 8px; border-radius: 0; font-size: 10px; font-weight: 900;
    color: #fff; text-transform: uppercase; letter-spacing: 1px;
    font-family: 'Chakra Petch', sans-serif; display: inline-block;
    line-height: 1.5; white-space: nowrap;
}
.b-bronze   { background: linear-gradient(135deg, #cd7f32, #8b5a2b); }
.b-silver   { background: linear-gradient(135deg, #b0bec5, #78909c); }
.b-gold     { background: linear-gradient(135deg, #f0c420, #c49b08); }
.b-platinum { background: linear-gradient(135deg, #b0cfe0, #6890a8); }
.b-diamond  { background: linear-gradient(135deg, #7c8cf8, #2C12D9); }
.b-master   { background: linear-gradient(135deg, #ff6b00, #d40000); animation: glowMaster 2s infinite alternate; }
@keyframes glowMaster {
    from { box-shadow: 0 0 4px rgba(255,107,0,0.6); }
    to   { box-shadow: 0 0 14px rgba(212,0,0,0.6); }
}

/* ---- Mobile nav transitions ---- */
.mobile-nav { max-height: 0; overflow: hidden; transition: max-height 0.35s cubic-bezier(0.4,0,0.2,1); }
.mobile-nav.open { max-height: 700px; transition: max-height 0.45s cubic-bezier(0.4,0,0.2,1); }

/* ---- Desktop dropdown transitions ---- */
.nav-dropdown-panel {
    opacity: 0; transform: translateY(-6px); pointer-events: none;
    transition: all 0.2s cubic-bezier(0.4,0,0.2,1); visibility: hidden;
}
.nav-dropdown::after {
    content: ''; position: absolute; top: 100%; left: 0; right: 0; height: 12px;
}
.nav-dropdown:hover .nav-dropdown-panel,
.nav-dropdown:focus-within .nav-dropdown-panel {
    opacity: 1; transform: translateY(0); pointer-events: auto; visibility: visible;
}

/* ---- KPI tabular numbers ---- */
.kpi-number { font-variant-numeric: tabular-nums; }

/* ---- Card hover micro-interaction ---- */
.card-hover {
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1), box-shadow 0.25s cubic-bezier(0.4,0,0.2,1);
}
.card-hover:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(44,18,217,0.15), 0 4px 12px rgba(0,0,0,0.4);
}

/* ---- Hero bottom divider ---- */
.hero-divider {
    height: 4px;
    background: linear-gradient(90deg, transparent, #2C12D9 20%, #2C12D9 80%, transparent);
    opacity: 0.5;
}

/* ---- Rank decorations ---- */
.rank-1 { color: #FBBF24; }
.rank-2 { color: #D1D5DB; }
.rank-3 { color: #D97706; }
.rank-4, .rank-5 { color: #6B7280; }

/* ---- Result row hover ---- */
.result-row { transition: background-color 0.15s ease; }
.result-row:hover { background-color: rgba(44,18,217,0.08); }

/* ---- Section title decorative line ---- */
.section-title-line::after {
    content: ''; flex: 1; height: 2px;
    background: linear-gradient(90deg, rgba(44,18,217,0.2), transparent);
    margin-left: 16px;
}

/* ========================================
   Tournament Pages — Component Styles
   Using var() references for theme switching
   ======================================== */

/* ---- Status banners ---- */
.status-banner {
    padding: 10px 20px; text-align: center; font-weight: 900;
    text-transform: uppercase; font-size: 11px; letter-spacing: 2px;
    font-family: 'Chakra Petch', sans-serif;
}
.status-banner.open { background: rgba(34,197,94,0.1); color: #4ade80; border-bottom: 2px solid #22c55e; }
.status-banner.live { background: rgba(245,158,11,0.1); color: #fbbf24; border-bottom: 2px solid #f59e0b; }
.status-banner.finished { background: rgba(107,114,128,0.1); color: #9ca3af; border-bottom: 2px solid #4b5563; }

/* ---- Tournament facepile ---- */
.facepile-v2 { display: flex; align-items: center; }
.facepile-v2 img {
    width: 32px; height: 32px;
    border: 2px solid var(--color-ps-border, #2A2A2E);
    object-fit: contain; background: var(--color-ps-elevated, #252429);
    margin-left: -8px; transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.facepile-v2 img:first-child { margin-left: 0; }
.facepile-v2 img:hover { transform: scale(1.15); z-index: 10; }

/* ---- Modal ---- */
.modal-v2-overlay {
    display: none; position: fixed; z-index: 1000; inset: 0;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
}
.modal-v2-content {
    background: var(--color-ps-surface, #1C1B1F);
    margin: 5% auto; padding: 0; width: 90%; max-width: 500px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.5), 0 10px 20px rgba(0,0,0,0.3);
    border-top: 4px solid #2C12D9; position: relative; overflow: hidden;
}
.modal-v2-content .close-modal {
    position: absolute; right: 16px; top: 12px;
    color: var(--color-ps-muted, #7B7FA0);
    font-size: 24px; font-weight: bold; cursor: pointer;
    transition: color 0.2s; z-index: 10;
}
.modal-v2-content .close-modal:hover { color: var(--color-ps-dark, #fff); }

/* ---- Bracket connector lines ---- */
.bracket-connectors line,
.bracket-connectors path {
    stroke: rgba(44,18,217,0.35); stroke-width: 2; fill: none; stroke-linecap: round;
}

/* ---- Match card ---- */
.match-card-v2 {
    background: var(--color-ps-surface, #1C1B1F);
    border: 1px solid var(--color-ps-border, #2A2A2E);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    overflow: hidden; transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.match-card-v2:hover {
    border-color: rgba(44,18,217,0.4);
    box-shadow: 0 4px 12px rgba(44,18,217,0.15);
}

/* ---- Admin panel ---- */
.admin-panel-v2 {
    background: rgba(44,18,217,0.08); padding: 10px;
    border-top: 1px solid var(--color-ps-border, #2A2A2E);
}
.admin-panel-v2 input,
.admin-panel-v2 select {
    background: var(--color-ps-elevated, #252429);
    color: var(--color-ps-dark, #fff);
    border: 1px solid var(--color-ps-border, #2A2A2E);
    font-size: 11px; padding: 5px 8px;
    font-family: 'Chakra Petch', sans-serif; outline: none;
    transition: border-color 0.2s;
}
.admin-panel-v2 input:focus,
.admin-panel-v2 select:focus { border-color: #2C12D9; }

/* ---- BYE card ---- */
.bye-card-v2 {
    background: rgba(44,18,217,0.08);
    border: 1px dashed rgba(44,18,217,0.3);
    padding: 15px; text-align: center;
    color: var(--color-ps-muted, #7B7FA0);
    font-weight: bold; margin-bottom: 12px;
}

/* ---- Broadcast banner floating logos ---- */
@keyframes floatLogo {
    0% { transform: translateY(0px); } 50% { transform: translateY(-8px); } 100% { transform: translateY(0px); }
}
.logo-float { animation: floatLogo 4s ease-in-out infinite; }
.logo-float-delayed { animation: floatLogo 4s ease-in-out infinite; animation-delay: -2s; }

/* ---- Live pulse for match status ---- */
@keyframes pulseLive { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.pulse-live { animation: pulseLive 2s infinite; }

/* ---- Stat table ---- */
.stat-table-v2 { width: 100%; border-collapse: collapse; }
.stat-table-v2--wide { min-width: 720px; }
.stat-table-v2 th {
    text-align: left; padding: 12px 10px;
    color: var(--color-ps-muted, #7B7FA0);
    font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
    font-family: 'Chakra Petch', sans-serif;
    border-bottom: 1px dashed var(--color-ps-border, #2A2A2E);
}
.stat-table-v2 th.text-center { text-align: center; }
.stat-table-v2 td.text-center { text-align: center; }
.stat-table-v2 td {
    padding: 12px 10px;
    border-bottom: 1px dashed var(--color-ps-border-subtle, #222228);
    font-size: 14px; font-weight: 600;
}
.stat-table-v2 tr:hover { background: rgba(44,18,217,0.06); }
.stat-table-v2 .acc-val { font-family: 'Chakra Petch', monospace; font-size: 16px; font-weight: 900; }


/* ========================================
   LIGHT MODE OVERRIDES
   Applied when data-theme="light" on <html>
   ======================================== */

html[data-theme="light"] {
    color-scheme: light;
    --color-ps-light: #F4F4F4;
    --color-ps-dark: #111111;
    --color-ps-surface: #FFFFFF;
    --color-ps-elevated: #F9FAFB;
    --color-ps-muted: #6b7280;
    --color-ps-dimmed: #9ca3af;
    --color-ps-lavender: #E8E4F7;
    --color-ps-lavender-dark: #C5BBE8;
    --color-ps-border: #E5E7EB;
    --color-ps-border-subtle: #F3F4F6;
    --color-ps-hover: #F8F7FD;
    --color-ps-active: #F0EEFB;
    --mp-default: #111;
}

/* Auto mode: use system preference */
@media (prefers-color-scheme: light) {
    html[data-theme="auto"] {
        color-scheme: light;
        --color-ps-light: #F4F4F4;
        --color-ps-dark: #111111;
        --color-ps-surface: #FFFFFF;
        --color-ps-elevated: #F9FAFB;
        --color-ps-muted: #6b7280;
        --color-ps-dimmed: #9ca3af;
        --color-ps-lavender: #E8E4F7;
        --color-ps-lavender-dark: #C5BBE8;
        --color-ps-border: #E5E7EB;
        --color-ps-border-subtle: #F3F4F6;
        --color-ps-hover: #F8F7FD;
        --color-ps-active: #F0EEFB;
        --mp-default: #111;
    }
}

/* Light-mode component overrides (selectors that can't use var()) */
html[data-theme="light"] ::-webkit-scrollbar-thumb,
html[data-theme="auto"] ::-webkit-scrollbar-thumb { background: #C5BBE8; }
html[data-theme="light"] ::-webkit-scrollbar-thumb:hover,
html[data-theme="auto"] ::-webkit-scrollbar-thumb:hover { background: #2C12D9; }

html[data-theme="light"] .hero-stripe,
html[data-theme="auto"] .hero-stripe { opacity: 0.06; }
html[data-theme="light"] .hero-stripe-bold,
html[data-theme="auto"] .hero-stripe-bold { opacity: 0.15; }

html[data-theme="light"] body::before,
html[data-theme="auto"] body::before {
    background-image:
        radial-gradient(ellipse 60% 50% at 10% 20%, rgba(44,18,217,0.03) 0%, transparent 60%),
        radial-gradient(ellipse 50% 40% at 90% 80%, rgba(44,18,217,0.025) 0%, transparent 60%);
}

html[data-theme="light"] .card-hover:hover,
html[data-theme="auto"] .card-hover:hover {
    box-shadow: 0 12px 32px rgba(44,18,217,0.1), 0 4px 12px rgba(0,0,0,0.06);
}

html[data-theme="light"] .hero-divider,
html[data-theme="auto"] .hero-divider { opacity: 0.3; }

html[data-theme="light"] .rank-1,
html[data-theme="auto"] .rank-1 { color: #D97706; }
html[data-theme="light"] .rank-2,
html[data-theme="auto"] .rank-2 { color: #9CA3AF; }
html[data-theme="light"] .rank-3,
html[data-theme="auto"] .rank-3 { color: #B45309; }
html[data-theme="light"] .rank-4,
html[data-theme="light"] .rank-5,
html[data-theme="auto"] .rank-4,
html[data-theme="auto"] .rank-5 { color: #D1D5DB; }

html[data-theme="light"] .result-row:hover,
html[data-theme="auto"] .result-row:hover { background-color: rgba(232,228,247,0.5); }

html[data-theme="light"] .section-title-line::after,
html[data-theme="auto"] .section-title-line::after {
    background: linear-gradient(90deg, #E8E4F7, transparent);
}

/* Status banners light */
html[data-theme="light"] .status-banner.open,
html[data-theme="auto"] .status-banner.open { background: #f0fdf4; color: #15803d; border-bottom-color: #22c55e; }
html[data-theme="light"] .status-banner.live,
html[data-theme="auto"] .status-banner.live { background: #fffbeb; color: #b45309; border-bottom-color: #f59e0b; }
html[data-theme="light"] .status-banner.finished,
html[data-theme="auto"] .status-banner.finished { background: #f9fafb; color: #6b7280; border-bottom-color: #d1d5db; }

/* Bracket connectors light */
html[data-theme="light"] .bracket-connectors line,
html[data-theme="light"] .bracket-connectors path,
html[data-theme="auto"] .bracket-connectors line,
html[data-theme="auto"] .bracket-connectors path { stroke: #C5BBE8; }

/* Modal light */
html[data-theme="light"] .modal-v2-overlay,
html[data-theme="auto"] .modal-v2-overlay { background: rgba(0,0,0,0.4); }
html[data-theme="light"] .modal-v2-content,
html[data-theme="auto"] .modal-v2-content {
    box-shadow: 0 25px 60px rgba(44,18,217,0.15), 0 10px 20px rgba(0,0,0,0.1);
}

/* B-gold text on light bg */
html[data-theme="light"] .b-gold,
html[data-theme="auto"] .b-gold { color: #111; }

/* =============================================
   ManiaPlanet color codes — dual-theme support
   .mp-col spans are generated by MPColor() with --mc-d (dark) and --mc-l (light) CSS vars.
   Dark mode uses --mc-d (brightened), light mode uses --mc-l (darkened).
   ============================================= */
.mp-col {
    color: var(--mc-d, var(--mp-default, #fff));
    display: inline;
    letter-spacing: 0;
    word-spacing: 0;
}
html[data-theme="light"] .mp-col,
html[data-theme="auto"] .mp-col {
    color: var(--mc-l, var(--mp-default, #111)) !important;
}
@media (prefers-color-scheme: light) {
    html[data-theme="auto"] .mp-col { color: var(--mc-l, var(--mp-default, #111)) !important; }
}

/* =============================================
   HUB REDESIGN — design tokens, zone accents, hub-* classes
   See PLAN-homepage-hub-redesign.md (Phase 1.4)
   ============================================= */

:root {
    --color-zone-mm: #2C12D9;
    --color-zone-mm-soft: rgba(44, 18, 217, 0.12);
    --color-zone-league: #F59E0B;
    --color-zone-league-soft: rgba(245, 158, 11, 0.12);
    --color-zone-comp: #22D3EE;
    --color-zone-comp-soft: rgba(34, 211, 238, 0.12);
    --color-zone-comm: #7B7FA0;
    --color-zone-comm-soft: rgba(123, 127, 160, 0.12);
    --color-pulse-strip: #0E0E10;
    --color-pulse-strip-text: #d6d8e6;
    --hub-zone-color: var(--color-zone-mm);
}

html[data-theme="light"],
html[data-theme="auto"] {
    --color-zone-mm-soft: rgba(44, 18, 217, 0.08);
    --color-zone-league-soft: rgba(245, 158, 11, 0.10);
    --color-zone-comp-soft: rgba(8, 145, 178, 0.08);
    --color-zone-comm-soft: rgba(75, 85, 99, 0.06);
    --color-pulse-strip: #111213;
    --color-pulse-strip-text: #e6e7ee;
}
@media (prefers-color-scheme: light) {
    html[data-theme="auto"] {
        --color-pulse-strip: #111213;
        --color-pulse-strip-text: #e6e7ee;
    }
}

/* ---- Zone wrapper + accent bar + eyebrow ---- */
.hub-zone-section {
    position: relative;
    padding-left: 1.25rem;
}
.hub-zone-bar {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    background: var(--hub-zone-color);
}
.hub-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 900;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--hub-zone-color);
    line-height: 1.15;
}
.hub-eyebrow::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--hub-zone-color);
    opacity: 0.25;
    min-width: 32px;
}
.hub-zone-section > .hub-eyebrow.mb-8 { margin-bottom: 1.25rem; }
.hub-zone-section > .hub-eyebrow.mb-6 { margin-bottom: 1rem; }
.hub-zone-section > .hub-eyebrow.mb-4 { margin-bottom: 0.875rem; }

/* ---- Hero number (queue size, ELO) ---- */
.hub-hero-number {
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 900;
    font-size: clamp(56px, 9vw, 96px);
    line-height: 0.95;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: var(--color-ps-dark);
}
.hub-hero-number-accent {
    color: var(--hub-zone-color);
}

/* ---- Tier badge XXL (hero) ---- */
.hub-tier-badge-xxl {
    width: 88px;
    height: 88px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.35);
    text-align: center;
    line-height: 1;
    position: relative;
}
.hub-tier-badge-xxl .hub-tier-badge-name {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.hub-tier-badge-xxl .hub-tier-badge-elo {
    font-size: 18px;
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
    opacity: 0.92;
}
html[data-theme="light"] .hub-tier-badge-xxl,
html[data-theme="auto"] .hub-tier-badge-xxl {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
html[data-theme="light"] .hub-tier-badge-xxl.b-gold,
html[data-theme="auto"] .hub-tier-badge-xxl.b-gold {
    color: #1f2937;
    text-shadow: none;
}

/* ---- Form W/L/C cells ---- */
.hub-form-row {
    display: inline-flex;
    gap: 4px;
}
.hub-form-cell {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 900;
    font-size: 12px;
    color: #fff;
    line-height: 1;
}
.hub-form-cell.w { background: #16a34a; }
.hub-form-cell.l { background: #dc2626; }
.hub-form-cell.c { background: #6b7280; }
html[data-theme="light"] .hub-form-cell,
html[data-theme="auto"] .hub-form-cell { color: #fff; }

/* ---- Streak chip ---- */
.hub-streak-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 900;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.hub-streak-chip.win { background: rgba(22, 163, 74, 0.15); color: #16a34a; }
.hub-streak-chip.loss { background: rgba(220, 38, 38, 0.12); color: #dc2626; }
html[data-theme="light"] .hub-streak-chip.win,
html[data-theme="auto"] .hub-streak-chip.win { background: #dcfce7; color: #15803d; }
html[data-theme="light"] .hub-streak-chip.loss,
html[data-theme="auto"] .hub-streak-chip.loss { background: #fee2e2; color: #b91c1c; }

/* ---- Pulse strip ---- */
.hub-pulse-strip {
    background: var(--color-pulse-strip);
    color: var(--color-pulse-strip-text);
    height: 36px;
    width: 100%;
    border-bottom: 1px solid #1f2024;
    display: flex;
    align-items: center;
    overflow: hidden;
}
.hub-pulse-strip[data-stale="true"] { opacity: 0.85; }
.hub-pulse-cells {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    width: 100%;
    max-width: 1400px;
    height: 100%;
    align-items: center;
    gap: 0;
    margin: 0 auto;
    padding: 0 1.5rem;
}
@media (max-width: 768px) {
    .hub-pulse-cells {
        grid-template-columns: 1fr;
        padding: 0 1rem;
    }
}
.hub-pulse-cell {
    padding: 0 1.25rem;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Chakra Petch', sans-serif;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-variant-numeric: tabular-nums;
    border-right: 1px solid #1f2024;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.hub-pulse-cell:first-child { padding-left: 0; }
.hub-pulse-cell:last-child { padding-right: 0; }
.hub-pulse-cell:last-child { border-right: 0; }
.hub-pulse-cell a { color: inherit; text-decoration: none; }
.hub-pulse-cell a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.hub-pulse-cell .hub-pulse-icon {
    width: 8px;
    height: 8px;
    flex-shrink: 0;
    display: inline-block;
}
.hub-pulse-icon.dot-live {
    background: #ef4444;
    border-radius: 50%;
}
.hub-pulse-icon.dot-queue { background: #22c55e; border-radius: 50%; }
.hub-pulse-icon.dot-tournament { background: #F59E0B; }
.hub-pulse-icon.dot-info { background: #22D3EE; border-radius: 50%; }
.hub-pulse-icon.dot-warning { background: #F59E0B; border-radius: 50%; }
.hub-pulse-icon.dot-critical { background: #ef4444; border-radius: 50%; }

@keyframes pulseRedHub {
    0%, 100% { opacity: 1; box-shadow: 0 0 4px #ef4444; }
    50% { opacity: 0.6; box-shadow: 0 0 10px #ef4444; }
}

/* ---- Hub cards ---- */
.hub-card {
    background: var(--color-ps-surface, #1C1B1F);
    border: 1px solid var(--color-ps-border, #2A2A2E);
    padding: 1.25rem;
    position: relative;
}
.hub-hero-actions > a {
    min-height: 56px;
    justify-content: center;
}
.hub-secondary-cta {
    padding: 0 0.25rem;
    align-self: stretch;
}
@media (min-width: 640px) {
    .hub-secondary-cta {
        align-self: center;
    }
}
.hub-comp-column {
    display: flex;
    min-width: 0;
}
.hub-comp-column > .hub-card {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
}
.hub-queue-list {
    display: grid;
    gap: 0.65rem;
}
.hub-queue-row {
    display: grid;
    grid-template-columns: minmax(8.5rem, 1fr) minmax(3.25rem, max-content) max-content;
    align-items: baseline;
    column-gap: 1.5rem;
}
@media (max-width: 640px) {
    .hub-queue-row {
        grid-template-columns: minmax(7.75rem, 1fr) minmax(2.75rem, max-content) max-content;
        column-gap: 1rem;
    }
}
.hub-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    border-left: 3px solid transparent;
    transition: transform 120ms ease, border-left-color 120ms ease, background 120ms ease;
}
.hub-card-link:hover {
    transform: translateY(-2px);
    border-left-color: var(--hub-zone-color);
}
.hub-card-link:focus-visible {
    outline: 2px solid var(--hub-zone-color);
    outline-offset: 2px;
}

/* ---- Hub data list rows ---- */
.hub-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px dashed var(--color-ps-border, #2A2A2E);
    text-decoration: none;
    color: inherit;
}
.hub-row:last-child { border-bottom: 0; }
.hub-row:hover { background: var(--color-zone-mm-soft); }

/* ---- Match LIVE indicator pill ---- */
.hub-live-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 900;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.hub-live-pill .dot-live { width: 6px; height: 6px; }

/* ---- Stale data indicator ---- */
.hub-stale-indicator {
    font-size: 10px;
    color: var(--color-ps-dimmed, #555);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-family: 'Chakra Petch', sans-serif;
    margin-left: 0.5rem;
}
[data-stale="true"] .hub-stale-indicator { display: inline; }
.hub-stale-indicator { display: none; }

/* ---- Match-in-progress hero banner ---- */
.hub-active-match-banner {
    background: linear-gradient(90deg, rgba(239,68,68,0.16) 0%, rgba(239,68,68,0.05) 60%, transparent 100%);
    border-left: 4px solid #ef4444;
    padding: 1.5rem 1.5rem 1.5rem 2rem;
    position: relative;
}
.hub-active-match-banner .hub-eyebrow { color: #ef4444; }
.hub-active-match-banner .hub-eyebrow::after { background: #ef4444; opacity: 0.4; }
.hub-active-match-dim main > section:not(.hub-active-match-banner-section) {
    opacity: 0.6;
    transition: opacity 200ms ease;
}
.hub-active-match-dim main > section:not(.hub-active-match-banner-section):hover {
    opacity: 1;
}

/* ---- Skip link ---- */
.hub-skip-link {
    position: absolute;
    top: 0;
    left: 0;
    background: var(--color-ps-primary, #2C12D9);
    color: #fff;
    padding: 0.5rem 1rem;
    text-decoration: none;
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 900;
    font-size: 12px;
    text-transform: uppercase;
    transform: translateY(-100%);
    z-index: 100;
    transition: transform 150ms ease;
}
.hub-skip-link:focus {
    transform: translateY(0);
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* ---- Section diagonal separator ---- */
.hub-zone-separator {
    height: 6px;
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 4px,
        var(--color-ps-border, #2A2A2E) 4px,
        var(--color-ps-border, #2A2A2E) 5px
    );
    opacity: 0.4;
    margin: 0;
    border: 0;
}

/* ---- Tabular numbers utility ---- */
.hub-tabular { font-variant-numeric: tabular-nums; }

/* ---- Zone selector (apply --hub-zone-color per section) ---- */
.zone-mm { --hub-zone-color: var(--color-zone-mm); }
.zone-league { --hub-zone-color: var(--color-zone-league); }
.zone-comp { --hub-zone-color: var(--color-zone-comp); }
.zone-comm { --hub-zone-color: var(--color-zone-comm); }

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    .hub-pulse-cell,
    .hub-card-link,
    .hub-active-match-dim main > section,
    .pulse-dot,
    .pulse-live,
    .hub-pulse-icon.dot-live,
    .hub-pulse-icon.dot-critical {
        animation: none !important;
        transition: none !important;
    }
    .hub-card-link:hover {
        transform: none;
    }
}
