/* ==========================================================
   ATLAS COMMAND - Spacecraft HUD Interface
   Star Citizen / Elite Dangerous Cockpit Aesthetic
   Palette: #00e5ff (HUD Cyan), #ff6d00 (Alert Amber), #020508 (Void)
   Fonts:  Electrolize (mono/display), Rajdhani (UI/body)
   ========================================================== */
@import url('https://fonts.googleapis.com/css2?family=Electrolize&family=Rajdhani:wght@400;600;700&display=swap');

/* ---------- CSS Custom Properties ---------- */
:root {
    --bg-void: #020508;
    --bg-panel: rgba(2, 8, 18, 0.92);
    --bg-card: rgba(4, 12, 24, 0.85);
    --bg-card-hover: rgba(0, 229, 255, 0.04);
    --hud-cyan: #00e5ff;
    --hud-cyan-med: rgba(0, 229, 255, 0.5);
    --hud-cyan-dim: rgba(0, 229, 255, 0.15);
    --hud-cyan-ghost: rgba(0, 229, 255, 0.06);
    --hud-cyan-glow: 0 0 12px rgba(0, 229, 255, 0.3);
    --amber: #ff6d00;
    --amber-dim: rgba(255, 109, 0, 0.12);
    --amber-glow: 0 0 12px rgba(255, 109, 0, 0.3);
    --red: #ff1744;
    --red-dim: rgba(255, 23, 68, 0.1);
    --text-primary: #c8d6e5;
    --text-dim: #556677;
    --border-hud: rgba(0, 229, 255, 0.12);
    --border-hud-active: rgba(0, 229, 255, 0.35);
    --font-ui: 'Rajdhani', sans-serif;
    --font-mono: 'Electrolize', sans-serif;
    --transition-fast: 0.2s ease;
    --transition-med: 0.35s ease;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    background-color: var(--bg-void);
    color: var(--text-primary);
    font-family: var(--font-ui);
    overflow-x: hidden;
    min-height: 100vh;
    line-height: 1.5;
}

/* ---------- HUD Vignette Overlay ---------- */
.hud-vignette {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.7) 100%);
    z-index: 9998;
    pointer-events: none;
}

/* ---------- Scanline CRT ---------- */
.scanline {
    position: fixed;
    inset: 0;
    background:
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0, 229, 255, 0.015) 2px, rgba(0, 229, 255, 0.015) 4px);
    z-index: 9999;
    pointer-events: none;
    opacity: 0.6;
}

/* ---------- HUD Corner Brackets ---------- */
.hud-bracket {
    position: fixed;
    width: 60px;
    height: 60px;
    z-index: 9997;
    pointer-events: none;
    opacity: 0.35;
}
.hud-bracket--tl { top: 8px; left: 8px; border-top: 2px solid var(--hud-cyan); border-left: 2px solid var(--hud-cyan); }
.hud-bracket--tr { top: 8px; right: 8px; border-top: 2px solid var(--hud-cyan); border-right: 2px solid var(--hud-cyan); }
.hud-bracket--bl { bottom: 8px; left: 8px; border-bottom: 2px solid var(--hud-cyan); border-left: 2px solid var(--hud-cyan); }
.hud-bracket--br { bottom: 8px; right: 8px; border-bottom: 2px solid var(--hud-cyan); border-right: 2px solid var(--hud-cyan); }

/* ---------- Panel overlay (backdrop) ---------- */
.panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
    backdrop-filter: blur(2px);
}
.panel-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

/* ==========================================================
   TOP HUD BAR
   ========================================================== */
.hud-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 24px;
    background: linear-gradient(180deg, rgba(2, 5, 8, 0.95) 0%, rgba(2, 5, 8, 0.8) 100%);
    border-bottom: 1px solid var(--border-hud);
    backdrop-filter: blur(8px);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 1.5px;
}
.hud-topbar__left, .hud-topbar__center, .hud-topbar__right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.hud-topbar__label { color: var(--text-dim); }
.hud-topbar__value { color: var(--hud-cyan); }

/* HUD Indicators */
.hud-indicator {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}
.hud-indicator--active {
    background: var(--hud-cyan);
    box-shadow: var(--hud-cyan-glow);
    animation: indicatorPulse 2s infinite;
}
.hud-indicator--warning {
    background: var(--amber);
    box-shadow: var(--amber-glow);
    animation: indicatorPulse 1.2s infinite;
}
@keyframes indicatorPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Signal Bars */
.hud-signal-bars { display: flex; gap: 2px; align-items: flex-end; }
.hud-signal-bar {
    width: 3px;
    background: var(--text-dim);
    opacity: 0.3;
}
.hud-signal-bar:nth-child(1) { height: 4px; }
.hud-signal-bar:nth-child(2) { height: 6px; }
.hud-signal-bar:nth-child(3) { height: 8px; }
.hud-signal-bar:nth-child(4) { height: 10px; }
.hud-signal-bar:nth-child(5) { height: 12px; }
.hud-signal-bar.active { background: var(--hud-cyan); opacity: 1; box-shadow: var(--hud-cyan-glow); }

/* ==========================================================
   MAIN LAYOUT
   ========================================================== */
.hud-main {
    display: flex;
    min-height: calc(100vh - 80px);
}

/* ---------- HUD Gutters (side panels) ---------- */
.hud-gutter {
    width: 100px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 8px;
    gap: 16px;
    border-right: 1px solid var(--border-hud);
}
.hud-gutter--right {
    border-right: none;
    border-left: 1px solid var(--border-hud);
}
.hud-gutter__line {
    width: 1px;
    flex: 1;
    min-height: 20px;
    background: linear-gradient(180deg, transparent, var(--hud-cyan-dim), transparent);
}
.hud-gutter__data {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
}
.hud-gutter__label {
    font-family: var(--font-mono);
    font-size: 0.55rem;
    color: var(--text-dim);
    letter-spacing: 2px;
}
.hud-gutter__val {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--hud-cyan);
    letter-spacing: 1px;
}
.hud-gutter__val--active {
    color: #00ff88;
    text-shadow: 0 0 8px rgba(0, 255, 136, 0.4);
}

/* ---------- Radar ---------- */
.hud-radar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    background: rgba(0, 229, 255, 0.02);
}
.hud-radar__ring {
    position: absolute;
    inset: 2px;
    border-radius: 50%;
    border: 1px solid var(--hud-cyan-dim);
}
.hud-radar__ring--inner {
    inset: 18px;
}
.hud-radar__crosshair {
    position: absolute;
    top: 50%; left: 50%;
    width: 6px; height: 6px;
    margin: -3px 0 0 -3px;
    border-radius: 50%;
    background: var(--hud-cyan);
    box-shadow: var(--hud-cyan-glow);
}
.hud-radar__sweep {
    position: absolute;
    top: 50%; left: 50%;
    width: 50%; height: 2px;
    transform-origin: left center;
    background: linear-gradient(90deg, var(--hud-cyan-med), transparent);
    animation: radarSweep 3s linear infinite;
}
@keyframes radarSweep {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.hud-radar__dots { position: absolute; inset: 0; }
.radar-dot {
    position: absolute;
    width: 4px; height: 4px;
    border-radius: 50%;
    background: var(--hud-cyan);
    box-shadow: var(--hud-cyan-glow);
    animation: radarBlink 2s infinite;
}
@keyframes radarBlink {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.2; }
}

/* ---------- Power Bars ---------- */
.hud-power-bars {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 4px;
}
.hud-power-bar {
    position: relative;
    height: 18px;
    background: rgba(0, 229, 255, 0.04);
    border: 1px solid var(--border-hud);
}
.hud-power-bar::before {
    content: attr(data-label);
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-mono);
    font-size: 0.5rem;
    color: var(--text-dim);
    letter-spacing: 1px;
    z-index: 1;
}
.hud-power-bar__fill {
    height: 100%;
    width: var(--fill);
    background: linear-gradient(90deg, var(--hud-cyan-dim), var(--hud-cyan-med));
    transition: width 1s ease;
}

/* ---------- Central Content ---------- */
.hud-content {
    flex: 1;
    min-width: 0;
    padding: 28px 36px 60px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ==========================================================
   HERO SECTION
   ========================================================== */
.hero-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 36px;
    flex-wrap: wrap;
    gap: 20px;
}

.hud-title-decorator {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}
.hud-title-decorator span {
    width: 12px;
    height: 2px;
    background: var(--amber);
    display: block;
}
.hud-title-decorator span:first-child { width: 24px; }

.title-block h1 {
    font-family: var(--font-mono);
    font-size: clamp(1.8rem, 4vw, 3rem);
    color: var(--hud-cyan);
    text-transform: uppercase;
    font-weight: 400;
    letter-spacing: 6px;
    position: relative;
    text-shadow: 0 0 30px var(--hud-cyan-dim);
}

/* Glitch effect */
.glitch { position: relative; }
.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    overflow: hidden;
}
.glitch::before {
    color: var(--amber);
    z-index: -1;
    animation: glitch-1 4s infinite linear alternate-reverse;
}
.glitch::after {
    color: var(--hud-cyan);
    z-index: -2;
    animation: glitch-2 3s infinite linear alternate-reverse;
}
@keyframes glitch-1 {
    0%, 96% { clip-path: inset(0 0 0 0); transform: translate(0); }
    97% { clip-path: inset(20% 0 60% 0); transform: translate(-3px, 1px); }
    98% { clip-path: inset(60% 0 10% 0); transform: translate(3px, -1px); }
    99% { clip-path: inset(40% 0 30% 0); transform: translate(-2px, 0); }
    100% { clip-path: inset(0 0 0 0); transform: translate(0); }
}
@keyframes glitch-2 {
    0%, 94% { clip-path: inset(0 0 0 0); transform: translate(0); }
    95% { clip-path: inset(30% 0 40% 0); transform: translate(2px, 1px); }
    97% { clip-path: inset(50% 0 20% 0); transform: translate(-2px, -1px); }
    100% { clip-path: inset(0 0 0 0); transform: translate(0); }
}

.subtitle {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--amber);
    letter-spacing: 3px;
    font-size: 0.82rem;
    font-family: var(--font-mono);
    margin-top: 6px;
}
.subtitle__line {
    display: block;
    width: 30px;
    height: 1px;
    background: var(--amber);
    opacity: 0.5;
}

/* Primary CTA button */
.btn-primary {
    background: transparent;
    border: 1px solid var(--amber);
    color: var(--amber);
    padding: 14px 28px;
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
    transition: var(--transition-fast);
}
.btn-primary__bg {
    position: absolute;
    inset: 0;
    background: var(--amber);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}
.btn-primary:hover .btn-primary__bg { transform: scaleX(1); }
.btn-primary__content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}
.btn-primary:hover { color: var(--bg-void); box-shadow: var(--amber-glow); }
.btn-primary::before {
    content: '';
    position: absolute;
    top: -1px; left: -1px;
    width: 10px; height: 10px;
    border-top: 2px solid var(--amber);
    border-left: 2px solid var(--amber);
}
.btn-primary::after {
    content: '';
    position: absolute;
    bottom: -1px; right: -1px;
    width: 10px; height: 10px;
    border-bottom: 2px solid var(--amber);
    border-right: 2px solid var(--amber);
}

/* ==========================================================
   STATS BAR
   ========================================================== */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 28px;
}
.stat-box {
    background: var(--bg-card);
    border: 1px solid var(--border-hud);
    padding: 16px 18px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: default;
}
.stat-box__accent {
    position: absolute;
    top: 0; left: 0;
    width: 2px; height: 100%;
    background: var(--hud-cyan);
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}
.stat-box:hover .stat-box__accent { opacity: 1; box-shadow: var(--hud-cyan-glow); }
.stat-box:hover {
    border-color: var(--border-hud-active);
    background: var(--bg-card-hover);
}
.stat-box__icon {
    color: var(--hud-cyan);
    opacity: 0.5;
    transition: opacity var(--transition-fast);
}
.stat-box:hover .stat-box__icon { opacity: 1; }
.stat-label {
    font-size: 0.6rem;
    color: var(--text-dim);
    text-transform: uppercase;
    margin-bottom: 4px;
    letter-spacing: 2px;
    font-family: var(--font-mono);
}
.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--hud-cyan);
    font-family: var(--font-mono);
    text-shadow: 0 0 10px var(--hud-cyan-dim);
    transition: all var(--transition-fast);
}

/* ==========================================================
   SIGNAL BOOSTER (FILTERS)
   ========================================================== */
.signal-booster {
    background: var(--bg-card);
    border: 1px solid var(--border-hud);
    padding: 20px 24px;
    margin-bottom: 24px;
    position: relative;
}
.signal-booster__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.signal-booster__tag {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--hud-cyan);
    letter-spacing: 3px;
    padding: 3px 10px;
    border: 1px solid var(--hud-cyan-dim);
    background: var(--hud-cyan-ghost);
}
.signal-booster__freq {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--text-dim);
    letter-spacing: 1px;
    animation: freqFlicker 3s infinite;
}
@keyframes freqFlicker {
    0%, 100% { opacity: 1; }
    48% { opacity: 1; }
    50% { opacity: 0.2; }
    52% { opacity: 1; }
    70% { opacity: 1; }
    72% { opacity: 0.3; }
    74% { opacity: 1; }
}

.search-wrap {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-hud);
    padding: 10px 14px;
    margin-bottom: 16px;
    background: rgba(0, 229, 255, 0.02);
    transition: all var(--transition-fast);
    gap: 12px;
}
.search-wrap:focus-within {
    border-color: var(--hud-cyan-med);
    background: rgba(0, 229, 255, 0.04);
    box-shadow: inset 0 0 20px var(--hud-cyan-ghost);
}
.search-icon {
    color: var(--hud-cyan);
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}
.search-wrap:focus-within .search-icon { opacity: 1; }
.search-cursor {
    width: 2px;
    height: 18px;
    background: var(--hud-cyan);
    flex-shrink: 0;
    animation: cursorBlink 1s infinite;
    opacity: 0;
    transition: opacity var(--transition-fast);
}
.search-wrap:focus-within .search-cursor { opacity: 1; }
@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}
.search-wrap input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 100%;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    outline: none;
    letter-spacing: 0.5px;
}
.search-wrap input::placeholder { color: var(--text-dim); }

.filter-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.filter-label {
    font-size: 0.65rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
    letter-spacing: 2px;
}
.filter-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip {
    background: transparent;
    border: 1px solid var(--border-hud);
    color: var(--text-dim);
    padding: 5px 14px;
    font-family: var(--font-mono);
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 1px;
    transition: all var(--transition-fast);
    position: relative;
}
.filter-chip:hover {
    border-color: var(--hud-cyan-med);
    color: var(--hud-cyan);
    background: var(--hud-cyan-ghost);
}
.filter-chip.active {
    background: var(--hud-cyan);
    color: var(--bg-void);
    border-color: var(--hud-cyan);
    box-shadow: var(--hud-cyan-glow);
    font-weight: 700;
}
.filter-chip.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0; height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid var(--hud-cyan);
}

/* ==========================================================
   PLANET GRID
   ========================================================== */
.log-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 16px;
}

/* Card */
.planet-card {
    background: var(--bg-card);
    border: 1px solid var(--border-hud);
    padding: 22px 22px 18px;
    cursor: pointer;
    transition: all var(--transition-med);
    position: relative;
    overflow: hidden;
}
/* Top scanning line */
.planet-card::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 1px;
    background: linear-gradient(90deg, transparent, var(--hud-cyan), transparent);
    transition: left 0.6s ease;
}
.planet-card:hover::before { left: 100%; }

/* Corner bracket decorator */
.planet-card::after {
    content: '';
    position: absolute;
    bottom: 0; right: 0;
    width: 16px; height: 16px;
    border-right: 1px solid var(--hud-cyan-dim);
    border-bottom: 1px solid var(--hud-cyan-dim);
    transition: all var(--transition-fast);
}
.planet-card:hover {
    border-color: var(--border-hud-active);
    transform: translateY(-2px);
    background: var(--bg-card-hover);
    box-shadow:
        0 4px 30px rgba(0, 229, 255, 0.06),
        inset 0 0 30px rgba(0, 229, 255, 0.02);
}
.planet-card:hover::after {
    border-color: var(--hud-cyan);
    width: 24px;
    height: 24px;
}

/* Card internals */
.card-header { margin-bottom: 8px; }
.card-header h3 {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    color: var(--hud-cyan);
    letter-spacing: 2px;
    margin-bottom: 2px;
}
.card-system {
    font-size: 0.72rem;
    color: var(--amber);
    font-family: var(--font-mono);
    display: block;
    margin-bottom: 10px;
    letter-spacing: 1px;
}
.card-biome-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.58rem;
    padding: 3px 10px;
    border: 1px solid var(--amber);
    color: var(--amber);
    text-transform: uppercase;
    font-family: var(--font-mono);
    letter-spacing: 1.5px;
    margin-bottom: 12px;
}
.biome-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    display: inline-block;
}
.card-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 12px; }
.mini-tag {
    font-size: 0.58rem;
    border: 1px solid var(--hud-cyan-dim);
    padding: 2px 8px;
    color: var(--hud-cyan);
    text-transform: uppercase;
    font-family: var(--font-mono);
    letter-spacing: 0.5px;
    transition: all var(--transition-fast);
    background: var(--hud-cyan-ghost);
}
.planet-card:hover .mini-tag {
    border-color: var(--hud-cyan-med);
}

/* Delete button on card */
.btn-delete {
    position: absolute;
    top: 10px; right: 10px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-dim);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    padding: 4px 8px;
    transition: all var(--transition-fast);
    z-index: 2;
    opacity: 0;
    letter-spacing: 1px;
}
.planet-card:hover .btn-delete { opacity: 1; }
.btn-delete:hover {
    color: var(--red);
    border-color: var(--red);
    background: var(--red-dim);
}

/* ==========================================================
   EMPTY STATE
   ========================================================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dim);
}
.empty-icon {
    color: var(--hud-cyan-dim);
    margin-bottom: 16px;
    animation: emptyPulse 3s infinite;
}
@keyframes emptyPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.97); }
}
.empty-title {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    color: var(--hud-cyan);
    margin-bottom: 8px;
    letter-spacing: 3px;
}
.empty-sub { font-size: 0.82rem; }

/* ==========================================================
   SIDE PANEL
   ========================================================== */
.side-panel {
    position: fixed;
    top: 0; right: 0;
    width: 440px;
    max-width: 100vw;
    height: 100vh;
    background: var(--bg-panel);
    border-left: 1px solid var(--hud-cyan);
    box-shadow: -10px 0 60px rgba(0, 229, 255, 0.05);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    backdrop-filter: blur(12px);
}
.side-panel.open { transform: translateX(0); }

.panel-inner {
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}
.panel-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-hud-active);
    padding-bottom: 16px;
    margin-bottom: 28px;
}
.panel-nav__title {
    display: flex;
    align-items: center;
    gap: 10px;
}
.panel-title {
    font-family: var(--font-mono);
    color: var(--hud-cyan);
    font-size: 0.85rem;
    letter-spacing: 3px;
}
.close-panel {
    background: none;
    border: 1px solid var(--border-hud);
    color: var(--text-dim);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}
.close-panel:hover {
    border-color: var(--red);
    color: var(--red);
    background: var(--red-dim);
}

.form-body { flex: 1; }

.input-group { margin-bottom: 24px; position: relative; }
.input-group label {
    display: block;
    font-size: 0.6rem;
    color: var(--hud-cyan);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: var(--font-mono);
}
.input-group input,
.input-group select {
    width: 100%;
    background: rgba(0, 229, 255, 0.02);
    border: none;
    border-bottom: 1px solid var(--border-hud);
    color: var(--text-primary);
    padding: 12px 10px;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    outline: none;
    transition: all var(--transition-fast);
    border-radius: 0;
    appearance: none;
    letter-spacing: 0.5px;
}
.input-group__line {
    position: absolute;
    bottom: 0; left: 0;
    width: 0; height: 2px;
    background: var(--hud-cyan);
    transition: width 0.3s ease;
    box-shadow: var(--hud-cyan-glow);
}
.input-group input:focus ~ .input-group__line,
.input-group select:focus ~ .input-group__line {
    width: 100%;
}
.input-group input:focus,
.input-group select:focus {
    border-bottom-color: transparent;
    background: rgba(0, 229, 255, 0.04);
}
.input-group select option {
    background: #060a10;
    color: var(--text-primary);
}

/* Resource picker grid */
.resource-picker {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.res-btn {
    background: transparent;
    border: 1px solid var(--border-hud);
    color: var(--text-dim);
    padding: 10px 8px;
    font-size: 0.68rem;
    font-family: var(--font-mono);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all var(--transition-fast);
    position: relative;
}
.res-btn:hover { border-color: var(--hud-cyan-dim); color: var(--text-primary); }
.res-btn.active {
    border-color: var(--hud-cyan);
    color: var(--hud-cyan);
    background: var(--hud-cyan-ghost);
    box-shadow: inset 0 0 15px var(--hud-cyan-ghost);
}
.res-btn.active::after {
    content: '';
    position: absolute;
    top: 3px; right: 3px;
    width: 5px; height: 5px;
    background: var(--hud-cyan);
    border-radius: 50%;
    box-shadow: var(--hud-cyan-glow);
}

.panel-footer { margin-top: auto; padding-top: 20px; }

/* Confirm button */
.btn-confirm {
    width: 100%;
    background: transparent;
    border: 1px solid var(--amber);
    color: var(--amber);
    padding: 16px;
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
    cursor: pointer;
    font-family: var(--font-ui);
    letter-spacing: 3px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-fast);
}
.btn-confirm__bg {
    position: absolute;
    inset: 0;
    background: var(--amber);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-confirm:hover .btn-confirm__bg { transform: scaleX(1); }
.btn-confirm__text { position: relative; z-index: 1; }
.btn-confirm:hover {
    color: var(--bg-void);
    box-shadow: var(--amber-glow);
}

/* ==========================================================
   MODAL
   ========================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 5, 8, 0.94);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    backdrop-filter: blur(6px);
}
.modal-overlay.visible { display: flex; }

.modal-card {
    background: var(--bg-panel);
    border: 1px solid var(--hud-cyan);
    width: 100%;
    max-width: 840px;
    padding: 32px 36px;
    position: relative;
    box-shadow:
        0 0 80px rgba(0, 229, 255, 0.06),
        inset 0 0 40px rgba(0, 229, 255, 0.02);
    animation: modalIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 90vh;
    overflow: hidden;
}

/* Ocultar scrollbar en Chrome, Safari y Opera */
.modal-body::-webkit-scrollbar {
    display: none;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Modal corner frames */
.modal-card__frame {
    position: absolute;
    width: 20px;
    height: 20px;
    z-index: 1;
}
.modal-card__frame--tl { top: -1px; left: -1px; border-top: 2px solid var(--hud-cyan); border-left: 2px solid var(--hud-cyan); }
.modal-card__frame--tr { top: -1px; right: -1px; border-top: 2px solid var(--hud-cyan); border-right: 2px solid var(--hud-cyan); }
.modal-card__frame--bl { bottom: -1px; left: -1px; border-bottom: 2px solid var(--hud-cyan); border-left: 2px solid var(--hud-cyan); }
.modal-card__frame--br { bottom: -1px; right: -1px; border-bottom: 2px solid var(--hud-cyan); border-right: 2px solid var(--hud-cyan); }

.modal-header {
    border-bottom: 1px solid var(--border-hud-active);
    padding-bottom: 16px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
}
.modal-title-wrap h2 {
    font-family: var(--font-mono);
    color: var(--hud-cyan);
    font-size: 1.5rem;
    letter-spacing: 3px;
    margin-bottom: 4px;
    text-shadow: 0 0 20px var(--hud-cyan-dim);
}
.modal-sub-id {
    font-size: 0.65rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
    letter-spacing: 1.5px;
}
.modal-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* HUD Buttons (modal) */
.btn-hud {
    background: transparent;
    border: 1px solid var(--border-hud);
    color: var(--text-dim);
    padding: 6px 16px;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transition: all var(--transition-fast);
    position: relative;
}
.btn-hud:hover {
    border-color: var(--hud-cyan);
    color: var(--hud-cyan);
    background: var(--hud-cyan-ghost);
}
.btn-hud--danger:hover {
    border-color: var(--red);
    color: var(--red);
    background: var(--red-dim);
}

/* Telemetry grid inside modal */
.telemetry-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}
.telemetry-item { margin-bottom: 20px; }
.t-label {
    color: var(--amber);
    font-size: 0.6rem;
    display: block;
    margin-bottom: 6px;
    font-family: var(--font-mono);
    letter-spacing: 2px;
    text-transform: uppercase;
}
.t-value {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-family: var(--font-mono);
    letter-spacing: 1px;
}

/* Threat / Danger bar */
.danger-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.04);
    margin-top: 10px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-hud);
}
.danger-fill {
    height: 100%;
    width: 0%;
    transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.danger-fill.low {
    background: linear-gradient(90deg, var(--hud-cyan-dim), var(--hud-cyan));
    box-shadow: 0 0 8px var(--hud-cyan-dim);
}
.danger-fill.high {
    background: linear-gradient(90deg, var(--amber-dim), var(--amber));
    box-shadow: 0 0 8px rgba(255, 109, 0, 0.4);
}

/* Edit-mode input inside modal */
.edit-input {
    background: var(--hud-cyan-ghost);
    border: none;
    border-bottom: 1px solid var(--hud-cyan-med);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    width: 100%;
    padding: 6px 8px;
    outline: none;
    transition: all var(--transition-fast);
    letter-spacing: 1px;
}
.edit-input:focus {
    background: rgba(0, 229, 255, 0.08);
    box-shadow: 0 2px 10px rgba(0, 229, 255, 0.1);
    border-bottom-color: var(--hud-cyan);
}
.edit-input option {
    background: #060a10;
    color: var(--text-primary);
}

/* Resource edit grid inside modal */
.edit-resource-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    margin-top: 6px;
}
.edit-res-btn {
    background: transparent;
    border: 1px solid var(--border-hud);
    color: var(--text-dim);
    padding: 6px;
    font-size: 0.6rem;
    font-family: var(--font-mono);
    cursor: pointer;
    text-transform: uppercase;
    transition: all var(--transition-fast);
    letter-spacing: 0.5px;
}
.edit-res-btn:hover { border-color: var(--hud-cyan-dim); color: var(--text-primary); }
.edit-res-btn.active {
    border-color: var(--hud-cyan);
    color: var(--hud-cyan);
    background: var(--hud-cyan-ghost);
}

/* Edit footer */
.edit-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-hud);
}

/* ==========================================================
   BOTTOM HUD BAR
   ========================================================== */
.hud-bottombar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 24px;
    background: linear-gradient(0deg, rgba(2, 5, 8, 0.95) 0%, rgba(2, 5, 8, 0.8) 100%);
    border-top: 1px solid var(--border-hud);
    backdrop-filter: blur(8px);
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 2px;
    color: var(--text-dim);
    gap: 0;
}
.hud-bottombar__segment {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 16px;
    border-right: 1px solid var(--border-hud);
}
.hud-bottombar__segment:last-child { border-right: none; }
.hud-bottombar__dot {
    width: 5px; height: 5px;
    border-radius: 50%;
    background: var(--text-dim);
    opacity: 0.3;
}
.hud-bottombar__dot.active {
    background: #00ff88;
    opacity: 1;
    box-shadow: 0 0 6px rgba(0, 255, 136, 0.5);
}
.hud-bottombar__center {
    padding: 4px 24px;
    border-right: 1px solid var(--border-hud);
    color: #00ff88;
    text-shadow: 0 0 8px rgba(0, 255, 136, 0.3);
    flex-shrink: 0;
}

/* ==========================================================
   HUD NOTIFICATION TOAST
   ========================================================== */
.hud-toast {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: var(--bg-panel);
    border: 1px solid var(--hud-cyan);
    padding: 10px 28px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--hud-cyan);
    letter-spacing: 2px;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.1);
}
.hud-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.hud-toast.hud-toast--warning {
    border-color: var(--amber);
    color: var(--amber);
    box-shadow: 0 0 30px rgba(255, 109, 0, 0.1);
}
.hud-toast.hud-toast--danger {
    border-color: var(--red);
    color: var(--red);
    box-shadow: 0 0 30px rgba(255, 23, 68, 0.1);
}


.modal-body::-webkit-scrollbar {
    width: 4px;
}
.modal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}
.modal-body::-webkit-scrollbar-thumb {
    background: var(--hud-cyan-med);
    border-radius: 10px;
}

/* ==========================================================
   RESPONSIVE
   ========================================================== */
@media (max-width: 1100px) {
    .hud-gutter { display: none; }
    .hud-content { padding: 20px 24px 60px; }
}
@media (max-width: 900px) {
    .stats-bar { grid-template-columns: repeat(2, 1fr); }
    .telemetry-grid { grid-template-columns: 1fr; gap: 20px; }
    .hero-section { flex-direction: column; align-items: flex-start; }
    .hud-topbar { flex-direction: column; gap: 6px; align-items: flex-start; }
    .hud-bottombar { display: none; }
}
@media (max-width: 600px) {
    .stats-bar { grid-template-columns: 1fr; }
    .hud-content { padding: 14px 12px 50px; }
    .modal-card { padding: 20px 16px; }
    .side-panel { width: 100%; }
    .log-grid { grid-template-columns: 1fr; }
    .stat-box__icon { display: none; }
}

/* ---------- Utility: sr-only ---------- */
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ==========================================================
   GALACTIC MAP
   ========================================================== */

.galaxy-map-section {
    margin: 40px 0 50px;
    padding: 20px 0;
    border-top: 1px solid var(--border-hud);
    border-bottom: 1px solid var(--border-hud);
}

.galaxy-map-title {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    color: var(--hud-cyan);
    letter-spacing: 4px;
    margin-bottom: 16px;
    text-shadow: 0 0 20px var(--hud-cyan-dim);
}

.galaxy-map-wrapper {
    position: relative;
    width: 100%;
    background: rgba(0, 229, 255, 0.02);
    border: 1px solid var(--border-hud);
    box-shadow: inset 0 0 40px rgba(0, 229, 255, 0.05);
    overflow: hidden;
}

#galaxy-map {
    width: 100%;
    height: 500px;
    display: block;
    cursor: crosshair;
}

.galaxy-map-hint {
    margin-top: 10px;
    font-size: 0.7rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
    letter-spacing: 2px;
    text-align: center;
}

.hud-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.hud-tab {
    background: transparent;
    border: 1px solid var(--border-hud);
    color: var(--text-dim);
    padding: 10px 20px;
    font-family: var(--font-mono);
    letter-spacing: 2px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.hud-tab.active {
    border-color: var(--hud-cyan);
    color: var(--hud-cyan);
    background: var(--hud-cyan-ghost);
    box-shadow: var(--hud-cyan-glow);
}

.tab-view {
    display: none;
}

.tab-view.active {
    display: block;
}

.resource-search-wrap {
    margin-bottom: 10px;
}

.resource-search-wrap input {
    width: 100%;
    background: rgba(0, 229, 255, 0.02);
    border: 1px solid var(--border-hud);
    padding: 10px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    letter-spacing: 1px;
    outline: none;
}

.resource-search-wrap input:focus {
    border-color: var(--hud-cyan);
    background: rgba(0, 229, 255, 0.04);
}

/* Ruido holográfico suave */
#galaxy-map {
    filter: contrast(1.05) brightness(1.08);
    image-rendering: crisp-edges;
}

/* Micro-parpadeo de la UI */
.hud-tab.active {
    animation: uiPulse 2.8s infinite ease-in-out;
}

@keyframes uiPulse {
    0%, 100% { box-shadow: 0 0 6px rgba(200,220,255,0.15); }
    50% { box-shadow: 0 0 12px rgba(200,220,255,0.25); }
}

/* Efecto de distorsión ligera al pasar el ratón */
.planet-card:hover {
    transform: translateY(-3px) scale(1.015);
    filter: drop-shadow(0 0 6px rgba(200,220,255,0.15));
}
