/* ============================================
   CV Space Explorer — ASTRONEER-Inspired UI
   Warm glassmorphism, rich dark palette,
   Outfit + Inter typography
   ============================================ */

/* --- Design Tokens --- */
:root {
    --bg: #030a18;
    --hud-bg: rgba(8, 14, 28, 0.82);
    --hud-border: rgba(0, 210, 255, 0.22);
    --hud-glow: rgba(0, 210, 255, 0.08);
    --hud-text: #dceeff;
    --hud-accent: #00d9ff;
    --hud-warm: #ffcc44;
    --hud-warning: #ff9a35;
    --hud-danger: #ff4c4c;
    --hud-success: #5ecb6f;
    --hud-creative: #818cf8; /* indigo / clean tint */
    --font-mono: 'Courier New', Consolas, monospace;
    --font-main: 'Outfit', 'Inter', system-ui, sans-serif;
    --panel-r: 14px;
}

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

body {
    overflow: hidden;
    background: var(--bg);
    font-family: var(--font-main);
    color: var(--hud-text);
    cursor: crosshair;
    user-select: none;
}

canvas { display: block; }

/* ============================================
   Loading Screen — dramatic animated gradient
   ============================================ */
#loading-screen {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at 40% 50%, #0a1e3d 0%, #030a18 55%, #000 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 1.4s ease;
}

#loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-logo {
    text-align: center;
    margin-bottom: 3.5rem;
    animation: logo-pulse 3s ease infinite;
}

@keyframes logo-pulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.25) drop-shadow(0 0 24px rgba(0,217,255,0.6)); }
}

.loading-planet-icon {
    font-size: 3.5rem;
    color: var(--hud-accent);
    margin-bottom: 0.8rem;
    display: block;
    animation: spin-slow 12s linear infinite;
}

@keyframes spin-slow {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

#loading-screen h1 {
    font-family: var(--font-main);
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: var(--hud-accent);
    text-shadow: 0 0 40px rgba(0, 217, 255, 0.55), 0 0 80px rgba(0, 217, 255, 0.2);
    margin-bottom: 0.4rem;
}

#loading-screen .subtitle {
    font-size: 0.8rem;
    letter-spacing: 0.3em;
    color: rgba(220, 238, 255, 0.38);
    margin-bottom: 0.5rem;
}

.loading-bar-container {
    width: 260px;
    height: 2px;
    background: rgba(255,255,255,0.06);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.loading-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--hud-accent), #80eefc);
    border-radius: 2px;
    box-shadow: 0 0 14px var(--hud-accent);
}

.loading-hint {
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: rgba(220,238,255,0.3);
    animation: blink 1.8s ease infinite;
}

@keyframes blink {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

/* ============================================
   Welcome / Intro Modal — 3 Slides
   ============================================ */
#welcome-modal {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(1, 5, 16, 0.8);
    backdrop-filter: blur(10px);
}

#welcome-modal.visible { display: flex; }

.welcome-window {
    width: min(540px, 93vw);
    padding: 32px 28px 24px;
    position: relative;
}

/* Slides */
.welcome-slide {
    display: none;
    min-height: 290px;
    flex-direction: column;
    gap: 12px;
}

.welcome-slide.active { display: flex; }

.slide-icon {
    font-size: 2.4rem;
    text-align: center;
    margin-bottom: 4px;
}

.welcome-slide h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--hud-accent);
    text-align: center;
    letter-spacing: 0.04em;
}

.slide-subtitle {
    text-align: center;
    font-size: 0.8rem;
    color: rgba(220, 238, 255, 0.55);
    margin-bottom: 6px;
}

.slide-body p {
    font-size: 0.83rem;
    line-height: 1.65;
    color: rgba(220, 238, 255, 0.78);
    margin-bottom: 8px;
}

.slide-body strong { color: var(--hud-accent); }
.slide-body kbd { 
    display: inline-block; padding: 1px 6px;
    background: rgba(0,217,255,0.1); border: 1px solid rgba(0,217,255,0.25);
    border-radius: 3px; font-size: 0.65rem; font-family: var(--font-mono); color: var(--hud-accent);
}

/* Tip items for slides 1 & 3 */
.slide-tips {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.tip-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(0, 217, 255, 0.04);
    border: 1px solid rgba(0, 217, 255, 0.10);
    border-radius: 8px;
    font-size: 0.78rem;
    color: rgba(220, 238, 255, 0.72);
}

.tip-icon { font-size: 1.1rem; flex-shrink: 0; }

/* Controls grid for slide 2 */
.controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 4px;
}

.ctrl-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(0,217,255,0.04);
    border: 1px solid rgba(0,217,255,0.1);
    border-radius: 8px;
}

.ctrl-keys {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
    min-width: 52px;
}

.ctrl-keys kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 7px;
    min-width: 22px;
    background: rgba(0,217,255,0.12);
    border: 1px solid rgba(0,217,255,0.28);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--hud-accent);
}

.ctrl-desc {
    font-size: 0.72rem;
    color: rgba(220,238,255,0.70);
}

/* Slide navigation */
.slide-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid rgba(0,217,255,0.1);
}

.slide-dots {
    display: flex;
    gap: 8px;
}

.dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: rgba(0,217,255,0.2);
    border: 1px solid rgba(0,217,255,0.3);
    cursor: pointer;
    transition: all 0.2s ease;
}

.dot.active {
    background: var(--hud-accent);
    box-shadow: 0 0 8px var(--hud-accent);
}

.slide-buttons {
    display: flex;
    gap: 10px;
    width: 100%;
}

.slide-btn {
    flex: 1;
    cursor: pointer;
    padding: 10px 18px;
    border-radius: 8px;
    font-family: var(--font-main);
    font-size: 0.82rem;
    font-weight: 600;
    transition: all 0.18s ease;
    border: 1px solid;
}

.slide-btn.secondary {
    background: rgba(0,217,255,0.06);
    border-color: rgba(0,217,255,0.18);
    color: rgba(220,238,255,0.6);
}

.slide-btn.secondary:hover {
    background: rgba(0,217,255,0.1);
    color: var(--hud-accent);
}

.slide-btn.primary {
    background: rgba(0,217,255,0.12);
    border-color: rgba(0,217,255,0.4);
    color: var(--hud-accent);
}

.slide-btn.primary:hover {
    background: rgba(0,217,255,0.22);
    box-shadow: 0 0 16px rgba(0,217,255,0.2);
}

.slide-btn.launch {
    background: linear-gradient(135deg, rgba(0,217,255,0.2), rgba(120,100,255,0.2));
    border-color: rgba(0,217,255,0.5);
    color: var(--hud-accent);
    letter-spacing: 0.05em;
}

.slide-btn.launch:hover {
    background: linear-gradient(135deg, rgba(0,217,255,0.3), rgba(120,100,255,0.3));
    box-shadow: 0 0 24px rgba(0,217,255,0.3);
}

/* ============================================
   HUD Container
   ============================================ */
#hud {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.6s ease;
}

#hud.visible { opacity: 1; }

/* Shared panel */
.hud-panel {
    background: var(--hud-bg);
    border: 1px solid var(--hud-border);
    border-radius: var(--panel-r);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 0 22px var(--hud-glow), inset 0 1px 0 rgba(255,255,255,0.04);
}

/* ============================================
   Top-Left: Speed & Coordinates
   ============================================ */
#hud-top-left {
    position: absolute;
    top: 20px; left: 20px;
    padding: 14px 18px;
    min-width: 185px;
}

.speed-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.hud-label {
    font-size: 0.58rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(220,238,255,0.38);
}

.hud-value {
    font-family: var(--font-mono);
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--hud-accent);
    text-shadow: 0 0 12px rgba(0,217,255,0.35);
    line-height: 1;
}

.hud-unit {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: rgba(220,238,255,0.3);
}

.hud-coords {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: rgba(220,238,255,0.25);
    margin-top: 7px;
    letter-spacing: 0.06em;
}

/* ============================================
   Bottom-Left: Fuel Gauge + Throttle
   ============================================ */
#fuel-gauge {
    position: absolute;
    bottom: 28px; left: 20px;
    padding: 14px 18px;
    min-width: 205px;
}

#speed-control {
    position: absolute;
    bottom: 105px; left: 20px;
    padding: 12px 14px;
    min-width: 205px;
}

.control-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.control-label, .control-value {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: rgba(220,238,255,0.6);
}

.control-value { color: var(--hud-accent); }

.control-hint {
    margin-top: 6px;
    font-size: 0.56rem;
    color: rgba(220,238,255,0.38);
}

.throttle-bar {
    width: 100%; height: 4px;
    margin-top: 7px;
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
    overflow: hidden;
}

.throttle-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--hud-accent), #ffee58);
    box-shadow: 0 0 8px rgba(0,217,255,0.3);
    border-radius: 3px;
    transition: width 0.2s ease;
}

.gauge-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 7px;
}

.gauge-label {
    font-size: 0.58rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(220,238,255,0.38);
}

.gauge-value {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--hud-accent);
}

.gauge-bar {
    width: 100%; height: 5px;
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
    overflow: hidden;
}

.gauge-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease, background 0.5s ease;
}

.gauge-fill.fuel {
    background: linear-gradient(90deg, #ff8a00, #ffcc00);
    box-shadow: 0 0 6px rgba(255,140,0,0.4);
}

.gauge-fill.fuel.low {
    background: linear-gradient(90deg, #c62828, #ff5252);
    box-shadow: 0 0 8px rgba(244,67,54,0.5);
    animation: pulse-warn 1s ease infinite;
}

/* ============================================
   Time Warp Controls
   ============================================ */
#timewarp-control {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
}

.tw-label {
    font-size: 0.55rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(220,238,255,0.38);
    white-space: nowrap;
}

.tw-buttons {
    display: flex;
    gap: 5px;
}

.tw-btn {
    cursor: pointer;
    padding: 5px 9px;
    border: 1px solid rgba(0,217,255,0.14);
    border-radius: 6px;
    background: rgba(0,217,255,0.04);
    color: rgba(220,238,255,0.5);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    transition: all 0.15s ease;
    pointer-events: auto;
}

.tw-btn:hover {
    border-color: rgba(255,200,55,0.5);
    color: var(--hud-warm);
}

.tw-btn.active {
    background: rgba(255,200,55,0.12);
    border-color: rgba(255,200,55,0.5);
    color: var(--hud-warm);
    box-shadow: 0 0 10px rgba(255,200,55,0.15);
}

/* ============================================
   Bottom-Center: Resource Bar
   ============================================ */
#resources-bar {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 14px;
    padding: 11px 20px;
}

#inventory-mode-label {
    position: absolute;
    top: -19px;
    left: 50%;
    transform: translateX(-50%);
    padding: 2px 9px;
    border-radius: 8px 8px 0 0;
    background: rgba(8, 14, 28, 0.86);
    color: rgba(220,238,255,0.42);
    font-family: var(--font-mono);
    font-size: 0.49rem;
    letter-spacing: 0.15em;
    white-space: nowrap;
}

.resource-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 50px;
}

.resource-icon { font-size: 1.1rem; }

.resource-value {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--hud-text);
}

.resource-name {
    font-size: 0.48rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(220,238,255,0.3);
}

/* ============================================
   Top-Right: Nearest Body
   ============================================ */
#nearest-body {
    position: absolute;
    top: 20px; right: 20px;
    padding: 14px 18px;
    min-width: 195px;
    text-align: right;
    transition: opacity 0.4s ease;
}

.planet-name {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.planet-subtitle {
    font-size: 0.58rem;
    color: rgba(220,238,255,0.4);
    margin-bottom: 6px;
    letter-spacing: 0.05em;
}

.planet-distance {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--hud-accent);
}

.planet-resource-hint {
    font-size: 0.52rem;
    color: rgba(220,238,255,0.3);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ============================================
   Interaction Prompt
   ============================================ */
#interaction-prompt {
    position: absolute;
    bottom: 108px;
    left: 50%;
    transform: translateX(-50%);
    padding: 9px 22px;
    background: rgba(0,217,255,0.06);
    border: 1px solid rgba(0,217,255,0.3);
    border-radius: 20px;
    font-size: 0.74rem;
    letter-spacing: 0.1em;
    color: var(--hud-accent);
    text-shadow: 0 0 8px rgba(0,217,255,0.2);
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: nowrap;
}

#interaction-prompt.visible { opacity: 1; }

#interaction-prompt kbd {
    display: inline-block;
    padding: 1px 7px;
    background: rgba(0,217,255,0.16);
    border: 1px solid rgba(0,217,255,0.3);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    margin: 0 3px;
}

/* ============================================
   Bottom-Right: Solar Status
   ============================================ */
#solar-status {
    position: absolute;
    bottom: 100px; right: 20px;
    padding: 12px 16px;
    min-width: 260px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#solar-status.visible { opacity: 1; }

.solar-label {
    font-size: 0.58rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(220,238,255,0.38);
    margin-bottom: 5px;
}

.solar-rate {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: #ffee58;
    text-shadow: 0 0 6px rgba(255,238,88,0.3);
}

.electrolysis-bar {
    width: 100%; height: 3px;
    background: rgba(255,255,255,0.05);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 6px;
}

.electrolysis-fill {
    height: 100%;
    background: linear-gradient(90deg, #1565c0, #42a5f5);
    box-shadow: 0 0 5px rgba(33,150,243,0.4);
    border-radius: 2px;
    transition: width 0.5s linear;
}

/* ============================================
   Controls Help
   ============================================ */
#controls-help {
    position: absolute;
    bottom: 28px; right: 20px;
    padding: 13px 17px;
    font-size: 0.58rem;
    color: rgba(220,238,255,0.36);
    line-height: 1.95;
}

#controls-help kbd,
#speed-control kbd,
.star-map-footer kbd {
    display: inline-block;
    padding: 1px 5px;
    background: rgba(0,217,255,0.1);
    border: 1px solid rgba(0,217,255,0.22);
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.52rem;
    color: var(--hud-accent);
    min-width: 15px;
    text-align: center;
}

/* ============================================
   EVA Surface Exploration HUD
   ============================================ */
#surface-hud {
    display: none;
    position: absolute;
    top: 20px;
    left: 20px;
    width: 265px;
    padding: 16px 17px;
}

#hud.eva-mode #surface-hud { display: block; }

#hud.eva-mode #hud-top-left,
#hud.eva-mode #fuel-gauge,
#hud.eva-mode #speed-control,
#hud.eva-mode #timewarp-control,
#hud.eva-mode #nearest-body,
#hud.eva-mode #solar-status {
    display: none !important;
}

#hud.eva-mode #resources-bar {
    border-color: rgba(94,203,111,0.36);
    box-shadow: 0 0 24px rgba(94,203,111,0.10);
}

#hud.eva-mode #inventory-mode-label {
    color: #8ce99a;
}

.surface-kicker {
    color: #8ce99a;
    font-family: var(--font-mono);
    font-size: 0.53rem;
    letter-spacing: 0.18em;
    margin-bottom: 3px;
}

#surface-planet-name {
    color: var(--hud-text);
    font-size: 1.03rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.surface-resource-row {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 6px 0;
    font-size: 0.69rem;
    color: rgba(220,238,255,0.76);
}

.surface-rarity {
    width: 67px;
    padding: 2px 5px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.47rem;
    letter-spacing: 0.10em;
    text-align: center;
}

.surface-resource-row.abundant .surface-rarity {
    color: #8ce99a;
    border: 1px solid rgba(94,203,111,0.28);
    background: rgba(94,203,111,0.08);
}

.surface-resource-row.rare .surface-rarity {
    color: #ffd166;
    border: 1px solid rgba(255,209,102,0.34);
    background: rgba(255,209,102,0.09);
}

.backpack-header {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    color: rgba(220,238,255,0.46);
    font-family: var(--font-mono);
    font-size: 0.53rem;
    letter-spacing: 0.10em;
}

.backpack-track,
.extractor-track {
    height: 4px;
    overflow: hidden;
    border-radius: 3px;
    background: rgba(255,255,255,0.07);
    margin-top: 6px;
}

#backpack-fill,
#extractor-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    transition: width 0.15s linear;
}

#backpack-fill { background: linear-gradient(90deg, #3fae5b, #8ce99a); }
#extractor-fill { background: linear-gradient(90deg, #00a7c7, #74f0ff); box-shadow: 0 0 7px rgba(0,217,255,0.6); }

#extractor-status {
    min-height: 15px;
    margin-top: 13px;
    color: rgba(220,238,255,0.55);
    font-size: 0.60rem;
    line-height: 1.4;
}

#crosshair.eva .ch-ring {
    border-color: rgba(116,240,255,0.85);
    box-shadow: 0 0 12px rgba(0,217,255,0.22);
}

#crosshair.extracting .ch-ring {
    border-color: #ffd166;
    transform: scale(0.82);
}

/* ============================================
   Planet Info Card
   ============================================ */
#planet-card {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 60px clamp(22px, 5vw, 78px);
    gap: clamp(200px, 30vw, 520px);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

#planet-card.visible { opacity: 1; pointer-events: auto; }

.card-left-panel, .card-right-panel {
    width: min(340px, 27vw);
    min-width: 275px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.card-left-panel {
    align-self: center;
    animation: slide-in-left 0.5s cubic-bezier(0.1, 0.9, 0.2, 1);
}

.card-right-panel {
    align-self: center;
    animation: slide-in-right 0.5s cubic-bezier(0.1, 0.9, 0.2, 1);
}

@keyframes slide-in-left {
    from { transform: translateX(-40px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

@keyframes slide-in-right {
    from { transform: translateX(40px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(0,217,255,0.1);
}

.card-title { font-size: 1.35rem; font-weight: 700; letter-spacing: 0.03em; }

.card-period {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--hud-accent);
    padding: 3px 10px;
    background: rgba(0,217,255,0.07);
    border-radius: 10px;
    white-space: nowrap;
}

.card-subtitle {
    font-size: 0.72rem;
    color: rgba(220,238,255,0.5);
    margin-bottom: 14px;
}

.card-description {
    font-size: 0.8rem;
    line-height: 1.65;
    margin-bottom: 14px;
    color: rgba(220,238,255,0.78);
    white-space: pre-line;
}

.card-details { list-style: none; padding: 0; margin-bottom: 14px; }

.card-details li {
    font-size: 0.75rem;
    padding: 5px 0 5px 16px;
    position: relative;
    color: rgba(220,238,255,0.6);
}

.card-details li::before {
    content: '▸';
    position: absolute; left: 0;
    color: var(--hud-accent);
}

.card-resource {
    padding: 10px 14px;
    background: rgba(0,217,255,0.04);
    border: 1px solid rgba(0,217,255,0.1);
    border-radius: 8px;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(220,238,255,0.45);
}

.card-right-panel h3 { margin-bottom: 14px; color: var(--hud-accent); font-size: 0.95rem; }

.card-close-hint {
    text-align: center;
    font-size: 0.58rem;
    color: rgba(220,238,255,0.22);
}

/* ============================================
   Satellite Info Card
   ============================================ */
#satellite-info-card {
    position: fixed;
    right: 34px; top: 50%;
    transform: translateY(-50%) translateX(28px);
    width: min(420px, 88vw);
    z-index: 240;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

#satellite-info-card.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) translateX(0);
}

.satellite-info-panel { padding: 22px; }

.satellite-info-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(0,217,255,0.12);
    margin-bottom: 14px;
}

.satellite-info-kicker {
    color: rgba(220,238,255,0.38);
    font-size: 0.6rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

#satellite-info-title {
    color: var(--hud-accent);
    font-size: 1.25rem;
    line-height: 1.2;
    margin-top: 4px;
}

#satellite-info-close {
    cursor: pointer;
    width: 30px; height: 30px;
    border: 1px solid rgba(0,217,255,0.2);
    border-radius: 6px;
    background: rgba(0,217,255,0.05);
    color: var(--hud-accent);
    font-size: 1.1rem;
    pointer-events: auto;
}

#satellite-info-description {
    color: rgba(220,238,255,0.8);
    font-size: 0.88rem;
    line-height: 1.55;
}

#satellite-info-reward {
    margin: 13px 0;
    padding: 9px 12px;
    border: 1px solid rgba(255,238,88,0.22);
    border-radius: 7px;
    background: rgba(255,238,88,0.05);
    color: rgba(255,238,88,0.88);
    font-family: var(--font-mono);
    font-size: 0.7rem;
}

#satellite-info-details { list-style: none; display: grid; gap: 8px; }

#satellite-info-details li {
    padding-left: 16px;
    position: relative;
    color: rgba(220,238,255,0.62);
    font-size: 0.76rem;
    line-height: 1.45;
}

#satellite-info-details li::before {
    content: '▸';
    position: absolute; left: 0;
    color: var(--hud-accent);
}

/* ============================================
   Star Map — System Telemetry
   ============================================ */
#star-map {
    position: fixed;
    inset: 0;
    background: rgba(2, 5, 15, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
}

#star-map.visible { opacity: 1; pointer-events: auto; }

.star-map-container {
    width: 980px;
    height: 600px;
    max-width: 96vw;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.star-map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid rgba(0,217,255,0.12);
    gap: 18px;
}

.star-map-header h2 {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--hud-accent);
    white-space: nowrap;
}

.star-map-close-btn {
    cursor: pointer;
    font-size: 1.15rem;
    color: rgba(220,238,255,0.42);
    transition: color 0.2s ease;
}

.star-map-close-btn:hover { color: var(--hud-accent); }

.map-tabs {
    display: flex;
    gap: 7px;
    margin-left: auto;
}

.map-tab {
    cursor: pointer;
    padding: 6px 13px;
    background: rgba(0,217,255,0.04);
    border: 1px solid rgba(0,217,255,0.14);
    border-radius: 7px;
    color: rgba(220,238,255,0.56);
    font-family: var(--font-main);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: all 0.15s ease;
}

.map-tab.active, .map-tab:hover {
    color: var(--hud-accent);
    background: rgba(0,217,255,0.1);
    border-color: rgba(0,217,255,0.4);
}

.star-map-content {
    display: flex;
    flex: 1;
    min-height: 0;
}

.star-map-viewport {
    flex: 1.3;
    position: relative;
    border-right: 1px solid rgba(0,217,255,0.08);
    background: radial-gradient(circle at 50% 50%, #081525 0%, #020610 100%);
}

.map-panel { display: none; }
.map-panel.active { display: block; flex: 1.3; }

.star-map-ship {
    flex: 1.3;
    padding: 24px;
    border-right: 1px solid rgba(0,217,255,0.08);
    background: radial-gradient(circle at 50% 50%, #081525 0%, #020610 100%);
    overflow-y: auto;
}

.star-map-ship h3 {
    margin-bottom: 16px;
    color: var(--hud-accent);
    font-size: 0.95rem;
}

/* Single-purpose Creative panel */
.star-map-creative {
    flex: 1.3;
    padding: 32px;
    background: #040916;
    overflow-y: auto;
}

.settings-content {
    max-width: 520px;
    margin: 0 auto;
}

.settings-content h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--hud-text);
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 16px 0;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.06);
    border-width: 1px 0 0;
}

.setting-info {
    flex: 1;
}

.setting-label {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--hud-text);
    margin-bottom: 5px;
}

.setting-subtext {
    font-size: 0.72rem;
    color: rgba(220,238,255,0.4);
    line-height: 1.45;
}

.settings-toggle-btn {
    cursor: pointer;
    min-width: 110px;
    padding: 8px 16px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 7px;
    color: rgba(220,238,255,0.7);
    font-family: inherit;
    font-size: 0.74rem;
    font-weight: 600;
    transition: all 0.15s ease;
}

.settings-toggle-btn:hover {
    background: rgba(255,255,255,0.1);
    color: var(--hud-text);
    border-color: rgba(255,255,255,0.3);
}

.settings-toggle-btn.active {
    background: rgba(0,217,255,0.10);
    border-color: rgba(0,217,255,0.42);
    color: var(--hud-accent);
    box-shadow: none;
}

.settings-toggle-btn:disabled {
    cursor: not-allowed;
    opacity: 0.42;
}

.quick-travel-action {
    min-width: 230px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#quick-travel-select {
    flex: 1;
    min-width: 0;
    padding: 8px 30px 8px 10px;
    border: 1px solid rgba(0,217,255,0.22);
    border-radius: 7px;
    outline: none;
    background: #081224;
    color: rgba(220,238,255,0.82);
    font-family: var(--font-main);
    font-size: 0.72rem;
    cursor: pointer;
}

#quick-travel-select:focus {
    border-color: rgba(0,217,255,0.58);
    box-shadow: 0 0 0 2px rgba(0,217,255,0.08);
}

#quick-travel-select option {
    background: #081224;
    color: var(--hud-text);
}

/* ============================================
   Upgrade Tree — cleaner card-based layout
   ============================================ */
.upgrade-tree {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.resource-economy-legend {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 14px;
}

.resource-economy-legend span {
    padding: 8px 10px;
    border: 1px solid rgba(126, 231, 255, 0.15);
    border-radius: 8px;
    background: rgba(6, 17, 31, 0.64);
    color: rgba(220, 238, 255, 0.58);
    font-size: 0.63rem;
    line-height: 1.35;
}

.resource-economy-legend b {
    display: block;
    color: rgba(226, 246, 255, 0.92);
    margin-bottom: 2px;
}

.upgrade-category {
    border: 1px solid rgba(var(--cat-color, 0,217,255), 0.18);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(0,0,0, 0.25);
}

.upgrade-cat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    background: rgba(255,255,255,0.02);
}

.upgrade-cat-icon { font-size: 1.1rem; }

.upgrade-cat-name {
    flex: 1;
    font-size: 0.82rem;
    font-weight: 600;
    color: rgba(220,238,255,0.88);
}

.upgrade-cat-tier {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: rgba(220,238,255,0.4);
}

.upgrade-progress-track {
    height: 2px;
    background: rgba(255,255,255,0.05);
}

.upgrade-progress-fill {
    height: 100%;
    transition: width 0.5s ease;
    opacity: 0.6;
}

.upgrade-tier {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 10px;
}

.upgrade-node {
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-family: inherit;
    padding: 10px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    color: var(--hud-text);
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.upgrade-node:not(.locked):not(.owned):hover {
    transform: translateY(-2px);
    border-color: rgba(0,217,255,0.45);
    background: rgba(0,217,255,0.08);
}

.upgrade-node strong {
    display: block;
    font-size: 0.75rem;
    color: rgba(220,238,255,0.88);
    margin-bottom: 3px;
}

.upgrade-node span {
    display: block;
    font-size: 0.62rem;
    color: rgba(220,238,255,0.4);
    line-height: 1.4;
}

.upgrade-node em {
    display: block;
    margin-top: 7px;
    font-style: normal;
    font-family: var(--font-mono);
    font-size: 0.58rem;
    color: rgba(255,238,88,0.82);
    line-height: 1.4;
}

.upgrade-node.locked {
    opacity: 0.45;
    border-style: dashed;
    cursor: default;
}

.upgrade-node.locked em {
    color: rgba(255,150,55,0.75);
}

.upgrade-node.owned {
    cursor: default;
    border-color: rgba(94,203,111,0.35);
    background: rgba(94,203,111,0.06);
}

.upgrade-node.owned em {
    color: var(--hud-success);
}

/* ============================================
   Star Map — Canvas + Info Panel
   ============================================ */
#star-map-canvas {
    width: 100%; height: 100%;
    display: block;
}

.trajectory-horizon-control {
    position: absolute;
    top: 18px;
    right: 14px;
    bottom: 18px;
    width: 52px;
    padding: 10px 7px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    border: 1px solid rgba(0,217,255,0.16);
    border-radius: 10px;
    background: rgba(2,8,20,0.82);
    box-shadow: 0 10px 25px rgba(0,0,0,0.28);
    backdrop-filter: blur(8px);
}

.trajectory-horizon-label {
    font-family: var(--font-mono);
    font-size: 0.52rem;
    color: rgba(220,238,255,0.48);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
}

#trajectory-horizon-value {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--hud-accent);
    white-space: nowrap;
}

#trajectory-horizon {
    flex: 1;
    width: 20px;
    min-height: 120px;
    writing-mode: vertical-lr;
    direction: rtl;
    accent-color: var(--hud-accent);
    cursor: ns-resize;
}

.trajectory-horizon-scale {
    position: absolute;
    top: 84px;
    bottom: 12px;
    left: 3px;
    min-height: 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 0.48rem;
    color: rgba(220,238,255,0.30);
}

.star-map-info {
    flex: 0.7;
    padding: 22px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: rgba(8,14,28,0.5);
    border-left: 1px solid rgba(0,217,255,0.08);
}

.star-map-info.hidden { display: none; }

.star-map-info h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--hud-accent);
    margin-bottom: 4px;
}

#map-planet-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: 16px;
}

.map-planet-row {
    cursor: pointer;
    width: 100%;
    padding: 8px 10px;
    background: rgba(0,217,255,0.03);
    border: 1px solid rgba(0,217,255,0.1);
    border-radius: 7px;
    color: var(--hud-text);
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    transition: all 0.15s ease;
}

.map-planet-row:hover,
.map-planet-row.selected {
    border-color: rgba(0,217,255,0.4);
    background: rgba(0,217,255,0.08);
}

.map-row-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 6px currentColor;
}

.map-row-name, .map-row-meta { display: block; }
.map-row-name { font-size: 0.76rem; font-weight: 600; }
.map-row-meta { margin-top: 2px; font-size: 0.6rem; color: rgba(220,238,255,0.45); }

.star-map-footer {
    padding: 11px 24px;
    border-top: 1px solid rgba(0,217,255,0.08);
    font-size: 0.62rem;
    color: rgba(220,238,255,0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast {
    position: fixed;
    top: 68px;
    left: 50%;
    transform: translateX(-50%) translateY(-12px);
    padding: 9px 22px;
    background: var(--hud-bg);
    border: 1px solid var(--hud-border);
    border-radius: 10px;
    backdrop-filter: blur(14px);
    font-size: 0.76rem;
    color: var(--hud-accent);
    z-index: 500;
    opacity: 0;
    transition: opacity 0.28s ease, transform 0.28s ease;
    pointer-events: none;
    white-space: nowrap;
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ============================================
   Crosshair — ASTRONEER-style ring+dot
   ============================================ */
#crosshair {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 26px; height: 26px;
    pointer-events: none;
    z-index: 101;
}

.ch-ring {
    position: absolute;
    inset: 0;
    border: 1.5px solid rgba(0, 217, 255, 0.5);
    border-radius: 50%;
}

.ch-dot {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 3px; height: 3px;
    background: rgba(0,217,255,0.8);
    border-radius: 50%;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    #hud-top-left { top: 10px; left: 10px; padding: 10px 12px; min-width: auto; }
    #fuel-gauge { bottom: 12px; left: 10px; min-width: 155px; }
    #speed-control { display: none; }
    #timewarp-control { top: 10px; }
    #resources-bar { bottom: 12px; padding: 8px 14px; gap: 10px; }
    #nearest-body { top: 10px; right: 10px; min-width: auto; }
    #controls-help { display: none; }
    #surface-hud { top: 10px; left: 10px; width: min(245px, calc(100vw - 20px)); }
    #interaction-prompt { max-width: 92vw; text-align: center; white-space: normal; }
    #planet-card { gap: 18px; padding: 18px; flex-direction: column; justify-content: center; }
    .card-left-panel,
    .card-right-panel { width: min(92vw, 420px); min-width: 0; max-height: 36vh; }
    .star-map-content { flex-direction: column; }
    .star-map-viewport,
    .star-map-ship,
    .star-map-creative { min-height: 250px; border-right: none; border-bottom: 1px solid rgba(0,217,255,0.08); }
    .upgrade-tier { grid-template-columns: 1fr; }
    .creative-features { grid-template-columns: 1fr; }
    .quick-travel-row { align-items: flex-start; flex-direction: column; gap: 12px; }
    .quick-travel-action { width: 100%; min-width: 0; }
    .controls-grid { grid-template-columns: 1fr; }
    .hud-value { font-size: 1.2rem; }
}
