html, body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    background: #000;
    touch-action: none !important;
    overscroll-behavior: contain !important;
}

#root {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    position: absolute;
    top: 0;
    left: 0;
}

canvas {
    display: block;
    margin: 0;
    padding: 0;
    border: none;
    outline: none;
    width: 100vw;
    height: 100vh;
    background: #000;
    box-sizing: border-box;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

#bar {
    position: absolute;
    bottom: 12px;
    right: 12px;
    color: #fff;
    font-family: monospace;
    font-size: 14px;
    padding: 5px 8px;
    z-index: 10;
    pointer-events: none;
    background: rgba(0,0,0,0.4);
    border-radius: 8px; overflow: visible;
}

#barFps, #barTime {
    display: inline-block;
    margin-right: 15px;
}

/* ================= Loading Overlay (D&D minimalist) ================= */

#loading-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(1200px 600px at 50% 40%, rgba(25,23,26,0.95), rgba(6,6,8,0.98) 60%, rgba(0,0,0,1));
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 2000;
    padding: 16px;
    padding-top: max(16px, 5vh);
    box-sizing: border-box;
    overflow-y: auto;
}

.loading-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    max-width: min(600px, 92vw);
}

.loading-card {
    width: 100%;
    color: #E6E2DF;
    background: linear-gradient(180deg, rgba(28,26,30,0.7), rgba(16,16,18,0.8));
    border: 1px solid rgba(229, 215, 187, 0.22);
    border-radius: 14px;
    padding: 18px 18px 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.04);
    backdrop-filter: blur(4px);
}

.loading-title {
    font-family: Georgia, 'Times New Roman', serif;
    letter-spacing: 0.5px;
    font-size: 20px;
    line-height: 1.2;
    color: #F2E8C9;
    text-shadow: 0 1px 0 rgba(0,0,0,0.4);
}

.loading-subtitle {
    margin-top: 2px;
    font-size: 12px;
    color: #B8B0A6;
}

.loading-center {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-column-gap: 14px;
    align-items: center;
    margin: 14px 0 12px;
    padding: 12px;
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.02));
    border: 1px solid rgba(255,255,255,0.06);
}

.loading-spinner {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background:
      conic-gradient(from 0deg, rgba(242,232,201,0.85), rgba(179,142,89,0.3), rgba(34,32,38,0.0)),
      radial-gradient(circle at center, rgba(12,11,13,0.95) 62%, rgba(255,255,255,0) 63%);
    animation: spin 1.2s linear infinite;
    filter: drop-shadow(0 0 10px rgba(228,211,176,0.25));
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.loading-status {
    font-size: 14px;
    color: #EDE6D3;
    margin-bottom: 4px;
}

.loading-substatus {
    font-size: 12px;
    color: #C9C0B2;
    opacity: 0.9;
}

.loading-play {
    width: 100%;
    margin-top: 10px;
    background: linear-gradient(180deg, #C8A46B, #A98245);
    color: #201d1a;
    border: none;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.2px;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(0,0,0,0.35), inset 0 0 0 1px rgba(255,255,255,0.28);
    transition: transform .12s ease, box-shadow .12s ease, filter .1s ease;
}

.loading-play:hover { transform: translateY(-1px); }

.loading-play.is-disabled,
.loading-play:disabled {
    background: linear-gradient(180deg, #6b665f, #4d4944);
    color: #c8c3bd;
    cursor: not-allowed;
    filter: grayscale(0.25);
}

.loading-tip {
    margin-top: 8px;
    font-size: 11px;
    color: #A59B90;
    text-align: center;
}

/* Mobile-friendly spacing */
@media (max-width: 480px) {
    .loading-card { padding: 14px; }
    .loading-center { grid-column-gap: 12px; padding: 10px; }
    .loading-spinner { width: 36px; height: 36px; }
    .loading-title { font-size: 18px; }
    .loading-status { font-size: 13px; }
    .loading-subtitle { font-size: 11px; }
    .loading-play { padding: 11px 12px; font-size: 14px; }
}