@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;
}

#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;
}

#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: 0;
}

.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: 15px 10px;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.3s;
}

.player-btn:hover:not(:disabled) {
    transform: scale(1.05);
}

.player-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#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;
    line-height: 0;
}

#board-image {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 40px);
}

#node-layer,
#token-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.node-hotspot {
    position: absolute;
    width: 3%;
    height: 4.2%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: auto;
    cursor: pointer;
    background-color: rgba(255, 215, 0, 0);
    transition: background-color 0.3s;
    z-index: 5;
}

.node-hotspot.choice-highlight {
    background-color: rgba(0, 150, 255, 0.7);
    border: 3px solid #00c3ff;
    z-index: 15;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 0 0 rgba(0, 195, 255, 0.7);
    }

    70% {
        transform: translate(-50%, -50%) scale(1.1);
        box-shadow: 0 0 10px 20px rgba(0, 195, 255, 0);
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 0 0 rgba(0, 195, 255, 0);
    }
}

.token-container {
    position: absolute;
    width: 10%;
    height: 14%;
    transition: all 0.5s ease-in-out;
    z-index: 10;
}

.token-part {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.token-part.quesito {
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    width: 12%;
    height: 12%;
    transform: translate(-50%, -50%);
}

.token-part.quesito.mates {
    top: 51%;
    left: 38%;
}

.token-part.quesito.lengua {
    top: 51%;
    left: 62%;
}

.token-part.quesito.cienciasnaturales {
    top: 51%;
    left: 50%;
}

.token-part.quesito.cienciassociales {
    top: 64%;
    left: 50%;
}

.token-part.quesito.deportes {
    top: 65%;
    left: 38%;
}

.token-part.quesito.ingles {
    top: 65%;
    left: 62%;
}

.token-part.quesito.earned {
    opacity: 1;
}

/* --- NUEVO: Estilo para la animación de DESTELLO del quesito --- */
.quesito-flash-animation {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 70vmin;
    /* Ocupa el 70% de la dimensión más pequeña de la pantalla */
    height: 70vmin;
    z-index: 3000;
    pointer-events: none;
    animation: flashAndGrow 2s ease-in-out forwards;
}

@keyframes flashAndGrow {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }

    20% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 1;
    }

    40% {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0.8;
    }

    60% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 1;
    }

    80% {
        transform: translate(-50%, -50%) scale(0.95);
        opacity: 0.9;
    }

    100% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0;
    }
}

/* ----------------------------------------------------------------- */

#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;
}

#mute-btn {
    font-size: 1.5em;
    background: none;
    border: none;
    cursor: pointer;
    position: absolute;
    top: 10px;
    right: 10px;
}

#turn-indicator {
    text-align: center;
    margin-bottom: 20px;
}

#turn-token-display {
    width: 80px;
    height: 80px;
    margin: 0 auto 10px;
    position: relative;
}

#turn-text {
    font-family: var(--font-title);
    font-size: 1.5em;
    word-break: break-word;
}

#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;
}

#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;
    transition: background-color 0.2s, transform 0.2s;
}

#roll-dice-btn:disabled {
    background-color: #aaa;
    cursor: not-allowed;
}

#roll-dice-btn:hover:not(:disabled) {
    transform: scale(1.05);
}

#game-message {
    margin-top: auto;
    width: 100%;
    font-weight: bold;
    text-align: center;
    padding: 15px;
    border-radius: 5px;
    border: 2px solid transparent;
    min-height: 80px;
}

.modal-overlay {
    font-family: var(--font-body);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    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);
}

#name-inputs-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px 0;
    width: 100%;
}

.name-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.name-input-group label {
    font-weight: bold;
    color: var(--dark-color);
    flex-basis: 120px;
    text-align: left;
}

.name-input-group input {
    flex-grow: 1;
    padding: 10px;
    border: 2px solid #ccc;
    border-radius: 8px;
    font-size: 1em;
}

#start-game-btn {
    margin-top: 10px;
}

#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;
}

@media (max-width: 900px) {
    body {
        overflow: auto;
    }

    #game-container {
        flex-direction: column;
        height: auto;
        padding: 10px;
        gap: 15px;
    }

    #board-area {
        order: 1;
    }

    #board-image {
        max-height: none;
    }

    #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;
    }

    #game-message {
        margin-top: 10px;
        order: 3;
        width: 100%;
    }

    #splash-title {
        font-size: 3em;
    }

    #turn-token-display {
        width: 60px;
        height: 60px;
    }

    #turn-text {
        font-size: 1.2em;
    }
}