/* Layout target: DJI RC Pro/RC 2 (5.5 in, 16:9) and RC Plus family (7 in, 16:10). */
html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

main {
  width: 100%;
  overflow: hidden;
}

#dashboard {
  height: 100%;
}

@media (orientation: landscape) {
  body {
    min-width: 0;
  }

  .login-panel {
    height: min(360px, calc(100dvh - 32px));
    min-height: 0;
    margin: max(16px, calc((100dvh - 396px) / 2)) auto;
  }

  .flight-layout {
    grid-template-columns: minmax(0, 1.65fr) minmax(260px, 0.75fr);
    height: calc(100dvh - 74px);
  }
}

/* Compact 5.5-inch controls and WebViews that report a 540–600 px CSS height. */
@media (orientation: landscape) and (max-height: 640px) {
  main {
    padding: 10px 16px;
  }

  .login-panel {
    grid-template-columns: minmax(210px, 1fr) minmax(250px, 330px);
    gap: 22px;
    height: calc(100dvh - 20px);
    margin: 10px auto;
    padding: 20px 28px;
  }

  .login-panel .brand {
    display: none;
  }

  .login-copy p:last-child {
    margin-top: 10px;
    font-size: 13px;
  }

  .topbar {
    height: 34px;
    margin-bottom: 8px;
  }

  .brand {
    font-size: 10px;
  }

  .brand-mark {
    width: 21px;
    height: 21px;
  }

  .connection-status,
  .secondary-button {
    padding: 5px 8px;
  }

  .flight-layout {
    height: calc(100dvh - 52px);
    gap: 10px;
  }

  .flight-card,
  .widget-card {
    padding: 18px 20px;
  }

  h1 {
    font-size: 25px;
  }

  h2 {
    font-size: 18px;
  }

  .flight-description,
  .widget-card > p:not(.eyebrow) {
    margin-top: 9px;
    font-size: 12px;
    line-height: 1.4;
  }

  .flight-steps {
    gap: 8px;
    padding-top: 14px;
  }

  .flight-steps > div {
    padding: 9px;
  }

  .step-icon {
    width: 20px;
    height: 20px;
    margin-bottom: 6px;
  }
}

/* Keep the two-panel cockpit even on a narrow landscape WebView. */
@media (orientation: landscape) and (max-width: 760px) {
  .login-panel {
    grid-template-columns: minmax(180px, 1fr) minmax(220px, 0.9fr);
    padding: 18px 22px;
  }

  .flight-layout {
    grid-template-columns: minmax(0, 1.25fr) minmax(210px, 0.75fr);
  }

  .user-chip {
    max-width: 120px;
  }

  .flight-steps small {
    display: none;
  }
}
