:root {
  --flight-panel-width: 340px;
  --panel-line: #ffffff12;
  --panel-muted: #91a6b2;
  --panel-accent: #78d6c4;
}
#flight-sidebar {
  position:absolute; inset:16px auto auto 16px; width:var(--flight-panel-width);
  max-height:calc(100dvh - 32px); display:flex; flex-direction:column; overflow:hidden;
  background:rgba(18,27,34,.97); border:1px solid #ffffff1b; border-radius:16px;
  box-shadow:0 16px 48px #0005; color:#e5eef1; color-scheme:dark; z-index:5;
  font-size:12px; -webkit-font-smoothing:antialiased;
}
.flight-sidebar-header { position:relative; flex-shrink:0; height:96px; padding:17px 18px; border-bottom:1px solid var(--panel-line); }
.flight-brand { display:flex; align-items:center; gap:9px; }
.flight-brand>span { display:grid; place-items:center; width:26px; height:26px; border:1px solid #5eb2a459; border-radius:8px; background:#23463f; color:#a4e8da; font-size:21px; }
.flight-brand strong { font-size:19px; font-weight:650; letter-spacing:-.6px; }
#flight-sidebar #sidebar-toggle { position:absolute; right:12px; top:16px; width:28px; height:28px; padding:0; border:0; border-radius:6px; background:transparent; color:var(--panel-muted); font-size:23px; cursor:pointer; }
#sidebar-toggle:hover { background:#ffffff08; color:#edf7f4; }
.flight-sidebar-header .mode-switch { top:auto; left:18px; bottom:14px; height:28px; padding:2px; border:1px solid var(--panel-line); background:#0c151b; border-radius:8px; }
.flight-sidebar-header .mode-switch>* { min-width:43px; padding:0 12px; line-height:22px; font-size:11px; border-radius:5px; }
.flight-sidebar-header .mode-switch .active { background:#255b53; color:#cefff2; }
.flight-sidebar-header .language-button { top:auto; right:18px; bottom:14px; min-width:32px; height:28px; padding:0 7px; border:1px solid var(--panel-line); border-radius:7px; background:transparent; color:var(--panel-muted); font-size:10px; }
#sidebar-content { min-height:0; overflow-y:auto; overflow-x:hidden; scrollbar-width:thin; scrollbar-color:#344750 transparent; overscroll-behavior:contain; padding-bottom:4px; }
.sidebar-region { padding:16px 18px 4px; }
.sidebar-region .viewer-control-row { margin:0; }
#flight-sidebar .viewer-control-row { display:grid; grid-template-columns:80px minmax(0,1fr); align-items:center; gap:10px; color:#becdd4; font-size:12px; font-weight:400; }
#flight-sidebar select, #flight-sidebar button { font:inherit; }
#flight-sidebar button, #flight-sidebar select, #flight-sidebar input { outline-offset:3px; }
#flight-sidebar button:focus-visible, #flight-sidebar select:focus-visible, #flight-sidebar input:focus-visible, #flight-sidebar summary:focus-visible { outline:2px solid var(--panel-accent); outline-offset:3px; }
#flight-sidebar select { width:auto; min-width:0; min-height:32px; padding:5px 9px; color:#dae6eb; border:1px solid #ffffff16; border-radius:7px; background:#1c2932; font-size:12px; cursor:pointer; }
#flight-sidebar .drone-panel { position:static; width:auto; max-height:none; overflow:visible; padding:18px 18px 14px; border:0; border-radius:0; box-shadow:none; background:transparent; }
#flight-sidebar .drone-header { position:static; padding:0; background:none; gap:8px; }
.drone-header h2 { margin:0 auto 0 0; font-size:14px; font-weight:600; letter-spacing:.2px; }
#flight-sidebar .drone-header #drone-collapse { width:24px; min-height:26px; padding:0; border:0; background:none; color:#8ca6af; font-size:16px; }
#flight-sidebar .drone-state { max-width:120px; display:flex; align-items:center; gap:5px; padding:0; border-radius:0; background:none; color:#8fc5b9; font-size:10px; white-space:nowrap; }
#flight-sidebar .drone-state::before { content:''; width:5px; height:5px; flex-shrink:0; border-radius:50%; background:currentColor; }
#flight-sidebar .drone-state[data-state=drifting] { color:#ffc37a; }
#flight-sidebar .drone-state[data-state=collision], #flight-sidebar .drone-state[data-state=boundary] { color:#ff9d9d; }
#flight-sidebar .drone-state[data-state=stopped], #flight-sidebar .drone-state[data-state=paused] { color:#a3b3bd; }
#flight-sidebar .drone-status-row { position:static; display:grid; grid-template-columns:minmax(0,1fr) 52px 52px; gap:6px; margin-top:13px; padding:0; background:none; }
#flight-sidebar .drone-panel button, #flight-sidebar .button-row button { min-height:32px; padding:6px 10px; border:1px solid #ffffff16; border-radius:8px; background:#1c2a33; color:#c0d1da; font-size:11px; cursor:pointer; transition:background .15s, border-color .15s; }
#flight-sidebar .drone-panel button:hover:not(:disabled), #flight-sidebar .button-row button:hover { border-color:#6fa99b80; background:#253b42; color:#ebf9f6; }
#flight-sidebar .drone-panel button:disabled { opacity:.35; cursor:default; }
#flight-sidebar .drone-status-row button { min-height:39px; }
#flight-sidebar .drone-status-row .drone-primary { margin:0; background:#317f70; border-color:#499986; color:#f1fff9; font-size:13px; font-weight:600; }
#flight-sidebar .drone-status-row .drone-primary:hover:not(:disabled) { background:#3a9581; border-color:#71beaa; }
#flight-sidebar .drone-status-row .drone-stop:not(:disabled) { color:#e9a5a4; border-color:#9b666449; }
#flight-sidebar .drone-notice { min-height:0; margin:9px 0 0; color:var(--panel-muted); font-size:10px; line-height:1.65; }
#flight-sidebar .drone-notice.warning { color:#ffc37a; }
#flight-sidebar .drone-notice:empty { display:none; }
#flight-sidebar .drone-intro { display:none; }
#flight-sidebar .drone-playback { display:grid; grid-template-columns:auto 51px auto 1fr; align-items:center; gap:6px; margin:12px 0 18px; color:var(--panel-muted); font-size:10px; }
#flight-sidebar .drone-playback button { margin:0; padding:4px 7px; min-height:29px; background:transparent; font-size:10px; }
#flight-sidebar .drone-playback select { min-height:29px; padding:4px 6px; font-size:11px; }
#flight-sidebar .drone-slider { margin:0; grid-template-columns:1fr auto; gap:10px; align-items:center; font-size:12px; color:#c8d8df; }
#flight-sidebar output { padding:2px 6px; border-radius:5px; background:#25443e60; color:#8dddc9; font-size:12px; font-variant-numeric:tabular-nums; }
#flight-sidebar input[type=range] { height:3px; margin:7px 0; border:0; border-radius:3px; background:#36474e; cursor:pointer; }
#flight-sidebar input[type=range]::-webkit-slider-thumb { width:13px; height:13px; border:2px solid #93dbca; border-radius:50%; background:#428a7b; box-shadow:0 0 0 3px #14242a; }
#flight-sidebar input[type=range]::-moz-range-thumb { width:9px; height:9px; border:2px solid #93dbca; border-radius:50%; background:#428a7b; box-shadow:0 0 0 3px #14242a; }
#flight-sidebar .drone-hint { margin:8px 0 12px; color:#829aa7; font-size:10px; line-height:1.7; }
#flight-sidebar #drone-resistance-hint { margin:6px 0 16px; font-size:10px; }
#flight-sidebar .drone-section-heading { display:flex; align-items:center; gap:12px; min-height:48px; margin:0; padding:0; border-top:1px solid var(--panel-line); font-size:13px; font-weight:500; color:#d5e2e7; }
#flight-sidebar .drone-section-heading>span:first-child::before { content:none; }
#flight-sidebar .drone-section-heading>span:last-child { margin-left:auto; color:#809aa7; font-size:10px; font-weight:400; }
#flight-sidebar .drone-section-heading::after, #flight-sidebar .sidebar-section>summary::after { content:''; width:5px; height:5px; flex-shrink:0; border:solid #6b9990; border-width:0 1.5px 1.5px 0; transform:rotate(45deg) translateY(-2px); margin-right:2px; }
#flight-sidebar details[open]>.drone-section-heading::after, #flight-sidebar details[open].sidebar-section>summary::after { transform:rotate(225deg) translate(-1px,-1px); }
#flight-sidebar .drone-buttons { gap:6px; }
#flight-sidebar .drone-buttons:has(>#drone-demo) { grid-template-columns:1fr; }
.route-files { margin:12px 0; padding:10px 12px; border:1px solid var(--panel-line); border-radius:9px; background:#0d171b55; }
.route-files>summary, .inline-help>summary { color:#8fb7b0; font-size:11px; cursor:pointer; }
.route-files>summary::before, .inline-help>summary::before { content:'+ ';color:#78b8aa; }.route-files[open]>summary::before, .inline-help[open]>summary::before { content:'− '; }
#flight-sidebar .drone-route-name { margin-top:12px; font-size:11px; }
#flight-sidebar .drone-route-name input { border-color:#ffffff1b; background:#16232b; border-radius:7px; }
.saved-routes-link { display:block; margin:12px 0; font-size:11px; color:#8cd4c3; text-underline-offset:3px; }
.inline-help { margin:0 0 12px; }
#flight-sidebar .drone-key { display:flex; flex-wrap:wrap; gap:13px; margin-top:7px; color:#9aadb7; font-size:9px; }
#flight-sidebar .drone-key i { width:13px; border-top-width:2px; }.drone-key i.planned { border-top-style:solid; }
#flight-sidebar .drone-footnote { margin:8px 0 0; color:#637d89; font-size:9px; line-height:1.5; }
#flight-sidebar .sidebar-section { position:static; width:auto; max-height:none; overflow:visible; padding:0 18px 17px; margin:0; border:0; border-radius:0; background:transparent; box-shadow:none; }
#flight-sidebar .sidebar-section>summary { display:flex; align-items:center; justify-content:space-between; min-height:48px; border-top:1px solid var(--panel-line); padding:0; color:#d5e2e7; font-size:13px; font-weight:500; list-style:none; cursor:pointer; }
#flight-sidebar summary::-webkit-details-marker { display:none; }
.sidebar-section .section-content { padding-top:2px; }
#flight-sidebar .seed-position-row { grid-template-columns:1fr auto; row-gap:6px; margin:16px 0 12px; }
#flight-sidebar .wind-follow-control { margin:13px 0 14px; min-height:27px; color:#b9ccd3; font-size:11px; }
#flight-sidebar .wind-follow-control>span:last-child { order:-1; flex:1; }
#flight-sidebar .wind-follow-control input { left:auto; right:0; }
#flight-sidebar .wind-follow-switch { flex-basis:32px; height:19px; border-color:#41575d; background:#26383f; }
#flight-sidebar .wind-follow-switch::after { width:11px; height:11px; margin:3px; }
#flight-sidebar .wind-follow-control input:checked + .wind-follow-switch { border-color:#6cb59f; background:#337c68; }
#flight-sidebar .wind-follow-control input:checked + .wind-follow-switch::after { transform:translateX(13px); }
#flight-sidebar .wind-band { padding:10px 11px 5px; margin:0 0 14px; border-radius:8px; background:#0b171e; font-size:11px; }
#flight-sidebar .wind-band p { color:#829aa7; font-size:10px; }
#flight-sidebar .button-row { display:grid; grid-template-columns:1fr 1fr; gap:6px; margin-top:12px; }
#flight-sidebar .button-row button { background:transparent; }
#flight-sidebar .speed-legend { position:static; display:grid; grid-template-columns:1fr 1fr 1fr; grid-template-rows:auto 4px auto; width:auto; height:auto; padding:0; margin-top:16px; gap:5px 0; color:#849ca8; background:none; font-size:9px; }
#flight-sidebar .speed-title { grid-column:1/-1; grid-row:1; writing-mode:horizontal-tb; transform:none; text-align:left; font-size:9px; }
#flight-sidebar .speed-gradient { grid-column:1/-1; grid-row:2; width:100%; height:4px; border-radius:3px; opacity:.86; background:linear-gradient(to right,#30123b,#4145ab,#2a8bd1,#1bcfd4,#61fc6c,#d1e834,#fca50a,#e12a1f,#7a0403); }
#flight-sidebar .speed-minimum { grid-row:3;grid-column:1;padding:0; }#flight-sidebar .speed-midpoint { grid-row:3;grid-column:2;text-align:center;padding:0; }#flight-sidebar .speed-maximum { grid-row:3;grid-column:3;text-align:right;padding:0; }
.viewer-help { left:calc(var(--flight-panel-width) + 32px); right:auto; bottom:16px; max-width:calc(100% - var(--flight-panel-width) - 48px); font-size:10px; }
#flight-sidebar.collapsed { width:46px; }#flight-sidebar.collapsed .flight-sidebar-header { height:48px;padding:0;border:0; }#flight-sidebar.collapsed #sidebar-toggle { inset:9px 8px auto; }#flight-sidebar.collapsed .flight-brand,#flight-sidebar.collapsed .mode-switch,#flight-sidebar.collapsed .language-button,#flight-sidebar.collapsed #sidebar-content { display:none; }
.drone-hover-controls { position:absolute;left:0;top:0;z-index:4;transform-origin:0 0;min-width:42px;min-height:42px;pointer-events:none; }
.drone-hover-target { position:absolute;left:-24px;top:-24px;width:48px;height:48px;border:0;border-radius:50%;background:transparent;color:transparent;cursor:pointer;pointer-events:auto; }
.drone-hover-hint { position:absolute;left:0;top:32px;transform:translate(-50%,0);white-space:nowrap;padding:5px 8px;border-radius:4px;background:#101b22db;color:#d5eee9;font:11px/1.5 system-ui;pointer-events:none; }
.drone-hover-controls:not(:hover):not(:focus-within) .drone-hover-hint { opacity:0; }
.drone-hover-target:focus-visible { outline:2px solid #8cf4df;outline-offset:2px; }
@media(max-width:900px) { :root {--flight-panel-width:310px}#flight-sidebar{inset:10px auto auto 10px;max-height:calc(100dvh - 20px)}.flight-sidebar-header{padding-left:15px}.sidebar-region,#flight-sidebar .drone-panel,#flight-sidebar .sidebar-section{padding-left:15px;padding-right:15px}.viewer-help{display:none} }
@media(max-width:540px) { :root{--flight-panel-width:286px}#flight-sidebar{max-width:calc(100% - 20px)}#flight-sidebar .drone-playback{grid-template-columns:auto 45px auto 1fr;gap:4px}.flight-brand strong{font-size:18px} }
@media(prefers-reduced-motion:reduce) { #flight-sidebar button { transition:none!important; } }
/* Point editing: compact values in the sidebar, discrete handles in the scene. */
#flight-sidebar .waypoint-settings { margin-top: 16px; }
#flight-sidebar .waypoint-settings > summary { display: flex; justify-content: space-between; }
#flight-sidebar #drone-waypoint-count { color: #89a4b3; font-size: 11px; font-weight: 400; }
.waypoint-toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 12px 0; }
.waypoint-chips { display: flex; flex-wrap: wrap; gap: 5px; max-height: 145px; overflow: auto; }
#flight-sidebar .waypoint-chips button { min-width: 28px; min-height: 28px; padding: 3px 6px; font-size: 11px; }
#flight-sidebar .waypoint-chips button.selected { color: #ffe1a2; border-color: #ac8a4b; background: #40372b; }
.waypoint-selection-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 14px 0 10px; font-size: 12px; }
#flight-sidebar .waypoint-selection-row button { font-size: 10px; padding: 5px 8px; }
.waypoint-value-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 10px; }
.waypoint-value-grid label { min-width: 0; font-size: 10px; color: #91a7b5; }
.waypoint-value-grid input { display: block; width: 100%; min-width: 0; margin-top: 5px; padding: 7px 8px; border: 1px solid #34444d; border-radius: 7px; color: #e4ecef; background: #1d2931; font: inherit; font-size: 12px; }
.waypoint-value-grid input:focus { outline: 1px solid #78d3c4; }
.waypoint-marker { position: absolute; width: 24px; height: 24px; margin: 0; padding: 0; transform: translate(-50%,-50%); border: 0; background: transparent; cursor: grab; touch-action: none; user-select: none; z-index: 2; }
.waypoint-dot { display: block; width: 8px; height: 8px; margin: auto; background: #ccdfec; border: 1px solid #314759; border-radius: 50%; box-shadow: 0 0 0 2px #13252e55; }
.waypoint-marker.selected .waypoint-dot { background: #ffcd73; box-shadow: 0 0 0 3px #ffcd7344; }
.waypoint-label { display: none; position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); padding: 4px 7px; border-radius: 6px; border: 1px solid #688799; background: #14232eeb; color: #e5f4fa; white-space: nowrap; font: 600 11px system-ui,sans-serif; pointer-events: none; }
.waypoint-marker:hover .waypoint-label, .waypoint-marker:focus-visible .waypoint-label, .waypoint-marker.endpoint .waypoint-label { display: block; }
.waypoint-marker[data-end="start"] .waypoint-label { border-color: #7ff1d5; color: #c6ffed; }
.waypoint-marker[data-end="goal"] .waypoint-label { border-color: #ffd689; color: #ffebc4; }

.waypoint-marker[hidden], #drone-waypoint-fields[hidden], #drone-waypoint-empty[hidden] { display: none; }

#flight-sidebar .waypoint-toolbar button[aria-pressed="true"] { background:#2d5755;border-color:#79d7c6;color:#e4fffa; }

.waypoint-marker.dragging { cursor:grabbing;z-index:5; }
.waypoint-marker.dragging .waypoint-label { display:block; }
.waypoint-marker:focus-visible { outline:1px solid #ffda8a;border-radius:50%; }
#flight-sidebar .route-warning { margin:10px 0;padding:10px 12px;border:1px solid #d76a79;border-radius:8px;background:#532a33;color:#ffccd4;font-size:11px;line-height:1.6; }
.route-risk-marker { position:absolute;z-index:4;transform:translate(-50%,calc(-100% - 8px));padding:5px 8px;border:1px solid #ff7187;border-radius:6px;background:#4b1e2bee;color:#ffe2e8;font:600 11px system-ui;pointer-events:none;white-space:nowrap; }
.route-risk-marker::after { content:'';position:absolute;left:50%;top:100%;height:8px;width:1px;background:#ff7187; }
.route-risk-marker[hidden],#flight-sidebar .route-warning[hidden] { display:none; }
#flight-sidebar .route-warning.editing { min-height:56px; }
#flight-sidebar .route-warning.editing[hidden] { display:block;visibility:hidden; }
