/* ── Base ───────────────────────────────────────────────────────────── */

* {
    box-sizing: border-box;
}

body {
    position: fixed;
    overflow: hidden;
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    background: #000000;
    font-family: 'Segoe UI', 'Inter', system-ui, sans-serif;
    color: #1a1a2e;
    touch-action: pan-x pan-y;
}

body.loaded {
    background: #f4f6f8;
}

/* ── Loader ─────────────────────────────────────────────────────────── */

#loader {
    z-index: 9999;
    position: fixed;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #000000;
    align-items: center;
    user-select: none;
    pointer-events: none;
}

#loader img {
    height: 20%;
    margin-bottom: 10px;
}

.lds-roller {
    display: inline-block;
    position: relative;
    width: 80px;
    height: 80px;
}

.lds-roller div {
    animation: lds-roller 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    transform-origin: 40px 40px;
}

.lds-roller div:after {
    content: " ";
    display: block;
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ffffff;
    margin: -4px 0 0 -4px;
}

.lds-roller div:nth-child(1) { animation-delay: -0.036s; }
.lds-roller div:nth-child(1):after { top: 63px; left: 63px; }

.lds-roller div:nth-child(2) { animation-delay: -0.072s; }
.lds-roller div:nth-child(2):after { top: 68px; left: 56px; }

.lds-roller div:nth-child(3) { animation-delay: -0.108s; }
.lds-roller div:nth-child(3):after { top: 71px; left: 48px; }

.lds-roller div:nth-child(4) { animation-delay: -0.144s; }
.lds-roller div:nth-child(4):after { top: 72px; left: 40px; }

.lds-roller div:nth-child(5) { animation-delay: -0.18s; }
.lds-roller div:nth-child(5):after { top: 71px; left: 32px; }

.lds-roller div:nth-child(6) { animation-delay: -0.216s; }
.lds-roller div:nth-child(6):after { top: 68px; left: 24px; }

.lds-roller div:nth-child(7) { animation-delay: -0.252s; }
.lds-roller div:nth-child(7):after { top: 63px; left: 17px; }

.lds-roller div:nth-child(8) { animation-delay: -0.288s; }
.lds-roller div:nth-child(8):after { top: 56px; left: 12px; }

@keyframes lds-roller {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ── Render canvas ──────────────────────────────────────────────────── */

.render-control {
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, #d0dce8, #eaf1f8);
}

/* ── Burger toggle ─────────────────────────────────────────────────── */

.burger-btn {
    display: flex;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1001;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: rgba(255,255,255,0.9);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 10px 8px;
}

.burger-btn .burger-line {
    display: block;
    width: 22px;
    height: 2px;
    background: #1a1a2e;
    border-radius: 1px;
    transition: transform 0.2s, opacity 0.2s;
}

/* ── Pure-CSS tabs ─────────────────────────────────────────────────── */

.tabs {
    display: none;
    position: fixed;
    top: 12px;
    left: 56px;
    width: 300px;
    font-family: 'Segoe UI', 'Inter', system-ui, sans-serif;
    font-size: 13px;
    z-index: 1000;
}

.tabs.tabs-open {
    display: block;
}

.tab-labels input[type="radio"] {
    display: none;
}

.tab-labels {
    display: flex;
    gap: 3px;
}

.tab-labels label {
    padding: 7px 16px;
    background: #dde3eb;
    color: #4a5568;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: background 0.15s, color 0.15s;
    user-select: none;
    white-space: nowrap;
    border: 1px solid #c5cdd8;
    border-bottom: none;
}

.tab-labels label:hover {
    background: #ccd4de;
    color: #1a2a3a;
}

.tab-panels {
    background: #ffffff;
    border-radius: 0 6px 6px 6px;
    border: 1px solid #c5cdd8;
    color: #1a1a2e;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.tab-panel {
    display: none;
    padding: 16px;
    line-height: 1.65;
}

.tab-panel h1 {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 10px 0;
    letter-spacing: 0.01em;
}

.tab-panel h2 {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin: 10px 0 4px 0;
}

.tab-panel p {
    font-size: 13px;
    color: #334155;
    margin: 4px 0;
}

.tab-panel ul {
    font-size: 12px;
    color: #475569;
    padding-left: 18px;
    margin: 6px 0 0 0;
}

.tab-panel li {
    margin-bottom: 2px;
}

.tab-panel button {
    display: inline-block;
    margin: 0 4px 6px 0;
    padding: 5px 14px;
    background: #1a56db;
    color: #ffffff;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.tab-panel button:hover {
    background: #1447ba;
}

/* Active tab label */
.tab-labels label:has(:checked) {
    background: #ffffff;
    color: #1a56db;
    border-color: #c5cdd8;
    box-shadow: 0 -2px 0 #1a56db inset;
}

/* Active tab panel */
.tabs:has(#hud-tab1:checked) #hud-panel1,
.tabs:has(#hud-tab2:checked) #hud-panel2,
.tabs:has(#hud-tab3:checked) #hud-panel3 {
    display: block;
}

/* ── Mobile adjustments ───────────────────────────────────────────── */

@media (max-width: 600px) {
    .tabs {
        left: 8px;
        right: 8px;
        width: auto;
        max-height: calc(100vh - 70px);
        overflow-y: auto;
    }
}
