: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;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --top-chrome: 52px;
  --top: calc(var(--top-chrome) + var(--safe-top));
  --strip: 0px;
  --side: min(380px, 92vw);
  --dock-pad: 72px;
  --dock-h: calc(var(--dock-pad) + var(--safe-bottom));
  --touch: 44px;
}

* { box-sizing: border-box; }
html {
  margin: 0;
  height: 100%;
  max-width: 100%;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  height: 100%;
  max-width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  color: var(--text);
  font-family: var(--font);
  background: var(--bg);
}

/* Crawler / a11y copy; visually hidden so the map UI stays clean (no layout impact) */
.seo-h1,
.seo-landing {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.seo-landing {
  white-space: normal;
  clip: rect(0, 0, 0, 0);
}
.seo-noscript {
  max-width: 40rem;
  margin: 2rem auto;
  padding: 1.25rem;
  font-family: var(--font);
  color: #122033;
  background: #eef3f8;
}

button, input, select { font: inherit; color: inherit; }

select,
select option {
  color-scheme: light;
}

.app {
  position: relative;
  height: 100%;
  height: 100dvh;
  max-width: 100%;
  overflow: hidden; /* clip off-canvas drawers (translateX) so they never scroll the page */
  background: var(--bg);
  isolation: isolate;
}

/* —— 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: var(--safe-top) max(0.7rem, var(--safe-right)) 0 max(0.7rem, var(--safe-left));
  background: var(--chrome);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  min-width: 0;
}

.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;
  min-width: 36px;
  min-height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--text);
  flex-shrink: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.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;
  width: max(100%, min(280px, calc(100vw - 1.5rem)));
  min-width: 0;
  max-width: calc(100vw - 1.5rem);
  background: var(--chrome-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  max-height: min(320px, 50vh);
  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; }

.layer-toggles {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.layer-toggle {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: var(--text);
  transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease, border-color 0.15s ease;
}

.layer-toggle[data-on="1"] {
  color: #1a1400;
  background: var(--yellow);
  border-color: transparent;
  opacity: 1;
}

.layer-toggle[data-on="0"] {
  opacity: 0.55;
}

.layer-toggle:hover {
  opacity: 1;
}

.top-actions {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  flex-shrink: 1;
}

.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.65rem 0.7rem;
  min-height: var(--touch);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
  touch-action: manipulation;
}
.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;
}

/* Google / Flightradar24-style “my location” blue dot */
.user-loc {
  position: relative;
  width: 18px;
  height: 18px;
  pointer-events: none;
}
.user-loc-accuracy {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(66, 133, 244, 0.18);
  border: 1px solid rgba(66, 133, 244, 0.32);
  width: 40px;
  height: 40px;
  box-sizing: border-box;
}
.user-loc-pulse {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  background: rgba(66, 133, 244, 0.4);
  animation: user-loc-pulse 2s ease-out infinite;
}
.user-loc-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: #4285f4;
  border: 2.5px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
@keyframes user-loc-pulse {
  0% { transform: scale(0.55); opacity: 0.75; }
  70% { transform: scale(2.2); opacity: 0; }
  100% { transform: scale(2.2); opacity: 0; }
}
.map-tools #recenter.is-locating {
  color: #1a73e8;
}
.map-tools #recenter.is-busy {
  opacity: 0.55;
  pointer-events: none;
}

.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: max(0.85rem, var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 8;
  display: flex;
  align-items: stretch;
  gap: 0.15rem;
  padding: 0.45rem 0.55rem;
  max-width: calc(100% - 1.2rem - var(--safe-left) - var(--safe-right));
  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);
  box-sizing: border-box;
}
.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;
  align-content: center;
  gap: 0.2rem;
  min-width: 62px;
  min-height: var(--touch);
  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;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.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(380px, calc(100% - 2rem));
  padding: 0.85rem 1rem 0.95rem;
  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-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}
.playback-sheet strong { display: block; margin: 0; }
.playback-hint {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}
.playback-time {
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem;
  margin-bottom: 0.4rem;
}
.playback-scrub {
  width: 100%;
  accent-color: var(--yellow);
  margin: 0 0 0.35rem;
}
.playback-meta {
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 0.55rem;
  line-height: 1.35;
}
.playback-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.playback-actions .text-btn.is-accent {
  color: var(--yellow);
}
body.is-playback .hud-count::after,
body.is-playback #hudCount::after {
  content: none;
}
body.is-playback #statusText {
  color: var(--yellow);
}

/* —— Per-flight replay scrubber (detail strip) —— */
.flight-replay {
  flex-shrink: 0;
  padding: 0.7rem 0.9rem 0.75rem;
  background: #1a1a1a;
  color: #f2f4f6;
  border-block: 1px solid rgba(255, 255, 255, 0.08);
}
.flight-replay[hidden] { display: none !important; }
.flight-replay-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.25rem;
}
.flight-replay-head strong {
  color: var(--orange);
  font-size: 0.92rem;
  font-weight: 700;
}
.flight-replay-time {
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  color: var(--yellow);
}
.flight-replay-hint {
  margin: 0 0 0.45rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}
.flight-replay-scrub {
  width: 100%;
  accent-color: var(--orange);
  margin: 0 0 0.3rem;
}
.flight-replay-meta {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
  margin-bottom: 0.45rem;
  min-height: 1.1em;
}
.flight-replay-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.flight-replay-actions .text-btn {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #f2f4f6;
  border-radius: 8px;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
}
.flight-replay-actions .text-btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.flight-replay-actions .text-btn.is-accent {
  color: var(--yellow);
  border-color: rgba(255, 204, 0, 0.35);
}
.flight-replay-actions .text-btn:not(:disabled):hover {
  background: rgba(255, 139, 26, 0.16);
}

/* —— 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"] .layer-toggle: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-inline: max(0.45rem, var(--safe-left)) max(0.45rem, var(--safe-right));
  }
  .lang-select { width: 96px; max-width: 28vw; }
  .search { width: min(150px, 28vw); min-width: 0; }
  .layer-toggle { width: 36px; height: 36px; border-radius: 10px; }
  .layer-toggle svg { width: 18px; height: 18px; }
  .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: max(0.85rem, var(--safe-left));
  }
  .app.has-side .layers,
  .app.has-strip .layers {
    left: max(0.85rem, var(--safe-left));
  }
  .app.has-side .bottom-dock,
  .app.has-strip .bottom-dock,
  html[dir="rtl"] .app.has-side .bottom-dock,
  html[dir="rtl"] .app.has-strip .bottom-dock {
    left: 50%;
    right: auto;
  }
  html[dir="rtl"] .app.has-side .hud,
  html[dir="rtl"] .app.has-strip .hud {
    left: auto;
    right: max(0.85rem, var(--safe-right));
  }
  html[dir="rtl"] .app.has-side .layers,
  html[dir="rtl"] .app.has-strip .layers {
    left: auto;
    right: max(0.85rem, var(--safe-right));
  }
  .bottom-dock {
    width: calc(100% - 1.2rem - var(--safe-left) - var(--safe-right));
    max-width: 440px;
    justify-content: space-between;
  }
  .dock-btn {
    min-width: 0;
    flex: 1;
    padding: 0.35rem 0.15rem;
    font-size: 0.62rem;
  }
  .weather-panel,
  .layers-panel {
    max-width: calc(100vw - 1.5rem);
  }
}

/* Phones / large phones (~320–640): bottom sheets + compact chrome */
@media (max-width: 640px) {
  :root {
    --dock-pad: 68px;
  }

  .side-panel,
  .strip {
    width: 100%;
    max-width: 100%;
    max-height: min(62vh, calc(100dvh - var(--top) - 0.5rem));
    top: auto;
    bottom: 0;
    border-right: 0;
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px 18px 0 0;
    transform: translateY(110%);
    padding-bottom: var(--safe-bottom);
  }
  .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;
    border-left: 0;
    border-right: 0;
    transform: translateY(110%);
  }
  html[dir="rtl"] .side-panel.is-open,
  html[dir="rtl"] .strip:not([hidden]) {
    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); }
  }

  .drawer,
  .site-drawer {
    width: min(320px, calc(100vw - 1rem));
    max-width: calc(100vw - 1rem);
    padding: 0.9rem max(0.9rem, var(--safe-right)) calc(0.9rem + var(--safe-bottom)) max(0.9rem, var(--safe-left));
  }
  .site-drawer {
    border-right: 0;
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.35);
  }
  .drawer {
    border-left: 0;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.35);
  }
  html[dir="rtl"] .site-drawer {
    border-left: 0;
  }
  html[dir="rtl"] .drawer {
    border-right: 0;
  }

  .hud { display: none; }
  .map-tools {
    bottom: calc(var(--dock-h) + 0.55rem);
    right: max(0.55rem, var(--safe-right));
  }
  html[dir="rtl"] .map-tools {
    right: auto;
    left: max(0.55rem, var(--safe-left));
  }
  .map-tools button {
    width: var(--touch);
    height: var(--touch);
    min-width: var(--touch);
    min-height: var(--touch);
  }
  .layers {
    top: 0.55rem;
    left: max(0.55rem, var(--safe-left));
    max-width: calc(100% - 1.1rem - var(--safe-left) - var(--safe-right));
  }
  html[dir="rtl"] .layers {
    left: auto;
    right: max(0.55rem, var(--safe-right));
  }
  .app.has-side .layers,
  .app.has-strip .layers,
  html[dir="rtl"] .app.has-side .layers,
  html[dir="rtl"] .app.has-strip .layers {
    left: max(0.55rem, var(--safe-left));
    right: auto;
  }
  html[dir="rtl"] .app.has-side .layers,
  html[dir="rtl"] .app.has-strip .layers {
    left: auto;
    right: max(0.55rem, var(--safe-right));
  }
  .app.has-side .bottom-dock,
  .app.has-strip .bottom-dock,
  html[dir="rtl"] .app.has-side .bottom-dock,
  html[dir="rtl"] .app.has-strip .bottom-dock {
    left: 50%;
    right: auto;
  }
  .google-maps-logo {
    bottom: calc(var(--dock-h) + 0.35rem);
    left: max(0.55rem, var(--safe-left));
  }
  html[dir="rtl"] .google-maps-logo {
    left: auto;
    right: max(0.55rem, var(--safe-right));
  }
  .playback-sheet {
    width: calc(100% - 1.2rem - var(--safe-left) - var(--safe-right));
    bottom: calc(var(--dock-h) + 0.35rem);
  }
  .side-tab {
    min-height: var(--touch);
    padding: 0.75rem 0.25rem;
  }
  .side-panel-close,
  .text-btn,
  .drawer-head .text-btn {
    min-height: var(--touch);
    min-width: var(--touch);
    padding: 0.45rem 0.65rem;
  }
}

/* Narrow phones (~320–430): two-row grid topbar (brand | toggles | actions / search) */
@media (max-width: 430px) {
  :root {
    --top-chrome: 96px;
    --dock-pad: 64px;
  }

  .topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: var(--touch) 40px;
    align-items: center;
    column-gap: 0.35rem;
    row-gap: 0.35rem;
    padding-bottom: 0.4rem;
    overflow: visible;
  }

  .brand {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }
  .brand-text { display: none; } /* mark stays — full wordmark needs more than ~430px */
  .brand-mark svg {
    width: 26px;
    height: 26px;
  }

  .layer-toggles {
    grid-column: 2;
    grid-row: 1;
    justify-self: start;
    gap: 0.25rem;
    min-width: 0;
  }
  .layer-toggle {
    width: var(--touch);
    height: var(--touch);
    min-width: var(--touch);
    min-height: var(--touch);
    border-radius: 12px;
  }
  .layer-toggle svg {
    width: 20px;
    height: 20px;
  }

  .top-actions {
    grid-column: 3;
    grid-row: 1;
    margin-inline-start: 0;
    margin-inline-end: 0;
    gap: 0.25rem;
    flex-shrink: 0;
    justify-self: end;
  }
  html[dir="rtl"] .top-actions {
    margin-inline-start: 0;
    margin-inline-end: 0;
  }

  .search {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    max-width: none;
    height: 40px;
    min-height: 40px;
  }
  .search input {
    font-size: 1rem; /* avoid iOS zoom on focus */
  }
  .suggest {
    width: 100%;
    max-width: none;
    left: 0;
    right: 0;
  }

  .live,
  .chip-theme {
    display: none;
  }
  .lang-select {
    width: 4.5rem;
    max-width: 28vw;
    height: 40px;
    min-height: 40px;
    font-size: 0.72rem;
    padding-inline: 0.3rem;
  }
  .icon-btn {
    width: var(--touch);
    height: var(--touch);
    min-width: var(--touch);
    min-height: var(--touch);
  }

  .bottom-dock {
    width: calc(100% - 0.8rem - var(--safe-left) - var(--safe-right));
    max-width: none;
    bottom: max(0.45rem, var(--safe-bottom));
    padding: 0.3rem 0.35rem;
    gap: 0;
    border-radius: 18px;
  }
  .dock-btn {
    min-height: var(--touch);
    padding: 0.25rem 0.1rem;
    font-size: 0.58rem;
    gap: 0.12rem;
    border-radius: 12px;
  }
  .dock-btn svg {
    width: 18px;
    height: 18px;
  }

  .strip-photo {
    height: min(160px, 28vh);
  }
  .card-title-row strong {
    font-size: 1.15rem;
  }
}

@media (max-width: 360px) {
  .lang-select {
    width: 3.85rem;
    font-size: 0.68rem;
  }
  .layer-toggles { gap: 0.18rem; }
  .topbar { column-gap: 0.28rem; }
}
