:root {
  --bg: #0e1114;
  --chrome: #1a1a1a;
  --chrome-2: #222226;
  --card: #2b2b2f;
  --panel: rgba(26, 26, 26, 0.94);
  --panel-solid: #1a1a1a;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f2f4f6;
  --muted: #9aa3ad;
  --yellow: #ffcc00;
  --yellow-2: #ffe38a;
  --orange: #ff8b1a;
  --teal: #2fd3a8;
  --blue: #4a90e2;
  --blue-deep: #336699;
  --danger: #ff6d5f;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  --font: "Manrope", "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --on-chrome: #f2f4f6;
  --on-chrome-muted: #9aa3ad;
  --top: 52px;
  --strip: 0px;
  --side: min(380px, 92vw);
  --dock-h: 72px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  overflow: hidden;
  color: var(--text);
  font-family: var(--font);
  background: var(--bg);
}

/* Single page H1 for crawlers; visually hidden so the map UI stays clean */
.seo-h1 {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

button, input, select { font: inherit; color: inherit; }

select,
select option {
  color-scheme: light;
}

.app {
  position: relative;
  height: 100vh;
  background: var(--bg);
}

/* —— Top chrome —— */
.topbar {
  position: absolute;
  inset: 0 0 auto 0;
  height: var(--top);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0 0.7rem;
  background: var(--chrome);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  color: inherit;
  min-width: max-content;
  flex-shrink: 0;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--yellow);
  line-height: 0;
}

.brand-text {
  display: grid;
  line-height: 1.05;
}

.brand-text strong {
  letter-spacing: 0.08em;
  font-size: 0.95rem;
  font-weight: 800;
}

.icon-btn, .map-tools button, .chip, .text-btn {
  cursor: pointer;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--text);
}

.search {
  position: relative;
  width: min(220px, 34vw);
  flex: 0 1 auto;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  height: 34px;
  padding: 0 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #2a2a2e;
}

.search input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  min-width: 0;
  font-size: 0.86rem;
}
.search input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.search svg { color: var(--muted); flex: 0 0 auto; }

.suggest {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  min-width: 280px;
  background: var(--chrome-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  max-height: 320px;
  overflow-y: auto;
  z-index: 40;
}

.suggest button {
  width: 100%;
  text-align: start;
  border: 0;
  background: transparent;
  padding: 0.7rem 0.9rem;
  display: grid;
  gap: 0.15rem;
  cursor: pointer;
}
.suggest button:hover { background: rgba(255, 204, 0, 0.08); }
.suggest b { font-size: 0.92rem; }
.suggest span { color: var(--muted); font-size: 0.78rem; }

.top-actions {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.chip {
  height: 32px;
  padding: 0 0.7rem;
  border-radius: 999px;
  color: var(--text);
  background: #2a2a2e;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.chip[data-on="1"] {
  color: #1a1400;
  background: var(--yellow);
  border-color: transparent;
}

.live {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
  padding-inline-start: 0.25rem;
  white-space: nowrap;
}
.live .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 0 rgba(47, 211, 168, 0.5);
  animation: pulse 1.8s ease-out infinite;
}
.live.is-error .dot { background: var(--danger); animation: none; }

@keyframes pulse {
  70% { box-shadow: 0 0 0 10px rgba(47, 211, 168, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 211, 168, 0); }
}

/* —— Side panel (Most tracked) —— */
.side-panel {
  position: absolute;
  top: var(--top);
  left: 0;
  bottom: 0;
  width: var(--side);
  z-index: 24;
  display: flex;
  flex-direction: column;
  background: rgba(22, 22, 24, 0.94);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(18px);
  transform: translateX(-105%);
  transition: transform 0.28s ease;
  pointer-events: none;
}
.side-panel.is-open {
  transform: translateX(0);
  pointer-events: auto;
}
.app.has-strip .side-panel {
  transform: translateX(-105%);
  pointer-events: none;
}

.side-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0 0.35rem;
  flex-shrink: 0;
}
.side-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.85rem 0.35rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  position: relative;
}
.side-tab.is-on {
  color: var(--text);
}
.side-tab.is-on::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--yellow);
}

.side-pane {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}
.side-pane.is-on {
  display: flex;
}
.side-pane[hidden] {
  display: none !important;
}

.side-panel-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 0.9rem 0.55rem;
  flex-shrink: 0;
}
.side-panel-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.side-panel-close {
  margin-inline-start: auto;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 0.4rem;
  border-radius: 4px;
  background: var(--yellow);
  color: #1a1400;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.side-footnote {
  margin: 0;
  padding: 0.65rem 0.9rem 0.9rem;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.side-stub {
  padding: 1.2rem 1rem;
  color: var(--muted);
  line-height: 1.5;
}
.side-stub-link {
  display: inline-flex;
  margin-top: 0.75rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: var(--yellow);
  color: #1a1400;
  text-decoration: none;
  font-weight: 800;
  font-size: 0.85rem;
}

/* —— Filters drawer —— */
.drawer {
  position: absolute;
  top: var(--top);
  right: 0;
  bottom: 0;
  width: min(320px, 92vw);
  z-index: 26;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.9rem;
  background: var(--panel);
  border-left: 1px solid var(--line);
  backdrop-filter: blur(16px);
  transform: translateX(105%);
  transition: transform 0.28s ease;
}
.drawer.is-open { transform: translateX(0); }

.site-drawer {
  position: absolute;
  top: var(--top);
  left: 0;
  bottom: 0;
  width: min(300px, 88vw);
  z-index: 27;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.9rem;
  background: var(--panel-solid);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(16px);
  transform: translateX(-105%);
  transition: transform 0.28s ease;
}
.site-drawer.is-open { transform: translateX(0); }
.site-nav {
  display: grid;
  gap: 0.2rem;
  overflow: auto;
  min-height: 0;
}
.site-nav a {
  display: block;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
}
.site-nav a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--yellow);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer-head h2 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.text-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.2rem 0.4rem;
  cursor: pointer;
}

.field, .toggle {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.field select {
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #ffffff;
  padding: 0 0.7rem;
  text-transform: none;
  letter-spacing: 0;
  color: #122033;
}
.field select option,
.lang-select option {
  background: #ffffff;
  color: #122033;
}
.toggle {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.6rem;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.92rem;
  color: var(--text);
}
.maritime-section {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.maritime-section > span {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.vessel-type-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.type-chip {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border-radius: 0.4rem;
  padding: 0.22rem 0.5rem;
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  opacity: 0.5;
}
.type-chip.is-on {
  opacity: 1;
  border-color: color-mix(in srgb, #0aa3a0 50%, var(--line));
  background: color-mix(in srgb, #0aa3a0 16%, transparent);
}
.range-row { display: grid; gap: 0.35rem; }
.range-meta { font-family: var(--mono); color: var(--muted); text-transform: none; }

.drawer-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
}
.drawer-stats div {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.55rem 0.45rem;
  text-align: center;
  background: rgba(255,255,255,0.02);
}
.drawer-stats b {
  display: block;
  font-family: var(--mono);
  font-size: 0.95rem;
}
.drawer-stats span {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.flight-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem 0.8rem;
}

.flight-item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--card);
  text-align: start;
  padding: 0.7rem 0.75rem;
  cursor: pointer;
  display: grid;
  gap: 0.35rem;
  color: inherit;
}
.flight-item:hover, .flight-item.is-active {
  background: #34343a;
  border-color: rgba(255, 204, 0, 0.28);
}
.flight-item-top {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}
.flight-item .rank {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
  width: 1.4rem;
  flex-shrink: 0;
}
.flight-item .cs {
  font-weight: 800;
  letter-spacing: 0.03em;
  font-size: 0.98rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.flight-item .type-chip {
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  letter-spacing: 0.03em;
}
.flight-item .meta-num {
  margin-inline-start: auto;
  color: var(--yellow);
  font-weight: 800;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.flight-item .route-line {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
  padding-inline-start: 1.85rem;
}
.flight-item .route-code {
  display: inline-block;
  margin: 0 0.15rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #d5dbe2;
  font-size: 0.7rem;
  font-weight: 700;
}

.sources {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
  border-top: 1px solid var(--line);
  padding-top: 0.7rem;
  margin-top: auto;
}

/* —— Map stage —— */
.stage {
  position: absolute;
  inset: var(--top) 0 0 0;
}
#map { width: 100%; height: 100%; }

/* Required Google Maps attribution logo when Map Tiles basemap is active. */
.google-maps-logo {
  position: absolute;
  left: 0.65rem;
  bottom: 1.65rem;
  z-index: 5;
  display: block;
  line-height: 0;
  opacity: 0.92;
  pointer-events: auto;
}
.google-maps-logo[hidden] { display: none; }
.google-maps-logo img {
  display: block;
  height: 26px;
  width: auto;
}
html[dir="rtl"] .google-maps-logo {
  left: auto;
  right: 0.65rem;
}

.map-boot {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  background: rgba(14, 17, 20, 0.94);
  backdrop-filter: blur(8px);
  pointer-events: none;
}
.map-boot:not(.is-hidden) { pointer-events: auto; }
.map-boot-allow {
  border: 0;
  border-radius: 999px;
  background: var(--yellow);
  color: #1a1400;
  font-weight: 800;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
}
.map-boot.is-hidden {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
.map-boot-inner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-solid);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}
.map-boot-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 0 rgba(47, 211, 168, 0.45);
  animation: pulse 1.8s ease-out infinite;
}

.layers {
  position: absolute;
  left: 0.85rem;
  top: 0.85rem;
  z-index: 6;
}
.app.has-side .layers,
.app.has-strip .layers {
  left: calc(var(--side) + 0.75rem);
}
.layers-panel button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  color: #102033;
  cursor: pointer;
}
.weather-panel {
  width: 236px;
}
.wx-days {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.wx-days button {
  flex: 1 1 calc(33% - 0.3rem);
  text-align: center;
  font-size: 0.74rem;
  padding: 0.38rem 0.2rem;
}
.wx-hour {
  display: grid;
  gap: 0.2rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #5d7284;
}
.wx-hour input {
  width: 100%;
  accent-color: #e2a20a;
}
.wx-scale {
  display: flex;
  height: 8px;
  border-radius: 99px;
  overflow: hidden;
}
.wx-scale i { flex: 1; }
.wx-readout {
  margin: 0.1rem 0.15rem 0.15rem;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.35;
}
.wx-popup .maplibregl-popup-content {
  border-radius: 12px;
  padding: 0.6rem 0.75rem;
  color: #102033;
  font-family: inherit;
}
.wx-pop {
  display: grid;
  gap: 0.2rem;
  min-width: 150px;
}
.wx-pop p {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  margin: 0;
  font-size: 0.82rem;
}
.wx-pop strong {
  display: block;
  margin-bottom: 0.25rem;
}
.layers-panel {
  width: 180px;
  padding: 0.55rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  color: #102033;
  display: grid;
  gap: 0.35rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}
.layers-panel[hidden] {
  display: none;
}
.layers-panel p {
  margin: 0.15rem 0.2rem 0.1rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5d7284;
}
.layers-panel button {
  text-align: start;
  border-radius: 9px;
  padding: 0.45rem 0.6rem;
  background: transparent;
}
.layers-panel button.is-on {
  background: #f7c948;
  border-color: transparent;
  font-weight: 700;
}
.legend {
  display: grid;
  gap: 0.28rem;
  padding: 0.15rem 0.25rem 0.3rem;
  font-size: 0.78rem;
}
.legend span {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.legend i {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

.map-tools {
  position: absolute;
  right: 0.85rem;
  bottom: calc(var(--dock-h) + 1.1rem);
  display: grid;
  gap: 0.35rem;
  z-index: 5;
}
.map-tools button {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(26, 26, 26, 0.9);
  font-size: 1.1rem;
  backdrop-filter: blur(8px);
  color: var(--text);
}
.app.has-strip .map-tools { bottom: calc(var(--dock-h) + 1.1rem); }

.hud {
  position: absolute;
  left: 0.85rem;
  bottom: calc(var(--dock-h) + 1.1rem);
  z-index: 5;
  display: flex;
  gap: 0.75rem;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  background: rgba(26, 26, 26, 0.88);
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  backdrop-filter: blur(8px);
}
.app.has-side .hud {
  left: calc(var(--side) + 0.75rem);
}
.app.has-strip .hud {
  left: calc(var(--side) + 0.75rem);
}

/* —— Floating bottom dock —— */
.bottom-dock {
  position: absolute;
  left: 50%;
  bottom: 0.85rem;
  transform: translateX(-50%);
  z-index: 8;
  display: flex;
  align-items: stretch;
  gap: 0.15rem;
  padding: 0.45rem 0.55rem;
  border-radius: 999px;
  background: rgba(22, 22, 24, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(16px);
}
.app.has-side .bottom-dock {
  left: calc(50% + var(--side) / 2);
}
.app.has-strip .bottom-dock {
  left: calc(50% + var(--side) / 2);
}

.dock-btn {
  display: grid;
  justify-items: center;
  gap: 0.2rem;
  min-width: 62px;
  padding: 0.35rem 0.45rem;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #e8ecf0;
  text-decoration: none;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 700;
}
.dock-btn svg { opacity: 0.92; }
.dock-btn:hover,
.dock-btn.is-on {
  background: rgba(255, 255, 255, 0.08);
  color: var(--yellow);
}

.playback-sheet {
  position: absolute;
  left: 50%;
  bottom: calc(var(--dock-h) + 0.4rem);
  transform: translateX(-50%);
  z-index: 9;
  width: min(320px, calc(100% - 2rem));
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: var(--chrome);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: var(--text);
}
.playback-sheet[hidden] { display: none !important; }
.playback-sheet strong { display: block; margin-bottom: 0.35rem; }
.playback-sheet p {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

/* —— Flight detail strip —— */
.strip {
  position: absolute;
  top: var(--top);
  left: 0;
  bottom: 0;
  width: var(--side);
  z-index: 28;
  display: flex;
  flex-direction: column;
  overflow: auto;
  background: #f4f5f7;
  color: #1c2430;
  box-shadow: 8px 0 40px rgba(0, 0, 0, 0.28);
  animation: rise 0.28s ease;
}
.strip[hidden] { display: none !important; }

.card-head {
  position: relative;
  padding: 0.75rem 0.9rem 0.7rem;
  background: var(--chrome);
  color: #fff;
}
.card-head-actions {
  position: absolute;
  top: 0.55rem;
  inset-inline-end: 0.55rem;
  display: flex;
  gap: 0.35rem;
}
.icon-round {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}
.icon-round.is-on {
  color: var(--yellow);
  border-color: rgba(255, 204, 0, 0.45);
}
.card-title-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.45rem;
  padding-inline-end: 5rem;
}
.card-title-row strong {
  color: var(--orange);
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  line-height: 1;
}
.pill {
  border-radius: 6px;
  background: #4a5158;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.4rem;
}
.pill-type { background: var(--blue); }

@keyframes rise {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

.strip-close {
  font-size: 1.35rem;
}
.strip-photo {
  position: relative;
  height: 200px;
  background: #111;
  flex-shrink: 0;
}
.strip-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.strip-photo img[hidden] { display: none; }
.photo-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.35rem;
  padding: 1rem;
  text-align: center;
  color: var(--yellow);
  background: linear-gradient(160deg, #1a1a1a, #2c2c30);
  overflow: hidden;
}
.photo-fallback-skel {
  display: none;
  position: absolute;
  inset: 0;
  background: linear-gradient(
    110deg,
    rgba(255, 255, 255, 0.02) 0%,
    rgba(255, 255, 255, 0.1) 45%,
    rgba(255, 255, 255, 0.02) 90%
  );
  background-size: 200% 100%;
  animation: photoShimmer 1.1s linear infinite;
}
.photo-fallback[data-state="loading"] .photo-fallback-skel {
  display: block;
}
@keyframes photoShimmer {
  from { background-position: 120% 0; }
  to { background-position: -80% 0; }
}
.photo-fallback-mark {
  position: relative;
  font-weight: 800;
  letter-spacing: 0.14em;
  font-size: 1.35rem;
  opacity: 0.9;
}
.photo-fallback-msg {
  position: relative;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  max-width: 16rem;
  line-height: 1.35;
}
.photo-fallback[data-state="loading"] .photo-fallback-msg {
  color: rgba(255, 214, 10, 0.85);
}
.photo-fallback[data-state="empty"] .photo-fallback-mark {
  opacity: 0.45;
}
.photo-fallback[data-state="empty"] .photo-fallback-skel {
  display: none;
}
.photo-fallback.is-hidden { display: none; }
.strip-photo img.is-blur {
  filter: blur(8px) saturate(0.85);
  transform: scale(1.04);
}
.photo-credit {
  position: absolute;
  left: 0.55rem;
  bottom: 0.4rem;
  color: #fff;
  font-size: 0.72rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}
.airline {
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  padding-inline-end: 5rem;
}
.route-board {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.4rem;
  align-items: center;
  padding: 0.95rem 0.85rem 0.8rem;
  background: #fff;
  color: #1c2430;
  text-align: center;
}
.route-board strong {
  display: block;
  font-size: 2.05rem;
  letter-spacing: 0.03em;
  line-height: 1;
}
.route-board em {
  display: block;
  margin-top: 0.35rem;
  color: #6b7280;
  font-style: normal;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.route-arrow {
  color: var(--yellow);
  display: grid;
  place-items: center;
}
.route-arrow svg {
  filter: drop-shadow(0 0 0 transparent);
}
.detail-times {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #eef0f3;
  color: #1c2430;
}
.detail-times .stat {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 0.8rem;
  border: 0;
  border-top: 1px solid #e0e3e8;
  border-radius: 0;
  background: transparent;
}
.detail-times .stat:nth-child(odd) { border-inline-end: 1px solid #e0e3e8; }
.detail-times .stat span {
  color: #6b7280;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.detail-times .stat strong {
  color: #111827;
  font-size: 0.95rem;
  font-family: var(--mono);
  font-weight: 600;
}
.detail-more {
  background: #fff;
}
.detail-more-block {
  border-top: 1px solid #e5e7eb;
}
.detail-more-head {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 0;
  background: var(--blue-deep);
  color: #fff;
  padding: 0.7rem 0.85rem;
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
  text-align: left;
}
.detail-more-body {
  display: grid;
  gap: 0.55rem;
  padding: 0.8rem 0.85rem;
  color: #1c2430;
}
.detail-more-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.88rem;
}
.detail-more-row span { color: #6b7280; }
.detail-more-row strong { font-weight: 700; }

.card-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--chrome);
  margin-top: auto;
  position: sticky;
  bottom: 0;
}
.card-actions button {
  border: 0;
  background: transparent;
  color: #d5dbe2;
  padding: 0.9rem 0.3rem;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
}
.card-actions button.is-on { color: var(--yellow); }

.empty {
  color: var(--muted);
  text-align: center;
  padding: 1.4rem 0.75rem;
  line-height: 1.45;
}

.maplibregl-ctrl-attrib {
  background: rgba(0,0,0,0.35) !important;
  color: #9fb2c0 !important;
}
.maplibregl-ctrl-attrib a { color: #cfe0ec !important; }
.maplibregl-canvas { outline: none; }

.country-select { width: 100%; }
.lang-select {
  height: 34px;
  width: 118px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #2a2a2e;
  color: #f2f4f6;
  padding: 0 0.55rem;
  font-weight: 700;
  cursor: pointer;
}

html[data-theme="light"] {
  --bg: #eef3f8;
  --chrome: #1f2429;
  --chrome-2: #ffffff;
  --card: #e8eef5;
  --panel: rgba(255, 255, 255, 0.97);
  --panel-solid: #ffffff;
  --line: rgba(16, 36, 56, 0.12);
  /* Readable on light panels / page chrome; dark topbar overrides below */
  --text: #122033;
  --muted: #5d7284;
  --on-chrome: #f2f4f6;
  --on-chrome-muted: #9aa3ad;
  --shadow: 0 18px 40px rgba(18, 32, 51, 0.12);
}

/* Topbar stays dark in light theme — keep light ink on chrome */
html[data-theme="light"] .topbar {
  color: var(--on-chrome);
  --text: var(--on-chrome);
  --muted: var(--on-chrome-muted);
}
html[data-theme="light"] .chip:not([data-on="1"]) {
  color: var(--on-chrome);
}
html[data-theme="light"] .lang-select {
  background: #ffffff;
  color: #122033;
  border-color: rgba(16, 32, 51, 0.18);
}
html[data-theme="light"] .search {
  background: #ffffff;
  color: #122033;
  border-color: rgba(16, 32, 51, 0.14);
  --text: #122033;
  --muted: #5d7284;
}
html[data-theme="light"] .suggest,
html[data-theme="light"] .layers-panel {
  background: #ffffff;
  color: #122033;
  --text: #122033;
  --muted: #5d7284;
}
html[data-theme="light"] .map-tools button,
html[data-theme="light"] .hud {
  background: rgba(255, 255, 255, 0.92);
  color: #122033;
  --text: #122033;
  --muted: #5d7284;
}

/* Light panels: force theme text tokens so Arabic/LTR labels stay readable */
html[data-theme="light"] .drawer,
html[data-theme="light"] .side-panel,
html[data-theme="light"] .site-drawer,
html[data-theme="light"] .playback-sheet {
  background: var(--panel-solid);
  color: var(--text);
  --text: #122033;
  --muted: #5d7284;
  --card: #e8eef5;
  border-color: var(--line);
}
html[data-theme="light"] .side-panel {
  background: var(--panel);
}
html[data-theme="light"] .side-tabs {
  border-bottom-color: var(--line);
}
html[data-theme="light"] .side-footnote,
html[data-theme="light"] .sources {
  border-top-color: var(--line);
}
html[data-theme="light"] .drawer-stats div {
  background: rgba(16, 36, 56, 0.04);
  border-color: var(--line);
}
html[data-theme="light"] .flight-item:hover,
html[data-theme="light"] .flight-item.is-active {
  background: #dce6f0;
  border-color: rgba(226, 162, 10, 0.45);
}
html[data-theme="light"] .flight-item .route-code {
  background: rgba(16, 36, 56, 0.08);
  color: #334155;
}
html[data-theme="light"] .site-nav a:hover {
  background: rgba(16, 36, 56, 0.06);
}
html[data-theme="light"] .text-btn {
  color: var(--muted);
}
html[data-theme="light"] .field,
html[data-theme="light"] .drawer-stats span,
html[data-theme="light"] .side-tab,
html[data-theme="light"] .side-footnote,
html[data-theme="light"] .side-stub,
html[data-theme="light"] .sources,
html[data-theme="light"] .range-meta {
  color: var(--muted);
}
html[data-theme="light"] .toggle,
html[data-theme="light"] .drawer-head h2,
html[data-theme="light"] .drawer-stats b,
html[data-theme="light"] .side-panel-head h2,
html[data-theme="light"] .side-tab.is-on,
html[data-theme="light"] .site-nav a {
  color: var(--text);
}
/* Bottom dock stays dark floating chrome */
html[data-theme="light"] .bottom-dock {
  color: var(--on-chrome);
  --text: var(--on-chrome);
  --muted: var(--on-chrome-muted);
}
html[data-theme="light"] .card-head {
  color: #fff;
  --text: #f2f4f6;
  --muted: #9aa3ad;
}

html[dir="rtl"] .top-actions { margin-inline-start: 0; margin-inline-end: auto; }
html[dir="rtl"] .side-panel,
html[dir="rtl"] .strip,
html[dir="rtl"] .site-drawer {
  left: auto;
  right: 0;
  border-right: 0;
  border-left: 1px solid var(--line);
  transform: translateX(105%);
}
html[dir="rtl"] .side-panel.is-open,
html[dir="rtl"] .site-drawer.is-open { transform: translateX(0); }
html[dir="rtl"] .app.has-strip .side-panel {
  transform: translateX(105%);
}
html[dir="rtl"] .drawer {
  right: auto;
  left: 0;
  border-left: 0;
  border-right: 1px solid var(--line);
  transform: translateX(-105%);
}
html[dir="rtl"] .drawer.is-open { transform: translateX(0); }
html[dir="rtl"] .hud {
  left: auto;
  right: 0.85rem;
}
html[dir="rtl"] .app.has-side .hud,
html[dir="rtl"] .app.has-strip .hud {
  left: auto;
  right: calc(var(--side) + 0.75rem);
}
html[dir="rtl"] .app.has-side .bottom-dock,
html[dir="rtl"] .app.has-strip .bottom-dock {
  left: calc(50% - var(--side) / 2);
}
html[dir="rtl"] .strip {
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.28);
}
html[dir="rtl"] .layers {
  left: auto;
  right: 0.85rem;
}
html[dir="rtl"] .app.has-side .layers,
html[dir="rtl"] .app.has-strip .layers {
  left: auto;
  right: calc(var(--side) + 0.75rem);
}
html[dir="rtl"] .map-tools {
  right: auto;
  left: 0.85rem;
}
html[dir="rtl"] .rx-drawer .rx-group-btn,
html[dir="rtl"] .site-nav a {
  text-align: start;
}
@keyframes rise-rtl {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}
html[dir="rtl"] .strip {
  animation-name: rise-rtl;
}

@media (max-width: 980px) {
  .chip-optional { display: none; }
  .topbar { gap: 0.4rem; padding: 0 0.45rem; }
  .lang-select { width: 96px; }
  .search { width: min(150px, 28vw); }
  .live span:last-child { max-width: 72px; overflow: hidden; text-overflow: ellipsis; }
  .brand-text strong { font-size: 0.82rem; }
  .side-panel,
  .strip {
    width: min(100vw, 420px);
  }
  .app.has-side .hud,
  .app.has-strip .hud {
    left: 0.85rem;
  }
  .app.has-side .layers,
  .app.has-strip .layers {
    left: 0.85rem;
  }
  .app.has-side .bottom-dock,
  .app.has-strip .bottom-dock {
    left: 50%;
  }
  .bottom-dock {
    width: calc(100% - 1.2rem);
    max-width: 440px;
    justify-content: space-between;
  }
  .dock-btn { min-width: 0; flex: 1; padding: 0.3rem 0.15rem; font-size: 0.62rem; }
}

@media (max-width: 640px) {
  .side-panel,
  .strip {
    width: 100%;
    max-height: min(62vh, 520px);
    top: auto;
    bottom: 0;
    border-right: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px 18px 0 0;
    transform: translateY(110%);
  }
  .side-panel.is-open,
  .strip:not([hidden]) {
    transform: translateY(0);
  }
  .app.has-strip .side-panel {
    transform: translateY(110%);
  }
  html[dir="rtl"] .side-panel,
  html[dir="rtl"] .strip {
    right: 0;
    left: 0;
    transform: translateY(110%);
  }
  html[dir="rtl"] .side-panel.is-open {
    transform: translateY(0);
  }
  html[dir="rtl"] .app.has-strip .side-panel {
    transform: translateY(110%);
  }
  .strip {
    animation: rise-up 0.28s ease;
  }
  @keyframes rise-up {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .hud { display: none; }
  .map-tools { bottom: calc(var(--dock-h) + 0.7rem); }
  .app.has-side .bottom-dock,
  .app.has-strip .bottom-dock {
    left: 50%;
  }
}
