@font-face {
    font-family: 'PxPlus IBM CGA-2y';
    src: url('PxPlus_IBM_CGA-2y.ttf') format('truetype');
}

:root {
    --bg-dark: #0a0c10;
    --panel-bg: rgba(18, 22, 30, 0.85);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f0f3f8;
    --text-secondary: #90a0b8;
    --accent: #ff8c00;
    --accent-glow: rgba(255, 140, 0, 0.35);
    --accent-secondary: #00e5ff;
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Outfit', sans-serif;
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar Controls */
.control-panel {
    width: 420px;
    background: var(--panel-bg);
    border-right: 1px solid var(--panel-border);
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    z-index: 10;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.3);
}

.app-header {
    padding: 24px;
    border-bottom: 1px solid var(--panel-border);
}

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

.logo .icon {
    font-size: 28px;
    filter: drop-shadow(0 0 10px var(--accent-glow));
}

.logo h1 {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff 30%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.scroll-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.scroll-container::-webkit-scrollbar {
    width: 6px;
}
.scroll-container::-webkit-scrollbar-track {
    background: transparent;
}
.scroll-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.control-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
}

/* Input Fields */
.input-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group.full-width {
    grid-column: span 2;
}

label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
}

input[type="number"], select, input[type="date"] {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 10px 12px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

input[type="number"]:focus, select:focus, input[type="date"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Radio Toggles */
.radio-toggle {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 2px;
}

.toggle-option {
    flex: 1;
    cursor: pointer;
    text-align: center;
}

.toggle-option input {
    display: none;
}

.toggle-option span {
    display: block;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: 4px;
    transition: var(--transition);
}

.toggle-option input:checked + span {
    background: var(--accent);
    color: var(--bg-dark);
}

/* Sliders */
.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.value-display {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    height: 6px;
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-glow);
    transition: var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Badges */
.derived-badges {
    display: flex;
    gap: 12px;
    margin-top: 4px;
}

.badge {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.badge-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-val {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-secondary);
    margin-top: 2px;
}

/* Time Events */
.time-events {
    display: flex;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
}

.event-time {
    display: flex;
    gap: 6px;
}

.event-time span {
    color: var(--text-secondary);
}

.event-time strong {
    color: var(--accent);
}

/* Buttons */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: 8px;
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    outline: none;
    width: 100%;
}

.btn.primary {
    background: linear-gradient(135deg, var(--accent), #ff5500);
    color: var(--bg-dark);
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--accent-glow);
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

/* Main Viewport */
.viewport {
    flex: 1;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    padding: 16px;
    background: #020305;
    position: relative;
}

.canvas-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ---------------------------------------------------- */
/* FULLSCREEN 3:2 FX CAMERA ASPECT RATIO LOCK */
/* ---------------------------------------------------- */
.canvas-container:fullscreen,
.canvas-container:-webkit-full-screen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    background: #000000 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    overflow: hidden !important;
}

.canvas-container:fullscreen #view-canvas,
.canvas-container:-webkit-full-screen #view-canvas {
    aspect-ratio: 3 / 2 !important;
    width: auto !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
}

@media (min-aspect-ratio: 3/2) {
    .canvas-container:fullscreen #view-canvas,
    .canvas-container:-webkit-full-screen #view-canvas {
        height: 100vh !important;
        width: calc(100vh * 1.5) !important;
    }
}

@media (max-aspect-ratio: 3/2) {
    .canvas-container:fullscreen #view-canvas,
    .canvas-container:-webkit-full-screen #view-canvas {
        width: 100vw !important;
        height: calc(100vw / 1.5) !important;
    }
}

.hud-fs-btn:hover {
    background: rgba(56, 189, 248, 0.2) !important;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

.hud-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.hud-item {
    background: rgba(10, 12, 16, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 8px 12px;
    backdrop-filter: blur(8px);
}

.hud-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hud-value {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 2px;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.retro-terminal {
    background: #000000;
    border: 2px solid #33ff33;
    box-shadow: 0 0 20px rgba(51, 255, 51, 0.3);
    border-radius: 8px;
    width: 90%;
    max-width: 950px;
    height: 80%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 20px;
}

.retro-terminal.amber {
    border-color: #ffb000;
    box-shadow: 0 0 20px rgba(255, 176, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(51, 255, 51, 0.3);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.retro-terminal.amber .modal-header {
    border-bottom-color: rgba(255, 176, 0, 0.3);
}

.modal-title {
    font-family: monospace;
    font-size: 18px;
    color: #33ff33;
    font-weight: bold;
}

.retro-terminal.amber .modal-title {
    color: #ffb000;
}

.btn-close {
    background: transparent;
    border: none;
    color: #33ff33;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

.retro-terminal.amber .btn-close {
    color: #ffb000;
}

.modal-body {
    flex: 1;
    overflow: auto;
    background: #020202;
    border: 1px solid rgba(51, 255, 51, 0.2);
    border-radius: 4px;
    padding: 15px;
}

.retro-terminal.amber .modal-body {
    border-color: rgba(255, 176, 0, 0.2);
}

.modal-body pre {
    margin: 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 6px;
    line-height: 0.65;
    letter-spacing: 0.12em;
    color: #33ff33;
    white-space: pre;
}

.retro-terminal.amber .modal-body pre {
    color: #ffb000;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 15px;
    border-top: 1px solid rgba(51, 255, 51, 0.3);
    padding-top: 10px;
}

.retro-terminal.amber .modal-footer {
    border-top-color: rgba(255, 176, 0, 0.3);
}

/* ---------------------------------------------------- */
/* D3X Edge Station Live Integration */
/* ---------------------------------------------------- */
.edge-station-section {
    border: 1px solid rgba(0, 229, 255, 0.2);
    background: linear-gradient(180deg, rgba(14, 22, 34, 0.7) 0%, rgba(10, 14, 22, 0.9) 100%);
    position: relative;
    overflow: hidden;
}

.edge-station-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--accent-secondary);
    box-shadow: 0 0 10px var(--accent-secondary);
}

.station-status-pill {
    font-size: 10px;
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 3px 8px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition);
}

.station-status-pill.online {
    color: #00ff88;
    background: rgba(0, 255, 136, 0.12);
    border: 1px solid rgba(0, 255, 136, 0.3);
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.25);
    animation: statusPulse 2.5s infinite;
}

.station-status-pill.offline {
    color: #8899aa;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; filter: drop-shadow(0 0 3px rgba(0, 255, 136, 0.4)); }
    50% { opacity: 0.7; filter: drop-shadow(0 0 8px rgba(0, 255, 136, 0.7)); }
}

.station-telemetry-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 8px;
}

.telemetry-badge {
    background: rgba(5, 8, 14, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
}

.telemetry-label {
    font-size: 9px;
    color: var(--text-secondary);
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.telemetry-val {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
