/* ============================================
   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 — 4 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; }

/* Non-blocking first-run help bubble */
.coach-bubble {
    position: fixed;
    right: 24px;
    bottom: 112px;
    z-index: 420;
    width: min(360px, calc(100vw - 32px));
    padding: 16px;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.coach-bubble[hidden] { display: none; }
.coach-bubble.visible { opacity: 1; transform: translateY(0); }

.coach-header,
.coach-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

#coach-step {
    color: var(--hud-accent);
    font-family: var(--font-mono);
    font-size: 0.58rem;
    letter-spacing: 0.09em;
}

#coach-skip {
    cursor: pointer;
    border: 0;
    background: transparent;
    color: rgba(220,238,255,0.58);
    font-size: 1rem;
}

.coach-bubble h2 {
    margin: 8px 0 5px;
    color: var(--hud-text);
    font-size: 1rem;
}

.coach-bubble p {
    margin: 0;
    color: rgba(220,238,255,0.68);
    font-size: 0.72rem;
    line-height: 1.5;
}

.coach-controls {
    margin: 12px 0;
    padding: 9px 10px;
    border: 1px solid rgba(0,217,255,0.16);
    border-radius: 7px;
    background: rgba(0,217,255,0.05);
    color: rgba(226,246,255,0.82);
    font-size: 0.66rem;
    line-height: 1.45;
}

.coach-controls kbd,
.coach-actions kbd {
    color: var(--hud-accent);
}

.coach-primary,
.coach-secondary {
    cursor: pointer;
    padding: 8px 11px;
    border-radius: 7px;
    font-family: var(--font-main);
    font-size: 0.66rem;
    font-weight: 600;
}

.coach-primary {
    border: 1px solid rgba(0,217,255,0.5);
    background: rgba(0,217,255,0.13);
    color: var(--hud-accent);
}

.coach-secondary {
    border: 1px solid rgba(220,238,255,0.16);
    background: rgba(220,238,255,0.04);
    color: rgba(220,238,255,0.66);
}

.welcome-window {
    width: min(900px, 94vw);
    max-height: 94vh;
    overflow-y: auto;
    padding: 20px 22px 18px;
    position: relative;
}

.welcome-dismiss {
    position: absolute;
    z-index: 4;
    top: 10px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(0, 217, 255, 0.24);
    border-radius: 50%;
    background: rgba(3, 12, 26, 0.88);
    color: rgba(220, 238, 255, 0.72);
    cursor: pointer;
    font-size: 1.1rem;
}

.welcome-dismiss:hover { color: var(--hud-accent); border-color: rgba(0, 217, 255, 0.55); }

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

.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: 2px;
}

.tutorial-visual {
    position: relative;
    width: 100%;
    height: clamp(190px, 29vh, 270px);
    overflow: hidden;
    border: 1px solid rgba(0, 217, 255, 0.22);
    border-radius: 13px;
    background: #061024;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.025), 0 15px 35px rgba(0,0,0,0.24);
}

.tutorial-visual::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 55%, rgba(2, 8, 20, 0.72));
    pointer-events: none;
}

.tutorial-visual img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.tutorial-visual-label {
    position: absolute;
    z-index: 1;
    left: 15px;
    bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(232, 248, 255, 0.92);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.tutorial-visual-label span {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--hud-accent);
    color: #03101c;
    font-family: var(--font-mono);
    box-shadow: 0 0 18px rgba(0,217,255,0.55);
}

.tutorial-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.tutorial-step {
    position: relative;
    min-height: 92px;
    padding: 11px 10px 10px 42px;
    border: 1px solid rgba(0, 217, 255, 0.15);
    border-radius: 10px;
    background: linear-gradient(145deg, rgba(0, 217, 255, 0.075), rgba(4, 12, 27, 0.66));
}

.tutorial-step > span {
    position: absolute;
    top: 11px;
    left: 10px;
    display: grid;
    place-items: center;
    width: 23px;
    height: 23px;
    border-radius: 50%;
    background: rgba(0, 217, 255, 0.16);
    border: 1px solid rgba(0, 217, 255, 0.32);
    color: var(--hud-accent);
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
}

.tutorial-step b,
.tutorial-step small { display: block; }
.tutorial-step b { margin-bottom: 5px; color: rgba(235, 249, 255, 0.94); font-size: 0.74rem; }
.tutorial-step small { color: rgba(220, 238, 255, 0.57); font-size: 0.64rem; line-height: 1.38; }

.tutorial-step kbd,
.material-key kbd {
    display: inline-block;
    padding: 1px 5px;
    border: 1px solid rgba(0, 217, 255, 0.30);
    border-radius: 4px;
    background: rgba(0, 217, 255, 0.10);
    color: var(--hud-accent);
    font-family: var(--font-mono);
    font-size: 0.61rem;
}

.material-key {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 7px;
}

.material-key > span {
    display: grid;
    grid-template-columns: 28px 1fr;
    grid-template-rows: auto auto;
    align-items: center;
    padding: 8px;
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 9px;
    background: rgba(4, 13, 29, 0.72);
}

.material-key i {
    grid-row: 1 / 3;
    color: var(--material);
    font-size: 1.1rem;
    font-style: normal;
    filter: drop-shadow(0 0 7px var(--material));
}

.material-key b { font-size: 0.67rem; color: rgba(235, 249, 255, 0.90); }
.material-key small { font-size: 0.54rem; color: rgba(220, 238, 255, 0.45); }

.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);
}

.welcome-slide > .tutorial-note kbd,
.mission-step kbd,
.tutorial-callouts kbd {
    display: inline-block;
    padding: 1px 5px;
    border: 1px solid rgba(0, 217, 255, 0.28);
    border-radius: 4px;
    background: rgba(0, 217, 255, 0.10);
    color: var(--hud-accent);
    font-family: var(--font-mono);
    font-size: 0.60rem;
}

.mission-loop {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.mission-step {
    position: relative;
    min-height: 150px;
    padding: 12px 10px;
    border: 1px solid rgba(0, 217, 255, 0.16);
    border-radius: 10px;
    background: linear-gradient(155deg, rgba(0, 217, 255, 0.08), rgba(4, 12, 27, 0.72));
}

.mission-step > span {
    display: grid;
    place-items: center;
    width: 25px;
    height: 25px;
    margin-bottom: 9px;
    border-radius: 50%;
    background: var(--hud-accent);
    color: #03101c;
    font-family: var(--font-mono);
    font-weight: 800;
}

.mission-step b,
.mission-step small { display: block; }
.mission-step b { margin-bottom: 6px; color: rgba(229, 248, 255, 0.94); font-size: 0.80rem; }
.mission-step small { color: rgba(220, 238, 255, 0.60); font-size: 0.67rem; line-height: 1.45; }

.tutorial-note {
    margin-top: 8px;
    padding: 9px 12px;
    border-left: 3px solid var(--hud-warm);
    border-radius: 5px;
    background: rgba(255, 190, 66, 0.07);
    color: rgba(229, 238, 248, 0.72);
    font-size: 0.72rem;
    line-height: 1.45;
}

.field-guide-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border: 1px solid rgba(0, 217, 255, 0.28);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(0, 217, 255, 0.13), rgba(69, 76, 180, 0.12));
}

.field-guide-banner > span {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border: 1px solid rgba(0, 217, 255, 0.50);
    border-radius: 10px;
    background: rgba(0, 217, 255, 0.12);
    color: var(--hud-accent);
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 800;
    box-shadow: 0 0 20px rgba(0, 217, 255, 0.18);
}

.field-guide-banner b,
.field-guide-banner small { display: block; }
.field-guide-banner b { margin-bottom: 4px; color: rgba(235, 249, 255, 0.95); }
.field-guide-banner small { color: rgba(220, 238, 255, 0.62); line-height: 1.45; }
.tutorial-callouts strong { color: var(--hud-accent); }

.control-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.control-panel {
    padding: 12px;
    border: 1px solid rgba(0, 217, 255, 0.14);
    border-radius: 10px;
    background: rgba(3, 12, 26, 0.58);
}

.control-panel h3 {
    margin-bottom: 8px;
    color: rgba(229, 248, 255, 0.9);
    font-size: 0.78rem;
}

.controls-grid.single-column { grid-template-columns: 1fr; }
.controls-grid.single-column .ctrl-row { padding: 6px 8px; }

.planet-resource-guide {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
}

.planet-resource-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px 10px;
    padding: 11px 12px;
    border: 1px solid rgba(0, 217, 255, 0.14);
    border-radius: 9px;
    background: rgba(4, 14, 30, 0.68);
}

.planet-resource-card b { grid-column: 1 / -1; color: var(--hud-accent); font-size: 0.78rem; }
.planet-resource-card span { color: rgba(226, 241, 248, 0.82); font-size: 0.70rem; }
.planet-resource-card em { color: #d8a0e5; font-size: 0.62rem; font-style: normal; text-align: right; }
.planet-resource-card small { grid-column: 1 / -1; color: rgba(220, 238, 255, 0.45); font-size: 0.62rem; }

.tutorial-callouts {
    display: grid;
    gap: 6px;
    margin-top: 2px;
}

.tutorial-callouts span {
    padding: 7px 10px;
    border-radius: 7px;
    background: rgba(0, 217, 255, 0.045);
    color: rgba(220, 238, 255, 0.66);
    font-size: 0.68rem;
}

/* 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;
    display: none;
}

/* ============================================
   Contextual mission and navigation guidance
   ============================================ */
#exploration-log {
    position: absolute;
    top: 92px;
    left: 20px;
    width: min(310px, calc(100vw - 40px));
    padding: 13px 16px 12px;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

#exploration-log.complete {
    border-color: rgba(94, 203, 111, 0.48);
    box-shadow: 0 0 26px rgba(94, 203, 111, 0.14), inset 0 1px 0 rgba(255,255,255,0.04);
}

#exploration-kicker {
    color: var(--hud-accent);
    font-family: var(--font-mono);
    font-size: 0.49rem;
    letter-spacing: 0.19em;
}

#exploration-title {
    margin-top: 4px;
    color: var(--hud-text);
    font-size: 0.88rem;
    font-weight: 700;
}

#exploration-description {
    margin-top: 4px;
    color: rgba(220,238,255,0.58);
    font-size: 0.63rem;
    line-height: 1.45;
}

.exploration-progress-track {
    height: 3px;
    margin-top: 10px;
    overflow: hidden;
    border-radius: 2px;
    background: rgba(255,255,255,0.06);
}

#exploration-progress-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #00a7c7, #74f0ff);
    box-shadow: 0 0 7px rgba(0,217,255,0.5);
    transition: width 0.35s ease;
}

#exploration-progress-label {
    margin-top: 5px;
    color: rgba(220,238,255,0.32);
    font-family: var(--font-mono);
    font-size: 0.45rem;
    letter-spacing: 0.13em;
}

#nav-marker {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 80;
    display: none;
    min-width: 94px;
    padding: 6px 9px;
    transform: translate(-50%, -50%);
    border: 1px solid rgba(0,217,255,0.46);
    border-radius: 8px;
    background: rgba(3,10,24,0.76);
    box-shadow: 0 0 18px rgba(0,217,255,0.16);
    color: var(--hud-accent);
    text-align: center;
    pointer-events: none;
}

#nav-marker.visible { display: block; }
#nav-marker.brake { border-color: rgba(255,189,89,0.72); color: #ffbd59; }
#nav-marker.land { border-color: rgba(94,203,111,0.72); color: #8ce99a; }
.nav-marker-arrow { font-size: 0.68rem; line-height: 1; transform: rotate(var(--nav-angle, 0deg)); }
#nav-marker-name { margin-top: 3px; font-size: 0.57rem; font-weight: 700; letter-spacing: 0.10em; }
#nav-marker-range { margin-top: 1px; font-family: var(--font-mono); font-size: 0.50rem; opacity: 0.72; }

.danger-alert {
    position: fixed;
    top: 16px;
    left: 50%;
    z-index: 330;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(620px, calc(100vw - 32px));
    padding: 9px 13px;
    transform: translateX(-50%);
    border: 1px solid rgba(255,76,76,0.62);
    border-radius: 8px;
    background: rgba(64,7,12,0.9);
    box-shadow: 0 0 24px rgba(255,40,40,0.15);
    color: rgba(255,232,232,0.9);
    backdrop-filter: blur(12px);
}

.danger-alert[hidden] { display: none; }
.danger-alert strong { flex: 0 0 auto; color: #ff8585; font-size: 0.67rem; letter-spacing: 0.08em; }
.danger-alert span { font-size: 0.66rem; line-height: 1.35; }
.danger-alert.warning { border-color: rgba(255,154,53,0.6); background: rgba(58,32,5,0.9); color: rgba(255,241,220,0.9); }
.danger-alert.warning strong { color: #ffb766; }

/* ============================================
   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;
}

.hull-header { margin-top: 10px; }
.gauge-fill.hull {
    background: linear-gradient(90deg, #36c8a0, #8af2c5);
    box-shadow: 0 0 9px rgba(54, 200, 160, 0.5);
}
.gauge-fill.hull.low {
    background: linear-gradient(90deg, #ff5a57, #ff9c55);
    box-shadow: 0 0 10px rgba(255, 90, 87, 0.58);
}

.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);
}

.tw-btn:disabled {
    opacity: 0.28;
    cursor: not-allowed;
}

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

#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: 44px;
}

.resource-item.resource-hidden { display: none; }

.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.85;
    opacity: 0.72;
}

#controls-help div:nth-child(n+5) { display: none; }

#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; }

#eva-compass {
    display: none;
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    min-width: 210px;
    padding: 8px 16px 7px;
    text-align: center;
}

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

.compass-home {
    color: rgba(126, 231, 255, 0.62);
    font-family: var(--font-mono);
    font-size: 0.49rem;
    letter-spacing: 0.20em;
}

.compass-readout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 2px 0;
    color: var(--hud-accent);
    font-family: var(--font-mono);
}

.compass-pointer { color: #ffbd5d; font-size: 0.70rem; }
#compass-direction { min-width: 24px; font-size: 0.92rem; font-weight: 700; }
#compass-degrees { color: rgba(220,238,255,0.68); font-size: 0.68rem; }

.compass-cardinals {
    display: flex;
    justify-content: space-between;
    padding-top: 3px;
    border-top: 1px solid rgba(0,217,255,0.14);
    color: rgba(220,238,255,0.28);
    font-family: var(--font-mono);
    font-size: 0.47rem;
}

#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 #exploration-log {
    top: 20px;
    right: 20px;
    left: auto;
}

.map-target-btn {
    width: 100%;
    margin: 5px 0 13px;
    padding: 9px 12px;
    border: 1px solid rgba(0,217,255,0.35);
    border-radius: 8px;
    background: rgba(0,217,255,0.08);
    color: var(--hud-accent);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    cursor: pointer;
}

.map-target-btn:hover:not(:disabled) {
    border-color: rgba(0,217,255,0.72);
    background: rgba(0,217,255,0.15);
}

.map-target-btn.active {
    border-color: rgba(94,203,111,0.52);
    color: #8ce99a;
    background: rgba(94,203,111,0.08);
}

.map-target-btn:disabled { opacity: 0.42; cursor: default; }

#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.uncommon .surface-rarity {
    color: #75d8ef;
    border: 1px solid rgba(117,216,239,0.32);
    background: rgba(117,216,239,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
   ============================================ */
/* In-game artifact archive */
#artifact-info-card {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%) translateX(34px);
    width: min(560px, 92vw);
    height: min(82vh, 760px);
    z-index: 245;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

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

.artifact-info-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 18px;
}

.artifact-info-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 11px;
    border-bottom: 1px solid rgba(206,147,216,0.24);
}

.artifact-info-kicker {
    color: rgba(206,147,216,0.72);
    font-size: 0.58rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

#artifact-info-title {
    margin-top: 4px;
    color: #e9c9ef;
    font-size: 1.12rem;
    line-height: 1.2;
}

#artifact-info-close {
    cursor: pointer;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border: 1px solid rgba(206,147,216,0.30);
    border-radius: 6px;
    background: rgba(206,147,216,0.08);
    color: #e9c9ef;
    font-size: 1.1rem;
}

#artifact-info-description {
    margin: 10px 0 7px;
    color: rgba(220,238,255,0.76);
    font-size: 0.76rem;
    line-height: 1.45;
}

#artifact-info-status {
    margin-bottom: 10px;
    color: #8df5c8;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.04em;
}

#artifact-pdf {
    flex: 1;
    min-height: 0;
    width: 100%;
    border: 1px solid rgba(206,147,216,0.20);
    border-radius: 8px;
    background: #eef2f4;
}

#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;
}

/* General, save, and recovery panel */
.star-map-general {
    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;
}

.settings-section-title {
    margin: 12px 0 0;
    color: rgba(116,240,255,0.68);
    font-size: 0.64rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.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;
}

.save-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 16px;
    border: 1px solid rgba(0,217,255,0.22);
    border-radius: 10px;
    background: rgba(0,217,255,0.045);
}

.save-status {
    margin-top: 7px;
    color: rgba(116,240,255,0.72);
    font-family: var(--font-mono);
    font-size: 0.58rem;
}

.save-note {
    margin: 0;
    color: rgba(220,238,255,0.34);
    font-size: 0.64rem;
    line-height: 1.5;
}

.settings-primary-btn,
.settings-secondary-btn,
.settings-danger-btn {
    cursor: pointer;
    padding: 9px 15px;
    border-radius: 7px;
    font-family: var(--font-main);
    font-size: 0.72rem;
    font-weight: 700;
}

.settings-primary-btn {
    border: 1px solid rgba(0,217,255,0.48);
    background: rgba(0,217,255,0.13);
    color: var(--hud-accent);
}

.settings-secondary-btn {
    border: 1px solid rgba(220,238,255,0.18);
    background: rgba(220,238,255,0.05);
    color: rgba(220,238,255,0.72);
}

.settings-danger-btn {
    border: 1px solid rgba(255,92,92,0.42);
    background: rgba(255,82,82,0.08);
    color: #ff8a8a;
}

.settings-primary-btn:hover,
.settings-secondary-btn:hover,
.settings-danger-btn:hover { filter: brightness(1.22); }

.session-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.reset-confirm {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 13px 14px;
    border: 1px solid rgba(255,92,92,0.34);
    border-radius: 8px;
    background: rgba(94,15,24,0.22);
}

.reset-confirm[hidden] { display: none; }
.reset-confirm > div:first-child { display: flex; flex-direction: column; gap: 3px; }
.reset-confirm strong { color: #ff9a9a; font-size: 0.76rem; }
.reset-confirm span { color: rgba(255,220,220,0.52); font-size: 0.62rem; }
.reset-confirm > div:last-child { display: flex; gap: 8px; }

#hud.compact-mode #controls-help,
#hud.compact-mode #speed-control { display: none !important; }
#hud.hide-exploration-log #exploration-log { display: none !important; }
#hud.guidance-disabled #nav-marker { display: none !important; }

.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;
}

.upgrade-how-to {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.upgrade-how-to span {
    padding: 9px 10px;
    border: 1px solid rgba(126,231,255,0.13);
    border-radius: 8px;
    background: rgba(6,17,31,0.58);
    color: rgba(220,238,255,0.52);
    font-size: 0.61rem;
    line-height: 1.4;
}

.upgrade-how-to b {
    display: block;
    margin-bottom: 2px;
    color: rgba(226,246,255,0.9);
}

.upgrade-cargo-summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 10px;
    color: rgba(220,238,255,0.5);
    font-size: 0.62rem;
}

.upgrade-cargo-summary > strong { margin-right: 3px; color: rgba(220,238,255,0.82); }
.upgrade-cargo-summary span { padding: 5px 7px; border-radius: 6px; background: rgba(255,255,255,0.04); }
.upgrade-cargo-summary i { margin-right: 4px; font-style: normal; }
.upgrade-cargo-summary b { color: var(--hud-text); }

.upgrade-next-step {
    margin-bottom: 14px;
    padding: 9px 11px;
    border-left: 2px solid rgba(255,154,53,0.6);
    background: rgba(255,154,53,0.055);
    color: rgba(220,238,255,0.6);
    font-size: 0.65rem;
    line-height: 1.4;
}

.upgrade-next-step strong { color: rgba(255,196,125,0.9); }
.upgrade-next-step.ready { border-left-color: rgba(94,203,111,0.7); background: rgba(94,203,111,0.055); }
.upgrade-next-step.ready strong { color: var(--hud-success); }

.resource-economy-legend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 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;
    color: rgba(220,238,255,0.88);
}

.upgrade-cat-name b { display: block; font-size: 0.82rem; font-weight: 600; }
.upgrade-cat-name small { display: block; margin-top: 2px; color: rgba(220,238,255,0.43); font-size: 0.59rem; line-height: 1.35; }

.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(:disabled):hover {
    transform: translateY(-2px);
    border-color: rgba(0,217,255,0.45);
    background: rgba(0,217,255,0.08);
}

.upgrade-node-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 5px;
}

.upgrade-node-heading strong { font-size: 0.74rem; color: rgba(220,238,255,0.9); }
.upgrade-node-heading i { font-style: normal; color: rgba(220,238,255,0.42); font-size: 0.51rem; letter-spacing: 0.07em; }
.upgrade-node.affordable .upgrade-node-heading i { color: var(--hud-success); }

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

.upgrade-costs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.upgrade-costs span {
    padding: 4px 5px;
    border-radius: 5px;
    background: rgba(255,255,255,0.04);
    color: rgba(220,238,255,0.54);
    font-family: var(--font-mono);
    font-size: 0.52rem;
}

.upgrade-costs span.enough { color: rgba(140,233,154,0.86); }
.upgrade-costs span.missing { color: rgba(255,170,95,0.88); background: rgba(255,120,50,0.07); }
.upgrade-costs b { color: inherit; }

.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.prerequisite-locked {
    opacity: 0.45;
    border-style: dashed;
    cursor: default;
}

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

.upgrade-node.unavailable { border-color: rgba(255,150,55,0.16); }

.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;
}

/* ============================================
   EVA Surface Map
   ============================================ */
#surface-map-overlay {
    position: fixed;
    inset: 0;
    z-index: 820;
    display: none;
    place-items: center;
    background: rgba(1, 6, 15, 0.78);
    backdrop-filter: blur(8px);
}

#surface-map-overlay.visible { display: grid; }

.surface-map-panel {
    width: min(760px, 94vw);
    max-height: 94vh;
    padding: 18px;
    overflow: hidden;
}

.surface-map-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 12px;
}

.surface-map-kicker {
    color: #7ee7ff;
    font-family: var(--font-mono);
    font-size: 0.55rem;
    letter-spacing: 0.18em;
}

.surface-map-header h2 {
    margin-top: 3px;
    color: var(--hud-text);
    font-size: 1.15rem;
}

.surface-map-key,
.surface-map-panel > p {
    color: rgba(220, 238, 255, 0.52);
    font-size: 0.65rem;
}

#surface-map-canvas {
    display: block;
    width: min(680px, 86vw, calc(94vh - 150px));
    height: auto;
    aspect-ratio: 1;
    margin: 0 auto;
    border: 1px solid rgba(0, 217, 255, 0.20);
    border-radius: 50%;
    background: #06101e;
    box-shadow: inset 0 0 40px rgba(0,0,0,0.55), 0 0 30px rgba(0,217,255,0.08);
}

.surface-map-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 9px 16px;
    margin: 12px 0 8px;
    color: rgba(220, 238, 255, 0.68);
    font-size: 0.62rem;
}

.surface-map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.surface-map-legend i { width: 9px; height: 9px; display: inline-block; }
.map-you { border-radius: 50%; background: #ff9b42; }
.map-ship { background: #00e5ff; }
.map-forest { border-radius: 50%; background: #72c66f; }
.map-mountain { background: #d3d8d1; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.map-water { border-radius: 50%; background: #288fa3; }
.surface-map-panel > p { text-align: 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) {
    .coach-bubble { right: 10px; bottom: 86px; width: calc(100vw - 20px); }
    .danger-alert { top: 8px; align-items: flex-start; flex-direction: column; gap: 3px; }
    .upgrade-how-to { grid-template-columns: 1fr; }
    #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; width: calc(100vw - 12px); padding: 8px 6px; gap: 2px; justify-content: center; }
    .resource-item { min-width: 36px; }
    .resource-name { font-size: 0.40rem; letter-spacing: 0.07em; }
    #nearest-body { top: 10px; right: 10px; min-width: auto; }
    #exploration-log { top: 74px; left: 10px; width: min(270px, calc(100vw - 20px)); }
    #hud.eva-mode #exploration-log { top: 10px; right: 10px; left: auto; width: min(230px, calc(100vw - 20px)); }
    #controls-help { display: none; }
    #surface-hud { top: 10px; left: 10px; width: min(245px, calc(100vw - 20px)); }
    #eva-compass { top: 230px; min-width: 150px; padding-inline: 10px; }
    #artifact-info-card { right: 4vw; width: 92vw; height: 74vh; }
    #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-general { 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; }
    .save-card,
    .reset-confirm { align-items: stretch; flex-direction: column; }
    .save-card .settings-primary-btn { width: 100%; }
    .session-actions,
    .reset-confirm > div:last-child { flex-wrap: wrap; }
    .controls-grid { grid-template-columns: 1fr; }
    .mission-loop { grid-template-columns: 1fr 1fr; }
    .mission-step { min-height: 112px; }
    .control-panels,
    .planet-resource-guide { grid-template-columns: 1fr; }
    .welcome-window { padding: 12px; }
    .welcome-slide { min-height: 0; }
    .tutorial-visual { height: 185px; }
    .tutorial-steps { grid-template-columns: 1fr; }
    .tutorial-step { min-height: 70px; }
    .material-key { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hud-value { font-size: 1.2rem; }
}

/* Blueprint gating in the upgrade tree */
.blueprint-row {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 12px;
    border: 1px dashed rgba(206, 147, 216, 0.45);
    border-radius: 9px;
    background: rgba(156, 85, 184, 0.08);
    font-size: 12px;
    color: #cdbcd8;
}
.blueprint-row .blueprint-lock {
    font-weight: 700;
    letter-spacing: 0.4px;
    color: #e6c6f0;
}
.blueprint-row b { color: #ce93d8; }
.blueprint-buy {
    align-self: flex-start;
    padding: 7px 12px;
    border-radius: 7px;
    border: 1px solid #ce93d8;
    background: rgba(206, 147, 216, 0.16);
    color: #f1e2f7;
    cursor: pointer;
    font: inherit;
    transition: background 0.15s ease;
}
.blueprint-buy[disabled] { opacity: 0.45; cursor: default; }
.blueprint-buy:not([disabled]):hover { background: rgba(206, 147, 216, 0.32); }

/* Stamina bar (EVA) */
#stamina-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    transition: width 0.15s linear, background 0.2s ease;
    background: linear-gradient(90deg, #d9a441, #ffd873);
}
#stamina-fill.exhausted {
    background: linear-gradient(90deg, #c62828, #ff8a65);
}

/* ============================================
   Physical Inventory — separate panels (not one
   popup box), but grouped together near the center
   of the screen rather than pinned to its edges.
   The right column (ship/rover + crafting) only
   appears while you're near one. The 3D world
   stays visible around and behind everything.
   ============================================ */
#inventory-overlay {
    position: fixed;
    inset: 0;
    z-index: 260;
    display: none;
    align-items: center;
    justify-content: center;
    gap: clamp(220px, 26vw, 460px);
    pointer-events: none;
}
#inventory-overlay.visible { display: flex; }

#inv-hint-bar {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.03em;
    color: rgba(220,238,255,0.75);
    background: rgba(6,10,18,0.72);
    border: 1px solid rgba(120,220,255,0.2);
    border-radius: 8px;
    padding: 7px 16px;
    white-space: nowrap;
    pointer-events: none;
}

#inv-panel-backpack {
    width: min(360px, 30vw);
    max-height: 82vh;
    pointer-events: auto;
}

#inv-right-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 88vh;
    overflow-y: auto;
    pointer-events: none;
}

/* flex-shrink: 0 is load-bearing here — #inv-panel-context and
   #inv-panel-craft are flex siblings in a column that caps at 88vh, and
   without this the flex algorithm can squeeze a panel shorter than its
   own content whenever the pair's combined height runs over. That content
   doesn't just get hidden, it renders past the panel's own clipped edge —
   sometimes exactly where the OTHER panel sits, so a real click there
   silently lands on that sibling instead. Let #inv-right-column's own
   scroll (above) be the one and only overflow boundary instead. */
.inv-panel {
    pointer-events: auto;
    flex-shrink: 0;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: linear-gradient(180deg, rgba(18,26,38,0.94), rgba(10,16,26,0.95));
    border: 1px solid rgba(120,220,255,0.18);
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.04);
}
#inv-panel-backpack { overflow-y: auto; }
#inv-panel-context, #inv-panel-craft { width: min(320px, 30vw); }

.inv-floating-hint {
    font-size: 0.62rem;
    color: rgba(220,238,255,0.5);
    line-height: 1.6;
    text-align: center;
    padding: 10px 4px 2px;
}

.inv-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.inv-panel-title {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    color: rgba(140,230,255,0.92);
    font-weight: 700;
}

.inv-move-all-btn {
    font-family: var(--font-mono);
    font-size: 0.54rem;
    letter-spacing: 0.04em;
    padding: 4px 9px;
    border-radius: 5px;
    border: 1px solid rgba(120,220,255,0.35);
    background: rgba(98,230,255,0.08);
    color: rgba(200,240,255,0.85);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.inv-move-all-btn:hover { background: rgba(98,230,255,0.22); border-color: rgba(120,220,255,0.6); }

.inventory-col-subtitle {
    font-size: 0.58rem;
    letter-spacing: 0.12em;
    color: rgba(220,238,255,0.5);
    margin: 14px 0 8px;
    font-weight: 600;
}

.inv-panel-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.inv-grid-large { grid-template-columns: repeat(4, 1fr); gap: 12px; }
.inventory-grid-single {
    grid-template-columns: 1fr;
    max-width: 108px;
}
.inv-grid-full-flash { animation: inv-full-flash 0.32s ease; }
@keyframes inv-full-flash {
    0%, 100% { box-shadow: none; }
    40% { box-shadow: inset 0 0 0 2px rgba(255,101,89,0.75); }
}

.inv-slot {
    --slot-color: #7fa0b8;
    position: relative;
    aspect-ratio: 1;
    border-radius: 10px;
    border: 1.5px solid rgba(255,255,255,0.1);
    background:
        radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--slot-color) 22%, transparent), transparent 70%),
        rgba(255,255,255,0.035);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, transform 0.1s ease;
    user-select: none;
}
.inv-slot:not(.empty):hover {
    border-color: color-mix(in srgb, var(--slot-color) 70%, white 10%);
    transform: translateY(-1px);
}
.inv-slot.empty { cursor: default; opacity: 0.4; }
.inv-slot .inv-icon {
    font-size: 1.55rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}
.inv-grid-large .inv-slot .inv-icon { font-size: 2rem; }
.inv-grid-large .inv-slot .inv-label { font-size: 0.48rem; top: 4px; }
.inv-grid-large .inv-slot .inv-qty { font-size: 0.7rem; }
.inv-slot.picked {
    opacity: 0.4;
    border-color: rgba(255,255,255,0.5);
    box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.35);
}
.inv-slot-target {
    border-color: color-mix(in srgb, var(--slot-color, #62e6ff) 65%, white 15%) !important;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--slot-color, #62e6ff) 35%, transparent);
}
.inv-slot-target:hover { background: rgba(120,255,190,0.14); }
.inv-slot.inv-battery-bay-slot {
    /* Fixed size instead of aspect-ratio: bay slots sit in flex wrappers
       (align-items: center) that don't stretch children to a track width
       the way a grid cell does, so an empty slot with no intrinsic content
       size would otherwise collapse to a near-invisible sliver. */
    width: 64px;
    height: 64px;
    aspect-ratio: unset;
    flex: 0 0 auto;
    border-style: dashed;
    border-color: rgba(255,255,255,0.22);
}
.inv-slot.inv-charged .inv-charge-fill { background: linear-gradient(90deg, #4de08a, #8dffb0); }
.inv-slot.inv-depleted .inv-charge-fill { background: linear-gradient(90deg, #ff6659, #ff9d7a); }
.inv-slot.inv-depleted .inv-icon { opacity: 0.55; filter: grayscale(0.6) drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }
.inv-slot .inv-qty {
    position: absolute;
    right: 4px;
    bottom: 3px;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 700;
    color: rgba(255,255,255,0.95);
    text-shadow: 0 1px 2px rgba(0,0,0,0.9);
}
.inv-slot .inv-charge-bar {
    position: absolute;
    left: 5px;
    right: 5px;
    bottom: 4px;
    height: 4px;
    border-radius: 2px;
    background: rgba(0,0,0,0.45);
    overflow: hidden;
}
.inv-slot .inv-charge-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6659, #62ffb0);
    transition: width 0.2s ease;
}
.inv-slot .inv-label {
    position: absolute;
    top: 3px;
    left: 0; right: 0;
    text-align: center;
    font-size: 0.44rem;
    letter-spacing: 0.03em;
    color: rgba(220,238,255,0.6);
    pointer-events: none;
}

#inv-held-icon {
    position: fixed;
    z-index: 270;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border-radius: 9px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    pointer-events: none;
    --slot-color: #62e6ff;
    background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--slot-color) 45%, transparent), rgba(10,16,26,0.85));
    border: 1.5px solid color-mix(in srgb, var(--slot-color) 70%, white 15%);
    box-shadow: 0 6px 18px rgba(0,0,0,0.5);
}
#inv-held-icon.visible { display: flex; }

.inventory-battery-bay-wrap { margin-top: 4px; }

.inv-ship-bays-row {
    display: flex;
    gap: 16px;
}
.inv-ship-bay-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 1;
}
.inv-ship-bay-slot .inventory-grid-single { max-width: 100%; }
.inv-ship-bay-label {
    font-size: 0.5rem;
    letter-spacing: 0.03em;
    color: rgba(220,238,255,0.5);
    text-align: center;
}

/* ---- Crafting wheel: center item + peeking neighbors + arrows ---- */
.inv-craft-wheel {
    display: flex;
    align-items: center;
    gap: 8px;
}
.inv-wheel-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 190px;
}
.inv-wheel-arrow {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(120,220,255,0.35);
    background: rgba(98,230,255,0.08);
    color: rgba(200,240,255,0.9);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}
.inv-wheel-arrow:hover { background: rgba(98,230,255,0.24); border-color: rgba(120,220,255,0.6); transform: scale(1.08); }
.inv-wheel-arrow:disabled { opacity: 0.3; cursor: default; transform: none; }

.inv-wheel-card {
    --slot-color: #62e6ff;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border-radius: 12px;
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.inv-wheel-side {
    width: 56px;
    opacity: 0.4;
    transform: scale(0.82);
    cursor: pointer;
    gap: 4px;
    padding: 6px 2px;
}
.inv-wheel-side:hover { opacity: 0.7; }
.inv-wheel-side .inv-wheel-icon { font-size: 1.5rem; }
.inv-wheel-side .inv-wheel-name { font-size: 0.46rem; color: rgba(220,238,255,0.6); }

.inv-wheel-center {
    width: 168px;
    padding: 16px 12px;
    gap: 8px;
    background: radial-gradient(circle at 50% 22%, color-mix(in srgb, var(--slot-color) 20%, transparent), transparent 70%), rgba(255,255,255,0.03);
    border: 1.5px solid color-mix(in srgb, var(--slot-color) 55%, rgba(255,255,255,0.15));
    box-shadow: 0 0 26px color-mix(in srgb, var(--slot-color) 22%, transparent);
}
.inv-wheel-center .inv-wheel-icon {
    font-size: 2.4rem;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.55));
}
.inv-wheel-center .inv-wheel-name {
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(230,244,255,0.95);
    letter-spacing: 0.02em;
}
.inv-wheel-desc {
    font-size: 0.56rem;
    color: rgba(220,238,255,0.55);
    line-height: 1.4;
}
.inv-wheel-cost {
    font-family: var(--font-mono);
    font-size: 0.56rem;
    color: rgba(200,240,255,0.8);
    letter-spacing: 0.02em;
}
.inv-wheel-missing {
    font-size: 0.55rem;
    color: rgba(255,150,130,0.85);
    line-height: 1.4;
}
.inv-wheel-craft-btn {
    margin-top: 4px;
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #62e6ff;
    background: rgba(98,230,255,0.16);
    color: #d6f7ff;
    font: inherit;
    font-weight: 700;
    letter-spacing: 0.06em;
    font-size: 0.62rem;
    cursor: pointer;
    transition: background 0.12s ease;
}
.inv-wheel-craft-btn:not([disabled]):hover { background: rgba(98,230,255,0.34); }
.inv-wheel-craft-btn[disabled] {
    opacity: 0.45;
    cursor: default;
    border-color: rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.03);
}

.inv-wheel-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
}
.inv-wheel-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}
.inv-wheel-dot:hover { background: rgba(255,255,255,0.4); }
.inv-wheel-dot.active { background: #62e6ff; transform: scale(1.3); }

