/* ============================================================
   Flugraum – Design
   Mobil zuerst, große Bedienelemente, hell/dunkel, LTR + RTL
   ============================================================ */

:root {
  --bg:        #0d1117;
  --bg-2:      #161b22;
  --bg-3:      #21262d;
  --line:      #30363d;
  --text:      #e6edf3;
  --text-2:    #9aa7b4;
  --text-3:    #6e7b8a;
  --accent:    #38bdf8;
  --accent-2:  #0ea5e9;
  --gold:      #fbbf24;
  --green:     #34d399;
  --red:       #f87171;
  --violet:    #a78bfa;
  --on-accent: #061119;

  --sheet:     #161b22;
  --overlay:   rgba(3, 7, 12, .66);

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;

  --fs:      16px;
  --tap:     48px;
  --safe-b:  env(safe-area-inset-bottom, 0px);
  --safe-t:  env(safe-area-inset-top, 0px);

  --shadow: 0 10px 34px rgba(0, 0, 0, .45);
  --nav-h: 62px;
}

html[data-theme="light"] {
  --bg:        #f2f5f8;
  --bg-2:      #ffffff;
  --bg-3:      #e6ebf1;
  --line:      #d3dbe4;
  --text:      #10161d;
  --text-2:    #52616f;
  --text-3:    #7d8b99;
  --accent:    #0369a1;
  --accent-2:  #0284c7;
  --gold:      #b45309;
  --green:     #047857;
  --red:       #b91c1c;
  --violet:    #6d28d9;
  --on-accent: #ffffff;
  --sheet:     #ffffff;
  --overlay:   rgba(15, 25, 35, .42);
  --shadow: 0 10px 30px rgba(20, 40, 60, .18);
}

html[data-big="1"] { --fs: 19px; --tap: 54px; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%;
  overscroll-behavior: none;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: var(--fs);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

html[dir="rtl"] body {
  font-family: "Segoe UI", Tahoma, "Noto Naskh Arabic", "Arial", system-ui, sans-serif;
  line-height: 1.7;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }

/* ---------------------------------------------------------- Grundgerüst */

#app {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
}

.view {
  flex: 1; position: relative; overflow: hidden;
  display: none;
}
.view.active { display: block; }
.view.scroll {
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding-bottom: 24px;
}

/* ---------------------------------------------------------- Kopfzeile */

.topbar {
  position: absolute; top: 0; inset-inline: 0; z-index: 750;
  padding: calc(8px + var(--safe-t)) 10px 8px;
  display: flex; align-items: center; gap: 8px;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
/* Der Sprachknopf soll in allen Sprachen an derselben Stelle bleiben –
   oben rechts. Deshalb behält die Leiste auch auf Arabisch ihre Richtung. */
html[dir="rtl"] .topbar { direction: ltr; }
html[dir="rtl"] .status-pill { direction: rtl; }
/* Auf den Listenansichten liegt die Leiste über scrollendem Inhalt */
.topbar.solid {
  background: linear-gradient(var(--bg) 62%, transparent);
}

/* Sprachknopf: Flagge + Kürzel, dreht durch alle Sprachen */
.icon-btn.lang-btn {
  width: auto; min-width: var(--tap); padding: 0 13px;
  border-radius: 999px; gap: 7px;
  display: inline-flex; align-items: center;
}
.icon-btn.lang-btn .fl { font-size: 1.15em; line-height: 1; }
.icon-btn.lang-btn .sh { font-size: .74em; font-weight: 800; letter-spacing: .3px; }

.status-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--sheet); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 14px;
  box-shadow: var(--shadow);
  font-size: .84em; font-weight: 600;
  min-height: 42px; white-space: nowrap;
  max-width: 62vw; overflow: hidden;
}
.dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--green); flex: none;
  box-shadow: 0 0 0 0 rgba(52, 211, 153, .6);
  animation: pulse 2.2s infinite;
}
.dot.err  { background: var(--red); animation: none; }
.dot.load { background: var(--gold); }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(52,211,153,.55); }
  70%  { box-shadow: 0 0 0 9px rgba(52,211,153,0); }
  100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
}
.status-count { color: var(--accent); }
.status-sub { color: var(--text-3); font-weight: 500; font-size: .92em; }

.icon-btn {
  width: var(--tap); height: var(--tap);
  min-width: var(--tap);
  border-radius: 50%;
  background: var(--sheet); border: 1px solid var(--line);
  display: grid; place-items: center;
  box-shadow: var(--shadow);
  font-size: 1.25em;
  transition: transform .12s ease, background .15s ease;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.icon-btn svg { width: 22px; height: 22px; }
.spacer { flex: 1; }

/* Badge für aktive Filter */
.icon-btn { position: relative; }
.icon-btn .badge {
  position: absolute; top: -2px; inset-inline-end: -2px;
  background: var(--gold); color: #1a1200;
  border-radius: 999px; min-width: 20px; height: 20px;
  font-size: 11px; font-weight: 800;
  display: grid; place-items: center; padding: 0 5px;
}

/* ---------------------------------------------------------- Karte */

#map { position: absolute; inset: 0; background: var(--bg-2); }
.leaflet-container { background: var(--bg-2); font-family: inherit; }
.leaflet-control-attribution {
  background: rgba(0,0,0,.55) !important; color: #9aa7b4 !important;
  font-size: 9px !important;
}
.leaflet-control-attribution a { color: #b9c6d3 !important; }
html[data-theme="light"] .leaflet-control-attribution {
  background: rgba(255,255,255,.8) !important; color: #52616f !important;
}
.leaflet-control-zoom { display: none; }

/* Flugzeug-Symbol */
.plane {
  will-change: transform;
  transition: transform .9s linear;
}
.plane svg { display: block; overflow: visible; }
.plane-body { fill: var(--p-col, #38bdf8); stroke: rgba(0,0,0,.55); stroke-width: .8; }
html[data-theme="light"] .plane-body { stroke: rgba(255,255,255,.85); }
.plane.sel .plane-body { fill: #fbbf24; }
.plane.sel { filter: drop-shadow(0 0 8px rgba(251,191,36,.9)); }
.plane.hit .plane-body { fill: #f87171; }

.plane-label {
  position: absolute; top: 100%; left: 50%;
  transform: translate(-50%, 2px);
  font-size: 10px; font-weight: 700; letter-spacing: .2px;
  background: rgba(0,0,0,.62); color: #fff;
  padding: 1px 5px; border-radius: 5px;
  white-space: nowrap; pointer-events: none;
}
html[data-theme="light"] .plane-label { background: rgba(255,255,255,.9); color: #10161d; }

.me-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(56,189,248,.22), 0 2px 8px rgba(0,0,0,.5);
}

/* Untere Werkzeuge auf der Karte */
.map-tools {
  position: absolute; inset-inline-end: 12px;
  bottom: calc(var(--nav-h) + var(--safe-b) + 14px);
  z-index: 550; display: flex; flex-direction: column; gap: 10px;
}

/* ---------------------------------------------------------- Untere Leiste */

.tabbar {
  flex: none; display: flex;
  background: var(--sheet);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
  z-index: 700;
}
.tab {
  flex: 1; padding: 8px 2px 7px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--text-3); font-size: .68em; font-weight: 600;
  min-height: var(--nav-h);
  transition: color .15s ease;
}
.tab svg { width: 24px; height: 24px; }
.tab.active { color: var(--accent); }
.tab.active svg { transform: translateY(-1px); }

/* ---------------------------------------------------------- Schnellauswahl */

.chips {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 10px 12px; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
/* Am Rechner: Leiste lässt sich anfassen und ziehen */
@media (hover: hover) and (pointer: fine) {
  .chips { cursor: grab; }
  .chips:active { cursor: grabbing; }
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: none; display: inline-flex; align-items: center; gap: 7px;
  background: var(--bg-3); border: 1px solid var(--line);
  color: var(--text); border-radius: 999px;
  padding: 10px 15px; font-size: .86em; font-weight: 650;
  min-height: 44px; white-space: nowrap;
  transition: all .15s ease;
}
.chip:active { transform: scale(.95); }
.chip.on {
  background: var(--accent); border-color: var(--accent);
  color: var(--on-accent);
}
.chip .emo { font-size: 1.15em; line-height: 1; }

.quickbar {
  position: absolute; inset-inline: 0;
  top: calc(var(--safe-t) + 66px);
  z-index: 590;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
}
.quickbar .chip { box-shadow: var(--shadow); background: var(--sheet); }
.quickbar .chip.on { background: var(--accent); }

/* ---------------------------------------------------------- Listen */

.view.scroll { padding-top: calc(var(--safe-t) + 62px); }

.list-head {
  background: var(--bg);
  padding: 6px 12px 4px;
}
.search-row { display: flex; gap: 8px; align-items: center; }
.search {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 0 12px; min-height: var(--tap);
}
.search input {
  flex: 1; background: none; border: 0; outline: none;
  min-width: 0; padding: 12px 0;
}
.search svg { width: 20px; height: 20px; color: var(--text-3); flex: none; }

.result-line {
  padding: 8px 4px 6px; color: var(--text-2);
  font-size: .8em; font-weight: 600;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

.cards { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 9px; }

.card {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 12px 14px;
  display: flex; gap: 12px; align-items: center;
  text-align: start; width: 100%;
  transition: transform .12s ease, border-color .15s ease;
}
.card:active { transform: scale(.985); border-color: var(--accent); }

.card-badge {
  flex: none; width: 46px; height: 46px; border-radius: 13px;
  background: var(--bg-3); display: grid; place-items: center;
  font-size: 1.05em; font-weight: 800; color: var(--accent);
  letter-spacing: -.5px;
}
.card-main { flex: 1; min-width: 0; }
.card-title {
  font-weight: 750; font-size: .98em;
  display: flex; align-items: center; gap: 7px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-route {
  color: var(--text-2); font-size: .84em; margin-top: 2px;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-meta {
  color: var(--text-3); font-size: .78em; margin-top: 3px;
  display: flex; gap: 10px; flex-wrap: wrap;
}
.card-side { flex: none; text-align: end; }
.card-alt { font-weight: 750; font-size: .92em; }
.card-dist { color: var(--text-3); font-size: .78em; }

.arrow-ico { color: var(--text-3); flex: none; }
html[dir="rtl"] .arrow-ico { transform: scaleX(-1); }

.trend { font-size: .8em; font-weight: 700; }
.trend.up { color: var(--green); }
.trend.down { color: var(--gold); }

.empty {
  text-align: center; padding: 54px 26px; color: var(--text-3);
}
.empty .big { font-size: 2.6em; margin-bottom: 10px; }
.empty .t { color: var(--text-2); font-weight: 650; margin-bottom: 6px; }
.empty .s { font-size: .86em; }

/* ---------------------------------------------------------- Übersicht */

.section {
  padding: 14px 12px 4px;
  font-size: .78em; font-weight: 800; letter-spacing: .8px;
  text-transform: uppercase; color: var(--text-3);
}
html[dir="rtl"] .section { letter-spacing: 0; text-transform: none; font-size: .84em; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 0 12px; }

.stat {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 14px;
}
.stat .v { font-size: 1.7em; font-weight: 800; line-height: 1.1; color: var(--accent); }
.stat .k { color: var(--text-2); font-size: .8em; margin-top: 3px; font-weight: 600; }
.stat.gold .v { color: var(--gold); }
.stat.green .v { color: var(--green); }
.stat.violet .v { color: var(--violet); }

.rank { padding: 0 12px; display: flex; flex-direction: column; gap: 7px; }
.rank-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 10px 13px;
  width: 100%; text-align: start;
}
.rank-row .n { flex: 1; font-weight: 650; font-size: .9em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-row .c {
  font-weight: 800; color: var(--accent); font-size: .92em;
  background: var(--bg-3); border-radius: 999px; padding: 2px 10px; flex: none;
}
.rank-bar {
  position: absolute; inset-block: 0; inset-inline-start: 0;
  background: linear-gradient(90deg, rgba(56,189,248,.16), transparent);
  border-radius: var(--r-sm); pointer-events: none;
}
.rank-row { position: relative; overflow: hidden; }
html[dir="rtl"] .rank-bar { background: linear-gradient(270deg, rgba(56,189,248,.16), transparent); }

.egypt-card {
  margin: 0 12px; padding: 16px;
  background: linear-gradient(135deg, rgba(212,175,55,.14), rgba(56,189,248,.10));
  border: 1px solid var(--line); border-radius: var(--r-md);
}
.egypt-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; }
.egypt-row .num { font-size: 1.55em; font-weight: 850; color: var(--gold); min-width: 46px; }
.egypt-row .lbl { color: var(--text-2); font-size: .88em; font-weight: 600; }

/* ---------------------------------------------------------- Einstellungen */

.set-group { padding: 0 12px; display: flex; flex-direction: column; gap: 8px; }

.row {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 13px 15px;
  display: flex; align-items: center; gap: 12px;
  min-height: var(--tap); width: 100%; text-align: start;
}
.row .lbl { flex: 1; font-weight: 620; font-size: .93em; }
.row .val { color: var(--text-3); font-size: .86em; }

.segment {
  display: flex; gap: 5px; background: var(--bg-3);
  border-radius: var(--r-sm); padding: 4px;
}
.segment button {
  flex: 1; padding: 10px 6px; border-radius: 7px;
  font-size: .84em; font-weight: 700; color: var(--text-2);
  min-height: 40px;
}
.segment button.on { background: var(--accent); color: var(--on-accent); }

.lang-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-2); border: 2px solid var(--line);
  border-radius: var(--r-md); padding: 14px 16px; width: 100%;
  text-align: start; min-height: 62px;
}
.lang-row.on { border-color: var(--accent); background: var(--bg-3); }
.lang-row .fl { font-size: 1.6em; line-height: 1; flex: none; }
.lang-row .nm { flex: 1; font-weight: 700; font-size: 1.02em; }
.lang-row .ck { color: var(--accent); font-size: 1.2em; opacity: 0; }
.lang-row.on .ck { opacity: 1; }

.about {
  margin: 0 12px; padding: 14px 16px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--r-md); color: var(--text-2);
  font-size: .84em; line-height: 1.65;
}

/* Schieberegler */
.slider-row { padding: 4px 2px 0; }
.slider-row .top {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 4px;
}
.slider-row .top b { color: var(--accent); font-size: 1.02em; }
input[type=range] {
  width: 100%; height: 38px; background: none;
  -webkit-appearance: none; appearance: none;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 6px; background: var(--bg-3); border-radius: 999px;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--sheet);
  margin-top: -10px; box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
input[type=range]::-moz-range-track { height: 6px; background: var(--bg-3); border-radius: 999px; }
input[type=range]::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--sheet);
}

select.sel {
  width: 100%; background: var(--bg-3); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 13px 12px; min-height: var(--tap);
  outline: none; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
                    linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: right 16px center, right 11px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
html[dir="rtl"] select.sel {
  background-position: left 11px center, left 16px center;
  background-image: linear-gradient(45deg, var(--text-3) 50%, transparent 50%),
                    linear-gradient(135deg, transparent 50%, var(--text-3) 50%);
}

/* ---------------------------------------------------------- Overlays */

.scrim {
  position: fixed; inset: 0; background: var(--overlay);
  z-index: 900; opacity: 0; pointer-events: none;
  transition: opacity .22s ease;
  backdrop-filter: blur(2px);
}
.scrim.show { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 950;
  background: var(--sheet);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  border-top: 1px solid var(--line);
  box-shadow: 0 -14px 40px rgba(0,0,0,.5);
  transform: translateY(102%);
  transition: transform .28s cubic-bezier(.32,.72,0,1);
  max-height: 88vh; display: flex; flex-direction: column;
  padding-bottom: var(--safe-b);
}
.sheet.show { transform: translateY(0); }

.sheet-grip {
  width: 42px; height: 4px; border-radius: 999px;
  background: var(--line); margin: 9px auto 2px; flex: none;
}
.sheet-head {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px 10px; flex: none;
}
.sheet-head h2 { margin: 0; font-size: 1.08em; font-weight: 750; flex: 1; }
.sheet-body { overflow-y: auto; padding: 0 0 14px; -webkit-overflow-scrolling: touch; }
.sheet-foot {
  flex: none; padding: 10px 14px calc(10px + var(--safe-b));
  border-top: 1px solid var(--line); display: flex; gap: 9px;
  background: var(--sheet);
}

.btn {
  flex: 1; min-height: var(--tap); border-radius: var(--r-md);
  font-weight: 750; font-size: .95em;
  display: grid; place-items: center;
  background: var(--bg-3); color: var(--text);
  transition: transform .12s ease;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.ghost { background: none; border: 1px solid var(--line); }

/* Foto des Flugzeugs.
   Die Bilder sind nur Vorschaugröße (wenige Kilobyte), deshalb bewusst
   nicht formatfüllend hochskaliert – lieber klein und scharf. */
.det-photo {
  position: relative; margin: 0 14px 12px;
  border-radius: var(--r-md); overflow: hidden;
  background: var(--bg-3); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  min-height: 90px;
}
.det-photo img {
  display: block; width: 100%; height: 100%;
  object-fit: cover;
}
.det-photo .src {
  position: absolute; inset-inline-end: 6px; bottom: 6px;
  background: rgba(0,0,0,.6); color: #fff;
  font-size: 10px; padding: 3px 8px; border-radius: 5px;
  text-decoration: none; max-width: calc(100% - 16px);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
a.det-photo-link, .det-photo a.src:active { opacity: .8; }

/* Vorlese-Knopf */
.speak-btn {
  width: 40px; height: 40px; min-width: 40px;
  border-radius: 50%; font-size: .68em;
  background: var(--bg-3); border: 1px solid var(--line);
  display: grid; place-items: center;
  transition: transform .12s ease, background .15s ease;
}
.speak-btn:active { transform: scale(.9); }
.speak-btn.on { background: var(--accent); border-color: var(--accent); }

/* Detailansicht eines Flugzeugs */
.det-head { padding: 4px 16px 14px; }
.det-cs {
  font-size: 1.55em; font-weight: 850; letter-spacing: -.4px;
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
}
.det-air { color: var(--text-2); font-size: .9em; margin-top: 2px; }

.route-vis {
  margin: 4px 14px 16px; padding: 16px 14px;
  background: var(--bg-3); border-radius: var(--r-md);
}
.route-ends { display: flex; align-items: flex-start; gap: 10px; }
.route-end { flex: 1; min-width: 0; }
.route-end.to { text-align: end; }
.route-code { font-size: 1.5em; font-weight: 850; line-height: 1.1; }
.route-city {
  color: var(--text-2); font-size: .83em; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.route-ctry { color: var(--text-3); font-size: .78em; margin-top: 1px; }

.route-line {
  position: relative; height: 3px; background: var(--line);
  border-radius: 999px; margin: 16px 4px 8px;
}
.route-line .done {
  position: absolute; inset-block: 0; inset-inline-start: 0;
  background: var(--accent); border-radius: 999px;
}
.route-line .pin {
  position: absolute; top: 50%; font-size: 15px;
  transform: translate(-50%, -50%);
}
html[dir="rtl"] .route-line .pin { transform: translate(50%, -50%) scaleX(-1); }
.route-pct {
  display: flex; justify-content: space-between;
  color: var(--text-3); font-size: .74em; font-weight: 600;
}

.kv-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  padding: 0 14px;
}
.kv {
  background: var(--bg-3); border-radius: var(--r-sm); padding: 11px 13px;
}
.kv .k { color: var(--text-3); font-size: .74em; font-weight: 650; }
.kv .v { font-weight: 750; font-size: 1.02em; margin-top: 2px; }
.kv.wide { grid-column: 1 / -1; }

.note {
  margin: 10px 14px 0; padding: 11px 13px;
  background: var(--bg-3); border-radius: var(--r-sm);
  color: var(--text-2); font-size: .84em;
  display: flex; gap: 9px; align-items: center;
}

/* ------------------------------------------------------- Länderauswahl */

.pick-group {
  margin: 0 12px 8px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  overflow: hidden; background: var(--bg-2);
}
.pick-head {
  display: flex; align-items: center; gap: 11px;
  width: 100%; text-align: start;
  padding: 14px 15px; min-height: 56px;
  background: var(--bg-2);
}
.pick-head .emo { font-size: 1.35em; line-height: 1; flex: none; }
.pick-head .nm { flex: 1; font-weight: 750; font-size: .98em; }
.pick-head .cnt {
  font-weight: 800; font-size: .8em; color: var(--accent);
  background: var(--bg-3); border-radius: 999px; padding: 3px 10px;
}
.pick-head .chev {
  color: var(--text-3); transition: transform .2s ease; flex: none;
  transform: rotate(90deg);
}
.pick-group.open .pick-head { border-bottom: 1px solid var(--line); }
.pick-group.open .pick-head .chev { transform: rotate(-90deg); }

.pick-list { display: none; }
.pick-group.open .pick-list { display: block; }

.pick-row {
  display: flex; align-items: center; gap: 11px;
  width: 100%; text-align: start;
  padding: 12px 15px; min-height: 50px;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
}
.pick-group .pick-list .pick-row:first-child { border-top: 0; }
.pick-row .fl { font-size: 1.3em; line-height: 1; flex: none; width: 28px; }
.pick-row .nm { flex: 1; font-weight: 620; font-size: .93em; }
.pick-row .cnt {
  font-size: .78em; font-weight: 750; color: var(--accent);
  background: var(--bg-3); border-radius: 999px; padding: 2px 9px; flex: none;
}
.pick-row.empty .nm { color: var(--text-3); font-weight: 520; }
.pick-row.on { background: var(--accent); color: var(--on-accent); }
.pick-row.on .nm { font-weight: 800; }
.pick-row.on .cnt { background: rgba(0,0,0,.22); color: inherit; }

.pick-flat { margin: 0 12px; border: 1px solid var(--line);
  border-radius: var(--r-md); overflow: hidden; background: var(--bg-2); }

/* ------------------------------------------------------- Flugverlauf */

.spark {
  display: block; width: 100%; height: 74px;
  margin-top: 8px; overflow: visible;
}
.spark path.area { fill: rgba(56,189,248,.18); }
.spark path.line { fill: none; stroke: var(--accent); stroke-width: 2; }
.spark circle { fill: var(--gold); }
.spark text { fill: var(--text-3); font-size: 9px; }

.legend {
  position: absolute; inset-inline-start: 12px;
  bottom: calc(var(--nav-h) + var(--safe-b) + 14px);
  z-index: 550;
  background: var(--sheet); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 7px 10px;
  box-shadow: var(--shadow); font-size: 10px; color: var(--text-2);
  pointer-events: none;
}
.legend .bar {
  height: 6px; border-radius: 999px; margin-bottom: 4px;
  background: linear-gradient(90deg,#34d399,#22d3ee,#38bdf8,#818cf8,#a78bfa,#fbbf24);
}
html[dir="rtl"] .legend .bar { background: linear-gradient(270deg,#34d399,#22d3ee,#38bdf8,#818cf8,#a78bfa,#fbbf24); }
.legend .ends { display: flex; justify-content: space-between; gap: 12px; }

/* ------------------------------------------------- Verfolgen-Hinweis */

.follow-bar {
  position: absolute; inset-inline: 12px;
  top: calc(var(--safe-t) + 138px);
  z-index: 580;
  display: flex; align-items: center; gap: 9px;
  background: var(--gold); color: #1a1200;
  border-radius: 999px; padding: 8px 8px 8px 15px;
  box-shadow: var(--shadow);
  font-size: .85em; font-weight: 700;
}
.follow-bar[hidden] { display: none; }
.fb-dot {
  width: 9px; height: 9px; border-radius: 50%; flex: none;
  background: #1a1200; animation: pulse 2s infinite;
}
.fb-name { font-weight: 850; letter-spacing: -.2px; }
.fb-sub { flex: 1; font-weight: 600; opacity: .75; font-size: .92em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-x {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: rgba(0,0,0,.16); display: grid; place-items: center;
  color: #1a1200;
}

/* ------------------------------------------------- Himmelsansicht */

.sky {
  position: fixed; inset: 0; z-index: 1100;
  background: linear-gradient(#0a1424 0%, #123055 55%, #2b5c86 100%);
  color: #eaf2fb;
  display: flex; flex-direction: column;
  padding-top: var(--safe-t); padding-bottom: var(--safe-b);
}
.sky[hidden] { display: none; }
html[data-theme="light"] .sky {
  background: linear-gradient(#2a6fb0 0%, #6aa8db 55%, #b7d6ee 100%);
  color: #08131f;
}

.sky-top {
  flex: none; display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
}
.sky-title { flex: 1; min-width: 0; }
.sky-title > span:first-child {
  font-size: 1.5em; font-weight: 850; letter-spacing: -.5px; display: block;
}
.sky-sub { font-size: .78em; opacity: .8; display: block; }
.sky .icon-btn { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.25); color: inherit; }

.sky-stage {
  flex: 1; position: relative; overflow: hidden;
  margin: 0 10px; border-radius: var(--r-md);
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.16);
}

.sky-grid { position: absolute; inset: 0; pointer-events: none; }
.sky-grid .vline {
  position: absolute; top: 0; bottom: 22px; width: 1px;
  background: rgba(255,255,255,.16);
}
.sky-grid .vlabel {
  position: absolute; bottom: 4px; transform: translateX(-50%);
  font-size: 10px; font-weight: 800; opacity: .75;
}
.sky-grid .hline {
  position: absolute; inset-inline: 0; height: 1px;
  background: rgba(255,255,255,.10);
}
.sky-grid .hlabel {
  position: absolute; inset-inline-start: 6px; transform: translateY(-50%);
  font-size: 9px; opacity: .6;
}

.sky-center {
  position: absolute; left: 50%; top: 0; bottom: 22px; width: 2px;
  background: rgba(255,255,255,.5); transform: translateX(-50%);
  pointer-events: none;
}
.sky-center::before {
  content: ''; position: absolute; top: 0; left: 50%;
  transform: translateX(-50%);
  border-inline: 7px solid transparent;
  border-top: 9px solid rgba(255,255,255,.75);
}

.sky-horizon {
  position: absolute; inset-inline: 0; bottom: 0; height: 22px;
  background: rgba(0,0,0,.28);
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; letter-spacing: 1px; opacity: .75;
}

.sky-planes { position: absolute; inset: 0; }
.sky-plane {
  position: absolute; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px; border-radius: 10px;
}
.sky-plane .ico { font-size: 20px; line-height: 1; }
.sky-plane .lb {
  font-size: 10px; font-weight: 800; white-space: nowrap;
  background: rgba(0,0,0,.45); border-radius: 5px; padding: 1px 5px;
}
.sky-plane .sub { font-size: 9px; opacity: .8; white-space: nowrap; }
.sky-plane.best { background: rgba(251,191,36,.22); outline: 2px solid var(--gold); }
.sky-plane.best .lb { background: var(--gold); color: #1a1200; }

.sky-foot { flex: none; padding: 10px 12px; }
.sky-best {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--r-md); padding: 12px 14px;
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: start;
  color: inherit; min-height: var(--tap);
}
.sky-best .big { font-size: 1.05em; font-weight: 800; }
.sky-best .small { font-size: .8em; opacity: .8; }
.sky-empty { text-align: center; opacity: .75; font-size: .88em; padding: 12px; }

.sky-manual { display: flex; align-items: center; gap: 10px; padding: 4px 2px 0; }
.sky-manual input[type=range] { flex: 1; }
.sky-btn {
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3);
  color: inherit; border-radius: var(--r-md);
  min-height: var(--tap); width: 100%; font-weight: 750;
  display: grid; place-items: center;
}

/* Toast-Meldungen */
.toast {
  position: fixed; inset-inline: 16px;
  bottom: calc(var(--nav-h) + var(--safe-b) + 18px);
  z-index: 1200;
  background: var(--bg-3); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 13px 16px; box-shadow: var(--shadow);
  font-size: .88em; font-weight: 600; text-align: center;
  opacity: 0; transform: translateY(14px);
  transition: opacity .22s ease, transform .22s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* Ladeanzeige */
.splash {
  position: fixed; inset: 0; z-index: 2000;
  background: var(--bg);
  display: grid; place-items: center;
  transition: opacity .35s ease;
}
.splash.hide { opacity: 0; pointer-events: none; }
.splash .in { text-align: center; }
.splash .ic { font-size: 3.2em; animation: fly 2.4s ease-in-out infinite; }
.splash .nm { font-weight: 800; font-size: 1.25em; margin-top: 10px; }
.splash .st { color: var(--text-3); font-size: .85em; margin-top: 5px; }
@keyframes fly {
  0%,100% { transform: translate(0,0); }
  50%     { transform: translate(6px,-8px); }
}

/* ---------------------------------------------------------- PC-Vorschau */

@media (min-width: 900px) {
  body { background: #05080c; }
  #app {
    position: relative; inset: auto;
    width: 412px; height: 880px; max-height: 96vh;
    margin: max(2vh, 14px) auto;
    border-radius: 34px; overflow: hidden;
    border: 10px solid #12181f;
    box-shadow: 0 30px 80px rgba(0,0,0,.7), 0 0 0 2px #2a343f;
  }
  /* Overlays bleiben im Handy-Rahmen (sie liegen dafür in #app) */
  .scrim, .sheet, .toast, .splash, .sky { position: absolute; }
  /* Fotos nicht über ihre echte Größe hinaus aufblasen */
  .det-photo { max-width: 100%; }
  .desk-note {
    position: fixed; inset-inline-start: 26px; bottom: 26px;
    color: #56616d; font-size: 12px; max-width: 260px; line-height: 1.6;
  }
}
@media (max-width: 899px) { .desk-note { display: none; } }
