/* Flight replay dock: a seatback film-player bar that sits on the bottom band. */
#replay-dock {
  --replay-bg: color-mix(in oklab, var(--airshow-theme-color, #1D0D78) 32%, #04030e);
  --replay-light: #fff2d2;
  --replay-dim: rgba(228, 232, 246, 0.64);
  --replay-faint: rgba(255, 255, 255, 0.14);
  --replay-gs: #74e2d2;
  --replay-live: #ff3b30;
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--airshow-replay-band-h, 72px);
  z-index: 1205; /* above the wing picture (1203), under the view buttons (1206) and popups */
  padding: 40px 32px 14px;
  background: linear-gradient(180deg,
    transparent 0,
    color-mix(in oklab, var(--replay-bg) 70%, transparent) 30px,
    color-mix(in oklab, var(--replay-bg) 94%, transparent) 62%,
    var(--replay-bg) 100%);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.12);
  color: #fff;
  font-family: var(--airshow-ui-font-family, "Pretendard Variable", sans-serif);
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 200ms ease, transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
}
#replay-dock.is-open { opacity: 1; transform: none; pointer-events: auto; }
.replay-dock-inner { max-width: 1320px; margin: 0 auto; display: grid; gap: 6px; }

.replay-scrub { display: grid; grid-template-columns: 78px minmax(0, 1fr) 92px; align-items: start; gap: 18px; }
.replay-time { display: grid; gap: 3px; padding-top: 47px; font-size: 15px; font-weight: 600; line-height: 1; letter-spacing: 0.01em; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
.replay-time small { font-size: 9.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--replay-dim); }
.replay-time-behind { text-align: right; color: var(--replay-dim); }

.replay-track { position: relative; height: 80px; cursor: pointer; touch-action: none; outline: none; }
.replay-profile { position: absolute; left: 0; top: 0; width: 100%; height: 56px; overflow: visible; }
.replay-alt { fill: rgba(255, 255, 255, 0.06); }
.replay-alt-played { fill: url(#replay-played-grad); }
.replay-alt-line { fill: none; stroke: rgba(255, 255, 255, 0.38); stroke-width: 1.5; stroke-linejoin: round; }
.replay-alt-line-played { stroke: var(--replay-light); stroke-width: 2.2; }
.replay-gs { fill: none; stroke: var(--replay-gs); stroke-width: 1.6; stroke-linejoin: round; opacity: 0.9; }
.replay-rail { position: absolute; left: 0; right: 0; top: 55px; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.24); }
.replay-rail-fill { height: 100%; width: 0; border-radius: inherit; background: var(--replay-light); }

.replay-chapters { position: absolute; inset: 0; pointer-events: none; }
.replay-chapter {
  position: absolute;
  top: 63px;
  padding-left: 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--replay-dim);
}
.replay-chapter i { position: absolute; left: 0; top: -63px; height: 69px; border-left: 1px dashed rgba(255, 255, 255, 0.34); }

.replay-head { position: absolute; top: 0; left: 0; width: 0; height: 57px; pointer-events: none; }
.replay-head::before { content: ""; position: absolute; left: -1px; top: 0; bottom: 0; width: 2px; background: var(--replay-light); box-shadow: 0 0 10px rgba(255, 242, 210, 0.55); }
.replay-head::after {
  content: "";
  position: absolute;
  left: -8px;
  bottom: -7px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 242, 210, 0.28), 0 2px 6px rgba(0, 0, 0, 0.45);
  transition: transform 150ms ease;
}
#replay-dock.is-scrubbing .replay-head::after { transform: scale(1.25); }
.replay-bubble {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  transform: translateX(-50%);
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 10px 6px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.96);
  color: #0d0a24;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}
.replay-bubble b { font-size: 14px; font-weight: 700; }
.replay-bubble-meta { display: inline-flex; gap: 8px; color: #3a3f55; }
.replay-k-gs::before { content: ""; display: inline-block; width: 10px; height: 2px; margin: 0 5px 3px 0; border-radius: 1px; background: #12a08f; vertical-align: middle; }
.replay-bubble::after { content: ""; position: absolute; left: 50%; top: 100%; margin-left: -5px; border: 5px solid transparent; border-top-color: rgba(255, 255, 255, 0.96); }

.replay-loading { display: none; position: absolute; left: 0; right: 0; top: 18px; text-align: center; font-size: 14px; color: var(--replay-dim); }
#replay-dock.is-loading .replay-loading,
#replay-dock.is-empty .replay-loading { display: block; }
#replay-dock.is-loading .replay-head,
#replay-dock.is-empty .replay-head,
#replay-dock.is-loading .replay-chapters { display: none; }
#replay-dock.is-loading .replay-rail { background: linear-gradient(90deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.14)); background-size: 200% 100%; animation: replayLoading 1.2s linear infinite; }
@keyframes replayLoading { to { background-position: -200% 0; } }

.replay-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 18px; }
.replay-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.replay-badge {
  flex: none;
  padding: 3px 8px 3px 9px;
  border: 1px solid rgba(255, 242, 210, 0.7);
  border-radius: 4px;
  color: var(--replay-light);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.replay-title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 600; }

.replay-transport { display: flex; align-items: center; gap: 18px; }
.replay-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: background-color 150ms ease, transform 150ms ease;
}
.replay-btn:hover { background: rgba(255, 255, 255, 0.12); }
.replay-btn:active { transform: scale(0.94); }
.replay-play { width: 54px; height: 54px; background: #fff; color: #0d0a24; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); }
.replay-play:hover { background: var(--replay-light); }

.replay-right { display: flex; align-items: center; justify-content: flex-end; gap: 16px; }
.replay-speeds { display: flex; align-items: center; gap: 2px; }
.replay-speed {
  padding: 7px 8px;
  border: 0;
  background: none;
  color: var(--replay-dim);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: inset 0 -2px 0 transparent;
  transition: color 150ms ease, box-shadow 150ms ease;
}
.replay-speed:hover { color: #fff; }
.replay-speed.is-active { color: #fff; box-shadow: inset 0 -2px 0 var(--replay-light); }
.replay-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}
.replay-live:hover { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.6); }
.replay-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--replay-live); box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.22); }
#replay-dock button:focus-visible,
.replay-track:focus-visible { outline: 2px solid var(--replay-light); outline-offset: 3px; }

/* Things that sit on the band move up with the dock (down when the band is on top). */
body.airshow-replay-open:not(.ui-vertical-flip):not(.airshow-seat-view-active) #map-zoom-dock,
body.airshow-replay-open:not(.ui-vertical-flip):not(.airshow-seat-view-active) #cockpit-view-mode-dock,
body.airshow-replay-open:not(.ui-vertical-flip):not(.airshow-seat-view-active) #map-credit-anchor { translate: 0 calc(-1 * var(--airshow-replay-dock-h, 0px)); }
body.ui-vertical-flip.airshow-replay-open:not(.airshow-seat-view-active) #map-zoom-dock { translate: 0 var(--airshow-replay-dock-h, 0px); }

body.ui-vertical-flip #replay-dock {
  top: var(--airshow-replay-band-h, 72px);
  bottom: auto;
  padding: 14px 32px 40px;
  background: linear-gradient(0deg, transparent 0, color-mix(in oklab, var(--replay-bg) 70%, transparent) 30px, var(--replay-bg) 100%);
  transform: translateY(-14px);
}
body.ui-vertical-flip #replay-dock.is-open { transform: none; }

/* Seat view: the cabin picture fills the screen and the band shrinks into the seatback monitor,
   so the player sits on top of the picture at the bottom edge of the screen. */
body.airshow-seat-view-active #replay-dock,
body.airshow-seat-view-active.ui-vertical-flip #replay-dock {
  position: fixed;
  top: auto;
  bottom: 0;
  z-index: 1327; /* above the cabin picture (1325), under the leave/upgrade dialogs (1328+) */
  padding: 40px 32px max(14px, env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg,
    transparent 0,
    color-mix(in oklab, var(--replay-bg) 70%, transparent) 30px,
    color-mix(in oklab, var(--replay-bg) 94%, transparent) 62%,
    var(--replay-bg) 100%);
}

/* Phone: a compact two-line player; the Left Wing / Cockpit / Right Wing switch sits in the
   middle of the control line, between the transport buttons and the speeds. */
html.airshow-mobile-runtime #replay-dock { padding: 14px 12px 4px; }
html.airshow-mobile-runtime body.airshow-seat-view-active #replay-dock { padding: 14px 12px max(4px, env(safe-area-inset-bottom, 0px)); }
html.airshow-mobile-runtime .replay-dock-inner { gap: 0; }
html.airshow-mobile-runtime .replay-scrub { grid-template-columns: 52px minmax(0, 1fr) 60px; gap: 10px; }
html.airshow-mobile-runtime .replay-time { padding-top: 15px; font-size: 12px; gap: 2px; }
html.airshow-mobile-runtime .replay-time small { font-size: 7.5px; letter-spacing: 0.06em; }
html.airshow-mobile-runtime .replay-track { height: 36px; }
html.airshow-mobile-runtime .replay-profile { height: 24px; }
html.airshow-mobile-runtime .replay-rail { top: 23px; }
html.airshow-mobile-runtime .replay-head { height: 25px; }
html.airshow-mobile-runtime .replay-chapter { top: 28px; font-size: 8.5px; letter-spacing: 0.06em; }
html.airshow-mobile-runtime .replay-chapter i { top: -28px; height: 30px; }
html.airshow-mobile-runtime .replay-bubble { padding: 3px 7px 4px; font-size: 10px; gap: 6px; }
html.airshow-mobile-runtime .replay-bubble b { font-size: 11.5px; }
html.airshow-mobile-runtime .replay-controls { display: flex; justify-content: space-between; gap: 8px; height: 34px; }
html.airshow-mobile-runtime .replay-title { display: none; }
html.airshow-mobile-runtime .replay-transport { gap: 4px; }
html.airshow-mobile-runtime .replay-btn { width: 30px; height: 30px; }
html.airshow-mobile-runtime .replay-btn svg { width: 18px; height: 18px; }
html.airshow-mobile-runtime .replay-play { width: 34px; height: 34px; }
html.airshow-mobile-runtime .replay-right { gap: 6px; }
html.airshow-mobile-runtime .replay-speed { padding: 4px 5px; font-size: 11.5px; }
html.airshow-mobile-runtime .replay-live { height: 26px; padding: 0 9px; font-size: 10.5px; }
html.airshow-mobile-runtime body.airshow-replay-open:not(.airshow-seat-view-active):not(.ui-vertical-flip) #cockpit-hud { --airshow-cockpit-panel-raise: 46px; }
html.airshow-mobile-runtime body.airshow-replay-open:not(.airshow-seat-view-active):not(.ui-vertical-flip) #cockpit-view-mode-dock {
  top: auto !important;
  bottom: calc(var(--airshow-replay-band-h, 52px) + 7px) !important;
  transform: translateX(-50%) !important;
  translate: none;
  border-radius: 14px;
  box-shadow: none;
}
html.airshow-mobile-runtime body.airshow-replay-open:not(.airshow-seat-view-active):not(.ui-vertical-flip) .cockpit-view-mode-btn {
  height: 28px;
  min-width: 0;
  padding: 0 12px;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(236, 238, 248, 0.84);
  font-size: 11.5px;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
html.airshow-mobile-runtime body.airshow-replay-open:not(.airshow-seat-view-active):not(.ui-vertical-flip) .cockpit-view-mode-btn:first-child { border-radius: 14px 0 0 14px; }
html.airshow-mobile-runtime body.airshow-replay-open:not(.airshow-seat-view-active):not(.ui-vertical-flip) .cockpit-view-mode-btn:last-child { border-radius: 0 14px 14px 0; }
html.airshow-mobile-runtime body.airshow-replay-open:not(.airshow-seat-view-active):not(.ui-vertical-flip) .cockpit-view-mode-btn.active {
  border-color: #fff2d2;
  background: #fff2d2;
  color: #0d0a24;
  box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  #replay-dock { transform: none; transition: opacity 150ms linear; }
  #replay-dock.is-loading .replay-rail { animation: none; }
  .replay-head::after, .replay-btn, .replay-speed { transition: none; }
}
