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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    user-select: none; /* Prevent text selection */
    -webkit-user-select: none;
    -webkit-touch-callout: none; /* Prevent callout on iOS */
}

#app {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
}

header {
    text-align: center;
    margin-bottom: 20px;
    color: white;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.score {
    font-size: 1.5em;
    font-weight: bold;
    background: rgba(255,255,255,0.2);
    padding: 10px 20px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
}

#game-container {
    position: relative;
    margin-bottom: 20px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

#game-canvas {
    display: block;
    background: #fff;
    border: 3px solid #2196F3;
    border-radius: 15px;
    touch-action: none;
    max-width: 100%;
    height: auto;
}

#game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    backdrop-filter: blur(10px);
}

#game-over h2 {
    font-size: 2em;
    margin-bottom: 15px;
    color: #ff6b6b;
}

#game-over p {
    font-size: 1.3em;
    margin-bottom: 20px;
}

.controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

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

.btn.primary {
    background: #4CAF50;
    color: white;
}

.btn.primary:hover {
    background: #45a049;
}

.btn:not(.primary) {
    background: #fff;
    color: #333;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.instructions {
    background: rgba(255,255,255,0.2);
    padding: 20px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    color: white;
    text-align: center;
    margin-top: auto;
}

.instructions h3 {
    margin-bottom: 10px;
    font-size: 1.3em;
}

.instructions p {
    font-size: 1em;
    line-height: 1.5;
}

.hidden {
    display: none !important;
}

/* Install banner styles */
.install-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #2196F3;
    color: white;
    padding: 15px 20px;
    border-radius: 25px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    z-index: 1000;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.banner-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.2em;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    background: rgba(255,255,255,0.2);
}

/* Responsive design */
@media (max-width: 480px) {
    #app {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .score {
        font-size: 1.3em;
        padding: 8px 16px;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 200px;
    }
}

/* PWA specific styles */
@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .instructions {
        background: rgba(0,0,0,0.3);
    }
}

/* Mobile optimizations */
@media (max-width: 480px) {
    body {
        padding: 10px;
        font-size: 14px;
    }
    
    h1 {
        font-size: 24px !important;
        margin: 10px 0 !important;
    }
    
    .score {
        font-size: 16px !important;
    }
    
    #game-canvas {
        /* Canvas size handled by JavaScript - ensure it fits */
        max-width: 100%;
        height: auto;
    }
    
    #game-container {
        padding: 10px 0;
    }
}

/* Prevent zoom on double tap */
canvas {
    touch-action: manipulation;
}