/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #111;
    font-family: 'Inter', sans-serif;
    color: #e0e0e0;
    cursor: default;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ===== CANVAS ===== */
#gameContainer {
    position: relative;
    /* Aspect ratio locking for any device */
    width: 100dvw;
    height: 56.25dvw;
    /* 16:9 based on width */
    max-height: 100dvh;
    max-width: 177.78dvh;
    /* 16:9 based on height */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    background: #1a1a1a;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* ===== HUD ===== */
.hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: linear-gradient(180deg, rgba(20, 20, 20, 0.9) 0%, transparent 100%);
    z-index: 10;
    pointer-events: none;
}

.hud-phase {
    font-family: 'Orbitron', monospace;
    font-size: 14px;
    font-weight: 700;
    color: #88aaff;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.hud-objective {
    font-size: 13px;
    font-weight: 300;
    color: #aaaaaa;
    text-align: center;
    flex: 1;
    padding: 0 20px;
}

.hud-score {
    font-family: 'Orbitron', monospace;
    font-size: 14px;
    font-weight: 700;
    color: #cccccc;
}

/* ===== OVERLAYS ===== */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.4s ease;
}

.overlay-content {
    background: #222;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 40px 48px;
    max-width: 560px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.overlay-content h2 {
    font-family: 'Orbitron', monospace;
    font-size: 22px;
    font-weight: 700;
    color: #e0e0e0;
    margin-bottom: 16px;
}

.overlay-content p {
    font-size: 15px;
    line-height: 1.7;
    color: #bbbbbb;
    margin-bottom: 28px;
}

.overlay-content.victory h2 {
    color: #ffffff;
}

/* ===== BUTTONS ===== */
.btn-glow {
    font-family: 'Orbitron', monospace;
    font-size: 14px;
    font-weight: 700;
    color: #111;
    background: #88aaff;
    border: 1px solid #6688cc;
    border-radius: 4px;
    padding: 12px 32px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.2s ease;
}

.btn-glow:hover {
    background: #99bbff;
}

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

/* ===== TOAST ===== */
.toast {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Orbitron', monospace;
    font-size: 14px;
    font-weight: 700;
    padding: 12px 24px;
    border-radius: 6px;
    z-index: 200;
    pointer-events: none;
    animation: toastIn 0.3s ease;
    background: #333;
    border: 1px solid #555;
    color: #fff;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.toast.success {
    border-left: 4px solid #4caf50;
}

.toast.error {
    border-left: 4px solid #f44336;
}

.toast.info {
    border-left: 4px solid #2196f3;
}

/* ===== UTILITY ===== */
.hidden {
    display: none !important;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ===== Globals Controls ===== */
.game-controls {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    gap: 10px;
    z-index: 500;
}

.control-btn {
    background: rgba(30, 30, 35, 0.8);
    border: 1px solid rgba(136, 170, 255, 0.4);
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.control-btn:hover {
    background: rgba(40, 40, 50, 0.9);
    border-color: rgba(136, 170, 255, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 0 10px rgba(136, 170, 255, 0.4);
}