/* ========================================
   Artemis Mission Tracker - Styles
   ======================================== */

@font-face {
    font-family: 'Chicago';
    src: url('../assets/ChicagoFLF.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-panel: #151c2c;
    --bg-panel-header: #1a2235;
    --border-color: #1e2d45;
    --text-primary: #e8ecf1;
    --text-secondary: #8896ab;
    --text-muted: #556178;
    --accent-blue: #3b82f6;
    --accent-cyan: #22d3ee;
    --nasa-blue: #0b3d91;
    --status-live: #f59e0b;
    --status-live-glow: rgba(245, 158, 11, 0.3);
    --status-completed: #10b981;
    --status-upcoming: #6b7280;
    --trajectory-past: #60a5fa;
    --trajectory-future: rgba(96, 165, 250, 0.3);
    --danger: #ef4444;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --transition: 0.2s ease;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ========================================
   Header
   ======================================== */

#app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

#app-header h1 {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-primary);
    font-family: var(--font-sans);
}

.header-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.header-btn, .header-select {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    font-family: var(--font-mono);
    transition: background var(--transition), color var(--transition);
}

.header-btn:hover, .header-select:hover {
    background: var(--bg-panel-header);
    color: var(--text-primary);
}

.header-select {
    outline: none;
    max-width: 140px;
}

.header-select option {
    background: var(--bg-panel);
    color: var(--text-primary);
}

/* ========================================
   Mission Tabs
   ======================================== */

#mission-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

#mission-tabs::-webkit-scrollbar {
    display: none;
}

.mission-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
    font-family: var(--font-sans);
}

.mission-tab:hover {
    background: var(--bg-panel);
    color: var(--text-primary);
}

.mission-tab.active {
    background: var(--bg-panel);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.mission-tab .tab-status {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mission-tab .tab-status.completed {
    background: var(--status-completed);
}

.mission-tab .tab-status.inProgress {
    background: var(--status-live);
    animation: pulse-glow 2s ease-in-out infinite;
}

.mission-tab .tab-status.upcoming {
    background: var(--status-upcoming);
}

.tab-live-badge {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--status-live);
    text-transform: uppercase;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 1; box-shadow: 0 0 4px var(--status-live-glow); }
    50% { opacity: 0.5; box-shadow: 0 0 8px var(--status-live-glow); }
}

/* ========================================
   3D Scene
   ======================================== */

#scene-container {
    position: relative;
    width: 100%;
    height: 50vh;
    min-height: 300px;
    max-height: 600px;
    background: #050810;
    border-bottom: 1px solid var(--border-color);
}

#three-canvas-wrapper {
    width: 100%;
    height: 100%;
}

#three-canvas-wrapper canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

#scene-overlay {
    position: absolute;
    top: 16px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

#scene-mission-label {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

#scene-status-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}

#scene-status-badge.completed {
    background: rgba(16, 185, 129, 0.2);
    color: var(--status-completed);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

#scene-status-badge.inProgress {
    background: rgba(245, 158, 11, 0.2);
    color: var(--status-live);
    border: 1px solid rgba(245, 158, 11, 0.3);
    animation: pulse-glow-badge 2s ease-in-out infinite;
}

#scene-status-badge.upcoming {
    background: rgba(107, 114, 128, 0.2);
    color: var(--status-upcoming);
    border: 1px solid rgba(107, 114, 128, 0.3);
}

@keyframes pulse-glow-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

#scene-controls {
    position: absolute;
    bottom: 16px;
    right: 20px;
    display: flex;
    gap: 8px;
}

.scene-btn-group {
    display: flex;
    gap: 3px;
}

.scene-btn {
    background: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    transition: all var(--transition);
}

.scene-btn:hover {
    background: rgba(26, 34, 53, 0.95);
    color: var(--text-primary);
    border-color: var(--accent-blue);
}

/* ========================================
   Panels
   ======================================== */

#panels-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 20px;
    display: grid;
    grid-template-columns: 1fr 380px;
    grid-template-rows: auto;
    gap: 12px;
    align-items: start;
}

#panels-left {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#panels-right {
    position: sticky;
    top: 60px;
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
}

#panels-right .panel {
    display: flex;
    flex-direction: column;
    max-height: 100%;
    overflow: hidden;
}

#panels-right .panel-content {
    overflow-y: auto;
    scrollbar-width: thin;
    flex: 1;
    min-height: 0;
    max-height: none;
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* reserved */

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--bg-panel-header);
    cursor: pointer;
    user-select: none;
    transition: background var(--transition);
}

.panel-header:hover {
    background: #1f293d;
}

.panel-header h2 {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
}

.panel-toggle {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform var(--transition);
}

.panel.collapsed .panel-toggle {
    transform: rotate(-90deg);
}

.panel-content {
    padding: 18px;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.2s ease;
    max-height: 2000px;
    opacity: 1;
}

.panel.collapsed .panel-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    overflow: hidden;
}

/* ========================================
   Telemetry Grid
   ======================================== */

.telemetry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.telemetry-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
}

.telemetry-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.telemetry-value {
    font-size: 22px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
    line-height: 1.2;
}

.telemetry-unit {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 4px;
}

.telemetry-bar {
    margin-top: 8px;
    height: 3px;
    background: var(--bg-primary);
    border-radius: 2px;
    overflow: hidden;
}

.telemetry-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--accent-cyan);
    transition: width 0.5s ease;
}

.telemetry-source {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.telemetry-source-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--status-completed);
    flex-shrink: 0;
}

.telemetry-source-dot.stale {
    background: var(--status-live);
}

.telemetry-source-dot.error {
    background: var(--danger);
}

/* ========================================
   Timeline
   ======================================== */

.timeline-progress {
    margin-bottom: 16px;
}

.timeline-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.timeline-progress-bar {
    height: 4px;
    background: var(--bg-primary);
    border-radius: 2px;
    overflow: hidden;
}

.timeline-progress-fill {
    height: 100%;
    background: var(--accent-blue);
    border-radius: 2px;
    transition: width 0.5s ease;
}

.timeline-list {
    list-style: none;
    position: relative;
    padding-left: 24px;
}

.timeline-list::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding: 8px 0 8px 16px;
}

.timeline-dot {
    position: absolute;
    left: -20px;
    top: 12px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--bg-panel);
    z-index: 1;
}

.timeline-item.completed .timeline-dot {
    background: var(--status-completed);
    border-color: var(--status-completed);
}

.timeline-item.current .timeline-dot {
    background: var(--status-live);
    border-color: var(--status-live);
    box-shadow: 0 0 8px var(--status-live-glow);
}

.timeline-item-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.timeline-item.upcoming .timeline-item-title {
    color: var(--text-secondary);
}

.timeline-item-meta {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.timeline-item-description {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.5;
}

/* Completed milestones group */
.timeline-completed-group {
    margin-bottom: 12px;
}

.timeline-completed-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: var(--text-muted);
    font-size: 12px;
    font-family: var(--font-sans);
    cursor: pointer;
    width: 100%;
    transition: background var(--transition), color var(--transition);
}

.timeline-completed-toggle:hover {
    background: var(--bg-panel-header);
    color: var(--text-secondary);
}

.timeline-completed-icon {
    font-size: 8px;
    transition: transform 0.2s ease;
}

.timeline-completed-list {
    margin-top: 8px;
}

.timeline-completed-list .timeline-item .timeline-item-title {
    color: var(--text-muted);
}

.timeline-completed-list .timeline-item .timeline-item-description {
    color: var(--text-muted);
    opacity: 0.7;
}

/* ========================================
   Crew
   ======================================== */

.crew-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.crew-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
}

.crew-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--bg-panel-header);
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--text-muted);
    overflow: hidden;
    border: 2px solid var(--border-color);
}

.crew-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.crew-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.crew-role {
    font-size: 12px;
    color: var(--accent-cyan);
    margin-bottom: 2px;
}

.crew-agency {
    font-size: 11px;
    color: var(--text-muted);
}

/* ========================================
   Mission Details
   ======================================== */

.details-description {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.details-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.details-stat {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
}

.details-stat-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.details-stat-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.details-objectives {
    margin-top: 16px;
}

.details-objectives h3 {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.details-objectives ul {
    list-style: none;
    padding: 0;
}

.details-objectives li {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 6px 0 6px 20px;
    position: relative;
    line-height: 1.5;
}

.details-objectives li::before {
    content: '\25B8';
    position: absolute;
    left: 0;
    color: var(--accent-blue);
}

/* ========================================
   Stats Bar
   ======================================== */

#stats-bar {
    display: flex;
    gap: 2px;
    padding: 0 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    scrollbar-width: none;
}

#stats-bar:empty {
    display: none;
}

#stats-bar::-webkit-scrollbar {
    display: none;
}

.stat-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    white-space: nowrap;
    font-size: 11px;
    color: var(--text-secondary);
    border-right: 1px solid var(--border-color);
}

.stat-chip:last-child {
    border-right: none;
}

.stat-chip-label {
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-size: 9px;
}

.stat-chip-value {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--text-primary);
    font-size: 12px;
}

.stat-chip-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ========================================
   Time Machine Slider
   ======================================== */

#time-slider-container {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 20px;
}

#time-slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.time-btn {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 36px;
    height: 28px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    flex-shrink: 0;
}

.time-btn:hover {
    background: var(--bg-panel-header);
    color: var(--text-primary);
}

.time-btn.time-live {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    width: auto;
    padding: 0 10px;
    color: var(--status-live);
    border-color: rgba(245, 158, 11, 0.3);
}

.time-btn.time-live.active {
    background: rgba(245, 158, 11, 0.15);
    border-color: var(--status-live);
}

.time-btn.time-live:hover {
    background: rgba(245, 158, 11, 0.2);
}

#time-slider-wrapper {
    flex: 1;
    min-width: 0;
}

#time-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: var(--bg-primary);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

#time-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-blue);
    border: 2px solid var(--text-primary);
    cursor: pointer;
    transition: transform 0.1s ease;
}

#time-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

#time-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-blue);
    border: 2px solid var(--text-primary);
    cursor: pointer;
}

#time-slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

#time-slider-current {
    color: var(--text-primary);
    font-weight: 600;
}

/* ========================================
   Video Panel
   ======================================== */

.video-embed-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: var(--radius-md);
}

.video-embed-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: var(--radius-md);
}

.video-links {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.video-link {
    font-size: 11px;
    color: var(--accent-cyan);
    text-decoration: none;
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.video-link:hover {
    background: var(--bg-panel-header);
    border-color: var(--accent-cyan);
}

/* ========================================
   Space Weather Panel
   ======================================== */

.weather-summary {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    padding: 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.weather-risk-indicator {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.weather-risk-info h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 2px;
}

.weather-risk-info p {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.weather-events {
    list-style: none;
}

.weather-event {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
}

.weather-event:last-child {
    border-bottom: none;
}

.weather-event-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    flex-shrink: 0;
}

/* ========================================
   DSN Panel
   ======================================== */

.dsn-stations {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.dsn-station {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    text-align: center;
}

.dsn-station-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.dsn-station-location {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.dsn-station-status {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    display: inline-block;
}

.dsn-station-status.active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--status-completed);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.dsn-station-status.standby {
    background: rgba(107, 114, 128, 0.15);
    color: var(--status-upcoming);
    border: 1px solid rgba(107, 114, 128, 0.3);
}

.dsn-link {
    display: block;
    margin-top: 12px;
    text-align: center;
    font-size: 11px;
    color: var(--accent-cyan);
    text-decoration: none;
}

.dsn-link:hover {
    text-decoration: underline;
}

/* ========================================
   No Trajectory Message
   ======================================== */

.no-trajectory {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-muted);
    gap: 8px;
}

.no-trajectory-icon {
    font-size: 48px;
    opacity: 0.3;
}

.no-trajectory-text {
    font-size: 14px;
    max-width: 300px;
    line-height: 1.5;
}

/* ========================================
   Footer
   ======================================== */

#app-footer {
    padding: 16px 20px;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

#footer-sources {
    margin-bottom: 6px;
}

#footer-sources a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
}

#footer-sources a:hover {
    color: var(--accent-cyan);
    text-decoration: underline;
}

#footer-credit {
    margin-top: 4px;
}

#footer-credit a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
}

#footer-credit a:hover {
    color: var(--text-primary);
}

.chicago-font {
    font-family: 'Chicago', 'Geneva', sans-serif;
    letter-spacing: 0.5px;
}

/* Crew card with images */
.crew-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.crew-card a {
    color: var(--accent-cyan);
    text-decoration: none;
    font-size: 10px;
    display: inline-block;
    margin-top: 6px;
}

.crew-card a:hover {
    text-decoration: underline;
}

/* Spacecraft panel */
.spacecraft-specs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.spacecraft-spec {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px;
}

.spacecraft-spec-label {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 3px;
}

.spacecraft-spec-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.spacecraft-3d {
    margin-top: 12px;
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
}

.spacecraft-3d iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ========================================
   Glossary Modal
   ======================================== */

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal[hidden] {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 540px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

#glossary-search {
    margin: 12px 20px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-sans);
    outline: none;
}

#glossary-search:focus {
    border-color: var(--accent-blue);
}

#glossary-list {
    overflow-y: auto;
    padding: 0 20px 20px;
    flex: 1;
}

.glossary-entry {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.glossary-entry:last-child {
    border-bottom: none;
}

.glossary-term {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-cyan);
    font-family: var(--font-mono);
    margin-bottom: 4px;
}

.glossary-abbr {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: 8px;
    font-weight: 400;
}

.glossary-def {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ========================================
   Tooltip
   ======================================== */

.tooltip {
    position: fixed;
    z-index: 2000;
    background: var(--bg-panel-header);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    max-width: 280px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.tooltip[hidden] {
    display: none;
}

.tooltip-term {
    font-weight: 700;
    color: var(--accent-cyan);
    font-family: var(--font-mono);
    display: block;
    margin-bottom: 4px;
}

/* Inline glossary terms */
.glossary-link {
    color: var(--accent-cyan);
    text-decoration: none;
    border-bottom: 1px dotted var(--accent-cyan);
    cursor: help;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 768px) {
    #app-header {
        padding: 10px 14px;
    }

    #app-header h1 {
        font-size: 12px;
        letter-spacing: 1.5px;
    }

    #mission-tabs {
        padding: 6px 14px;
    }

    .mission-tab {
        padding: 6px 12px;
        font-size: 12px;
    }

    #scene-container {
        height: 40vh;
        min-height: 250px;
    }

    #scene-controls {
        bottom: 10px;
        right: 10px;
    }

    .scene-btn {
        padding: 5px 8px;
        font-size: 10px;
    }

    #panels-container {
        padding: 12px 14px;
        gap: 10px;
        grid-template-columns: 1fr;
    }

    #panels-right {
        position: static;
        max-height: none;
        overflow-y: visible;
    }

    .panel-content {
        padding: 14px;
    }

    .telemetry-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .telemetry-value {
        font-size: 18px;
    }

    .crew-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .details-stats {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .telemetry-grid {
        grid-template-columns: 1fr 1fr;
    }

    .crew-grid {
        grid-template-columns: 1fr;
    }

    .details-stats {
        grid-template-columns: 1fr;
    }

    #scene-mission-label {
        font-size: 14px;
    }
}

/* ========================================
   Scrollbar
   ======================================== */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ========================================
   Loading / Empty States
   ======================================== */

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.empty-state {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
    font-size: 13px;
}
