body {
    margin: 0;
    overflow: hidden;
    background: #000000;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: -moz-crisp-edges;
    image-rendering: -o-crisp-edges;
    image-rendering: pixelated;
    backface-visibility: hidden;
    z-index: 0;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(20, 20, 40, 0.85);
    color: #ffffff;
    font-family: 'Orbitron', sans-serif;
    z-index: 1;
    pointer-events: auto;
}

#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

#score, #gem-counter {
    pointer-events: none;
}

#score {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 28px;
    font-weight: 700;
    text-shadow: 0 0 15px #ff00ff88;
}

#gem-counter {
    position: absolute;
    top: 60px;
    left: 20px;
    font-size: 24px;
    font-weight: 700;
    text-shadow: 0 0 15px #00ffff88;
}

#speed-bar {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 200px;
    height: 20px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #ff00ff;
    border-radius: 5px;
    overflow: hidden;
}

#speed-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #ff00ff, #00ffff);
    transition: width 0.2s ease;
}

h1 {
    font-size: 72px;
    margin: 30px;
    text-shadow: 0 0 30px #00ffff, 0 0 60px #00ffff;
}

p {
    font-size: 32px;
    margin: 15px;
}

button {
    padding: 15px 30px;
    margin: 10px;
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, #ff00ff, #00ffff);
    background-size: 200% 200%;
    color: #ffffff;
    border: 3px solid #ff66ff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    transform: translate3d(0, 0, 0);
    pointer-events: auto;
    position: relative;
    z-index: 2;
}

button:hover {
    background-position: 100% 100%;
    box-shadow: 0 0 20px #ff66ff88;
    transform: translate3d(0, -2px, 0) scale(1.05);
}

button:active {
    transform: translate3d(0, 1px, 0) scale(0.98);
}

#shop-screen, #customizer-screen, #help-screen {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    pointer-events: auto;
    z-index: 2;
}

#ship-options, #customizer-options {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 80%;
}

.ship-option {
    background: rgba(0, 20, 60, 0.9);
    padding: 20px;
    border: 2px solid #ff00ff;
    border-radius: 10px;
    text-align: center;
    width: 200px;
    pointer-events: auto;
    position: relative;
    z-index: 2;
    cursor: pointer;
}

.ship-option img {
    width: 150px;
    height: 100px;
    object-fit: cover;
}

.ship-option p {
    font-size: 18px;
    margin: 10px 0;
}

#customizer-options label {
    font-size: 20px;
    margin: 10px 0;
}

#customizer-options input[type="color"] {
    margin-left: 10px;
    cursor: pointer;
    pointer-events: auto;
}

#warp-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

#warp-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    pointer-events: none;
    animation: warpFlash 0.3s ease-out;
    will-change: opacity, transform;
}

@keyframes warpFlash {
    0% { opacity: 1; transform: scale(1.1); }
    100% { opacity: 0; transform: scale(1); }
}

#afk-warning {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 72px;
    font-weight: bold;
    color: #ff0000;
    text-shadow: 0 0 20px #ff0000, 0 0 40px #ff0000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 4;
    font-family: 'Orbitron', sans-serif;
    text-align: center;
    animation: pulse 1s infinite;
}

#boss-warning {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 84px;
    font-weight: bold;
    color: #ff00ff;
    text-shadow: 0 0 30px #ff00ff, 0 0 60px #ff00ff;
    opacity: 0;
    transition: opacity 0.5s ease;
    text-align: center;
    font-family: 'Orbitron', sans-serif;
    z-index: 1000;
    pointer-events: none;
    animation: bossWarning 2s infinite;
}

@keyframes bossWarning {
    0% { transform: translate(-50%, -50%) scale(1); color: #ff00ff; }
    50% { transform: translate(-50%, -50%) scale(1.2); color: #ff0066; }
    100% { transform: translate(-50%, -50%) scale(1); color: #ff00ff; }
}

#boss-health {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 20px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #ff0066;
    box-shadow: 0 0 10px #ff0066;
    opacity: 0;
    transition: opacity 0.5s;
    z-index: 1000;
    pointer-events: none;
}

#boss-health-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #ff0066, #ff66ff);
    box-shadow: 0 0 15px #ff0066 inset;
    transition: width 0.3s;
}

#boss-name {
    position: fixed;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 24px;
    color: #ff0066;
    text-shadow: 0 0 10px #ff0066;
    opacity: 0;
    transition: opacity 0.5s;
    font-family: 'Press Start 2P', cursive;
    z-index: 1000;
    pointer-events: none;
}

@keyframes pulse {
    0% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

.projectile {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #00ffff;
    border-radius: 50%;
    box-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff;
    pointer-events: none;
}

.boss-projectile {
    position: absolute;
    width: 15px;
    height: 15px;
    background: #ff0066;
    border-radius: 50%;
    box-shadow: 0 0 15px #ff0066, 0 0 30px #ff0066;
    pointer-events: none;
}

@media (max-width: 600px) and (orientation: portrait) {
    h1 { font-size: 48px; margin: 20px; }
    button { padding: 12px 24px; font-size: 20px; margin: 8px; }
    p { font-size: 24px; margin: 10px; }
    .ship-option { width: 160px; padding: 15px; }
    .ship-option img { width: 120px; height: 80px; }
    .ship-option p { font-size: 16px; }
    #customizer-options label { font-size: 18px; }
    #score { font-size: 24px; top: 10px; left: 10px; }
    #gem-counter { font-size: 20px; top: 40px; left: 10px; }
    #speed-bar { width: 150px; height: 15px; bottom: 10px; left: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}