* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8C42 50%, #FFE66D 100%);
    color: #fff;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    touch-action: none;
}

.game-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    height: 100vh;
    max-height: 600px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 20px;
}

canvas {
    background: linear-gradient(to bottom, #FFE5B4 0%, #FFF8DC 50%, #F5E6D3 100%);
    border: 3px solid #FF8C42;
    border-radius: 10px;
    touch-action: none;
    outline: none;
    width: 100%;
    max-width: 800px;
    height: auto;
    max-height: calc(100vh - 200px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

canvas:focus {
    outline: 3px solid #FFD700;
    outline-offset: 3px;
}

.hud {
    display: flex;
    flex-direction: row;
    gap: 20px;
    font-size: 1.1em;
    text-shadow: 0 0 10px #FFD700;
    background: rgba(255, 140, 66, 0.9);
    padding: 12px 20px;
    border-radius: 10px;
    border: 2px solid #FF8C42;
    width: 100%;
    max-width: 800px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.hud div {
    display: flex;
    gap: 5px;
    white-space: nowrap;
}

.menu, .game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(255, 107, 107, 0.95);
    padding: 2em;
    border-radius: 15px;
    border: 3px solid #FFD700;
    z-index: 100;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
}

.menu h1, .game-over h2 {
    color: #FFD700;
    margin-bottom: 0.5em;
    font-size: 2.5em;
    text-shadow: 0 0 15px #FFD700;
}

.menu-description {
    color: #ddd;
    margin-bottom: 1em;
    font-size: 1.1em;
}

#startBtn, #restartBtn {
    background: #FFD700;
    color: #2c1810;
    border: none;
    padding: 1em 2em;
    font-size: 1.2em;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 1em 0;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.5);
}

#startBtn:hover, #restartBtn:hover {
    background: #FFA500;
    transform: scale(1.1);
    box-shadow: 0 0 25px #FFD700;
}

.high-score {
    color: #FFD700;
    font-size: 1.1em;
    margin-top: 1em;
}

.game-over {
    display: none;
}

.game-over p {
    color: #ddd;
    font-size: 1.3em;
    margin-bottom: 1em;
}

.controls {
    position: relative;
    width: 100%;
    pointer-events: none;
}

.mobile-controls {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    align-items: center;
    z-index: 1000;
    pointer-events: none;
    visibility: visible;
    opacity: 1;
}

.mobile-controls button {
    background: rgba(255, 215, 0, 0.4);
    border: 3px solid #FFD700;
    color: #FFD700;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    font-size: 2.5em;
    cursor: pointer;
    touch-action: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.1s ease;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
    font-weight: bold;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-controls button:active,
.mobile-controls button:focus {
    background: rgba(255, 215, 0, 0.6);
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.6);
    outline: none;
}

.mobile-controls button:hover {
    background: rgba(255, 215, 0, 0.5);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.5);
}

@media (max-width: 1024px) {
    .mobile-controls {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

@media (max-width: 800px) {
    .game-container {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        padding: 10px;
        gap: 10px;
    }
    
    canvas {
        width: 100%;
        height: calc(100vh - 200px);
        max-height: calc(100vh - 200px);
    }
    
    .mobile-controls button {
        width: 70px;
        height: 70px;
        font-size: 2em;
    }
    
    .mobile-controls {
        bottom: 20px;
        gap: 15px;
    }
    
    .hud {
        font-size: 0.85em;
        padding: 8px 12px;
        gap: 10px;
        flex-wrap: wrap;
    }
}

@media (min-width: 1025px) {
    .mobile-controls {
        display: none !important;
    }
}
