@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap');

/* Mars EDL Simulation - Unified Stylesheet */

/* ===========================
   Font Family Utilities
   =========================== */
:root {
    --font-ui: 'Roboto', 'Helvetica Neue', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    --font-data: 'Courier New', Consolas, Monaco, monospace;
}

.font-ui {
    font-family: var(--font-ui);
}

.font-data {
    font-family: var(--font-data);
}

/* ===========================
   Base Styles & Reset
   =========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-ui);
    background: #000;
    color: #fff;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

/* ===========================
   Canvas Container
   =========================== */
#canvas-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    background: radial-gradient(ellipse at center, #0a0a0a 0%, #000000 100%);
}

/* Full-height left-side vignette - sits between 3D canvas and UI */
#canvas-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 45%;
    height: 100%;
    background: linear-gradient(
        to right,
        rgba(0, 0, 0, 0.7) 0%,
        rgba(0, 0, 0, 0.5) 25%,
        rgba(0, 0, 0, 0.25) 50%,
        rgba(0, 0, 0, 0.06) 80%,
        rgba(0, 0, 0, 0) 100%
    );
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.4s ease;
}

#canvas-container.vignette-hidden::after {
    opacity: 0;
}

/* Full-height right-side vignette - mirrors left vignette for right controls */
#canvas-container::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 30%;
    height: 100%;
    background: linear-gradient(
        to left,
        rgba(0, 0, 0, 0.7) 0%,
        rgba(0, 0, 0, 0.5) 25%,
        rgba(0, 0, 0, 0.25) 50%,
        rgba(0, 0, 0, 0.06) 80%,
        rgba(0, 0, 0, 0) 100%
    );
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.4s ease;
}

#canvas-container.vignette-right-hidden::before {
    opacity: 0;
}

/* ===========================
   Loading Screen
   =========================== */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 80px;
    height: 80px;
    border: 3px solid rgba(255, 102, 0, 0.2);
    border-top-color: #ff6600;
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    margin: 0 auto 30px;
}

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

.loading-text {
    font-size: 18px;
    color: #ccc;
    margin-bottom: 10px;
}

.loading-progress {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin: 20px auto;
    overflow: hidden;
}

.loading-bar {
    height: 100%;
    background: linear-gradient(90deg, #ff6600, #ff8800);
    width: 0%;
    transition: width 0.3s;
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* ===========================
   Header
   =========================== */
.header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to bottom, rgba(0,0,0,0.9), transparent);
    z-index: 100;
    pointer-events: none;
}

.header > * {
    pointer-events: auto;
}

.mission-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wpi-logo {
    width: 30px;
    height: 30px;
    /* background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj4KICAgIDxjaXJjbGUgY3g9IjUwIiBjeT0iNTAiIHI9IjQ1IiBmaWxsPSIjZmZmIi8+CiAgICA8dGV4dCB4PSI1MCIgeT0iNjUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIGZvcnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSI0NSIgZm9udC13ZWlnaHQ9ImJvbGQiIGZpbGw9IiMwMDAiPk48L3RleHQ+Cjwvc3ZnPg==') center/contain no-repeat; */
}

.wpi-logo > img {
    width: 30px;
    height: 30px;
}

.mission-title {
    line-height: 1.2;
}

.mission-title strong {
    font-size: 16px;
    font-weight: 600;
    display: block;
    letter-spacing: 1px;
}

.mission-title span {
    font-size: 11px;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.simulation-badge {
    margin-right: 44px;
    padding: 5px 12px;
    background: rgba(255, 102, 0, 0.2);
    border: 1px solid rgba(255, 102, 0, 0.5);
    border-radius: 15px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #ff6600;
    font-weight: 500;
}

/* ===========================
   Phase Info Panel
   =========================== */
#phase-info {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 48px;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0;
    border-radius: 0;
    max-width: 450px;
    max-height: none;
    z-index: 100;
    border: none;
    box-shadow: none;
    font-size: 14px;
    font-family: var(--font-ui);
    font-weight: 300;
    overflow-y: visible;
    color: #FFFFFF;
}

#phase-info h2 {
    font-size: 18px;
    margin-bottom: 8px;
}

#phase-info h3 {
    font-size: 24px;
    margin-bottom: 4px;
}

#phase-info p {
    font-size: 12px;
    line-height: 1.4;
    margin: 8px 0;
}

/* ===========================
   Timeline Container & Controls
   =========================== */
#timeline-container {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    max-width: none;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(50px);
    -webkit-backdrop-filter: blur(50px);
    padding: 12px 24px;
    border-radius: 15px;
    z-index: 100;
    border: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    font-size: 14px;
    font-family: var(--font-ui);
    display: flex;
    align-items: center;
    gap: 16px;
    flex-direction: row;
    overflow: visible;
}

/* Rate drawer - collapses behind timeline, expands upward in playback mode */
.rate-drawer {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    opacity: 0;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(50px);
    -webkit-backdrop-filter: blur(50px);
    padding: 8px 16px;
    border-radius: 12px 12px 0 0;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
    z-index: -1;
}

.rate-drawer.expanded {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.timeline-controls {
    display: contents;
}

.play-button {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    color: #FFFFFF;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    order: 2;
}

.play-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.timeline-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    color: #ccc;
}

.current-time {
    color: #FFFFFF;
    font-weight: 400;
    font-size: 14px;
    order: 1;
    white-space: nowrap;
}

.separator {
    color: #666;
}

.playback-rate {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #FFFFFF;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.rate-buttons {
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.rate-button {
    background: transparent;
    border: none;
    color: #FFFFFF;
    padding: 4px 8px;
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    outline: none;
}

.rate-button:last-child {
    border-right: none;
}

.rate-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.rate-button.active {
    background: rgba(255, 255, 255, 0.3);
    color: #FFFFFF;
    font-weight: 600;
}

.rate-label {
    font-size: 11px;
    color: #FFFFFF;
    font-weight: 400;
}

.timeline-reset-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0;
    order: 3;
    transition: all 0.2s ease;
    min-width: 32px;
}

.timeline-reset-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.timeline-reset-button:not(:disabled):hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #fff;
}

/* Old scrubber styles - DEPRECATED */
.timeline-scrubber {
    display: none; /* Hide old interactive scrubber */
}

/* Timeline progress bar */
.timeline-progress-bar {
    position: relative;
    height: 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    width: clamp(180px, 35vw, 420px);
    margin: 0;
    padding: 0;
    order: 3;
    cursor: pointer;
    pointer-events: auto;
    transition: opacity 0.2s ease;
}

.timeline-progress-bar.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.timeline-progress-bar.scrubbing .timeline-progress {
    transition: none;
}

.timeline-track {
    position: relative;
    height: 100%;
    border-radius: 999px;
    overflow: visible;
}

.timeline-progress {
    position: absolute;
    height: 100%;
    background: linear-gradient(90deg, #ffffff, #ff925a);
    border-radius: 999px;
    width: 0%;
    transition: width 0.1s ease-out;
    pointer-events: none;
}

.timeline-handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid rgba(0, 0, 0, 0.65);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.65);
    pointer-events: none;
    transition: transform 0.1s ease;
}

.timeline-progress-bar:not(.is-disabled) .timeline-handle {
    pointer-events: auto;
}

.timeline-progress-bar.scrubbing .timeline-handle,
.timeline-progress-bar:not(.is-disabled):hover .timeline-handle {
    transform: translate(-50%, -50%) scale(1.1);
}

/* Completion Toast */
.completion-toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.88);
    color: #fff;
    padding: 14px 24px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 200;
    font-size: 13px;
    letter-spacing: 0.4px;
}

.completion-toast button {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    padding: 4px 10px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 12px;
}

.completion-toast button:hover {
    background: rgba(255, 255, 255, 0.25);
}

.timeline-handle:active {
    cursor: grabbing;
    transform: translateY(-50%) scale(1.1);
}

.timeline-markers {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    pointer-events: none;
}

.timeline-marker {
    position: absolute;
    width: 2px;
    height: 14px;
    background: rgba(255, 255, 255, 0.35);
    top: -3px;
}

.timeline-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    transform: translate(-50%, 0);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
}

.timeline-tooltip.visible {
    opacity: 1;
    transform: translate(-50%, -4px);
}

.timeline-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
}

.tooltip-phase {
    display: block;
    color: #f60;
    font-size: 11px;
    margin-top: 2px;
}

/* ===========================
   Control Components
   =========================== */

/* Dynamic Controls - Generic styles for all interactive controls */
.control-container {
    position: static;
    background: rgba(255, 255, 255, 0.03);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    width: 100%;
}

.hidden-control {
    display: none !important;
}

.control-container.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.control-slider-row {
    position: relative;
    display: flex;
    align-items: center;
}

.control-slider {
    flex: 1;
    accent-color: #f60;
    height: 3px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    cursor: pointer;
}

.control-slider:focus {
    outline: none;
}

.control-value {
    position: absolute;
    right: 0;
    top: 0;
    transform: translate(10px, -140%);
    min-width: 32px;
    color: #fff;
    font-family: var(--font-data);
    font-size: 13px;
    padding: 2px 8px;
    border-radius: 4px;
    pointer-events: none;
}

.control-status {
    font-size: 11px;
    color: #ffb347;
    margin: 4px 0 0;
    min-height: 16px;
}

/* Legacy class names for backward compatibility */
.bank-angle-controls {
    position: static;
    background: rgba(255, 255, 255, 0.03);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    width: 100%;
}

.bank-angle-controls.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.bank-slider-row {
    position: relative;
    display: flex;
    align-items: center;
}

.bank-slider-relative {
    position: relative;
}

.bank-slider {
    flex: 1;
    accent-color: #f60;
    height: 3px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    cursor: pointer;
}

.bank-slider:focus {
    outline: none;
}

.bank-angle-value {
    position: absolute;
    right: 0;
    top: 0;
    transform: translate(10px, -140%);
    min-width: 32px;
    color: #fff;
    font-family: var(--font-data);
    font-size: 13px;
    padding: 2px 8px;
    border-radius: 4px;
    pointer-events: none;
}

.bank-angle-status {
    font-size: 11px;
    color: #ffb347;
    margin: 4px 0 0;
    min-height: 16px;
}

/* Camera Controls */
.camera-controls-wrapper {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 0;
    flex-direction: row-reverse;
}

.camera-toggle-icon {
    position: relative;
    right: 0;
    margin-left: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 101;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.camera-toggle-icon:hover {
    background: rgba(255, 102, 0, 0.3);
}

.camera-toggle-icon svg {
    width: 20px;
    height: 20px;
    color: #ddd;
    transition: color 0.3s ease, transform 0.3s ease;
}

.camera-toggle-icon:hover svg {
    color: #fff;
    transform: scale(1.1);
}

.camera-controls {
    position: relative;
    background: none;
    padding: 16px;
    border-radius: 10px;
    backdrop-filter: none;
    border: none;
    width: 230px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
}

.camera-controls.slide-out {
    transform: translateX(100%);
    opacity: 0;
}

.camera-controls.slide-in {
    transform: translateX(0);
    opacity: 1;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group.control-disabled {
    opacity: 0.5;
    pointer-events: none;
}

.control-label {
    font-size: 10px;
    color: #bbb;
    letter-spacing: 1.2px;
    margin: 0;
    text-align: left;
    text-transform: uppercase;
}

.camera-mode {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #eee;
    cursor: pointer;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: all 0.2s;
    width: 100%;
    justify-content: space-between;
}

.camera-mode:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    transform: translateX(-1px);
}

.camera-mode.active {
    background: rgba(255, 102, 0, 0.3);
    border-color: #ff6600;
    color: #fff;
    box-shadow: 0 0 10px rgba(255, 102, 0, 0.4);
}

.zoom-indicator {
    text-align: center;
    font-size: 12px;
    color: #888;
    padding: 5px;
    font-family: var(--font-data);
}

/* Toggle switch for reference trajectory */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 0;
    user-select: none;
}

.toggle-switch input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 40px;
    height: 22px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 11px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transition: all 0.25s ease;
}

.toggle-switch input:checked + .toggle-slider {
    background: rgba(255, 102, 0, 0.4);
    border-color: rgba(255, 102, 0, 0.6);
}

.toggle-switch input:checked + .toggle-slider::after {
    left: 20px;
    background: #f60;
    box-shadow: 0 0 6px rgba(255, 102, 0, 0.5);
}

.toggle-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* Simulation info display (replaces vehicle buttons) */
.sim-info-display {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.sim-info-display .control-label {
    margin-bottom: 8px;
}

.sim-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.sim-info-key {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sim-info-value {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
}

.model-selector-compact {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.model-selector-compact .selector-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.model-selector-compact .model-status {
    font-size: 11px;
    color: #8ecbff;
    font-weight: 500;
    letter-spacing: 0.4px;
    text-align: right;
}

.model-selector-compact .model-status[data-state="loading"] {
    color: #ffb347;
}

.model-selector-compact .model-status[data-state="error"] {
    color: #ff6b6b;
}

.model-selector-compact .model-status[data-state="ready"] {
    color: #8ffe9c;
}

.model-toggle {
    display: flex;
    gap: 8px;
}

.model-chip {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    color: #fff;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.model-chip:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
}

.model-chip.active {
    background: rgba(255, 107, 107, 0.25);
    border-color: rgba(255, 107, 107, 0.8);
    box-shadow: 0 0 8px rgba(255, 107, 107, 0.3);
}

.model-chip .chip-label {
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.model-chip .chip-badge {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
}

.model-chip.active .chip-badge {
    color: rgba(255, 107, 107, 0.9);
}

.model-dropdown select {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    padding: 8px 12px;
    color: #fff;
    font-size: 12px;
    font-family: inherit;
    appearance: none;
    outline: none;
    transition: border-color 0.2s ease;
}

.model-dropdown select:focus {
    border-color: rgba(255, 102, 0, 0.9);
    box-shadow: 0 0 0 2px rgba(255, 102, 0, 0.2);
}

/* Hide any native select arrows globally in control panels */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: none !important;
}

.model-dropdown select option[disabled] {
    color: #777;
}

/* Settings Panel */
.settings-panel {
    position: absolute;
    top: 12px;
    right: 15px;
    z-index: 101;
}

.settings-toggle {
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    backdrop-filter: blur(20px);
}

.settings-toggle:hover,
.settings-toggle.active {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

.settings-content {
    position: absolute;
    top: 50px;
    right: 0;
    background: rgba(0, 0, 0, 0.4);
    padding: 15px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 220px;
    max-height: 350px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s;
    backdrop-filter: blur(25px);
}

.settings-content.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.settings-content h3 {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.setting-item {
    margin: 15px 0;
}

.setting-item label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ccc;
    font-size: 13px;
    cursor: pointer;
}

.setting-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.setting-item select {
    width: 100%;
    padding: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 4px;
    margin-top: 5px;
    cursor: pointer;
}

.setting-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 20px 0;
}

/* Shortcuts Panel */
.shortcuts-panel {
    position: fixed;
    bottom: 15px;
    right: 15px;
    z-index: 101;
}

.shortcuts-toggle {
    width: 30px;
    height: 30px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    border-radius: 50%;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s;
    backdrop-filter: blur(20px);
}

.shortcuts-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.shortcuts-content {
    position: absolute;
    bottom: 40px;
    right: 0;
    background: rgba(0, 0, 0, 0.4);
    padding: 15px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s;
    backdrop-filter: blur(25px);
}

.shortcuts-content.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.shortcuts-content h3 {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: #fff;
}

.shortcuts-content dl {
    margin: 0;
}

.shortcuts-content dt {
    display: inline-block;
    width: 60px;
    font-family: 'Courier New', monospace;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    border-radius: 3px;
    margin-bottom: 8px;
    font-size: 12px;
}

.shortcuts-content dd {
    display: inline;
    margin-left: 10px;
    color: #aaa;
    font-size: 13px;
}

.shortcuts-content dd::after {
    content: '\A';
    white-space: pre;
}

/* Control Notifications */
.control-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    color: #fff;
    padding: 15px 25px;
    border-radius: 5px;
    font-weight: 500;
    z-index: 1000;
}

.notification-success {
    background: #00cc44;
}

.notification-info {
    background: #f60;
}

/* ===========================
   Phase Info Panel Styles
   =========================== */

.phase-info {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.phase-title {
    font-size: 48px;
    font-weight: 200;
    margin-bottom: 24px;
    letter-spacing: -1px;
    line-height: 1;
    text-transform: none;
    color: #FFFFFF;
    border-bottom: none;
    padding-bottom: 0;
    animation: slideIn 0.6s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-30px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.telemetry {
    margin: 0 0 24px 0;
}

.telemetry-item {
    margin: 0;
    font-size: 16px;
    display: block;
    line-height: 1.4;
    padding: 0;
    border-bottom: none;
}

.telemetry-label {
    font-weight: 700;
    color: #FFFFFF;
    text-transform: none;
    letter-spacing: 0;
    font-size: 16px;
    display: inline;
}

.telemetry-value {
    font-family: var(--font-ui);
    font-size: 16px;
    font-weight: 700;
    color: #FFFFFF;
    display: inline;
    margin-right: 8px;
}

.phase-description {
    margin: 24px 0;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.8);
    font-size: 16px;
    max-height: none;
    overflow-y: visible;
    display: block;
    -webkit-line-clamp: none;
    -webkit-box-orient: none;
    text-overflow: none;
    font-style: normal;
    border-left: none;
    padding-left: 0;
    max-width: 420px;
}

.countdown {
    margin: 24px 0;
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
    text-align: left;
}

.countdown-label {
    font-size: 16px;
    color: #FFFFFF;
    text-transform: none;
    letter-spacing: 0;
    display: inline;
    margin-bottom: 0;
    font-weight: 700;
}

.countdown-value {
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-ui);
    color: #FFFFFF;
    display: inline;
    margin-left: 8px;
}

.next-phase {
    margin: 24px 0 0 0;
    font-size: 16px;
    color: #FFFFFF;
    padding: 0;
    background: none;
    border-radius: 0;
}

.next-phase-label {
    margin-bottom: 8px;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 700;
    color: #FFFFFF;
    display: block;
}

.next-phase-info {
    color: #FFFFFF;
    font-size: 16px;
    font-weight: 400;
}

#next-phase-name {
    color: #FFFFFF;
    font-weight: 400;
    text-transform: none;
    display: inline;
}

#next-phase-time {
    font-family: var(--font-ui);
    color: #FFFFFF;
    font-weight: 700;
    display: inline;
    margin-left: 8px;
}

.phase-progress {
    margin: 15px 0 10px;
}

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1px;
    overflow: hidden;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #FF6B35, #FF8F00);
    border-radius: 1px;
    width: var(--progress-width, 0%);
    transition: width 0.5s ease-out;
    box-shadow: 0 0 10px rgba(255, 107, 53, 0.3);
}

.progress-label {
    font-size: 10px;
    color: #B0B0B0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.additional-telemetry {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

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

.telemetry-cell {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 2px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: background-color 0.3s ease;
}

.telemetry-cell:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 107, 53, 0.3);
}

.cell-label {
    font-size: 9px;
    color: #B0B0B0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.cell-value {
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font-data);
    color: #FFFFFF;
}

.cell-value-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cell-arrow-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #FFFFFF;
    min-width: 20px;
    min-height: 20px;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.cell-arrow-btn:hover:not(:disabled) {
    background: rgba(255, 102, 0, 0.3);
    border-color: rgba(255, 102, 0, 0.6);
    transform: scale(1.1);
}

.cell-arrow-btn:active:not(:disabled) {
    transform: scale(0.95);
    background: rgba(255, 102, 0, 0.5);
}

.cell-arrow-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.cell-arrow-btn svg {
    display: block;
}

.scroll-indicator {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    /* display: flex; */
    display: none;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #666;
    animation: bounce 2s infinite;
    cursor: pointer;
}

@keyframes bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(5px); }
}

.scroll-indicator:hover {
    color: #999;
}

.phase-alert {
    position: absolute;
    top: 20px;
    right: 20px;
    color: #fff;
    padding: 15px 25px;
    border-radius: 5px;
    font-weight: bold;
    z-index: 1000;
}

.alert-warning {
    background: #ff6600;
}

.alert-info {
    background: #00ccff;
}

@keyframes alertSlide {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.alert-slide-in {
    animation: alertSlide 0.5s ease-out;
}

.alert-slide-out {
    animation: alertSlide 0.5s ease-out reverse;
}

.hidden {
    display: none !important;
}

.no-animation {
    animation: none !important;
}

.slide-in-animation {
    animation: slideIn 0.6s ease-out;
}

.fade-in-delayed-animation {
    animation: fadeIn 0.6s ease-out 0.2s both;
}

/* ===========================
   Swap Icon & Plots View
   =========================== */

.toggle-icon {
    position: absolute;
    left: -40px;
    top: calc(50% - 50px);
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 101;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.toggle-icon:hover {
    background: rgba(255, 102, 0, 0.3);
}

.toggle-icon svg {
    width: 20px;
    height: 20px;
    color: #ddd;
    transition: color 0.3s ease, transform 0.3s ease;
}

.toggle-icon:hover svg {
    color: #fff;
    transform: scale(1.1);
}

.swap-icon {
    position: absolute;
    left: -40px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 101;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.swap-icon:hover {
    background: rgba(255, 102, 0, 0.3);
}

.swap-icon svg {
    width: 20px;
    height: 20px;
    color: #ddd;
    transition: color 0.3s ease, transform 0.3s ease;
}

.swap-icon:hover svg {
    color: #fff;
    transform: scale(1.1);
}

.content-wrapper {
    position: relative;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
}

.content-wrapper.slide-out {
    transform: translateX(-100%);
    opacity: 0;
}

.content-wrapper.slide-in {
    transform: translateX(0);
    opacity: 1;
}

#phase-info.hidden .content-wrapper {
    pointer-events: none;
}

.plots-view {
    width: 100%;
}

.plots-container {
    margin-top: 20px;
}

.plots-container > div {
    margin-bottom: 24px;
}

/* Style Observable Plot to match theme */
.plots-container svg {
    font-family: 'Roboto', 'Helvetica Neue', 'Arial', sans-serif;
}

.plots-container text {
    fill: #ccc !important;
}

.plots-container line,
.plots-container path[stroke] {
    stroke: rgba(255, 255, 255, 0.1) !important;
}

.plots-container path[stroke="#ff6600"],
.plots-container path[stroke="#00aaff"],
.plots-container path[stroke="#00ff88"] {
    stroke-opacity: 1 !important;
}

.value-normal {
    color: #00ff66 !important;
}

.value-warning {
    color: #ff9933 !important;
}

.value-danger {
    color: #ff3333 !important;
}

.notification-slide-in {
    animation: slideInRight 0.3s ease-out;
}

.notification-slide-out {
    animation: slideOutRight 0.3s ease-out;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Responsive Controls */
@media (max-width: 768px) {
    .camera-controls {
        top: auto;
        bottom: 80px;
        transform: none;
    }
    
    .zoom-controls {
        flex-direction: row;
        bottom: 20px;
    }
    
    .settings-panel {
        top: auto;
        bottom: 20px;
        left: 20px;
        right: auto;
    }
    
    .settings-content {
        left: 0;
        right: auto;
    }
    
    .phase-title {
        font-size: 28px;
    }
    
    .telemetry-value {
        font-size: 14px;
    }
    
    .telemetry-grid {
        grid-template-columns: 1fr;
    }
}

/* ===========================
   UI Overlay
   =========================== */
#ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

#ui-overlay > * {
    pointer-events: auto;
}


/* ===========================
   Zoom Controls
   =========================== */
.zoom-controls {
    position: fixed !important;
    right: 15px !important;
    bottom: 80px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    z-index: 100 !important;
    pointer-events: auto !important;
}

.zoom-btn {
    width: 36px !important;
    height: 36px !important;
    background: rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
    font-size: 20px !important;
    font-weight: bold !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) !important;
    pointer-events: auto !important;
}

.zoom-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    transform: scale(1.05) !important;
}

.zoom-btn:active {
    transform: scale(0.95) !important;
}

.zoom-reset {
    padding: 0 !important;
}

.zoom-reset svg {
    display: block !important;
}

/* ===========================
   Additional UI Scaling
   =========================== */
.ui-panel {
    font-size: 12px;
}

.stats-item {
    font-size: 11px;
    padding: 4px 0;
}

.control-button {
    font-size: 11px;
    padding: 6px 12px;
}

.timeline-label {
    font-size: 10px;
}

/* ===========================
   Responsive Design
   =========================== */
@media (max-width: 768px) {
    .header {
        padding: 8px 15px;
    }
    
    .mission-title strong {
        font-size: 14px;
    }
    
    .mission-title span {
        font-size: 10px;
    }
    
    #phase-info {
        left: 10px;
        right: 10px;
        max-width: none;
        max-height: 350px;
        padding: 10px;
        font-size: 10px;
        overflow-y: auto;
    }
    
    #phase-info h2 {
        font-size: 14px;
    }
    
    #phase-info h3 {
        font-size: 16px;
    }
    
    #timeline-container {
        width: 90%;
        bottom: 10px;
        padding: 10px;
    }
    
    .simulation-badge {
        display: none;
    }
    
    .wpi-logo {
        width: 30px;
        height: 30px;
    }
}

/* ===========================
   Fullscreen Styles
   =========================== */
:fullscreen #canvas-container {
    width: 100vw;
    height: 100vh;
}

/* ===========================
   Performance Mode
   =========================== */
body.performance-mode * {
    will-change: auto !important;
    backface-visibility: hidden;
}

/* ===========================
   No WebGL Fallback
   =========================== */
.no-webgl {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    max-width: 500px;
    padding: 40px;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 10px;
    border: 1px solid #ff6600;
}

.no-webgl h2 {
    color: #ff6600;
    margin-bottom: 20px;
}

.no-webgl p {
    color: #ccc;
    line-height: 1.6;
    margin-bottom: 20px;
}

/* ===========================
   Accessibility
   =========================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus Styles */
button:focus,
a:focus,
input:focus,
select:focus {
    outline: 2px solid #ff6600;
    outline-offset: 2px;
}

/* ===========================
   Print Styles
   =========================== */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .header,
    #timeline-container,
    .camera-controls,
    .zoom-controls,
    .settings-panel {
        display: none !important;
    }
}

.planet-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed !important;
}

/* ===========================
   Acknowledgements
   =========================== */
#acknowledgements {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    font-family: var(--font-ui);
}

.acknowledgement-content {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
}

.acknowledgement-text {
    line-height: 1.4;
    max-width: 600px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    white-space: normal;
    transition: all 0.3s ease;
    cursor: pointer;
}

.acknowledgement-content:hover {
    box-shadow: 0 -4px 12px rgba(255, 255, 255, 0.3);
}

.acknowledgement-content:hover .acknowledgement-text {
    -webkit-line-clamp: unset;
    max-height: 200px;
}

.info-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.5);
    transition: color 0.2s ease;
}

.info-icon:hover,
.info-icon:focus {
    color: rgba(255, 255, 255, 0.9);
    outline: none;
}

.info-icon svg {
    width: 16px;
    height: 16px;
}

.info-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 14px;
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 8px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
}

.info-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(20, 20, 20, 0.95);
}

.info-tooltip p {
    margin: 0;
    line-height: 1.5;
}

.info-icon:hover .info-tooltip,
.info-icon:focus .info-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

/* ===========================
   Marker Tooltip
   =========================== */
.marker-tooltip {
    position: fixed;
    z-index: 200;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 14px 18px;
    min-width: 180px;
    max-width: 260px;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    font-family: var(--font-ui);
    color: #fff;
}

.marker-tooltip.visible {
    opacity: 1;
    transform: scale(1);
}

.marker-tooltip-name {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}

.marker-tooltip-type {
    display: inline-block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-bottom: 8px;
    font-weight: 500;
}

.marker-tooltip-coords {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    font-family: var(--font-data);
    margin-bottom: 6px;
}

.marker-tooltip-desc {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.4;
    margin-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 6px;
}

.marker-tooltip-mission {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 6px;
    line-height: 1.5;
}

.marker-tooltip-mission span {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
}
