/* Timeline Panel — expandable multi-track view opened from the existing
   #diagram_animation bottom bar (the bar stays the primary play/scrub control).
   Matches official tokens: navy #212F52, blue #0677BB, Rubik,
   white rgba(255,255,255,0.7), radius 12px. */

#timeline-panel {
  position: fixed;
  left: 5px; /* match #logo left edge */
  right: 6px; /* match #help_btn right edge */
  bottom: 6px; /* match #help_btn bottom edge */
  z-index: 39; /* below the floating bottom menu */
  height: 0; /* collapsed = hidden */
  background-color: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  font-family: Rubik, sans-serif;
  color: #212f52;
  overflow: hidden;
  transition: height 0.25s ease, opacity 0.2s ease;
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
}

#timeline-panel.tp-expanded {
  height: 200px;
  opacity: 1;
  pointer-events: auto;
}

/* ---- Header (visible when expanded) ---- */
.tp-header {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 16px;
  box-sizing: border-box;
}

.tp-title {
  font-size: 14px;
  font-weight: 600;
  color: #212f52;
  flex-shrink: 0;
  user-select: none;
}

/* ---- Open control on the old #diagram_animation bar ---- */
/* Scope under #diagram_animation so these beat `.bottom-menu button`
   (padding: 8px 16px) which would otherwise squeeze the icon. */
#diagram_animation .tp-openbtn,
#diagram_animation .tp-ghost-btn.tp-barbtn {
  padding: 0;
}
.tp-openbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-left: 6px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background-color: rgba(105, 115, 138, 0.336);
  color: #212f52;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.tp-openbtn:hover {
  background-color: rgba(105, 115, 138, 0.5);
}
.tp-openbtn svg {
  width: 30px;
  height: 30px;
}
.tp-openbtn.tp-active {
  background-color: #212f52;
  color: #fff;
}

.tp-transport {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
}

.tp-play {
  width: 30px;
  height: 30px;
  object-fit: contain;
  cursor: pointer;
  flex-shrink: 0;
}

.tp-btn {
  padding: 6px 12px;
  font-size: 14px;
  border: none;
  border-radius: 8px;
  background-color: #212f52;
  color: white;
  cursor: pointer;
  transition: background-color 0.3s;
  font-weight: 600;
  font-family: Rubik, sans-serif;
}

.tp-btn:hover {
  background-color: #454c5c;
}

.tp-edit {
  background-color: rgba(105, 115, 138, 0.336);
}

.tp-speed {
  position: relative;
  width: 64px;
  text-align: center;
}

.tp-time {
  margin-left: auto;
  font-size: 14px;
  font-weight: 400;
  color: #212f52;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  user-select: none;
}

/* Speed popup */
.tp-speed-popup {
  position: absolute;
  bottom: 40px;
  left: 0;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 999;
  display: none;
  flex-direction: column;
  width: 64px;
  padding: 4px 0;
  font-weight: 400;
  font-size: 14px;
}

.tp-speed-popup.tp-open {
  display: flex;
}

.tp-speed-option {
  padding: 4px 0;
  text-align: center;
  cursor: pointer;
  color: #212f52;
}

.tp-speed-option:hover {
  background-color: rgba(6, 119, 187, 0.12);
}

/* ---- Body (visible when expanded) ---- */
.tp-body {
  display: none;
  padding: 4px 16px 12px;
  box-sizing: border-box;
}

#timeline-panel.tp-expanded .tp-body {
  display: block;
}

.tp-track-area {
  display: flex;
  align-items: stretch;
  gap: 8px;
  max-height: 142px;
  overflow-y: auto;
}

.tp-labels {
  width: 142px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.tp-lanes {
  position: relative;
  flex: 1;
  min-width: 0;
  cursor: pointer;
  touch-action: none;
}

.tp-row-label {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  font-size: 13px;
  color: #212f52;
  flex-shrink: 0;
}

.tp-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
  border: 1px solid rgba(33, 47, 82, 0.3);
}

.tp-lane {
  position: relative;
  height: 30px;
  flex-shrink: 0;
}

/* connector segment between dots */
.tp-lane-line {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  transform: translateY(-50%);
  background-color: rgba(33, 47, 82, 0.18);
  border-radius: 1px;
}

.tp-dot {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  margin-top: -6px;
  border-radius: 50%;
  background-color: #212f52;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-sizing: border-box;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.tp-dot:hover {
  transform: scale(1.35);
}

.tp-dot.tp-dot-active {
  background-color: #0677bb;
  box-shadow: 0 0 0 3px rgba(6, 119, 187, 0.35);
}

/* Playhead overlay spanning all lanes */
.tp-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background-color: #0677bb;
  pointer-events: none;
  z-index: 5;
}

.tp-playhead::before {
  content: "";
  position: absolute;
  top: -3px;
  left: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #0677bb;
}

.tp-empty {
  display: flex;
  align-items: center;
  height: 30px;
  font-size: 13px;
  color: rgba(33, 47, 82, 0.55);
  font-style: italic;
}

/* ---- Track row name (truncate to make room for the focus button) ---- */
.tp-row-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Ghost overlay toggle ---- */
.tp-ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #212f52;
  cursor: pointer;
  opacity: 0.55;
  flex-shrink: 0;
  transition: opacity 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}
.tp-ghost-btn:hover {
  opacity: 1;
}
.tp-ghost-btn svg {
  width: 18px;
  height: 18px;
}
.tp-ghost-btn.tp-active {
  opacity: 1;
  color: #0677bb;
}
.tp-ghost-btn[data-mode="trail"] {
  color: #0677bb;
  background-color: rgba(6, 119, 187, 0.12);
}

/* Ghost toggle when placed on the old #diagram_animation bar — match the
   open button's footprint. */
.tp-ghost-btn.tp-barbtn {
  width: 40px;
  height: 40px;
  margin-left: 6px;
  border-radius: 8px;
  background-color: rgba(105, 115, 138, 0.336);
  color: #212f52;
  opacity: 1;
}
.tp-ghost-btn.tp-barbtn:hover {
  background-color: rgba(105, 115, 138, 0.5);
}
.tp-ghost-btn.tp-barbtn svg {
  width: 28px;
  height: 28px;
}
.tp-ghost-btn.tp-barbtn.tp-active {
  background-color: #212f52;
  color: #fff;
}
.tp-ghost-btn.tp-barbtn[data-mode="trail"] {
  background-color: #0677bb;
  color: #fff;
}

/* ---- Focus mode ---- */
.tp-track-focus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  background: transparent;
  color: #212f52;
  cursor: pointer;
  opacity: 0.35;
  flex-shrink: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}
.tp-track-focus:hover {
  opacity: 1;
}
.tp-track-focus svg {
  width: 14px;
  height: 14px;
}
.tp-track-focus.tp-active {
  opacity: 1;
  color: #0677bb;
}

/* Collapsed (non-focused) rows shrink to a thin bar. */
.tp-row-label.tp-focus-collapsed,
.tp-lane.tp-focus-collapsed {
  height: 14px;
  opacity: 0.45;
  overflow: hidden;
}
.tp-row-label.tp-focus-collapsed .tp-row-name,
.tp-row-label.tp-focus-collapsed .tp-track-focus {
  display: none;
}
.tp-lane.tp-focus-collapsed {
  pointer-events: none;
}
.tp-lane.tp-focus-collapsed .tp-dot {
  display: none;
}

/* Focused row gets a subtle highlight. */
.tp-row-label.tp-focus-active,
.tp-lane.tp-focus-active {
  background-color: rgba(6, 119, 187, 0.08);
  border-radius: 4px;
}

/* Focus indicator badge in the header. */
.tp-focus-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  margin-left: 8px;
  background-color: #0677bb;
  color: #fff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.tp-focus-close {
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
}

/* ---- Layout ----
   The panel docks to the bottom edge. The old #diagram_animation bar stays the
   primary control. When the panel is EXPANDED it lifts the bar and the other
   bottom-anchored UI up by the panel height so nothing is covered; collapsed,
   everything returns to its natural position. These :has() rules no-op when the
   panel element is absent (feature disabled). */
body:has(#timeline-panel.tp-expanded) #diagram_animation,
body:has(#timeline-panel.tp-expanded) #logo,
body:has(#timeline-panel.tp-expanded) #enrollment,
body:has(#timeline-panel.tp-expanded) #help_btn,
body:has(#timeline-panel.tp-expanded) #report_bug,
body:has(#timeline-panel.tp-expanded) #zoom-pan-controls,
body:has(#timeline-panel.tp-expanded) #info_btn {
  transition: bottom 0.25s ease;
}

/* Lift each bottom-anchored element by ~panel height (200px) above its
   natural bottom offset (panel docks at bottom:6px, so +6px clearance). */
body:has(#timeline-panel.tp-expanded) #diagram_animation {
  bottom: 226px;
}
body:has(#timeline-panel.tp-expanded) #logo {
  bottom: 211px;
}
body:has(#timeline-panel.tp-expanded) #enrollment {
  bottom: 294px;
}
body:has(#timeline-panel.tp-expanded) #help_btn {
  bottom: 212px;
}
body:has(#timeline-panel.tp-expanded) #report_bug {
  bottom: 219px;
}
body:has(#timeline-panel.tp-expanded) #zoom-pan-controls {
  bottom: 271px;
}
body:has(#timeline-panel.tp-expanded) #info_btn {
  bottom: 217px;
}

/* Also give the bottom-anchored transition to the bar even before expand so
   collapse animates smoothly back. */
body:has(#timeline-panel) #diagram_animation,
body:has(#timeline-panel) #logo,
body:has(#timeline-panel) #enrollment,
body:has(#timeline-panel) #help_btn,
body:has(#timeline-panel) #report_bug,
body:has(#timeline-panel) #zoom-pan-controls,
body:has(#timeline-panel) #info_btn {
  transition: bottom 0.25s ease;
}

/* ---- Side panels (left toolbar + right TOOLS/COLLAB menu) ----
   The lifted bottom-anchored controls (e.g. zoom/help at z-index 1000) would
   otherwise rise into and cover the vertically-centered side menus. Shift the
   side menus up when the panel is expanded so they clear. Centered menus use
   `top` (their slide-in transform is preserved); the left toolbar uses a
   transform so its own positioning is untouched. */
body:has(#timeline-panel) .menu-container,
body:has(#timeline-panel) #NavBar {
  transition: top 0.25s ease, transform 0.25s ease;
}
body:has(#timeline-panel.tp-expanded) .menu-container {
  top: calc(50% - 150px);
}
body:has(#timeline-panel.tp-expanded) #NavBar {
  transform: translateY(-60px);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .tp-title {
    display: none;
  }
  .tp-transport {
    gap: 6px;
    margin-left: 4px;
  }
  .tp-btn {
    padding: 6px 8px;
    font-size: 13px;
  }
  .tp-labels {
    width: 116px;
  }
  .tp-hint-how {
    display: none;
  }
  .tp-unit-long {
    display: none;
  }
  .tp-unit-short {
    display: inline;
  }
  .tp-mode-btn {
    padding: 3px 7px;
  }
  .tp-time {
    font-size: 13px;
  }
}

/* ==== Boat timing (when each boat reaches each point) ====================
   The lanes are a time axis. Dots sit at the moment the boat reaches that
   point and can be dragged; spans between them show how long each leg takes. */

#timeline-panel {
  user-select: none;
  -webkit-user-select: none;
}

/* ---- Header extras ---- */
.tp-hint {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.3;
}
.tp-hint-blurb,
.tp-hint-how {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tp-hint-blurb {
  font-size: 12px;
  font-weight: 500;
  color: rgba(33, 47, 82, 0.85);
}
.tp-hint-how {
  font-size: 11px;
  color: rgba(33, 47, 82, 0.55);
}
.tp-reset-all {
  flex-shrink: 0;
  padding: 4px 10px;
  border: none;
  border-radius: 8px;
  background-color: rgba(105, 115, 138, 0.2);
  color: #212f52;
  font-family: Rubik, sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.tp-reset-all:hover {
  background-color: rgba(105, 115, 138, 0.35);
}
/* The board's timing: [Even | By distance], then its value:
   "− 2 s between points +" or "− 0.75 boat lengths/s +" */
.tp-mode {
  flex-shrink: 0;
  display: inline-flex;
  padding: 2px;
  border-radius: 8px;
  background-color: rgba(105, 115, 138, 0.12);
}
.tp-mode-btn {
  padding: 3px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(33, 47, 82, 0.7);
  font-family: Rubik, sans-serif;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.tp-mode-btn:hover {
  color: #212f52;
  background-color: rgba(105, 115, 138, 0.2);
}
.tp-mode-btn.tp-active {
  background-color: #fff;
  color: #212f52;
  box-shadow: 0 1px 2px rgba(33, 47, 82, 0.2);
}
.tp-unit-short {
  display: none;
}
.tp-gap {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 4px;
  border-radius: 8px;
  background-color: rgba(105, 115, 138, 0.12);
  color: #212f52;
  font-family: Rubik, sans-serif;
  font-size: 12px;
  font-weight: 600;
}
.tp-gap-step {
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #212f52;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.tp-gap-step:hover {
  background-color: rgba(105, 115, 138, 0.25);
}
.tp-gap-input {
  width: 3.2em;
  height: 22px;
  box-sizing: border-box;
  padding: 0 4px;
  border: 1px solid rgba(33, 47, 82, 0.2);
  border-radius: 6px;
  background: #fff;
  color: #212f52;
  font: inherit;
  font-variant-numeric: tabular-nums;
  text-align: right;
  user-select: text;
  -webkit-user-select: text;
}
.tp-gap-input:focus {
  outline: none;
  border-color: #0677bb;
}
.tp-gap-unit {
  margin: 0 2px 0 1px;
}
.tp-header-time {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  color: #212f52;
  font-variant-numeric: tabular-nums;
}

/* ---- Ruler ---- */
.tp-ruler,
.tp-ruler-spacer {
  position: sticky;
  top: 0;
  height: 18px;
  flex-shrink: 0;
  z-index: 4;
}
.tp-ruler {
  background: linear-gradient(rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.75));
  border-bottom: 1px solid rgba(33, 47, 82, 0.15);
}
.tp-ruler-spacer {
  background: transparent;
}
.tp-tick {
  position: absolute;
  bottom: 0;
  width: 1px;
  height: 4px;
  background-color: rgba(33, 47, 82, 0.3);
}
.tp-tick-major {
  height: 7px;
  background-color: rgba(33, 47, 82, 0.55);
}
.tp-tick-label {
  position: absolute;
  bottom: 6px;
  left: 3px;
  font-size: 10px;
  line-height: 1;
  color: rgba(33, 47, 82, 0.7);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---- End of the animation ---- */
.tp-after-end {
  position: absolute;
  top: 18px;
  bottom: 0;
  right: 0;
  background: repeating-linear-gradient(
    135deg,
    rgba(33, 47, 82, 0.05) 0 4px,
    rgba(33, 47, 82, 0) 4px 8px
  );
  pointer-events: none;
}
.tp-end-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 1.5px dashed rgba(33, 47, 82, 0.45);
  pointer-events: none;
  z-index: 4;
}
.tp-end-marker::after {
  content: attr(data-label);
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  color: rgba(33, 47, 82, 0.75);
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.85);
  padding: 1px 3px;
  border-radius: 3px;
}

/* Vertical guide when a dragged dot lines up with another boat's point */
.tp-snap-guide {
  display: none;
  position: absolute;
  top: 18px;
  bottom: 0;
  width: 0;
  border-left: 1.5px solid #f08a24;
  pointer-events: none;
  z-index: 4;
}

/* ---- Lane contents ---- */
.tp-wait {
  position: absolute;
  top: 50%;
  left: 0;
  height: 0;
  border-top: 2px dashed;
  opacity: 0.55;
  transform: translateY(-50%);
}
.tp-seg {
  position: absolute;
  top: 0;
  bottom: 0;
  pointer-events: none;
}
.tp-seg-bar {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 4px;
  margin-top: -2px;
  border-radius: 2px;
  opacity: 0.55;
}
.tp-seg-label {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9.5px;
  line-height: 1;
  color: rgba(33, 47, 82, 0.75);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.tp-lane:hover .tp-seg-label,
.tp-lane.tp-lane-hot .tp-seg-label {
  opacity: 1;
}
.tp-seg.tp-seg-narrow .tp-seg-label {
  display: none;
}

/* Dots: drag sideways to change when the boat gets there. */
.tp-dot {
  cursor: ew-resize;
  touch-action: none;
  z-index: 2;
}
/* A time set by hand (vs. automatic even spacing). */
.tp-dot.tp-dot-set {
  border-radius: 3px;
}
.tp-dot.tp-dot-dragging,
.tp-dot.tp-dot-dragging:hover {
  transform: scale(1.45);
  background-color: #0677bb;
  box-shadow: 0 0 0 4px rgba(6, 119, 187, 0.3);
  z-index: 3;
}
.tp-dot.tp-dot-snap {
  box-shadow: 0 0 0 3px rgba(240, 138, 36, 0.6);
}
.tp-lanes.tp-timing-drag .tp-lane:not(.tp-lane-hot) {
  opacity: 0.75;
}
body.tp-body-timing-drag,
body.tp-body-timing-drag * {
  cursor: ew-resize !important;
}

/* After a drag, ease the rescale of the time axis. */
.tp-lanes.tp-smooth .tp-dot,
.tp-lanes.tp-smooth .tp-seg,
.tp-lanes.tp-smooth .tp-wait,
.tp-lanes.tp-smooth .tp-end-marker,
.tp-lanes.tp-smooth .tp-after-end {
  transition: left 0.28s ease, width 0.28s ease;
}

/* Per-boat "time by distance" and "even timing" buttons. */
.tp-track-distance,
.tp-track-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 20px;
  padding: 0;
  border: none;
  background: transparent;
  color: #0677bb;
  cursor: pointer;
  opacity: 0.7;
  flex-shrink: 0;
}
.tp-track-distance {
  color: #212f52;
  opacity: 0.45;
}
.tp-track-distance:hover,
.tp-track-reset:hover {
  opacity: 1;
}
.tp-track-distance svg,
.tp-track-reset svg {
  width: 13px;
  height: 13px;
}
.tp-row-label.tp-focus-collapsed .tp-track-distance,
.tp-row-label.tp-focus-collapsed .tp-track-reset {
  display: none !important;
}
.tp-lane.tp-focus-collapsed .tp-seg-label,
.tp-lane.tp-focus-collapsed .tp-wait {
  display: none;
}

/* ---- Floating read-out while dragging ---- */
.tp-drag-tip {
  position: fixed;
  left: 0;
  top: 0;
  transform: translate(-50%, -100%);
  padding: 5px 9px;
  border-radius: 7px;
  background-color: #212f52;
  color: #fff;
  font-family: Rubik, sans-serif;
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  z-index: 1001;
  opacity: 0;
  transition: opacity 0.1s ease;
}
.tp-drag-tip.tp-show {
  opacity: 1;
}
.tp-drag-tip b {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.tp-tip-name {
  margin-left: 6px;
  opacity: 0.8;
}
.tp-tip-delta {
  margin-left: 6px;
  color: #9fd3ff;
  font-variant-numeric: tabular-nums;
}
.tp-tip-note {
  font-size: 11px;
  color: #ffc58a;
}

/* ---- Type an exact time (double-click a dot) ---- */
.tp-time-editor {
  position: fixed;
  transform: translate(-50%, -100%);
  min-width: 190px;
  padding: 10px 12px;
  border-radius: 10px;
  background-color: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
  font-family: Rubik, sans-serif;
  color: #212f52;
  z-index: 1001;
  user-select: none;
}
.tp-te-title {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}
.tp-te-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.tp-te-row input {
  width: 72px;
  padding: 5px 7px;
  border: 1px solid rgba(33, 47, 82, 0.3);
  border-radius: 6px;
  font-family: Rubik, sans-serif;
  font-size: 14px;
  color: #212f52;
  user-select: text;
}
.tp-te-unit {
  font-size: 13px;
}
.tp-te-set {
  margin-left: auto;
  padding: 5px 12px;
  border: none;
  border-radius: 6px;
  background-color: #212f52;
  color: #fff;
  font-family: Rubik, sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.tp-te-set:hover {
  background-color: #0677bb;
}
.tp-te-hint {
  margin-top: 5px;
  font-size: 11px;
  color: rgba(33, 47, 82, 0.6);
}
.tp-te-reset {
  margin-top: 6px;
  padding: 0;
  border: none;
  background: none;
  color: #0677bb;
  font-family: Rubik, sans-serif;
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
}

/* ---- Arrival-time tags next to each position on the board ---- */
#tp-time-badges {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 38; /* above the board, under the timeline panel and side panel */
}
.tp-badge {
  position: absolute;
  left: 0;
  top: 0;
  padding: 1px 5px;
  border: 1.5px solid #212f52;
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.92);
  color: #212f52;
  font-family: Rubik, sans-serif;
  font-size: 10px;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}
.tp-badge.tp-badge-set {
  font-weight: 700;
}
.tp-badge.tp-badge-hot {
  background-color: #212f52;
  color: #fff;
  z-index: 1;
}

/* ---- "Custom frame timing" tag on the play bar, above the timeline
   button (some boats have set times) ---- */
#diagram_animation .tp-custom-pill {
  position: absolute;
  top: -12px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px 2px 7px;
  border: none;
  border-radius: 999px;
  background-color: #0677bb;
  color: #fff;
  font-family: Rubik, sans-serif;
  font-size: 11px;
  font-weight: 600;
  line-height: 16px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  z-index: 2;
}
#diagram_animation .tp-custom-pill:hover {
  background-color: #212f52;
}
.tp-custom-pill svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

/* "?" in the header: starts the Timeline & timing tutorial */
.tp-help-btn {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-left: -4px;
  padding: 0;
  border: 1.5px solid rgba(33, 47, 82, 0.45);
  border-radius: 50%;
  background: transparent;
  color: #212f52;
  font-family: Rubik, sans-serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.tp-help-btn:hover {
  border-color: #0677bb;
  background-color: #0677bb;
  color: #fff;
}
