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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --accent: #0ea5e9;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-x: hidden;
}

.game-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-container {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    max-width: 600px;
    width: 100%;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border);
}

.game-header h1 {
    font-size: 1.8rem;
    color: var(--primary);
    font-weight: 700;
}

.back-btn {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    transition: color 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.back-btn:hover {
    color: var(--primary);
    background: var(--bg-secondary);
}

.game-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

#gameCanvas {
    border: 3px solid var(--primary);
    border-radius: 10px;
    background: linear-gradient(180deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    max-width: 100%;
    height: auto;
    display: block;
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.3);
}

.game-info {
    display: flex;
    gap: 2rem;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
}

.game-score,
.game-high-score,
.game-lives {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.game-score span:last-child,
.game-high-score span:last-child,
.game-lives span:last-child {
    color: var(--primary);
    font-size: 1.3rem;
}

.game-controls {
    display: flex;
    gap: 1rem;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
}

.game-btn {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.game-btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.game-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.game-btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
}

.game-btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.game-btn-secondary:hover {
    background: var(--bg-secondary);
}

.mobile-controls {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
    padding: 1rem 0;
}

.mobile-fire-row {
    display: flex;
    justify-content: center;
}

.mobile-fire-btn {
    width: 80px;
    height: 80px;
    border: 3px solid #ef4444;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-radius: 50%;
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.mobile-fire-btn:active {
    transform: scale(0.9);
    box-shadow: 0 2px 10px rgba(239, 68, 68, 0.6);
}

.mobile-move-row {
    display: flex;
    gap: 2rem;
    justify-content: center;
}

.mobile-move-btn {
    width: 70px;
    height: 70px;
    border: 3px solid var(--primary);
    background: white;
    border-radius: 15px;
    font-size: 1.8rem;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.mobile-move-btn:active {
    background: var(--primary);
    color: white;
    transform: scale(0.9);
}

@media (max-width: 768px) {
    body {
        padding: 5px;
        overflow-x: hidden;
    }

    .game-container {
        padding: 1rem;
        max-width: 100%;
    }

    .game-header {
        margin-bottom: 1rem;
    }

    .game-header h1 {
        font-size: 1.3rem;
    }

    .back-btn {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }

    .game-content {
        gap: 1rem;
    }

    #gameCanvas {
        max-width: 100% !important;
        width: auto !important;
        height: auto !important;
    }

    .game-info {
        gap: 0.8rem;
    }

    .game-score,
    .game-high-score,
    .game-lives {
        font-size: 0.9rem;
    }

    .game-score span:last-child,
    .game-high-score span:last-child,
    .game-lives span:last-child {
        font-size: 1.1rem;
    }

    .game-controls {
        gap: 0.5rem;
    }

    .game-btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    .mobile-controls {
        display: flex;
        gap: 0.8rem;
        padding: 0.8rem 0;
    }

    .mobile-fire-row {
        margin-bottom: 0.3rem;
    }

    .mobile-fire-btn {
        width: 65px;
        height: 65px;
        font-size: 1.6rem;
    }

    .mobile-move-row {
        gap: 1.5rem;
    }

    .mobile-move-btn {
        width: 55px;
        height: 55px;
        font-size: 1.4rem;
    }
}

@media (max-width: 480px) {
    .game-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .back-btn {
        width: 100%;
        text-align: center;
    }

    .mobile-fire-btn {
        width: 65px;
        height: 65px;
        font-size: 1.6rem;
    }

    .mobile-move-btn {
        width: 55px;
        height: 55px;
        font-size: 1.3rem;
    }

    .mobile-move-row {
        gap: 1.5rem;
    }
}
