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

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

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;
}

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

.game-container {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    max-width: 500px;
    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: #f8fafc;
    max-width: 100%;
    height: auto;
    box-shadow: var(--shadow);
}

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

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

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

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

.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-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: 0.5rem;
    width: 100%;
}

.mobile-control-row {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.mobile-btn {
    width: 60px;
    height: 60px;
    border: 2px solid var(--primary);
    background: white;
    border-radius: 15px;
    font-size: 1.5rem;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

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

.game-instructions {
    width: 100%;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: 10px;
    border: 1px solid var(--border);
}

.game-instructions h3 {
    color: var(--primary);
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.game-instructions ul {
    list-style: none;
    padding-left: 0;
}

.game-instructions li {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.8;
    margin-bottom: 0.5rem;
}

.game-instructions li strong {
    color: var(--text-primary);
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .game-container {
        padding: 1.5rem;
    }

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

    #gameCanvas {
        width: 300px !important;
        height: 300px !important;
    }

    .game-info {
        gap: 1rem;
    }

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

    .game-btn {
        padding: 0.6rem 1.5rem;
        font-size: 0.9rem;
    }

    .mobile-controls {
        display: flex;
    }

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

    .game-instructions {
        padding: 1rem;
    }

    .game-instructions li {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    #gameCanvas {
        width: 260px !important;
        height: 260px !important;
    }

    .mobile-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .game-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

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