/* Material 3 Expressive — Shared styles */
/* Used by both Electron and web versions */

:root {
  /* M3 Color Roles (dark mode defaults — overridden dynamically by applyTheme) */
  --md-primary: #00cc44;
  --md-on-primary: #ffffff;
  --md-primary-container: rgba(0, 204, 68, 0.15);
  --md-on-primary-container: #00cc44;
  --md-surface: #121212;
  --md-surface-container: rgba(20, 34, 25, 0.78);
  --md-surface-container-solid: rgb(20, 34, 25);
  --md-surface-container-highest: rgba(36, 50, 41, 0.28);
  --md-on-surface: #e0e0e0;
  --md-on-surface-variant: rgba(255, 255, 255, 0.6);
  --md-on-surface-disabled: rgba(255, 255, 255, 0.25);
  --md-outline: rgba(255, 255, 255, 0.3);
  --md-outline-variant: rgba(255, 255, 255, 0.12);

  /* M3 Shape tokens */
  --md-shape-xs: 4px;
  --md-shape-sm: 8px;
  --md-shape-md: 12px;
  --md-shape-lg: 16px;
  --md-shape-xl: 28px;
  --md-shape-full: 9999px;

  /* M3 Elevation shadows */
  --md-elevation-1: 0 1px 3px 1px rgba(0,0,0,0.15), 0 1px 2px 0 rgba(0,0,0,0.3);
  --md-elevation-2: 0 2px 6px 2px rgba(0,0,0,0.15), 0 1px 2px 0 rgba(0,0,0,0.3);
  --md-elevation-3: 0 4px 8px 3px rgba(0,0,0,0.15), 0 1px 3px 0 rgba(0,0,0,0.3);

  /* M3 Motion */
  --md-motion-easing-standard: cubic-bezier(0.2, 0, 0, 1);
  --md-motion-easing-emphasized: cubic-bezier(0.2, 0, 0, 1);
  --md-motion-easing-spring: cubic-bezier(0.35, 1.5, 0.65, 1);
  --md-motion-duration-short: 150ms;
  --md-motion-duration-medium: 300ms;
  --md-motion-duration-long: 500ms;

  /* M3 Type scale */
  --md-typescale-body-small: 500 14px/19px 'Roboto Flex', sans-serif;
  --md-typescale-body-medium: 400 15px/21px 'Roboto Flex', sans-serif;
  --md-typescale-body-large: 400 17px/25px 'Roboto Flex', sans-serif;
  --md-typescale-label-small: 500 13px/17px 'Roboto Flex', sans-serif;
  --md-typescale-label-medium: 500 14px/19px 'Roboto Flex', sans-serif;
  --md-typescale-label-large: 500 15px/21px 'Roboto Flex', sans-serif;
  --md-typescale-title-medium: 500 17px/25px 'Roboto Flex', sans-serif;
  --md-typescale-title-large: 500 23px/29px 'Roboto Flex', sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--md-surface);
  color: var(--md-on-surface);
  font-family: 'Roboto Flex', sans-serif;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

#cesiumContainer {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

/* Hide default Cesium UI elements we don't need */
.cesium-viewer-toolbar,
.cesium-viewer-animationContainer,
.cesium-viewer-timelineContainer,
.cesium-viewer-fullscreenContainer,
.cesium-viewer-vrContainer,
.cesium-viewer-geocoderContainer,
.cesium-viewer-infoBoxContainer,
.cesium-viewer-selectionIndicatorContainer,
.cesium-viewer-bottom,
.cesium-credit-logoContainer,
.cesium-credit-expand-link,
.cesium-widget-credits {
  display: none !important;
}

/* Override Cesium credit bar */
.cesium-viewer .cesium-widget-credits {
  display: none !important;
}

/* HUD */
#hud {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  pointer-events: none;
}

#hud-stats {
  display: flex;
  gap: 10px;
  padding: 10px 16px;
  font: var(--md-typescale-label-small);
  color: var(--md-on-surface-variant);
  white-space: nowrap;
}

#clock {
  font: var(--md-typescale-label-medium);
  font-weight: 500;
}

.hud-sep {
  opacity: 0.35;
}

#hud-instructions {
  position: fixed;
  bottom: 16px;
  right: 16px;
  text-align: right;
  font: var(--md-typescale-label-small);
  color: var(--md-on-surface-variant);
  line-height: 1.6;
  pointer-events: none;
  z-index: 10;
}

#throttle-warning {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: #93000a;
  color: #ffdad6;
  text-align: center;
  padding: 6px 16px;
  font: var(--md-typescale-label-medium);
  font-weight: 500;
}

#throttle-warning.hidden { display: none; }
#throttle-warning:not(.hidden) ~ #flight-search-wrap {
  top: 46px;
}


/* Controls Panel */
#controls {
  position: absolute;
  bottom: 16px;
  left: 16px;
  z-index: 100;
  background: var(--md-surface-container);
  border-radius: var(--md-shape-lg);
  padding: 14px 22px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font: var(--md-typescale-label-medium);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  overflow: visible;
  transition: transform var(--md-motion-duration-medium) var(--md-motion-easing-emphasized);
}

/* Controls handle: vertical bar on the right edge (desktop) */
#controls > .sheet-handle {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 54px;
  margin: 0;
}

#controls.collapsed {
  transform: translateX(calc(-100% + 20px));
}

.control-group {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

#controls .control-group:last-child {
  border-top: 1px solid var(--md-outline-variant);
  padding-top: 10px;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.toggle-label input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--md-outline);
  border-radius: var(--md-shape-xs);
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: background var(--md-motion-duration-short) var(--md-motion-easing-standard),
              border-color var(--md-motion-duration-short) var(--md-motion-easing-standard);
}

.toggle-label input[type="checkbox"]:checked {
  background: var(--md-primary);
  border-color: var(--md-primary);
}

.toggle-label input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 5px;
  width: 5px;
  height: 9px;
  border: solid var(--md-on-primary);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.toggle-label input[type="checkbox"]:disabled {
  border-color: var(--md-on-surface-disabled);
  background: transparent;
  cursor: default;
}

.toggle-label input[type="checkbox"]:checked:disabled {
  background: var(--md-on-surface-disabled);
  border-color: var(--md-on-surface-disabled);
}

.toggle-label:has(input[type="checkbox"]:disabled) {
  color: var(--md-on-surface-disabled);
  cursor: default;
}

.theme-light .toggle-label input[type="checkbox"]:not(:checked) {
  background: #ffffff;
}

.range-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 4px;
  background: var(--md-outline-variant);
  border-radius: var(--md-shape-full);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--md-primary);
  cursor: pointer;
  box-shadow: var(--md-elevation-1);
  transition: transform var(--md-motion-duration-short) var(--md-motion-easing-spring);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.map-layer-label-text {
  font-family: 'Roboto Flex', sans-serif;
  font-size: 14px;
  color: var(--md-on-surface);
  opacity: 0.7;
  margin-left: 12px;
}

/* Custom map layer dropdown */
.map-layer-select {
  position: relative;
}

.map-layer-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--md-surface);
  color: var(--md-on-surface);
  border: 1px solid var(--md-outline);
  border-radius: var(--md-shape-sm);
  padding: 6px 8px;
  min-height: 36px;
  font-family: 'Roboto Flex', sans-serif;
  font-size: 14px;
  cursor: pointer;
  outline: none;
  transition: border-color var(--md-motion-duration-short) var(--md-motion-easing-standard);
}

.map-layer-btn:focus,
.map-layer-select.open .map-layer-btn {
  border-color: var(--md-primary);
}

.map-layer-chevron {
  opacity: 0.6;
  flex-shrink: 0;
  transition: transform var(--md-motion-duration-short) var(--md-motion-easing-standard);
}

.map-layer-select.open .map-layer-chevron {
  transform: rotate(180deg);
}

.map-layer-menu {
  display: none;
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  background: var(--md-surface-container-solid);
  border-radius: var(--md-shape-md);
  box-shadow: 0 2px 6px 2px rgba(0,0,0,0.18), 0 1px 2px rgba(0,0,0,0.28);
  padding: 4px 0;
  z-index: 200;
  overflow: hidden;
}

.map-layer-select.open .map-layer-menu {
  display: block;
}

.map-layer-option {
  padding: 10px 16px;
  font-family: 'Roboto Flex', sans-serif;
  font-size: 14px;
  color: var(--md-on-surface);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--md-motion-duration-short) var(--md-motion-easing-standard);
}

.map-layer-option:hover {
  background: color-mix(in srgb, var(--md-on-surface) 8%, transparent);
}

.map-layer-option.selected {
  color: var(--md-primary);
  background: color-mix(in srgb, var(--md-primary) 12%, transparent);
}

.map-layer-divider {
  height: 1px;
  margin: 4px 12px;
  background: color-mix(in srgb, var(--md-on-surface) 12%, transparent);
}

.scope-btn {
  background: #000000;
  border: none;
  border-radius: var(--md-shape-full);
  color: var(--md-on-surface);
  padding: 0 16px;
  min-height: 40px;
  font-family: 'Roboto Flex', sans-serif;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--md-motion-duration-short) var(--md-motion-easing-standard),
              color var(--md-motion-duration-short) var(--md-motion-easing-standard);
}

.scope-btn:hover {
  background: var(--md-surface-container-highest);
}

.scope-btn:active {
  background: var(--md-outline-variant);
}

.scope-btn.active {
  background: var(--md-primary);
  color: #000000;
}

.theme-light .scope-btn {
  background: #ffffff;
}

.theme-light .scope-btn:hover {
  background: #f0f0f0;
}

.theme-light .scope-btn:active {
  background: #e4e4e4;
}

.theme-light .scope-btn.active {
  background: var(--md-primary);
  color: #ffffff;
}

.scope-btn:disabled {
  opacity: 0.38;
  cursor: default;
  pointer-events: none;
}

.scope-btn-group {
  display: inline-flex;
  border-radius: var(--md-shape-full);
  background: var(--md-surface-container-highest);
  padding: 3px;
  gap: 2px;
}

.scope-btn-group .scope-btn:not(.active) {
  background: transparent;
}

.theme-light .scope-btn-group {
  background: #ffffff;
}

.theme-light .scope-btn-group .scope-btn:not(.active) {
  background: transparent;
}

/* Panel shadow overlays — ::after with z-index: 0 paints the shadow ON TOP of
   the z-index: -1 toggle tabs, so the panel appears to cast a shadow on them. */
#controls::after,
#aircraft-info::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: var(--md-elevation-2);
  pointer-events: none;
  z-index: 0;
}


#info-collapsible {
  overflow: hidden;
  transition: max-height var(--md-motion-duration-medium) var(--md-motion-easing-emphasized),
              opacity var(--md-motion-duration-medium) var(--md-motion-easing-standard);
  max-height: 800px; /* must exceed tallest possible content */
  opacity: 1;
}

#aircraft-info.collapsed #info-collapsible {
  max-height: 0;
  opacity: 0;
}

#aircraft-info.collapsed #info-callsign {
  margin-bottom: 0;
}

/* Aircraft Info Panel */
#aircraft-info {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 100;
  background: var(--md-surface-container);
  border-radius: var(--md-shape-xl);
  padding: 20px 20px 10px;
  min-width: 240px;
  font: var(--md-typescale-body-small);
  line-height: 1.6;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  overflow: visible;
}

#aircraft-info > .sheet-handle {
  margin: 14px auto 0;
}

#aircraft-info.hidden {
  display: none;
}

#info-close,
#settings-close {
  font-size: 29px;
  font-weight: 400;
  padding: 0;
  width: 40px;
}

#info-close {
  position: absolute;
  top: 10px;
  right: 10px;
}

#info-callsign {
  font: var(--md-typescale-title-medium);
  font-weight: 500;
  color: var(--md-on-surface);
  margin-bottom: 8px;
}

#info-details {
  color: var(--md-on-surface);
}

#info-details div {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--md-outline-variant);
  padding: 3px 0;
}

#info-details div:last-child {
  border-bottom: none;
}

#info-details .label {
  color: var(--md-on-surface-variant);
  margin-right: 8px;
}

#info-buttons {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

#info-buttons.hidden { display: none; }

#info-buttons .scope-btn {
  flex: 1;
}

/* Flight search wrapper */
#flight-search-wrap {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: 420px;
  transition: top 0.3s ease;
}

/* Flight search input */
#flight-search-bar {
  display: flex;
  align-items: center;
  gap: 0;
}

#flight-search {
  flex: 1;
  min-width: 0;
  background: var(--md-surface-container-solid);
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-shape-full) 0 0 var(--md-shape-full);
  color: var(--md-on-surface);
  padding: 0 20px;
  height: 48px;
  font-family: 'Roboto Flex', sans-serif;
  font-size: 15px;
  outline: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.search-history-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--md-surface-container-solid);
  border: 1px solid var(--md-outline-variant);
  border-left: none;
  border-radius: 0 var(--md-shape-full) var(--md-shape-full) 0;
  color: var(--md-on-surface-variant);
  cursor: pointer;
  padding: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  flex-shrink: 0;
}

.search-history-btn:hover,
.search-history-btn:active,
.search-history-btn:focus {
  background: var(--md-surface-container-solid);
  color: var(--md-on-surface);
  outline: none;
  filter: brightness(1.4);
}

.theme-light .search-history-btn {
  background: #ffffff;
}

.theme-light .search-history-btn:hover,
.theme-light .search-history-btn:active,
.theme-light .search-history-btn:focus {
  background: #f0f0f0;
  filter: none;
}

#flight-search:focus {
  border-color: var(--md-outline-variant);
}

.theme-light #flight-search {
  background: #ffffff;
}

#flight-search::placeholder {
  color: var(--md-on-surface-variant);
}

/* Flight search results dropdown */
#flight-results {
  margin-top: 4px;
  background: var(--md-surface-container);
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-shape-lg);
  max-height: 320px;
  overflow-y: auto;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: var(--md-elevation-3);
  /* Standard scrollbar (Firefox, future browsers) */
  scrollbar-width: thin;
  scrollbar-color: rgba(73, 69, 79, 0.28) transparent;
}

/* Chromium scrollbar — M3-aligned (thin, rounded, themed) */
#flight-results::-webkit-scrollbar {
  width: 8px;
}

#flight-results::-webkit-scrollbar-track {
  background: transparent;
}

#flight-results::-webkit-scrollbar-thumb {
  background: rgba(73, 69, 79, 0.28);
  border-radius: 100px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

#flight-results::-webkit-scrollbar-thumb:hover {
  background: rgba(73, 69, 79, 0.48);
  background-clip: padding-box;
}

.theme-dark #flight-results {
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.theme-dark #flight-results::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  background-clip: padding-box;
}

.theme-dark #flight-results::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.32);
  background-clip: padding-box;
}

#flight-results.hidden {
  display: none;
}

.theme-light #flight-results {
  background: #ffffff;
}

.flight-result-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--md-outline-variant);
  font: var(--md-typescale-body-small);
}

.flight-result-item:last-child {
  border-bottom: none;
}

.flight-result-item:hover {
  background: var(--md-surface-container-highest);
}

.flight-result-badge {
  font: var(--md-typescale-label-small);
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--md-shape-xs);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 72px;
  text-align: center;
}

.badge-enroute {
  background: rgba(0, 204, 68, 0.2);
  color: var(--md-primary);
}

.badge-upcoming {
  background: rgba(66, 165, 245, 0.2);
  color: #42A5F5;
}

.badge-past {
  background: rgba(255, 255, 255, 0.08);
  color: var(--md-on-surface-variant);
}

.theme-light .badge-past {
  background: rgba(0, 0, 0, 0.06);
}

.flight-result-ident {
  font-weight: 600;
  white-space: nowrap;
  min-width: 60px;
}

.flight-result-route {
  color: var(--md-on-surface-variant);
  flex: 1;
}

.flight-result-time {
  color: var(--md-on-surface-variant);
  font-size: 12px;
  white-space: nowrap;
}

/* Search history items */
.search-history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--md-outline-variant);
  font: var(--md-typescale-body-small);
  color: var(--md-on-surface);
}

.search-history-item:last-child {
  border-bottom: none;
}

.search-history-item:hover {
  background: var(--md-surface-container-highest);
}

.search-history-item svg {
  flex-shrink: 0;
  color: var(--md-on-surface-variant);
}

.search-history-ident {
  font-weight: 600;
  flex: 1;
}

.search-history-empty {
  padding: 14px;
  text-align: center;
  color: var(--md-on-surface-variant);
  font: var(--md-typescale-body-small);
}

/* Flight Plan Timeline Scrubber */
#timeline-panel {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: var(--md-surface-container);
  border-radius: var(--md-shape-xl);
  padding: 12px 20px;
  min-width: 460px;
  max-width: 690px;
  box-shadow: var(--md-elevation-2);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

#timeline-panel.hidden {
  display: none;
}

#timeline-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 12px;
  row-gap: 2px;
}

#timeline-origin  { grid-column: 1; grid-row: 1; }
#timeline-track   { grid-column: 2; grid-row: 1; display: flex; align-items: center; gap: 6px; }
#timeline-dest    { grid-column: 3; grid-row: 1; }

.timeline-delay-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: lime;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.4);
}
#origin-weather   { grid-column: 1; grid-row: 2; }
#timeline-time    { grid-column: 2; grid-row: 2; text-align: center; }
#dest-weather     { grid-column: 3; grid-row: 2; }

.timeline-airport {
  font: var(--md-typescale-label-large);
  font-weight: 600;
  color: var(--md-primary);
  min-width: 32px;
  text-align: center;
  white-space: nowrap;
}

.timeline-weather {
  font: var(--md-typescale-body-small);
  color: var(--md-on-surface-variant);
  white-space: nowrap;
  text-align: center;
  min-height: 1em;
}

#timeline-slider {
  width: 100%;
  min-width: 180px;
  height: 8px;
}

#timeline-slider::-webkit-slider-thumb {
  background: transparent;
  border: 3px solid var(--md-primary);
  box-shadow: none;
}

#timeline-slider::-moz-range-thumb {
  background: transparent;
  border: 3px solid var(--md-primary);
  box-shadow: none;
}

#timeline-info {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 6px;
}

#timeline-time {
  font: var(--md-typescale-body-small);
  color: var(--md-on-surface-variant);
  white-space: nowrap;
  min-height: 1em;
}

/* Sheet handle pill — embedded toggle bar with enlarged hit area via ::before */
.sheet-handle {
  position: relative;
  width: 54px;
  height: 4px;
  background: var(--md-on-surface-variant);
  border-radius: 2px;
  margin: 0 auto;
  opacity: 0.4;
  display: block;
  flex-shrink: 0;
  cursor: pointer;
  transition: opacity var(--md-motion-duration-short) var(--md-motion-easing-standard);
}

.sheet-handle::before {
  content: '';
  position: absolute;
  inset: -10px -16px;
}

.sheet-handle:hover {
  opacity: 0.7;
}

/* Settings icon button — square icon variant of scope-btn, centered */
.scope-btn-icon {
  padding: 0;
  width: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Settings button always right-justified in the controls row */
#btn-settings {
  margin-left: 12px;
}

.timeline-live-btn {
  font-size: 12px;
  min-height: 28px;
  padding: 0 12px;
}

/* ============================================================
   Mobile layout (portrait / narrow screens)
   ============================================================ */

@media (max-width: 767px) {
  /* Hide keyboard/mouse interaction hints */
  #hud-instructions {
    display: none;
  }

  /* Full-width search bar */
  #flight-search-wrap {
    width: calc(100% - 32px);
  }


  /* ---- Bottom sheet wrapper: timeline stacks above controls ---- */
  #bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform var(--md-motion-duration-medium) var(--md-motion-easing-emphasized);
  }

  #bottom-sheet.collapsed {
    /* Slide down leaving the handle bar visible (≈ 36px) */
    transform: translateY(calc(100% - 36px));
  }

  /* Controls: static inside flex column, full width, top corners rounded */
  #controls {
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
    width: 100%;
    max-width: none;
    border-radius: var(--md-shape-xl) var(--md-shape-xl) 0 0;
    font: var(--md-typescale-label-large);
    padding-top: 12px;
  }

  /* Suppress the leftward-slide collapse (wrapper handles hide on mobile) */
  #controls.collapsed {
    transform: none;
  }

  /* Revert handle to horizontal bar at top on mobile */
  #controls > .sheet-handle {
    position: static;
    width: 54px;
    height: 4px;
    transform: none;
    margin: 0 auto 10px;
  }

  /* Timeline: floats just above the bottom sheet, moves with it during transition */
  #timeline-panel {
    position: absolute;
    bottom: 100%;
    left: 8px;
    right: 8px;
    transform: none;
    width: auto;
    max-width: none;
    min-width: unset;
    border-radius: var(--md-shape-xl);
    margin-bottom: 8px;
  }

  /* ---- Aircraft info: full-width top sheet ---- */
  #aircraft-info {
    top: 0;
    left: 0;
    right: 0;
    min-width: unset;
    border-radius: 0 0 var(--md-shape-xl) var(--md-shape-xl);
    padding-bottom: 12px;
    transition: transform var(--md-motion-duration-medium) var(--md-motion-easing-emphasized);
  }

  /* Collapse upward leaving handle bar visible at top of screen */
  #aircraft-info.mob-collapsed {
    transform: translateY(calc(-100% + 36px));
  }

  /* Match control panel proportions: 12px padding at panel edge, 20px to handle
     Total bottom strip = 12 + 20 + 4px pill = 36px = exact stowed reveal height */
  /* Handle sits at bottom of the aircraft info panel */
  #aircraft-info .sheet-handle {
    margin: 20px auto 0;
  }

  /* Hide 2D/3D buttons, North up, and Auto rotate on mobile */
  .scope-btn-group,
  #btn-north,
  label:has(#toggle-rotate) {
    display: none;
  }

  /* Larger checkboxes for touch targets */
  .toggle-label input[type="checkbox"] {
    width: 22px;
    height: 22px;
  }

  /* Search bar shifts down when aircraft info panel is stowed (showing handle only) */
  body:has(#aircraft-info.mob-collapsed) #flight-search-wrap {
    top: 44px;
  }
}
