:root {
    --background: #050b12;
    --panel: rgba(11, 22, 34, 0.94);
    --panel-soft: rgba(15, 30, 45, 0.88);
    --border: rgba(142, 190, 219, 0.18);
    --text: #edf7ff;
    --muted: #8fa9bb;
    --birth: #3be7ff;
    --birth-soft: rgba(59, 231, 255, 0.18);
    --death: #ff5277;
    --death-soft: rgba(255, 82, 119, 0.18);
    --net: #ffd166;
    --land: #172d3d;
    --land-hover: #23475e;
    --land-selected: #316d89;
    --ocean: #07131e;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-height: 100%;
    margin: 0;
    background:
        radial-gradient(circle at 40% 30%, #10283a 0%, transparent 40%),
        linear-gradient(145deg, #07111b, #02070c);
    color: var(--text);
    font-family:
        Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
}

body {
    overflow: hidden;
}

button,
input {
    font: inherit;
}

.topbar {
    height: 78px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 22px;
    border-bottom: 1px solid var(--border);
    background: rgba(4, 10, 17, 0.94);
    backdrop-filter: blur(16px);
    position: relative;
    z-index: 20;
}

.branding {
    display: flex;
    align-items: center;
    gap: 13px;
}

.globe-mark {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(59, 231, 255, 0.45);
    border-radius: 50%;
    color: var(--birth);
    font-size: 28px;
    box-shadow:
        inset 0 0 18px rgba(59, 231, 255, 0.13),
        0 0 18px rgba(59, 231, 255, 0.08);
}

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

.branding h1 {
    margin-bottom: 2px;
    font-size: clamp(1.05rem, 2vw, 1.55rem);
    letter-spacing: 0.01em;
}

.branding p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.status-area {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #bcd1df;
    font-size: 0.85rem;
}

.live-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #4dff91;
    box-shadow: 0 0 12px #4dff91;
    animation: statusPulse 1.6s infinite;
}

@keyframes statusPulse {
    50% {
        opacity: 0.35;
    }
}

main {
    height: calc(100vh - 78px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 390px;
}

.map-panel {
    min-width: 0;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at center, rgba(24, 67, 93, 0.22), transparent 55%),
        var(--ocean);
}

#worldMap {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
}

#worldMap:active {
    cursor: grabbing;
}

.country {
    fill: var(--land);
    stroke: rgba(117, 170, 199, 0.42);
    stroke-width: 0.5;
    vector-effect: non-scaling-stroke;
    transition: fill 140ms ease;
}

.country:hover {
    fill: var(--land-hover);
}

.country.selected {
    fill: var(--land-selected);
    stroke: var(--birth);
    stroke-width: 1.2;
}

.graticule {
    fill: none;
    stroke: rgba(103, 163, 195, 0.12);
    stroke-width: 0.5;
    vector-effect: non-scaling-stroke;
}

.sphere {
    fill: rgba(8, 25, 38, 0.36);
    stroke: rgba(110, 172, 205, 0.22);
    stroke-width: 1;
}

.event-ring {
    fill: none;
    pointer-events: none;
    vector-effect: non-scaling-stroke;
}

.event-core {
    pointer-events: none;
    vector-effect: non-scaling-stroke;
}

.birth-ring {
    stroke: var(--birth);
}

.birth-core {
    fill: #d6fbff;
    stroke: var(--birth);
}

.death-ring {
    stroke: var(--death);
}

.death-core {
    fill: #ffe1e8;
    stroke: var(--death);
}

.dashboard {
    padding: 14px;
    overflow-y: auto;
    border-left: 1px solid var(--border);
    background: rgba(4, 10, 17, 0.93);
}

.counter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.counter-card,
.control-card,
.country-card,
.information-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    background:
        linear-gradient(145deg, rgba(18, 37, 53, 0.88), rgba(8, 17, 27, 0.94));
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
}

.counter-card {
    min-height: 115px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.counter-label,
.eyebrow {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.11em;
}

.counter-card strong {
    margin: 7px 0 3px;
    font-size: clamp(1.45rem, 3vw, 2rem);
    line-height: 1;
}

.counter-card small {
    color: var(--muted);
    line-height: 1.3;
}

.birth-card strong {
    color: var(--birth);
}

.death-card strong {
    color: var(--death);
}

.net-card strong {
    color: var(--net);
}

.control-card,
.country-card,
.information-card {
    margin-top: 12px;
    padding: 16px;
}

.control-card h2,
.country-card h2,
.information-card h2 {
    margin-bottom: 13px;
    font-size: 1rem;
}

.control-card > label {
    display: flex;
    justify-content: space-between;
    color: #cadae4;
    font-size: 0.84rem;
}

#speedControl {
    width: 100%;
    margin: 14px 0;
    accent-color: var(--birth);
}

.button-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
}

button {
    min-height: 42px;
    padding: 9px 14px;
    border: 1px solid rgba(130, 189, 221, 0.24);
    border-radius: 9px;
    background: #142b3c;
    color: var(--text);
    cursor: pointer;
}

button:hover {
    background: #1b3b51;
    border-color: rgba(59, 231, 255, 0.5);
}

.toggle-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 13px;
    color: #c1d2dd;
    font-size: 0.82rem;
}

.toggle-row label {
    display: flex;
    align-items: center;
    gap: 7px;
}

.toggle-row input {
    accent-color: var(--birth);
}

.country-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.country-heading h2 {
    margin: 4px 0 12px;
    font-size: 1.25rem;
}

#clearCountry {
    width: 34px;
    min-height: 34px;
    padding: 0;
    border-radius: 50%;
    font-size: 1.3rem;
}

.search-label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 0.75rem;
}

#countrySearch {
    width: 100%;
    min-height: 42px;
    padding: 8px 11px;
    border: 1px solid rgba(131, 185, 214, 0.28);
    border-radius: 9px;
    outline: none;
    background: #081722;
    color: var(--text);
}

#countrySearch:focus {
    border-color: var(--birth);
    box-shadow: 0 0 0 3px rgba(59, 231, 255, 0.1);
}

.country-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    margin-top: 14px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--border);
}

.country-stats div {
    min-height: 70px;
    padding: 11px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #0b1925;
}

.country-stats span {
    color: var(--muted);
    font-size: 0.72rem;
}

.country-stats strong {
    margin-top: 5px;
    font-size: 0.97rem;
}

.information-card p {
    margin-bottom: 9px;
    color: #9fb4c2;
    font-size: 0.77rem;
    line-height: 1.5;
}

.information-card p:last-child {
    margin-bottom: 0;
}

.legend {
    position: absolute;
    left: 17px;
    bottom: 17px;
    display: flex;
    gap: 15px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(3, 10, 17, 0.82);
    color: #bbccd7;
    font-size: 0.76rem;
    backdrop-filter: blur(10px);
}

.legend span {
    display: flex;
    align-items: center;
    gap: 7px;
}

.legend i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.birth-key {
    background: var(--birth);
    box-shadow: 0 0 10px var(--birth);
}

.death-key {
    background: var(--death);
    box-shadow: 0 0 10px var(--death);
}

.zoom-hint {
    position: absolute;
    right: 17px;
    bottom: 17px;
    padding: 8px 11px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: rgba(3, 10, 17, 0.76);
    color: var(--muted);
    font-size: 0.7rem;
}

.tooltip {
    position: fixed;
    z-index: 50;
    max-width: 245px;
    padding: 10px 12px;
    border: 1px solid rgba(59, 231, 255, 0.35);
    border-radius: 9px;
    background: rgba(3, 11, 18, 0.96);
    color: var(--text);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42);
    pointer-events: none;
    opacity: 0;
    transform: translate(10px, 10px);
    transition: opacity 100ms ease;
}

.tooltip strong {
    display: block;
    margin-bottom: 5px;
}

.tooltip span {
    display: block;
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.45;
}

.loading-panel {
    position: absolute;
    inset: 0;
    z-index: 15;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(3, 10, 17, 0.91);
}

.loading-panel.hidden {
    display: none;
}

.loader {
    width: 46px;
    height: 46px;
    border: 3px solid rgba(59, 231, 255, 0.18);
    border-top-color: var(--birth);
    border-radius: 50%;
    animation: spin 900ms linear infinite;
}

.loading-panel span {
    color: var(--muted);
    font-size: 0.85rem;
}

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

@media (max-width: 1050px) {
    body {
        overflow: auto;
    }

    main {
        height: auto;
        min-height: calc(100vh - 78px);
        grid-template-columns: 1fr;
    }

    .map-panel {
        height: 62vh;
        min-height: 470px;
    }

    .dashboard {
        border-top: 1px solid var(--border);
        border-left: 0;
    }

    .counter-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 720px) {
    .topbar {
        height: auto;
        min-height: 70px;
        padding: 10px 12px;
    }

    .globe-mark {
        width: 38px;
        height: 38px;
        font-size: 22px;
    }

    .branding p,
    .status-area {
        display: none;
    }

    main {
        min-height: calc(100vh - 70px);
    }

    .map-panel {
        height: 53vh;
        min-height: 380px;
    }

    .dashboard {
        padding: 10px;
    }

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

    .counter-card {
        min-height: 100px;
        padding: 11px;
    }

    .zoom-hint {
        display: none;
    }

    .legend {
        right: 10px;
        left: 10px;
        bottom: 10px;
        justify-content: center;
    }
}

/* ================================================================
   LEAFLET SATELLITE MAP UPGRADE
   ================================================================ */

#worldMap {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    background: #06121c;
    cursor: grab;
    z-index: 1;
}

#worldMap:active {
    cursor: grabbing;
}

.leaflet-container {
    background: #06121c;
    font-family:
        Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
}

.leaflet-tile-pane {
    filter:
        saturate(1.12)
        contrast(1.05)
        brightness(0.82);
}

.leaflet-overlay-pane svg {
    overflow: visible;
}

.leaflet-control-zoom a,
.leaflet-control-layers {
    border-color: rgba(67, 213, 255, 0.32) !important;
    background: rgba(4, 17, 27, 0.94) !important;
    color: #e7f8ff !important;
}

.leaflet-control-zoom a:hover {
    background: rgba(14, 53, 73, 0.98) !important;
}

.leaflet-control-layers-expanded {
    color: #dceef8;
}

.leaflet-control-layers-separator {
    border-top-color: rgba(117, 181, 214, 0.22);
}

.leaflet-control-attribution {
    background: rgba(2, 10, 16, 0.76) !important;
    color: #9ab3c2 !important;
    font-size: 10px !important;
}

.leaflet-control-attribution a {
    color: #5fe9ff !important;
}

.leaflet-control-scale-line {
    border-color: rgba(220, 245, 255, 0.8) !important;
    background: rgba(2, 10, 16, 0.72) !important;
    color: #e8f8ff !important;
    text-shadow: 0 1px 2px #000;
}

.birthdeath-map-tooltip {
    border: 1px solid rgba(65, 228, 255, 0.55) !important;
    border-radius: 9px !important;
    background: rgba(3, 12, 19, 0.96) !important;
    color: #edfaff !important;
    box-shadow: 0 9px 28px rgba(0, 0, 0, 0.5) !important;
}

.birthdeath-map-tooltip::before {
    border-top-color: rgba(3, 12, 19, 0.96) !important;
}

.map-country-tooltip strong {
    display: block;
    margin-bottom: 5px;
    color: #ffffff;
    font-size: 14px;
}

.map-country-tooltip span {
    display: block;
    color: #a9c3d2;
    font-size: 11px;
    line-height: 1.45;
}

.event-pulse {
    transform-box: fill-box;
    transform-origin: center;
    animation: mapPulse 1.8s ease-out forwards;
    pointer-events: none;
}

.event-core {
    transform-box: fill-box;
    transform-origin: center;
    animation: mapCore 1.5s ease-out forwards;
    pointer-events: none;
}

.birth-pulse {
    filter:
        drop-shadow(0 0 3px #3be7ff)
        drop-shadow(0 0 8px rgba(59, 231, 255, 0.75));
}

.death-pulse {
    filter:
        drop-shadow(0 0 3px #ff5277)
        drop-shadow(0 0 8px rgba(255, 82, 119, 0.75));
}

@keyframes mapPulse {
    0% {
        transform: scale(0.45);
        opacity: 1;
        stroke-width: 3px;
    }

    70% {
        opacity: 0.62;
    }

    100% {
        transform: scale(5.8);
        opacity: 0;
        stroke-width: 0.4px;
    }
}

@keyframes mapCore {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(0.35);
        opacity: 0;
    }
}

.map-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background:
        radial-gradient(
            circle at center,
            transparent 52%,
            rgba(0, 8, 14, 0.29) 100%
        );
}

.map-panel .loading-panel,
.map-panel .legend,
.map-panel .zoom-hint {
    z-index: 500;
}

@media (max-width: 720px) {
    .leaflet-control-attribution {
        max-width: 78vw;
        font-size: 8px !important;
    }
}

/* Birth and Death Leaflet container repair */
.map-panel {
    position: relative;
}

#worldMap {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 300px;
    min-height: 300px;
    z-index: 1;
}

.leaflet-container {
    width: 100%;
    height: 100%;
}

/* ================================================================
   LARGER AND LONGER BIRTH/DEATH MAP PULSES
   ================================================================ */

.event-pulse {
    pointer-events: auto !important;
    cursor: pointer;
    animation-duration: 4.2s !important;
}

.event-core {
    pointer-events: auto !important;
    cursor: pointer;
    animation-duration: 4.2s !important;
}

@keyframes mapPulse {
    0% {
        transform: scale(0.75);
        opacity: 1;
        stroke-width: 3px;
    }

    18% {
        transform: scale(1.15);
        opacity: 1;
    }

    70% {
        opacity: 0.82;
    }

    100% {
        transform: scale(3.8);
        opacity: 0;
        stroke-width: 0.7px;
    }
}

@keyframes mapCore {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    68% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(0.7);
        opacity: 0;
    }
}

.event-map-tooltip {
    padding: 0 !important;
    border: 1px solid rgba(255, 255, 255, 0.28) !important;
    border-radius: 10px !important;
    background: rgba(2, 10, 17, 0.97) !important;
    color: #ffffff !important;
    box-shadow: 0 9px 25px rgba(0, 0, 0, 0.55) !important;
}

.event-map-tooltip::before {
    border-top-color: rgba(2, 10, 17, 0.97) !important;
}

.birth-event-tooltip {
    border-color: rgba(59, 231, 255, 0.78) !important;
}

.death-event-tooltip {
    border-color: rgba(255, 82, 119, 0.82) !important;
}

.pulse-tooltip-content {
    min-width: 145px;
    padding: 10px 12px;
}

.pulse-tooltip-content strong,
.pulse-tooltip-content span,
.pulse-tooltip-content small {
    display: block;
}

.pulse-tooltip-content strong {
    margin-bottom: 4px;
    font-size: 13px;
}

.birth-event-tooltip .pulse-tooltip-content strong {
    color: #3be7ff;
}

.death-event-tooltip .pulse-tooltip-content strong {
    color: #ff718f;
}

.pulse-tooltip-content span {
    color: #ffffff;
    font-size: 12px;
}

.pulse-tooltip-content small {
    margin-top: 4px;
    color: #91aaba;
    font-size: 10px;
}

/* ================================================================
   FIXED LARGE SCREEN-SIZE BIRTH AND DEATH MARKERS
   These remain 56 pixels wide regardless of map zoom.
   ================================================================ */

.birthdeath-event-icon {
    width: 56px !important;
    height: 56px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    cursor: pointer !important;
    pointer-events: auto !important;
}

.fixed-event-marker {
    position: relative;
    width: 56px;
    height: 56px;
    display: block;
    cursor: pointer;
    pointer-events: auto;
}

.fixed-event-ring,
.fixed-event-halo,
.fixed-event-core {
    position: absolute;
    top: 50%;
    left: 50%;
    display: block;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.fixed-event-ring {
    width: 46px;
    height: 46px;
    border: 4px solid currentColor;
    opacity: 0.95;
    animation: fixedEventRing 5.2s ease-out forwards;
}

.fixed-event-halo {
    width: 34px;
    height: 34px;
    border: 3px solid currentColor;
    opacity: 0.85;
    animation: fixedEventHalo 5.2s ease-out forwards;
}

.fixed-event-core {
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    border: 3px solid #ffffff;
    color: #ffffff;
    background: currentColor;
    box-shadow:
        0 0 4px #ffffff,
        0 0 14px currentColor,
        0 0 26px currentColor;
    opacity: 1;
    animation: fixedEventCore 5.2s ease-out forwards;
}

.fixed-event-core b {
    display: block;
    color: #ffffff;
    font-size: 15px;
    font-weight: 900;
    line-height: 1;
    text-align: center;
}

.birth-fixed-marker {
    color: #16e5ff;
}

.death-fixed-marker {
    color: #ff315f;
}

.birth-fixed-marker .fixed-event-core {
    background: #08bad2;
}

.death-fixed-marker .fixed-event-core {
    background: #e51f4f;
}

@keyframes fixedEventRing {
    0% {
        width: 26px;
        height: 26px;
        opacity: 1;
        border-width: 5px;
    }

    15% {
        width: 52px;
        height: 52px;
        opacity: 1;
        border-width: 4px;
    }

    72% {
        width: 52px;
        height: 52px;
        opacity: 0.9;
        border-width: 4px;
    }

    100% {
        width: 56px;
        height: 56px;
        opacity: 0;
        border-width: 2px;
    }
}

@keyframes fixedEventHalo {
    0% {
        width: 20px;
        height: 20px;
        opacity: 1;
    }

    18% {
        width: 38px;
        height: 38px;
        opacity: 0.9;
    }

    75% {
        width: 38px;
        height: 38px;
        opacity: 0.75;
    }

    100% {
        width: 44px;
        height: 44px;
        opacity: 0;
    }
}

@keyframes fixedEventCore {
    0% {
        width: 16px;
        height: 16px;
        opacity: 1;
    }

    12% {
        width: 22px;
        height: 22px;
        opacity: 1;
    }

    78% {
        width: 22px;
        height: 22px;
        opacity: 1;
    }

    100% {
        width: 18px;
        height: 18px;
        opacity: 0;
    }
}

/*
 * Larger invisible mouse target so a pulse is easier to catch.
 */
.birthdeath-event-icon::before {
    content: "";
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    pointer-events: auto;
}

/*
 * Make the marker even larger at worldwide zoom levels.
 */
.leaflet-zoom-animated .birthdeath-event-icon {
    transform-origin: center center;
}

@media (max-width: 720px) {
    .birthdeath-event-icon {
        width: 62px !important;
        height: 62px !important;
    }

    .fixed-event-marker {
        width: 62px;
        height: 62px;
    }

    .fixed-event-ring {
        width: 56px;
        height: 56px;
    }

    .birthdeath-event-icon::before {
        inset: -16px;
    }
}

/* ================================================================
   LARGE READABLE EVENT CARDS
   ================================================================ */

.large-event-popup {
    max-width: min(620px, calc(100vw - 36px)) !important;
}

.large-event-popup .leaflet-popup-content-wrapper {
    overflow: hidden;
    padding: 0 !important;
    border: 3px solid rgba(255, 255, 255, 0.28);
    border-radius: 18px !important;
    background: rgba(3, 11, 18, 0.985) !important;
    color: #ffffff !important;
    box-shadow:
        0 18px 55px rgba(0, 0, 0, 0.72),
        0 0 30px rgba(255, 255, 255, 0.08) !important;
}

.birth-event-popup .leaflet-popup-content-wrapper {
    border-color: #24dff7;
}

.death-event-popup .leaflet-popup-content-wrapper {
    border-color: #ff5277;
}

.large-event-popup .leaflet-popup-content {
    width: auto !important;
    min-width: 420px;
    max-width: 600px;
    margin: 0 !important;
    font-size: 20px !important;
    line-height: 1.45 !important;
}

.large-event-popup .leaflet-popup-tip {
    background: rgba(3, 11, 18, 0.985) !important;
}

.large-event-popup .leaflet-popup-close-button {
    top: 9px !important;
    right: 10px !important;
    width: 46px !important;
    height: 46px !important;
    display: grid !important;
    place-items: center !important;
    padding: 0 !important;
    border: 2px solid rgba(255, 255, 255, 0.42) !important;
    border-radius: 50% !important;
    background: rgba(0, 0, 0, 0.65) !important;
    color: #ffffff !important;
    font-size: 34px !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    text-decoration: none !important;
    z-index: 10;
}

.large-event-popup .leaflet-popup-close-button:hover {
    background: #ffffff !important;
    color: #08131c !important;
}

.large-event-card {
    width: 100%;
    padding: 28px;
    color: #ffffff;
}

.large-event-card-header {
    display: flex;
    align-items: center;
    gap: 18px;
    padding-right: 46px;
}

.large-event-symbol {
    flex: 0 0 auto;
    width: 68px;
    height: 68px;
    display: grid;
    place-items: center;
    border: 4px solid #ffffff;
    border-radius: 50%;
    color: #ffffff;
    font-size: 44px;
    font-weight: 900;
    line-height: 1;
}

.birth-large-event-card .large-event-symbol {
    background: #079db3;
    box-shadow: 0 0 24px rgba(36, 223, 247, 0.78);
}

.death-large-event-card .large-event-symbol {
    background: #d8204a;
    box-shadow: 0 0 24px rgba(255, 82, 119, 0.78);
}

.large-event-category {
    display: block;
    margin-bottom: 3px;
    font-size: 17px;
    font-weight: 900;
    letter-spacing: 0.1em;
}

.birth-large-event-card .large-event-category {
    color: #54efff;
}

.death-large-event-card .large-event-category {
    color: #ff7895;
}

.large-event-card h2 {
    margin: 0 !important;
    color: #ffffff !important;
    font-size: 34px !important;
    font-weight: 800 !important;
    line-height: 1.15 !important;
}

.large-event-explanation {
    margin: 24px 0 !important;
    padding: 18px 20px;
    border-left: 6px solid currentColor;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.075);
    color: #f3f9fc !important;
    font-size: 21px !important;
    line-height: 1.5 !important;
}

.birth-large-event-card .large-event-explanation {
    border-left-color: #24dff7;
}

.death-large-event-card .large-event-explanation {
    border-left-color: #ff5277;
}

.large-event-data {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.16);
}

.large-event-data div {
    min-height: 102px;
    padding: 17px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #0b1b28;
}

.large-event-data span {
    display: block;
    margin-bottom: 7px;
    color: #b5cad7;
    font-size: 17px;
    line-height: 1.3;
}

.large-event-data strong {
    display: block;
    color: #ffffff;
    font-size: 25px;
    font-weight: 800;
    line-height: 1.2;
}

.large-event-notice {
    margin: 22px 0 0 !important;
    color: #c2d3dd !important;
    font-size: 18px !important;
    line-height: 1.5 !important;
}

@media (max-width: 720px) {
    .large-event-popup .leaflet-popup-content {
        min-width: min(360px, calc(100vw - 48px));
        max-width: calc(100vw - 48px);
    }

    .large-event-card {
        padding: 22px;
    }

    .large-event-symbol {
        width: 58px;
        height: 58px;
        font-size: 36px;
    }

    .large-event-card h2 {
        font-size: 29px !important;
    }

    .large-event-category {
        font-size: 15px;
    }

    .large-event-explanation {
        font-size: 19px !important;
    }

    .large-event-data {
        grid-template-columns: 1fr;
    }

    .large-event-data div {
        min-height: 80px;
    }

    .large-event-data span {
        font-size: 16px;
    }

    .large-event-data strong {
        font-size: 23px;
    }

    .large-event-notice {
        font-size: 17px !important;
    }
}

/* BIRTHDEATH_MOBILE_MAPFIRST_BEGIN */

@media (max-width: 720px) {

    html,
    body {
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
    }

    .topbar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;

        width: 100% !important;
        height: 60px !important;
        min-height: 60px !important;

        padding: 7px 9px !important;

        z-index: 30000 !important;
        box-sizing: border-box !important;
    }

    .globe-mark {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        font-size: 20px !important;
    }

    .branding h1 {
        margin: 0 !important;
        font-size: 17px !important;
        line-height: 1.05 !important;
    }

    .branding p,
    .status-area {
        display: none !important;
    }

    main {
        display: block !important;

        position: fixed !important;
        top: 60px !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;

        width: 100vw !important;
        height: calc(100dvh - 60px) !important;
        min-height: 0 !important;

        margin: 0 !important;
        padding: 0 !important;

        overflow: hidden !important;
    }

    .map-panel {
        position: absolute !important;
        inset: 0 !important;

        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;

        margin: 0 !important;
        padding: 0 !important;

        border: 0 !important;

        z-index: 1 !important;
    }

    #worldMap {
        position: absolute !important;
        inset: 0 !important;

        width: 100% !important;
        height: 100% !important;

        min-width: 0 !important;
        min-height: 0 !important;
    }

    .dashboard {
        display: none !important;

        position: fixed !important;

        top: 60px !important;
        left: 0 !important;
        bottom: 0 !important;

        width: min(90vw, 390px) !important;
        max-width: 390px !important;

        height: calc(100dvh - 60px) !important;

        overflow-x: hidden !important;
        overflow-y: auto !important;

        padding: 12px !important;

        z-index: 50000 !important;

        box-sizing: border-box !important;

        border-top: 0 !important;
        border-right:
            1px solid rgba(59,231,255,.45) !important;

        box-shadow:
            12px 0 35px rgba(0,0,0,.78) !important;

        -webkit-overflow-scrolling: touch;
    }

    .dashboard.birthdeath-mobile-open {
        display: block !important;
    }

    .legend,
    .zoom-hint {
        display: none !important;
    }

    #birthdeath-mobile-controls {
        display: block !important;

        position: fixed !important;

        top: calc(68px + env(safe-area-inset-top)) !important;
        left: 10px !important;

        z-index: 45000 !important;

        min-width: 112px !important;
        min-height: 44px !important;

        padding: 8px 14px !important;

        border:
            1px solid rgba(59,231,255,.9) !important;

        border-radius: 24px !important;

        background:
            rgba(4,15,24,.94) !important;

        color: #ffffff !important;

        font-size: 11px !important;
        font-weight: 800 !important;

        letter-spacing: .07em !important;

        box-shadow:
            0 4px 18px rgba(0,0,0,.75) !important;

        cursor: pointer !important;

        touch-action: manipulation;
    }

    #birthdeath-mobile-controls.birthdeath-mobile-open {
        left: auto !important;
        right: 10px !important;
        z-index: 51000 !important;
    }

    #birthdeath-mobile-backdrop {
        display: none !important;

        position: fixed !important;

        inset: 60px 0 0 0 !important;

        z-index: 49000 !important;

        background:
            rgba(0,0,0,.44) !important;
    }

    #birthdeath-mobile-backdrop.birthdeath-mobile-open {
        display: block !important;
    }

    .counter-grid {
        grid-template-columns:
            1fr 1fr !important;

        gap: 8px !important;
    }

    .counter-card {
        min-height: 82px !important;
        padding: 9px !important;
    }

    .counter-card strong {
        font-size:
            clamp(18px, 5vw, 25px) !important;

        overflow-wrap: anywhere;
    }

    .control-card {
        padding: 12px !important;
    }

    .dashboard input[type="text"],
    .dashboard input[type="search"],
    .dashboard select,
    .dashboard button {
        min-height: 44px !important;
        max-width: 100% !important;
    }

    .dashboard input[type="text"],
    .dashboard input[type="search"],
    .dashboard select {
        font-size: 16px !important;
    }

    .dashboard input[type="checkbox"],
    .dashboard input[type="radio"] {
        width: 20px !important;
        height: 20px !important;
    }

    .leaflet-control-zoom a {
        width: 42px !important;
        height: 42px !important;

        line-height: 42px !important;

        font-size: 24px !important;
    }

    .leaflet-control-layers {
        max-width:
            calc(100vw - 80px) !important;

        max-height: 48vh !important;

        overflow-y: auto !important;
    }

    .leaflet-control-attribution {
        max-width: 70vw !important;

        font-size: 7px !important;
        line-height: 1.1 !important;
    }

    .large-event-popup {
        max-width:
            calc(100vw - 24px) !important;
    }

    .large-event-popup .leaflet-popup-content {
        width: auto !important;
        min-width: 0 !important;

        max-width:
            calc(100vw - 54px) !important;
    }

    .large-event-card {
        padding: 16px !important;
    }

    .large-event-card h2 {
        font-size: 23px !important;
    }

    .large-event-explanation {
        font-size: 16px !important;
    }

    .birthdeath-event-icon {
        width: 46px !important;
        height: 46px !important;
    }

    .fixed-event-marker {
        width: 46px !important;
        height: 46px !important;
    }

    .fixed-event-ring {
        width: 42px !important;
        height: 42px !important;
    }

    .birthdeath-event-icon::before {
        inset: -10px !important;
    }

}


@media
    (max-width: 720px)
    and (orientation: landscape) {

    .topbar {
        height: 48px !important;
        min-height: 48px !important;
    }

    main {
        top: 48px !important;
        height:
            calc(100dvh - 48px) !important;
    }

    .dashboard {
        top: 48px !important;
        height:
            calc(100dvh - 48px) !important;
    }

    #birthdeath-mobile-backdrop {
        inset: 48px 0 0 0 !important;
    }

    #birthdeath-mobile-controls {
        top: 56px !important;
    }

}


@media (min-width: 721px) {

    #birthdeath-mobile-controls,
    #birthdeath-mobile-backdrop {
        display: none !important;
    }

}

/* BIRTHDEATH_MOBILE_MAPFIRST_END */
