* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    overflow-x: hidden;
    min-height: 100vh;
    touch-action: manipulation;
}

#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease-out;
}

#loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 18px;
    font-weight: 300;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-canvas {
    display: block;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    width: min(80vw, 80vh) !important;
    height: min(80vw, 80vh) !important;
}

.game-ui {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    pointer-events: none;
    z-index: 100;
}

.game-ui > * {
    pointer-events: auto;
}

.ui-panel {
    background: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    padding: 15px;
    backdrop-filter: blur(10px);
    margin-bottom: 10px;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.game-title {
    font-size: 24px;
    font-weight: bold;
    color: #ecf0f1;
}

.game-controls {
    display: flex;
    gap: 10px;
}

.btn {
    background: linear-gradient(45deg, #3498db, #2980b9);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

.btn:active {
    transform: translateY(0);
}

#level-dropdown {
    color: white;
    background: linear-gradient(45deg, #3498db, #2980b9);
}

#level-dropdown option {
    color: black;
    background: white;
    font-weight: normal;
}

@media (max-width: 1200px) {
    .game-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .game-controls {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .game-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .game-title {
        font-size: 18px;
        text-align: center;
    }

    .game-controls {
        flex-wrap: wrap;
        justify-content: center;
    }

    .btn {
        padding: 8px 12px;
        font-size: 13px;
        flex: 1;
        min-width: 70px;
    }

    #level-dropdown {
        min-width: auto !important;
        flex: 1;
    }

    .ui-panel {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 16px;
    }

    .btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .game-controls {
        gap: 5px;
    }
}

@media (max-width: 400px) {
    .game-ui {
        left: 10px;
        right: 10px;
    }

    .ui-panel {
        padding: 8px;
    }

    .game-title {
        font-size: 14px;
    }

    .game-title img {
        height: 32px !important;
        width: 32px !important;
        margin-right: 8px !important;
    }

    .game-controls {
        flex-direction: column;
        gap: 6px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 12px;
        width: 100%;
        min-width: auto;
    }

    #level-dropdown {
        font-size: 12px;
        width: 100%;
        max-width: none;
    }
}