@import url("https://fonts.googleapis.com/css2?family=Michroma&display=swap");

@font-face {
  font-family: "Ethnocentric";
  src: url("/assets/fonts/Ethnocentric-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --gap: 10px;
  --bg: #050607;
  --panel: #090b0d;
  --text: #f2f3f4;
  --accent: #4da3ff;
  --muted: #a3a8ad;
  --err: #ff6b6b;
  --chrome-border: rgb(255 255 255 / 15%);
  --chrome-line: rgb(255 255 255 / 10%);
  --chrome-sheen: rgb(255 255 255 / 8%);
  --font-ui: "Michroma", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --font-display: "Ethnocentric", "Michroma", system-ui, sans-serif;

  --key-bg: #ffffff;
  --key-border: #000000;
  --key-text: #000000;

  --blue-3d: #2f5997;
  --grey-view: #777777;
  --red-help: #e15c5c;
  --black-main: #111111;
  --green-cam: #64b592;

  --key-gap: 6px;
  --key-radius: 6px;
  --key-font:
    system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font:
    14px/1.45 var(--font-ui);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 52% 0%, rgb(148 163 184 / 14%), transparent 30%),
    linear-gradient(115deg, rgb(255 255 255 / 3.5%), transparent 35%),
    repeating-linear-gradient(
      90deg,
      rgb(255 255 255 / 1.8%) 0,
      rgb(255 255 255 / 1.8%) 1px,
      transparent 1px,
      transparent 120px
    );
  z-index: -1;
}

.wrap {
  display: flex;
  height: 100dvh;
  gap: var(--gap);
  padding: var(--gap);
  box-sizing: border-box;
  overflow: hidden;
}

.col {
  background: var(--panel);
  border: 1px solid var(--chrome-border);
  border-radius: 22px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-shadow:
    inset 0 1px 0 var(--chrome-sheen),
    0 24px 90px rgb(0 0 0 / 45%);
}

.col.video {
  flex: 1 1 auto;
  position: relative;
}

header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #090b0d;
  border-bottom: 1px solid var(--chrome-line);
}

header::before {
  content: "";
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #b8c7d2;
  box-shadow: 0 0 14px rgb(184 199 210 / 85%);
}

header h1 {
  font-family: var(--font-display);
  font-size: 13px;
  margin: 0;
  color: #f2f3f4;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.toolbar {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.servo-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px;
  border: 1px solid #273246;
  border-radius: 10px;
  background: #111720;
}

.servo-btn {
  padding-inline: 9px;
  white-space: nowrap;
}

.servo-status {
  max-width: 220px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.servo-status[data-state="error"] {
  color: var(--err);
}

.btn {
  background: linear-gradient(180deg, rgb(255 255 255 / 16%), rgb(255 255 255 / 3.5%));
  color: #f2f3f4;
  border: 1px solid rgb(255 255 255 / 25%);
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  box-shadow:
    0 0 18px rgb(184 199 210 / 12%),
    inset 0 1px 0 rgb(255 255 255 / 22%);
}

.btn:hover {
  border-color: rgb(255 255 255 / 45%);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  border-color: #2a3242;
  color: #93a2bf;
  background: #141a24;
}

.btn:disabled:hover {
  border-color: #2a3242;
}

#btnShare {
  display: none;
}

.hidden-ui-only {
  display: none !important;
}

#btnRecordStart,
#btnRecordStop,
#recStatus {
  display: none;
}

.video-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: #000;
}

#pilotVideo {
  width: 100%;
  height: 100%;
  background: #000;
  /* background: linear-gradient(
    45deg,
    red,
    orange,
    yellow,
    green,
    blue,
    indigo,
    violet,
    red
  ); */

  object-fit: cover;
}

.pilot-turn-timer {
  position: absolute;
  top: 14px;
  left: 50%;
  z-index: 45;
  min-width: 132px;
  padding: 7px 12px 8px;
  border: 1px solid rgb(170 194 226 / 34%);
  border-radius: 8px;
  background: rgb(8 12 18 / 72%);
  color: #f4f7fb;
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 28px rgb(0 0 0 / 28%);
}

.pilot-turn-timer.hidden {
  display: none;
}

.pilot-turn-timer-label {
  color: #aebdd4;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
}

.pilot-turn-timer-value {
  margin-top: 3px;
  color: #ffffff;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.pilot-turn-timer.is-ending {
  border-color: rgb(255 107 107 / 72%);
}

.pilot-turn-timer.is-ending .pilot-turn-timer-label,
.pilot-turn-timer.is-ending .pilot-turn-timer-value {
  color: var(--err);
}

.pilot-turn-timer.is-ending .pilot-turn-timer-value {
  font-size: 13px;
  text-transform: uppercase;
}

.pilot-turn-timer.is-expired {
  width: min(660px, calc(100vw - 40px));
  min-width: min(420px, calc(100vw - 40px));
  padding: clamp(20px, 4vw, 30px) clamp(22px, 6vw, 44px)
    clamp(22px, 4.5vw, 34px);
  border-color: rgb(255 107 107 / 58%);
}

.pilot-turn-timer.is-expired .pilot-turn-timer-value {
  color: var(--err);
  font-size: clamp(34px, 8vw, 65px);
  text-transform: uppercase;
}

#cvOverlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#detectionOverlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.detection-action-menu {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 18;
  pointer-events: auto;
}

.detection-action-menu.hidden {
  display: none;
}

.mission-counter {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 156px;
  padding: 7px 8px;
  border: 1px solid rgb(155 185 225 / 28%);
  border-radius: 8px;
  background: rgb(8 12 18 / 78%);
  box-shadow: 0 10px 28px rgb(0 0 0 / 28%);
  color: #f4f7fb;
  pointer-events: none;
  z-index: 12;
  backdrop-filter: blur(10px);
}

.mission-counter-title {
  margin-bottom: 5px;
  color: #cfe0ff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.mission-counter-grid {
  display: grid;
  gap: 3px;
  margin: 0;
}

.mission-counter-grid div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.mission-counter-grid dt {
  margin: 0;
  color: #aebdd4;
  font-size: 10px;
}

.mission-counter-grid dd {
  margin: 0;
  color: #ffffff;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: right;
}

.detection-action-card {
  min-width: 168px;
  padding: 8px;
  border: 1px solid rgba(255, 216, 77, 0.45);
  border-radius: 12px;
  background: rgba(14, 20, 27, 0.94);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(8px);
  display: grid;
  gap: 8px;
}

.detection-action-btn {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  color: #f3f7ff;
  font:
    13px/1.2 ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}

.detection-action-btn:hover,
.detection-action-btn:focus-visible {
  outline: none;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.34);
}

.detection-action-btn-secondary {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.04);
  color: #f3f7ff;
}

.detection-action-btn-secondary:hover,
.detection-action-btn-secondary:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.34);
}

.detection-debug {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 12;
  max-width: min(80vw, 720px);
  padding: 6px 10px;
  border: 1px solid rgba(170, 194, 226, 0.28);
  border-radius: 8px;
  background: rgba(12, 18, 25, 0.72);
  color: #d8e2f5;
  font:
    12px/1.4 ui-monospace,
    SFMono-Regular,
    Menlo,
    Consolas,
    monospace;
  pointer-events: none;
  backdrop-filter: blur(6px);
}

.chat-panel {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 20;
  width: min(175px, calc(100vw - 32px));
  max-height: min(44vh, 320px);
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(170, 194, 226, 0.28);
  border-radius: 12px;
  background: rgba(12, 18, 25, 0.4);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
}

.chat-panel.show {
  display: flex;
}

.chat-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.chat-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: #f1f6ff;
}

.chat-panel-status {
  margin-top: 2px;
  font-size: 11px;
  color: #9fb4d9;
}

.chat-close {
  border: 0;
  background: transparent;
  color: #d8e2f5;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.chat-messages {
  overflow-y: auto;
  min-height: 96px;
  max-height: min(30vh, 190px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}

.chat-empty {
  font-size: 12px;
  color: #9fb4d9;
  opacity: 0.85;
}

.chat-message {
  padding: 7px 9px;
  border: 1px solid rgba(170, 194, 226, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.chat-message.own {
  border-color: rgba(77, 163, 255, 0.32);
  background: rgba(77, 163, 255, 0.12);
}

.chat-message-meta {
  margin-bottom: 4px;
  font-size: 11px;
  color: #9fb4d9;
}

.chat-message-body {
  font-size: 12px;
  line-height: 1.4;
  color: #f3f7ff;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-form {
  display: flex;
  gap: 8px;
}

.chat-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid #2c384d;
  border-radius: 8px;
  background: rgba(8, 12, 18, 0.4);
  color: #f3f7ff;
  font-size: 12px;
}

.chat-input:disabled {
  opacity: 0.7;
}

.chat-send {
  flex: 0 0 auto;
}

#recStatus {
  font-size: 12px;
  color: #9fb4d9;
  margin-left: 8px;
}

.footer {
  padding: 10px 16px;
  background: #090b0d;
  border-top: 1px solid var(--chrome-line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hint {
  color: #70767c;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 1;
}

.status {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #1e2633;
  border: 1px solid #2c384d;
  font-size: 12px;
  display: none;
  z-index: 80;
}

.status.show {
  display: block;
}

.status.err {
  color: var(--err);
}

.kbd {
  display: inline-block;
  padding: 2px 6px;
  border: 1px solid #2c384d;
  border-radius: 6px;
  background: #0c1017;
  margin: 0 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 70%);
  backdrop-filter: blur(3px);
  display: none;
  z-index: 90;
}

.modal {
  position: fixed;
  inset: auto;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(1000px, calc(100vw - 32px));
  max-height: 80vh;
  overflow-x: visible;
  overflow-y: auto;
  background: #090b0d;
  border: 1px solid var(--chrome-border);
  border-radius: 22px;
  padding: 18px 18px 12px;
  display: none;
  z-index: 91;
  box-shadow:
    inset 0 1px 0 var(--chrome-sheen),
    0 24px 90px rgb(0 0 0 / 48%);
}

.modal-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal.show,
.modal-backdrop.show {
  display: block;
}

.modal h2 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 15px;
  color: #f2f3f4;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.kbd.key-blue {
  background-color: var(--blue-3d);
  color: #fff;
  border-color: var(--blue-3d);
}

.kbd.key-red {
  background-color: var(--red-help);
  color: #fff;
  border-color: var(--red-help);
}

.kbd.key-grey {
  background-color: var(--grey-view);
  color: #fff;
  border-color: var(--grey-view);
}

.kbd.key-black {
  background-color: var(--black-main);
  color: #fff;
  border-color: var(--black-main);
}

.kbd.key-cam {
  background-color: var(--green-cam);
  color: #fff;
  border-color: var(--green-cam);
}

.table-container {
  width: 700px;
  max-width: 100%;
  margin: 0 auto;
}

ul.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

ul.grid li {
  background: #0f1420;
  border: 1px solid #223049;
  border-radius: 8px;
  padding: 8px;
}

.takeoff {
  background-color: #b3b3b3;
  color: #0f1420;
  border: 1px solid #223049;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
}
.table-camera {
  background: #0f1420;
  border: 1px solid #223049;
  border-radius: 8px;
  padding: 8px;
  margin-top: 10px;
}

.takeoff .kbd {
  background: #0c1017;
  color: #f6f6f6;
}

.modal .foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.modal .foot label {
  margin-right: auto;
  font-size: 12px;
  opacity: 0.8;
}

.keyboard-container {
  display: flex;
  justify-content: center;
  width: 100%;
}

.keyboard {
  display: inline-flex;
  align-items: flex-end;
  padding: 16px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 30px rgb(0 0 0 / 60%);
  box-sizing: border-box;
  overflow: hidden;
}

.keyboard .main-keys {
  display: inline-block;
}

.keyboard .row {
  display: flex;
  margin-bottom: var(--key-gap);
}

.keyboard .row:last-child {
  margin-bottom: 0;
}

.keyboard .key {
  border: 2px solid var(--key-border);
  border-radius: var(--key-radius);
  background: var(--key-bg);
  color: var(--key-text);
  min-width: 35px;
  padding: 12px 6px;
  margin-right: var(--key-gap);
  text-align: center;
  font-size: 11px;
  line-height: 1;
  user-select: none;
  white-space: nowrap;
  font-family: var(--key-font);
}

.keyboard .key:last-child {
  margin-right: 0;
}

.keyboard .w-15 {
  flex: 1.5;
}

.keyboard .w-175 {
  flex: 1.75;
}

.keyboard .w-2 {
  flex: 2;
}

.keyboard .w-225 {
  flex: 2.25;
}

.keyboard .w-25 {
  flex: 2.5;
}

.keyboard .w-125 {
  flex: 1.25;
}

.keyboard .space {
  flex: 9;
}

.keyboard .key-3d,
.keyboard .arrow-3d {
  background: var(--blue-3d);
  color: #fff;
  border-color: var(--blue-3d);
}

.keyboard .key-view {
  background: var(--grey-view);
  color: #fff;
  border-color: var(--grey-view);
}

.keyboard .key-help {
  background: var(--red-help);
  color: #fff;
  border-color: var(--red-help);
}

.keyboard .key-main {
  background: var(--black-main);
  color: #fff;
  border-color: var(--black-main);
}

.keyboard .key-cam {
  background: var(--green-cam);
  color: #fff;
  border-color: var(--green-cam);
}

.keyboard .arrow-cluster {
  margin-left: 24px;
  display: grid;
  grid-template-columns: repeat(3, 38px);
  grid-template-rows: repeat(2, 38px);
  gap: var(--key-gap);
  justify-items: center;
  align-items: center;
}

.keyboard .arrow-key {
  border-radius: var(--key-radius);
  border: 2px solid var(--blue-3d);
  background: var(--blue-3d);
  color: #fff;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  user-select: none;
  font-family: var(--key-font);
}

.keyboard-caption {
  font-size: 13px;
  opacity: 0.8;
  color: #d9e6ff;
  text-align: center;
}

.pilot-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

.pilot-overlay.hidden {
  display: none;
}

.overlay-panel,
.overlay-wheel {
  pointer-events: auto;
}

.overlay-panel {
  background: rgba(175, 175, 175, 0.2);
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(5px);
}

.overlay-top-left {
  position: absolute;
  top: 22px;
  left: 16px;
}

.overlay-zoom-map-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.overlay-zoom-rail {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 150px;
  height: 44px;
  padding: 6px 8px;
  touch-action: none;
}

.drone-map-toggle {
  width: 46px;
  height: 58px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 15px;
  cursor: pointer;
  touch-action: manipulation;
}

.drone-map-toggle[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.28);
}

.drone-map-pin-icon {
  position: relative;
  width: 23px;
  height: 23px;
  border-radius: 50% 50% 50% 0;
  background: #ef443b;
  transform: rotate(-45deg);
  filter: drop-shadow(0 2px 3px rgb(0 0 0 / 36%));
}

.drone-map-pin-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgb(20 20 20 / 86%);
  transform: translate(-50%, -50%);
}

.overlay-zoom-key {
  width: 20px;
  height: 20px;
  font-size: 16px;
  background: transparent;
  color: rgb(230 230 230 / 72%);
  display: grid;
  place-items: center;
  pointer-events: none;
}

.overlay-zoom-track {
  position: relative;
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: rgb(0 0 0 / 20%);
}

.overlay-zoom-thumb {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 20px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  background: rgb(232 232 232 / 75%);
  transition:
    transform 80ms linear,
    background-color 80ms ease;
}

.overlay-logs-panel {
  position: absolute;
  top: 22px;
  left: 198px;
  z-index: 5;
  width: min(320px, calc(100vw - 214px));
  max-height: min(34vh, 260px);
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
}

.overlay-logs-panel.show {
  display: flex;
}

.overlay-logs-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.overlay-logs-title {
  color: rgb(241 246 255 / 94%);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.overlay-logs-close {
  border: 0;
  padding: 0;
  background: transparent;
  color: rgb(216 226 245 / 88%);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.overlay-logs-messages {
  overflow-y: auto;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}

.overlay-logs-empty {
  color: rgb(216 226 245 / 72%);
  font-size: 12px;
}

.overlay-log-entry {
  padding: 7px 9px;
  border: 1px solid rgba(170, 194, 226, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.overlay-log-meta {
  margin-bottom: 4px;
  color: rgb(159 180 217 / 88%);
  font-size: 10px;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.overlay-log-body {
  color: #f3f7ff;
  font-size: 12px;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}

.overlay-mini,
.overlay-stack-btn,
.overlay-rail-key {
  border: 0;
  border-radius: 8px;
  background: rgb(230 230 230 / 65%);
  color: rgb(29 29 29 / 55%);
  font-weight: 700;
  font-size: 24px;
  line-height: 1;
  width: 32px;
  height: 32px;
  padding: 0;
}

.overlay-mini {
  font-size: 24px;
}

.overlay-left-rail {
  position: absolute;
  top: 110px;
  left: 18px;
  width: 48px;
  height: 430px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 10px;
  touch-action: none;
}

.overlay-rail-key {
  width: 40px;
  height: 40px;
  background: transparent;
  color: rgb(230 230 230 / 65%);
}

.overlay-rail-track {
  position: relative;
  margin: 10px 0;
  width: 56px;
  flex: 1;
  background: transparent;
  touch-action: none;
}

.overlay-rail-track::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 10px;
  border-radius: 999px;
  background: rgb(0 0 0 / 20%);
  transform: translateX(-50%);
  pointer-events: none;
}

.overlay-rail-thumb {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 42px;
  height: 12px;
  z-index: 2;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  background: rgb(232 232 232 / 75%);
  pointer-events: none;
  transition:
    transform 80ms linear,
    background-color 80ms ease;
}

.overlay-rail-centerline {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  width: 20px;
  height: 14px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  transform: translate(-50%, -50%);
  cursor: pointer;
  touch-action: manipulation;
}

.overlay-rail-centerline::after {
  content: "";
  position: absolute;
  left: -8px;
  right: -8px;
  top: 50%;
  height: 3px;
  border-radius: 999px;
  transform: translateY(-50%);
  background: rgb(232 232 232 / 56%);
  transition:
    background-color 120ms ease,
    transform 120ms ease;
}

.overlay-rail-centerline:focus-visible::after,
.overlay-rail-centerline:hover::after {
  background: rgb(232 232 232 / 72%);
  transform: translateY(-50%) scaleX(1.03);
}

.overlay-letter-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.overlay-label-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.overlay-label-text {
  font-size: 8px;
  line-height: 1;
  letter-spacing: 0.02em;
  color: rgb(232 232 232 / 75%);
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
}

.overlay-right-group {
  position: absolute;
  top: 18px;
  right: 18px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.overlay-link-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 8px;
  pointer-events: none;
}

.overlay-link-row .overlay-letter-stack {
  gap: 4px;
}

.overlay-link-row .overlay-label-text {
  font-size: 7px;
}

.overlay-link-value {
  min-width: 42px;
  width: auto;
  height: 30px;
  padding: 0 4px;
  border-radius: 8px;
  background: rgb(230 230 230 / 65%);
  color: rgb(24 24 24 / 70%);
  font-weight: 700;
  font-size: 8px;
  line-height: 1;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}

.overlay-right-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
}

.overlay-stack-btn {
  width: 40px;
  height: 40px;
  font-size: 24px;
}

.overlay-record-duration {
  width: 40px;
  min-height: 14px;
  border-radius: 6px;
  background: rgb(17 17 17 / 50%);
  color: rgb(232 232 232 / 86%);
  font-weight: 700;
  font-size: 9px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
}

.overlay-compass {
  position: absolute;
  left: 50%;
  bottom: clamp(72px, 10vh, 132px);
  transform: translateX(-50%);
  width: clamp(108px, 9vw, 132px);
  height: clamp(108px, 9vw, 132px);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  pointer-events: none;
}

.overlay-compass-dial {
  position: relative;
  width: clamp(54px, 5vw, 68px);
  height: clamp(54px, 5vw, 68px);
  border-radius: 50%;
  background: rgb(0 0 0 / 18%);
  border: 1px solid rgb(255 255 255 / 22%);
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / 12%),
    0 8px 18px rgb(0 0 0 / 16%);
}

.overlay-compass-rose {
  position: absolute;
  inset: 0;
  transition: transform 140ms ease-out;
}

.overlay-compass-rose::before,
.overlay-compass-rose::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 999px;
  background: rgb(255 255 255 / 14%);
  transform: translate(-50%, -50%);
}

.overlay-compass-rose::before {
  width: 1px;
  height: calc(100% - 14px);
}

.overlay-compass-rose::after {
  width: calc(100% - 14px);
  height: 1px;
}

.overlay-compass-cardinal {
  position: absolute;
  font-size: clamp(9px, 0.7vw, 11px);
  line-height: 1;
  font-weight: 700;
  color: rgb(230 230 230 / 72%);
  text-shadow: 0 1px 0 rgb(0 0 0 / 25%);
}

.overlay-compass-cardinal-n {
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  color: rgb(255 230 140 / 96%);
}

.overlay-compass-cardinal-e {
  top: 50%;
  right: 7px;
  transform: translateY(-50%);
}

.overlay-compass-cardinal-s {
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
}

.overlay-compass-cardinal-w {
  top: 50%;
  left: 7px;
  transform: translateY(-50%);
}

.overlay-compass-pointer {
  position: absolute;
  left: 50%;
  top: 3px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 12px solid rgb(255 255 255 / 94%);
  transform: translateX(-50%);
  filter: drop-shadow(0 1px 2px rgb(0 0 0 / 30%));
}

.overlay-compass-center-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgb(255 255 255 / 88%);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px rgb(0 0 0 / 16%);
}

.overlay-compass-heading {
  font-size: clamp(10px, 0.9vw, 12px);
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgb(244 244 244 / 92%);
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgb(0 0 0 / 26%);
}

.overlay-compass[data-heading-state="unknown"] .overlay-compass-dial,
.overlay-compass[data-heading-state="unknown"] .overlay-compass-heading {
  opacity: 0.55;
}

.drone-map-overlay {
  position: absolute;
  top: 90px;
  left: 96px;
  width: clamp(280px, 32vw, 460px);
  aspect-ratio: 1.12;
  padding: 10px;
  border: 1px solid rgb(255 255 255 / 24%);
  border-radius: 8px;
  background: rgb(12 16 18 / 74%);
  box-shadow: 0 16px 36px rgb(0 0 0 / 28%);
  color: rgb(245 245 245 / 92%);
  z-index: 42;
  pointer-events: auto;
  transform-origin: top left;
  transition:
    opacity 120ms ease,
    transform 120ms ease;
}

.drone-map-overlay:not(.show) {
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  pointer-events: none;
}

.drone-map-overlay[data-telemetry-state="unknown"] {
  opacity: 0.6;
}

.drone-map-surface {
  position: relative;
  height: calc(100% - 42px);
  min-height: 250px;
  overflow: hidden;
  border-radius: 6px;
  background: rgb(18 24 24 / 92%);
}

.drone-map-surface .leaflet-container,
.drone-map-surface.leaflet-container {
  width: 100%;
  height: 100%;
  background: rgb(18 24 24);
  font-family: inherit;
}

.drone-map-surface .leaflet-control-attribution {
  background: rgb(0 0 0 / 52%);
  color: rgb(255 255 255 / 72%);
  font-size: 9px;
}

.drone-map-surface .leaflet-control-attribution a {
  color: rgb(190 232 255 / 86%);
}

.drone-map-surface .leaflet-control-zoom {
  border: 1px solid rgb(255 255 255 / 24%);
  box-shadow: 0 8px 20px rgb(0 0 0 / 22%);
}

.drone-map-surface .leaflet-control-zoom a {
  border: 0;
  background: rgb(18 24 24 / 88%);
  color: rgb(245 245 245 / 88%);
}

.drone-map-toolbar,
.drone-map-mission-panel,
.drone-map-waypoint-panel {
  position: absolute;
  z-index: 500;
}

.drone-map-toolbar {
  top: 8px;
  left: 8px;
  display: flex;
  gap: 4px;
  max-width: calc(100% - 16px);
}

.drone-map-recenter {
  border: 1px solid rgb(255 255 255 / 22%);
  border-radius: 6px;
  background: rgb(13 18 19 / 82%);
  color: rgb(245 245 245 / 88%);
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
}

.drone-map-recenter {
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 18px;
  line-height: 26px;
}

.drone-map-mission-panel {
  right: 8px;
  top: 44px;
  width: min(178px, calc(100% - 16px));
  padding: 8px;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 6px;
  background: rgb(13 18 19 / 78%);
  box-shadow: 0 12px 26px rgb(0 0 0 / 24%);
  font-size: 10px;
  font-weight: 800;
}

.drone-map-mission-title {
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.drone-map-route-id {
  margin-bottom: 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 9px;
  color: rgb(245 245 245 / 56%);
}

.drone-map-mission-grid {
  display: grid;
  gap: 4px;
  margin: 0;
}

.drone-map-mission-grid div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.drone-map-mission-grid dt,
.drone-map-waypoint-details dt {
  color: rgb(245 245 245 / 62%);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.drone-map-mission-grid dd,
.drone-map-waypoint-details dd {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
}

.drone-map-waypoint-panel {
  right: 8px;
  bottom: 24px;
  display: none;
  width: min(190px, calc(100% - 16px));
  padding: 8px;
  border: 1px solid rgb(255 255 255 / 22%);
  border-radius: 6px;
  background: rgb(12 16 18 / 86%);
  box-shadow: 0 12px 26px rgb(0 0 0 / 28%);
}

.drone-map-waypoint-panel.show {
  display: block;
}

.drone-map-waypoint-title {
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.drone-map-waypoint-details {
  display: grid;
  gap: 3px;
  margin: 0 0 7px;
}

.drone-map-waypoint-details div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.drone-map-marker {
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 25px solid rgb(255 227 92 / 96%);
  filter: drop-shadow(0 3px 5px rgb(0 0 0 / 45%));
  transform: rotate(0deg);
  transform-origin: 50% 62%;
  transition: transform 240ms ease;
  z-index: 2;
}

.drone-map-aircraft-icon {
  display: grid;
  place-items: center;
}

.drone-map-waypoint-icon {
  display: grid;
  place-items: center;
  border: 2px solid rgb(255 255 255 / 92%);
  border-radius: 50%;
  background: rgb(35 119 255 / 94%);
  box-shadow: 0 4px 10px rgb(0 0 0 / 36%);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.drone-map-waypoint-icon.is-selected,
.leaflet-marker-icon.is-selected .drone-map-waypoint-icon {
  border-color: rgb(255 227 92 / 96%);
  background: rgb(12 91 116 / 96%);
}

.drone-map-readout {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.drone-map-coords {
  margin-top: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  line-height: 1.1;
  color: rgb(245 245 245 / 68%);
}

.overlay-wheel {
  position: absolute;
  width: clamp(180px, 16vw, 300px);
  height: clamp(180px, 16vw, 300px);
  border-radius: 50%;
  overflow: hidden;
  background: rgba(175, 175, 175, 0.3);

  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.859);
  touch-action: none;
}

.overlay-wheel::before,
.overlay-wheel::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  height: 150%;
  /* background: rgb(34 34 34 / 54%); */
  background: rgba(255, 255, 255, 0.4);

  transform-origin: center;
  pointer-events: none;
}

.overlay-wheel::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.overlay-wheel::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.overlay-wheel-left {
  left: clamp(120px, 15vw, 280px);
  bottom: clamp(24px, 8vh, 72px);
}

.overlay-wheel-right {
  right: clamp(120px, 15vw, 280px);
  bottom: clamp(24px, 8vh, 72px);
}

.wheel-segment {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(184, 175, 175, 0.1);
  /* color: rgba(243, 0, 0, 0.74); */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 4px;
  font-weight: 700;
  z-index: 1;
  transition:
    transform 80ms ease,
    background-color 80ms ease,
    color 80ms ease;
}

.wheel-main {
  font-size: clamp(24px, 1.7vw, 34px);
  line-height: 1;
  color: rgb(232 232 232 / 95%);
  text-shadow: 0 1px 0 rgb(0 0 0 / 25%);
  position: relative;
  z-index: 2;
}

.wheel-sub {
  font-size: clamp(11px, 0.9vw, 16px);
  line-height: 1;
  color: rgb(224 224 224 / 70%);
  position: relative;
  z-index: 2;
}

.wheel-top {
  clip-path: polygon(50% 50%, 0 0, 100% 0);
  justify-content: flex-start;
  padding-top: 11%;
}

.wheel-right {
  clip-path: polygon(50% 50%, 100% 0, 100% 100%);
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10%;
}

.wheel-bottom {
  clip-path: polygon(50% 50%, 100% 100%, 0 100%);
  justify-content: flex-end;
  padding-bottom: 10%;
}

.wheel-left {
  clip-path: polygon(50% 50%, 0 100%, 0 0);
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  padding-left: 10%;
}

.wheel-center-mark {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 50px;
  color: rgb(220 220 220 / 55%);
  font-weight: 700;
  font-size: clamp(18px, 1.8vw, 34px);
  pointer-events: none;
  opacity: 1;
  z-index: 3;
}

.pilot-overlay .is-active.key-3d,
.pilot-overlay .is-active.key-blue {
  background: rgba(66, 109, 175, 0.65) !important;
  color: #fff !important;
}

.pilot-overlay .is-active.key-view,
.pilot-overlay .is-active.key-grey {
  background: rgb(119 119 119 / 50%) !important;
  color: #fff !important;
}

.pilot-overlay .is-active.key-main,
.pilot-overlay .is-active.key-black {
  background: rgba(17, 17, 17, 0.2) !important;
  color: #fff !important;
}

.pilot-overlay .is-active.key-cam {
  background: rgba(100, 181, 146, 0.75) !important;
  color: #fff !important;
}

.pilot-overlay .is-active.key-help,
.pilot-overlay .is-active.key-red {
  background: rgba(0, 0, 0, 0.1);
  color: #fff !important;
}

#overlayBtnT.is-active,
#overlayBtnL.is-active,
#overlayBtnR.is-active,
#overlayBtnH.is-active,
#overlayBtnU.is-active {
  background: rgb(17 17 17 / 92%) !important;
  color: #fff !important;
}

.overlay-rail-key.is-active {
  transform: translateY(-6px);
}

#overlayKeyS.is-active {
  transform: translateY(6px);
}

.overlay-rail-thumb.is-up {
  transform: translate(-50%, calc(-50% - 40%));
  background: rgb(119 119 119 / 95%);
}

.overlay-rail-thumb.is-down {
  transform: translate(-50%, calc(-50% + 40%));
  background: rgb(119 119 119 / 95%);
}

.overlay-mini.is-active,
.overlay-stack-btn.is-active,
.overlay-rail-key.is-active {
  background: rgb(230 230 230 / 95%);
  color: rgb(22 22 22 / 85%);
}

.pilot-overlay .is-blocked {
  background: rgba(220, 54, 54, 0.82) !important;
  border-color: rgba(255, 122, 122, 0.95) !important;
  color: #fff !important;
  box-shadow: 0 0 0 2px rgba(255, 122, 122, 0.34) !important;
}

.overlay-link-value[data-link-quality="good"] {
  color: rgb(18 57 24 / 88%);
  background: rgb(146 220 163 / 78%);
}

.overlay-link-value[data-link-quality="fair"] {
  color: rgb(64 46 0 / 88%);
  background: rgb(235 209 119 / 82%);
}

.overlay-link-value[data-link-quality="poor"] {
  color: rgb(96 56 18 / 88%);
  background: rgb(237 189 145 / 82%);
}

.overlay-link-value[data-link-quality="critical"] {
  color: rgb(96 18 18 / 88%);
  background: rgb(238 157 157 / 82%);
}

.overlay-link-value[data-link-quality="stale"] {
  color: rgb(37 41 49 / 88%);
  background: rgb(187 197 215 / 82%);
}

.overlay-link-value[data-link-quality="unknown"] {
  color: rgb(24 24 24 / 70%);
  background: rgb(230 230 230 / 65%);
}

.overlay-zoom-key.is-active {
  background: rgb(119 119 119 / 90%) !important;
  color: #fff !important;
}

.pilot-overlay .overlay-cam-key.is-active {
  background: rgba(100, 181, 146, 0.224) !important;
  color: #fff !important;
}

@media (max-width: 960px) {
  .modal {
    width: min(680px, calc(100vw - 32px));
  }

  .table-container {
    width: 100%;
  }

  ul.grid {
    grid-template-columns: 1fr;
  }

  .pilot-overlay {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }

  .overlay-center {
    grid-column: 1 / -1;
    order: 3;
  }

  .overlay-stick {
    width: min(32vw, 150px);
  }

  .overlay-actions {
    width: min(420px, 90vw);
  }

  .overlay-right-group {
    gap: 6px;
  }

  .overlay-link-row {
    gap: 4px;
    padding: 8px 6px;
  }

  .overlay-link-value {
    min-width: 34px;
    height: 26px;
    padding: 0 3px;
    font-size: 7px;
  }

  .overlay-stack-btn {
    width: 36px;
    height: 36px;
  }

  .overlay-stack-btn {
    font-size: 22px;
  }

  .overlay-compass {
    bottom: clamp(66px, 9vh, 112px);
    width: clamp(94px, 20vw, 108px);
    height: clamp(94px, 20vw, 108px);
  }

  .overlay-compass-heading {
    font-size: 9px;
  }
}

@media (max-width: 620px) {
  header {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar {
    width: 100%;
  }

  .overlay-gimbal {
    height: 140px;
  }

  .overlay-actions {
    grid-template-columns: 1fr;
  }

  .chat-panel {
    right: 8px;
    left: 8px;
    width: auto;
    max-height: 50vh;
  }

  .mission-counter {
    right: 8px;
    bottom: 8px;
    width: 148px;
    padding: 6px 7px;
  }

  .mission-counter-grid {
    gap: 4px;
  }

  .mission-counter-grid dt {
    font-size: 10px;
  }

  .mission-counter-grid dd {
    font-size: 11px;
  }

  .overlay-top-left,
  .overlay-logs-panel {
    left: 8px;
  }

  .overlay-top-left {
    top: 14px;
  }

  .overlay-logs-panel {
    top: 64px;
    width: min(300px, calc(100vw - 16px));
    max-height: min(38vh, 240px);
  }
}
