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

:root {
    --bg: #0f0f0f;
    --panel: #0d0909;
    --panel2: #222222;
    --border: #333333;
    --border2: #404040;
    --accent: #9f9f9f;
    --accent2: #ff4000;
    --accent3: #ffffff;
    --text: #d4cfc8;
    --text2: #8a8680;
    --text3: #555250;
    --danger: #ffffff;
    --warning: #cc8800;
    --mono: 'Chivo Mono', monospace;
    --ui: 'Orbitron', sans-serif;
}

html, body {
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    font-family: var(--mono)
}

#app {
    display: flex;
    height: 100vh;
    width: 100vw
}

#globe-wrap {
    flex: 1;
    position: relative;
    overflow: hidden
}

#cesiumContainer {
    width: 100%;
    height: 100%;
    filter: grayscale(1)
}

/* SIDEBAR — flex column, launch pinned at bottom */
#sidebar {
    width: 340px;
    min-width: 280px;
    max-width: 340px;
    background: var(--panel);
    border-left: 1px solid var(--border2);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    z-index: 10;
    transition: transform .3s;
}

#header {
    padding: 14px 16px 10px;
    background: linear-gradient(180deg, #111111, var(--panel));
    flex-shrink: 0
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px
}

.logo-icon svg {
    width: 28px;
    height: 28px
}

.logo-title {
    font-size: 25px;
    font-weight: 600;
    color: #b6b6b6;
    text-transform: uppercase;
    font-family: 'Orbitron', sans-serif;
}

.logo-version {
    font-size: 15px;
    color: var(--text3);
    font-family: var(--mono);
    font-weight: 600
}

/* Scrollable content */
#tele-wrap {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden
}

#tele-wrap::-webkit-scrollbar {
    width: 3px
}

#tele-wrap::-webkit-scrollbar-thumb {
    background: var(--border)
}

.section {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border)
}

.section-label {
    font-size: 10px;
    color: var(--text3);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 8px;
    font-family: var(--mono);
    font-weight: 700;
    letter-spacing: 2px;
    color: white
}

/* TABS */
.category-tabs {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
    margin-bottom: 8px
}

.cat-btn {
    padding: 3px 7px;
    font-size: 10px;
    letter-spacing: 1px;
    font-family: var(--mono);
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text3);
    cursor: pointer;
    border-radius: 2px;
    transition: all .2s;
    text-transform: uppercase
}

.cat-btn.active, .cat-btn:hover {
    border-color: #ff4d00;
    color: var(--panel);
    background: #ff4d00
}

.missile-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-height: 170px;
    overflow-y: auto
}

.missile-list::-webkit-scrollbar {
    width: 3px
}

.missile-list::-webkit-scrollbar-thumb {
    background: var(--border)
}

.missile-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 7px;
    border: 1px solid transparent;
    border-radius: 2px;
    cursor: pointer;
    transition: all .15s
}

.missile-item:hover, .missile-item.selected {
    border-color: #ff4d00;
    background: #ff4d00
}

.missile-item.selected .mi-name {
    color: var(--panel)
}

.missile-item.selected .mi-cat {
    background-color: var(--panel)
}

.missile-item.selected .mi-sub {
    color: var(--panel)
}

.missile-item.selected .mi-range {
    color: var(--panel)
}

.mi-cat {
    width: 3px;
    height: 26px;
    border-radius: 1px;
    flex-shrink: 0;
    background-color: #ff4d00
}

.mi-info {
    flex: 1;
    min-width: 0
}

.mi-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.mi-sub {
    font-size: 9px;
    color: var(--text3);
    font-family: var(--mono)
}

.mi-range {
    font-size: 10px;
    color: var(--text2);
    font-family: var(--mono);
    text-align: right;
    flex-shrink: 0
}

/* CARD */
.missile-card {
    margin: 8px 14px;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 2px;
    overflow: hidden;
    border-left: 3px solid var(--accent)
}

.missile-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-bottom: 1px solid var(--border)
}

.missile-card-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--panel);
    letter-spacing: 1px
}

.missile-card-origin {
    font-size: 10px;
    color: var(--text3);
    font-family: var(--mono)
}

.missile-card-body {
    display: grid;
    grid-template-columns:1fr 1fr;
    gap: 1px;
    background: var(--border)
}

.missile-stat {
    background: var(--panel2);
    padding: 6px 9px
}

.stat-k {
    font-size: 9px;
    color: var(--text3);
    font-family: var(--mono);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 2px
}

.stat-v {
    font-size: 11px;
    color: var(--text2);
    font-family: var(--mono)
}

.stat-v.hl {
    color: var(--accent)
}

/* COORDS */
.coord-grid {
    display: grid;
    grid-template-columns:1fr 1fr;
    gap: 5px
}

.coord-box {
    background: var(--panel2);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 5px 7px;
    position: relative
}

.coord-label {
    font-size: 9px;
    color: var(--text3);
    font-family: var(--mono);
    letter-spacing: 2px;
    margin-bottom: 2px
}

.coord-value {
    font-size: 11px;
    color: var(--text2);
    font-family: var(--mono)
}

.coord-dot {
    position: absolute;
    top: 6px;
    right: 7px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--text3)
}

.coord-dot.set {
    background: #ff4d00;
    box-shadow: 0 0 4px #ff4d00
}

/* PICK BUTTONS — prominent, numbered, with done state */
.pick-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 2px solid var(--border2);
    background: var(--panel2);
    color: var(--text);
    cursor: pointer;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    border-radius: 2px;
    transition: border-color .2s, background .2s;
    width: 100%;
    text-transform: uppercase;
}

.pick-btn:hover {
    border-color: #888;
    background: #2a2020
}

.pick-btn.active {
    border-color: #ff4d00;
    color: white;
    background: rgba(255, 77, 0, 0.1);
    animation: pickpulse 1s infinite;
}

@keyframes pickpulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 77, 0, 0.5)
    }
    50% {
        box-shadow: 0 0 0 5px rgba(255, 77, 0, 0)
    }
}

.pick-btn.done {
    border-color: #3a3a3a;
    color: var(--text2);
    background: transparent
}

.pbadge {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ff4d00;
    color: black;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .2s;
}

.pick-btn.done .pbadge {
    background: #3a3a3a;
    color: var(--text3)
}

.pick-btn.active .pbadge {
    background: white;
    color: black
}

.pcheck {
    margin-left: auto;
    font-size: 13px;
    color: var(--text3);
    transition: color .2s
}

/* OPTIONS */
.option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 0
}

.option-label {
    font-size: 11px;
    color: var(--text2);
    font-family: var(--mono);
    letter-spacing: 1px
}

.toggle {
    width: 30px;
    height: 15px;
    background: var(--panel2);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    transition: background .2s;
    flex-shrink: 0
}

.toggle.on {
    background: var(--panel);
    border-color: var(--accent)
}

.toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--text3);
    transition: all .2s
}

.toggle.on::after {
    left: 17px;
    background: var(--accent);
    box-shadow: 0 0 4px var(--accent)
}

.speed-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px
}

.speed-row input[type=range] {
    flex: 1;
    accent-color: var(--accent);
    height: 3px
}

.speed-val {
    font-size: 11px;
    color: var(--accent);
    font-family: var(--mono);
    min-width: 36px;
    text-align: right
}

/* TELEMETRY OVERLAY */
#tele-wrap-inner {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 8px
}

#telemetry-display {
    bottom: 33px;
    min-width: 210px;
    text-shadow: 0px 1px 5px #000000
}

.tele-section {
    padding: 8px 14px
}

.tele-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 0
}

.tele-key {
    font-size: 10px;
    color: white;
    font-family: var(--mono);
    letter-spacing: 1px;
    text-transform: uppercase
}

.tele-val {
    font-size: 11px;
    color: white;
    font-family: var(--mono)
}

.tele-val.live {
    color: white
}

.tele-val.warn {
    color: var(--warning)
}

.tele-val.danger {
    color: var(--danger)
}

.progress-bar-wrap {
    margin-top: 5px;
    height: 3px;
    background: var(--panel2);
    border-radius: 1px;
    overflow: hidden
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #6a1510, var(--accent));
    border-radius: 1px;
    width: 0%;
    transition: width .1s
}

/* LAUNCH — always pinned at bottom */
.launch-wrap {
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--panel);
}

.launch-btn {
    width: 100%;
    padding: 11px;
    font-size: 20px;
    font-weight: 600;
    text-transform: uppercase;
    font-family: var(--mono);
    cursor: pointer;
    border-radius: 2px;
    border: 1px solid;
    transition: all .3s
}

.launch-btn:disabled {
    opacity: .35;
    cursor: not-allowed
}

.launch-btn.ready {
    background: #ff4d00;
    border-color: #ff4d00;
    color: black
}

.launch-btn.ready:not(:disabled):hover {
    opacity: .6
}

.launch-btn.launching {
    background: rgba(255, 77, 0, 0.18);
    border-color: var(--accent2);
    color: var(--accent2);
    animation: bpulse .5s infinite
}

@keyframes bpulse {
    0%, 100% {
        box-shadow: 0 0 0 rgba(255, 77, 0, .4)
    }
    50% {
        box-shadow: 0 0 14px rgba(255, 77, 0, .4)
    }
}

.launch-btn.abort {
    background: rgba(255, 51, 51, 0.08);
    border-color: var(--danger);
    color: var(--danger)
}

/* GLOBE OVERLAYS */
.globe-overlay {
    position: absolute;
    pointer-events: none
}

#crosshair {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity .3s
}

#crosshair.visible {
    opacity: 1
}

.ch-svg {
    width: 44px;
    height: 44px;
    animation: rotate 4s linear infinite
}

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

@keyframes pulse {
    0%, 100% {
        opacity: 1
    }
    50% {
        opacity: .4
    }
}

#status-bar {
    bottom: 0;
    left: 0;
    right: 0;
    padding: 5px 14px;
    background: rgba(15, 15, 15, 0.88);
    backdrop-filter: blur(6px);
    border-top: 1px solid var(--border2);
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text3)
}

.sdot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0
}

.sdot.warn {
    background: var(--warning);
    animation: pulse 1s infinite
}

.sdot.danger {
    background: var(--danger);
    animation: pulse .5s infinite
}

#coords-display {
    top: 12px;
    left: 12px;
    font-family: var(--mono);
    font-size: 10px;
    color: white;
    letter-spacing: 1px;
    text-shadow: 0px 1px 5px #000000
}

/* MENU TOGGLE (mobile) */
#menu-toggle {
    display: none;
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 200;
    width: 36px;
    height: 36px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 2px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    padding: 8px
}

#menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text2);
    border-radius: 1px
}

@media (max-width: 768px) {
    #sidebar {
        position: fixed;
        right: 0;
        top: 0;
        height: 100%;
        transform: translateX(100%);
        z-index: 100
    }

    #sidebar.open {
        transform: translateX(0)
    }

    #menu-toggle {
        display: flex
    }

    #globe-wrap {
        width: 100vw
    }

    .category-tabs {
        gap: 2px
    }

    .cat-btn {
        padding: 2px 5px;
        font-size: 9px
    }
}