:root {
    --bg: #f5f3ff;
    --primary: #c4b5fd;
    --secondary: #a78bfa;
    --accent: #7c3aed;
    --white: #ffffff;
}

body {
    margin: 0;
    font-family: 'Dancing Script', cursive;
    background: var(--bg);
    text-align: center;
}

.hidden {
    display: none !important;
}

/* Pantalla inicial */
#start-screen {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at top, #c4b5fd 0%, #f5f3ff 45%, #ede9fe 100%);
}

.star-content {
    position: relative;
    z-index: 2;

    animation: fadeEntrance 1.5s ease;
}

.star-content h1 {
    font-size: clamp(2.5rem, 5vw, 5rem);
    color: #5b21b6;
    margin-bottom: 20px;
    text-shadow: 0 0 15px rgba(124, 58, 237, 0.25);
}

.star-content button {
    padding: 14px 28px;
    font-size: 1.2rem;
    border-radius: 16px;
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
    box-shadow: 0 10px 30px rgba(124, 58, 237, 0.3);
    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease;
}

.star-content button:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 15px 35px rgba(124, 58, 237, 0.44);
}

#particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 1;
}

.particle {
    position: absolute;
    font-size: clamp(18px, 2vw, 28px);
    animation:
        floatParticle linear infinite,
        pulseParticle 3s ease-in-out infinite;
    opacity: 0.8;
    user-select: none;
    pointer-events: none;
}

@keyframes floatParticle {
    from {
        transform: translateY(110vh);
    }

    to {
        transform: translateY(-120vh);
    }
}

@keyframes pulseParticle {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

@keyframes fadeEntrance {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }

}

/* Contenedor del juego */
#game-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 50px;
    box-sizing: border-box;
}

/* Grid */
#game {
    width: min(92vw, 520px);
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    aspect-ratio: 1 / 1;
    margin: 0 auto;
}

@media (max-width: 768px) {

    #game {
        width: 95vw;
    }

}

/* Celdas */
.cell {
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: #ede9fe;
    transition: all 0.2s ease;
    aspect-ratio: 1 / 1;
}

.visited-path {
    background: #e9e4f7 !important;
    opacity: 0.55;
}

/* Niebla */
.hidden-cell {
    background: #ddd6fe;
}

/* Celda clickeable */
.cell.clickable {
    cursor: pointer;
    background: #c4b5fd;
}

/* .cell.clickable:hover {
    transform: scale(1.05);
    background: #a78bfa;
} */

@media (hover: hover) {

    .cell.clickable:hover {
        transform: scale(1.05);
        background: #a78bfa;
    }

}

/* Jugador */
.player {
    font-size: 2rem;
    position: relative;

    animation: playerMove 0.25s ease;
}

@keyframes playerMove {
    from {
        transform: scale(0.6);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.player::after {
    content: "";
    position: absolute;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.5), transparent);
    top: -35px;
    left: -35px;
    pointer-events: none;
}

/* Controles */
#controls {
    margin-top: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

#controls .middle {
    display: flex;
    gap: 10px;
}

#controls button {
    width: 60px;
    height: 60px;

    border: none;
    border-radius: 15px;

    background: var(--secondary);
    color: white;

    font-size: 20px;

    display: flex;
    align-items: center;
    justify-content: center;

    transition: transform 0.1s ease, background 0.2s ease;
}

@media (max-width: 480px) {
    #controls button {
        width: 50px;
        height: 50px;
        font-size: 18px;
    }
}

#controls button:active {
    transform: scale(0.95);
}

button {
    padding: 10px;
    margin: 5px;
    border: none;
    border-radius: 10px;
    background: var(--secondary);
    color: white;
    font-size: 16px;
}

/* Modal */
#modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    z-index: 1000;
}

.modal-content {
    background: white;
    width: min(90vw, 550px);
    padding: clamp(16px, 3vw, 24px);
    border-radius: 20px;

    animation: pop 0.4s ease;

    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.25),
        0 0 25px rgba(124, 58, 237, 0.15);

    transform-origin: center;
}

#modal-text {
    font-size: clamp(20px, 4vw, 30px);
    line-height: 1.3;
    margin-top: 15px;
}

.modal-image,
.modal-video {
    width: 100%;
    max-height: 60vh;
    object-fit: cover;
    border-radius: 12px;
    display: block;
}

.modal-video {
    background: black;
}

/* Iconos dentro de celdas */
.event-icon {
    width: 40%;
    height: 40%;
    object-fit: contain;
    pointer-events: none;
    /* evita interferencia con clicks */
    transition: transform 0.2s ease;
    opacity: 0;
    transform: scale(0.5);
    animation: fadeInIcon 0.3s ease forwards;
}

/* Hover más bonito */
@media (hover: hover) {
    .cell.clickable:hover .event-icon {
        transform: scale(1.2);
    }
}

/* Ajuste para que el contenido no “salte” */
.cell {
    position: relative;
}

@keyframes fadeInIcon {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pop {
    from {
        transform: scale(0.7) translateY(10px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}


#final-screen {
    position: fixed;
    inset: 0;

    overflow: hidden;

    z-index: 5000;

    display: flex;
    justify-content: center;
    align-items: center;
}

#final-screen::before {
    content: "";

    position: absolute;
    inset: 0;

    /* background: rgba(15, 10, 25, 0.55); */
    background: rgba(195, 181, 253, 0.70);

    backdrop-filter: blur(12px);

    z-index: 0;
}

.final-message {
    position: relative;
    z-index: 2;
    width: min(90vw, 850px);
    padding: 40px 30px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px);
    border:
        1px solid rgba(255, 255, 255, 0.15);
    box-shadow:
        0 0 50px rgba(0, 0, 0, 0.35);
    text-align: center;
    color: white;
}

.final-message h1 {
    font-size: clamp(4rem, 9vw, 8rem);
    margin: 0;
    color: white;
    text-shadow:
        0 0 30px rgba(0, 0, 0, 0.6);
    animation:
        textReveal 1s ease forwards;
}

/* SUBTÍTULO */
.final-message h2 {
    font-size: clamp(2rem, 5vw, 4rem);
    margin-top: 15px;
    color: #f5d0fe;
    opacity: 0;
    animation:
        textReveal 1s ease forwards;
    animation-delay: 0.6s;
}

/* TEXTO */
.final-message p {
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    line-height: 1.5;
    margin-top: 20px;
    opacity: 0;
    animation:
        textReveal 1s ease forwards;
    animation-delay: 1.2s;
    text-shadow:
        0 0 15px rgba(0, 0, 0, 0.5);
}

/* FRASE FINAL */
.final-message h3 {
    font-size: clamp(2rem, 4vw, 4rem);
    margin-top: 30px;
    color: #c4b5fd;
    opacity: 0;
    animation:
        textReveal 1s ease forwards;
    animation-delay: 1.8s;
    text-shadow:
        0 0 20px rgba(124, 58, 237, 0.8);
}

/* ANIMACIÓN TEXTO */
@keyframes textReveal {
    from {
        opacity: 0;
        transform: translateY(30px);
        filter: blur(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

/* CONTENEDOR DE POLAROIDS */
#polaroid-container {
    position: absolute;
    inset: 0;
    z-index: 5;
}

/* POLAROID */
.polaroid {
    position: absolute;
    width: clamp(120px, 18vw, 220px);
    background: white;
    padding: 10px 10px 35px;
    border-radius: 8px;
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.35);
    transition:
        transform 0.5s ease,
        opacity 0.5s ease;
    /* cursor: pointer; */
    animation:
        floatingPolaroid 4s ease-in-out infinite;
}

/* IMAGEN */
.polaroid img {
    width: 100%;
    display: block;
    border-radius: 4px;
}

/* AL QUITAR FOTO */
.remove-polaroid {
    opacity: 0;
    transform:
        scale(0.5) rotate(15deg);
    pointer-events: none;
}

/* MOVIMIENTO SUAVE */
@keyframes floatingPolaroid {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}