/* Base layout and device controls */
@font-face  {
  font-family: Manrope; src: url("fonts/manrope.ttf") format("truetype"); font-weight: 200 800;
  font-display: swap;
}
@font-face  {
  font-family: "Fira Code"; src: url("fonts/fira-code.ttf") format("truetype"); font-weight: 300 700;
  font-display: swap;
}
:root {
  font: 400 16px/1.5 Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, output { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; transition: background .18s ease, border-color .18s ease, box-shadow .18s ease; }
button:disabled { cursor: not-allowed; }
button:active:not(:disabled) { filter: brightness(.93); }
[hidden] { display: none !important; }
button svg { pointer-events: none; }
.ui-icon { width: 18px; height: 18px; fill: none; stroke-width: 1.6; flex-shrink: 0; }
.telemetry-grid>div>span { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.telemetry-grid .ui-icon { width: 15px; height: 15px; }
.speaker .ui-icon { color: var(--accent); width: 20px; height: 20px; }
.speaker[aria-pressed=true] .ui-icon { color: white; }
h2, h3, p { margin: 0; }
.skip-link {
  position: fixed;
  top: -100px;
  left: 24px;
  z-index: 100;
  padding: 12px 20px;
  background: white;
  color: var(--ink);
  border-radius: 8px;
}
.skip-link:focus { top: 12px; }
header {
  width: min(1360px, calc(100% - 64px));
  min-height: 82px;
  margin: 20px auto 0;
  padding: 14px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: #fefefe;
  border: 1px solid #ffffff80;
  border-radius: 16px;
  box-shadow: 0 4px 18px #1515150a;
  position: relative;
}
.brand { display: block; max-width: 100%; text-decoration: none; }
.brand img { width: 148px; max-width: 100%; height: auto; display: block; }
.navigation { max-width: 100%; display: flex; align-items: center; flex-wrap: wrap; gap: 24px; }
#menuPanel { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; padding: 0; }
#menuPanel a, #menuPanel button {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  min-height: 44px;
  padding: 12px 8px;
  border-radius: 6px;
  position: relative;
  color: var(--muted);
  font-size: .8125rem;
  text-decoration: none;
  font-weight: 500;
}
#menuPanel a[aria-current="page"], #menuPanel button[aria-current="page"] { color: var(--navy); background: transparent; box-shadow: none; font-weight: 700; }
#menuPanel [aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: calc(50% - 10px);
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
#menuPanel button:hover { background: #f5f5f5; color: var(--ink); }
#disconnectButton {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 10px 0 10px 24px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: .8125rem;
  font-weight: 600;
}
#disconnectButton:hover { background: transparent; }
main {
  max-width: 1360px;
  margin: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-areas: "camera controls" "telemetry controls";
  gap: 20px;
  align-items: start;
}
main:focus { outline: none; }
main { padding-top: 28px; }
aside { display: contents; }
.controls, .lower-panel, .camera-card { border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.controls { grid-area: controls; overflow: hidden; }
.camera-card { grid-area: camera; overflow: hidden; }
.lower-panel { grid-area: telemetry; padding: 22px 26px 26px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h2 { font-size: 1rem; font-weight: 800; }
.panel-heading>svg { width: 22px; height: 22px; opacity: .65; }
.control-name { display: flex; align-items: center; min-width: 0; gap: 13px; }
.control-name>div { min-width: 0; overflow-wrap: anywhere; }
.mini-icon { display: grid; place-items: center; width: 42px; height: 42px; flex-shrink: 0; }
.mini-icon svg { width: 25px; height: 25px; }
.audio-controls { padding: 26px 0 22px; }
.audio-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h3, .control label, .control-title { font-size: .875rem; font-weight: 800; line-height: 1.5; }
.control-name small, .control-name div>span { display: block; font-size: .75rem; color: var(--muted); margin-top: 5px; }
.control-name div>span:empty { display: none; }
.speaker { display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; border: 1px solid #dcdcdc; }
.control { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 22px 0; border-top: 1px solid var(--line); }
.control-copy { display: flex; flex-direction: column; text-align: left; }
.alarm-control {
  width: 100%;
  border-right: 0;
  border-left: 0;
  border-bottom: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.control-chevron { width: 16px; height: 16px; fill: none; stroke-width: 1.5; flex-shrink: 0; }
.switch { position: relative; width: 58px; height: 30px; min-width: 58px; padding: 0; border-radius: 99px; border: 1px solid #dddddd; }
.switch i { position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; border-radius: 50%; transition: transform .2s; }
.switch span { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); font-size: .5rem; font-weight: 800; }
.switch[aria-checked=true] { border-color: var(--accent); }
.switch[aria-checked=true] i { transform: translateX(28px); }
.switch[aria-checked=true] span { right: auto; left: 5px; }
.switch:disabled { opacity: .65; }
.audio-status { margin: 0; padding: 12px 0 20px; font-size: .75rem; color: var(--muted); overflow-wrap: anywhere; }
.audio-status:empty { display: none; }
.subtle { font-size: .75rem; color: var(--muted); }
.telemetry-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 20px; }
.telemetry-grid>div { padding-left: 22px; border-left: 1px solid var(--line); }
.telemetry-grid>div:first-child { padding-left: 0; border: 0; }
.telemetry-grid>div>span { font-size: .75rem; font-weight: 600; color: var(--muted); }
.telemetry-grid strong {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: "Fira Code", ui-monospace, monospace;
  font-weight: 500;
  font-size: 1.5rem;
  line-height: 1.4;
  margin-top: 8px;
}
.telemetry-grid small { font: 400 .6875rem Manrope, sans-serif; color: var(--muted); letter-spacing: 0; }
.camera-heading { min-height: 72px; padding: 16px 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.camera-heading>div { display: flex; align-items: center; gap: 10px; }
.camera-dot { width: 7px; height: 7px; border-radius: 50%; }
#fullscreen { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line); }
#fullscreen:hover { background: var(--soft); }
#fullscreen svg { width: 23px; height: 23px; }
.camera {
  position: relative;
  min-height: 380px;
  height: clamp(380px, 32vw, 470px);
  margin: 0 12px;
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
}
.camera::before { content: ""; position: absolute; inset: 0; z-index: -1; }
#f2f2f2dd { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #191919; }
.camera:fullscreen { width: 100%; height: 100%; max-height: none; margin: 0; border-radius: 0; aspect-ratio: auto; }
#cameraEmpty { position: relative; min-width: 0; max-width: 100%; padding: 36px 28px; text-align: center; z-index: 1; overflow-wrap: anywhere; }
.camera { min-width: 0; width: calc(100% - 24px); }
.empty-icon {
  position: relative;
  width: 76px;
  height: 76px;
  margin: 0 auto 32px;
  display: grid;
  place-items: center;
  border: 1px solid #bababa40;
}
.empty-icon svg { width: 36px; height: 36px; }
.preview-eyebrow { display: block; font-size: .5rem; font-weight: 700; margin-bottom: 10px; }
#cameraEmpty h3 { letter-spacing: -.045em; }
#cameraEmpty p { margin-top: 12px; line-height: 1.8; }
.view-corner { width: 16px; height: 16px; position: absolute; border: 0 solid #adadad40; pointer-events: none; }
.top-left { left: 22px; top: 22px; border-width: 1px 0 0 1px; }
.top-right { right: 22px; top: 22px; border-width: 1px 1px 0 0; }
.bottom-left { left: 22px; bottom: 22px; border-width: 0 0 1px 1px; }
.bottom-right { right: 22px; bottom: 22px; border-width: 0 1px 1px 0; }
.camera-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 84px;
  padding: 18px 24px;
}
#connectCamera {
  min-height: 46px;
  padding: 12px 23px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  font-size: .75rem;
  font-weight: 700;
}
#connectCamera:hover { border-color: var(--accent-hover); }
#connection { margin-right: auto; color: var(--muted); font-size: .75rem; max-width: 55%; overflow-wrap: anywhere; }
#streamLabel { font-size: .6875rem; color: var(--accent); }
#connection:empty, #streamLabel:empty { display: none; }
.detection-panel { margin: 12px 12px 0; padding: 16px; border-radius: 10px; border: 1px solid #d9d9d9; font-size: .75rem; }
.detection-panel strong { font-size: .875rem; display: block; }
.detection-panel[data-state=warning] { border: 2px solid var(--danger); }
#detectionLabels, #detectionSummary { margin-top: 5px; overflow-wrap: anywhere; }
dialog {
  width: min(440px, calc(100vw - 32px));
  min-width: 0;
  padding: 28px;
  max-height: calc(100dvh - 40px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
}
dialog h2 { font-size: 1.375rem; line-height: 1.4; letter-spacing: -.04em; }
dialog p { font-size: .8125rem; line-height: 1.8; color: var(--muted); margin: 16px 0; }
dialog button { min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: .75rem; font-weight: 700; }
dialog button:hover { background: var(--soft); }
dialog button:disabled { opacity: .55; }
dialog dl>div { display: flex; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: .8125rem; }
dialog dd { margin: 0; }
.alarm-dialog { width: min(600px, calc(100vw - 32px)); padding: 32px; }
.rescue-close { position: absolute; top: 18px; right: 18px; width: 44px; height: 44px; padding: 12px; }
.rescue-close svg, .upload-symbol svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.alarm-badge {
  display: inline-block;
  margin: 0 40px 12px 0;
  padding: 5px 8px;
  font-size: .5625rem;
  letter-spacing: .1em;
  font-weight: 800;
  color: var(--accent);
  background: var(--soft);
  border-radius: 5px;
}
.alarm-dialog h2 { max-width: 25ch; text-wrap: balance; }
.rescue-intro { max-width: 52ch; }
.alarm-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; margin: 22px 0; }
.alarm-actions button { flex: 1 1 140px; }
#openMic { color: var(--accent); border-color: #d2d2d2; }
.alarm-dialog[data-mode=manual] #ignoreAlarm { display: none; }
.alarm-audio { border-top: 1px solid var(--line); padding-top: 22px; }
.alarm-audio h3 { margin-bottom: 12px; }
.recording-upload {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 0 12px;
  align-items: center;
  border: 1px dashed #c5c5c5;
  border-radius: 12px;
  padding: 20px;
}
.upload-symbol {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  grid-row: span 2;
  color: var(--accent);
  background: var(--soft);
}
.recording-upload label { font-size: .8125rem; font-weight: 700; }
#uploadHint { font-size: .6875rem; color: var(--muted); }
.recording-upload input { width: 100%; min-width: 0; grid-column: 1/-1; margin-top: 16px; color: var(--muted); font-size: .6875rem; }
.recording-upload input::file-selector-button {
  border: 1px solid var(--line);
  padding: 10px 14px;
  min-height: 44px;
  border-radius: 8px;
  background: white;
  color: var(--ink);
  margin-right: 10px;
  font: inherit;
  cursor: pointer;
}
.audio-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 16px 0; }
.audio-actions button { padding-inline: 8px; font-size: .6875rem; }
.hardware-details { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 20px; color: var(--muted); font-size: .75rem; }
.hardware-details summary { cursor: pointer; min-height: 44px; align-content: center; }
#rescueStatus:empty, #alarmDetails:empty { display: none; }
#rescueStatus { border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
@media (min-width: 1441px) {
  .camera { min-height: 450px; }
}
@media (max-width: 1424px) {
  main { margin-left: 32px; margin-right: 32px; }
}
@media (max-width: 1100px) {
  main { grid-template-columns: minmax(0, 1fr) 310px; }
  .controls { padding-inline: 20px; }
  .camera { min-height: 390px; }
}
@media (max-width: 850px) {
  header { padding-inline: 24px; width: calc(100% - 48px); }
  .brand img { width: 130px; }
  #menuPanel { gap: 2px; }
  #menuPanel a, #menuPanel button { padding-inline: 12px; }
  main { margin-left: 24px; margin-right: 24px; }
  main {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "camera camera" "controls controls" "telemetry telemetry";
  }
  .controls { padding-inline: 24px; }
  .controls .panel-heading { padding-bottom: 4px; }
  .camera { min-height: 360px; }
  .controls .control { min-height: 86px; }
}
@media (max-width: 600px) {
  header {
    width: calc(100% - 32px);
    margin-top: 16px;
    padding: 16px;
    min-height: 0;
    gap: 14px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .brand img { width: 132px; }
  .navigation { display: contents; }
  #menuPanel {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-column: 1 / -1;
    grid-row: 2;
    gap: 4px;
    border-top: 1px solid var(--line);
    padding-top: 8px;
  }
  #menuPanel a, #menuPanel button {
    padding: 10px 8px;
    font-size: .6875rem;
    justify-content: center;
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: center;
  }
  #disconnectButton { grid-column: 2; grid-row: 1; padding: 10px 0; border: 0; font-size: .6875rem; }
  main { margin-left: 16px; margin-right: 16px; }
  main { gap: 16px; }
  .camera-heading { padding: 14px 18px; min-height: 68px; }
  .camera { min-height: 320px; height: auto; aspect-ratio: 1/1; margin-inline: 8px; }
  .camera { width: calc(100% - 16px); }
  #cameraEmpty { padding: 32px 16px; width: 100%; }
  #cameraEmpty h3 { font-size: 1.35rem; }
  #cameraEmpty p { font-size: .8125rem; }
  .desktop-break { display: none; }
  .camera-footer { padding: 16px 18px; min-height: 78px; }
  #connectCamera { width: 100%; }
  #connection { max-width: 100%; }
  .lower-panel { padding: 20px; }
  .telemetry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
  .telemetry-grid>div:nth-child(3) { border: 0; padding-left: 0; }
  .telemetry-grid>div { padding-left: 20px; }
  .subtle { font-size: .6875rem; }
  .controls { padding: 24px 20px 4px; }
  .alarm-dialog { padding: 24px 20px; }
  .rescue-close { top: 12px; right: 12px; }
  .recording-upload { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media (prefers-reduced-transparency: reduce) {
  header { background: #ffffff; backdrop-filter: none; -webkit-backdrop-filter: none; }
  dialog::backdrop { backdrop-filter: none; background: #212121e6; }
}
@media (prefers-contrast: more) {
  :root { --muted: #494949; --line: #979797; }
  .preview-eyebrow, #cameraEmpty p { color: white; }
}
@media (forced-colors: active) {
  .controls, .camera-card, .lower-panel, button { border: 1px solid ButtonText; }
  .camera { border: 1px solid CanvasText; }
}
.trip-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0; }
.trip-controls button {
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: .78rem;
  font-weight: 700;
}
.trip-controls button:hover:not(:disabled) { background: var(--soft); border-color: var(--accent); }
.trip-controls button:disabled { opacity: .5; cursor: not-allowed; }
#takeoffTrip { color: var(--accent); }
#landTrip { color: var(--danger); }
#tripStatus { grid-column: 1 / -1; margin: 4px 0; font-size: .75rem; line-height: 1.6; color: var(--muted); overflow-wrap: anywhere; }
#setHome { color: var(--accent); background: var(--soft); }
#flightState { grid-column: 1 / -1; font-size: .7rem; line-height: 1.6; color: var(--muted); overflow-wrap: anywhere; }
#rtlTrip { color: var(--accent); background: var(--soft); }
.route-editor { border-top: 1px solid var(--line); padding: 14px 0; margin: 4px 0; }
.route-editor summary { color: var(--ink); cursor: pointer; font-size: .8rem; font-weight: 700; }
.route-editor p { color: var(--muted); font-size: .72rem; line-height: 1.7; margin-top: 10px; }
.route-editor fieldset { padding: 0; margin: 12px 0 0; border: 0; min-width: 0; }
.route-editor label { display: block; font-size: .72rem; color: var(--muted); margin: 10px 0 5px; }
.route-editor input, .route-editor select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  color: var(--ink);
  background: var(--surface);
  font-size: .75rem;
}
#routeSteps { padding-left: 20px; margin: 12px 0; }
#routeSteps li { padding: 5px 0; }
.route-step { display: grid; grid-template-columns: 1fr 64px 26px 28px; gap: 5px; align-items: center; }
.route-step span { font-size: .7rem; color: var(--muted); }
.route-editor button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent);
  font-size: .75rem;
  min-height: 36px;
}
.route-editor button:disabled, .route-editor fieldset:disabled { opacity: .55; }
.route-actions { display: flex; gap: 8px; }
.route-actions button { flex: 1; }
.alarm-audio summary { cursor: pointer; font-size: .8rem; font-weight: 700; margin-bottom: 14px; }
.alert-hero { display: none; }
.alarm-dialog[data-mode=alarm] { border: 1px solid #6868686b; padding-top: 28px; scrollbar-color: #4c4c4c #181818; }
.alarm-dialog[data-mode=alarm]::backdrop { animation: alert-edge-pulse 2.6s ease-in-out infinite; }
body.drowning-alert::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  border: 2px solid #6a6a6a60;
  box-shadow: inset 0 0 65px #5c5c5c2b;
}
.alarm-dialog[data-mode=alarm] .alert-hero {
  display: grid;
  place-items: center;
  position: relative;
  isolation: isolate;
  min-height: 150px;
  margin: 0 -12px 18px;
  overflow: hidden;
  background: linear-gradient(#79797909 1px, transparent 1px), linear-gradient(90deg, #79797909 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(transparent, black 15%, black 85%, transparent);
}
.alert-symbol { width: 136px; height: 122px; z-index: 1; }
.alert-hazard-line {
  position: absolute;
  inset: 56px 0 auto;
  height: 32px;
  opacity: .25;
  background: repeating-linear-gradient(125deg, #6a6a6a 0 6px, transparent 6px 13px);
  mask-image: linear-gradient(90deg, transparent, black 20%, transparent 40%, transparent 60%, black 80%, transparent);
}
.alert-hero-caption { font: 500 .5rem "Fira Code", monospace; letter-spacing: .19em; margin-top: 7px; }
.alarm-dialog[data-mode=alarm] .alarm-badge {
  display: block;
  width: fit-content;
  margin: 0 auto 12px;
  padding: 6px 10px;
  color: #afafaf;
  background: #6a6a6a17;
  border: 1px solid #6a6a6a44;
  border-radius: 4px;
  letter-spacing: .17em;
}
.alarm-dialog[data-mode=alarm] h2 { max-width: none; text-align: center; font-size: 1.45rem; letter-spacing: -.025em; }
.alarm-dialog[data-mode=alarm] #alarmDetails { text-align: center; font-weight: 500; font-size: .8rem; }
.alarm-dialog[data-mode=alarm] .rescue-intro { color: #acacac; text-align: center; font-size: .75rem; }
.alarm-dialog[data-mode=alarm] button:hover:not(:disabled) { background: #363636; border-color: #777777; }
.alarm-dialog[data-mode=alarm] .rescue-close { border-radius: 50%; color: #b8b8b8; background: #ffffff05; border-color: #ffffff1c; }
.alarm-dialog[data-mode=alarm] .alarm-actions { background: #ffffff03; border-color: #3e3e3e; padding: 12px; }
.alarm-dialog[data-mode=alarm] #openServo:hover:not(:disabled) { background: #636363; }
.alarm-dialog[data-mode=alarm] #openMic { color: #cbcbcb; border-color: #434343; }
#alertFlightActions { grid-template-columns: 1fr 1fr; }
.alarm-dialog[data-mode=alarm] .alarm-audio { color: #cfcfcf; border-color: #3e3e3e; padding-top: 16px; margin-top: 20px; }
.alarm-dialog[data-mode=alarm] .recording-upload { color: #e3e3e3; }
.alarm-dialog[data-mode=alarm] .upload-symbol { background: #333333; color: #c8c8c8; }
.alarm-dialog[data-mode=alarm] p, .alarm-dialog[data-mode=alarm] #uploadHint { color: #bcbcbc; }
.alarm-dialog[data-mode=alarm] .hardware-details { border-color: #3e3e3e; color: #cfcfcf; }
.alarm-dialog[data-mode=alarm] #rescueStatus { border-color: #4d4d4d; background: #6a6a6a0b; }
@keyframes alert-edge-pulse {
  0%, 100% { box-shadow: inset 0 0 40px 5px #55555529; }
  50% { box-shadow: inset 0 0 100px 12px #55555557; }
}
@media (max-width: 560px) {
  .alarm-dialog[data-mode=alarm] .alert-hero { min-height: 115px; margin-bottom: 12px; }
  .alert-symbol { width: 104px; height: 96px; }
  .alarm-dialog[data-mode=alarm] h2 { font-size: 1.2rem; }
  .alarm-dialog[data-mode=alarm] .alarm-actions { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .alarm-dialog[data-mode=alarm]::backdrop { animation: none; box-shadow: inset 0 0 55px #55555540; }
}
.alarm-dialog[data-mode=alarm] button:focus-visible { outline-color: #8e8e8e; }
.check-flight-button {
  flex-shrink: 0;
  min-height: 40px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: .73rem;
  font-weight: 700;
}
.check-flight-button:disabled { opacity: .5; cursor: not-allowed; }

/* Statistics layout */
.statistics-page main { display: block; width: min(1360px, calc(100% - 64px)); padding: 0; background: transparent; }
.stats-panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 22px; }
.statistics-page .filters { display: flex; flex-wrap: wrap; gap: 18px; align-items: end; }
.filters label { display: flex; flex: 1; min-width: 150px; flex-direction: column; gap: 7px; font-size: 13px; font-weight: 700; }
.filters input, .filters select {
  font: inherit;
  min-height: 46px;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #ababab;
  border-radius: 8px;
}
.statistics-page #statistics button {
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  font-weight: 700;
}
.statistics-page #statistics button:disabled { opacity: .6; }
.statistics-page select:focus-visible, .statistics-page [tabindex]:focus-visible { outline: 3px solid #717171; outline-offset: 4px; }
#status { color: white; margin: 20px 0; }
#status[data-error=true] { color: #dcdcdc; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 24px 0; }
.stat-card { padding: 23px; border: 1px solid var(--line); border-radius: 16px; }
.stat-card span { display: block; color: var(--muted); font-size: 13px; }
.stat-card strong { display: block; font: 500 clamp(1.5rem, 2.2vw, 2.1rem) "Fira Code", monospace; margin: 12px 0 7px; }
.stat-card small { color: var(--muted); font-size: 12px; }
.charts { display: grid; gap: 22px; }
.charts .stats-panel { margin: 0; }
.statistics-page h2 { font-size: 19px; margin: 0 0 8px; }
.stats-panel p { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.chart-wrap { height: 290px; position: relative; margin-top: 24px; }
.charts { margin-bottom: 22px; }
.table-scroll { overflow: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: 13px; }
caption { text-align: left; color: var(--muted); padding: 10px 0; }
th { color: var(--muted); font-size: 12px; }
th, td { padding: 14px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
@media (max-width:950px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .charts { grid-template-columns: 1fr; }
}
@media (max-width:560px) {
  .statistics-page main { width: calc(100% - 28px); margin-top: 26px; }
  .statistics-page header { width: calc(100% - 28px); padding: 12px 16px; }
  .summary-grid { gap: 10px; }
  .stat-card { padding: 16px; }
  .stats-panel { padding: 18px; }
  .filters label { min-width: 100%; }
  .filters button { width: 100%; }
  .chart-wrap { height: 250px; }
}
@media (prefers-reduced-motion:reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* AID theme and navigation */
:root {
  --canvas: #000;
  --surface: #111;
  --ink: #fff;
  --muted: #aaa;
  --navy: #fff;
  --accent: #fff;
  --accent-hover: #ddd;
  --soft: #1a1a1a;
  --line: #2b2b2b;
  --danger: #fff;
  --radius: 16px;
  --shadow: 0 12px 48px #0006;
  color-scheme: dark;
}
html { scroll-behavior: smooth; scroll-padding-top: 115px; }
body { background: #000; color: var(--ink); }
::selection { background: #fff; color: #000; }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible, select:focus-visible {
  outline: 2px solid #fff !important;
  outline-offset: 5px;
}
#siteHeader {
  position: sticky;
  top: 18px;
  z-index: 20;
  width: min(1360px,calc(100% - 64px));
  min-height: 78px;
  margin: 24px auto 0;
  padding: 8px 22px;
  border: 1px solid #ffffff24;
  border-radius: 99px;
  background: linear-gradient(120deg,#ffffff12,#ffffff04 48%,#ffffff0a),#101010db;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: inset 0 1px 0 #ffffff15,0 12px 48px #0008;
  flex-wrap: nowrap;
}
#siteHeader .brand { width: 112px; flex-shrink: 0; }
#siteHeader .brand img { width: 112px; height: 60px; object-fit: contain; }
#siteHeader .navigation { margin: auto; }
#siteHeader #menuPanel { display: flex; flex-wrap: nowrap; gap: 8px; border: 0; padding: 0; }
#siteHeader #menuPanel a, #siteHeader #menuPanel button {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 12px 20px;
  border: 0;
  border-radius: 99px;
  font: 600 12px Manrope,sans-serif;
  color: #aaa;
  background: transparent;
  text-decoration: none;
  transition: background .22s,color .22s,box-shadow .22s;
}
#siteHeader #menuPanel [aria-current="page"] {
  color: #fff;
}
#menuPanel [aria-current="page"]::after { display: none; }
#siteHeader #menuPanel a:hover, #siteHeader #menuPanel button:hover { color: #fff; }
.pixel-icon {
  width: 23px;
  height: 23px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: square;
}
.dashboard main {
  width: min(1360px,calc(100% - 64px));
  margin: 0 auto;
  padding-top: 8px;
  grid-template-columns: minmax(0,1fr) 350px;
  gap: 20px;
}
.controls, .lower-panel, .camera-card, .stats-panel, .stat-card { background: #111; border-color: #2b2b2b; box-shadow: none; }
.controls { padding: 24px; }
h2 { letter-spacing: -.03em; }
.panel-heading .pixel-icon { color: #888; }
.camera { background: #060606; border: 1px solid #242424; border-radius: 8px; }
.camera::before {
  background: linear-gradient(#ffffff05 1px,transparent 1px),linear-gradient(90deg,#ffffff05 1px,transparent 1px);
  background-size: 48px 48px;
}
#feed { background: #000; }
.empty-icon { background: #111; border-color: #444; border-radius: 12px; box-shadow: 0 0 0 14px #ffffff03,0 0 0 15px #ffffff08; }
.empty-icon .pixel-icon { width: 32px; height: 32px; }
.preview-eyebrow { color: #aaa; font: 9px "Fira Code",monospace; letter-spacing: .15em; }
#cameraEmpty h3 { color: #fff; font-size: 28px; font-weight: 500; }
#cameraEmpty p { color: #999; font-size: 13px; }
.view-corner { border-color: #666; }
.camera-dot, body.online .camera-dot { background: #fff; box-shadow: 0 0 8px #ffffff30; }
.mini-icon, .alarm-control .mini-icon { background: #1a1a1a; border: 1px solid #333; border-radius: 8px; color: #ddd; }
.ui-icon, .telemetry-grid .ui-icon, .control-chevron { color: #aaa; stroke: currentColor; stroke-linecap: square; stroke-linejoin: miter; }
#fullscreen, .speaker { background: #1a1a1a; color: #ddd; border-color: #333; border-radius: 8px; }
.speaker:hover, .alarm-control:hover { background: #222; }
#connectCamera, #saveRoute, .check-flight-button, #uploadAlarm, #openServo, .statistics-page #statistics button {
  background: #fff;
  color: #000;
  border-color: #fff;
  box-shadow: none;
}
#connectCamera:hover, .check-flight-button:hover:not(:disabled), #saveRoute:hover { background: #ddd; color: #000; }
#disconnectButton:hover { color: #fff; }
.speaker[aria-pressed=true] { background: #444; box-shadow: 0 0 15px #ffffff18; }
.switch { background: #222; border-color: #555; color: #bbb; }
.switch i { background: #888; }
.switch[aria-checked=true] { background: #fff; color: #000; }
.switch[aria-checked=true] i { background: #000; }
.trip-controls button { min-height: 44px; border-radius: 7px; }
.control { min-height: 88px; }
.control-title, h3 { font-weight: 600; }
.telemetry-grid strong { letter-spacing: -.05em; }
.detection-panel, .detection-panel[data-state=warning] { background: #1a1a1a; color: #fff; border-color: #888; }
.detection-panel[data-state=warning] { border-width: 2px; border-style: dashed; }
dialog, .alarm-dialog[data-mode=alarm] { background: #111; color: #fff; border-color: #777; box-shadow: 0 30px 120px #000c; }
dialog::backdrop, .alarm-dialog[data-mode=alarm]::backdrop { background: #000b; backdrop-filter: blur(10px); }
dialog button, .alarm-dialog[data-mode=alarm] button { background: #1a1a1a; color: #fff; border-color: #444; }
.alarm-actions, .recording-upload, .alarm-dialog[data-mode=alarm] .recording-upload { background: #161616; border-color: #444; }
.alarm-dialog[data-mode=alarm] #openServo { background: #fff; color: #000; border-color: #fff; box-shadow: 0 0 20px #ffffff15; }
.alarm-dialog[data-mode=alarm] #alertLand { color: #fff; border-color: #777; }
.alarm-dialog[data-mode=alarm] p, .alarm-dialog[data-mode=alarm] #alarmDetails, .alarm-dialog[data-mode=alarm] #rescueStatus {
  color: #ccc;
}
.alert-symbol { color: #fff; filter: drop-shadow(0 0 20px #ffffff20); }
.alert-hero-caption { color: #aaa; }
.statistics-page main { margin: 8px auto 36px; }
.filters input, .filters select { background: #080808; border-color: #444; color: #fff; }
.stat-card { background: #111; }
th { background: #1a1a1a; }
tbody tr:hover { background: #1a1a1a; }
@media (max-width:1000px) {
  #siteHeader .navigation { margin: 0; }
  .dashboard main { grid-template-columns: minmax(0,1fr) 310px; }
}
@media (max-width:850px) {
  .dashboard main { grid-template-columns: 1fr; grid-template-areas: "camera" "controls" "telemetry"; }
}
@media (max-width:560px) {
  #siteHeader { width: calc(100% - 28px); margin-top: 14px; top: 10px; padding: 5px 12px; min-height: 66px; gap: 10px; }
  #siteHeader .brand, #siteHeader .brand img { width: 70px; height: 44px; }
  #siteHeader .navigation { width: auto; max-width: calc(100% - 80px); }
  #siteHeader #menuPanel { width: auto; gap: 4px; }
  #siteHeader #menuPanel a, #siteHeader #menuPanel button {
    padding: 8px 10px;
    min-height: 44px;
    gap: 5px;
    flex-direction: column;
    font-size: 8px;
  }
  #menuPanel .pixel-icon { width: 18px; height: 18px; }
  .dashboard main { width: calc(100% - 28px); margin: 0 auto; }
  .controls { padding: 20px; }
  .camera { min-height: 310px; height: 340px; }
  .camera-heading { padding: 14px 18px; }
}
@media (prefers-reduced-motion:reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (prefers-reduced-transparency:reduce) {
  #siteHeader { background: #161616; backdrop-filter: none; }
}
@media (forced-colors:active) {
  #siteHeader, .camera, button, a { border-color: CanvasText; }
}
@media (max-width:560px) {
  #siteHeader { flex-direction: row; align-items: center; justify-content: space-between; }
  #siteHeader .navigation { flex-direction: row; flex: 0 1 auto; }
}
#siteHeader .brand, #siteHeader .brand img { background: transparent; border-radius: 0; }
/* Pointer lighting, loading states and motion */
.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;
}
kbd {
  font: 9px "Fira Code",monospace;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 3px 5px;
  color: #aaa;
  background: #ffffff05;
  white-space: nowrap;
}
.charts { grid-template-columns: repeat(2,minmax(0,1fr)); }
.charts>.stats-panel, .chart-wrap { min-width: 0; }
@media (max-width:950px) {
  .charts { grid-template-columns: minmax(0,1fr); }
}
@media (hover:hover) and (prefers-reduced-motion:no-preference) {
  #menuPanel .pixel-icon, .mini-icon .pixel-icon, #speaker .pixel-icon, #fullscreen .pixel-icon {
    transition: transform .22s ease,filter .22s ease,color .22s ease;
    transform-origin: center;
  }
  #menuPanel a:hover .pixel-icon, #menuPanel button:hover .pixel-icon, .control:hover .mini-icon .pixel-icon, .audio-top:hover .mini-icon .pixel-icon, #speaker:hover:not(:disabled) .pixel-icon, #fullscreen:hover:not(:disabled) .pixel-icon {
    transform: translateY(-2px);
    color: #fff;
    filter: drop-shadow(0 0 5px #ffffff65);
  }
  .mini-icon { transition: border-color .22s ease,background .22s ease; }
  .control:hover .mini-icon, .audio-top:hover .mini-icon { border-color: #777; background: #222; }
}
.chart-interaction-hint { color: #aaa; font-size: 11px; line-height: 1.7; margin: 0 0 18px; }
button:not(:disabled) { transition: background .18s,border-color .18s,box-shadow .18s,transform .12s ease; }
button:active:not(:disabled) { transform: translateY(1px) scale(.98); }
button.switch:active:not(:disabled) { transform: translateY(1px); }
@media (prefers-reduced-motion:reduce) {
  button:active:not(:disabled) { transform: none; }
}
body { isolation: isolate; }
.stat-card strong { font-variant-numeric: tabular-nums; }
.chart-awaiting-growth { opacity:0; }
@media(prefers-reduced-motion:reduce) { .chart-awaiting-growth { opacity:1; } }
