/* css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@700&display=swap');

:root {
    --primary-color: #4a90e2;
    --secondary-color: #ff9f43;
    --light-color: #f0f2f5;
    --dark-color: #343a40;
    --font-title: 'Fredoka One', cursive;
    --font-body: 'Nunito', sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    display: flex;
    height: 100vh;
    margin: 0;
    background-color: var(--light-color);
    overflow: hidden;
}

#game-container {
    display: flex;
    flex-direction: row;
    gap: 20px;
    width: 100%;
    height: 100%;
    padding: 20px;
}

#board-area {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 0;
}

#board-wrapper {
    position: relative;
    display: inline-block;
    line-height: 0;
}

#board-image {
    max-width: 100%;
    max-height: calc(100vh - 40px);
    height: auto;
    display: block;
    border-radius: 10px;
    border: 5px solid var(--dark-color);
}

#token-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.token {
    position: absolute;
    width: 5%;
    height: auto;
    object-fit: contain;
    transition: all 0.25s ease-in-out;
    transform: translate(-50%, -50%);
    z-index: 10;
}

#controls-area {
    flex: 0 0 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
}

h2 {
    font-family: var(--font-title);
    color: var(--dark-color);
}

#turn-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 1.2em;
    font-weight: bold;
    border-radius: 20px;
    padding: 5px 10px;
    transition: all 0.3s ease;
}

@keyframes attention {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 5px transparent;
    }

    50% {
        transform: scale(1.1);
        box-shadow: 0 0 15px var(--secondary-color);
    }
}

.attention-pulse {
    animation: attention 1s ease-in-out;
}

#turn-token-img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 3px solid var(--primary-color);
    object-fit: contain;
    padding: 2px;
    background-color: white;
}

#dice-container {
    text-align: center;
}

#dice {
    font-size: 5.5em;
    width: 90px;
    height: 90px;
    background-color: #fff;
    border: 3px solid var(--primary-color);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 15px;
    user-select: none;
    transition: transform 0.2s;
}

#dice.rolling {
    animation: roll 0.1s infinite;
}

@keyframes roll {
    0% {
        transform: rotate(0deg) scale(1.1);
    }

    50% {
        transform: rotate(180deg) scale(1);
    }

    100% {
        transform: rotate(360deg) scale(1.1);
    }
}

#roll-dice-btn {
    font-family: var(--font-title);
    padding: 12px 25px;
    font-size: 1.1em;
    cursor: pointer;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
}

#game-message {
    margin-top: 20px;
    width: 100%;
    font-weight: bold;
    text-align: center;
    padding: 10px;
    border-radius: 5px;
    border: 2px solid transparent;
    transition: all 0.3s;
}

#game-message.flash {
    animation: flash 1s;
}

@keyframes flash {

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

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

#bottom-controls {
    margin-top: auto;
    padding-top: 20px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

#logo-container {
    text-align: center;
}

#logo-img {
    width: 120px;
    height: auto;
    margin-bottom: 10px;
}

#pe-link {
    font-family: var(--font-title);
    text-decoration: none;
    background-color: var(--secondary-color);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9em;
}

#mute-btn {
    font-size: 1.5em;
    background: none;
    border: none;
    cursor: pointer;
    position: absolute;
    top: 10px;
    right: 10px;
}

/* --- Estilos de la Pantalla de Inicio --- */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.8));
    color: white;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

/* ===== NUEVO ESTILO AQUÍ ===== */
#splash-logo {
    width: 180px;
    height: auto;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

/* ============================= */
#splash-title {
    font-family: var(--font-title);
    font-size: 4em;
    margin-top: 0;
}

/* ===== NUEVOS ESTILOS AQUÍ ===== */
#theme-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
    width: 90%;
    max-width: 900px;
}

.theme-btn {
    font-family: var(--font-title);
    font-size: 1.2em;
    background: #6c757d;
    /* Color gris por defecto */
    color: white;
    border: 3px solid #f8f9fa;
    border-radius: 15px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.theme-btn.selected {
    background: var(--secondary-color);
    border-color: white;
    transform: scale(1.05);
    box-shadow: 0 0 15px var(--secondary-color);
}

#start-controls {
    margin-top: 25px;
    height: 60px;
    /* Damos altura para que el error no mueva el botón */
}

#start-game-btn {
    font-family: var(--font-title);
    font-size: 1.8em;
    background: #28a745;
    /* Verde para empezar */
    color: white;
    border: 3px solid white;
    border-radius: 15px;
    padding: 15px 40px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#start-game-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}


#splash-error {
    color: var(--secondary-color);
    font-weight: bold;
    margin-top: 10px;
    height: 20px;
    /* Espacio reservado para que no haya saltos */
    transition: opacity 0.3s;
}

.player-btn {
    font-family: var(--font-title);
    font-size: 1.5em;
    background: var(--primary-color);
    color: white;
    border: 3px solid white;
    border-radius: 15px;
    padding: 15px 30px;
    margin: 0 10px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    /* Añadimos transición */
}

/* ===== MODIFICACIÓN 3: Estilo para jugador seleccionado ===== */
.player-btn.selected {
    transform: scale(1.1);
    box-shadow: 0 0 15px var(--primary-color);
}

/* --- Estilos de los Modales --- */
.modal-overlay {
    font-family: var(--font-body);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #f9f9f9;
    padding: 25px;
    border-radius: 20px;
    width: 90%;
    max-width: 450px;
    text-align: center;
    border: 5px solid var(--primary-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

#question-title {
    font-family: var(--font-title);
    font-size: 2em;
    color: var(--dark-color);
    margin: 0 0 15px;
}

#question-text {
    font-size: 1.8em;
    font-weight: bold;
    color: #555;
    margin: 10px 0 20px;
}

#answers-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-top: 20px;
}

.answer-btn {
    font-family: var(--font-title);
    padding: 15px;
    font-size: 1.5em;
    cursor: pointer;
    border: 3px solid #ddd;
    background-color: #fff;
    color: #555;
    border-radius: 12px;
}

#play-again-btn {
    font-family: var(--font-title);
    padding: 15px 30px;
    font-size: 1.2em;
    cursor: pointer;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 10px;
}

/* --- ESTILOS PARA DISPOSITIVOS MÓVILES --- */
@media (max-width: 800px) {
    body {
        overflow: auto;
    }

    #game-container {
        flex-direction: column;
        height: auto;
        padding: 10px;
        gap: 15px;
    }

    #board-area {
        flex: 1 1 auto;
        width: 100%;
        order: 1;
    }

    #board-image {
        max-height: none;
        border-width: 3px;
    }

    #controls-area {
        order: 2;
        flex: 0 0 auto;
        width: 100%;
        padding: 15px;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-around;
        align-items: center;
        gap: 10px;
    }

    #turn-indicator {
        margin-bottom: 0;
        font-size: 1.1em;
    }

    #dice-container {
        margin-bottom: 0;
    }

    #game-message {
        width: 100%;
        margin-top: 10px;
        order: 3;
        font-size: 0.9em;
    }

    #bottom-controls {
        width: 100%;
        order: 4;
        margin-top: 15px;
        padding-top: 15px;
        border-top: 2px solid var(--light-color);
    }

    /* ===== NUEVO ESTILO AQUÍ ===== */
    #splash-logo {
        width: 150px;
        margin-bottom: 15px;
    }

    /* ============================= */
    #splash-title {
        font-size: 3em;
    }

    .theme-btn {
        font-size: 1em;
        padding: 8px 16px;
    }


    .player-btn {
        font-size: 1.2em;
        padding: 12px 24px;
        margin: 5px;
    }

    #question-title {
        font-size: 1.5em;
    }

    #question-text {
        font-size: 1.3em;
    }

    .answer-btn {
        font-size: 1.2em;
        padding: 12px;
    }
}

/* Ajustes adicionales para pantallas muy pequeñas */
@media (max-width: 400px) {

    /* ===== NUEVO ESTILO AQUÍ ===== */
    #splash-logo {
        width: 120px;
        margin-bottom: 10px;
    }

    /* ============================= */
    #splash-title {
        font-size: 2.5em;
    }

    #dice {
        font-size: 4.5em;
        width: 75px;
        height: 75px;
    }

    #roll-dice-btn {
        font-size: 1em;
        padding: 10px 20px;
    }

    .answer-btn,
    .player-btn {
        font-size: 1em;
    }
}