html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100dvh; /* Use dynamic viewport height for mobile */
    overflow: hidden;
    touch-action: none; /* Prevent pull-to-refresh and other touch gestures */
    color: rgba(255, 255, 255, 0.87);
    background-color: #0f0f0f;
}

#app {
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container {
    width: 100%;
    height: 100%;
    padding-bottom: env(safe-area-inset-bottom, 0);
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
    box-sizing: border-box;
}

/* Rotate device overlay for portrait mobile users */
#rotate-device-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    flex-direction: column;
}

#rotate-device-overlay.visible {
    display: flex;
}

#rotate-device-overlay .rotate-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: rotate-pulse 2s ease-in-out infinite;
}

#rotate-device-overlay .rotate-text {
    font-size: 24px;
    text-align: center;
    color: #ffffff;
    font-family: Arial, sans-serif;
}

@keyframes rotate-pulse {
    0%, 100% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(90deg) scale(1.2);
    }
}

/* iOS PWA Installation Prompt */
#ios-pwa-prompt {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.95), rgba(0,0,0,0.8));
    padding: 20px;
    z-index: 10001;
    display: none;
    flex-direction: column;
    align-items: center;
    animation: slide-up 0.3s ease-out;
    color: #ffffff;
    font-family: Arial, sans-serif;
}

#ios-pwa-prompt.visible {
    display: flex;
}

@keyframes slide-up {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Fullscreen re-entry button */
#fullscreen-reentry-btn {
    position: fixed;
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 28px;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    touch-action: manipulation;
    cursor: pointer;
    border: none;
    transition: background 0.2s, transform 0.2s;
}

#fullscreen-reentry-btn:hover {
    background: rgba(0,0,0,0.8);
    transform: scale(1.1);
}

#fullscreen-reentry-btn.visible {
    display: flex;
}
