.motion-setting-group {
  border-color: rgba(112, 232, 255, .32);
  background:
    radial-gradient(circle at 92% 10%, rgba(104, 226, 255, .11), transparent 32%),
    rgba(104, 226, 255, .035);
}

.motion-permission-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 7px;
  padding-top: 19px;
}

.motion-permission-actions button {
  min-height: 38px;
  padding: 8px 11px;
  font-size: 10px;
}

.motion-status {
  margin: 9px 0 11px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 9px;
  background: rgba(255, 255, 255, .045);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.motion-status.ok {
  border-color: rgba(120, 227, 107, .4);
  background: rgba(120, 227, 107, .08);
  color: #c9ffc5;
}

.motion-status.warning {
  border-color: rgba(255, 209, 102, .42);
  background: rgba(255, 209, 102, .08);
  color: #ffe9ad;
}

.motion-status.error {
  border-color: rgba(255, 93, 93, .42);
  background: rgba(255, 93, 93, .08);
  color: #ffd3d3;
}

.motion-note { max-width: 920px; }

.motion-flight-hud {
  position: absolute;
  z-index: 9;
  left: 50%;
  top: max(76px, env(safe-area-inset-top));
  width: min(390px, calc(100vw - 28px));
  transform: translateX(-50%);
  border: 1px solid rgba(104, 226, 255, .28);
  border-radius: 12px;
  padding: 8px 10px 9px;
  background: linear-gradient(145deg, rgba(5, 18, 29, .68), rgba(5, 18, 29, .42));
  box-shadow: 0 12px 36px rgba(0, 0, 0, .25);
  backdrop-filter: blur(9px);
  color: var(--ink);
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}

.motion-flight-hud.hidden {
  display: none;
}

.motion-flight-hud.is-stale {
  opacity: .72;
  border-color: rgba(255, 209, 102, .34);
}

.motion-hud-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.motion-hud-head > div { min-width: 0; }
.motion-hud-head span {
  display: block;
  color: var(--cyan);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.motion-hud-head strong {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: #eaf8ff;
  font-size: 10px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.motion-hud-head button {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 8px;
  padding: 6px 9px;
  background: rgba(255, 255, 255, .09);
  color: var(--ink);
  font-size: 9px;
  font-weight: 850;
  pointer-events: auto;
}

.motion-hud-gauges {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 7px;
}

.motion-gauge {
  position: relative;
  height: 22px;
  overflow: hidden;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(255, 209, 102, .16), rgba(104, 226, 255, .08) 50%, rgba(120, 227, 107, .16));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1);
}
.motion-gauge::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: rgba(255, 255, 255, .35);
}
.motion-gauge span {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  color: rgba(255, 255, 255, .7);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: .1em;
  transform: translate(-50%, -50%);
}
.motion-gauge i {
  position: absolute;
  z-index: 3;
  left: calc(50% - 4px);
  top: 3px;
  width: 8px;
  height: 16px;
  border-radius: 999px;
  background: #75e6ff;
  box-shadow: 0 0 10px rgba(117, 230, 255, .72);
  transition: transform 60ms linear;
}
.motion-gauge.pitch i {
  background: #ffd166;
  box-shadow: 0 0 10px rgba(255, 209, 102, .7);
}
.motion-gauge b {
  position: absolute;
  top: 4px;
  color: rgba(255, 255, 255, .48);
  font-size: 10px;
}
.motion-gauge b:first-of-type { left: 8px; }
.motion-gauge b:last-of-type { right: 8px; }

#mobileControls.motion-flight-mode #joystickBase::after {
  content: "KORKEUS";
  position: absolute;
  left: 50%;
  top: calc(100% + 4px);
  color: rgba(255, 255, 255, .65);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .12em;
  transform: translateX(-50%);
}

#mobileControls.motion-flight-active #joystickBase {
  border-color: rgba(104, 226, 255, .42);
  background: rgba(7, 18, 29, .24);
}

@media (pointer: coarse), (max-width: 900px) {
  .motion-flight-hud {
    top: max(62px, env(safe-area-inset-top));
    width: min(360px, calc(100vw - 170px));
    padding: 7px 8px;
  }
}

@media (max-width: 680px) {
  .motion-permission-actions { padding-top: 0; }
  .motion-flight-hud {
    left: 50%;
    top: max(58px, env(safe-area-inset-top));
    width: min(310px, calc(100vw - 24px));
  }
  .motion-hud-head strong { max-width: 210px; }
}

@media (orientation: landscape) and (max-height: 460px) {
  .motion-flight-hud {
    left: 60%;
    top: max(7px, env(safe-area-inset-top));
    width: min(320px, calc(100vw - 420px));
    min-width: 280px;
    padding: 5px 8px 6px;
  }
  .motion-hud-gauges { margin-top: 4px; }
  .motion-gauge { height: 18px; }
  .motion-gauge i { top: 2px; height: 14px; }
}


.motion-direction-select {
  display: grid;
  min-width: min(360px, 100%);
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.motion-direction-select select {
  min-height: 38px;
  text-transform: none;
}

/* Bird flight has automatic high cruise speed. Only the air-brake remains as
   a speed control; the same button becomes available again in ground modes. */
#mobileControls.constant-speed-flight #touchBoost { display: none !important; }
#mobileControls.constant-speed-flight .action-stack { grid-template-columns: repeat(2, 90px); }

/* In pure sensor mode both turn and pitch come from the phone. The joystick
   fades away while fresh sensor data is available and returns on timeout. */
#mobileControls.motion-pure-active #joystickBase {
  opacity: .12;
  pointer-events: none;
  transform: scale(.82);
}
#mobileControls.motion-pure-active #joystickBase::after { content: "VARAOHJAIN"; }

/* v4.5.2 — angular sensor model, live diagnostics and compatibility controls */
.motion-live-readout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 9px 0 12px;
}

.motion-live-readout > div {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 9px;
  background: rgba(0, 0, 0, .14);
}

.motion-live-readout span,
.motion-live-readout strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.motion-live-readout span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.motion-live-readout strong {
  margin-top: 3px;
  color: #eaf8ff;
  font: 700 11px/1.25 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.motion-axis-grid { margin-top: 10px; }
.motion-axis-grid label { min-width: 0; }
.motion-axis-grid select { min-height: 39px; }

@media (max-width: 760px) {
  .motion-live-readout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (orientation: landscape) and (max-height: 460px) {
  .motion-live-readout {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
  }
  .motion-live-readout > div { padding: 5px 6px; }
  .motion-live-readout strong { font-size: 9px; }
}
