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

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #7e22ce 100%);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 32px;
    background: rgba(10, 12, 31, 0.92);
    backdrop-filter: blur(12px);
    z-index: 10000;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

#loading-overlay.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#loading-overlay .loader-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 36px 44px;
    border-radius: 20px;
    background: rgba(19, 23, 54, 0.85);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

#loading-overlay .loader-progress {
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

#loading-overlay .loader-progress__track {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.12);
}

#loading-overlay .loader-progress__bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #f9d423 0%, #ff4e50 100%);
    transition: width 0.25s ease;
}

#loading-overlay .loader-progress__label {
    font-size: 16px;
    color: #f5f5ff;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#loading-overlay .loader-spinner {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 6px solid rgba(255, 255, 255, 0.25);
    border-top-color: #f9d423;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

#loading-overlay p {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 20px;
    line-height: 1.4;
    text-align: center;
    color: #f5f5ff;
    max-width: 320px;
}

#loading-overlay.has-error .loader-spinner {
    display: none;
}

#loading-overlay.has-error p {
    color: #ff9f9f;
}

/* Phone frame for desktop */
#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 480px;
    max-height: 100vh;
    background: #000;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
}

canvas {
    display: block;
}

/* Mobile - full screen, no frame */
@media (max-width: 767px) {
    #game-container {
        max-width: 100%;
        max-height: 100%;
    }
}

/* Tablet - allow a wider game container for better use of space */
@media (min-width: 768px) and (max-width: 1024px) {
    #game-container {
        /* Increase from desktop's 480px cap to better fit tablets */
        max-width: 720px;
        max-height: 100vh;
    }
}