/* ============================
   Kerala Polls Tracker v2
   Design System & Layout
   ============================ */

/* --- Design Tokens --- */
:root {
    --bg: #0c1220;
    --bg-alt: #111827;
    --surface: rgba(23, 35, 58, 0.95);
    --surface-raised: rgba(30, 45, 70, 0.98);
    --border: rgba(255, 255, 255, 0.14);
    --border-active: rgba(99, 102, 241, 0.6);
    --text-1: #f1f5f9;
    --text-2: #b8c8d8;
    --text-3: #8899aa;
    --accent: #818cf8;
    --accent-glow: rgba(129, 140, 248, 0.25);

    --ldf: #f87171; --ldf-bg: rgba(248, 113, 113, 0.15);
    --udf: #60a5fa; --udf-bg: rgba(96, 165, 250, 0.15);
    --nda: #fb923c; --nda-bg: rgba(251, 146, 60, 0.15);
    --oth: #a8b8c8; --oth-bg: rgba(168, 184, 200, 0.15);
    --toss: #facc15; --toss-bg: rgba(250, 204, 21, 0.15);

    --map-fill: #2d3f55;
    --map-stroke: #4a6080;
    --map-hover: #5a7090;

    --radius-sm: 0.375rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.25rem;

    --shadow-card: 0 4px 24px rgba(0,0,0,0.4), 0 1px 4px rgba(0,0,0,0.3);
    --shadow-glow: 0 0 30px rgba(129, 140, 248, 0.2);

    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="light"] {
    --bg: #f1f5f9;
    --bg-alt: #e8eef5;
    --surface: rgba(255, 255, 255, 0.95);
    --surface-raised: rgba(255, 255, 255, 0.99);
    --border: rgba(0, 0, 0, 0.1);
    --border-active: rgba(99, 102, 241, 0.5);
    --text-1: #0f172a;
    --text-2: #334155;
    --text-3: #64748b;
    --accent: #4f46e5;
    --accent-glow: rgba(79, 70, 229, 0.12);

    /* Deeper alliance colours for light backgrounds */
    --ldf: #dc2626; --ldf-bg: rgba(220, 38, 38, 0.1);
    --udf: #1d4ed8; --udf-bg: rgba(29, 78, 216, 0.1);
    --nda: #c2410c; --nda-bg: rgba(194, 65, 12, 0.1);
    --oth: #475569; --oth-bg: rgba(71, 85, 105, 0.1);
    --toss: #92400e; --toss-bg: rgba(146, 64, 14, 0.1);

    --map-fill: #c8d8e8;
    --map-stroke: #7a94a8;
    --map-hover: #b0c4d8;

    --shadow-card: 0 4px 24px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.05);
    --shadow-glow: 0 0 30px rgba(79, 70, 229, 0.1);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text-1);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Ambient gradient orbs */
body::before {
    content: '';
    position: fixed;
    top: -30%;
    right: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}
body::after {
    content: '';
    position: fixed;
    bottom: -20%;
    left: -10%;
    width: 40vw;
    height: 40vw;
    background: radial-gradient(circle, rgba(239,68,68,0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}
[data-theme="light"] body::before,
[data-theme="light"] body::after { opacity: 0; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.22); }

/* --- Typography --- */
h1 { font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 1.75rem; letter-spacing: -0.5px; }
h2 { font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 1.15rem; color: var(--text-2); }
h3 { font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 1.35rem; display: flex; align-items: center; gap: 0.5rem; }

.ac-badge {
    font-family: 'Inter', sans-serif;
    background: var(--accent);
    color: #fff;
    font-size: 0.65rem;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    letter-spacing: 1px;
}

/* --- App Shell --- */
.app-shell {
    position: relative;
    z-index: 1;
    max-width: 1440px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* --- Header --- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(13, 18, 32, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}
[data-theme="light"] .app-header {
    background: rgba(255,255,255,0.96);
    border-bottom-color: rgba(0,0,0,0.1);
    box-shadow: 0 1px 12px rgba(0,0,0,0.06);
}
.app-header .logo { display: flex; flex-direction: column; }
.app-header .logo h1 { font-size: 1.3rem; line-height: 1.2; }
.app-header .logo span { font-size: 0.7rem; color: var(--text-3); font-weight: 600; letter-spacing: 0.5px; }
.header-actions { display: flex; gap: 0.5rem; align-items: center; }

.pill-toggle {
    display: flex;
    background: rgba(0,0,0,0.25);
    border-radius: var(--radius-md);
    padding: 3px;
    border: 1px solid var(--border);
}
[data-theme="light"] .pill-toggle { background: rgba(0,0,0,0.05); }
.pill-toggle button {
    background: transparent;
    border: none;
    color: var(--text-3);
    padding: 0.35rem 0.75rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: 'Inter', sans-serif;
}
.pill-toggle button.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}
.pill-toggle button:not(.active):hover {
    color: var(--text-1);
    background: rgba(255,255,255,0.06);
}
[data-theme="light"] .pill-toggle button:not(.active):hover {
    background: rgba(0,0,0,0.06);
}

.pro-link {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-2);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: 'Inter', sans-serif;
}
.pro-link:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}
.pro-link.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* --- Main Layout --- */
.main-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
}
@media (min-width: 900px) {
    .main-layout { flex-direction: row; }
}

/* --- Tracker 4-Column Layout --- */
@media (min-width: 900px) {
    .tracker-4col {
        display: flex;
        flex-direction: row;
        height: calc(100vh - 56px);
    }
    .tracker-tally-col {
        width: 260px;
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 1rem 0.5rem;
        border-right: 1px solid rgba(255,255,255,0.06);
        position: sticky;
        top: 56px;
        height: calc(100vh - 56px);
        overflow-y: auto;
    }
    [data-theme="light"] .tracker-tally-col {
        border-right-color: rgba(0,0,0,0.06);
    }
    .tracker-tally-col .tally-panel {
        position: static;
        transform: none;
        width: 100%;
        max-width: 240px;
        margin: 0;
    }
    .tracker-map-col {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        position: sticky;
        top: 56px;
        height: calc(100vh - 56px);
        overflow: hidden;
        min-width: 0;
        padding: 1.5rem 1rem;
    }
    .tracker-candidate-col {
        width: 340px;
        flex-shrink: 0;
        position: sticky;
        top: 56px;
        height: calc(100vh - 56px);
        overflow-y: auto;
        border-left: 1px solid rgba(255,255,255,0.06);
        border-right: 1px solid rgba(255,255,255,0.06);
        background: rgba(0,0,0,0.1);
    }
    [data-theme="light"] .tracker-candidate-col {
        border-color: rgba(0,0,0,0.06);
        background: #fafbfc;
    }
    .tracker-4col .district-accordion-panel {
        width: 320px;
        flex-shrink: 0;
    }
}
/* Mobile: stack vertically */
@media (max-width: 899px) {
    .tracker-tally-col { padding: 0.5rem; }
    .tracker-tally-col .tally-panel {
        position: static;
        transform: none;
        max-width: 400px;
        margin: 0 auto;
    }
    .tracker-map-col { padding: 0.5rem; }
    .tracker-candidate-col { padding: 0.5rem; }
}

/* --- Map Hero Panel --- */
.map-hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0.75rem;
    min-height: 0;
    height: 100%;
}

.map-wrap {
    flex: 1;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    min-height: 0;
}
@media (max-width: 899px) {
    .map-wrap { max-height: 50vh; }
}
.map-wrap svg {
    height: 100%;
    width: auto;
    max-width: 100%;
    max-height: 100%;
    filter: drop-shadow(0 8px 30px rgba(0,0,0,0.4));
}
[data-theme="light"] .map-wrap svg { filter: drop-shadow(0 4px 20px rgba(0,0,0,0.15)); }
.map-wrap path {
    transition: fill var(--transition-smooth), fill-opacity var(--transition-smooth), stroke var(--transition-fast);
    cursor: pointer;
}
.map-wrap path:hover {
    filter: brightness(1.25);
}

/* Map Tooltip */
.map-tooltip {
    position: fixed;
    pointer-events: none;
    z-index: 200;
    background: rgba(15, 25, 45, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem;
    box-shadow: var(--shadow-card);
}
[data-theme="light"] .map-tooltip {
    background: rgba(255,255,255,0.98);
    border-color: rgba(0,0,0,0.1);
    color: var(--text-1);
}
.map-tooltip {
    opacity: 0;
    transition: opacity 100ms ease;
    white-space: nowrap;
    font-size: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.map-tooltip.visible { opacity: 1; }
.map-tooltip .tt-name { font-weight: 700; font-family: 'Outfit', sans-serif; font-size: 0.8rem; }
.map-tooltip .tt-info { color: var(--text-3); font-size: 0.65rem; }
.map-tooltip .tt-winner { font-weight: 700; font-size: 0.7rem; }

/* --- Tally Panel — positioned in map whitespace --- */
.tally-panel {
    background: rgba(10, 18, 32, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-xl);
    padding: 1.25rem 1.4rem;
    box-shadow: 0 12px 40px rgba(0,0,0,0.6), 0 1px 0 rgba(255,255,255,0.05) inset;
    width: 100%;
    max-width: 460px;
    margin-top: 0.75rem;
    z-index: 10;
}
[data-theme="light"] .tally-panel {
    background: rgba(255,255,255,0.97);
    border-color: rgba(0,0,0,0.1);
    box-shadow: var(--shadow-card);
}
@media (min-width: 900px) {
    .tally-panel {
        width: 100%;
        margin-top: 0;
        padding: 1rem 1rem;
    }
}

/* Header */
.tp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.tp-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-1);
    letter-spacing: 0.2px;
}
.tp-progress-badge {
    font-size: 0.95rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    color: var(--accent);
    background: var(--accent-glow);
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
}
.tp-progress-badge span { font-size: 0.7rem; opacity: 0.7; }
.tp-progress-badge.done { color: #4ade80; background: rgba(74,222,128,0.12); }

/* Stacked projection bar */
.tp-stack-section { margin-bottom: 1rem; }
.tp-stack-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--text-3);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.tp-majority-note { color: rgba(255,255,255,0.35); }
[data-theme="light"] .tp-majority-note { color: rgba(0,0,0,0.3); }

.tp-stack-bar {
    position: relative;
    display: flex;
    height: 18px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
}
[data-theme="light"] .tp-stack-bar {
    background: rgba(0,0,0,0.05);
    border-color: rgba(0,0,0,0.08);
}
.tp-seg {
    height: 100%;
    transition: width 700ms cubic-bezier(0.4,0,0.2,1);
    flex-shrink: 0;
}
.tp-seg-sure { opacity: 1; }
.tp-seg-edge { opacity: 0.7; }

/* Majority line marker */
.tp-majority-line {
    position: absolute;
    top: -2px;
    bottom: -2px;
    width: 2px;
    background: rgba(255,255,255,0.8);
    z-index: 10;
    border-radius: 2px;
    box-shadow: 0 0 6px rgba(255,255,255,0.6);
}
[data-theme="light"] .tp-majority-line {
    background: rgba(0,0,0,0.6);
    box-shadow: 0 0 4px rgba(0,0,0,0.3);
}

.tp-stack-footer {
    display: flex;
    position: relative;
    font-size: 0.5rem;
    color: var(--text-3);
    margin-top: 0.2rem;
}

/* Per-front rows */
.tp-rows { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.75rem; }

.tp-row {
    display: grid;
    grid-template-columns: 2.5rem 1fr auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.4rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: var(--transition-fast);
}
.tp-row-majority {
    border-color: rgba(74,222,128,0.3);
    background: rgba(74,222,128,0.04);
}
.tp-row-toss { opacity: 0.8; }

.tp-row-name {
    font-size: 0.75rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 0.5px;
}

.tp-row-bars {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.tp-mini-bar {
    height: 6px;
    border-radius: 999px;
    background: rgba(255,255,255,0.07);
    overflow: visible;
    position: relative;
}
[data-theme="light"] .tp-mini-bar { background: rgba(0,0,0,0.05); }
.tp-mini-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 700ms cubic-bezier(0.4,0,0.2,1);
    min-width: 0;
}
.tp-sure-fill { opacity: 1; }
.tp-edge-fill { opacity: 0.8; }

.tp-row-counts {
    display: grid;
    grid-template-columns: 1.6rem 0.7rem 1.6rem 2rem;
    align-items: center;
    font-size: 0.72rem;
    font-weight: 700;
    gap: 0;
    text-align: right;
}
.tp-edge-label { color: var(--text-3); font-size: 0.6rem; text-align: center; }
.tp-total-count { font-weight: 900; font-size: 0.85rem; border-left: 1px solid rgba(255,255,255,0.1); padding-left: 0.35rem; }
[data-theme="light"] .tp-total-count { border-color: rgba(0,0,0,0.1); }

/* Legend */
.tp-legend {
    display: flex;
    gap: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 0.6rem;
    flex-wrap: wrap;
}
[data-theme="light"] .tp-legend { border-color: rgba(0,0,0,0.08); }
.tp-legend-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.55rem;
    font-weight: 600;
    color: var(--text-3);
}
.tp-legend-swatch {
    width: 16px;
    height: 6px;
    border-radius: 3px;
}
.tp-legend-sure { background: rgba(255,255,255,0.5); }
.tp-legend-edge { background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.4); }
[data-theme="light"] .tp-legend-sure { background: rgba(0,0,0,0.25); }
[data-theme="light"] .tp-legend-edge { background: rgba(0,0,0,0.08); border-color: rgba(0,0,0,0.2); }

/* --- Sidebar --- */
.sidebar {
    width: 100%;
    border-left: 1px solid rgba(255,255,255,0.08);
    background: #0f1a2e;
    display: flex;
    flex-direction: column;
    position: relative;
}
[data-theme="light"] .sidebar {
    background: #ffffff;
    border-left-color: rgba(0,0,0,0.1);
}
@media (min-width: 900px) {
    .sidebar {
        width: 420px;
        flex-shrink: 0;
        height: calc(100vh - 56px);
        position: sticky;
        top: 56px;
        overflow-y: auto;
    }
}

/* Search */
.sidebar-search {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.15);
}
[data-theme="light"] .sidebar-search {
    border-bottom-color: rgba(0,0,0,0.1);
    background: #f8fafc;
}
.search-box {
    width: 100%;
    padding: 0.6rem 0.9rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: var(--text-1);
    font-size: 0.8rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: var(--transition-fast);
}
[data-theme="light"] .search-box {
    border-color: rgba(0,0,0,0.12);
    background: #ffffff;
    color: #0f172a;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
}
.search-box:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.search-box::placeholder { color: var(--text-3); }

/* District List */
.district-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.dist-group {
    margin-bottom: 0.35rem;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid transparent;
    transition: var(--transition-fast);
}
.dist-group.has-preds { border-color: var(--border); }

.dist-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0.65rem;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    gap: 0.4rem;
}
.dist-head:hover { background: rgba(255,255,255,0.04); }
[data-theme="light"] .dist-head:hover { background: rgba(0,0,0,0.05); }

.dist-head .dist-name {
    font-weight: 700;
    font-size: 0.8rem;
    font-family: 'Outfit', sans-serif;
}
.dist-head .dist-meta { display: flex; align-items: center; gap: 0.4rem; }

.dist-progress {
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255,255,255,0.15);
    overflow: hidden;
}
[data-theme="light"] .dist-progress { background: rgba(0,0,0,0.06); }
.dist-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--accent);
    transition: width var(--transition-smooth);
}
.dist-progress-fill.full { background: #4ade80; }

.dist-count {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-3);
    min-width: 28px;
    text-align: right;
}
[data-theme="light"] .dist-count { color: var(--text-2); }
.dist-chevron {
    font-size: 0.6rem;
    color: var(--text-3);
    transition: transform var(--transition-fast);
}
.dist-chevron.open { transform: rotate(90deg); }

.dist-clear {
    font-size: 0.55rem;
    color: #ef4444;
    border: 1px solid rgba(239,68,68,0.25);
    background: transparent;
    padding: 0.1rem 0.35rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: var(--transition-fast);
}
.dist-clear:hover { background: rgba(239,68,68,0.1); }

/* LAC Chips inside expanded district */
.lac-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.35rem;
    padding: 0.5rem 0.6rem;
    background: rgba(0,0,0,0.25);
    border-top: 1px solid var(--border);
}
[data-theme="light"] .lac-grid { background: rgba(0,0,0,0.02); }

.lac-chip {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.6rem 0.3rem 0.4rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(30, 45, 70, 0.9);
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: 'Inter', sans-serif;
    min-height: 50px;
}
[data-theme="light"] .lac-chip { background: #ffffff; border-color: rgba(0,0,0,0.1); }
.lac-chip:hover {
    border-color: rgba(255,255,255,0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
    background: rgba(40, 60, 90, 0.95);
}
[data-theme="light"] .lac-chip:hover { border-color: rgba(0,0,0,0.2); background: #f8fafc; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.lac-chip.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow), 0 2px 8px rgba(0,0,0,0.3);
    background: rgba(40, 55, 90, 0.98);
}
[data-theme="light"] .lac-chip.active { background: rgba(79,70,229,0.06); border-color: var(--accent); box-shadow: 0 0 0 2px rgba(79,70,229,0.15); }
.lac-chip .chip-ac {
    position: absolute;
    top: 3px;
    left: 3px;
    font-size: 0.5rem;
    font-weight: 700;
    color: var(--text-3);
    letter-spacing: 0.5px;
}
.lac-chip .chip-name {
    font-size: 0.7rem;
    font-weight: 700;
    text-align: center;
    color: var(--text-1);
    line-height: 1.15;
    word-break: break-word;
}
.lac-chip .chip-winner {
    font-size: 0.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Color-coded left accent on predicted chips */
.lac-chip.pred-ldf { border-left: 3px solid var(--ldf); }
.lac-chip.pred-udf { border-left: 3px solid var(--udf); }
.lac-chip.pred-nda { border-left: 3px solid var(--nda); }
.lac-chip.pred-others { border-left: 3px solid var(--oth); }
.lac-chip.pred-toss-up { border-left: 3px solid var(--toss); }

/* --- Candidate Drawer --- */
.cand-drawer {
    border-top: 1px solid var(--border);
    background: rgba(16, 28, 50, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    max-height: 55vh;
    animation: slideUp 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
[data-theme="light"] .cand-drawer {
    background: #ffffff;
    border-top-color: rgba(0,0,0,0.1);
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: rgba(16, 28, 50, 0.99);
    flex-shrink: 0;
}
[data-theme="light"] .drawer-header { background: #f8fafc; border-bottom-color: rgba(0,0,0,0.08); }
.drawer-header h3 { font-size: 1.1rem; color: var(--text-1); }
.drawer-header .district-label { font-size: 0.7rem; color: var(--text-3); font-weight: 600; }
.drawer-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
    color: var(--text-2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: var(--transition-fast);
}
[data-theme="light"] .drawer-close { border-color: rgba(0,0,0,0.1); background: transparent; color: var(--text-2); }
.drawer-close:hover { background: rgba(255,255,255,0.1); color: var(--text-1); }
[data-theme="light"] .drawer-close:hover { background: rgba(0,0,0,0.06); color: var(--text-1); }

.drawer-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0.75rem 1rem;
    background: rgba(14, 24, 44, 0.98);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
[data-theme="light"] .drawer-body { background: #f1f5f9; }

/* Candidate Card v2 */
.cand-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(20, 32, 52, 0.95);
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}
[data-theme="light"] .cand-card { background: #ffffff; border-color: rgba(0,0,0,0.1); }
.cand-card:hover { border-color: rgba(255,255,255,0.25); background: rgba(28, 42, 65, 0.98); }
[data-theme="light"] .cand-card:hover { border-color: rgba(0,0,0,0.2); background: #f8fafc; }
.cand-card.is-winner {
    border-color: var(--accent);
    background: rgba(99,102,241,0.12);
}
[data-theme="light"] .cand-card.is-winner { background: rgba(79,70,229,0.06); border-color: var(--accent); }

.cand-front-accent {
    width: 4px;
    height: 100%;
    border-radius: 2px;
    position: absolute;
    left: 0;
    top: 0;
}

.cand-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; padding-left: 0.3rem; }
.cand-card .c-name { font-weight: 700; font-size: 0.8rem; color: var(--text-1); }
.cand-card .c-party {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-2);
    background: rgba(255,255,255,0.1);
    padding: 0.1rem 0.35rem;
    border-radius: var(--radius-sm);
    width: fit-content;
    border: 1px solid rgba(255,255,255,0.08);
}
[data-theme="light"] .cand-card .c-party { background: rgba(0,0,0,0.06); border: 1px solid rgba(0,0,0,0.08); color: var(--text-2); }
.cand-card .c-alliance { font-size: 0.65rem; font-weight: 800; }

.cand-actions { display: flex; gap: 0.35rem; flex-shrink: 0; }

.btn-sure, .btn-edge {
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: 'Inter', sans-serif;
    border: 1px solid transparent;
}
.btn-sure {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-sure:hover { background: #6366f1; transform: scale(1.05); }
.btn-edge {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.2);
    color: var(--text-1);
}
[data-theme="light"] .btn-edge { background: #f1f5f9; border-color: rgba(0,0,0,0.18); color: var(--text-1); }
.btn-edge:hover { border-color: rgba(255,255,255,0.4); color: #fff; background: rgba(255,255,255,0.1); }
[data-theme="light"] .btn-edge:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }

.badge-winner {
    font-size: 0.6rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.drawer-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
    background: rgba(12, 20, 38, 0.99);
}
[data-theme="light"] .drawer-footer {
    background: #ffffff;
    border-top-color: rgba(0,0,0,0.08);
}
.btn-tossup {
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: 'Inter', sans-serif;
    background: transparent;
    border: 1px solid var(--toss);
    color: var(--toss);
}
.btn-tossup:hover { background: var(--toss-bg); }
.btn-next {
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: 'Inter', sans-serif;
    background: var(--accent);
    color: #fff;
    border: none;
}
.btn-next:hover { background: #4f46e5; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.3); }

/* --- Pro Mode Page v2 --- */
.pro-page-v2 {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: var(--bg);
}

/* ── Section shared card style ── */
.pro-section {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
[data-theme="light"] .pro-section { border-bottom-color: rgba(0,0,0,0.07); }

.pro-section-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-1);
    letter-spacing: 0.2px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.pro-section-title .pro-section-badge {
    font-size: 0.6rem;
    font-weight: 700;
    background: var(--accent-glow);
    color: var(--accent);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ── Section 1: State Overview ── */
.pro-state-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
@media (min-width: 900px) {
    .pro-state-section {
        flex-direction: row;
        align-items: flex-start;
        gap: 1.5rem;
    }
}

.pro-state-map-wrap {
    flex: 1;
    height: 500px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-xl);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}
[data-theme="light"] .pro-state-map-wrap {
    background: #f8fafc;
    border-color: rgba(0,0,0,0.1);
}
/* Inner div that holds the injected SVG */
.pro-state-map-wrap > div:last-child {
    flex: 1;
    width: 100%;
    min-height: 0;
    display: block;
    cursor: pointer;
}
.pro-state-map-wrap svg {
    width: 100%;
    height: 100%;
    display: block;
}
.pro-state-map-wrap path {
    transition: fill 0.3s ease, opacity 0.3s ease;
    cursor: pointer;
}
.pro-state-map-wrap path:hover { filter: brightness(1.2); }

.pro-tally-col {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
@media (min-width: 900px) {
    .pro-tally-col { width: 340px; flex-shrink: 0; }
}

/* Inline tally panel for pro mode — exact same .tally-panel but static (not absolute) */
.pro-tally-col .tally-panel {
    position: static !important;
    transform: none !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* District stats row */
.pro-district-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
}
.pro-dist-stat {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-md);
    padding: 0.65rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    cursor: pointer;
    transition: var(--transition-fast);
}
[data-theme="light"] .pro-dist-stat { background: #ffffff; border-color: rgba(0,0,0,0.09); }
.pro-dist-stat:hover { border-color: var(--accent); background: var(--accent-glow); }
.pro-dist-stat.active { border-color: var(--accent); background: var(--accent-glow); }
.pro-dist-stat .pds-name { font-size: 0.7rem; font-weight: 700; font-family: 'Outfit', sans-serif; color: var(--text-1); }
.pro-dist-stat .pds-bar {
    height: 3px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    overflow: hidden;
    margin-top: 0.25rem;
}
[data-theme="light"] .pro-dist-stat .pds-bar { background: rgba(0,0,0,0.06); }
.pro-dist-stat .pds-fill { height: 100%; border-radius: 999px; background: var(--accent); }
.pro-dist-stat .pds-count { font-size: 0.6rem; color: var(--text-3); font-weight: 600; text-align: right; }

/* ── Section 2: District Deep-Dive ── */
.pro-district-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pro-district-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.pro-district-selector {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.14);
    color: var(--text-1);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    outline: none;
    cursor: pointer;
    flex: 1;
    max-width: 260px;
    transition: var(--transition-fast);
}
[data-theme="light"] .pro-district-selector {
    background: #ffffff;
    border-color: rgba(0,0,0,0.12);
}
.pro-district-selector:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.pro-district-meta { font-size: 0.75rem; color: var(--text-3); font-weight: 600; }
.pro-district-progress-pill {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 999px;
    padding: 0.25rem 0.65rem;
    font-size: 0.7rem;
    font-weight: 700;
}
[data-theme="light"] .pro-district-progress-pill { background: #f1f5f9; border-color: rgba(0,0,0,0.1); }
.pro-district-progress-pill .pill-done { color: #4ade80; }
.pro-district-progress-pill .pill-total { color: var(--text-3); }

.pro-district-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
@media (min-width: 900px) {
    .pro-district-layout { flex-direction: row; align-items: flex-start; gap: 1.5rem; }
}

/* District map */
.pro-dist-map-container {
    width: 100%;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-xl);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    height: 380px;
}
[data-theme="light"] .pro-dist-map-container { background: #f8fafc; border-color: rgba(0,0,0,0.1); }
@media (min-width: 900px) {
    .pro-dist-map-container { width: 360px; flex-shrink: 0; height: 480px; }
}
/* The inner div that receives the SVG innerHTML */
.pro-dist-map-container > div:last-child {
    flex: 1;
    width: 100%;
    min-height: 0;
    display: block;
}
.pro-dist-map-container svg { width: 100%; height: 100%; display: block; }
.pro-dist-map-container path { transition: fill 0.25s ease, opacity 0.25s ease; }
.pro-dist-map-container path.dim { opacity: 0.12; cursor: default; }
.pro-dist-map-container path.active-path { cursor: pointer; }
.pro-dist-map-container path.active-path:hover { filter: brightness(1.18); }

/* District map label overlay */
.pro-dist-map-label {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-sm);
    padding: 0.3rem 0.65rem;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    color: #fff;
    pointer-events: none;
}
[data-theme="light"] .pro-dist-map-label { background: rgba(255,255,255,0.85); color: var(--text-1); }

/* Constituency list */
.pro-con-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 0;
    max-height: 500px;
    overflow-y: auto;
}

.pro-con-card {
    background: rgba(20, 32, 52, 0.9);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: var(--radius-md);
    padding: 0.75rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
    transition: var(--transition-fast);
    flex-shrink: 0;
}
[data-theme="light"] .pro-con-card { background: #ffffff; border-color: rgba(0,0,0,0.1); }
.pro-con-card:hover { border-color: rgba(255,255,255,0.2); }
[data-theme="light"] .pro-con-card:hover { border-color: rgba(0,0,0,0.18); }
.pro-con-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }

.pro-con-card-front-bar {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    border-radius: 2px 0 0 2px;
}

.pro-con-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding-left: 0.4rem;
}
.pro-con-card-id {
    font-size: 0.55rem;
    font-weight: 700;
    color: var(--text-3);
    letter-spacing: 0.8px;
    font-family: 'Inter', sans-serif;
}
.pro-con-card-name {
    font-weight: 800;
    font-size: 0.8rem;
    font-family: 'Outfit', sans-serif;
    color: var(--text-1);
    flex: 1;
}
.pro-con-card-badge {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    white-space: nowrap;
}

/* Action buttons row (own line below header) */
.pro-con-top-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding-left: 0.4rem;
    flex-shrink: 0;
    width: 100%;
}
.pro-con-submit-btn {
    flex: 1;
    padding: 0.25rem 0;
    font-size: 0.58rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    border: 1px solid #4ade80;
    background: rgba(74, 222, 128, 0.12);
    color: #4ade80;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: var(--transition-fast);
    white-space: nowrap;
    text-align: center;
}
.pro-con-submit-btn:hover {
    background: rgba(74, 222, 128, 0.25);
}
.pro-con-submit-btn.completed {
    background: rgba(74, 222, 128, 0.9);
    color: var(--card-bg);
}
[data-theme="light"] .pro-con-submit-btn.completed { color: #fff; }

.pro-con-candidates {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding-left: 0.4rem;
}
.pro-con-cand-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    padding: 0.25rem 0.3rem;
    border-radius: var(--radius-sm);
    transition: background 0.2s ease;
}
.pro-con-cand-row.rank-1 {
    background: rgba(74, 222, 128, 0.06);
}
.pro-con-cand-row.rank-2 {
    background: rgba(148, 163, 184, 0.06);
}
.pro-con-cand-row.rank-3 {
    background: rgba(251, 191, 36, 0.05);
}
.pro-con-cand-fill {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    opacity: 0.07;
    border-radius: var(--radius-sm);
    transition: width 400ms ease;
}
.pro-con-cand-info { flex: 1; min-width: 0; z-index: 1; }
.pro-con-cand-name { font-size: 0.72rem; font-weight: 700; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pro-con-cand-party { font-size: 0.55rem; color: var(--text-3); font-weight: 600; }

/* Rank buttons (horizontal row between name and vote %) */
.pro-rank-col {
    display: flex;
    flex-direction: row;
    gap: 3px;
    z-index: 1;
    flex-shrink: 0;
}
.pro-rank-btn {
    width: 24px;
    height: 22px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    background: rgba(255,255,255,0.03);
    color: var(--text-3);
    font-size: 0.6rem;
    font-weight: 800;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
[data-theme="light"] .pro-rank-btn {
    border-color: rgba(0,0,0,0.12);
    background: #f1f5f9;
}
.pro-rank-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}
.pro-rank-btn.active.rank-winner {
    background: #4ade80;
    color: #0a1220;
    border-color: #4ade80;
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.4);
}
.pro-rank-btn.active.rank-runner {
    background: #94a3b8;
    color: #0a1220;
    border-color: #94a3b8;
    box-shadow: 0 0 4px rgba(148, 163, 184, 0.3);
}
.pro-rank-btn.active.rank-third {
    background: #fbbf24;
    color: #0a1220;
    border-color: #fbbf24;
    box-shadow: 0 0 4px rgba(251, 191, 36, 0.3);
}

/* Auto-margin badge */
.pro-margin-auto-badge {
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Footer actions */
.pro-con-footer-actions {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: auto;
}
.pro-con-clear-btn {
    flex: 1;
    padding: 0.25rem 0;
    font-size: 0.58rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(248,113,113,0.4);
    background: transparent;
    color: #f87171;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: var(--transition-fast);
    white-space: nowrap;
    text-align: center;
}
.pro-con-clear-btn:hover {
    background: rgba(248,113,113,0.1);
}


.pro-con-vote-wrap {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    padding: 0.15rem 0.3rem;
    z-index: 1;
}
[data-theme="light"] .pro-con-vote-wrap { background: #f1f5f9; border-color: rgba(0,0,0,0.1); }
.pro-con-vote-input {
    background: transparent;
    border: none;
    color: var(--text-1);
    width: 2rem;
    text-align: right;
    font-weight: 700;
    font-size: 0.72rem;
    outline: none;
    font-family: 'Inter', sans-serif;
}
.pro-con-vote-wrap .pct { font-size: 0.6rem; color: var(--text-3); font-weight: 700; }

.pro-con-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 0.4rem;
    padding-top: 0.2rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}
[data-theme="light"] .pro-con-card-footer { border-top-color: rgba(0,0,0,0.06); }
.pro-con-total-label { font-size: 0.6rem; color: var(--text-3); font-weight: 600; }
.pro-con-total-val { font-size: 0.7rem; font-weight: 800; }
.pro-con-tossup-btn {
    flex: 1;
    padding: 0.25rem 0;
    font-size: 0.58rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    border: 1px solid var(--toss);
    background: transparent;
    color: var(--toss);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: var(--transition-fast);
    white-space: nowrap;
    text-align: center;
}
.pro-con-tossup-btn:hover { background: var(--toss-bg); }
.pro-con-tossup-btn.completed {
    background: rgba(251, 191, 36, 0.9);
    color: var(--card-bg);
}
[data-theme="light"] .pro-con-tossup-btn.completed { color: #fff; }

/* Pro nav (old, kept for compat) */
.pro-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.pro-nav select {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-1);
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    outline: none;
    cursor: pointer;
    max-width: 200px;
}

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.animate-in { animation: fadeIn 300ms ease-out; }

/* --- Report (Hidden PDF) --- */
#pdf-report-container {
    position: absolute;
    left: -10000px;
    top: 0;
    width: 800px;
    background: white;
    color: #1f2937;
    padding: 2.5rem;
    font-family: 'Inter', sans-serif;
    z-index: -100;
}
.report-header { text-align: center; border-bottom: 4px solid #1f2937; padding-bottom: 1.5rem; margin-bottom: 2rem; }
.report-header h1 { font-size: 2.25rem; text-transform: uppercase; color: #111827; }
.report-tally { display: flex; gap: 1rem; margin-bottom: 3rem; }
.report-tally-box { flex: 1; text-align: center; padding: 1.5rem; border-radius: 0.75rem; border: 1px solid #e5e7eb; }
.report-dist-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }

/* =====================================================
   NAVIGATION BAR
   ===================================================== */
.nav-bar {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.nav-bar::-webkit-scrollbar { display: none; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.65rem;
    border: none;
    background: transparent;
    color: var(--text-3);
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    white-space: nowrap;
}
.nav-link:hover { background: rgba(255,255,255,0.06); color: var(--text-1); }
[data-theme="light"] .nav-link:hover { background: rgba(0,0,0,0.05); }
.nav-link.active {
    background: rgba(99,102,241,0.15);
    color: var(--accent);
}
.nav-icon { font-size: 0.85rem; }
@media (max-width: 899px) {
    .nav-bar { order: 3; width: 100%; justify-content: center; padding: 0.25rem 0; }
    .app-header { flex-wrap: wrap; }
    .nav-link { padding: 0.3rem 0.5rem; }
}

/* =====================================================
   MAP + TALLY COLUMN WRAPPER (Tracker)
   ===================================================== */
.map-tally-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 0.5rem;
}
@media (min-width: 900px) {
    .map-tally-col {
        position: sticky;
        top: 56px;
        height: calc(100vh - 56px);
        overflow: hidden;
        justify-content: center;
    }
}
@media (max-width: 899px) {
    .map-tally-col { order: 1; }
    .map-tally-col > .tally-panel { order: -1; margin-bottom: 0.5rem; max-width: 340px; padding: 0.8rem 1rem; }
    .map-tally-col > .tally-panel .tp-title { font-size: 0.85rem; }
    .map-tally-col > .tally-panel .tp-progress-badge { font-size: 1rem; }
    .map-tally-col > .tally-panel .tp-front-row { font-size: 0.72rem; }
}

/* =====================================================
   GENERIC PAGE CONTAINER
   ===================================================== */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}
.page-title {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-1);
    margin-bottom: 0.4rem;
}
.page-desc {
    color: var(--text-3);
    font-size: 0.95rem;
    margin-bottom: 2rem;
    max-width: 640px;
}
.section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-1);
    margin: 2.5rem 0 1rem;
}

/* =====================================================
   HOME PAGE
   ===================================================== */
.hero-section {
    text-align: center;
    padding: 4rem 1rem 3rem;
    position: relative;
}
.hero-glow {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(99,102,241,0.18) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}
.hero-title {
    font-family: 'Outfit', sans-serif;
    font-size: 3.2rem;
    font-weight: 900;
    color: var(--text-1);
    line-height: 1.1;
    position: relative;
    z-index: 1;
}
.hero-accent {
    background: linear-gradient(135deg, #6366f1, #a78bfa, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero-subtitle {
    max-width: 620px;
    margin: 1.2rem auto 2rem;
    color: var(--text-3);
    font-size: 1.05rem;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}
.hero-stats {
    display: flex;
    justify-content: center;
    gap: 1.2rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}
.hero-stat-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-lg);
    padding: 1.2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 110px;
    transition: var(--transition-fast);
}
.hero-stat-card:hover { background: rgba(255,255,255,0.08); transform: translateY(-2px); }
[data-theme="light"] .hero-stat-card { background: #f8fafc; border-color: rgba(0,0,0,0.08); }
[data-theme="light"] .hero-stat-card:hover { background: #f0f4f8; }
.hero-stat-num {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent);
}
.hero-stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.hero-cta-row {
    display: flex;
    justify-content: center;
    gap: 1rem;
    position: relative;
    z-index: 1;
}
.hero-cta {
    padding: 0.75rem 2rem;
    border-radius: var(--radius-lg);
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: var(--transition-fast);
}
.hero-cta.primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 20px rgba(99,102,241,0.35);
}
.hero-cta.primary:hover { background: #5855e0; transform: translateY(-2px); }
.hero-cta.secondary {
    background: rgba(255,255,255,0.06);
    color: var(--text-1);
    border: 1px solid rgba(255,255,255,0.15);
}
.hero-cta.secondary:hover { background: rgba(255,255,255,0.12); }
[data-theme="light"] .hero-cta.secondary { background: #f0f4f8; color: var(--text-1); border-color: rgba(0,0,0,0.1); }

/* Features grid */
.home-features { text-align: left; }
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.2rem;
}
.feature-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    cursor: pointer;
    transition: var(--transition-fast);
}
.feature-card:hover { background: rgba(99,102,241,0.08); border-color: rgba(99,102,241,0.2); transform: translateY(-3px); }
[data-theme="light"] .feature-card { background: #fafbfc; border-color: rgba(0,0,0,0.06); }
[data-theme="light"] .feature-card:hover { background: #f0f2ff; }
.feature-icon { font-size: 2rem; display: block; margin-bottom: 0.75rem; }
.feature-card h4 { font-family: 'Outfit', sans-serif; font-weight: 700; color: var(--text-1); margin-bottom: 0.3rem; }
.feature-card p { font-size: 0.82rem; color: var(--text-3); line-height: 1.5; }

/* =====================================================
   ELECTION HISTORY PAGE
   ===================================================== */
.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.2rem;
}
.history-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    transition: var(--transition-fast);
}
.history-card:hover { border-color: rgba(99,102,241,0.2); }
[data-theme="light"] .history-card { background: #fafbfc; border-color: rgba(0,0,0,0.06); }
.history-year {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--accent);
    margin-bottom: 0.5rem;
}
.history-winner { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.hw-label { font-size: 0.72rem; color: var(--text-3); text-transform: uppercase; }
.hw-front { font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 1.2rem; }
.history-cm, .history-turnout { font-size: 0.82rem; color: var(--text-3); margin-bottom: 0.25rem; }
.history-seats { margin-top: 0.75rem; }
.hs-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.35rem; }
.hs-front { width: 50px; font-weight: 700; font-size: 0.75rem; }
.hs-bar-bg { flex: 1; height: 8px; background: rgba(255,255,255,0.08); border-radius: 99px; overflow: hidden; }
[data-theme="light"] .hs-bar-bg { background: rgba(0,0,0,0.06); }
.hs-bar-fill { height: 100%; border-radius: 99px; transition: width 0.5s ease; }
.hs-count { width: 28px; text-align: right; font-weight: 700; font-size: 0.8rem; color: var(--text-2); }

.history-comparison { margin-top: 2rem; }
.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.history-table th, .history-table td {
    padding: 0.65rem 1rem;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
[data-theme="light"] .history-table th,
[data-theme="light"] .history-table td { border-bottom-color: rgba(0,0,0,0.06); }
.history-table th {
    color: var(--text-3);
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.history-table td { color: var(--text-2); }

/* =====================================================
   POPULAR PREDICTIONS PAGE
   ===================================================== */
.pop-summary-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.pop-stat {
    flex: 1;
    min-width: 140px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-lg);
    padding: 1.2rem;
    text-align: center;
}
[data-theme="light"] .pop-stat { background: #fafbfc; border-color: rgba(0,0,0,0.06); }
.pop-num { display: block; font-family: 'Outfit', sans-serif; font-size: 2rem; font-weight: 800; color: var(--accent); }
.pop-label { font-size: 0.72rem; color: var(--text-3); text-transform: uppercase; font-weight: 600; }

.pop-district-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}
.pop-dist-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-md);
}
[data-theme="light"] .pop-dist-card { background: #fafbfc; border-color: rgba(0,0,0,0.05); }
.pop-dist-name { font-weight: 700; font-size: 0.78rem; width: 100px; flex-shrink: 0; }
.pop-dist-bar-bg { flex: 1; height: 6px; background: rgba(255,255,255,0.08); border-radius: 99px; overflow: hidden; }
[data-theme="light"] .pop-dist-bar-bg { background: rgba(0,0,0,0.06); }
.pop-dist-bar-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.4s ease; }
.pop-dist-count { font-size: 0.72rem; color: var(--text-3); width: 30px; text-align: right; }

.pop-recent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.8rem;
}
.pop-recent-card {
    position: relative;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-lg);
    padding: 0.8rem 1rem 0.8rem 1.2rem;
    overflow: hidden;
}
[data-theme="light"] .pop-recent-card { background: #fafbfc; border-color: rgba(0,0,0,0.06); }
.pop-accent { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.pop-ac { font-size: 0.65rem; color: var(--text-3); font-weight: 600; display: block; }
.pop-name { font-weight: 700; font-size: 0.85rem; color: var(--text-1); display: block; }
.pop-winner { font-size: 0.78rem; font-weight: 700; display: block; }
.pop-margin { font-size: 0.65rem; color: var(--text-3); text-transform: uppercase; }

/* =====================================================
   CONTACT PAGE
   ===================================================== */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}
@media (min-width: 768px) {
    .contact-grid { grid-template-columns: 1.5fr 1fr; }
}
.contact-form-wrap {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-xl);
    padding: 2rem;
}
[data-theme="light"] .contact-form-wrap { background: #fafbfc; border-color: rgba(0,0,0,0.06); }
.contact-form { display: flex; flex-direction: column; gap: 1.2rem; }
.form-group { display: flex; flex-direction: column; gap: 0.3rem; }
.form-group label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.form-group input, .form-group select, .form-group textarea {
    padding: 0.65rem 0.9rem;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius-md);
    color: var(--text-1);
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    transition: var(--transition-fast);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
[data-theme="light"] .form-group input,
[data-theme="light"] .form-group select,
[data-theme="light"] .form-group textarea {
    background: #fff;
    border-color: rgba(0,0,0,0.12);
    color: #1f2937;
}
.contact-success {
    text-align: center;
    padding: 3rem 1rem;
}
.success-icon { font-size: 3rem; display: block; margin-bottom: 1rem; }
.contact-success h3 { font-family: 'Outfit', sans-serif; color: var(--text-1); margin-bottom: 0.5rem; }
.contact-success p { color: var(--text-3); margin-bottom: 1.5rem; }

.contact-info {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-xl);
    padding: 2rem;
}
[data-theme="light"] .contact-info { background: #fafbfc; border-color: rgba(0,0,0,0.06); }
.contact-info h4 { font-family: 'Outfit', sans-serif; font-weight: 700; color: var(--text-1); margin-bottom: 0.75rem; }
.contact-info > p { font-size: 0.88rem; color: var(--text-3); line-height: 1.6; margin-bottom: 1.5rem; }
.contact-details { display: flex; flex-direction: column; gap: 0.8rem; }
.contact-item { display: flex; align-items: center; gap: 0.6rem; font-size: 0.85rem; color: var(--text-2); }
.ci-icon { font-size: 1.1rem; }

/* =====================================================
   MINI TRACKER PREVIEW (Homepage)
   ===================================================== */
.home-tracker-preview {
    margin-top: 1rem;
}
.mini-tracker {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    cursor: pointer;
    transition: var(--transition-fast);
    overflow: hidden;
}
.mini-tracker:hover {
    border-color: rgba(99,102,241,0.3);
    background: rgba(99,102,241,0.04);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(99,102,241,0.1);
}
[data-theme="light"] .mini-tracker {
    background: #fafbfc;
    border-color: rgba(0,0,0,0.08);
}
[data-theme="light"] .mini-tracker:hover {
    background: #f5f3ff;
    border-color: rgba(99,102,241,0.2);
}
.mini-tracker-inner {
    display: flex;
    gap: 2rem;
    align-items: center;
}
@media (max-width: 768px) {
    .mini-tracker-inner {
        flex-direction: column;
        gap: 1.2rem;
    }
}
.mini-map-col {
    flex: 0 0 260px;
    max-height: 340px;
    display: flex;
    justify-content: center;
    align-items: center;
}
@media (max-width: 768px) {
    .mini-map-col { flex: none; width: 100%; max-height: 240px; }
}
.mini-map-svg {
    width: 100%;
    height: 100%;
}
.mini-map-svg svg {
    width: 100%;
    max-height: 320px;
    filter: drop-shadow(0 4px 16px rgba(0,0,0,0.25));
}
[data-theme="light"] .mini-map-svg svg {
    filter: drop-shadow(0 2px 10px rgba(0,0,0,0.1));
}
.mini-tally-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}
.mini-tally-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--text-1);
}
.mini-tally-counter {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
}
.mini-counter-num {
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    font-size: 2.5rem;
    color: var(--accent);
    line-height: 1;
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ============================================================
   FOOTER
   =========================================================== */
.site-footer {
    margin-top: auto;
    background: #060b13;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 3rem 1.5rem 1.5rem 1.5rem;
    font-family: 'Inter', sans-serif;
    color: var(--text-2);
}
[data-theme="light"] .site-footer {
    background: #f8fafc;
    border-top: 1px solid rgba(0,0,0,0.06);
    color: var(--text-2);
}
.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}
.footer-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    flex-wrap: wrap;
}
.footer-brand {
    flex: 1;
    min-width: 250px;
    max-width: 400px;
}
.fb-logo {
    font-family: 'Inter', sans-serif;
    font-size: 56px;
    font-weight: 900;
    color: transparent;
    -webkit-text-stroke: 1.5px var(--text-2);
    margin-bottom: 0.75rem;
    letter-spacing: -2px;
    text-transform: uppercase;
    line-height: 0.9;
}
.fb-desc {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-3);
}
.footer-nav {
    display: flex;
    gap: 4rem;
    flex-wrap: wrap;
}
.f-nav-col {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}
.f-nav-col h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-1);
    margin-bottom: 0.2rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.f-nav-col span, .f-nav-col a {
    font-size: 0.85rem;
    color: var(--text-2);
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
}
.f-nav-col span:hover, .f-nav-col a:hover {
    color: var(--accent);
}
.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 1.5rem;
    font-size: 0.75rem;
    color: var(--text-3);
    flex-wrap: wrap;
    gap: 1rem;
}
[data-theme="light"] .footer-bottom { border-top-color: rgba(0,0,0,0.05); }
.fb-links {
    display: flex;
    gap: 1.5rem;
}
.fb-links span {
    cursor: pointer;
    transition: var(--transition-fast);
}
.fb-links span:hover {
    color: var(--text-1);
}

@media (max-width: 768px) {
    .footer-top {
        flex-direction: column;
        gap: 2.5rem;
    }
    .footer-nav {
        width: 100%;
        justify-content: space-between;
        gap: 2rem;
    }
    .footer-bottom {
        flex-direction: column;
        text-align: center;
        justify-content: center;
    }
}

.mini-counter-label {
    font-size: 0.82rem;
    color: var(--text-3);
    font-weight: 600;
}
.mini-tally-bars {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.mini-bar-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.mini-bar-label {
    width: 55px;
    font-weight: 800;
    font-size: 0.78rem;
    flex-shrink: 0;
}
.mini-bar-bg {
    flex: 1;
    height: 10px;
    background: rgba(255,255,255,0.08);
    border-radius: 99px;
    overflow: hidden;
}
[data-theme="light"] .mini-bar-bg {
    background: rgba(0,0,0,0.06);
}
.mini-bar-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.5s ease;
}
.mini-bar-count {
    width: 28px;
    text-align: right;
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--text-2);
}
.mini-cta {
    margin-top: 0.5rem;
    font-size: 0.78rem;
    color: var(--accent);
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* =====================================================
   CANDIDATE PLACEHOLDER (Tracker 4-col)
   ===================================================== */
.candidate-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 2rem 1.5rem;
    text-align: center;
    color: var(--text-3);
}
.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}
.candidate-placeholder p {
    font-size: 0.85rem;
    line-height: 1.5;
    max-width: 220px;
    opacity: 0.6;
}

/* Tracker 4-col: candidate drawer fills column */
.tracker-candidate-col .cand-drawer {
    max-height: none;
    border-top: none;
    animation: none;
    height: 100%;
}
.tracker-candidate-col .drawer-body {
    flex: 1;
    overflow-y: auto;
}

/* =====================================================
   EXPERT MODE 4-COLUMN LAYOUT
   ===================================================== */
@media (min-width: 900px) {
    .expert-4col {
        display: flex;
        flex-direction: row;
        height: calc(100vh - 56px);
    }

    /* Col 1: Tally + District stats */
    .expert-tally-col {
        width: 260px;
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
        padding: 1rem 0.5rem;
        border-right: 1px solid rgba(255,255,255,0.06);
        position: sticky;
        top: 56px;
        height: calc(100vh - 56px);
        overflow-y: auto;
        gap: 0.75rem;
    }
    [data-theme="light"] .expert-tally-col {
        border-right-color: rgba(0,0,0,0.06);
    }
    .expert-tally-col .tally-panel {
        position: static;
        transform: none;
        width: 100%;
        max-width: 240px;
        margin: 0 auto;
    }

    /* Col 2: Map */
    .expert-map-col {
        flex: 1;
        display: flex;
        flex-direction: column;
        position: sticky;
        top: 56px;
        height: calc(100vh - 56px);
        min-width: 0;
    }

    /* Col 3: Constituency cards */
    .expert-cards-col {
        width: 380px;
        flex-shrink: 0;
        position: sticky;
        top: 56px;
        height: calc(100vh - 56px);
        display: flex;
        flex-direction: column;
        border-left: 1px solid rgba(255,255,255,0.06);
        border-right: 1px solid rgba(255,255,255,0.06);
        background: rgba(0,0,0,0.08);
    }
    [data-theme="light"] .expert-cards-col {
        border-color: rgba(0,0,0,0.06);
        background: #fafbfc;
    }

    /* Col 4: District list */
    .expert-district-col {
        width: 260px;
        flex-shrink: 0;
        position: sticky;
        top: 56px;
        height: calc(100vh - 56px);
        display: flex;
        flex-direction: column;
        background: rgba(0,0,0,0.04);
    }
    [data-theme="light"] .expert-district-col {
        background: #ffffff;
    }
}

/* Mobile: stack vertically */
@media (max-width: 899px) {
    .expert-tally-col { padding: 0.75rem; }
    .expert-tally-col .tally-panel {
        position: static;
        transform: none;
        max-width: 400px;
        margin: 0 auto;
    }
    .expert-map-col { min-height: 350px; }
    .expert-cards-col { padding: 0.5rem; }
    .expert-district-col { padding: 0.5rem; }
}

/* Expert state map in col 1 */
.expert-state-map-wrap {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: stretch;
}
.expert-state-map-wrap .pro-state-map-wrap {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    border-radius: 0;
}
[data-theme="light"] .expert-state-map-wrap .pro-state-map-wrap {
    background: transparent;
    border: none;
}

/* Expert map header */
.expert-map-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
[data-theme="light"] .expert-map-header {
    border-bottom-color: rgba(0,0,0,0.06);
}
.expert-map-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-1);
}

/* District selector dropdown */
.expert-district-select {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--text-1);
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.6rem;
    cursor: pointer;
    outline: none;
    appearance: auto;
    transition: var(--transition-fast);
}
[data-theme="light"] .expert-district-select {
    background: #f1f5f9;
    border-color: rgba(0,0,0,0.12);
    color: var(--text-1);
}
.expert-district-select:hover,
.expert-district-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

/* Map constituency tooltip */
.map-tooltip {
    background: var(--card-bg);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius);
    padding: 0.5rem 0.7rem;
    pointer-events: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    min-width: 160px;
    max-width: 260px;
    backdrop-filter: blur(12px);
}
[data-theme="light"] .map-tooltip {
    background: #fff;
    border-color: rgba(0,0,0,0.1);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.map-tooltip-header {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    margin-bottom: 0.2rem;
}
.map-tooltip-ac {
    font-size: 0.55rem;
    font-weight: 700;
    color: var(--text-3);
    letter-spacing: 0.5px;
}
.map-tooltip-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 0.78rem;
    color: var(--text-1);
}
.map-tooltip-pred {
    font-size: 0.62rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}
.map-tooltip-cands {
    display: flex;
    flex-direction: column;
    gap: 1px;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 0.25rem;
}
[data-theme="light"] .map-tooltip-cands {
    border-top-color: rgba(0,0,0,0.06);
}
.map-tooltip-cand {
    font-size: 0.6rem;
    line-height: 1.3;
}
.expert-map-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 0.5rem;
}
.expert-map-area .pro-dist-map-container {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
}
[data-theme="light"] .expert-map-area .pro-dist-map-container {
    background: transparent;
    border: none;
}

/* Expert cards header */
.expert-cards-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
[data-theme="light"] .expert-cards-header {
    border-bottom-color: rgba(0,0,0,0.06);
}
.expert-cards-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--text-1);
}
.expert-cards-count {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-glow);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}
.expert-cards-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Expert district list (Col 4) */
.expert-district-col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--text-1);
}
[data-theme="light"] .expert-district-col-header {
    border-bottom-color: rgba(0,0,0,0.06);
}
.expert-total-badge {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-glow);
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
}
.expert-district-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.3rem 0;
}
.expert-dist-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0.8rem;
    cursor: pointer;
    transition: var(--transition-fast);
    border-left: 3px solid transparent;
}
.expert-dist-item:hover {
    background: rgba(255,255,255,0.03);
}
[data-theme="light"] .expert-dist-item:hover {
    background: rgba(0,0,0,0.02);
}
.expert-dist-item.active {
    background: var(--accent-glow);
    border-left-color: var(--accent);
}
.expert-dist-item.full .edi-name {
    color: #4ade80;
}
.edi-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--text-1);
    flex: 1;
}
.edi-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.edi-bar {
    width: 40px;
    height: 3px;
    border-radius: 99px;
    background: rgba(255,255,255,0.08);
    overflow: hidden;
}
[data-theme="light"] .edi-bar {
    background: rgba(0,0,0,0.06);
}
.edi-bar-fill {
    height: 100%;
    border-radius: 99px;
    background: var(--accent);
    transition: width 0.3s ease;
}
.edi-count {
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--text-3);
    min-width: 24px;
    text-align: right;
}
.edi-chevron {
    font-size: 0.5rem;
    color: var(--text-3);
    transition: transform 0.2s ease;
}
.expert-dist-item.active .edi-chevron {
    color: var(--accent);
    transform: rotate(90deg);
}

/* ============================================================
   EXPERT DASHBOARD — Analytics below tracker
   ============================================================ */
.expert-dashboard {
    max-width: 1440px;
    margin: 2rem auto 4rem;
    padding: 0 1.5rem;
}

/* Header row */
.ed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.ed-header-left { display: flex; align-items: baseline; gap: 0.75rem; }
.ed-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-1);
    margin: 0;
}
.ed-subtitle {
    font-size: 0.7rem;
    color: var(--text-3);
    font-weight: 600;
    background: rgba(255,255,255,0.05);
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
}
.ed-nudge {
    font-size: 0.72rem;
    color: var(--text-3);
    font-style: italic;
}

/* Top grid: Ring + Front Cards */
.ed-top-grid {
    display: flex;
    gap: 1.25rem;
    align-items: stretch;
    margin-bottom: 1.25rem;
}
.ed-ring-card {
    width: 140px;
    flex-shrink: 0;
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.ed-ring { width: 110px; height: 110px; }
.ed-ring-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.ed-ring-num {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 900;
    color: var(--text-1);
    line-height: 1;
}
.ed-ring-of {
    font-size: 0.6rem;
    color: var(--text-3);
    font-weight: 600;
}

/* Front cards */
.ed-front-cards {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
}
.ed-fc {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 0.85rem 0.9rem;
    border: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}
.ed-fc::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--fc-color);
}
.ed-fc:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.ed-fc-head { display: flex; align-items: center; gap: 0.3rem; }
.ed-fc-dot { width: 7px; height: 7px; border-radius: 50%; }
.ed-fc-name {
    font-size: 0.6rem;
    font-weight: 800;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ed-fc-crown { font-size: 0.7rem; margin-left: auto; }
.ed-fc-count {
    font-size: 2.2rem;
    font-weight: 900;
    font-family: 'Outfit', sans-serif;
    color: var(--fc-color);
    line-height: 1.1;
}
.ed-fc-bar {
    height: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: 99px;
    overflow: hidden;
    margin-top: 0.2rem;
}
.ed-fc-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.6s ease;
}
.ed-fc-meta {
    font-size: 0.58rem;
    color: var(--text-3);
    font-weight: 500;
    margin-top: 0.1rem;
}

/* Seat Projection Bar */
.ed-seat-bar-section {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 1rem 1.25rem 1.25rem;
    margin-bottom: 1.25rem;
    border: 1px solid rgba(255,255,255,0.06);
    position: relative;
}
.ed-sbs-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.ed-sbs-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ed-sbs-71 {
    font-size: 0.6rem;
    color: var(--text-3);
    font-weight: 600;
}
.ed-seat-bar {
    display: flex;
    height: 36px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255,255,255,0.04);
}
.ed-sb-seg {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    transition: width 0.6s ease;
    min-width: 0;
}
.ed-sb-pending {
    background: rgba(255,255,255,0.06);
    color: var(--text-3);
    text-shadow: none;
    font-weight: 500;
    font-size: 0.6rem;
}
.ed-majority-line {
    position: absolute;
    bottom: 1.25rem;
    width: 2px;
    height: 36px;
    background: #fff;
    opacity: 0.4;
    pointer-events: none;
}

/* Party Performance Table */
.ed-party-section {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 1rem 1.25rem 0.75rem;
    border: 1px solid rgba(255,255,255,0.06);
}
.ed-party-title {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-1);
    margin: 0 0 0.6rem 0;
}
.ed-party-grid-4col {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 0.5rem;
}
.ed-party-col {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.015);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.75rem;
}
.ed-pc-title {
    font-size: 0.85rem;
    font-weight: 800;
    margin: 0 0 0.5rem 0;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid transparent; 
}
.ed-pc-header {
    display: grid;
    grid-template-columns: 2fr 0.8fr 0.8fr 1fr;
    gap: 0.3rem;
    font-size: 0.55rem;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    margin-bottom: 0.4rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.ed-pc-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.ed-pc-row {
    display: grid;
    grid-template-columns: 2fr 0.8fr 0.8fr 1fr;
    gap: 0.3rem;
    align-items: center;
    padding: 0.25rem 0;
}
.ed-party-empty-small {
    font-size: 0.65rem;
    color: var(--text-3);
    font-style: italic;
    padding: 0.5rem 0;
    text-align: center;
}

.ed-pr-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ed-pr-c, .ed-pr-w {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-2);
    text-align: center;
}
.ed-pr-w { font-weight: 900; font-size: 0.8rem; }
.ed-pr-s {
    font-size: 0.65rem;
    font-weight: 600;
    text-align: right;
}

/* Light theme */
[data-theme="light"] .ed-header { border-bottom-color: rgba(0,0,0,0.06); }
[data-theme="light"] .ed-subtitle { background: rgba(0,0,0,0.04); }
[data-theme="light"] .ed-ring-card,
[data-theme="light"] .ed-fc,
[data-theme="light"] .ed-seat-bar-section,
[data-theme="light"] .ed-party-section { border-color: rgba(0,0,0,0.06); }
[data-theme="light"] .ed-fc:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.08); }
[data-theme="light"] .ed-fc-bar { background: rgba(0,0,0,0.06); }
[data-theme="light"] .ed-seat-bar { background: rgba(0,0,0,0.04); }
[data-theme="light"] .ed-sb-pending { background: rgba(0,0,0,0.06); }
[data-theme="light"] .ed-majority-line { background: #000; }

[data-theme="light"] .ed-party-col {
    background: rgba(0,0,0,0.02);
    border-color: rgba(0,0,0,0.05);
}
[data-theme="light"] .ed-pc-header {
    border-bottom-color: rgba(0,0,0,0.06);
}

/* Responsive */
@media (max-width: 1100px) {
    .ed-party-grid-4col { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .ed-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .ed-top-grid { flex-direction: column; }
    .ed-ring-card { width: 100%; padding: 1rem; }
    .ed-front-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .ed-party-grid-4col { grid-template-columns: 1fr; }
}
.kp-home { width: 100%; }

/* ── HERO ── */
.kp-hero {
    position: relative;
    min-height: 92vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.kp-hero-bg {
    position: absolute; inset: 0;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e, #0f172a, #1e1b4b);
    background-size: 400% 400%;
    animation: kpShift 16s ease infinite;
}
.kp-hero-overlay {
    position: absolute; inset: 0;
    background:
        radial-gradient(ellipse 60% 50% at 20% 80%, rgba(99,102,241,0.25) 0%, transparent 70%),
        radial-gradient(ellipse 50% 40% at 80% 20%, rgba(168,85,247,0.2) 0%, transparent 70%),
        radial-gradient(ellipse 40% 60% at 50% 50%, rgba(56,189,248,0.08) 0%, transparent 60%);
    pointer-events: none;
}
.kp-hero-content {
    position: relative; z-index: 1;
    text-align: center;
    max-width: 860px;
    padding: 3rem 2rem;
}
.kp-hero-badge {
    display: inline-block;
    padding: 0.5rem 1.4rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    backdrop-filter: blur(8px);
    font-size: 0.82rem;
    font-weight: 700;
    color: #c4b5fd;
    letter-spacing: 0.04em;
    margin-bottom: 2rem;
}
.kp-hero-h1 {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(2.5rem, 5vw, 4.2rem);
    font-weight: 900;
    color: #f1f5f9;
    line-height: 1.12;
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
}
.kp-gradient-text {
    background: linear-gradient(135deg, #818cf8, #c084fc, #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.kp-hero-sub {
    font-size: 1.15rem;
    line-height: 1.75;
    color: #94a3b8;
    max-width: 680px;
    margin: 0 auto 2.5rem;
}
.kp-hero-btns {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 3rem;
}

/* Shared button base */
.kp-btn {
    padding: 0.85rem 2.2rem;
    border-radius: 14px;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: all 0.25s cubic-bezier(.4,0,.2,1);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.kp-btn-icon { font-size: 1.15rem; }

.kp-btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    box-shadow: 0 4px 24px rgba(99,102,241,0.4), inset 0 1px 0 rgba(255,255,255,0.1);
}
.kp-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(99,102,241,0.55), inset 0 1px 0 rgba(255,255,255,0.15);
}
.kp-btn-ghost {
    background: rgba(255,255,255,0.05);
    color: #e2e8f0;
    border: 1px solid rgba(255,255,255,0.15);
    backdrop-filter: blur(4px);
}
.kp-btn-ghost:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}
.kp-btn-gold {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #1c1917;
    font-weight: 800;
    box-shadow: 0 4px 20px rgba(245,158,11,0.35);
}
.kp-btn-gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(245,158,11,0.5);
}
.kp-btn-full { width: 100%; justify-content: center; }
.kp-btn-lg { padding: 1.1rem 3rem; font-size: 1.15rem; border-radius: 16px; }

/* Hero stat pills */
.kp-hero-pills {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}
.kp-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.8rem 1.4rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    backdrop-filter: blur(6px);
    min-width: 100px;
    transition: all 0.25s ease;
    animation: kpFloat 4s ease-in-out infinite;
}
.kp-pill:nth-child(2) { animation-delay: 0.5s; }
.kp-pill:nth-child(3) { animation-delay: 1s; }
.kp-pill:nth-child(4) { animation-delay: 1.5s; }
.kp-pill:hover { background: rgba(255,255,255,0.08); transform: translateY(-4px) !important; }
.kp-pill-accent { border-color: rgba(99,102,241,0.3); background: rgba(99,102,241,0.08); }
.kp-pill-num {
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem; font-weight: 900;
    color: #e2e8f0;
}
.kp-pill-accent .kp-pill-num { color: #a78bfa; }
.kp-pill-lbl {
    font-size: 0.65rem; font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── ABOUT ── */
.kp-about {
    padding: 6rem 2rem;
    background: linear-gradient(180deg, #1e1b4b 0%, #0f0c29 100%);
}
.kp-about-inner {
    max-width: 740px;
    margin: 0 auto;
    text-align: center;
}
.kp-about-badge {
    display: inline-block;
    padding: 0.4rem 1.2rem;
    border-radius: 999px;
    background: rgba(34,197,94,0.08);
    border: 1px solid rgba(34,197,94,0.2);
    color: #4ade80;
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}
.kp-section-h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    font-weight: 900;
    color: #f1f5f9;
    margin-bottom: 1.5rem;
    letter-spacing: -0.01em;
}
.kp-center { text-align: center; }
.kp-about-inner p {
    font-size: 1.08rem;
    line-height: 1.85;
    color: #94a3b8;
    margin-bottom: 1rem;
}
.kp-about-inner strong { color: #e2e8f0; }
.kp-about-inner em { color: #c084fc; font-style: italic; }

/* ── GAME MODES ── */
.kp-modes {
    padding: 6rem 2rem;
    background: linear-gradient(180deg, #0f0c29 0%, #171030 100%);
}
.kp-modes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 2rem;
    max-width: 960px;
    margin: 2rem auto 0;
}
.kp-mode-card {
    position: relative;
    overflow: hidden;
    border-radius: 24px;
    padding: 2.5rem 2rem;
    background: rgba(15,23,42,0.6);
    border: 1px solid rgba(255,255,255,0.06);
    backdrop-filter: blur(10px);
    transition: all 0.35s cubic-bezier(.4,0,.2,1);
    display: flex;
    flex-direction: column;
}
.kp-mode-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 60px -15px rgba(0,0,0,0.6);
}
.kp-mode-classic:hover { border-color: rgba(56,189,248,0.35); }
.kp-mode-expert:hover { border-color: rgba(250,204,21,0.35); }

.kp-mode-glow {
    position: absolute; top: -60px; right: -60px;
    width: 200px; height: 200px;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.15;
    pointer-events: none;
}
.kp-glow-blue { background: #38bdf8; }
.kp-glow-gold { background: #facc15; }

.kp-mode-badge {
    display: inline-block;
    width: fit-content;
    padding: 0.3rem 0.9rem;
    border-radius: 999px;
    background: rgba(56,189,248,0.12);
    border: 1px solid rgba(56,189,248,0.25);
    color: #38bdf8;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    margin-bottom: 1rem;
}
.kp-badge-gold {
    background: rgba(250,204,21,0.1);
    border-color: rgba(250,204,21,0.25);
    color: #facc15;
}
.kp-mode-icon { font-size: 3rem; margin-bottom: 0.8rem; }
.kp-mode-card h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.75rem;
    font-weight: 800;
    color: #f1f5f9;
    margin-bottom: 0.75rem;
}
.kp-mode-for {
    color: #94a3b8;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 0.75rem;
}
.kp-mode-for strong { color: #e2e8f0; }
.kp-mode-card > p {
    color: #64748b;
    font-size: 0.88rem;
    line-height: 1.65;
    margin-bottom: 1.5rem;
}
.kp-mode-card > p em { color: #c084fc; }
.kp-mode-checklist {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.kp-mode-checklist li {
    font-size: 0.82rem;
    color: #94a3b8;
    font-weight: 600;
    padding-left: 0.3rem;
}

/* ── COUNTDOWN ── */
.kp-countdown {
    padding: 5rem 2rem;
    background: linear-gradient(180deg, #171030 0%, #0f172a 100%);
    position: relative;
    overflow: hidden;
}
.kp-countdown::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(99,102,241,0.15), transparent 60%);
    pointer-events: none;
}
.kp-countdown-inner {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}
.kp-countdown-text h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.4rem;
    font-weight: 900;
    color: #fff;
    margin-bottom: 0.75rem;
}
.kp-countdown-text p {
    font-size: 1.1rem;
    color: #e0e7ff;
    margin-bottom: 2.5rem;
}
.kp-timer {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    align-items: center;
    margin-bottom: 2rem;
}
.kp-timer-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 1.2rem 1.4rem;
    min-width: 80px;
    backdrop-filter: blur(8px);
}
.kp-timer-num {
    font-family: 'Outfit', sans-serif;
    font-size: 2.8rem;
    font-weight: 900;
    color: #fff;
    line-height: 1;
    text-shadow: 0 0 20px rgba(129,140,248,0.5);
}
.kp-timer-lbl {
    font-size: 0.65rem;
    font-weight: 700;
    color: #a5b4fc;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 0.4rem;
}
.kp-timer-sep {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    font-weight: 900;
    color: rgba(255,255,255,0.3);
    animation: kpPulse 1s ease-in-out infinite;
    margin-bottom: 1rem;
}
.kp-deadline-tag {
    display: inline-block;
    padding: 0.6rem 1.6rem;
    border-radius: 999px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.12);
    color: #a5b4fc;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

/* ── WHY PARTICIPATE ── */
.kp-why {
    padding: 6rem 2rem;
    background: linear-gradient(180deg, #0f172a 0%, #020617 100%);
}
.kp-why-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    max-width: 960px;
    margin: 2rem auto 0;
}
.kp-why-card {
    text-align: center;
    padding: 2.5rem 1.5rem;
    border-radius: 20px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    transition: all 0.3s ease;
}
.kp-why-card:hover {
    background: rgba(99,102,241,0.06);
    border-color: rgba(99,102,241,0.15);
    transform: translateY(-4px);
}
.kp-why-icon { font-size: 3.5rem; margin-bottom: 1rem; display: block; }
.kp-why-card h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 800;
    color: #f1f5f9;
    margin-bottom: 0.5rem;
}
.kp-why-card p {
    font-size: 0.9rem;
    line-height: 1.65;
    color: #64748b;
}

/* ── FINAL CTA ── */
.kp-final {
    position: relative;
    padding: 7rem 2rem;
    background: #020617;
    text-align: center;
    overflow: hidden;
}
.kp-final-glow {
    position: absolute;
    bottom: -100px; left: 50%;
    transform: translateX(-50%);
    width: 600px; height: 400px;
    background: radial-gradient(circle, rgba(99,102,241,0.15) 0%, transparent 70%);
    pointer-events: none;
}
.kp-final h2 {
    position: relative;
    font-family: 'Outfit', sans-serif;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 900;
    color: #f1f5f9;
    margin-bottom: 2.5rem;
    line-height: 1.2;
}
.kp-final-links {
    margin-top: 2.5rem;
    font-size: 0.95rem;
    color: #475569;
}
.kp-link {
    color: #818cf8;
    cursor: pointer;
    font-weight: 600;
    transition: color 0.2s;
}
.kp-link:hover { color: #a78bfa; text-decoration: underline; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .kp-hero { min-height: 80vh; }
    .kp-hero-h1 { font-size: 2.2rem; }
    .kp-hero-pills { gap: 0.5rem; }
    .kp-pill { min-width: 70px; padding: 0.6rem 0.8rem; }
    .kp-pill-num { font-size: 1.2rem; }
    .kp-modes-grid { grid-template-columns: 1fr; }
    .kp-timer-unit { min-width: 60px; padding: 0.8rem; }
    .kp-timer-num { font-size: 2rem; }
    .kp-section-h2 { font-size: 1.75rem; }
}

/* =====================================================
   HOMEPAGE — LIGHT MODE OVERRIDES
   ===================================================== */

/* ── HERO — Light Mode: clean white/cream with vibrant accents ── */
[data-theme="light"] .kp-hero-bg {
    background: linear-gradient(160deg, #f8faff 0%, #eef2ff 40%, #f0fdf4 100%);
    background-size: 100% 100%;
    animation: none;
}
[data-theme="light"] .kp-hero-overlay {
    background:
        radial-gradient(ellipse 55% 50% at 0% 100%, rgba(99,102,241,0.12) 0%, transparent 65%),
        radial-gradient(ellipse 45% 40% at 100% 0%, rgba(139,92,246,0.1) 0%, transparent 65%),
        radial-gradient(ellipse 35% 35% at 50% 50%, rgba(56,189,248,0.06) 0%, transparent 60%);
}
/* Hero heading — deep navy for strong contrast on white */
[data-theme="light"] .kp-hero-h1 { color: #0f172a; }
[data-theme="light"] .kp-hero-sub { color: #475569; }
[data-theme="light"] .kp-hero-badge {
    background: rgba(99,102,241,0.08);
    border-color: rgba(99,102,241,0.2);
    color: #4338ca;
}
/* Stat pills — crisp white cards */
[data-theme="light"] .kp-pill {
    background: rgba(255,255,255,0.85);
    border-color: rgba(0,0,0,0.08);
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
[data-theme="light"] .kp-pill:hover {
    background: #fff;
    box-shadow: 0 4px 20px rgba(99,102,241,0.15);
    border-color: rgba(99,102,241,0.2);
    transform: translateY(-4px) !important;
}
[data-theme="light"] .kp-pill-accent {
    background: rgba(99,102,241,0.06);
    border-color: rgba(99,102,241,0.18);
}
[data-theme="light"] .kp-pill-num { color: #1e293b; }
[data-theme="light"] .kp-pill-accent .kp-pill-num { color: #4f46e5; }
[data-theme="light"] .kp-pill-lbl { color: #94a3b8; }

/* Ghost button — dark outline on white background */
[data-theme="light"] .kp-btn-ghost {
    background: rgba(255,255,255,0.9);
    color: #1e293b;
    border-color: rgba(0,0,0,0.15);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
[data-theme="light"] .kp-btn-ghost:hover {
    background: #fff;
    border-color: rgba(99,102,241,0.4);
    color: #4338ca;
}

/* Gradient text — vivid indigo→violet→cyan on white */
[data-theme="light"] .kp-gradient-text {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #0ea5e9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* About section */
[data-theme="light"] .kp-about {
    background: linear-gradient(180deg, #f1f5f9 0%, #e8eef5 100%);
}
[data-theme="light"] .kp-section-h2 { color: #0f172a; }
[data-theme="light"] .kp-about-inner p { color: #475569; }
[data-theme="light"] .kp-about-inner strong { color: #1e293b; }
[data-theme="light"] .kp-about-inner em { color: #7c3aed; }
[data-theme="light"] .kp-about-badge {
    background: rgba(34,197,94,0.08);
    border-color: rgba(34,197,94,0.25);
    color: #15803d;
}

/* Game Mode / Battle section */
[data-theme="light"] .kp-modes {
    background: linear-gradient(180deg, #e8eef5 0%, #f1f5f9 100%);
}
[data-theme="light"] .kp-mode-card {
    background: rgba(255,255,255,0.85);
    border-color: rgba(0,0,0,0.08);
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}
[data-theme="light"] .kp-mode-card:hover {
    box-shadow: 0 16px 48px rgba(0,0,0,0.12);
}
[data-theme="light"] .kp-mode-classic:hover { border-color: rgba(56,189,248,0.4); }
[data-theme="light"] .kp-mode-expert:hover { border-color: rgba(245,158,11,0.4); }
[data-theme="light"] .kp-mode-card h3 { color: #0f172a; }
[data-theme="light"] .kp-mode-for { color: #475569; }
[data-theme="light"] .kp-mode-for strong { color: #1e293b; }
[data-theme="light"] .kp-mode-card > p { color: #64748b; }
[data-theme="light"] .kp-mode-card > p em { color: #7c3aed; }
[data-theme="light"] .kp-mode-checklist li { color: #475569; }
[data-theme="light"] .kp-mode-badge {
    background: rgba(14,165,233,0.08);
    border-color: rgba(14,165,233,0.25);
    color: #0284c7;
}
[data-theme="light"] .kp-badge-gold {
    background: rgba(217,119,6,0.08);
    border-color: rgba(217,119,6,0.25);
    color: #b45309;
}

/* Countdown section */
[data-theme="light"] .kp-countdown {
    background: linear-gradient(180deg, #f1f5f9 0%, #e8eef5 100%);
}
[data-theme="light"] .kp-countdown::before {
    background: radial-gradient(ellipse at 50% 0%, rgba(99,102,241,0.1), transparent 60%);
}
[data-theme="light"] .kp-countdown-text h2 { color: #0f172a; }
[data-theme="light"] .kp-countdown-text p { color: #475569; }
[data-theme="light"] .kp-timer-unit {
    background: rgba(255,255,255,0.8);
    border-color: rgba(0,0,0,0.08);
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
[data-theme="light"] .kp-timer-num {
    color: #1e1b4b;
    text-shadow: 0 0 20px rgba(99,102,241,0.2);
}
[data-theme="light"] .kp-timer-lbl { color: #6366f1; }
[data-theme="light"] .kp-timer-sep { color: rgba(0,0,0,0.3); }
[data-theme="light"] .kp-deadline-tag {
    background: rgba(255,255,255,0.7);
    border-color: rgba(0,0,0,0.1);
    color: #4338ca;
}

/* Final CTA section */
[data-theme="light"] .kp-final {
    background: #f1f5f9;
}
[data-theme="light"] .kp-final-glow {
    background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 70%);
}
[data-theme="light"] .kp-final h2 { color: #0f172a; }
[data-theme="light"] .kp-final-links { color: #64748b; }
[data-theme="light"] .kp-link { color: #4f46e5; }
[data-theme="light"] .kp-link:hover { color: #4338ca; }

/* Gradient text — keep working in light mode */
[data-theme="light"] .kp-gradient-text {
    background: linear-gradient(135deg, #4f46e5, #7c3aed, #0ea5e9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================
   Mobile Navigation Overlay
   ============================ */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-1);
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1100;
}
.mobile-nav-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(12, 18, 32, 0.95);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding-top: 7rem; /* Clear the header */
    padding-bottom: 3rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
[data-theme="light"] .mobile-nav-overlay {
    background: rgba(248, 250, 252, 0.95);
}
.mobile-nav-overlay.open {
    opacity: 1;
    pointer-events: auto;
}
.mobile-nav-links {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
    align-items: center;
}
.mobile-nav-link {
    background: none;
    border: none;
    color: var(--text-2);
    font-size: 1.8rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: 'Outfit', sans-serif;
}
.mobile-nav-link.active {
    color: var(--accent);
}
.mobile-theme-actions {
    margin-top: auto;
    width: 100%;
    display: flex;
    justify-content: center;
}
@media (max-width: 900px) {
    .desktop-nav { display: none !important; }
    .mobile-menu-btn { display: block; }
}
