:root {
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'SFMono-Regular', Menlo, Consolas, monospace;

    --bg-0: #070d19;
    --bg-1: #0f172a;
    --bg-2: #111f3b;
    --panel: #0b1428cc;
    --panel-strong: #0d1a30f0;
    --line: #28435f;
    --text: #dbeafe;
    --text-dim: #9db5cc;

    --ok: #22c55e;
    --warn: #f59e0b;
    --bad: #ef4444;
    --info: #38bdf8;
    --accent: #2dd4bf;
    --accent-strong: #14b8a6;

    --shadow: 0 10px 28px rgba(2, 6, 23, 0.48);
    --radius: 12px;
    --radius-sm: 8px;

    --z-map: 1;
    --z-panels: 20;
    --z-overlay: 120;
    --z-toast: 240;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-ui);
    color: var(--text);
    background:
        radial-gradient(1200px 560px at 15% -10%, rgba(56, 189, 248, 0.16), transparent 70%),
        radial-gradient(900px 420px at 110% 120%, rgba(20, 184, 166, 0.12), transparent 72%),
        linear-gradient(180deg, var(--bg-2) 0%, var(--bg-0) 100%);
}

.hidden {
    display: none !important;
}

.app-shell {
    position: relative;
    --fx-speed: 1;
    --fx-opacity: 1;
    --fx-glow: 1;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 320px 1fr 360px;
    grid-template-rows: 46px 1fr 84px;
    grid-template-areas:
        'status status status'
        'sidebar map intel'
        'timeline timeline timeline';
    gap: 10px;
    padding: 10px;
}

.app-shell[data-fx='low'] {
    --fx-speed: 1.7;
    --fx-opacity: 0.45;
    --fx-glow: 0.72;
}

.app-shell[data-fx='medium'] {
    --fx-speed: 1;
    --fx-opacity: 1;
    --fx-glow: 1;
}

.app-shell[data-fx='max'] {
    --fx-speed: 0.68;
    --fx-opacity: 1.3;
    --fx-glow: 1.22;
}

.app-shell::before,
.app-shell::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.app-shell::before {
    background:
        repeating-linear-gradient(
            180deg,
            rgba(148, 163, 184, 0.08) 0px,
            rgba(148, 163, 184, 0.08) 1px,
            transparent 1px,
            transparent 3px
        ),
        linear-gradient(90deg, rgba(56, 189, 248, 0.05), rgba(16, 185, 129, 0.03), rgba(56, 189, 248, 0.05));
    mix-blend-mode: screen;
    opacity: calc(0.34 * var(--fx-opacity));
    z-index: 480;
    animation: crt-roll calc(10s * var(--fx-speed)) linear infinite;
}

.app-shell::after {
    background:
        radial-gradient(130% 120% at 50% 50%, transparent 52%, rgba(2, 6, 23, 0.58) 100%),
        radial-gradient(100% 100% at 50% -10%, rgba(56, 189, 248, 0.14), transparent 60%);
    box-shadow:
        inset 0 0 160px rgba(2, 6, 23, 0.5),
        inset 0 0 0 1px rgba(56, 189, 248, 0.12);
    opacity: calc(0.46 * var(--fx-opacity));
    z-index: 481;
    animation: crt-flicker calc(6.2s * var(--fx-speed)) linear infinite;
}

@keyframes crt-roll {
    0% { background-position: 0 0, 0 0; }
    100% { background-position: 0 120px, 18px 0; }
}

@keyframes crt-flicker {
    0%, 18%, 55%, 100% { opacity: 0.42; }
    6% { opacity: 0.5; }
    36% { opacity: 0.36; }
    66% { opacity: 0.48; }
    84% { opacity: 0.38; }
}

.panel {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background: linear-gradient(180deg, rgba(12, 24, 44, 0.94), rgba(9, 17, 32, 0.94));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(2px);
}

.panel::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
        linear-gradient(130deg, rgba(56, 189, 248, 0.08) 0%, transparent 32%),
        linear-gradient(320deg, rgba(45, 212, 191, 0.06) 0%, transparent 45%);
    opacity: calc(0.6 * var(--fx-opacity));
    animation: panel-shimmer calc(9s * var(--fx-speed)) linear infinite;
    pointer-events: none;
}

@keyframes panel-shimmer {
    0% { transform: translateX(-18%); }
    100% { transform: translateX(18%); }
}

.status-bar {
    grid-area: status;
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 14px;
    overflow: hidden;
}

.status-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 0%, rgba(56, 189, 248, 0.08) 40%, transparent 70%);
    animation: status-sweep calc(7s * var(--fx-speed)) linear infinite;
    pointer-events: none;
}

@keyframes status-sweep {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(120%); }
}

.app-shell.threat-amber .status-bar {
    border-color: #945f20;
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.35), var(--shadow);
}

.app-shell.threat-red .status-bar {
    border-color: #7f1d1d;
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.45), 0 0 24px rgba(127, 29, 29, 0.5);
}

.app-shell.threat-red .status-bar::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        120deg,
        rgba(254, 226, 226, 0.06) 0px,
        rgba(254, 226, 226, 0.06) 8px,
        transparent 8px,
        transparent 16px
    );
    animation: alert-stripe calc(1.9s * var(--fx-speed)) linear infinite;
}

.app-shell.threat-amber .status-led[data-status='amber'],
.app-shell.threat-red .status-led[data-status='red'] {
    animation: led-alert calc(1.1s * var(--fx-speed)) ease-in-out infinite;
}

.app-shell.threat-red .status-title {
    color: #fee2e2;
    text-shadow: 0 0 10px rgba(248, 113, 113, 0.65);
}

.app-shell.threat-amber #instrument-panel,
.app-shell.threat-amber .timeline-bar {
    border-color: #7c4b15;
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.28), var(--shadow);
}

.app-shell.threat-red #instrument-panel,
.app-shell.threat-red .timeline-bar {
    border-color: #7f1d1d;
    box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.34), 0 0 24px rgba(127, 29, 29, 0.45);
    animation: threat-breath calc(1.8s * var(--fx-speed)) ease-in-out infinite;
}

.app-shell[data-fx='low']::before,
.app-shell[data-fx='low']::after {
    opacity: 0.14;
}

.app-shell[data-fx='low'] .status-bar::after {
    opacity: 0.45;
}

.app-shell[data-fx='max']::before,
.app-shell[data-fx='max']::after {
    opacity: 0.58;
}

@keyframes led-alert {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.24); filter: brightness(1.28); }
}

@keyframes alert-stripe {
    0% { transform: translateX(-12%); }
    100% { transform: translateX(12%); }
}

@keyframes threat-breath {
    0%, 100% { filter: saturate(1); }
    50% { filter: saturate(1.22); }
}

.status-left,
.status-right {
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1;
}

.status-right {
    justify-self: end;
}

.status-center {
    text-align: center;
    z-index: 1;
}

.status-title {
    font-family: var(--font-mono);
    letter-spacing: 0.14em;
    font-size: 12px;
    font-weight: 600;
    color: #dff6ff;
}

.status-label {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: 0.08em;
}

.status-led {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #64748b;
    box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.3);
}

.status-led[data-status='green'] {
    background: var(--ok);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.8);
}

.status-led[data-status='amber'] {
    background: var(--warn);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.74);
}

.status-led[data-status='red'] {
    background: var(--bad);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.72);
}

.status-gps,
.status-clock {
    font-family: var(--font-mono);
    font-size: 12px;
}

.status-gps[data-status='green'] { color: var(--ok); }
.status-gps[data-status='amber'] { color: var(--warn); }

.command-sidebar {
    grid-area: sidebar;
    position: relative;
    padding: 12px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.sidebar-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.sidebar-tab {
    flex: 1;
    position: relative;
    overflow: hidden;
    height: 34px;
    border: 1px solid #2b475f;
    border-radius: 8px;
    background: #0a2038;
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 12px;
    cursor: pointer;
}

.sidebar-tab::after {
    content: '';
    position: absolute;
    inset: -45% -25%;
    background: linear-gradient(105deg, transparent 40%, rgba(56, 189, 248, 0.24) 52%, transparent 64%);
    transform: translateX(-130%) skewX(-18deg);
    transition: transform calc(480ms * var(--fx-speed)) ease;
    pointer-events: none;
}

.sidebar-tab:hover::after,
.sidebar-tab.active::after {
    transform: translateX(130%) skewX(-18deg);
}

.sidebar-tab.active {
    color: #dff6ff;
    border-color: #2dd4bf;
    box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.4);
}

.sidebar-panel {
    overflow-y: auto;
    min-height: 0;
    padding-right: 4px;
}

.panel-section {
    margin-bottom: 14px;
}

.panel-label {
    display: block;
    position: relative;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    margin-bottom: 8px;
    text-shadow: 0 0 8px rgba(56, 189, 248, 0.24);
}

.panel-label::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(45, 212, 191, 0.6) 50%, transparent 100%);
    transform: scaleX(0.35);
    transform-origin: center;
    animation: label-sweep calc(4.4s * var(--fx-speed)) ease-in-out infinite;
}

@keyframes label-sweep {
    0%, 100% { opacity: 0.35; transform: scaleX(0.3); }
    50% { opacity: 0.8; transform: scaleX(1); }
}

.search-wrapper {
    display: grid;
    grid-template-columns: 1fr 38px 38px;
    gap: 6px;
}

.tactical-input,
.search-input,
.terminal-field {
    width: 100%;
    border: 1px solid #2b475f;
    border-radius: 9px;
    background: #08192f;
    color: #dbeafe;
    height: 38px;
    padding: 0 11px;
    font-family: var(--font-ui);
    font-size: 14px;
    outline: none;
}

.tactical-input:focus,
.search-input:focus,
.terminal-field:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.18);
}

.search-dropdown,
.search-results {
    margin-top: 6px;
    border: 1px solid #2b475f;
    border-radius: 9px;
    max-height: 240px;
    overflow-y: auto;
    background: #08192f;
    display: none;
}

.search-dropdown.visible,
.search-results.visible {
    display: block;
}

.search-result-item {
    border-bottom: 1px solid #1d3248;
    padding: 9px 10px;
    cursor: pointer;
}

.search-result-item:last-child {
    border-bottom: 0;
}

.search-result-item:hover {
    background: rgba(45, 212, 191, 0.08);
}

.search-result-name {
    font-size: 13px;
    color: #e2e8f0;
}

.search-result-address {
    font-size: 12px;
    color: #8aa6bf;
}

.tactical-btn,
.tactical-btn-icon,
.search-btn,
.search-clear,
.play-btn,
.route-summary-clear,
.legend-toggle,
.detail-close {
    border: 1px solid #2b475f;
    background: linear-gradient(180deg, #0a2038, #0a1628);
    color: #dbeafe;
    border-radius: 10px;
    cursor: pointer;
}

.tactical-btn {
    width: 100%;
    position: relative;
    overflow: hidden;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.tactical-btn::after {
    content: '';
    position: absolute;
    inset: -38% -20%;
    background: linear-gradient(115deg, transparent 42%, rgba(45, 212, 191, 0.3) 52%, transparent 62%);
    transform: translateX(-140%) skewX(-18deg);
    transition: transform calc(520ms * var(--fx-speed)) ease;
    pointer-events: none;
}

.tactical-btn:hover::after {
    transform: translateX(140%) skewX(-18deg);
}

.tactical-btn.accent {
    border-color: #1ea69a;
    background: linear-gradient(180deg, rgba(20, 184, 166, 0.25), rgba(7, 33, 49, 0.88));
}

#gps-btn.active {
    border-color: #22c55e;
    box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.45);
}

.tactical-btn-icon,
.search-btn,
.search-clear,
.play-btn,
.legend-toggle,
.detail-close {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tactical-btn:hover,
.tactical-btn-icon:hover,
.search-btn:hover,
.search-clear:hover,
.play-btn:hover,
.route-summary-clear:hover,
.legend-toggle:hover,
.detail-close:hover {
    border-color: #2dd4bf;
    color: #ecfeff;
}

.tactical-btn.loading,
#gps-btn.loading,
#route-plan-btn.loading {
    animation: pulse calc(1s * var(--fx-speed)) ease-in-out infinite;
}

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

.quick-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.stat-block {
    border: 1px solid #26425c;
    border-radius: 9px;
    background: #08192f;
    padding: 8px;
}

.stat-block .stat-value {
    display: block;
    font-family: var(--font-mono);
    font-size: 18px;
    color: #ecfeff;
}

.stat-block .stat-label {
    display: block;
    margin-top: 4px;
    font-size: 10px;
    letter-spacing: 0.08em;
    color: #8aa6bf;
}

.action-stack {
    display: grid;
    gap: 8px;
}

.fx-panel {
    margin-top: 4px;
}

.fx-toggle {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.fx-level-btn {
    border: 1px solid #2b475f;
    border-radius: 8px;
    height: 34px;
    background: linear-gradient(180deg, #081f36, #091629);
    color: #9db5cc;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: border-color calc(220ms * var(--fx-speed)) ease, box-shadow calc(220ms * var(--fx-speed)) ease, color calc(220ms * var(--fx-speed)) ease;
}

.fx-level-btn:hover {
    border-color: #38bdf8;
    color: #e2f3ff;
}

.fx-level-btn.active {
    color: #cffafe;
    border-color: #2dd4bf;
    box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.42), 0 0 14px rgba(45, 212, 191, 0.2);
}

.fx-level-btn[data-fx-level='low'].active {
    border-color: #22c55e;
    box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.4), 0 0 12px rgba(34, 197, 94, 0.2);
}

.fx-level-btn[data-fx-level='max'].active {
    border-color: #38bdf8;
    box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.45), 0 0 14px rgba(56, 189, 248, 0.28);
}

.terminal-input {
    margin-top: auto;
    display: grid;
    grid-template-columns: 20px 1fr;
    align-items: center;
    gap: 8px;
    border-top: 1px solid #1f354b;
    padding-top: 12px;
}

.terminal-prompt {
    font-family: var(--font-mono);
    color: var(--accent);
}

.waypoint-list {
    display: grid;
    gap: 6px;
}

.waypoint-row {
    border: 1px solid #2b475f;
    border-radius: 8px;
    background: #08192f;
    color: #e2e8f0;
    padding: 7px 8px;
    text-align: left;
    cursor: pointer;
}

.waypoint-id {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent);
}

.waypoint-name {
    display: block;
    margin-top: 2px;
    font-size: 13px;
}

.waypoint-meta {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: #8aa6bf;
}

.waypoint-empty {
    padding: 8px;
    border: 1px dashed #365975;
    border-radius: 8px;
    color: #8aa6bf;
    font-size: 12px;
}

.map-viewport {
    grid-area: map;
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: #1f2937;
    z-index: var(--z-map);
}

.map-viewport::before,
.map-viewport::after {
    content: '';
    position: absolute;
    pointer-events: none;
}

.map-viewport::before {
    inset: -34% -40%;
    background: conic-gradient(
        from 0deg at 50% 50%,
        transparent 0deg,
        transparent 286deg,
        rgba(34, 211, 238, 0.2) 324deg,
        transparent 360deg
    );
    mix-blend-mode: screen;
    opacity: calc(0.82 * var(--fx-opacity));
    animation: map-reticle-spin calc(11s * var(--fx-speed)) linear infinite;
    z-index: 550;
}

.map-viewport::after {
    inset: 0;
    background:
        repeating-linear-gradient(180deg, rgba(56, 189, 248, 0.06) 0px, rgba(56, 189, 248, 0.06) 1px, transparent 1px, transparent 5px),
        linear-gradient(180deg, transparent 0%, rgba(45, 212, 191, 0.14) 46%, rgba(45, 212, 191, 0.22) 50%, rgba(45, 212, 191, 0.14) 54%, transparent 100%);
    background-size: 100% 6px, 100% 210%;
    animation: map-scanline calc(7.5s * var(--fx-speed)) linear infinite;
    opacity: calc(0.56 * var(--fx-opacity));
    z-index: 551;
}

.app-shell[data-fx='low'] .map-viewport::before {
    opacity: 0.2;
}

.app-shell[data-fx='low'] .map-viewport::after {
    opacity: 0.24;
}

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

@keyframes map-scanline {
    0% { background-position: 0 0, 0 -220%; }
    100% { background-position: 0 0, 0 220%; }
}

.leaflet-container {
    width: 100%;
    height: 100%;
    background: #111827;
    font-family: var(--font-ui);
}

.leaflet-control-attribution {
    font-size: 10px;
    color: #9db5cc;
    background: rgba(5, 10, 20, 0.7) !important;
}

.constellation-tooltip {
    border: 1px solid rgba(251, 191, 36, 0.65);
    border-radius: 6px;
    background: rgba(9, 17, 32, 0.9);
    color: #fde68a;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.04em;
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.2);
}

.constellation-tooltip::before {
    border-top-color: rgba(251, 191, 36, 0.65) !important;
}

.intel-panel {
    grid-area: intel;
    position: relative;
    padding: 12px;
    min-height: 0;
    overflow-y: auto;
}

.route-summary-panel {
    border: 1px solid #2b475f;
    border-radius: 10px;
    background: #08192f;
    padding: 10px;
}

.route-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.route-summary-title {
    margin: 0;
    font-size: 13px;
    font-family: var(--font-mono);
    letter-spacing: 0.06em;
}

.route-summary-clear {
    padding: 6px 9px;
    font-size: 11px;
    font-family: var(--font-mono);
}

.route-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.route-summary-item {
    border: 1px solid #234059;
    border-radius: 8px;
    background: #07182d;
    padding: 7px 8px;
}

.route-summary-label {
    display: block;
    font-size: 10px;
    letter-spacing: 0.08em;
    color: #89a7c2;
    margin-bottom: 4px;
}

.route-summary-value {
    display: block;
    font-family: var(--font-mono);
    color: #ecfeff;
    font-size: 15px;
}

.route-summary-toggle {
    margin-top: 9px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #9db5cc;
}

.route-summary-toggle input {
    accent-color: var(--accent);
}

.mission-brief,
.data-quality {
    border: 1px solid #24405a;
    border-radius: 8px;
    background: #08192f;
    padding: 9px;
    font-size: 12px;
    color: #c9ddf0;
    display: grid;
    gap: 4px;
}

.sky-plot-container {
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #24405a;
    border-radius: 10px;
    background: radial-gradient(circle at 50% 40%, rgba(34, 197, 94, 0.1), rgba(2, 6, 23, 0.7));
    padding: 8px;
}

.sky-plot-container::before,
.sky-plot-container::after {
    content: '';
    position: absolute;
    pointer-events: none;
}

.sky-plot-container::before {
    inset: 8px;
    border-radius: 50%;
    border: 1px dashed rgba(34, 211, 238, 0.5);
    animation: orbit-drift calc(9s * var(--fx-speed)) linear infinite;
}

.sky-plot-container::after {
    inset: 0;
    background: linear-gradient(105deg, transparent 35%, rgba(56, 189, 248, 0.15) 50%, transparent 65%);
    transform: translateX(-120%);
    opacity: calc(0.9 * var(--fx-opacity));
    animation: scope-sweep calc(6s * var(--fx-speed)) linear infinite;
}

@keyframes orbit-drift {
    to { transform: rotate(360deg); }
}

@keyframes scope-sweep {
    to { transform: translateX(120%); }
}

.sky-plot {
    max-width: 100%;
}

.satellite-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid #24405a;
    border-radius: 8px;
    background: #08192f;
    max-height: 200px;
    overflow-y: auto;
}

.satellite-item,
.satellite-empty {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 8px;
    border-bottom: 1px solid #1b3148;
    font-size: 12px;
}

.satellite-item:last-child {
    border-bottom: 0;
}

.satellite-name {
    color: #e2e8f0;
}

.satellite-info {
    color: #90abc4;
    font-family: var(--font-mono);
    font-size: 11px;
}

.analysis-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.instrument-panel {
    position: relative;
    overflow: hidden;
    border: 1px solid #24405a;
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(8, 25, 47, 0.95), rgba(3, 12, 24, 0.96));
    padding: 10px;
}

.instrument-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(120deg, transparent 38%, rgba(56, 189, 248, 0.16) 50%, transparent 62%);
    transform: translateX(-125%);
    opacity: calc(0.95 * var(--fx-opacity));
    animation: instrument-sweep calc(8.5s * var(--fx-speed)) linear infinite;
    z-index: 0;
}

@keyframes instrument-sweep {
    to { transform: translateX(125%); }
}

.instrument-gauges {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
}

.hud-gauge {
    --fill-angle: 0deg;
    --needle-angle: -130deg;
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    border: 1px solid #2d536f;
    background:
        radial-gradient(circle at center, rgba(6, 20, 34, 0.94) 0 36%, transparent 37%),
        radial-gradient(circle at center, transparent 50%, rgba(56, 189, 248, 0.18) 70%, transparent 74%),
        conic-gradient(
            from -130deg,
            rgba(45, 212, 191, 0.92) 0deg,
            rgba(45, 212, 191, 0.92) var(--fill-angle),
            rgba(25, 54, 76, 0.9) var(--fill-angle),
            rgba(25, 54, 76, 0.9) 260deg,
            rgba(9, 24, 40, 0.7) 260deg,
            rgba(9, 24, 40, 0.7) 360deg
        );
    box-shadow:
        inset 0 0 0 1px rgba(56, 189, 248, 0.18),
        0 0 18px rgba(8, 145, 178, 0.22);
}

.hud-gauge::before {
    content: '';
    position: absolute;
    inset: 8%;
    border-radius: 50%;
    border: 1px dashed rgba(34, 211, 238, 0.35);
    animation: gauge-rotor calc(7.8s * var(--fx-speed)) linear infinite;
}

@keyframes gauge-rotor {
    to { transform: rotate(360deg); }
}

.hud-gauge-needle {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 2px;
    height: 37%;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(186, 230, 253, 0.98), rgba(34, 211, 238, 0.62));
    transform-origin: 50% 88%;
    transform: translate(-50%, -88%) rotate(var(--needle-angle));
    transition: transform 420ms cubic-bezier(0.25, 1, 0.5, 1);
    box-shadow: 0 0 9px rgba(34, 211, 238, 0.62);
}

.hud-gauge-needle::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cffafe;
    transform: translateX(-50%);
}

.hud-gauge-value,
.hud-gauge-name {
    position: absolute;
    left: 0;
    right: 0;
    text-align: center;
    font-family: var(--font-mono);
    pointer-events: none;
}

.hud-gauge-value {
    top: 54%;
    transform: translateY(-50%);
    font-size: 12px;
    color: #ccfbf1;
    text-shadow: 0 0 8px rgba(34, 211, 238, 0.35);
}

.hud-gauge-name {
    top: 74%;
    font-size: 9px;
    letter-spacing: 0.08em;
    color: #86a9c5;
}

.gizmo-strip {
    position: relative;
    z-index: 1;
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.gizmo-dial {
    --dial-angle: -120deg;
    position: relative;
    min-height: 80px;
    border: 1px solid #2b475f;
    border-radius: 9px;
    background:
        radial-gradient(circle at 50% 42%, rgba(15, 118, 110, 0.2), rgba(4, 11, 21, 0.92)),
        linear-gradient(180deg, rgba(8, 25, 47, 0.95), rgba(3, 12, 22, 0.95));
    overflow: hidden;
}

.gizmo-dial::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 48%;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid rgba(45, 212, 191, 0.42);
    transform: translate(-50%, -50%);
    box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.2);
}

.gizmo-dial::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 48%;
    width: 2px;
    height: 18px;
    border-radius: 999px;
    background: #67e8f9;
    transform-origin: 50% 90%;
    transform: translate(-50%, -86%) rotate(var(--dial-angle));
    transition: transform 360ms ease;
    box-shadow: 0 0 8px rgba(34, 211, 238, 0.62);
}

.gizmo-ring {
    position: absolute;
    left: 50%;
    top: 48%;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 1px dashed rgba(56, 189, 248, 0.33);
    transform: translate(-50%, -50%);
    animation: gizmo-spin calc(9s * var(--fx-speed)) linear infinite;
}

.gizmo-dial:nth-child(2) .gizmo-ring {
    animation-duration: calc(6.4s * var(--fx-speed));
    animation-direction: reverse;
}

.gizmo-dial:nth-child(3) .gizmo-ring {
    animation-duration: calc(7.2s * var(--fx-speed));
}

.app-shell[data-fx='low'] .sky-plot-container::after,
.app-shell[data-fx='low'] .instrument-panel::after {
    opacity: 0.3;
}

.app-shell[data-fx='max'] .hud-gauge,
.app-shell[data-fx='max'] .gizmo-dial {
    filter: drop-shadow(0 0 calc(10px * var(--fx-glow)) rgba(14, 165, 233, 0.26));
}

@keyframes gizmo-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.gizmo-label,
.gizmo-value {
    position: absolute;
    left: 0;
    right: 0;
    text-align: center;
    font-family: var(--font-mono);
}

.gizmo-label {
    top: 7px;
    color: #85a6c0;
    letter-spacing: 0.08em;
    font-size: 9px;
}

.gizmo-value {
    bottom: 8px;
    color: #cffafe;
    font-size: 11px;
    text-shadow: 0 0 8px rgba(34, 211, 238, 0.4);
}

.stat-item {
    border: 1px solid #24405a;
    border-radius: 8px;
    background: #08192f;
    padding: 8px;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 17px;
    color: #ecfeff;
}

.stat-label {
    font-size: 10px;
    letter-spacing: 0.07em;
    color: #89a7c2;
}

.dq-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.dq-chip {
    border: 1px solid #2b475f;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 11px;
    font-family: var(--font-mono);
    background: #0b213b;
}

.dq-warnings {
    margin-top: 7px;
    color: #fbcfe8;
    font-size: 11px;
    display: grid;
    gap: 4px;
}

.timeline-bar {
    grid-area: timeline;
    position: relative;
    padding: 10px 14px;
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 10px;
}

.timeline-track {
    width: 100%;
}

.timeline-slider,
.time-slider {
    width: 100%;
    appearance: none;
    height: 6px;
    background: #223a53;
    border-radius: 999px;
    outline: none;
}

.timeline-slider::-webkit-slider-thumb,
.time-slider::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: var(--accent);
    border: 0;
}

.timeline-slider::-moz-range-thumb,
.time-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 0;
    background: var(--accent);
}

.timeline-labels {
    margin-top: 8px;
    font-size: 10px;
    color: #84a0ba;
    display: flex;
    justify-content: space-between;
}

.timeline-time,
.timeline-date {
    font-family: var(--font-mono);
    font-size: 12px;
    color: #dbeafe;
}

.legend-container {
    position: absolute;
    right: 22px;
    bottom: 98px;
    width: 160px;
    padding: 9px;
    z-index: var(--z-panels);
}

.legend-container.collapsed {
    transform: translateY(calc(100% - 36px));
}

.legend-title {
    margin: 0 0 8px;
    font-size: 12px;
    font-family: var(--font-mono);
    letter-spacing: 0.06em;
}

.legend-items {
    display: grid;
    gap: 6px;
    font-size: 12px;
    color: #a7bfd4;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-clear { background: var(--ok); }
.legend-marginal { background: var(--warn); }
.legend-dead { background: var(--bad); }

.legend-toggle {
    position: absolute;
    right: 6px;
    top: 6px;
}

.detail-panel {
    position: absolute;
    top: 56px;
    right: 22px;
    width: 320px;
    max-height: calc(100% - 170px);
    background: #091a31f5;
    border: 1px solid #2b475f;
    border-radius: 12px;
    overflow: hidden;
    transform: translateX(130%);
    transition: transform 180ms ease;
    z-index: var(--z-overlay);
}

.detail-panel.open {
    transform: translateX(0);
}

.detail-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #24405a;
    padding: 8px;
}

.detail-title {
    margin: 0;
    font-size: 14px;
    font-family: var(--font-mono);
}

.detail-panel-content {
    padding: 10px;
}

.detail-coords {
    font-family: var(--font-mono);
    font-size: 12px;
    color: #8fb0cb;
    margin-bottom: 8px;
}

.detail-status {
    border: 1px solid #24405a;
    border-radius: 8px;
    padding: 8px;
    font-size: 13px;
}

.detail-status.clear { color: #86efac; }
.detail-status.marginal { color: #fcd34d; }
.detail-status.dead { color: #fca5a5; }

.detail-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.5);
    z-index: calc(var(--z-overlay) - 2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms ease;
}

.detail-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(7, 13, 25, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: calc(var(--z-overlay) + 20);
}

.loading-overlay[aria-hidden='true'] {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(148, 163, 184, 0.3);
    border-top-color: var(--accent);
    border-radius: 999px;
    animation: spinner 0.9s linear infinite;
}

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

.loading-text {
    margin: 0;
    font-family: var(--font-mono);
    color: #9dc8df;
}

.offline-indicator {
    position: absolute;
    left: 50%;
    top: 58px;
    transform: translate(-50%, -90px);
    padding: 8px 12px;
    border: 1px solid #905f1b;
    border-radius: 999px;
    background: rgba(146, 64, 14, 0.9);
    color: #fde68a;
    font-family: var(--font-mono);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: var(--z-overlay);
    transition: transform 140ms ease;
}

.offline-indicator.visible {
    transform: translate(-50%, 0);
}

.toast-container {
    position: absolute;
    right: 14px;
    top: 58px;
    display: grid;
    gap: 8px;
    z-index: var(--z-toast);
}

.toast {
    min-width: 220px;
    max-width: 360px;
    border: 1px solid #28435f;
    background: #0a1a31f4;
    color: #e2e8f0;
    border-radius: 9px;
    padding: 10px 12px;
    box-shadow: var(--shadow);
    font-size: 13px;
}

.toast.success { border-color: #1f7b46; }
.toast.warning { border-color: #9a6b1c; }
.toast.error { border-color: #9f2f2f; }
.toast.info { border-color: #236e8a; }

.signal-lost-overlay {
    position: absolute;
    inset: 0;
    z-index: calc(var(--z-overlay) + 30);
    background: repeating-linear-gradient(
        180deg,
        rgba(239, 68, 68, 0.15) 0,
        rgba(239, 68, 68, 0.15) 2px,
        rgba(2, 6, 23, 0.96) 3px,
        rgba(2, 6, 23, 0.96) 8px
    );
    display: flex;
    align-items: center;
    justify-content: center;
}

.signal-lost-text {
    font-family: var(--font-mono);
    font-size: 34px;
    letter-spacing: 0.16em;
    color: #fecaca;
    text-shadow: 0 0 18px rgba(248, 113, 113, 0.8);
}

.backend-banner {
    position: absolute;
    top: 56px;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast);
    background: rgba(127, 29, 29, 0.95);
    color: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    padding: 8px 10px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    column-gap: 10px;
    row-gap: 6px;
    min-width: min(680px, calc(100vw - 20px));
}

.backend-banner-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.backend-banner-status {
    grid-column: 2 / 4;
    font-size: 12px;
    color: #fecaca;
    opacity: 0;
    transition: opacity 140ms ease;
}

.backend-banner-status.visible {
    opacity: 1;
}

.backend-banner-start,
.backend-banner-retry,
.backend-banner-close {
    border: 1px solid #fca5a5;
    background: transparent;
    color: inherit;
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
}

.backend-banner-start:disabled {
    opacity: 0.65;
    cursor: wait;
}

.app-shell.boot-sequence {
    animation: boot-on 520ms ease;
}

.app-shell.boot-flicker {
    animation: boot-flicker 100ms steps(2, jump-none) 2;
}

.fx-glitch {
    animation: glitch 180ms linear 1;
}

@keyframes boot-on {
    0% { filter: brightness(0.38) contrast(1.26); transform: scale(1.003); }
    100% { filter: brightness(1); transform: scale(1); }
}

@keyframes boot-flicker {
    0% { opacity: 0.96; }
    40% { opacity: 0.76; }
    100% { opacity: 1; }
}

@keyframes glitch {
    0% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    50% { transform: translateX(2px); }
    75% { transform: translateX(-1px); }
    100% { transform: translateX(0); }
}

@media (max-width: 1180px) {
    .app-shell {
        grid-template-columns: 280px 1fr 320px;
    }
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
        grid-template-rows: 46px auto 1fr auto 80px;
        grid-template-areas:
            'status'
            'sidebar'
            'map'
            'intel'
            'timeline';
        overflow: auto;
    }

    .command-sidebar,
    .intel-panel {
        max-height: none;
    }

    .legend-container {
        right: 10px;
        bottom: 90px;
    }

    .detail-panel {
        width: calc(100% - 20px);
        right: 10px;
        top: 54px;
    }

    .toast-container {
        right: 10px;
        left: 10px;
    }

    .toast {
        max-width: 100%;
        min-width: 0;
    }

    .backend-banner {
        min-width: min(680px, calc(100vw - 20px));
    }
}

@media (max-width: 640px) {
    .app-shell {
        gap: 8px;
        padding: 8px;
    }

    .status-title {
        font-size: 10px;
        letter-spacing: 0.08em;
    }

    .timeline-bar {
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
    }

    .timeline-time,
    .timeline-date {
        justify-self: end;
    }

    .instrument-gauges,
    .gizmo-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .backend-banner {
        grid-template-columns: auto 1fr;
        font-size: 12px;
    }

    .backend-banner-actions,
    .backend-banner-status {
        grid-column: 1 / 3;
    }

    .backend-banner-actions {
        justify-content: flex-end;
        flex-wrap: wrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
