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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.game-container {
    width: 100%;
    max-width: 800px;
    padding: 20px;
}

.game-header {
    margin-bottom: 20px;
}

.back-link {
    display: inline-block;
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 10px;
    transition: background 0.2s;
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.2);
}

h1 {
    font-size: 2.5rem;
    text-align: center;
}

.game-layout {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.game-area {
    position: relative;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

#game-canvas {
    display: block;
    width: 400px;
    height: 600px;
    background: #1a1a2e;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 180px;
}

.info-panel {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
}

.info-panel h3 {
    font-size: 0.9rem;
    margin-bottom: 10px;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-value {
    font-size: 2rem;
    font-weight: bold;
    color: #fbbf24;
}

#next-canvas {
    display: block;
    width: 120px;
    height: 120px;
    margin: 0 auto;
    background: #1a1a2e;
    border-radius: 8px;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.overlay.hidden {
    display: none;
}

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

.overlay-content h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.overlay-content p {
    font-size: 1.1rem;
    margin-bottom: 20px;
    opacity: 0.9;
}

.controls {
    list-style: none;
    text-align: left;
    margin: 20px auto;
    display: inline-block;
}

.controls li {
    padding: 8px 0;
    font-size: 1rem;
}

.controls strong {
    color: #fbbf24;
    margin-right: 10px;
}

.btn {
    padding: 15px 40px;
    font-size: 1.2rem;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-weight: 600;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.final-score {
    font-size: 1.5rem;
    margin: 30px 0;
}

#final-score {
    color: #fbbf24;
    font-weight: bold;
}

@media (max-width: 768px) {
    .game-layout {
        flex-direction: column;
        align-items: center;
    }

    .sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        width: 100%;
        max-width: 400px;
    }

    .info-panel {
        flex: 1;
        min-width: 150px;
    }

    #game-canvas {
        width: 100%;
        max-width: 400px;
        height: auto;
        aspect-ratio: 2/3;
    }
}
