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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    background: #020205;
    overflow: hidden;
    font-family: 'Courier New', monospace;
}

#game-container {
    width: 100vw;
    height: 100vh;
    height: 100dvh;            /* dynamic viewport for mobile address bar */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

#gameCanvas {
    display: block;
    border: 2px solid #151520;
    border-radius: 8px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8), inset 0 0 20px rgba(0, 0, 0, 0.3);
    image-rendering: pixelated;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* ─── Mobile: canvas fills the screen ─── */
@media (max-width: 1250px) {
    #gameCanvas {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        border: none;
        border-radius: 0;
        box-shadow: none;
    }
}

/* ─── Rotate-device overlay (portrait phones) ─── */
#rotate-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #020205;
    color: #888;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    font-family: 'Courier New', monospace;
    text-align: center;
    padding: 20px;
}
#rotate-overlay .rotate-icon {
    font-size: 64px;
    animation: rotateHint 2s ease-in-out infinite;
}
#rotate-overlay .rotate-text {
    font-size: 18px;
    line-height: 1.6;
}
@keyframes rotateHint {
    0%, 100% { transform: rotate(0deg); }
    25%      { transform: rotate(-20deg); }
    75%      { transform: rotate(90deg); }
}

/* Show overlay only on small portrait screens */
@media (max-width: 900px) and (orientation: portrait) {
    #rotate-overlay {
        display: flex !important;
    }
    #gameCanvas {
        display: none !important;
    }
}

@media (max-width: 768px) {
    #instructions {
        font-size: 11px;
        padding: 6px 12px;
        bottom: 8px;
    }
}

#instructions {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #444;
    font-size: 14px;
    text-align: center;
    background: rgba(0, 0, 0, 0.85);
    padding: 10px 20px;
    border-radius: 20px;
    border: 1px solid #1a1a1a;
}

#instructions strong {
    color: #997744;
}

/* Scanline effect overlay */
#game-container::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.08),
        rgba(0, 0, 0, 0.08) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 100;
}
