/* REDS Theme v3.4 - aurora + orbital spark fireworks */
:root {
    --bg-deep: #080808;
    --panel: rgba(18, 18, 18, 0.94);
    --white: #ffffff;
    --line: rgba(61, 255, 122, 0.35);
    --text: #fafafa;
    --muted: #a8a3b8;
    --soft: #7c758f;
    --dim: #5b5470;
    --violet: #3dff7a;
    --violet-bright: #6bff96;
    --violet-deep: #15803d;
    --violet-light: #b6ffce;
    --violet-glow: rgba(61, 255, 122, 0.38);
    --orange: var(--violet);
    --orange-bright: var(--violet-bright);
    --orange-deep: var(--violet-deep);
    --orange-light: var(--violet-light);
    --orange-glow: var(--violet-glow);
    --accent: var(--violet);
    --accent-bright: var(--violet-bright);
    --green: #34d399;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
    --radius: 14px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --grad: linear-gradient(135deg, #15803d 0%, #22c55e 45%, #3dff7a 100%);
    --grad-soft: linear-gradient(135deg, rgba(21, 128, 61, 0.18), rgba(61, 255, 122, 0.08));
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html {
    scroll-behavior: auto;
    background: #080808;
}
body {
    min-height: 100vh;
    font-family: "Exo 2", system-ui, sans-serif;
    color: var(--text);
    background: transparent;
    overflow-x: hidden;
}
a { color: inherit; }
.mono { font-family: "IBM Plex Mono", monospace; }

.bg-scene {
    position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
    contain: strict;
    transform: translateZ(0);
}
.bg-aurora {
    position: absolute; inset: 0; z-index: 1;
    background:
        radial-gradient(ellipse 100% 80% at 15% 10%, rgba(22, 163, 74, 0.32), transparent 55%),
        radial-gradient(ellipse 80% 60% at 85% 20%, rgba(107, 255, 150, 0.22), transparent 50%),
        radial-gradient(ellipse 90% 70% at 50% 100%, rgba(22, 101, 52, 0.2), transparent 55%);
    animation: auroraShift 22s ease-in-out infinite alternate;
}
@keyframes auroraShift { 0% { opacity: 0.88; transform: scale(1); } 100% { opacity: 1; transform: scale(1.04) rotate(1deg); } }
.bg-spark-glow {
    position: absolute; inset: 0; z-index: 2;
    background:
        radial-gradient(ellipse 70% 50% at 30% 25%, rgba(107, 255, 150, 0.14), transparent 58%),
        radial-gradient(ellipse 60% 45% at 72% 35%, rgba(61, 255, 122, 0.12), transparent 55%),
        radial-gradient(ellipse 80% 55% at 50% 80%, rgba(22, 101, 52, 0.1), transparent 60%);
    animation: sparkGlow 14s ease-in-out infinite alternate;
}
@keyframes sparkGlow { 0% { opacity: 0.7; } 100% { opacity: 1; } }
.bg-orbit-ring {
    position: absolute; border-radius: 50%;
    border: 1px solid rgba(107, 255, 150, 0.08);
    box-shadow: 0 0 60px rgba(61, 255, 122, 0.06), inset 0 0 40px rgba(22, 163, 74, 0.04);
    z-index: 2;
    opacity: 0.55;
}
.bg-orbit-ring--1 {
    width: min(90vw, 720px); height: min(90vw, 720px);
    top: 8%; left: -12%;
    animation: orbitSpin 48s linear infinite;
}
.bg-orbit-ring--2 {
    width: min(70vw, 520px); height: min(70vw, 520px);
    bottom: -8%; right: -10%;
    animation: orbitSpin 36s linear infinite reverse;
    border-color: rgba(182, 255, 206, 0.1);
}
@keyframes orbitSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.bg-canvas, #bgCanvas {
    position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%;
    opacity: 0.88;
}
body.is-scrolling .bg-aurora,
body.is-scrolling .bg-spark-glow,
body.is-scrolling .bg-orbit-ring { animation-play-state: paused; }
body.is-scrolling .bg-canvas,
body.is-scrolling #bgCanvas { opacity: 0.45; }
.bg-vignette {
    position: absolute; inset: 0; z-index: 4;
    background: radial-gradient(ellipse at center, transparent 42%, rgba(8, 8, 8, 0.55) 100%),
        linear-gradient(180deg, rgba(8, 8, 8, 0.2) 0%, transparent 32%, transparent 68%, rgba(8, 8, 8, 0.55) 100%);
}

.banner-page-wrap {
    width: 100%;
    margin-bottom: 24px;
}
.section .banner-page-wrap,
.glass .banner-page-wrap {
    padding: 0;
}
.banner-page-wrap .reds-map-card {
    margin-bottom: 0;
}
.banner-page-wrap--full .reds-map-card {
    width: 100%;
}

.kpi-delta {
    display: inline-block;
    margin-top: 8px;
    font-family: "IBM Plex Mono", monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.kpi-delta.up { color: #34d399; }
.kpi-delta.down { color: #f87171; }
.kpi-delta.neutral { color: var(--soft); }

.leaderboard-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.leaderboard-filters a {
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: 1px solid rgba(61, 255, 122, 0.22);
    color: var(--muted);
    background: rgba(0, 0, 0, 0.35);
    transition: all 0.2s var(--ease);
}
.leaderboard-filters a:hover,
.leaderboard-filters a.active {
    color: var(--white);
    border-color: rgba(107, 255, 150, 0.5);
    background: rgba(61, 255, 122, 0.12);
}
.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    border-radius: 10px;
    font-family: "IBM Plex Mono", monospace;
    font-size: 12px;
    font-weight: 800;
    background: rgba(61, 255, 122, 0.1);
    border: 1px solid rgba(107, 255, 150, 0.25);
    color: var(--orange-bright);
}
.rank-badge.gold { background: linear-gradient(135deg, rgba(251, 191, 36, 0.25), rgba(21, 128, 61, 0.15)); border-color: rgba(251, 191, 36, 0.45); color: #fde68a; }
.rank-badge.silver { background: linear-gradient(135deg, rgba(203, 213, 225, 0.18), rgba(100, 116, 139, 0.12)); border-color: rgba(203, 213, 225, 0.35); color: #e2e8f0; }
.rank-badge.bronze { background: linear-gradient(135deg, rgba(21, 128, 61, 0.22), rgba(20, 83, 45, 0.12)); border-color: rgba(107, 255, 150, 0.35); color: #b6ffce; }
.leaderboard-name { font-family: "Exo 2", sans-serif; font-weight: 900; font-size: 14px; color: var(--text); }
.leaderboard-meta { font-size: 10px; color: var(--soft); margin-top: 4px; }
.leaderboard-recent {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--orange-bright);
    background: rgba(61, 255, 122, 0.1);
    border: 1px solid rgba(107, 255, 150, 0.25);
}

.page, #root { position: relative; z-index: 10; width: min(1560px, calc(100% - 36px)); margin: 0 auto; padding: 20px 0 48px; }
.wrap { max-width: 1560px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }

.glass, .panel {
    background: var(--panel);
    border: 1px solid rgba(61, 255, 122, 0.35);
    border-radius: var(--radius);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(61, 255, 122, 0.06);
    position: relative;
    overflow: hidden;
    transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease), transform 0.3s var(--ease);
}
.glass::before, .panel::before {
    content: "";
    position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: var(--grad);
    opacity: 0.85;
}
.glass:hover, .panel:hover {
    border-color: rgba(61, 255, 122, 0.35);
    box-shadow: var(--shadow), 0 0 28px rgba(61, 255, 122, 0.1);
}

.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 14px 20px; margin-bottom: 20px;
    animation: slideDown 0.7s var(--ease) both;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }

.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo {
    width: 54px; height: 54px; border-radius: 50%; border: 2px solid var(--orange);
    box-shadow: 0 0 20px var(--orange-glow); overflow: hidden; flex-shrink: 0;
    display: grid; place-items: center; background: var(--grad-soft);
}
.brand-logo svg { width: 30px; height: 30px; stroke: var(--orange-bright); fill: none; stroke-width: 1.8; filter: drop-shadow(0 0 6px var(--orange-glow)); }
.brand h2 {
    font-size: 16px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
    background: linear-gradient(90deg, var(--orange-bright), var(--white));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand p { color: var(--soft); font-size: 11px; margin-top: 3px; letter-spacing: 0.1em; text-transform: uppercase; }

.nav, .nav-links { display: flex; gap: 4px; flex-wrap: wrap; }
.nav { justify-content: center; background: rgba(0, 0, 0, 0.4); padding: 5px; border-radius: 10px; border: 1px solid rgba(61, 255, 122, 0.1); }
.nav a, .nav-link {
    text-decoration: none; font-size: 11px; font-weight: 700; color: var(--muted);
    padding: 10px 14px; border-radius: 8px; transition: all 0.25s var(--ease);
    letter-spacing: 0.05em; text-transform: uppercase; border: 1px solid transparent;
    background: transparent; cursor: pointer;
}
.nav a:hover, .nav-link:hover { color: var(--white); background: rgba(61, 255, 122, 0.1); }
.nav a.active, .nav-link.active { color: var(--white); background: var(--grad); box-shadow: 0 4px 20px rgba(61, 255, 122, 0.25); border-color: transparent; }

.auth-box { display: flex; align-items: center; gap: 10px; }
.badge {
    display: inline-flex; align-items: center; gap: 7px; border-radius: 6px;
    padding: 8px 12px; font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
    text-transform: uppercase; font-family: "IBM Plex Mono", monospace;
    border: 1px solid rgba(255, 255, 255, 0.08); color: var(--muted); background: rgba(0, 0, 0, 0.4); white-space: nowrap;
}
.badge.ok, .badge-teal, .badge.gold { color: var(--orange-bright); border-color: rgba(107, 255, 150, 0.35); background: rgba(61, 255, 122, 0.08); }
.badge-violet { color: var(--orange-light); border-color: rgba(182, 255, 206, 0.3); background: rgba(61, 255, 122, 0.06); }
.badge-red { color: #fca5a5; border-color: rgba(248, 113, 113, 0.35); background: rgba(127, 29, 29, 0.2); }
.badge-muted { color: var(--soft); border-color: rgba(120, 113, 108, 0.25); background: rgba(0, 0, 0, 0.3); }
.dot, .pulse { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; animation: blink 1.5s ease-in-out infinite; flex-shrink: 0; }
.pulse-teal, .pulse-violet { background: var(--orange-bright); box-shadow: 0 0 10px var(--orange-glow); }
@keyframes blink { 50% { opacity: 0.3; } }

.page-hero {
    padding: 32px 36px; position: relative; z-index: 1;
    background: linear-gradient(135deg, rgba(12, 20, 14, 0.95), rgba(8, 8, 8, 0.98));
}
.page-hero-glow {
    position: absolute; top: 0; right: 0; width: 420px; height: 280px;
    background: radial-gradient(ellipse at top right, rgba(61, 255, 122, 0.12) 0%, transparent 65%);
    pointer-events: none;
}
.page-kicker {
    display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
    font-size: 9px; font-weight: 800; color: var(--orange-bright);
    text-transform: uppercase; letter-spacing: 0.4em;
}
.page-kicker::before { content: ""; width: 24px; height: 1px; background: rgba(61, 255, 122, 0.6); }
.page-title {
    font-size: clamp(1.4rem, 3vw, 2.2rem); font-weight: 800; color: var(--white);
    line-height: 1.1; letter-spacing: -0.02em; margin-bottom: 12px;
}
.page-title span { color: var(--soft); font-weight: 600; }
.page-copy { font-size: 12px; color: var(--muted); max-width: 520px; line-height: 1.75; font-weight: 500; }

.section-head, .s-head {
    padding: 16px 22px; display: flex; align-items: center; justify-content: space-between; gap: 14px;
    border-bottom: 1px solid rgba(61, 255, 122, 0.12); background: rgba(0, 0, 0, 0.3); position: relative; z-index: 1;
}
.section-title, .s-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.12em; color: var(--orange-bright); }
.section-sub, .s-sub { color: var(--soft); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; margin-top: 2px; font-family: "IBM Plex Mono", monospace; }

.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.kpi, .kpi-card {
    padding: 20px; min-height: 130px; border-left: 3px solid var(--orange);
    transition: all 0.3s var(--ease);
}
.kpi:nth-child(even), .kpi-card:nth-child(even) { border-left-color: var(--orange-bright); }
.kpi:hover, .kpi-card:hover { transform: translateY(-4px); box-shadow: 0 16px 50px rgba(0, 0, 0, 0.4), 0 0 22px rgba(61, 255, 122, 0.08); }
.kpi-label { color: var(--soft); font-size: 9px; text-transform: uppercase; letter-spacing: 0.15em; font-weight: 700; font-family: "IBM Plex Mono", monospace; margin-bottom: 10px; }
.kpi-value, .kpi-num { font-family: "IBM Plex Mono", monospace; font-size: clamp(1.8rem, 3.5vw, 2.4rem); font-weight: 700; line-height: 1; color: var(--white); text-shadow: 0 0 24px rgba(61, 255, 122, 0.25); }
.kpi p, .kpi-sub { color: var(--soft); font-size: 11px; line-height: 1.5; margin-top: 10px; }

.forms, .form-area { padding: 22px; position: relative; z-index: 1; }
.form-row, .form-grid, .date-selector { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.input, .inp, select.inp {
    border: 1px solid rgba(61, 255, 122, 0.22); background: rgba(0, 0, 0, 0.45); color: var(--white);
    border-radius: 8px; padding: 12px 16px; outline: none; font-family: "IBM Plex Mono", monospace; font-size: 12px;
    transition: all 0.25s var(--ease);
}
.input:focus, .inp:focus, select.inp:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(61, 255, 122, 0.12), 0 0 18px rgba(61, 255, 122, 0.1); }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.55) sepia(1) saturate(4) hue-rotate(220deg); cursor: pointer; }

.btn, .ghost-btn, .btn-ghost {
    border: 0; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border-radius: 8px; padding: 12px 20px; font-weight: 700; font-size: 11px; letter-spacing: 0.1em;
    text-transform: uppercase; font-family: "Exo 2", sans-serif; transition: all 0.25s var(--ease); white-space: nowrap;
    color: #f5f3ff; background: var(--grad); box-shadow: 0 8px 28px rgba(61, 255, 122, 0.35);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 12px 36px rgba(107, 255, 150, 0.4); filter: brightness(1.08); }
.btn-teal { background: var(--grad); color: #f5f3ff; }
.ghost-btn, .btn-ghost { color: var(--orange-bright); background: transparent; border: 1px solid rgba(61, 255, 122, 0.4); box-shadow: none; }
.ghost-btn:hover, .btn-ghost:hover { background: rgba(61, 255, 122, 0.1); box-shadow: 0 0 18px rgba(61, 255, 122, 0.15); }

.table-wrap, .tbl-wrap { overflow-x: auto; position: relative; z-index: 1; }
table, .tbl { width: 100%; border-collapse: collapse; min-width: 640px; }
th, .tbl th {
    text-align: left; padding: 14px 18px; color: var(--orange-bright); font-size: 10px;
    text-transform: uppercase; letter-spacing: 0.12em; font-family: "IBM Plex Mono", monospace;
    background: rgba(61, 255, 122, 0.06); border-bottom: 2px solid rgba(61, 255, 122, 0.18); white-space: nowrap;
}
td, .tbl td {
    padding: 14px 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--muted); font-size: 12px; font-family: "IBM Plex Mono", monospace; vertical-align: middle;
    transition: background 0.2s, color 0.2s;
}
tbody tr:hover td, .tbl tr:hover td { background: rgba(61, 255, 122, 0.05); color: #e7e5e4; }
tbody tr:nth-child(even) td { background: rgba(0, 0, 0, 0.15); }
tbody tr:nth-child(even):hover td { background: rgba(61, 255, 122, 0.05); }

.accent-teal, .accent-violet { color: var(--orange-bright) !important; font-weight: 700; }
.country-pill {
    display: inline-flex; align-items: center; gap: 6px; border-radius: 6px;
    border: 1px solid rgba(61, 255, 122, 0.22); background: rgba(61, 255, 122, 0.07);
    padding: 5px 10px; font-size: 11px; white-space: nowrap; color: var(--orange-bright);
}

.empty-box, .msg-empty, .placeholder-text {
    padding: 40px 24px; text-align: center; color: var(--soft);
    font-family: "IBM Plex Mono", monospace; font-size: 12px; font-weight: 600;
    border-radius: 8px; border: 1px dashed rgba(61, 255, 122, 0.28); background: rgba(61, 255, 122, 0.04);
}
.msg-error {
    display: none; margin-top: 14px; padding: 12px 16px; border-radius: 8px;
    border: 1px solid rgba(61, 255, 122, 0.4); background: rgba(21, 128, 61, 0.12); color: var(--violet-light); font-size: 12px;
}

.two-col, .chart-grid, .results-grid { display: grid; gap: 20px; margin-bottom: 20px; }
.two-col, .chart-grid { grid-template-columns: 1fr 1fr; }
.results-grid { grid-template-columns: 1fr 1fr; }
.chart-wrap { padding: 28px; position: relative; z-index: 1; }
.chart-legend { display: flex; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 8px; }
.legend-line { width: 18px; height: 2px; border-radius: 2px; background: var(--orange); }

.info-col { display: flex; flex-direction: column; gap: 8px; min-width: 220px; }
.info-row {
    display: flex; justify-content: space-between; align-items: center; padding: 11px 15px;
    background: rgba(0, 0, 0, 0.2); border: 1px solid rgba(61, 255, 122, 0.12); border-radius: 9px;
}
.info-label { font-size: 9px; font-weight: 700; color: var(--soft); text-transform: uppercase; letter-spacing: 0.14em; }

.result-rows { padding: 0; }
.result-row {
    display: flex; justify-content: space-between; align-items: center; gap: 16px;
    padding: 14px 22px; border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.result-row:last-child { border-bottom: none; }
.row-label { font-size: 10px; font-weight: 700; color: var(--soft); text-transform: uppercase; letter-spacing: 0.12em; }
.row-value { font-size: 12px; color: var(--text); font-weight: 600; text-align: right; word-break: break-word; }
.row-value.mono { font-family: "IBM Plex Mono", monospace; color: var(--orange-bright); }
.vac-secured { color: var(--orange-bright); font-weight: 700; }
.vac-unsecured { color: #fca5a5; font-weight: 700; }

.spinner-wrap { display: none; padding: 40px; text-align: center; color: var(--soft); font-size: 12px; font-family: "IBM Plex Mono", monospace; }
.spinner {
    width: 28px; height: 28px; border: 2px solid rgba(61, 255, 122, 0.15);
    border-top-color: var(--orange-bright); border-radius: 50%;
    animation: spin 0.8s linear infinite; margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.footer, .page-footer {
    display: flex; justify-content: space-between; gap: 14px; color: var(--dim);
    font-family: "IBM Plex Mono", monospace; font-size: 10px; text-transform: uppercase;
    letter-spacing: 0.1em; padding: 16px 4px 0; border-top: 1px solid rgba(61, 255, 122, 0.1); margin-top: 8px;
}

.nav-wrap { display: flex; justify-content: space-between; align-items: center; padding: 10px; flex-wrap: wrap; gap: 10px; }

@media (max-width: 1180px) {
    .topbar { flex-direction: column; align-items: flex-start; }
    .nav { justify-content: flex-start; width: 100%; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
    .two-col, .chart-grid, .results-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .page, #root { width: calc(100% - 24px); padding-top: 12px; }
    .kpi-grid { grid-template-columns: 1fr; }
    .page-hero { padding: 24px 20px; }
}
