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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    font-family: 'Courier New', monospace;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

#game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    touch-action: none;
}

#gameCanvas {
    display: block;
    image-rendering: auto;
    cursor: default;
    touch-action: none;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #0a0a1a;
    z-index: 100;
    transition: opacity 0.5s ease;
}

#loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

#loading-screen h1 {
    color: #4488ff;
    font-size: 2.5rem;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 20px #4488ff;
    margin-bottom: 20px;
    letter-spacing: 4px;
}

#loading-screen .subtitle {
    color: #88bbff;
    font-size: 1rem;
    margin-bottom: 40px;
    letter-spacing: 8px;
    text-transform: uppercase;
}

.loading-bar-container {
    width: 300px;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    overflow: hidden;
}

.loading-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #4488ff, #88bbff);
    border-radius: 2px;
    animation: loadingProgress 1.5s ease-in-out forwards;
}

@keyframes loadingProgress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

#game-container {
    opacity: 0;
    transition: opacity 0.5s ease;
}

#game-container.visible {
    opacity: 1;
}

.touch-pause {
    position: fixed;
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    color: #fff;
    font-size: 18px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    touch-action: manipulation;
}

@media (hover: none) and (pointer: coarse) {
    .touch-pause {
        display: flex;
    }
}

@media (max-width: 768px) {
    #loading-screen h1 {
        font-size: 1.8rem;
    }
    #loading-screen .subtitle {
        font-size: 0.8rem;
        letter-spacing: 4px;
    }
    .loading-bar-container {
        width: 200px;
    }
}

@media (max-height: 500px) {
    #loading-screen h1 {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }
    #loading-screen .subtitle {
        margin-bottom: 20px;
        font-size: 0.7rem;
    }
}
