:root {
    --pink: #FFB7C5;
    --blue: #A2D2FF;
    --yellow: #FFFFE0;
    --green: #D4F1BE;
    --lavender: #E0BBE4;
    --dark-text: #5D5D5D;
    --white: #FFFFFF;
    --shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Fredoka', sans-serif;
    color: var(--dark-text);
    overflow: hidden;
    background: #000;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#globeViz {
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: none;
}

#globeViz:active {
    cursor: grabbing;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 10;
}

/* Header */
header {
    padding: 1rem;
    pointer-events: none;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    border-radius: 50px;
    box-shadow: var(--shadow);
    pointer-events: auto;
    max-width: 800px;
    margin: 0 auto;
    border-bottom: 4px solid var(--pink);
    width: 95%;
    /* Mobile friendly default */
}

.header-left,
.header-right,
.header-center {
    display: flex;
    align-items: center;
}

.home-btn,
.icon-btn {
    text-decoration: none;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: transform 0.2s;
    background: white;
    border: 2px solid #eee;
    padding: 5px;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--dark-text);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.home-btn:hover,
.icon-btn:hover {
    transform: scale(1.1);
    border-color: var(--pink);
}

.home-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.score-display {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--blue);
    background: white;
    padding: 8px 18px;
    border-radius: 20px;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.1);
    border: 2px solid #f0f0f0;
    min-width: 100px;
    text-align: center;
}

/* Panels */
.panel {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 25px;
    border-radius: 30px;
    text-align: center;
    box-shadow: var(--shadow);
    max-width: 90%;
    width: 400px;
    margin: 0 auto;
    border: 4px solid var(--blue);

    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    transition: transform 0.3s, opacity 0.3s;
}

.hidden {
    transform: translateX(-50%) translateY(150px);
    opacity: 0;
    pointer-events: none;
}

/* Texts */
#action-prompt {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 10px;
}

#event-year {
    font-size: 2.2rem;
    color: var(--pink);
    margin-bottom: 5px;
    font-weight: 800;
}

#event-desc {
    font-size: 1.1rem;
    margin-bottom: 15px;
    line-height: 1.4;
}

.timer-bar {
    width: 100%;
    height: 10px;
    background: #eee;
    border-radius: 5px;
    overflow: hidden;
    margin-top: 15px;
}

#timer-fill {
    height: 100%;
    background: var(--green);
    width: 0%;
    transition: width 0.5s linear;
}

/* Feedback */
#feedback-title {
    font-size: 2rem;
    margin-bottom: 5px;
    color: var(--blue);
}

#feedback-location {
    font-size: 1.3rem;
    margin: 5px 0;
    color: #555;
    font-weight: bold;
}

#feedback-distance {
    font-size: 1.2rem;
    color: #888;
}

#feedback-points {
    font-size: 1.8rem;
    color: var(--pink);
    font-weight: 800;
    margin: 10px 0;
}

/* Buttons */
.action-btn {
    background: var(--blue);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1.2rem;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    transition: transform 0.1s;
    box-shadow: 0 5px 0 #89C2D9;
}

.action-btn:active {
    transform: translateY(3px);
    box-shadow: 0 2px 0 #89C2D9;
}

.action-btn.secondary {
    background: #eee;
    color: #555;
    box-shadow: 0 5px 0 #ccc;
    margin-left: 10px;
}

.action-btn.secondary:active {
    box-shadow: 0 2px 0 #ccc;
}

/* Screens & Menu */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
}

.centered-panel {
    background: rgba(255, 255, 255, 0.98);
    padding: 40px;
    border-radius: 40px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    border: 6px solid var(--pink);
    box-shadow: 0 15px 0 var(--lavender), 0 30px 60px rgba(0, 0, 0, 0.3);
}

.mode-select {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin: 30px 0;
}

.mode-btn {
    background: white;
    border: 3px solid var(--blue);
    padding: 12px 24px;
    border-radius: 20px;
    font-size: 1.1rem;
    color: var(--blue);
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 5px 0 var(--blue);
    transition: transform 0.1s;
}

.mode-btn:active {
    transform: translateY(3px);
    box-shadow: 0 2px 0 var(--blue);
}

.lang-select {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 25px;
}

.lang-btn {
    background: white;
    border: 2px solid #ddd;
    padding: 10px 18px;
    border-radius: 15px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 0 #ddd;
    transition: transform 0.1s;
}

.lang-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #ddd;
}

.lang-btn.active {
    border-color: var(--pink);
    background: #fff0f5;
    box-shadow: 0 4px 0 var(--pink);
}

/* Zoom Slider */
#mobile-zoom-container {
    display: none;
    /* Controlled by JS now */
    position: absolute;
    top: 90px;
    /* Below header */
    right: 15px;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    padding: 10px 5px;
    border-radius: 15px;
    z-index: 50;
    border: 2px solid var(--blue);
}

#zoom-slider {
    -webkit-appearance: slider-vertical;
    appearance: slider-vertical;
    width: 20px;
    height: 150px;
    margin: 10px 0;
}

@media (max-width: 600px) {
    .header-content {
        padding: 8px 10px;
    }

    .score-display {
        font-size: 1rem;
        padding: 5px 12px;
        min-width: 80px;
    }

    .home-btn,
    .icon-btn {
        width: 40px;
        height: 40px;
    }

    .panel {
        width: 95%;
        bottom: 90px;
        padding: 20px 15px;
    }

    .centered-panel {
        padding: 25px 15px;
    }

    .action-btn {
        width: 100%;
        display: block;
        margin: 10px 0;
    }

    .action-btn.secondary {
        margin-left: 0;
    }
}
/* ========================================================
   OPTIMIZACIONES GLOBALES DE RENDIMIENTO (GLOBAL PERF)
   ======================================================== */
@media (max-width: 768px) {
    /* Disable expensive full-screen background animations on mobile */
    body::before, body::after {
        animation: none !important;
        opacity: 0.2 !important; /* static fallback */
    }
    
    /* Optimize composite layering */
    .game-layer, .board, .card, .cell, .modal-content {
        contain: layout style;
    }
}
