/* ===== DARKER BLUE BACKGROUND ===== */

.worlds-body {
    background: linear-gradient(to bottom, #06275a, #0a3b7a) !important;
    min-height: 100vh;
    overflow: hidden;
}

/* ===== WORLD MAP CONTAINER ===== */

.world-map {
    position: fixed;
    inset: 0;
    top: 200px;
    perspective: 1200px;
    overflow: hidden;
}

/* ===== 3D CUBE ===== */

.world-cube {
    position: absolute;
    width: 120px;
    height: 120px;
    cursor: pointer;
    animation: cubeFloat 6s ease-in-out infinite;
}

/* Stagger float animations */
.world-cube:nth-child(1) { animation-delay: 0s; }
.world-cube:nth-child(2) { animation-delay: 1.5s; }
.world-cube:nth-child(3) { animation-delay: 3s; }
.world-cube:nth-child(4) { animation-delay: 4.5s; }

/* Float animation for Genesis Earth (centered) */
.world-cube:nth-child(1) {
    animation: cubeFloatCenter 6s ease-in-out infinite;
}

@keyframes cubeFloatCenter {
    0%, 100% { transform: translateX(-50%) translateY(0px); }
    50% { transform: translateX(-50%) translateY(-30px); }
}

/* Float animation for horizontal cubes */
@keyframes cubeFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-30px); }
}

/* Inner cube wrapper that handles rotation */
.cube-inner {
    position: absolute;
    width: 80px;
    height: 80px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transform-style: preserve-3d;
    animation: cubeRotate 20s linear infinite;
    animation-play-state: running;
}

@keyframes cubeRotate {
    0% { transform: translate(-50%, -50%) rotateX(0deg) rotateY(0deg); }
    100% { transform: translate(-50%, -50%) rotateX(360deg) rotateY(360deg); }
}

/* Speed up rotation on hover - uses animation-duration to stay synced */
.world-cube:hover .cube-inner {
    animation-duration: 10s;
}

/* Cube faces */
.cube-face {
    position: absolute;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, 
        rgba(30,111,209,0.7),
        rgba(30,111,209,0.9)
    );
    border: 2px solid rgba(100,170,255,0.5);
    box-shadow: 
        inset 0 0 20px rgba(255,255,255,0.2),
        0 0 20px rgba(30,111,209,0.4);
    transition: all 0.3s ease;
}

.front  { transform: translateZ(40px); }
.back   { transform: translateZ(-40px) rotateY(180deg); }
.left   { transform: rotateY(-90deg) translateZ(40px); }
.right  { transform: rotateY(90deg) translateZ(40px); }
.top    { transform: rotateX(90deg) translateZ(40px); }
.bottom { transform: rotateX(-90deg) translateZ(40px); }

/* Hover glow effect - lighter and brighter */
.world-cube:hover .cube-face {
    background: linear-gradient(135deg, 
        rgba(120,190,255,0.85),
        rgba(100,170,255,0.95)
    );
    border: 2px solid rgba(150,210,255,0.8);
    box-shadow: 
        inset 0 0 30px rgba(255,255,255,0.5),
        0 0 40px rgba(120,190,255,0.9);
}

/* Cube label - positioned above cube, stays static */
.cube-label {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 13px;
    letter-spacing: 1.5px;
    opacity: 0.85;
    text-shadow: 0 2px 10px rgba(0,0,0,0.8);
    pointer-events: none;
    animation: labelFloat 6s ease-in-out infinite;
}

/* Label floats gently with the cube container */
@keyframes labelFloat {
    0%, 100% { transform: translateX(-50%) translateY(0px); }
    50% { transform: translateX(-50%) translateY(-5px); }
}

/* Genesis Earth label needs different float to match its centering */
.world-cube:nth-child(1) .cube-label {
    animation: labelFloatCenter 6s ease-in-out infinite;
}

@keyframes labelFloatCenter {
    0%, 100% { transform: translateX(-50%) translateY(0px); }
    50% { transform: translateX(-50%) translateY(-5px); }
}

.world-cube:hover .cube-label {
    opacity: 1;
    font-size: 14px;
}

/* ===== LOCATION DETAIL PANEL ===== */

.location-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    max-width: 90%;
    background: linear-gradient(135deg, #1e6fd1 0%, #1a56a8 100%);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 
        0 20px 60px rgba(0,0,0,0.7),
        inset 0 0 30px rgba(255,255,255,0.1);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.location-panel.active {
    opacity: 1;
    visibility: visible;
}

/* Backdrop overlay */
.location-panel::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.location-panel.active::before {
    opacity: 1;
}

.panel-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s ease;
    line-height: 1;
}

.panel-close:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(90deg);
}

#locationName {
    font-size: 26px;
    letter-spacing: 2px;
    margin-bottom: 20px;
    color: white;
}

#locationDesc {
    font-size: 15px;
    line-height: 1.8;
    color: rgba(255,255,255,0.95);
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

/* Locations List */
.locations-list {
    margin-top: 20px;
}

.location-item {
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.location-item:hover {
    background: rgba(255,255,255,0.2);
    transform: translateX(5px);
}

.location-item h3 {
    font-size: 16px;
    letter-spacing: 1px;
    margin: 0 0 8px 0;
    color: white;
}

.location-item p {
    font-size: 13px;
    line-height: 1.6;
    margin: 0;
    color: rgba(255,255,255,0.85);
}

/* Responsive */
@media (max-width: 768px) {
    .world-cube {
        width: 100px;
        height: 100px;
    }
    
    .cube-inner {
        width: 60px;
        height: 60px;
    }
    
    .cube-face {
        width: 60px;
        height: 60px;
    }
    
    .front  { transform: translateZ(30px); }
    .back   { transform: translateZ(-30px) rotateY(180deg); }
    .left   { transform: rotateY(-90deg) translateZ(30px); }
    .right  { transform: rotateY(90deg) translateZ(30px); }
    .top    { transform: rotateX(90deg) translateZ(30px); }
    .bottom { transform: rotateX(-90deg) translateZ(30px); }
    
    .location-panel {
        width: 95%;
        padding: 30px 20px;
    }
}