.globe-container {
    perspective: 1000px;
    width: 340px;
    height: 340px;
    margin: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.globe {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    animation: rotate 30s linear infinite;
    border-radius: 50%;
    box-shadow: 0 0 50px rgba(52, 152, 219, 0.5), 
                inset 0 0 50px rgba(52, 152, 219, 0.2);
}

.globe-sphere {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #1e4d6d;
    background: radial-gradient(circle at 70% 70%, #2c82c9 0%, #0a2140 100%);
    overflow: hidden;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.country {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.5);
    /* Не transition: all — під час rotateY батьківський 3D-трансформ дає миготіння в WebKit */
    transition: filter 0.25s ease, box-shadow 0.25s ease;
    z-index: 5;
    transform: translateZ(1px);
    -webkit-transform: translateZ(1px);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Країни при наведенні стають яскравішими */
.country:hover {
    filter: brightness(1.5);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.7);
    z-index: 10;
}

.country.has-data {
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.9), 0 0 18px rgba(46, 204, 113, 0.45);
    filter: brightness(1.2) saturate(1.1);
}

/* Європейські країни */
.ukraine {
    width: 8%;
    height: 6%;
    top: 25%;
    left: 52%;
    background: #FFD700;
    clip-path: polygon(0 0, 100% 0, 90% 100%, 10% 100%);
}

.poland {
    width: 6%;
    height: 5%;
    top: 22%;
    left: 48%;
    background: #DC143C;
    clip-path: polygon(20% 0, 80% 0, 100% 100%, 0 100%);
}

.germany {
    width: 7%;
    height: 5%;
    top: 21%;
    left: 45%;
    background: #FFD700;
    clip-path: polygon(0 0, 100% 0, 90% 100%, 10% 100%);
}

.france {
    width: 8%;
    height: 6%;
    top: 24%;
    left: 42%;
    background: #0055A4;
    clip-path: polygon(20% 0, 80% 0, 100% 100%, 0 100%);
}

/* Північна Америка */
.usa {
    width: 25%;
    height: 15%;
    top: 25%;
    left: 15%;
    background: #B22234;
    clip-path: polygon(0 0, 100% 0, 95% 100%, 5% 100%);
}

.canada {
    width: 20%;
    height: 12%;
    top: 15%;
    left: 17%;
    background: #FF0000;
    clip-path: polygon(10% 0, 90% 0, 100% 100%, 0 100%);
}

/* Азія */
.china {
    width: 20%;
    height: 15%;
    top: 28%;
    left: 65%;
    background: #DE2910;
    clip-path: polygon(0 0, 100% 0, 90% 100%, 10% 100%);
}

.japan {
    width: 8%;
    height: 8%;
    top: 27%;
    left: 78%;
    background: #FFFFFF;
    clip-path: polygon(30% 0, 70% 0, 100% 100%, 0 100%);
}

.india {
    width: 15%;
    height: 12%;
    top: 35%;
    left: 62%;
    background: #FF9933;
    clip-path: polygon(20% 0, 80% 0, 100% 100%, 0 100%);
}

/* Африка */
.egypt {
    width: 10%;
    height: 8%;
    top: 35%;
    left: 52%;
    background: #C09300;
    clip-path: polygon(0 0, 100% 0, 90% 100%, 10% 100%);
}

.south-africa {
    width: 12%;
    height: 10%;
    top: 60%;
    left: 48%;
    background: #007A4D;
    clip-path: polygon(20% 0, 80% 0, 100% 100%, 0 100%);
}

/* Південна Америка */
.brazil {
    width: 15%;
    height: 15%;
    top: 50%;
    left: 28%;
    background: #009C3B;
    clip-path: polygon(20% 0, 80% 0, 100% 100%, 0 100%);
}

.argentina {
    width: 10%;
    height: 12%;
    top: 60%;
    left: 25%;
    background: #75AADB;
    clip-path: polygon(0 0, 100% 0, 90% 100%, 10% 100%);
}

/* Австралія */
.australia {
    width: 15%;
    height: 12%;
    top: 60%;
    left: 75%;
    background: #00008B;
    clip-path: polygon(20% 0, 80% 0, 100% 100%, 0 100%);
}

.meridian {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

/* Стилі для міграційних точок */
.migration-point {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: #e74c3c;
    border-radius: 50%;
    z-index: 10;
    box-shadow: 0 0 10px #ff6b6b, 0 0 15px rgba(231, 76, 60, 0.5);
    transform: translate(-50%, -50%);
    opacity: 0.8;
    animation: pulse 2s infinite;
}

/* Пульсація міграційних точок */
@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.8;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.8;
    }
}

@keyframes rotate {
    from {
        transform: rotateY(0deg) rotateX(-20deg);
    }
    to {
        transform: rotateY(360deg) rotateX(-20deg);
    }
}

/* Стилі для світлої теми */
body.light-theme .globe-sphere {
    background: radial-gradient(circle at 70% 70%, #3498db 0%, #1a5276 100%);
}

body.light-theme .meridian {
    border-color: rgba(255, 255, 255, 0.2);
}

body.light-theme .migration-point {
    background-color: #e74c3c;
    box-shadow: 0 0 10px #ff6b6b, 0 0 15px rgba(231, 76, 60, 0.5);
}

@media (max-width: 768px) {
    .globe-container {
        width: 240px;
        height: 240px;
    }
    
    .migration-point {
        width: 6px;
        height: 6px;
        z-index: 25;
        box-shadow: 0 0 6px #ff6b6b, 0 0 10px rgba(231, 76, 60, 0.5);
    }

    /* Менше дорогих перефарбувань під час обертання глобуса */
    .country {
        transition: none;
    }

    .country.has-data {
        filter: none;
        box-shadow: 0 0 8px rgba(46, 204, 113, 0.85), 0 0 14px rgba(46, 204, 113, 0.4);
    }
}

/* Інтерактивний tooltip над глобусом */
.globe-hover-tooltip {
    position: absolute;
    pointer-events: none;
    background: rgba(10, 22, 45, 0.92);
    color: #ffffff;
    border: 1px solid rgba(52, 152, 219, 0.5);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px;
    max-width: 240px;
    z-index: 40;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.globe-hover-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

/* Панель країн */
.globe-country-panel {
    position: absolute;
    right: 0;
    top: 10px;
    width: min(370px, calc(100vw - 32px));
    max-height: 78%;
    background: rgba(8, 18, 36, 0.96);
    border: 1px solid rgba(52, 152, 219, 0.45);
    border-radius: 12px;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.4);
    padding: 10px;
    z-index: 60;
    display: none;
}

.globe-country-panel.open {
    display: block;
}

.globe-country-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: #ecf0f1;
    margin-bottom: 4px;
}

.globe-country-panel-close {
    border: 0;
    border-radius: 8px;
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
    color: #ecf0f1;
    cursor: pointer;
}

.globe-country-panel-subtitle {
    font-size: 12px;
    color: #9fb6cb;
    margin-bottom: 8px;
}

.globe-country-search {
    width: 100%;
    border: 1px solid rgba(52, 152, 219, 0.35);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    padding: 8px 10px;
    margin-bottom: 8px;
    outline: none;
}

.globe-country-list {
    max-height: 320px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.globe-country-row {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.03);
}

.globe-country-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.globe-country-name {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}

.globe-country-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.globe-country-badges .badge {
    font-size: 11px;
    border-radius: 999px;
    padding: 3px 8px;
    border: 1px solid transparent;
}

.globe-country-badges .badge.vac {
    background: rgba(52, 152, 219, 0.18);
    color: #7ec8ff;
    border-color: rgba(52, 152, 219, 0.35);
}

.globe-country-badges .badge.spec {
    background: rgba(46, 204, 113, 0.16);
    color: #8bf6c7;
    border-color: rgba(46, 204, 113, 0.35);
}

.globe-country-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}

.globe-country-actions a {
    flex: 1;
    text-align: center;
    text-decoration: none;
    font-size: 12px;
    padding: 6px 8px;
    border-radius: 8px;
    color: #fff;
    border: 1px solid transparent;
}

.globe-country-actions .go-vac {
    background: rgba(52, 152, 219, 0.25);
    border-color: rgba(52, 152, 219, 0.5);
}

.globe-country-actions .go-spec {
    background: rgba(46, 204, 113, 0.24);
    border-color: rgba(46, 204, 113, 0.5);
}

@media (max-width: 768px) {
    .globe-country-panel {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: min(370px, calc(100vw - 20px));
        top: 8px;
    }
}