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

body {
    overflow: hidden;
    background: #000;
    font-family: system-ui, -apple-system, sans-serif;
    color: #fff;
}

#canvas {
    display: block;
    width: 100vw;
    height: 100vh;
}

/* Wormhole overview dim overlay */
#scene-dim-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 10, 0.78);
    z-index: 500;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

#scene-dim-overlay.active {
    opacity: 1;
}

#tube-map-svg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 501;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

#tube-map-svg.active {
    opacity: 1;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 300px; /* original width restored */
    max-width: 92vw;
    background: rgba(15, 15, 20, 0.95);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.3s ease;
    z-index: 1000;
    display: flex;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-toggle {
    position: absolute;
    right: -40px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 60px;
    background: rgba(15, 15, 20, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: none;
    border-radius: 0 8px 8px 0;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.sidebar-toggle:hover {
    background: rgba(30, 30, 40, 0.95);
}

.sidebar.collapsed .sidebar-toggle i {
    transform: rotate(0deg);
}

.sidebar:not(.collapsed) .sidebar-toggle i {
    transform: rotate(180deg);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
}
.sidebar-content > * { flex-shrink: 0; }

.sidebar-header {
    color: #fff;
    padding: 10px 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.9rem;
}

/* Camera view buttons */
.sidebar .btn-group .btn-outline-light {
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
}

.sidebar .btn-group .btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}

.sidebar .btn-group .btn-outline-light:active {
    background: rgba(255, 255, 255, 0.25);
}

/* Bootstrap dark theme overrides */
.accordion {
    --bs-accordion-bg: transparent;
    --bs-accordion-border-color: rgba(255, 255, 255, 0.1);
}

.accordion-button {
    background: rgba(255, 255, 255, 0.05) !important;
    color: #fff !important;
    font-size: 0.85rem;
    padding: 12px 15px;
}

.accordion-button:not(.collapsed) {
    background: rgba(255, 255, 255, 0.1) !important;
    box-shadow: none;
}

.accordion-button::after {
    filter: invert(1);
}

.accordion-button:focus {
    box-shadow: none;
    border-color: rgba(255, 255, 255, 0.2);
}

.accordion-body {
    background: transparent;
    padding: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.accordion-body .text-muted {
    color: rgba(255, 255, 255, 0.5) !important;
}

.accordion-item {
    border-color: rgba(255, 255, 255, 0.1);
}

/* List items in sidebar */
.sidebar-item {
    padding: 8px 12px;
    margin: 2px 0;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    transition: background 0.2s;
}

.sidebar-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-item.active {
    background: rgba(80, 120, 200, 0.3);
    color: #fff;
}

.sidebar-item-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0;
}

/* Name + inline type tag, truncating before the copy button */
.sidebar-item-label {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 6px;
    overflow: hidden;
}

.sidebar-item-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-item-tag {
    flex-shrink: 0;
    font-size: 0.7rem;
    font-style: italic;
    color: rgba(255, 255, 255, 0.4);
}

/* Per-entry copy-GPS button, revealed on row hover */
.sidebar-copy-btn {
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    padding: 2px 6px;
    margin-left: 6px;
    border-radius: 3px;
    font-size: 0.75rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s, color 0.2s;
}

.sidebar-item:hover .sidebar-copy-btn {
    opacity: 1;
}

.sidebar-copy-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* Sector sub-headers within Celestial Bodies / Points of Interest */
.sidebar-group-header {
    margin-bottom: 6px;
    margin-top: 14px;
}

.sidebar-group-header:first-child {
    margin-top: 2px;
}

/* Controls grid */
.controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
}

.control-key {
    background: rgba(255, 255, 255, 0.15);
    padding: 3px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.75rem;
    color: #fff;
    min-width: 45px;
    text-align: center;
}

.control-desc {
    color: rgba(255, 255, 255, 0.7);
}

#overlay {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
}

.panel {
    pointer-events: auto;
    background: rgba(20, 20, 30, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 16px;
    min-width: 200px;
}

#info-panel {
    position: fixed;
    top: 20px;
    right: 20px;
}

#info-panel h2 {
    margin-bottom: 8px;
    font-size: 1.1rem;
}

#info-panel p {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 12px;
}

#info-panel button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
}

#info-panel button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.hidden {
    display: none;
}

#labels-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.label {
    position: absolute;
    color: #fff;
    font-size: 12px;
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 3px;
    white-space: nowrap;
    transform: translate(-50%, -100%);
    pointer-events: none;
    transition: opacity 0.2s;
}

.label.selected {
    background: rgba(80, 120, 200, 0.8);
    font-weight: bold;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.label.sector-label {
    font-size: 11px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.32em;
    background: transparent;
    color: rgba(205, 240, 255, 0.78);
    text-shadow: 0 0 8px rgba(127, 227, 255, 0.3);
}
.label.sector-label::after { content: attr(data-sub); display: block; margin-top: 3px; font-size: 7px; font-weight: 400; letter-spacing: 0.3em; color: rgba(160, 225, 245, 0.5); text-shadow: none; }

.label.player-label {
    background: rgba(0, 200, 100, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.6);
    font-weight: bold;
}

/* Player position input */
.player-position-section {
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.player-position-section .form-control {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-family: monospace;
    font-size: 0.8rem;
}

.player-position-section .form-control::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.player-position-section .form-control:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(80, 120, 200, 0.5);
    box-shadow: 0 0 0 2px rgba(80, 120, 200, 0.2);
    color: #fff;
}

.player-position-section .form-control.is-invalid {
    border-color: rgba(220, 53, 69, 0.5);
}

.player-position-section .invalid-feedback {
    color: #ff6b6b;
    font-size: 0.75rem;
    display: none;
    margin-top: 4px;
}

.form-label {
    color: #fff !important;
}

/* Celestial Body Info Box - Top Right Overlay */
.body-info-box {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 350px; /* info card on the right: was 280px (+25%) */
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 40px);
    background: rgba(15, 15, 20, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    z-index: 900;
    display: flex;
    flex-direction: column;
}

.body-info-box.hidden {
    display: none;
}

.body-info-box.collapsed .body-info-inner {
    display: none;
}

.body-info-box.collapsed {
    max-height: none;
}

.body-info-toggle {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: background 0.2s, color 0.2s;
    z-index: 1;
}

.body-info-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.body-info-box.collapsed .body-info-toggle i {
    transform: rotate(180deg);
}

.body-info-inner {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
}

.body-info-box img {
    width: 100%;
    height: auto;
    /* Reserve a ~station-shaped box while the (large) image loads so the card
       doesn't collapse then jump. `auto 1.9/1` uses the real image ratio once
       loaded (no distortion) and only falls back to 1.9:1 while empty. */
    aspect-ratio: auto 1.9 / 1;
    display: block;
    margin-bottom: 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.body-info-box h6 {
    color: #fff;
    margin-bottom: 10px;
    margin-right: 28px;
    font-size: 0.95rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
}

.body-info-content {
    font-size: 0.8rem;
}

.body-info-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.body-info-row:last-child {
    border-bottom: none;
}

.body-info-label {
    color: rgba(255, 255, 255, 0.6);
    flex-shrink: 0;
}

.body-info-value {
    color: #fff;
    text-align: right;
    margin-left: 10px;
}

.body-info-section {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.body-info-section-title {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.body-info-ores {
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.4;
}

.body-info-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    justify-content: center;
}

.body-info-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.body-info-badge.planet {
    background: rgba(160, 120, 255, 0.3);
    color: #c9b3ff;
}

.body-info-badge.moon {
    background: rgba(120, 180, 255, 0.3);
    color: #a3c9ff;
}

.body-info-badge.sector {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
}

a.body-info-badge.sector {
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

a.body-info-badge.sector:hover {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
}

.body-info-badge.transporter {
    background: rgba(100, 255, 150, 0.3);
    color: #90ffb0;
}

.body-info-badge.no-respawn {
    background: rgba(255, 100, 100, 0.3);
    color: #ffaaaa;
}

.body-info-footer {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.35);
    text-align: center;
}

/* Saved Markers section */
.marker-item {
    display: flex;
    align-items: center;
    padding-right: 4px;
}

.marker-item .marker-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.marker-actions {
    display: flex;
    gap: 2px;
    margin-left: auto;
    opacity: 0;
    transition: opacity 0.2s;
}

.marker-item:hover .marker-actions {
    opacity: 1;
}

.marker-action-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    padding: 2px 6px;
    cursor: pointer;
    border-radius: 3px;
    font-size: 0.75rem;
    transition: background 0.2s, color 0.2s;
}

.marker-action-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.marker-action-btn.marker-action-delete:hover {
    background: rgba(220, 53, 69, 0.3);
    color: #ff6b6b;
}

.markers-actions {
    display: flex;
    gap: 8px;
}

.markers-actions .btn {
    font-size: 0.8rem;
}

#import-markers-text {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-family: monospace;
    font-size: 0.75rem;
    resize: vertical;
}

#import-markers-text::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

#import-markers-text:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(80, 120, 200, 0.5);
    box-shadow: 0 0 0 2px rgba(80, 120, 200, 0.2);
    color: #fff;
}

#import-markers-result.success {
    color: #90ffb0;
}

#import-markers-result.error {
    color: #ffaaaa;
}

/* Saved marker labels */
.label.saved-marker-label {
    background: rgba(100, 150, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

/* Route endpoint labels - always on top, offset below point */
.label.route-endpoint-label {
    background: rgba(255, 204, 0, 0.95);
    border: 2px solid rgba(255, 220, 100, 1);
    color: #000;
    font-weight: bold;
    z-index: 100;
    transform: translate(-50%, 8px);
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.label.route-endpoint-origin::before {
    content: "A: ";
}

.label.route-endpoint-destination::before {
    content: "B: ";
}

/* Modal dark theme overrides */
.modal-content.bg-dark {
    background: rgba(25, 25, 35, 0.98) !important;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.modal-content.bg-dark .modal-header,
.modal-content.bg-dark .modal-footer {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

.modal-content.bg-dark .modal-title {
    color: #fff;
}

.modal-content.bg-dark .form-label {
    color: rgba(255, 255, 255, 0.8);
}

.modal-content.bg-dark .form-control {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.modal-content.bg-dark .form-control:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(80, 120, 200, 0.5);
    box-shadow: 0 0 0 2px rgba(80, 120, 200, 0.2);
    color: #fff;
}

.modal-content.bg-dark .form-control-color {
    padding: 4px;
    height: 38px;
}

.modal-content.bg-dark p {
    color: rgba(255, 255, 255, 0.9);
}

/* GPS input save button */
.player-position-section .input-group .btn-outline-light {
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
}

.player-position-section .input-group .btn-outline-light:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}

.player-position-section .input-group .btn-outline-light:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Route Planner */
.route-planner-body {
    max-height: 400px;
}

.route-field {
    margin-bottom: 12px;
}

.route-label {
    display: block;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.route-combobox {
    position: relative;
}

.route-combobox-input {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
    font-size: 0.8rem !important;
}

.route-combobox-input::placeholder {
    color: rgba(255, 255, 255, 0.3) !important;
}

.route-combobox-input:focus {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(80, 120, 200, 0.5) !important;
    box-shadow: 0 0 0 2px rgba(80, 120, 200, 0.2) !important;
}

.route-combobox-input.has-selection {
    color: #a3c9ff !important;
}

.route-combobox-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: #1a1a24;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-top: none;
    border-radius: 0 0 4px 4px;
    z-index: 1000;
}

.route-combobox-dropdown.open {
    display: block;
}

.route-combobox-item {
    padding: 6px 10px;
    font-size: 0.8rem;
    color: #fff;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.route-combobox-item:hover,
.route-combobox-item.highlighted {
    background: rgba(80, 120, 200, 0.3);
}

.route-combobox-group {
    padding: 6px 10px;
    font-size: 0.7rem;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(0, 0, 0, 0.2);
}

#route-jump-range {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

#route-jump-range:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(80, 120, 200, 0.5);
    box-shadow: 0 0 0 2px rgba(80, 120, 200, 0.2);
}

#route-jump-range option {
    background: #1a1a24;
    color: #fff;
}

.route-gps-hint {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 12px;
    padding: 0 2px;
}

.route-gps-hint.hidden {
    display: none;
}

.route-distance {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    margin-bottom: 12px;
}

.route-distance-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
}

.route-distance-value {
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: monospace;
}

#route-calculate {
    font-size: 0.85rem;
}

#route-calculate:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Route Result */
.route-result {
    margin-top: 12px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
}

.route-result.hidden {
    display: none;
}

.route-summary {
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.route-summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
}

.route-summary-row span:last-child {
    font-family: monospace;
    color: #fff;
}

.route-info {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.route-error {
    font-size: 0.8rem;
    color: #ffaaaa;
    background: rgba(255, 100, 100, 0.15);
    padding: 8px;
    border-radius: 4px;
    margin-top: 8px;
}

.route-steps {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}

.route-step {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    padding: 4px 6px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 3px;
}

.route-step-travel {
    align-items: flex-start;
}

.route-step-endpoints {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    margin-right: 8px;
}

.route-step-from,
.route-step-to {
    color: rgba(255, 255, 255, 0.8);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.route-step-to {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.7rem;
}

.route-step-value {
    color: #fff;
    font-family: monospace;
    flex-shrink: 0;
}

.route-step-wormhole {
    background: rgba(80, 120, 200, 0.2);
    color: #a3c9ff;
    justify-content: center;
}

.route-step-gravity {
    background: rgba(200, 150, 80, 0.15);
    color: #ffd699;
    justify-content: flex-start;
}

.route-total {
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    font-weight: 500;
}

.route-total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
}

.route-total-row:last-child {
    margin-bottom: 0;
}

.route-total-row span:first-child {
    color: rgba(255, 255, 255, 0.7);
}

.route-total-value {
    color: #90ffb0;
    font-family: monospace;
}

.route-warning {
    font-size: 0.75rem;
    color: #ffd699;
    background: rgba(255, 180, 80, 0.15);
    padding: 6px 8px;
    border-radius: 4px;
    margin-top: 8px;
}

/* Route action buttons */
.btn-route-copy {
    background: rgba(255, 204, 0, 0.9);
    border-color: rgba(255, 220, 100, 1);
    color: #000;
    font-weight: 500;
}

.btn-route-copy:hover {
    background: rgba(255, 204, 0, 1);
    border-color: rgba(255, 220, 100, 1);
    color: #000;
}

.btn-route-copy:active {
    background: rgba(230, 180, 0, 1);
    border-color: rgba(255, 200, 80, 1);
    color: #000;
}

.route-result .btn-group .btn-outline-secondary {
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.6);
}

.route-result .btn-group .btn-outline-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.9);
}

/* Route Alternative Section */
.route-alternative {
    margin-top: 12px;
    padding: 10px;
    background: rgba(100, 200, 100, 0.08);
    border: 1px solid rgba(100, 200, 100, 0.25);
    border-radius: 6px;
}

.route-alternative-header {
    font-size: 0.8rem;
    color: #90ffb0;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(100, 200, 100, 0.2);
}

.route-alternative-header i {
    color: #90ffb0;
}

.route-steps-alt {
    opacity: 0.9;
}

.route-total-alt {
    padding-top: 6px;
    border-top: 1px solid rgba(100, 200, 100, 0.2);
    font-size: 0.8rem;
}

.route-total-alt .route-total-value {
    color: #90ffb0;
}

/* Authentication Section */
.auth-section {
    padding: 10px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-status.hidden {
    display: none;
}

.auth-section .btn-outline-warning {
    border-color: rgba(255, 193, 7, 0.5);
    color: #ffc107;
}

.auth-section .btn-outline-warning:hover {
    background: rgba(255, 193, 7, 0.15);
    border-color: rgba(255, 193, 7, 0.7);
    color: #ffc107;
}

.auth-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    background: rgba(100, 255, 150, 0.15);
    border: 1px solid rgba(100, 255, 150, 0.3);
    border-radius: 4px;
    color: #90ffb0;
    font-size: 0.8rem;
    font-weight: 500;
    position: relative;
}

.auth-clear-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    padding: 2px 6px;
    margin-left: 8px;
    cursor: pointer;
    border-radius: 3px;
    font-size: 0.7rem;
    transition: background 0.2s, color 0.2s;
}

.auth-clear-btn:hover {
    background: rgba(255, 100, 100, 0.3);
    color: #ff9999;
}


/* Auth Modal */
#auth-modal .modal-header {
    color: #ffc107;
}

#auth-modal .modal-header i {
    color: #ffc107;
}

#auth-code-input {
    font-family: monospace;
    letter-spacing: 2px;
    text-align: center;
}

#auth-code-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

#auth-error.hidden {
    display: none;
}

/* Wormhole restricted state */
.wormholes-restricted {
    font-size: 0.75rem;
    color: #ffc107;
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.25);
    border-radius: 4px;
    padding: 8px 10px;
    margin-bottom: 10px;
    text-align: center;
}

.wormholes-restricted.hidden {
    display: none;
}

#wormholes-lock-icon {
    font-size: 0.7rem;
    opacity: 0.8;
}

#wormholes-lock-icon.hidden {
    display: none;
}

.sidebar-item.wormhole-restricted {
    opacity: 0.6;
}

/* ===== Visual refresh: sci-fi glass UI ===== */
:root {
    --ui-accent: #4fd6ff;
    --ui-accent-soft: rgba(79, 214, 255, 0.18);
    --ui-glass: rgba(9, 13, 26, 0.62);
    --ui-font: 'Exo 2', system-ui, -apple-system, sans-serif;
    --ui-display: 'Orbitron', 'Exo 2', sans-serif;
}
body { font-family: var(--ui-font); }
.sidebar, .body-info-box, .modal-content {
    background: var(--ui-glass) !important;
    backdrop-filter: blur(14px) saturate(1.3);
    -webkit-backdrop-filter: blur(14px) saturate(1.3);
    border: 1px solid var(--ui-accent-soft);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), inset 0 0 24px rgba(79, 214, 255, 0.04);
}
.sidebar h1, .sidebar h2, .sidebar h3, .sidebar h4, .sidebar h5, .sidebar h6,
.body-info-box h6, .modal-title, .body-info-section-title {
    font-family: var(--ui-display);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.body-info-box h6 { color: var(--ui-accent); text-shadow: 0 0 12px rgba(79, 214, 255, 0.45); }
.accordion-button { font-family: var(--ui-display); font-size: 0.8rem; letter-spacing: 0.05em; text-transform: uppercase; }
.accordion-button:not(.collapsed) { color: var(--ui-accent); box-shadow: inset 0 -1px 0 var(--ui-accent-soft); }
.btn-primary, .btn-outline-primary:hover { --bs-btn-bg: var(--ui-accent); --bs-btn-border-color: var(--ui-accent); --bs-btn-color: #04121a; --bs-btn-hover-bg: #8be6ff; --bs-btn-hover-border-color: #8be6ff; --bs-btn-hover-color: #04121a; }
.btn-outline-primary, .btn-outline-light { --bs-btn-color: var(--ui-accent); --bs-btn-border-color: var(--ui-accent-soft); }
.btn { transition: box-shadow 0.2s, background 0.2s, color 0.2s; }
.btn:hover { box-shadow: 0 0 14px rgba(79, 214, 255, 0.35); }
.form-control:focus, .form-select:focus { border-color: var(--ui-accent); box-shadow: 0 0 0 0.2rem rgba(79, 214, 255, 0.2); }
.body-info-label, .body-info-badge { font-family: var(--ui-font); letter-spacing: 0.03em; }
* { scrollbar-width: thin; scrollbar-color: rgba(79, 214, 255, 0.35) transparent; }
*::-webkit-scrollbar { width: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(79, 214, 255, 0.3); border-radius: 4px; }


/* ===== Title, search, accessibility ===== */
.sidebar-header { text-align: center; font-size: 1.1rem; margin: 0 0 1rem; padding: 0.25rem 0; width: 100%; color: #fff; text-shadow: 0 0 14px rgba(79, 214, 255, 0.5); }
#markers-list .filtered-out { display: none !important; }

/* Keyboard focus styles */
:focus-visible { outline: 2px solid var(--ui-accent) !important; outline-offset: 2px; }
.btn:focus-visible, .accordion-button:focus-visible, .sidebar-toggle:focus-visible, .btn-close:focus-visible { box-shadow: 0 0 0 4px rgba(79, 214, 255, 0.25) !important; }
.form-control:focus-visible, .form-select:focus-visible { outline-offset: 0; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }


/* ===== Loading screen ===== */
#loading-screen { position: fixed; inset: 0; z-index: 5000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; background: radial-gradient(ellipse at center, #0f1a2e 0%, #05070d 70%); transition: opacity 0.7s ease; }
#loading-screen.done { opacity: 0; pointer-events: none; }
.ld-orbits { position: relative; width: 190px; height: 190px; }
.ld-core { position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #bff0ff, #4fd6ff 55%, #1b6f99); box-shadow: 0 0 28px rgba(79, 214, 255, 0.7); animation: ld-pulse 2.4s ease-in-out infinite; }
.ld-ring { position: absolute; left: 50%; top: 50%; border: 1px solid rgba(79, 214, 255, 0.28); border-radius: 50%; animation: ld-spin linear infinite; }
.ld-ring span { position: absolute; top: -5px; left: 50%; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: #fff; box-shadow: 0 0 10px #4fd6ff; }
.ld-r1 { width: 90px; height: 90px; margin: -45px 0 0 -45px; animation-duration: 2.2s; }
.ld-r2 { width: 140px; height: 140px; margin: -70px 0 0 -70px; animation-duration: 3.8s; animation-direction: reverse; }
.ld-r2 span { background: #ffb86b; box-shadow: 0 0 10px #ff8a4a; }
.ld-r3 { width: 190px; height: 190px; margin: -95px 0 0 -95px; animation-duration: 6s; }
.ld-r3 span { background: #8dff9d; box-shadow: 0 0 10px #4cff6a; }
.ld-title { font-family: var(--ui-display, sans-serif); font-size: 1.25rem; letter-spacing: 0.22em; text-transform: uppercase; color: #fff; text-shadow: 0 0 16px rgba(79, 214, 255, 0.6); }
.ld-bar { width: 240px; height: 3px; overflow: hidden; border-radius: 2px; background: rgba(255, 255, 255, 0.1); }
.ld-bar-fill { width: 40%; height: 100%; border-radius: 2px; background: linear-gradient(90deg, transparent, #4fd6ff, transparent); animation: ld-slide 1.4s ease-in-out infinite; }
.ld-text { font-family: var(--ui-font, sans-serif); font-size: 0.85rem; letter-spacing: 0.08em; color: rgba(255, 255, 255, 0.6); }
#loading-screen.error .ld-bar-fill, #loading-screen.error .ld-ring, #loading-screen.error .ld-core { animation: none; }
#loading-screen.error .ld-text { color: #ff8a8a; }
@keyframes ld-spin { to { transform: rotate(360deg); } }
@keyframes ld-pulse { 50% { transform: scale(1.18); box-shadow: 0 0 40px rgba(79, 214, 255, 0.9); } }
@keyframes ld-slide { from { transform: translateX(-120%); } to { transform: translateX(300%); } }

/* ===== Navigation-map labels (planets, moons, stations, wormholes) ===== */
.label.nav-label { pointer-events: auto; }
.label.nav-label.selected { background: transparent; border: none; box-shadow: none; }
.label.nav-label::before { content: ''; position: absolute; right: 100%; margin-right: 6px; top: 50%; width: 16px; height: 1px; background: linear-gradient(90deg, rgba(160, 230, 255, 0), rgba(160, 230, 255, 0.8)); }
.label.nav-label::after { content: attr(data-sub); display: block; margin-top: 2px; font-size: 8px; font-weight: 400; letter-spacing: 0.26em; color: rgba(160, 225, 245, 0.55); text-shadow: none; }


/* ===== Route planner quick tools ===== */
.route-tools { display: flex; gap: 6px; margin-bottom: 0.6rem; }


/* ===== Sidebar footer ===== */
.sidebar-footer { margin: auto -15px -15px; padding: 10px 15px 12px; position: sticky; bottom: -15px; text-align: center; font-family: 'Orbitron', var(--ui-display, sans-serif); font-size: 8px; font-weight: 400; letter-spacing: 0.16em; line-height: 1.7; text-transform: uppercase; color: rgba(190, 230, 245, 0.5); border-top: 1px solid rgba(160, 225, 245, 0.14); background: rgba(10, 13, 22, 0.92); }
.sidebar-footer-label { display: block; font-size: 7px; letter-spacing: 0.3em; color: rgba(160, 225, 245, 0.35); }


/* ===== Planet data (imported from planets.md) ===== */
.body-info-inner { overflow-y: auto; max-height: calc(100vh - 80px); }
.body-info-more { margin-top: 8px; border-top: 1px solid rgba(255, 255, 255, 0.1); padding-top: 6px; }
.body-info-more summary { cursor: pointer; color: rgba(160, 225, 245, 0.8); font-size: 0.7rem; letter-spacing: 1px; text-transform: uppercase; }
.body-info-more summary:focus-visible { outline: 2px solid var(--ui-accent); }
.body-info-table { width: 100%; font-size: 0.72rem; margin-top: 6px; border-collapse: collapse; }
.body-info-table th { color: rgba(255, 255, 255, 0.5); font-weight: 400; text-align: left; padding: 2px 4px; }
.body-info-table td { padding: 2px 4px; border-top: 1px solid rgba(255, 255, 255, 0.05); color: rgba(255, 255, 255, 0.9); }
.body-info-line { font-size: 0.72rem; line-height: 1.4; margin-top: 6px; color: rgba(255, 255, 255, 0.85); word-break: break-word; }
.body-info-dim { color: rgba(255, 255, 255, 0.5); }
.breath-yes { color: #7dffa8; }
.breath-no { color: #ff8a8a; }
.breath-marginal { color: #ffd166; }


/* ===== Station store stock ===== */
.stock-sub { font-size: 0.65rem; letter-spacing: 1px; text-transform: uppercase; color: rgba(255, 255, 255, 0.5); margin-top: 8px; }
.body-info-table th.num, .body-info-table td.num { text-align: right; white-space: nowrap; }


/* ===== Emperor option ===== */
.emperor-icon { color: #ffd166; }
.emperor-note { font-size: 0.85rem; color: #ffd166; letter-spacing: 0.05em; }
#auth-badge-text { cursor: pointer; }
#auth-badge-text:hover { text-decoration: underline; }


.emperor-section-title { font-size: 0.7rem; letter-spacing: 1px; text-transform: uppercase; color: rgba(255, 209, 102, 0.8); margin: 14px 0 6px; }
.emperor-status { font-size: 0.72rem; line-height: 1.4; color: rgba(255, 255, 255, 0.7); margin-top: 8px; word-break: break-word; }


/* ===== Shared faction GPS (Personal Core) ===== */
.faction-section { margin-top: 16px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.12); }
.faction-title { font-family: var(--ui-display, sans-serif); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ui-accent, #4fd6ff); margin-bottom: 6px; }
.faction-help { font-size: 0.7rem; color: rgba(255, 255, 255, 0.5); line-height: 1.4; margin-bottom: 8px; }
.faction-tag-input { max-width: 90px; text-transform: uppercase; letter-spacing: 0.1em; }
.faction-share-label { font-size: 0.8rem; color: rgba(255, 255, 255, 0.85); display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.faction-msg { font-size: 0.75rem; margin-top: 8px; min-height: 1em; color: #7dffa8; }
.faction-msg.faction-error { color: #ff8a8a; }
.faction-row { margin-top: 8px; padding: 8px; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 6px; background: rgba(255, 255, 255, 0.03); }
.faction-row-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.faction-row-title { font-size: 0.85rem; color: #fff; word-break: break-word; }
.faction-row-coords { font-size: 0.68rem; color: rgba(255, 255, 255, 0.5); font-family: monospace; }
.faction-row-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.faction-row-actions .faction-share-label { flex: 1; min-width: 110px; }
.faction-desc-input { resize: none; line-height: 1.35; }
.faction-desc-count { font-size: 0.65rem; text-align: right; color: rgba(255, 255, 255, 0.45); margin-top: 2px; }
.faction-desc-count.near-limit { color: #ffcf7a; }
.faction-row-desc { font-size: 0.72rem; color: rgba(255, 255, 255, 0.7); line-height: 1.35; margin-bottom: 6px; word-break: break-word; }
.label .faction-desc { display: block; max-width: 220px; white-space: normal; margin-top: 3px; font-size: 9px; font-weight: 400; letter-spacing: 0.04em; line-height: 1.3; opacity: 0.85; text-shadow: none; }
.faction-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.faction-tab { flex: 1; background: transparent; border: 1px solid rgba(255, 255, 255, 0.2); color: rgba(255, 255, 255, 0.7); font-size: 0.75rem; padding: 4px 6px; border-radius: 4px; cursor: pointer; }
.faction-tab:hover { color: #fff; }
.faction-tab.active { background: rgba(79, 214, 255, 0.15); border-color: var(--ui-accent, #4fd6ff); color: #fff; }
.faction-account-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 0.78rem; color: rgba(255, 255, 255, 0.85); margin-bottom: 8px; word-break: break-word; }
.faction-account-line.hidden { display: none; }
.faction-account-line .btn { white-space: nowrap; flex-shrink: 0; }

/* ===== Sidebar bottom (footer) ===== */
.sidebar-bottom { margin: auto -15px -15px; position: sticky; bottom: -15px; background: rgba(10, 13, 22, 0.92); }
.sidebar-bottom .sidebar-footer { margin: 0; position: static; }

/* Trade arbitrage + faction filter chips */
.arb-list{display:flex;flex-direction:column;gap:8px;max-height:420px;overflow-y:auto}
.arb-card{border:1px solid rgba(255,255,255,.18);border-radius:6px;padding:8px;font-size:.8rem;color:#eaeaea;background:rgba(255,255,255,.05)}
.arb-card strong,.arb-head{color:#fff}
.arb-none{color:#ffd166;font-weight:600}
.arb-sub{margin-top:6px;font-size:.72rem;letter-spacing:.03em;text-transform:uppercase;color:#9fd3ff}
.arb-head{display:flex;justify-content:space-between;gap:8px}
.arb-gain{color:#5fd68a;font-weight:600;white-space:nowrap}
.arb-path{margin:3px 0;color:#e2e2e2}
.arb-meta{color:#b8b8b8}
.faction-filter{display:flex;flex-wrap:wrap;gap:6px;margin:6px 0}
.faction-chip{background:transparent;border:1px solid rgba(255,255,255,.3);color:#ccc;border-radius:12px;padding:1px 10px;font-size:.75rem}
.faction-chip.on{background:rgba(255,255,255,.18);color:#fff}

/* ===== Galaxy Market ===== */
.market-launch-wrap{padding:10px 12px 4px}
.market-launch{display:flex;align-items:center;gap:10px;width:100%;padding:10px 12px;text-align:left;color:#f2f2f2;cursor:pointer;
  background:linear-gradient(135deg,rgba(217,164,65,.18),rgba(217,164,65,.04));border:1px solid rgba(217,164,65,.45);border-radius:8px;transition:background .15s,border-color .15s}
.market-launch:hover,.market-launch.active{background:linear-gradient(135deg,rgba(217,164,65,.3),rgba(217,164,65,.08));border-color:#d9a441}
.market-launch:focus-visible{outline:2px solid #d9a441;outline-offset:2px}
.market-launch-icon{display:grid;place-items:center;width:34px;height:34px;border-radius:8px;background:rgba(217,164,65,.2);color:#e8b955;font-size:1.05rem}
.market-launch-text{display:flex;flex-direction:column;flex:1;line-height:1.2}
.market-launch-text strong{font-size:.9rem;letter-spacing:.02em}
.market-launch-text small{font-size:.7rem;color:rgba(255,255,255,.55)}
.market-launch-badge{min-width:24px;padding:1px 7px;border-radius:10px;background:#d9a441;color:#1a1305;font-size:.72rem;font-weight:700;text-align:center}
.market-launch-go{color:rgba(255,255,255,.45)}

.market-panel{position:fixed;top:0;right:0;bottom:0;width:440px;max-width:100vw;z-index:950;display:flex;flex-direction:column;
  background:rgba(13,14,19,.97);border-left:1px solid rgba(217,164,65,.35);box-shadow:-12px 0 32px rgba(0,0,0,.45);color:#e6e6e6}
.market-panel.hidden{display:none}
body.market-open .body-info-box{right:460px}
.market-header{display:flex;align-items:center;justify-content:space-between;padding:16px 18px;border-bottom:1px solid rgba(255,255,255,.1);
  background:linear-gradient(180deg,rgba(217,164,65,.14),transparent)}
.market-title{display:flex;align-items:center;gap:12px}
.market-title>i{font-size:1.5rem;color:#e8b955}
.market-title h2{margin:0;font-size:1.05rem;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:#fff}
.market-sub{font-size:.72rem;color:rgba(255,255,255,.55)}
.market-close{background:transparent;border:1px solid rgba(255,255,255,.2);color:#ddd;width:32px;height:32px;border-radius:6px;cursor:pointer}
.market-close:hover{background:rgba(255,255,255,.1);color:#fff}
.market-kpis{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;padding:12px 18px 0}
.market-kpi{padding:8px 10px;border:1px solid rgba(255,255,255,.1);border-radius:8px;background:rgba(255,255,255,.04)}
.market-kpi span{display:block;font-size:1.15rem;font-weight:700;color:#fff;font-variant-numeric:tabular-nums}
.market-kpi small{font-size:.65rem;text-transform:uppercase;letter-spacing:.05em;color:rgba(255,255,255,.5)}
.market-filters{padding:12px 18px 10px;border-bottom:1px solid rgba(255,255,255,.1)}
.market-label{display:block;margin:8px 0 3px;font-size:.66rem;text-transform:uppercase;letter-spacing:.07em;color:rgba(255,255,255,.55)}
.market-row{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.market-input{width:100%;padding:6px 8px;font-size:.82rem;color:#f0f0f0;background:#171922;border:1px solid rgba(255,255,255,.18);border-radius:6px}
.market-input:focus{outline:none;border-color:#d9a441;box-shadow:0 0 0 2px rgba(217,164,65,.25)}
.market-actions{display:flex;align-items:center;justify-content:space-between;margin-top:10px}
.market-btns{display:flex;gap:6px}
.market-btn{padding:5px 12px;font-size:.78rem;color:#ddd;background:transparent;border:1px solid rgba(255,255,255,.25);border-radius:6px;cursor:pointer}
.market-btn:hover{background:rgba(255,255,255,.1)}
.market-btn-primary{color:#1a1305;background:#d9a441;border-color:#d9a441;font-weight:600}
.market-btn-primary:hover{background:#e8b955}
.market-scroll{flex:1;overflow-y:auto;padding:12px 18px 18px}
.market-panel .arb-list{max-height:none;overflow:visible}
.market-panel .arb-card{background:rgba(255,255,255,.04)}
.market-panel .arb-card:hover{border-color:rgba(217,164,65,.5)}
@media (max-width:900px){body.market-open .body-info-box{right:20px}}
.market-btn-block{width:100%;margin-top:8px;text-align:center}
.market-panel .arb-head{margin-bottom:2px}
.market-panel .arb-card{padding:10px 12px}
