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

:root {
    --primary: #6366f1;
    --secondary: #8b5cf6;
    --accent: #10b981;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    min-height: 100vh;
    padding: 1rem;
}

.container {
    max-width: 600px;
    margin: 0 auto;
}

.header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
}

.back-btn {
    position: absolute;
    left: 0;
    top: 0;
    background: white;
    color: var(--primary);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    border: 2px solid var(--primary);
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 48px;
}

.back-btn:hover {
    transform: translateX(-5px);
    background: var(--primary);
    color: white;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.back-btn:active {
    transform: translateX(-3px) scale(0.98);
}

.brand h1 {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.brand-text {
    color: rgba(255,255,255,0.9);
    font-size: 0.9rem;
}

.game-container {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.score-display {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.resume-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary)) !important;
    margin-bottom: 0.5rem;
}

.score-box {
    flex: 1;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 1rem;
    border-radius: 10px;
    text-align: center;
    color: white;
}

.label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0.25rem;
}

.value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
}

#gameCanvas {
    width: 100%;
    max-width: 500px;
    height: 500px;
    border: 3px solid var(--primary);
    border-radius: 10px;
    display: block;
    margin: 0 auto 1.5rem;
    background: #f8fafc;
}

.controls {
    text-align: center;
}

.control-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--accent), #059669);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 1rem;
    transition: all 0.3s;
}

.control-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 20px rgba(16, 185, 129, 0.4);
}

.mobile-controls {
    display: grid;
    gap: 0.5rem;
    max-width: 200px;
    margin: 0 auto;
}

.arrow-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.arrow-btn {
    padding: 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.arrow-btn:hover {
    background: var(--secondary);
    transform: scale(1.05);
}

.arrow-btn:active {
    transform: scale(0.95);
}

.instructions {
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
    margin-top: 1rem;
    line-height: 1.6;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 3rem;
    border-radius: 20px;
    text-align: center;
    animation: scaleIn 0.3s;
}

.modal-content h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.final-score {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 1rem 0;
}

.modal-btn {
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
}

@keyframes scaleIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@media (max-width: 600px) {
    .header {
        margin-bottom: 1.5rem;
    }
    
    .back-btn {
        position: relative;
        left: auto;
        top: auto;
        margin-bottom: 1rem;
        width: 100%;
        justify-content: center;
        padding: 1rem;
        font-size: 1.1rem;
    }
    
    .brand {
        text-align: center;
    }
    
    .brand h1 {
        font-size: 2rem;
    }
    
    #gameCanvas {
        height: 400px;
    }
    
    .game-container {
        padding: 1rem;
    }
}
