* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#game-container {
    width: 900px;
    max-width: 95vw;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.screen {
    display: none;
    min-height: 600px;
}

.screen.active {
    display: block;
}

.story-content {
    padding: 60px 40px;
    text-align: center;
}

.story-content h1 {
    font-size: 3em;
    color: #667eea;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.story-content p {
    font-size: 1.3em;
    line-height: 1.8;
    color: #333;
    margin-bottom: 40px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.finale {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 10px;
}

.finale p {
    font-size: 1.4em;
    color: #764ba2;
    font-weight: 500;
}

.finale::-webkit-scrollbar {
    width: 8px;
}

.finale::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.finale::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

.finale::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.game-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 18px 50px;
    font-size: 1.3em;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    font-weight: bold;
}

.game-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.game-button:active {
    transform: translateY(-1px);
}

#game-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.level-info h2 {
    font-size: 2em;
    margin-bottom: 5px;
}

.level-info p {
    font-size: 1.1em;
    opacity: 0.9;
}

.game-stats {
    text-align: right;
    font-size: 1.2em;
}

.game-stats span {
    display: block;
    margin-bottom: 5px;
}

#game-canvas-container {
    position: relative;
    padding: 20px;
    background: #f5f5f5;
}

#game-canvas {
    display: block;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

#instructions {
    text-align: center;
    margin-top: 15px;
    font-size: 1.1em;
    color: #666;
    font-weight: 500;
}

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

.game-button {
    animation: bounce 2s infinite;
}

.game-button:hover {
    animation: none;
}

#minigame-container {
    margin-top: 30px;
}

#minigame-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-width: 500px;
    margin: 0 auto;
}

.minigame-cell {
    width: 110px;
    height: 110px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 15px;
    border: 2px dashed rgba(102, 126, 234, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.minigame-character {
    width: 90px;
    height: 90px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3em;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    user-select: none;
    position: absolute;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    animation: bounce 1s ease-in-out infinite;
}

.minigame-character:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    animation: none;
}

.minigame-character:active {
    transform: scale(0.9);
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0px) scale(1);
    }
    50% {
        transform: translateY(-8px) scale(1.05);
    }
}

.minigame-character.correct {
    animation: correctPulse 0.5s ease;
}

.minigame-character.wrong {
    animation: wrongShake 0.5s ease;
}

@keyframes correctPulse {
    0%, 100% { transform: scale(1); background: linear-gradient(135deg, #2ECC40 0%, #01FF70 100%); }
    50% { transform: scale(1.2); }
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); background: linear-gradient(135deg, #FF4136 0%, #FF851B 100%); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

#minigame-score {
    display: block;
    margin-top: 15px;
    font-size: 1.4em;
    font-weight: bold;
    color: #667eea;
}

@media (max-width: 900px) {
    #game-canvas {
        width: 100%;
        height: auto;
    }

    .story-content {
        padding: 40px 20px;
    }

    .story-content h1 {
        font-size: 2em;
    }

    .story-content p {
        font-size: 1.1em;
    }

    #minigame-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .minigame-cell {
        width: 90px;
        height: 90px;
    }

    .minigame-character {
        width: 75px;
        height: 75px;
        font-size: 2.5em;
    }
}
