:root {
    color-scheme: dark;

    --bg: #04100c;
    --bg-soft: #071812;
    --surface: rgba(12, 30, 23, 0.72);
    --surface-strong: rgba(16, 39, 30, 0.9);
    --surface-hover: rgba(22, 52, 40, 0.92);

    --border: rgba(142, 255, 194, 0.11);
    --border-strong: rgba(142, 255, 194, 0.22);

    --text: #effff5;
    --text-soft: #c7dfd2;
    --muted: #82a493;

    --accent: #63e6a4;
    --accent-strong: #36d887;
    --accent-soft: rgba(99, 230, 164, 0.12);
    --accent-glow: rgba(99, 230, 164, 0.32);

    --blue: #57b8ff;
    --blue-soft: rgba(87, 184, 255, 0.17);

    --danger: #ff7888;
    --danger-soft: rgba(255, 120, 136, 0.12);

    --warning: #ffd166;
    --warning-soft: rgba(255, 209, 102, 0.11);

    --shadow-lg: 0 28px 90px rgba(0, 0, 0, 0.38);
    --shadow-md: 0 18px 55px rgba(0, 0, 0, 0.28);

    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 17px;

    --transition: 180ms ease;
}

/* ==========================================
   RESET
========================================== */

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;

    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    color: var(--text);

    background:
        radial-gradient(circle at 10% 5%, rgba(99, 230, 164, 0.10), transparent 30%),
        radial-gradient(circle at 95% 16%, rgba(87, 184, 255, 0.09), transparent 28%),
        linear-gradient(145deg, #04100c 0%, #071812 45%, #030a07 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -4;

    background:
        linear-gradient(rgba(255,255,255,0.008) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.008) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,.8), transparent 85%);
}

p,
h1,
h2 {
    margin-top: 0;
}

/* ==========================================
   BACKGROUND DECORATION
========================================== */

.background-orb {
    position: fixed;
    border-radius: 999px;
    filter: blur(90px);
    pointer-events: none;
    z-index: -3;
}

.background-orb-one {
    width: 380px;
    height: 380px;
    top: -120px;
    left: -80px;
    background: rgba(99, 230, 164, 0.13);
}

.background-orb-two {
    width: 430px;
    height: 430px;
    right: -170px;
    top: 170px;
    background: rgba(87, 184, 255, 0.09);
}

/* ==========================================
   GENERAL LAYOUT
========================================== */

.page-shell {
    width: min(1480px, calc(100% - 40px));
    margin: 0 auto;
    padding: 34px 0 26px;
}

.glass-panel {
    border: 1px solid var(--border);
    background:
        linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.035),
            rgba(255, 255, 255, 0.012)
        ),
        var(--surface);

    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.025),
        var(--shadow-md);

    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.eyebrow {
    margin-bottom: 8px;
    color: var(--accent);
    font-size: 0.71rem;
    font-weight: 850;
    letter-spacing: 0.18em;
}

h1 {
    margin-bottom: 4px;
    font-size: clamp(2.5rem, 5vw, 4.8rem);
    line-height: .95;
    letter-spacing: -0.065em;
}

h2 {
    margin-bottom: 0;
    font-size: clamp(1.35rem, 2.3vw, 2rem);
    line-height: 1.08;
    letter-spacing: -0.035em;
}

/* ==========================================
   HERO
========================================== */

.hero {
    position: relative;
    overflow: hidden;

    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 32px;

    min-height: 280px;
    margin-bottom: 18px;
    padding: 34px;

    border-radius: var(--radius-xl);
}

.hero::after {
    content: "";
    position: absolute;
    width: 360px;
    height: 360px;
    right: -110px;
    bottom: -190px;

    border: 1px solid rgba(99, 230, 164, 0.12);
    border-radius: 50%;
    box-shadow:
        0 0 0 36px rgba(99, 230, 164, 0.025),
        0 0 0 74px rgba(99, 230, 164, 0.018);
}

.hero-copy {
    position: relative;
    z-index: 1;
    flex: 1;
}

.brand-row {
    display: flex;
    align-items: center;
    gap: 18px;
}

.brand-icon {
    position: relative;
    flex: 0 0 auto;

    display: grid;
    place-items: center;

    width: 68px;
    height: 68px;

    border: 1px solid var(--border-strong);
    border-radius: 20px;
    background: rgba(99, 230, 164, 0.07);
    box-shadow: 0 0 35px rgba(99, 230, 164, 0.12);
}

.brand-ring,
.brand-core {
    position: absolute;
    border-radius: 50%;
}

.brand-ring {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(99, 230, 164, 0.55);
    animation: spin 12s linear infinite;
}

.brand-ring::before {
    content: "";
    position: absolute;
    width: 6px;
    height: 6px;
    top: -3px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 14px var(--accent-glow);
}

.brand-core {
    width: 11px;
    height: 11px;
    background: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.hero-description {
    max-width: 760px;
    margin: 24px 0 26px;
    color: var(--text-soft);
    font-size: clamp(1rem, 1.5vw, 1.18rem);
    line-height: 1.7;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.meta-item {
    min-width: 160px;
    padding: 13px 15px;

    border: 1px solid var(--border);
    border-radius: 14px;

    background: rgba(4, 16, 12, 0.34);
}

.meta-label {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: .68rem;
    font-weight: 780;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.meta-item strong {
    color: var(--text);
    font-size: .9rem;
}

.hero-status {
    position: relative;
    z-index: 1;

    display: flex;
    align-items: flex-start;
    justify-content: flex-end;

    min-width: 220px;
}

/* ==========================================
   RELAY STATUS
========================================== */

.status-card {
    display: flex;
    align-items: center;
    gap: 14px;

    min-width: 190px;
    padding: 16px 18px;

    border: 1px solid var(--border);
    border-radius: 17px;
    background: rgba(4, 16, 12, 0.42);
}

.status-indicator {
    position: relative;
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
}

.status-dot,
.status-pulse {
    position: absolute;
    border-radius: 50%;
}

.status-dot {
    width: 10px;
    height: 10px;
}

.status-pulse {
    width: 18px;
    height: 18px;
    opacity: .55;
    animation: statusPulse 1.9s ease-out infinite;
}

@keyframes statusPulse {
    0% {
        transform: scale(.65);
        opacity: .65;
    }

    70%,
    100% {
        transform: scale(1.75);
        opacity: 0;
    }
}

.status-label {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: .68rem;
    font-weight: 760;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.status-card strong {
    font-size: 1rem;
    letter-spacing: .04em;
}

.status-loading {
    color: var(--warning);
    background: var(--warning-soft);
}

.status-loading .status-dot,
.status-loading .status-pulse {
    background: var(--warning);
}

.status-online {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: var(--border-strong);
}

.status-online .status-dot,
.status-online .status-pulse {
    background: var(--accent);
}

.status-offline {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: rgba(255, 120, 136, 0.2);
}

.status-offline .status-dot,
.status-offline .status-pulse {
    background: var(--danger);
}

/* ==========================================
   METRICS
========================================== */

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.metric-card {
    position: relative;
    overflow: hidden;

    min-height: 184px;
    padding: 23px;

    border-radius: var(--radius-lg);

    transition:
        transform var(--transition),
        border-color var(--transition),
        background var(--transition);
}

.metric-card::after {
    content: "";
    position: absolute;
    width: 120px;
    height: 120px;
    right: -65px;
    top: -65px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 230, 164, 0.11), transparent 70%);
}

.metric-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-strong);
    background-color: var(--surface-hover);
}

.metric-highlight {
    background:
        linear-gradient(145deg, rgba(99, 230, 164, 0.15), rgba(12, 30, 23, 0.73));
}

.metric-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.metric-label {
    margin-bottom: 0;
    color: var(--muted);
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.metric-icon {
    display: grid;
    place-items: center;

    width: 32px;
    height: 32px;

    border: 1px solid var(--border);
    border-radius: 11px;

    color: var(--accent);
    background: rgba(99, 230, 164, 0.08);

    font-size: .8rem;
    font-weight: 850;
}

.metric-value {
    margin: 26px 0 8px;
    font-size: clamp(2.4rem, 5vw, 4.25rem);
    font-weight: 790;
    line-height: .9;
    letter-spacing: -0.065em;

    transition: opacity 120ms ease, transform 120ms ease;
}

.metric-value.is-changing {
    opacity: .45;
    transform: translateY(4px);
}

.metric-description {
    margin-bottom: 0;
    color: var(--muted);
    font-size: .8rem;
}

/* ==========================================
   DASHBOARD GRID
========================================== */

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.75fr) minmax(310px, .75fr);
    gap: 16px;
    margin-bottom: 16px;
}

.chart-card,
.traffic-card,
.map-card,
.countries-card {
    border-radius: var(--radius-xl);
}

.chart-card,
.traffic-card,
.map-card,
.countries-card {
    padding: 25px;
}

.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.section-header.compact {
    margin-bottom: 26px;
}

.section-description {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: .82rem;
    line-height: 1.55;
}

.live-chip,
.coming-soon {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    padding: 8px 11px;

    border: 1px solid var(--border);
    border-radius: 999px;

    color: var(--accent);
    background: var(--accent-soft);

    font-size: .66rem;
    font-weight: 850;
    letter-spacing: .1em;
    white-space: nowrap;
}

.live-chip-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
    animation: livePulse 1.6s ease-in-out infinite;
}

@keyframes livePulse {
    50% {
        transform: scale(.75);
        opacity: .6;
    }
}

.countries-card .section-header {
    display: block;
    margin-bottom: 22px;
}

.countries-card .coming-soon,
.countries-card .live-chip {
    float: right;
}

.countries-card h2 {
    margin-top: 6px;
    margin-bottom: 0;
}

.countries-list {
    margin-top: 0;
}

/* ==========================================
   CHART
========================================== */

.chart-wrapper {
    position: relative;
    min-height: 360px;
}

#connections-chart {
    width: 100% !important;
    height: 360px !important;
}

.chart-message {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;

    color: var(--muted);
    font-size: .88rem;
}

/* ==========================================
   TRAFFIC
========================================== */

.traffic-total {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;

    margin-bottom: 28px;
    padding-bottom: 22px;

    border-bottom: 1px solid var(--border);
}

.traffic-total span {
    color: var(--muted);
    font-size: .8rem;
}

.traffic-total strong {
    font-size: 1.85rem;
    letter-spacing: -.05em;
}

.traffic-item {
    margin-bottom: 27px;
}

.traffic-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 11px;
}

.traffic-header > div {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--text-soft);
    font-size: .84rem;
    font-weight: 670;
}

.traffic-header strong {
    font-size: .9rem;
}

.traffic-direction {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.inbound-dot {
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.outbound-dot {
    background: var(--blue);
    box-shadow: 0 0 10px rgba(87, 184, 255, 0.33);
}

.progress-track {
    overflow: hidden;
    height: 11px;

    border: 1px solid var(--border);
    border-radius: 999px;

    background: rgba(4, 16, 12, .58);
}

.progress-bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    transition: width 900ms cubic-bezier(.22, .8, .3, 1);
}

.inbound-bar {
    background: linear-gradient(90deg, #36d887, #72efb1);
    box-shadow: 0 0 18px rgba(99, 230, 164, .2);
}

.outbound-bar {
    background: linear-gradient(90deg, #2a8ed1, #69c5ff);
    box-shadow: 0 0 18px rgba(87, 184, 255, .18);
}

.traffic-percentage {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: .72rem;
    text-align: right;
}

.network-split {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: stretch;

    margin-top: 30px;
    padding: 17px;

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    background: rgba(4, 16, 12, .34);
}

.network-split-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.network-split-item span {
    color: var(--muted);
    font-size: .73rem;
}

.network-split-item strong {
    font-size: 1.15rem;
}

.network-divider {
    width: 1px;
    background: var(--border);
}

/* ==========================================
   GEO / FUTURE SECTIONS
========================================== */

.future-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(430px, .85fr);
    gap: 16px;
}

.countries-card .section-header {
    align-items: center;
}

.countries-card h2 {
    white-space: nowrap;
}

.countries-list {
    width: 100%;
}

.country-row-header {
    grid-template-columns: auto minmax(120px, 1fr) auto;
}

.country-row-name {
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

.country-row-footer {
    font-size: .7rem;
}

.map-placeholder {
    display: grid;
    place-items: center;
    min-height: 350px;
    padding: 30px;

    border: 1px solid var(--border);
    border-radius: 21px;

    background:
        radial-gradient(circle at center, rgba(99, 230, 164, .08), transparent 45%),
        rgba(4, 16, 12, .32);

    text-align: center;
}
#world-map {
    width: 100%;
    height: 350px;
}
.map-placeholder > p {
    max-width: 520px;
    margin: 24px 0 0;
    color: var(--muted);
    font-size: .82rem;
    line-height: 1.55;
}

.globe {
    position: relative;
    width: 190px;
    height: 190px;

    border: 1px solid rgba(99, 230, 164, .42);
    border-radius: 50%;

    box-shadow:
        inset 0 0 32px rgba(99, 230, 164, .06),
        0 0 36px rgba(99, 230, 164, .08);

    animation: globeFloat 5s ease-in-out infinite;
}

@keyframes globeFloat {
    50% {
        transform: translateY(-7px);
    }
}

.globe-line,
.globe-equator {
    position: absolute;
    border: 1px solid rgba(99, 230, 164, .23);
    border-radius: 50%;
}

.globe-line {
    top: 12px;
    bottom: 12px;
    left: 50%;
    width: 62px;
    transform: translateX(-50%);
}

.globe-line-two {
    width: 118px;
}

.globe-line-three {
    width: 168px;
}

.globe-equator {
    top: 50%;
    left: 9px;
    right: 9px;
    height: 58px;
    transform: translateY(-50%);
}

.globe-node {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 14px var(--accent-glow);
}

.node-one {
    top: 35px;
    left: 58px;
}

.node-two {
    top: 72px;
    right: 34px;
}

.node-three {
    bottom: 44px;
    left: 39px;
}

.node-four {
    right: 61px;
    bottom: 28px;
}

.empty-country-list {
    min-height: 350px;
    padding: 20px;

    border: 1px solid var(--border);
    border-radius: 21px;

    background: rgba(4, 16, 12, .28);
}

.country-placeholder {
    display: flex;
    align-items: flex-start;
    gap: 14px;

    padding: 16px;

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    background: rgba(99, 230, 164, .045);
}

.country-flag {
    font-size: 1.5rem;
}

.country-placeholder strong {
    display: block;
    margin-bottom: 6px;
    font-size: .9rem;
}

.country-placeholder p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: .76rem;
    line-height: 1.5;
}

/* ==========================================
   TOP COUNTRIES
========================================== */

.countries-list {
    min-height: 350px;
    padding: 16px;

    border: 1px solid var(--border);
    border-radius: 21px;

    background: rgba(4, 16, 12, .28);
}

.country-loading,
.country-error {
    display: grid;
    place-items: center;

    min-height: 315px;

    color: var(--muted);
    font-size: .82rem;
    text-align: center;
}

.country-error {
    color: var(--danger);
}

.country-row {
    padding: 12px 10px;

    border-bottom: 1px solid var(--border);
}

.country-row:last-child {
    border-bottom: 0;
}

.country-row-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;

    margin-bottom: 9px;
}

.country-row-flag {
    font-size: 1.25rem;
    line-height: 1;
}

.country-row-name {
    overflow: hidden;

    color: var(--text-soft);
    font-size: .82rem;
    font-weight: 700;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.country-row-count {
    color: var(--text);
    font-size: .83rem;
    font-weight: 800;
}

.country-progress-track {
    overflow: hidden;

    height: 7px;

    border: 1px solid var(--border);
    border-radius: 999px;

    background: rgba(4, 16, 12, .62);
}

.country-progress-bar {
    width: 0;
    height: 100%;

    border-radius: inherit;

    background:
        linear-gradient(
            90deg,
            var(--accent-strong),
            var(--accent)
        );

    box-shadow: 0 0 16px rgba(99, 230, 164, .16);

    transition: width 850ms cubic-bezier(.22, .8, .3, 1);
}

.country-row-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;

    margin-top: 6px;

    color: var(--muted);
    font-size: .67rem;
}



/* ==========================================
   FOOTER
========================================== */

footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    padding: 27px 6px 0;
    color: var(--muted);
    font-size: .75rem;
}

footer > div {
    display: flex;
    gap: 8px;
}

footer strong {
    color: var(--text-soft);
}

footer p {
    margin-bottom: 0;
}

/* ==========================================
   RESPONSIVE
========================================== */

@media (max-width: 1120px) {
    .metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid,
    .future-grid {
        grid-template-columns: 1fr;
    }

    .traffic-card {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0 26px;
    }

    .traffic-card .section-header,
    .traffic-card .traffic-total,
    .traffic-card .network-split {
        grid-column: 1 / -1;
    }
}

@media (max-width: 760px) {
    .page-shell {
        width: min(100% - 24px, 1480px);
        padding-top: 16px;
    }

    .hero {
        flex-direction: column;
        padding: 23px;
        min-height: auto;
    }

    .hero-status {
        justify-content: flex-start;
        min-width: 0;
    }

    .status-card {
        width: 100%;
    }

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

    .meta-item {
        min-width: 0;
    }

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

    .metric-card {
        min-height: 155px;
    }

    .dashboard-grid,
    .future-grid {
        gap: 12px;
    }

    .chart-card,
    .traffic-card,
    .map-card,
    .countries-card {
        padding: 18px;
        border-radius: 21px;
    }

    .traffic-card {
        display: block;
    }

    .chart-wrapper,
    #connections-chart {
        min-height: 290px;
        height: 290px !important;
    }

    .section-header {
        flex-direction: column;
    }

    .map-placeholder {
        min-height: 300px;
    }

    footer {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 440px) {
    .brand-row {
        align-items: flex-start;
    }

    .brand-icon {
        width: 56px;
        height: 56px;
        border-radius: 17px;
    }

    h1 {
        font-size: 2.6rem;
    }

    .metric-value {
        font-size: 3.1rem;
    }

    .globe {
        width: 155px;
        height: 155px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
