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

:root {
    --bg:      #06090F;
    --bg2:     #0D1526;
    --bg3:     #162040;
    --border:  #1E3050;
    --dim:     #64748B;
    --text:    #CBD5E1;
    --yellow:  #F5C200;
    --purple:  #5533E8;
    --teal:    #00A889;
    --panel-w: 340px;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    user-select: none;
    -webkit-user-select: none;
}

.back-link {
    position: fixed;
    top: 8px; left: 12px;
    z-index: 300;
    color: var(--dim);
    font-size: 0.7rem;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.04em;
    transition: color 0.15s;
}
.back-link:hover { color: #fff; }

/* ── APP ─────────────────────────────────────── */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

/* ── HEADER ──────────────────────────────────── */
#header {
    flex-shrink: 0;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 8px 12px 0 100px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
#title-row { display: flex; align-items: center; }
.title-text h1 {
    font-size: 1.05rem;
    font-weight: 900;
    letter-spacing: 0.02em;
    color: #fff;
    line-height: 1;
}
.title-text .hint {
    font-size: 0.62rem;
    color: var(--dim);
    font-weight: 500;
    margin-top: 2px;
    letter-spacing: 0.02em;
}

/* ── PLANET NAV ──────────────────────────────── */
#planet-nav {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none;
}
#planet-nav::-webkit-scrollbar { display: none; }

.planet-pill {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px 4px 7px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}
.planet-pill:hover   { background: var(--bg3); border-color: #2E4A70; color: #fff; }
.planet-pill.active  { background: var(--bg3); border-color: var(--yellow); color: #fff; }
.pill-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── CANVAS WRAP ─────────────────────────────── */
#canvas-wrap {
    flex: 1;
    position: relative;
    overflow: hidden;
}
#orrery {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
}
#orrery:active { cursor: grabbing; }

/* ── INFO PANEL ──────────────────────────────── */
#info-panel {
    position: absolute;
    top: 0; right: 0;
    width: var(--panel-w);
    height: 100%;
    background: rgba(13, 21, 38, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateX(0);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
}
#info-panel.hidden {
    transform: translateX(calc(var(--panel-w) + 2px));
}
#close-btn {
    position: absolute;
    top: 10px; right: 12px;
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--dim);
    width: 28px; height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: color 0.15s, background 0.15s;
}
#close-btn:hover { color: #fff; background: var(--border); }

#panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px 18px 24px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
#panel-body::-webkit-scrollbar { width: 4px; }
#panel-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Panel content */
.panel-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    padding-right: 32px;
}
.panel-orb {
    width: 58px; height: 58px;
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.orb-rings {
    position: absolute;
    width: 130%;
    height: 30%;
    border: 6px solid rgba(232,213,163,0.55);
    border-radius: 50%;
    pointer-events: none;
}
.panel-header h2 {
    font-size: 1.4rem;
    font-weight: 900;
    color: #fff;
    line-height: 1.1;
}
.type-badge {
    display: inline-block;
    margin-top: 4px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    color: var(--dim);
    background: var(--bg3);
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: 10px;
}

.stats-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 18px;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.stat-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 12px;
    border-bottom: 1px solid var(--border);
}
.stat-row:last-child { border-bottom: none; }
.stat-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--dim);
    letter-spacing: 0.04em;
    white-space: nowrap;
    flex-shrink: 0;
}
.stat-val {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text);
    text-align: right;
}

/* Size comparison */
.size-compare {
    margin-bottom: 18px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
}
.compare-label {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--dim);
    margin-bottom: 10px;
}
.compare-bars { display: flex; flex-direction: column; gap: 6px; }
.compare-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.compare-name {
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--dim);
    width: 54px;
    flex-shrink: 0;
    text-align: right;
}
.compare-track {
    flex: 1;
    height: 10px;
    background: rgba(255,255,255,0.06);
    border-radius: 5px;
    overflow: hidden;
}
.compare-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.4s ease;
}
.fill-earth { background: #4B9CD3; }
.compare-note {
    font-size: 0.6rem;
    color: var(--dim);
    margin-top: 8px;
    text-align: right;
}

/* Facts */
.facts-section h3 {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--dim);
    margin-bottom: 8px;
}
.facts-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.facts-list li {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1.55;
    padding-left: 14px;
    position: relative;
}
.facts-list li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--yellow);
    font-size: 0.6rem;
    top: 2px;
}

/* Visit button */
.visit-btn {
    display: block;
    margin-top: 18px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #1a2a48, #0f1e38);
    border: 1px solid var(--yellow);
    border-radius: 10px;
    color: var(--yellow);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    text-decoration: none;
    text-align: center;
    letter-spacing: 0.03em;
    transition: background 0.18s, box-shadow 0.18s;
}
.visit-btn:hover {
    background: linear-gradient(135deg, #253d6a, #162d55);
    box-shadow: 0 0 18px rgba(245,194,0,0.25);
}

/* ── CONTROLS ────────────────────────────────── */
#controls {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 16px;
    background: var(--bg2);
    border-top: 1px solid var(--border);
    min-height: 48px;
}
.ctrl-btn {
    flex-shrink: 0;
    padding: 6px 14px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.ctrl-btn:hover { background: #1E3050; color: #fff; }
.ctrl-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}
.ctrl-group label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--dim);
    letter-spacing: 0.06em;
    white-space: nowrap;
}
#speed-slider {
    flex: 1;
    accent-color: var(--yellow);
    cursor: pointer;
    max-width: 220px;
}
#speed-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--yellow);
    white-space: nowrap;
    min-width: 80px;
}
