:root {
    --primary: #FF6B6B;
    --secondary: #ff9800;
    --accent: #FFE66D;
    --bg: #F7FFF7;
    --text: #2F2F2F;
    --correct: #4CAF50;
    --wrong: #F44336;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Comic Sans MS', 'Chalkboard SE', 'cursive', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    position: relative;
    background: none;
    color: var(--text);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

body::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(2px) brightness(0.9);
    z-index: 0;
    pointer-events: none;
}

#app {
    width: 100%;
    max-width: 1000px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    position: relative;
    /* z-index: 1; */
}

.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    animation: fadeIn 0.5s ease-out;
}

.screen.active {
    display: flex;
}

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

/* START SCREEN */

#start-screen {
    text-align: center;
}

.title-img {
    width: 350px;
    max-width: 500px;
    margin-bottom: 30px;
    animation: floaty 3s ease-in-out infinite;
}

@keyframes floaty {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

#start-screen::before,
#game-screen::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle, rgba(0, 0, 0, 0.25) 0%, rgba(0, 0, 0, 0) 70%),
        url('assets/images/bg.webp') center/cover no-repeat;
    z-index: -1;
}

.start-btn {
    width: 220px;
    cursor: pointer;
    transition: transform 0.2s ease;
    animation: pulse 2s infinite;
    z-index: 2;
    position: relative;
}

.start-btn:hover {
    transform: scale(1.05);
}

.start-btn:active {
    transform: scale(0.95);
}

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

/* GAME SCREEN */

.game-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.timer {
    font-size: 2rem;
    background: white;
    padding: 10px 20px;
    border-radius: 15px;
    border: 4px solid var(--secondary);
    box-shadow: 0 0 15px rgba(255, 152, 0, 0.6);
    animation: timerPulse 1.5s infinite;
}

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

.game-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.image-box {
    position: relative;
    width: 90%;
    max-width: 700px;
    aspect-ratio: 3 / 2;
    background: #ddd;
    border-radius: 15px;
    overflow: hidden;
    transform: perspective(1000px) rotateX(2deg);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.25),
        inset 0 2px 10px rgba(255, 255, 255, 0.2);
}

.image-box::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 15px;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.25), transparent 70%);
    opacity: 0.6;
    pointer-events: none;
}

.image-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.05);
}

.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(6, 1fr);
}

.grid-block {
    background: linear-gradient(135deg, #6EC1FF, #4A90E2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.3),
        inset 0 -2px 4px rgba(0, 0, 0, 0.2);
}

.grid-block.hidden {
    opacity: 0;
    transform: scale(0.4) rotate(12deg);
    pointer-events: none;
    animation: popDisappear 0.3s ease forwards;
}

@keyframes popDisappear {
    0% { transform: scale(1) rotate(0); opacity: 1; }
    100% { transform: scale(0.3) rotate(15deg); opacity: 0; }
}

.options-box {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 200px;
    justify-content: center;
}

.option-btn {
    background: linear-gradient(180deg, #ffffff, #f2f2f2);
    border: 4px solid var(--secondary);
    padding: 10px;
    margin-bottom: 20px;
    font-size: 1.5rem;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    box-shadow:
        0 8px 0 #d87c00,
        0 12px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.15s ease;
}

.option-btn:hover {
    background-color: #fff6ea;
    transform: translateY(-3px) scale(1.05);
    box-shadow:
        0 10px 0 #d87c00,
        0 20px 25px rgba(255, 152, 0, 0.3);
}

.option-btn:active {
    transform: translateY(6px) scale(0.95);
}

.option-btn.correct {
    background-color: var(--correct);
    color: black;
    border-color: #388E3C;
    animation: correctPop 0.4s ease, glowGreen 0.6s ease;
    box-shadow:
        0 8px 0 #2e7d32,
        0 12px 20px rgba(0, 0, 0, 0.2);
}

@keyframes glowGreen {
    0% { box-shadow: 0 0 0 rgba(76, 175, 80, 0); }
    50% { box-shadow: 0 0 25px rgba(76, 175, 80, 0.8); }
    100% { box-shadow: 0 8px 0 #2e7d32; }
}

@keyframes correctPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.option-btn.wrong {
    background-color: var(--wrong);
    color: black;
    border-color: #D32F2F;
    box-shadow:
        0 8px 0 #9a0007,
        0 12px 20px rgba(0, 0, 0, 0.2);
    animation: shake 0.4s ease;
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    50% { transform: translateX(6px); }
    75% { transform: translateX(-4px); }
    100% { transform: translateX(0); }
}

/* END SCREEN */

#end-screen {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999;
    background: url('assets/images/end.webp') center bottom / cover no-repeat;
    background-color: #cfe9ff;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 40px;
}

#end-screen.active {
    display: flex;
}

#end-screen::before {
    display: none;
}

.complete-img {
    width: 350px;
    max-width: 500px;
    margin-bottom: 2px;
    animation: floaty 3s ease-in-out infinite, popIn 0.6s ease;
}

@keyframes popIn {
    from { transform: scale(0.6); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.score-text {
    font-size: 3.5rem;
    font-weight: bold;
    margin-top: 10px;
    background: linear-gradient(180deg, #ffffff, #ffe082);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow:
        0 4px 0 #d4a017,
        0 8px 20px rgba(0, 0, 0, 0.25);
    transform: perspective(500px) translateZ(20px);
}

.trophy {
    position: fixed;
    top: -100px;
    width: 40px;
    pointer-events: none;
    z-index: 1000;
    animation: fall linear forwards;
}

@keyframes fall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(110vh) rotate(var(--rotate-end)); opacity: 0; }
}

@media (max-width: 900px) {
    .game-container {
        flex-direction: column;
        align-items: center;
    }
    .image-box {
        width: 350px;
        height: 350px;
    }
    .options-box {
        width: 100%;
        max-width: 400px;
    }
    h1 {
        font-size: 2.5rem;
    }
}

#global-logo {
    position: absolute;
    top: 20px;
    right: 20px;
    height: 50px;
    z-index: 100;
    pointer-events: none;
}

