/* Copyright (c) 2024-2026. Jericho Crosby (Chalwk) */

.asteroids-panel {
    background: var(--light);
    border: 1px solid var(--gray-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 2rem;
    position: relative;
    padding-bottom: 140px;
}

.panel-head {
    margin-bottom: 1rem;
}

.panel-title {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.game-instructions {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(203, 213, 225, 0.1);
    border-radius: var(--radius);
}

.mobile-instructions {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: rgba(59, 130, 246, 0.1);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary);
    display: none;
}

.instructions-title {
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.instructions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5rem;
}

#gameContainer {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

#gameCanvas {
    display: block;
    background: var(--darker);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 100%;
    height: auto;
    aspect-ratio: 4/3;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: none;
}

#gameCanvas:focus {
    outline: none;
}

.game-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(203, 213, 225, 0.1);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.stat-item {
    display: flex;
    align-items: center;
}

.stat-label {
    color: var(--primary);
}

.stat-value {
    font-family: var(--font-mono);
    font-weight: 600;
    margin-left: 0.5rem;
}

.mobile-controls {
    position: absolute;
    bottom: 1.5rem;
    left: 1.5rem;
    right: 1.5rem;
    display: none;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 10;
}

.controls-row {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.control-btn {
    flex: 1;
    padding: 0.75rem 0.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 50px;
}

.control-btn i {
    font-size: 1.2rem;
}

.rotate-left {
    background: var(--primary);
    color: white;
}

.rotate-right {
    background: var(--secondary);
    color: white;
}

.thrust {
    background: var(--success);
    color: white;
}

.shoot {
    background: var(--danger);
    color: white;
    flex: 1.5;
}

.restart {
    background: var(--warning);
    color: var(--dark);
    flex: 1;
}

.control-btn:active {
    transform: scale(0.95);
    opacity: 0.9;
}

@media (max-width: 768px) {
    .asteroids-panel {
        padding-bottom: 160px;
    }

    .mobile-instructions {
        display: block;
    }

    .mobile-controls {
        display: flex;
    }

    #gameCanvas {
        width: 100%;
        height: 60vh;
        max-height: 500px;
        min-height: 350px;
        aspect-ratio: unset;
    }

    .game-stats {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .instructions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    #gameCanvas {
        height: 50vh;
        min-height: 300px;
    }

    .control-btn {
        padding: 0.6rem 0.4rem;
        font-size: 0.8rem;
        min-height: 45px;
    }

    .control-btn i {
        font-size: 1rem;
    }

    .asteroids-panel {
        padding: 1rem;
        padding-bottom: 150px;
    }

    .mobile-controls {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }
}

@media (hover: hover) and (pointer: fine) {
    .mobile-controls {
        display: none !important;
    }
}