:root {
    --primary-font: 'Space Grotesk', sans-serif;
    --background-color: #f0f0f0;
    --modal-background: #ffffff;
    --modal-overlay: rgba(0, 0, 0, 0.5);
    --text-primary: #121212;
    --text-secondary: #555555;
    --text-tertiary: #888888;
    --accent-color: #007bff;
    --accent-hover: #0056b3;
    --button-secondary-bg: #6c757d;
    --button-secondary-hover: #5a6268;
    --border-color: #dddddd;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --info-panel-bg: rgba(255, 255, 255, 0.9);
}

body.dark-mode {
    --background-color: #121212;
    --modal-background: #1e1e1e;
    --modal-overlay: rgba(0, 0, 0, 0.85);
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-tertiary: #707070;
    --accent-color: #00aaff;
    --accent-hover: #0088cc;
    --button-secondary-bg: #333;
    --button-secondary-hover: #444;
    --border-color: #333;
    --shadow-color: rgba(0, 0, 0, 0.6);
    --info-panel-bg: rgba(20, 20, 20, 0.9);
}

/* --- Estilos Generales --- */
body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: var(--primary-font);
    overflow: hidden;
    background-color: var(--background-color);
    color: var(--text-primary);
}

/* --- Mapa --- */
#map {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
}

/* --- UI Superior --- */
.top-ui-container {
    position: fixed;
    top: 0px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0px;
    z-index: 500;
}

.game-ui {
    position: fixed;
    top: 100px; /* Ajustado para que no se superponga */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 500;
}

.current-target {
    background: #014286;
    color: #fff;
    padding: 10px 22px;
    border-radius: 1px;
    font-size: 1.3em;
    font-weight: 700;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
}

.current-description {
    background: #161601;
    color: #e7d808;
    padding: 10px 22px;
    border-radius: 1px;
    font-size: 1.2em;
    font-weight: 600;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
}


.timer {
    position: fixed;
    bottom: 70px; /* Ajustado para estar sobre el info-panel */
    left: 50%;
    transform: translateX(-50%);
    background: var(--info-panel-bg);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    box-shadow: 0 4px 15px var(--shadow-color);
    font-size: 1.1em;
    font-weight: 600;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 600; /* Asegura que esté sobre otros elementos */
}

.timer.timer-warning {
    background-color: #ff4136;
    color: #fff;
    animation: blink 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* --- Panel de Información Inferior --- */
.info-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--info-panel-bg);
    padding: 12px 20px;
    z-index: 500;
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -5px 20px var(--shadow-color);
    text-align: center;
    transition: transform 0.4s ease-in-out;
}

.info-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
}

.info-section {
    font-size: 1.1em;
    font-weight: 500;
}

.info-section .distance-close {
    color: #28a745;
}

.info-section .distance-medium {
    color: #007bff;
}

.info-section .distance-far {
    color: #ffc107;
}

.info-section .distance-very-far {
    color: #dc3545;
}

.info-section .time-bonus {
    color: #17a2b8;
    font-weight: bold;
}

.theme-toggle-icon {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    background: var(--info-panel-bg);
    color: var(--text-primary);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5em;
    cursor: pointer;
    z-index: 1001;
    border: 1px solid var(--border-color);
    transition: background-color 0.3s, transform 0.3s;
}

.theme-toggle-icon:hover {
    background-color: var(--accent-color);
    transform: scale(1.1);
}

/* --- Icono de Ayuda --- */
.help-icon {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: var(--info-panel-bg);
    color: var(--text-primary);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5em;
    font-weight: 700;
    cursor: pointer;
    z-index: 1001;
    border: 1px solid var(--border-color);
    transition: background-color 0.3s, transform 0.3s;
}

.help-icon:hover {
    background-color: var(--accent-color);
    transform: scale(1.1);
}

.credits-icon {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: var(--info-panel-bg);
    color: var(--text-primary);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5em;
    font-weight: 700;
    cursor: pointer;
    z-index: 1001;
    border: 1px solid var(--border-color);
    transition: background-color 0.3s, transform 0.3s;
}

.credits-icon:hover {
    background-color: var(--accent-color);
    transform: scale(1.1);
}

/* Estilo base para todas las etiquetas */
.tag {
    display: inline-block;
    padding: 5px 8px;
    border-radius: 0px;
    font-size: 0.75em;
    font-weight: 600;
    margin-left: 8px;
    margin-right: 8px;
    color: white;
}

/* Estilos específicos por categoría */
.tag-capitales {
    background-color: #3498db; /* Azul */
    border: 1px solid #0f3e5e;
}

.tag-monumentos {
    background-color: #e73c3c; /* Rojo */
    border: 1px solid #661c14;
}

.tag-naturaleza {
    background-color: #2ecc71; /* Verde */
    border: 1px solid #0f572d;
}

.tag-ciudades {
    background-color: #9b59b6; /* Morado */
    border: 1px solid #421455;
}

.tag-geo {
    background-color: #b2c507; /* Naranja */
    border: 1px solid #9e4509;
}

.tag-historia {
    background-color: #1abc9c; /* Turquesa */
    border: 1px solid #0a4136;
}

.tag-deporte {
    background-color: #e67e22; /* Naranja oscuro */
    border: 1px solid #612a06;
}


.modal-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 15px;
}

.credits-footer {
    margin-top: 25px;
    font-size: 0.9em;
    color: var(--text-tertiary);
}

/* --- Estilos de Modales --- */
.game-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modal-overlay);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.game-modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--modal-background);
    padding: 30px 40px;
    border-radius: 15px;
    box-shadow: 0 10px 40px var(--shadow-color);
    text-align: center;
    width: 90%;
    max-width: 500px;
    border: 1px solid var(--border-color);
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-title {
    font-size: 2.2em;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 15px;
}

.modal-description {
    font-size: 1.1em;
    color: var(--text-secondary);
    margin-bottom: 25px;
    line-height: 1.6;
}

.modal-text {
    text-align: left;
    margin-bottom: 25px;
    color: var(--text-secondary);
}
.modal-text ul { padding-left: 20px; }

.modal-settings {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.setting {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.setting label {
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-secondary);
}

.setting select,
.setting input[type="text"] {
    width: 100%;
    box-sizing: border-box; /* Asegura que el padding no afecte el ancho total */
}

.setting select {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #f8f9fa;
    color: var(--text-primary);
    font-size: 1em;
}

body.dark-mode .setting select {
    background: #2c2c2c;
}

.modal-button {
    background: var(--accent-color);
    color: #fff;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    transition: background-color 0.3s, transform 0.2s;
    margin: 5px;
}

.modal-button:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

.setting input[type="text"] {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #f8f9fa;
    color: var(--text-primary);
    font-size: 1em;
    width: 160px;
}

body.dark-mode .setting input[type="text"] {
    background: #2c2c2c;
}

.modal-button:disabled {
    background-color: var(--button-secondary-bg);
    cursor: not-allowed;
    transform: none;
}

.modal-button:disabled:hover {
    background-color: var(--button-secondary-bg);
}

.modal-button.secondary {
    background: var(--button-secondary-bg);
}

.modal-button.secondary:hover {
    background: var(--button-secondary-hover);
}

/* --- Fin de Juego y Ranking --- */
.end-game-summary {
    margin-bottom: 20px;
}

.end-game-emoji {
    font-size: 4em;
    display: block;
    margin-bottom: 15px;
}

.ranking-form input {
    width: 80%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #2c2c2c;
    color: var(--text-primary);
    font-size: 1em;
    margin-bottom: 15px;
}

.ranking-list {
    list-style: none;
    padding: 0;
    margin-bottom: 25px;
    text-align: left;
}

.ranking-list li {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    font-size: 1.1em;
}

.ranking-list li:last-child {
    border-bottom: none;
}

.ranking-list .rank-name {
    font-weight: 600;
}

.ranking-list .rank-score {
    color: var(--accent-color);
    font-weight: 700;
}



/* --- Media Queries para Responsividad --- */
@media (max-width: 600px) {
    .modal-content { width: 95%; padding: 20px; }
    .modal-title { font-size: 1.8em; }
    .modal-description { font-size: 1em; }
    .modal-settings { flex-direction: column; gap: 20px; }
    .setting select { width: 100%; }
    .game-ui { top: 10px; gap: 5px; }
    .current-target, .level-indicator, .timer { font-size: 0.9em; padding: 6px 12px; }
    .info-panel { padding: 8px; }
    .info-section { font-size: 0.9em; }
    .help-icon { top: 10px; right: 10px; width: 35px; height: 35px; font-size: 1.3em; }
}
