/* ============================================================
   Pangea Ultima — 3D Planet Viewer stylesheet
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: #000008;
    overflow: hidden;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

canvas { display: block; }

/* ── Logo (top centre, forced white, fades on zoom-in) ── */
#logo {
    position: fixed;
    top: 22px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.6s ease;
}
#logo img {
    width: auto;
    height: 69px;
    display: block;
    /* the SVG is black art on a transparent background — invert turns it
       white while keeping it transparent (no background box), and the
       drop-shadow lifts it off the starfield */
    filter: invert(1) drop-shadow(0 4px 14px rgba(0, 0, 0, 0.9));
    opacity: 0.95;
}

/* ── Loading overlay ── */
#loading {
    position: fixed; inset: 0; z-index: 100;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    background: #000008;
    color: #8899cc;
    font-size: 1.3rem;
    letter-spacing: 0.08em;
    transition: opacity 0.6s ease;
    pointer-events: none;
    gap: 16px;
}
#loading.hidden { opacity: 0; }
#loading .label { font-size: 1.05rem; text-align: center; letter-spacing: 0.06em; }
#loading .progress {
    font-size: 0.8rem; color: #667799;
    font-variant-numeric: tabular-nums; letter-spacing: 0.08em;
}
#loading .spinner {
    width: 28px; height: 28px;
    border: 2px solid rgba(120,160,255,0.25);
    border-top-color: #88aaff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Planet title (below the globe) ── */
#title {
    position: fixed;
    left: 0;
    right: 0;
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    margin: 0 auto;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    z-index: 30;
    pointer-events: none;
    color: #ffffff;
    font-size: clamp(10px, 3.2vw, 16px);
    font-weight: 600;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    white-space: nowrap;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.85);
    opacity: 0.82;
}

/* ── Control panel ── */
#panel-wrap {
    position: fixed; top: 20px; right: 20px; z-index: 20;
    display: flex; align-items: flex-start; gap: 0;
}
#panel {
    width: 270px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: rgba(8, 10, 28, 0.88);
    backdrop-filter: blur(14px) saturate(130%);
    -webkit-backdrop-filter: blur(14px) saturate(130%);
    border: 1px solid rgba(90, 130, 220, 0.28);
    border-radius: 14px;
    padding: 18px 16px 14px;
    color: #bcc8e8;
    transition: all 0.32s ease;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
#panel.hidden {
    width: 0; padding: 18px 0 14px;
    border-width: 0;
    opacity: 0;
    pointer-events: none;
    margin-right: -8px;
    overflow: hidden;
}
#panel h3 {
    margin: 0 0 14px 0;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: #8aaeff;
    display: flex; justify-content: space-between; align-items: center;
    white-space: nowrap;
}
#panel-close {
    background: none; border: 1px solid rgba(90,130,220,0.25);
    color: #8aaeff; cursor: pointer;
    border-radius: 6px; width: 24px; height: 24px;
    font-size: 13px; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
}
#panel-close:hover { background: rgba(90,130,220,0.15); }

.section-divider {
    border: 0; border-top: 1px solid rgba(90,130,220,0.15);
    margin: 14px 0 12px;
}

.ctrl-group { margin-bottom: 10px; }
.ctrl-group label {
    display: flex; justify-content: space-between;
    font-size: 10.5px; margin-bottom: 3px;
    color: #8a9abb; letter-spacing: 0.03em;
}
.ctrl-group label .val {
    color: #b8d0ff; font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.ctrl-group input[type="range"] {
    width: 100%; -webkit-appearance: none; appearance: none;
    height: 5px;
    background: rgba(90,130,220,0.18);
    border-radius: 3px; outline: none; cursor: pointer;
}
.ctrl-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px; height: 16px;
    background: #8aaeff;
    border-radius: 50%; cursor: pointer;
    border: 2px solid #4a6ebb;
    transition: transform 0.12s;
}
.ctrl-group input[type="range"]::-webkit-slider-thumb:active {
    transform: scale(1.25);
}
.ctrl-group input[type="range"]::-moz-range-thumb {
    width: 16px; height: 16px;
    background: #8aaeff; border-radius: 50%;
    cursor: pointer; border: 2px solid #4a6ebb;
}

.color-row {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 10px; font-size: 10.5px;
}
.color-row span { flex: 1; color: #8a9abb; letter-spacing: 0.03em; }
.color-row input[type="color"] {
    width: 32px; height: 26px; padding: 0;
    border: 1px solid rgba(90,130,220,0.3);
    border-radius: 5px; background: transparent;
    cursor: pointer;
}
.color-row .hex {
    font-size: 10px; color: #8899bb;
    font-family: 'Consolas', 'Fira Code', monospace;
}

#reset-btn {
    width: 100%; padding: 7px;
    margin-top: 8px;
    background: rgba(90,130,220,0.12);
    border: 1px solid rgba(90,130,220,0.25);
    color: #aac0f0; border-radius: 8px;
    cursor: pointer; font-size: 10.5px;
    letter-spacing: 0.08em;
    transition: background 0.2s, color 0.2s;
}
#reset-btn:hover {
    background: rgba(90,130,220,0.28);
    color: #d0e0ff;
}

#save-btn {
    width: 100%; padding: 7px;
    margin-top: 8px;
    background: rgba(90,200,150,0.12);
    border: 1px solid rgba(90,200,150,0.3);
    color: #9fe0c0; border-radius: 8px;
    cursor: pointer; font-size: 10.5px;
    letter-spacing: 0.08em;
    transition: background 0.2s, color 0.2s;
}
#save-btn:hover {
    background: rgba(90,200,150,0.28);
    color: #d6ffee;
}
#save-btn.saved {
    border-color: rgba(120,230,170,0.6);
    color: #d6ffe6;
}
#save-btn.err {
    border-color: rgba(230,90,90,0.6);
    color: #ffd8d8;
    background: rgba(230,90,90,0.12);
}

/* toggle button (visible when panel hidden) */
#panel-toggle {
    width: 38px; height: 38px;
    background: rgba(8, 10, 28, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(90, 130, 220, 0.28);
    border-radius: 10px;
    color: #8aaeff; cursor: pointer;
    font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.32s ease;
    box-shadow: 0 4px 18px rgba(0,0,0,0.45);
    flex-shrink: 0;
}
#panel-wrap.expanded #panel-toggle { display: none; }
#panel-wrap:not(.expanded) #panel-toggle { display: flex; }

/* scrollbar (WebKit) */
#panel::-webkit-scrollbar { width: 8px; }
#panel::-webkit-scrollbar-thumb {
    background: rgba(90,130,220,0.25);
    border-radius: 4px;
}
#panel::-webkit-scrollbar-track { background: transparent; }

/* responsive */
@media (max-width: 600px) {
    #panel-wrap { top: 10px; right: 10px; }
    #panel { width: 240px; padding: 14px 12px 10px; }
    #panel h3 { font-size: 10px; margin-bottom: 10px; }
    .ctrl-group label { font-size: 10px; }
}
