:root {
    --bg: #05040b;
    --panel: rgba(17, 13, 34, .82);
    --purple: #a66bff;
    --blue: #42cfff;
    --text: #f4efff;
    --muted: #88839d;
    --border: rgba(166, 107, 255, .22);
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: Arial, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

button, input {
    font: inherit;
}

button {
    cursor: pointer;
}

#universe {
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

.star-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(1px 1px at 20% 30%, white 99%, transparent),
        radial-gradient(2px 2px at 70% 60%, #a66bff 99%, transparent),
        radial-gradient(1px 1px at 40% 80%, white 99%, transparent);
    background-size: 190px 190px, 270px 270px, 130px 130px;
    animation: stars 35s linear infinite;
}

.nebula {
    position: fixed;
    width: 700px;
    height: 700px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(91, 34, 180, .17), transparent 70%);
    top: 10%;
    left: 30%;
    pointer-events: none;
}

@keyframes stars {
    to { transform: translateY(-190px); }
}

.topbar {
    height: 75px;
    padding: 0 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: rgba(5, 4, 11, .88);
    position: relative;
    z-index: 5;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-symbol {
    width: 43px;
    height: 43px;
    border: 1px solid var(--purple);
    display: grid;
    place-items: center;
    color: var(--purple);
    font-size: 25px;
    box-shadow: 0 0 20px #9e62ff44;
}

.brand h1 {
    font-size: 18px;
    letter-spacing: 4px;
}

.brand h1 span {
    color: var(--purple);
}

.brand small {
    color: var(--muted);
    font-size: 9px;
    letter-spacing: 2px;
}

.top-status, .live-label {
    color: #a9a0c0;
    font-size: 10px;
    letter-spacing: 2px;
}

.pulse {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #60ffad;
    border-radius: 50%;
    box-shadow: 0 0 12px #60ffad;
    margin-right: 7px;
}

.menu-button {
    display: none;
    background: transparent;
    color: white;
    border: 1px solid var(--border);
    padding: 9px 12px;
}

.side-nav {
    position: fixed;
    top: 75px;
    bottom: 35px;
    left: 0;
    width: 225px;
    padding: 25px 15px;
    border-right: 1px solid var(--border);
    background: rgba(8, 6, 17, .95);
    z-index: 4;
}

.nav-heading, .eyebrow {
    color: var(--purple);
    font-size: 10px;
    letter-spacing: 2px;
    margin-bottom: 15px;
}

.nav-item {
    display: block;
    width: 100%;
    padding: 15px;
    text-align: left;
    margin-bottom: 7px;
    background: transparent;
    color: #aaa3bc;
    border: 1px solid transparent;
    font-size: 11px;
    letter-spacing: 1px;
}

.nav-item:hover, .nav-item.active {
    color: white;
    background: rgba(166, 107, 255, .12);
    border-color: var(--border);
}

.nav-bottom {
    position: absolute;
    bottom: 25px;
    left: 20px;
}

.creator-label {
    font-size: 9px;
    color: var(--muted);
    letter-spacing: 2px;
}

.creator-name {
    margin: 8px 0;
    color: var(--purple);
    letter-spacing: 3px;
}

.nav-bottom small {
    font-size: 9px;
    color: var(--muted);
}

.main-stage {
    margin-left: 225px;
    padding: 30px;
    min-height: calc(100vh - 110px);
    position: relative;
    z-index: 1;
}

.universe-panel, .module-panel {
    display: none;
}

.active-panel {
    display: block;
    animation: appear .4s ease;
}

@keyframes appear {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.section-heading h2, .module-panel h2 {
    font-size: 25px;
    letter-spacing: 4px;
}

.space-layout {
    display: grid;
    grid-template-columns: 190px minmax(250px, 1fr) 190px;
    gap: 20px;
    align-items: center;
}

.planet-information, .space-information {
    min-width: 0;
}

.planet-information h2 {
    font-size: 28px;
    color: white;
    letter-spacing: 3px;
    margin-bottom: 10px;
}

.planet-information p, .module-panel > p {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.7;
    margin-bottom: 20px;
}

.planet-stat {
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
}

.planet-stat small, .space-clock small {
    display: block;
    color: var(--muted);
    font-size: 9px;
    letter-spacing: 1px;
    margin-bottom: 7px;
}

.planet-stat strong {
    font-size: 11px;
    letter-spacing: 1px;
}

.planet-controls {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.planet-controls button {
    width: 40px;
    height: 35px;
    color: white;
    background: var(--panel);
    border: 1px solid var(--border);
}

.earth-container {
    position: relative;
    min-height: 380px;
    display: grid;
    place-items: center;
}

#earthCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

#earthCanvas canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.earth-glow {
    width: 210px;
    height: 210px;
    border-radius: 50%;
    background: #7136ff;
    filter: blur(80px);
    opacity: .23;
}

.orbit {
    position: absolute;
    width: 300px;
    height: 150px;
    border: 1px solid rgba(166, 107, 255, .25);
    border-radius: 50%;
    transform: rotate(-25deg);
}

.orbit-two {
    transform: rotate(65deg);
    width: 350px;
    height: 190px;
    border-color: rgba(66, 207, 255, .15);
}

.scan-marker {
    position: absolute;
    width: 7px;
    height: 7px;
    background: var(--blue);
    border-radius: 50%;
    box-shadow: 0 0 15px var(--blue);
}

.marker-one { top: 20%; right: 15%; }
.marker-two { bottom: 25%; left: 15%; }

.earth-caption {
    position: absolute;
    bottom: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 8px;
    letter-spacing: 1px;
}

.info-card {
    padding: 18px;
    border: 1px solid var(--border);
    background: var(--panel);
    margin-bottom: 12px;
    border-radius: 5px;
}

.info-card h3 {
    font-size: 24px;
    color: var(--purple);
}

.info-card h3 span {
    font-size: 10px;
}

.info-card p {
    color: var(--muted);
    font-size: 9px;
    margin-top: 8px;
}

.waiting {
    color: #d4a45d !important;
}

.bottom-space-panel {
    margin-top: 35px;
    padding: 20px;
    border: 1px solid var(--border);
    background: var(--panel);
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.planet-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.planet-button {
    padding: 10px;
    color: var(--muted);
    background: transparent;
    border: 1px solid var(--border);
    font-size: 9px;
}

.planet-button.selected, .planet-button:hover {
    color: white;
    border-color: var(--purple);
    background: rgba(166, 107, 255, .16);
}

.space-clock strong {
    font-size: 21px;
    letter-spacing: 2px;
}

.module-panel {
    max-width: 950px;
    padding: 25px;
    border: 1px solid var(--border);
    background: rgba(12, 9, 24, .8);
    border-radius: 7px;
}

.module-panel > p {
    margin-top: 12px;
}

.scanner-visual {
    height: 250px;
    display: grid;
    place-items: center;
}

.scanner-ring {
    width: 175px;
    height: 175px;
    border: 1px solid var(--purple);
    border-radius: 50%;
    display: grid;
    place-items: center;
    box-shadow: 0 0 40px #9e62ff33;
}

.scanner-core {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 1px solid var(--blue);
    display: grid;
    place-items: center;
    color: var(--blue);
    font-size: 30px;
}

.scanning .scanner-ring {
    animation: scan 2s linear infinite;
}

@keyframes scan {
    to { transform: rotate(360deg); }
}

.scanner-status {
    text-align: center;
    color: var(--blue);
    font-size: 11px;
    margin-bottom: 20px;
}

.primary-button {
    display: block;
    margin: auto;
    padding: 14px 25px;
    background: rgba(166, 107, 255, .15);
    color: white;
    border: 1px solid var(--purple);
}

.upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    border: 1px dashed var(--purple);
    margin: 25px 0;
    cursor: pointer;
    color: white;
    gap: 10px;
}

.upload-zone span {
    font-size: 30px;
    color: var(--purple);
}

.upload-zone small {
    color: var(--muted);
}

.result-box {
    padding: 20px;
    border: 1px solid var(--border);
    color: var(--blue);
    overflow-wrap: anywhere;
    font-size: 12px;
    line-height: 1.8;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 25px;
}

.macro-console {
    margin-top: 25px;
    background: #030308;
    border: 1px solid var(--border);
}

.console-header {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    border-bottom: 1px solid var(--border);
    color: var(--purple);
    font-size: 10px;
}

.console-output {
    padding: 20px;
    min-height: 170px;
    color: #8bffbc;
    font-size: 12px;
    line-height: 2;
    overflow-wrap: anywhere;
}

#macroForm {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-top: 1px solid var(--border);
}

#macroForm span {
    color: var(--purple);
}

#macroInput {
    flex: 1;
    min-width: 0;
    background: transparent;
    color: white;
    border: none;
    outline: none;
}

#macroForm button {
    background: transparent;
    color: var(--purple);
    border: 1px solid var(--border);
    padding: 8px 13px;
}

.system-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 35px;
    background: #080611;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    color: var(--muted);
    font-size: 8px;
    letter-spacing: 1px;
    z-index: 6;
}

@media(max-width: 900px) {
    .space-layout {
        grid-template-columns: 1fr;
    }

    .planet-information {
        text-align: center;
    }

    .planet-controls {
        justify-content: center;
    }

    .space-information {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

@media(max-width: 650px) {
    .topbar {
        padding: 0 13px;
    }

    .menu-button {
        display: block;
    }

    .top-status {
        display: none;
    }

    .side-nav {
        transform: translateX(-100%);
        transition: transform .3s;
        width: 240px;
    }

    .side-nav.open {
        transform: translateX(0);
    }

    .main-stage {
        margin-left: 0;
        padding: 20px 13px 55px;
    }

    .section-heading h2, .module-panel h2 {
        font-size: 20px;
    }

    .earth-container {
        min-height: 300px;
    }

    .bottom-space-panel {
        flex-direction: column;
    }

    .module-panel {
        padding: 17px;
    }

    .system-footer span:nth-child(2) {
        display: none;
    }
}

@media(orientation: landscape) and (max-height: 500px) {
    .side-nav {
        bottom: 35px;
        overflow-y: auto;
    }

    .main-stage {
        padding-top: 15px;
    }

    .earth-container {
        min-height: 270px;
    }
}
