:root {
    --green-dark: #12372a;
    --green: #2f7d32;
    --green-soft: #e9f6ec;
    --cream: #fbfaf3;
    --text: #25352d;
    --muted: #6b7c72;
}

body {
    background: var(--cream);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.navbar {
    background: rgba(251, 250, 243, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(18, 55, 42, 0.08);
}

.navbar-brand {
    color: var(--green-dark);
    letter-spacing: -0.03em;
}

.hero {
    padding: 72px 0;
    background:
            radial-gradient(circle at top left, rgba(47, 125, 50, 0.18), transparent 35%),
            linear-gradient(135deg, #f7fff4, #fbfaf3);
}

.eyebrow {
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.8rem;
    font-weight: 700;
}

.hero h1 {
    font-size: clamp(2.2rem, 5vw, 4.5rem);
    font-weight: 800;
    color: var(--green-dark);
    line-height: 1.05;
    letter-spacing: -0.06em;
}

.hero-text {
    max-width: 640px;
    color: var(--muted);
    font-size: 1.1rem;
    margin-top: 18px;
}

.search-box {
    margin-top: 28px;
    background: white;
    border-radius: 18px;
    padding: 14px 18px;
    max-width: 520px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 18px 40px rgba(18, 55, 42, 0.1);
}

.search-box input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 1rem;
}

.search-box i {
    color: var(--green);
}

.hero-card {
    background: white;
    border-radius: 28px;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(18, 55, 42, 0.12);
    display: flex;
    gap: 22px;
    align-items: center;
}

.score-circle {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: conic-gradient(var(--green) 72%, #dcebdd 0);
    display: grid;
    place-items: center;
    position: relative;
    flex-shrink: 0;
}

.score-circle::after {
    content: "";
    width: 96px;
    height: 96px;
    background: white;
    border-radius: 50%;
    position: absolute;
}

.score-circle span,
.score-circle small {
    position: relative;
    z-index: 1;
    display: block;
    text-align: center;
}

.score-circle span {
    font-size: 2rem;
    font-weight: 800;
    color: var(--green-dark);
}

.score-circle small {
    font-size: 0.7rem;
    color: var(--muted);
}

.stat-card,
.data-card {
    background: white;
    border: 1px solid rgba(18, 55, 42, 0.08);
    border-radius: 24px;
    padding: 22px;
    height: 100%;
    box-shadow: 0 12px 32px rgba(18, 55, 42, 0.06);
}

.stat-card i {
    font-size: 1.5rem;
    color: var(--green);
}

.stat-card h3 {
    font-weight: 800;
    margin: 10px 0 2px;
}

.stat-card p,
.data-card p,
.section-heading p {
    color: var(--muted);
    margin-bottom: 0;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: end;
    margin-bottom: 20px;
}

.section-heading h2 {
    font-weight: 800;
    color: var(--green-dark);
}

.data-card {
    cursor: pointer;
    transition: all 0.2s ease;
}

.data-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 42px rgba(18, 55, 42, 0.12);
}

.card-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.index-badge {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    font-weight: 800;
    color: white;
    background: var(--green);
    transition: background 0.3s;
}

.index-badge[data-state] {
    cursor: help;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 18px;
}

.meta-item {
    background: var(--green-soft);
    border-radius: 16px;
    padding: 12px;
}

.meta-item small {
    display: block;
    color: var(--muted);
}

.meta-item strong {
    color: var(--green-dark);
}

.trend {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--green);
}

footer {
    padding: 28px 0;
    background: var(--green-dark);
    color: rgba(255,255,255,0.75);
    margin-top: 64px;
}

/* ── Map panel ─────────────────────────────────────────────────────────── */

#mapPanel {
    width: 100%;
}

#map {
    width: 100%;
    height: 620px;
    background: #f0f4f0;
}

/* Leaflet tooltip override */
.map-tooltip {
    background: rgba(15, 28, 18, 0.93);
    border: none;
    border-radius: 10px;
    padding: 12px 15px;
    color: #fff;
    font-size: 13px;
    min-width: 190px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.35);
}

.map-tooltip::before { display: none; }

.tt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.tt-name  { font-weight: 700; font-size: 14px; }

.tt-score {
    font-weight: 800;
    font-size: 13px;
    padding: 3px 9px;
    border-radius: 6px;
    flex-shrink: 0;
}

.tt-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
    color: rgba(255,255,255,0.8);
    margin-top: 4px;
}

/* Legend */
.map-legend {
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(8px);
    padding: 12px 15px;
    border-radius: 12px;
    box-shadow: 0 3px 16px rgba(0,0,0,0.14);
    font-size: 12px;
    line-height: 1.5;
}

.legend-title {
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #444;
    margin-bottom: 8px;
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.legend-swatch {
    display: inline-block;
    width: 16px;
    height: 13px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.08);
    flex-shrink: 0;
}

/* ── View tabs ─────────────────────────────────────────────────────────── */

.view-tabs {
    display: inline-flex;
    gap: 3px;
    background: #edf3ee;
    padding: 4px;
    border-radius: 12px;
}

.view-tab {
    border: none;
    background: transparent;
    padding: 7px 20px;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.18s;
}

.view-tab.active {
    background: white;
    color: var(--green-dark);
    box-shadow: 0 1px 6px rgba(18,55,42,0.12);
}

.view-tab:hover:not(.active) {
    color: var(--green-dark);
}

/* ── Loading overlay ───────────────────────────────────────────────────── */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(251, 250, 243, 0.9);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    z-index: 9999;
    font-size: 16px;
    font-weight: 500;
    color: var(--green-dark);
}

/* ── Footer link ───────────────────────────────────────────────────────── */

.footer-link,
footer a {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
}

.footer-link:hover,
footer a:hover {
    color: rgba(255,255,255,0.9);
}

/* ── No-click district cards ───────────────────────────────────────────── */

.data-card.no-click {
    cursor: default;
}

.data-card.no-click:hover {
    transform: none;
    box-shadow: 0 12px 32px rgba(18,55,42,0.06);
}

/* ── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .hero {
        padding: 44px 0;
    }

    .hero-card {
        flex-direction: column;
        text-align: center;
    }

    .section-heading {
        align-items: start;
        flex-direction: column;
    }

    .meta-grid {
        grid-template-columns: 1fr;
    }

    #map {
        height: 420px;
    }
}