#stage {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  justify-items: center;
  background: radial-gradient(ellipse at 65% 30%, #0e1723 0%, #05070d 66%);
}

.stage-inner {
  position: relative;
  width: min(100%, 1160px);
  min-height: 0;
  padding: clamp(14px, 3vh, 32px) clamp(16px, 2.6vw, 36px) 52px;
  display: grid;
  grid-template-rows: auto minmax(120px, 1fr) auto auto auto;
  align-content: stretch;
  gap: clamp(8px, 1.7vh, 15px);
}

.stage-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.stage-head h2 { margin: 0; color: var(--accent); font-size: 18px; font-weight: 650; }
.stage-head p { margin: 4px 0 0; font-size: 12px; color: #a3b2c4; }

.map-frame {
  min-height: 0;
  overflow: hidden;
  border: 1px solid #345064;
  border-radius: 14px;
  background: #0b1825;
}

#flight-map { display: block; width: 100%; height: 100%; touch-action: none; }
#flight-map.can-scrub { cursor: grab; }
#flight-map:active { cursor: grabbing; }

.flight-clocks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.clock {
  padding: 8px 13px 9px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 7px;
  align-items: baseline;
  border: 1px solid #293b4e;
  border-radius: 9px;
  background: #0e1724;
}

.clock div { grid-column: 1 / -1; display: flex; gap: 4px 10px; align-items: baseline; flex-wrap: wrap; }
.clock b { font-size: 13px; }
.clock small, .clock span { color: #aebdd0; font-size: 11px; white-space: nowrap; }
.clock strong { font: 650 18px/1.1 var(--mono); }
.departure-clock b, .departure-clock strong { color: #95e1f6; }
.arrival-clock b, .arrival-clock strong { color: var(--accent); }
.utc-clock { border-style: dashed; }

.timeline { display: grid; grid-template-rows: auto auto auto; gap: 0; }
.timeline-head, .timeline-ends { display: flex; justify-content: space-between; align-items: center; gap: 5px; }
.transport { display: flex; gap: 6px; }

button.small, #panelToggle { min-height: 44px; color: var(--accent); }
.timeline-head span, .timeline-ends { font-size: 12px; color: #9fb1c6; }
.timeline-ends b { color: #dce6f0; font-weight: 550; white-space: nowrap; }
.timeline-ends span:last-child b { color: var(--accent); }

#progress {
  appearance: none;
  height: 32px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

#progress::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent) var(--progress), #2c4355 var(--progress));
}

#progress::-webkit-slider-thumb {
  appearance: none;
  width: 15px;
  height: 15px;
  margin-top: -5px;
  border: 2px solid #161c24;
  border-radius: 50%;
  background: var(--accent);
}

#progress::-moz-range-track { height: 5px; border-radius: 4px; background: #2c4355; }
#progress::-moz-range-progress { height: 5px; border-radius: 4px; background: var(--accent); }
#progress::-moz-range-thumb { width: 13px; height: 13px; border: 2px solid #161c24; border-radius: 50%; background: var(--accent); }

.date-event {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px 9px;
  padding: 5px 10px;
  border: 1px solid #413953;
  border-radius: 8px;
  background: #131320;
  color: #baadcb;
  font-size: 11px;
}
.date-event[hidden] { display: none; }
.date-event div { display: flex; flex-wrap: wrap; gap: 0 10px; }
.date-event b { color: #ded0ef; font-weight: 600; }
.date-event.passed { border-color: #8269a0; }
#line-status { white-space: nowrap; }
.passed #line-status { color: #e4ccff; }

.route-buttons { display: flex; }
.route-buttons button { flex: 1; min-height: 44px; padding-inline: 4px; color: var(--accent); }
.route-buttons button.on { color: #111; }
.flight-inputs label { display: block; font-size: 12px; color: #cbd6e4; }
#departure {
  display: block;
  color-scheme: dark;
  width: 100%;
  min-height: 44px;
  margin: 5px 0 12px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-2);
  font: inherit;
}
.duration-head { display: flex; justify-content: space-between; align-items: center; }
#duration { height: 32px; margin: 0; }
#arrival { color: var(--accent); font-variant-numeric: tabular-nums; }
#arrive-day { margin: 1px 0 10px; color: #c1cedd; font-size: 12px; }
.calculation { padding-top: 9px; border-top: 1px solid #344254; font-size: 12px; }
.calculation dd { text-align: right; font-variant-numeric: tabular-nums; }

@media (max-width: 760px) {
  .stage-inner { padding: 12px 12px 48px; gap: 8px; }
  .stage-head h2 { font-size: 16px; }
  .stage-head p { font-size: 11px; margin-top: 2px; }
  #panelToggle { position: static; margin: 0; padding: 4px 10px; font-size: 12px; flex: none; }
  .clock { padding: 7px 6px; gap: 3px 4px; }
  .clock div { gap: 0 4px; }
  .clock b { font-size: 12px; }
  .clock small, .clock span { font-size: 10px; }
  .clock strong { font-size: 16px; }
  .flight-clocks { gap: 4px; }
  .timeline-head span, .timeline-ends { font-size: 11px; }
  .date-event { padding-inline: 8px; }
}

@media (max-height: 550px) {
  #app { min-height: 500px; }
}

@media (prefers-reduced-motion: reduce) {
  #panel { transition: none; }
}
