/* Interactive Webots simulation (#webots-sim): a dark 3D viewport above a light console.
   All rules are scoped to .ws; colours follow the Nerfies look of the page. */

.ws {
  --ws-ink: #363636;
  --ws-text: #4a4a4a;
  --ws-muted: #757575;
  --ws-line: #dbdbdb;
  --ws-line-soft: #ececec;
  --ws-soft: #f5f5f5;
  --ws-focus: hsl(204, 86%, 53%);           /* focus ring over the dark 3D view */
  --ws-focus-ui: var(--link, hsl(204, 86%, 40%));  /* on the light console: the page's ring */
  --ws-coop: #0072b2;
  --ws-local: #d55e00;
  --ws-local-text: #b34d00;
  --ws-gold: #e0a100;
  --ws-ground: #4f7146;
  --ws-radius: 10px;
  --ws-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  display: block;
  color: var(--ws-ink);
  font-family: var(--ws-font);
  font-size: 14px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}

.ws *,
.ws *::before,
.ws *::after {
  box-sizing: border-box;
}

.ws i {
  font-style: italic;
}

.ws sub,
.ws sup {
  font-size: 0.72em;
  line-height: 0;
}

/* the star of x*(t): full size and raised, as in the paper */
.ws sup.ws-star {
  margin-left: 0.04em;
  font-size: 1em;
  font-style: normal;
  vertical-align: 0.3em;
}

.ws-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------ viewport */

.ws-stage {
  position: relative;
  /* a definite width: the height cap must not narrow the stage through the aspect ratio */
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: max(340px, calc(100vh - 150px));
  overflow: hidden;
  border-radius: var(--ws-radius) var(--ws-radius) 0 0;
  background: var(--ws-ground);
  isolation: isolate;
  touch-action: pan-y;
  outline: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* focus ring above the canvases */
.ws-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 9;
  border-radius: inherit;
  box-shadow: inset 0 0 0 3px transparent;
  pointer-events: none;
  transition: box-shadow 0.15s ease;
}

.ws-stage:focus-visible::after {
  box-shadow: inset 0 0 0 3px var(--ws-focus);
}

.ws-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.ws-layer--3d {
  z-index: 0;
  cursor: grab;
}

.ws-layer--3d:active {
  cursor: grabbing;
}

.ws-layer--3d webots-view {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: pan-y;
}

/* the Webots toolbar, loading panel and labels: this page has its own controls */
.ws-layer--3d webots-view > :not(.webots-3d-view),
.ws-layer--3d webots-view .webots-label {
  display: none !important;
}

.ws-layer--3d canvas {
  display: block;
  outline: none;
}

.ws-layer--top {
  z-index: 1;
  display: none;
  cursor: grab;
  touch-action: pan-y;
}

.ws-layer--top.is-panning {
  cursor: grabbing;
}

.ws--top .ws-layer--top {
  display: block;
}

.ws--top .ws-layer--3d {
  visibility: hidden;
}

.ws-poster {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: var(--ws-ground);
  opacity: 0;
  visibility: hidden;
  /* the poster is another moment of the run: a short dissolve keeps the double image brief */
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}

.ws--show-poster .ws-poster {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease;
}

.ws-poster-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ws-poster--noimg .ws-poster-img {
  visibility: hidden;
}

/* phase line and recharge note, top left */
.ws-hud {
  position: absolute;
  z-index: 4;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* the poster shows another moment of the run: no phase line over it */
.ws--show-poster .ws-hud {
  opacity: 0;
}

.ws-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 6px 13px 6px 11px;
  border-radius: 999px;
  background: rgba(18, 22, 26, 0.62);
  -webkit-backdrop-filter: blur(8px) saturate(1.2);
  backdrop-filter: blur(8px) saturate(1.2);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.005em;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.ws-chip[hidden] {
  display: none;
}

.ws-chip-text {
  min-width: 0;
}

.ws-chip-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffd84d;
  box-shadow: 0 0 0 3px rgba(255, 216, 77, 0.28);
}

.ws-chip--phase[data-phase="learn"] .ws-chip-dot {
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35);
  animation: ws-pulse 1.1s ease-in-out infinite;
}

.ws-chip--phase[data-phase="track"] .ws-chip-dot {
  background: #57b2ff;
  box-shadow: 0 0 0 3px rgba(87, 178, 255, 0.3);
}

.ws-chip--flight {
  padding-left: 8px;
  font-size: 12.5px;
}

.ws-chip-bolt {
  display: inline-flex;
  color: var(--c, #ffd84d);
}

.ws-chip-bolt .ws-ico {
  width: 15px;
  height: 15px;
}

@keyframes ws-pulse {
  50% {
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0);
  }
}

/* big play button with the loading ring */
.ws-center {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.ws--show-center .ws-center {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease;
}

.ws-bigplay {
  position: relative;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(18, 22, 26, 0.6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #fff;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.ws-bigplay:hover {
  background: rgba(18, 22, 26, 0.78);
  transform: scale(1.05);
}

.ws-bigplay:focus-visible {
  outline: 3px solid var(--ws-focus);
  outline-offset: 3px;
}

.ws-bigplay-icon .ws-ico {
  width: 32px;
  height: 32px;
  margin-left: 4px;
}

.ws-ring {
  position: absolute;
  inset: -4px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.ws-ring svg {
  display: block;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ws-ring circle {
  fill: none;
  stroke-width: 3.5;
}

.ws-ring-bg {
  stroke: rgba(255, 255, 255, 0.22);
}

.ws-ring-fg {
  stroke: #fff;
  stroke-linecap: round;
  stroke-dasharray: 0 100;
  transition: stroke-dasharray 0.2s linear;
}

.ws--3d-loading:not(.ws--top) .ws-ring {
  opacity: 1;
}

.ws-loadnote {
  min-height: 1.3em;
  padding: 2px 10px;
  border-radius: 999px;
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ws--3d-loading:not(.ws--top) .ws-loadnote {
  opacity: 1;
}

.ws--want-play .ws-bigplay-icon {
  opacity: 0.55;
}

/* one-line messages */
.ws-msg {
  position: absolute;
  z-index: 6;
  left: 12px;
  bottom: 12px;
  max-width: calc(100% - 24px);
  margin: 0;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(18, 22, 26, 0.66);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 12.5px;
  line-height: 1.35;
}

.ws-msg[hidden] {
  display: none;
}

.ws-toast {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: 14px;
  margin: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(18, 22, 26, 0.7);
  color: #fff;
  font-size: 12.5px;
  white-space: nowrap;
  transform: translate(-50%, 6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.ws-toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ------------------------------------------------------------------ console */

.ws-console {
  border: 1px solid var(--ws-line);
  border-top: 0;
  border-radius: 0 0 var(--ws-radius) var(--ws-radius);
  background: #fff;
}

.ws-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 14px 10px 12px;
  border-bottom: 1px solid var(--ws-line-soft);
}

.ws-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  font: inherit;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.ws-btn .ws-ico {
  width: 20px;
  height: 20px;
}

.ws-btn--play {
  background: var(--ws-ink);
  color: #fff;
}

.ws-btn--play:hover {
  background: #1f1f1f;
}

.ws-btn--play .ws-ico {
  width: 22px;
  height: 22px;
}

.ws-btn--icon {
  border: 1px solid var(--ws-line);
  background: #fff;
  color: var(--ws-text);
}

.ws-btn--icon:hover {
  border-color: #b5b5b5;
  color: var(--ws-ink);
}

.ws-btn:focus-visible,
.ws-select:focus-visible,
.ws-seg:focus-visible,
.ws-st:focus-visible,
.ws-back:focus-visible {
  outline: 2px solid var(--ws-focus-ui);
  outline-offset: 2px;
}

/* timeline */
.ws-timeline {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
}

.ws-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 26px;
  cursor: pointer;
  outline: none;
  touch-action: pan-y;
}

.ws-rail,
.ws-fill {
  position: absolute;
  left: 0;
  right: 0;
  top: 10px;
  height: 6px;
  border-radius: 3px;
}

.ws-rail {
  background: linear-gradient(90deg, #f3e6c1 0 var(--n, 33.333%), #d9e8f3 var(--n, 33.333%) 100%);
}

.ws-fill {
  background: linear-gradient(90deg, var(--ws-gold) 0 var(--n, 33.333%), var(--ws-coop) var(--n, 33.333%) 100%);
  clip-path: inset(0 calc(100% - var(--p, 0%)) 0 0);
}

.ws-nmark {
  position: absolute;
  top: 7px;
  left: var(--n, 33.333%);
  width: 2px;
  height: 12px;
  margin-left: -1px;
  border-radius: 1px;
  background: #fff;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.08);
}

.ws-flights {
  position: absolute;
  left: 0;
  right: 0;
  top: 19px;
  height: 3px;
}

.ws-fl {
  position: absolute;
  top: 0;
  height: 3px;
  border-radius: 2px;
  background: var(--c);
}

.ws-thumb {
  position: absolute;
  top: 13px;
  left: 0;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid var(--ws-ink);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  pointer-events: none;
}

.ws-track:hover .ws-thumb,
.ws-track.is-dragging .ws-thumb {
  transform: scale(1.15);
}

.ws-track:focus-visible .ws-thumb {
  border-color: var(--ws-focus-ui);
  box-shadow: 0 0 0 3px rgba(14, 120, 190, 0.35), 0 1px 3px rgba(0, 0, 0, 0.25);
}

.ws-tl-labels {
  position: absolute;
  left: 0;
  right: 0;
  top: 25px;
  height: 14px;
  color: var(--ws-muted);
  font-size: 11px;
  line-height: 14px;
  pointer-events: none;
}

.ws-tl-lab {
  position: absolute;
  top: 0;
  white-space: nowrap;
}

.ws-tl-lab--n {
  transform: translateX(-50%);
  color: var(--ws-ink);
  font-family: "Computer Modern Serif", Georgia, "Times New Roman", serif;
  font-size: 12px;
}

.ws-tl-lab--track {
  margin-left: 9px;
}

.ws-tl-lab--fl {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.ws-tl-bolt {
  display: inline-flex;
  color: var(--c);
}

.ws-tl-bolt .ws-ico {
  width: 11px;
  height: 11px;
}

.ws-tip {
  position: absolute;
  top: -22px;
  left: 0;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--ws-ink);
  color: #fff;
  font-size: 11px;
  line-height: 15px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.ws-tip.is-on {
  opacity: 1;
}

/* step readout, speed, view, camera */
.ws-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.ws-time {
  min-width: 7.6em;
  color: var(--ws-ink);
  font-size: 13.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ws-time i {
  font-family: "Computer Modern Serif", Georgia, "Times New Roman", serif;
  font-size: 15px;
}

.ws-time-sep,
.ws-time-max {
  color: var(--ws-muted);
}

.ws-select {
  height: 40px;
  padding: 0 30px 0 14px;
  border: 1px solid var(--ws-line);
  border-radius: 999px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%234a4a4a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center / 12px 12px;
  color: var(--ws-ink);
  font: 600 13px/1 var(--ws-font);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.ws-select:hover {
  border-color: #b5b5b5;
}

.ws-switch {
  display: inline-flex;
  flex: none;
  height: 40px;
  padding: 0;
  border: 1px solid var(--ws-line);
  border-radius: 999px;
  background: var(--ws-soft);
}

/* full-height buttons (tap targets); the dark pill of the active one is inset */
.ws-seg {
  min-width: 52px;
  height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ws-text);
  font: 600 13px/1 var(--ws-font);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.ws-seg:hover {
  color: var(--ws-ink);
}

.ws-seg[aria-pressed="true"] {
  background: var(--ws-ink);
  box-shadow: inset 0 0 0 3px var(--ws-soft);
  color: #fff;
}

.ws-seg:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ------------------------------------------------------------------ panels */

.ws-panes {
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(0, 1.22fr) minmax(0, 0.86fr);
}

.ws-pane {
  min-width: 0;
  padding: 14px 18px 16px;
}

.ws-pane + .ws-pane {
  border-left: 1px solid var(--ws-line-soft);
}

.ws-pane-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  margin-bottom: 8px;
}

.ws-pane-title {
  margin: 0;
  color: var(--ws-ink);
  font-family: var(--ws-font);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0;
}

.ws-pane-note {
  color: var(--ws-muted);
  font-size: 12px;
}

.ws-key {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  color: var(--ws-text);
  font-size: 12px;
}

.ws-key-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.ws-sw {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.ws-sw--coop {
  background: var(--ws-coop);
}

.ws-sw--local {
  background: var(--ws-local);
}

.ws-c-coop {
  color: var(--ws-coop);
}

.ws-c-local {
  color: var(--ws-local-text);
}

/* stations */
.ws-st-cols,
.ws-st,
.ws-st-axis {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) 56px minmax(0, 1.3fr);
  align-items: center;
  column-gap: 10px;
}

.ws-st-cols {
  margin-bottom: 2px;
  color: var(--ws-muted);
  font-size: 11px;
  line-height: 14px;
}

.ws-st-cols span:nth-child(2) {
  text-align: center;
}

.ws-st-list {
  display: grid;
}

.ws-st {
  width: calc(100% + 12px);
  height: 28px;
  margin: 0 -6px;
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ws-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.ws-st:hover {
  background: var(--ws-soft);
}

.ws-st-dot {
  display: inline-block;
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14);
}

.ws-st-name {
  overflow: hidden;
  font-size: 13px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ws-st-tele {
  display: flex;
  justify-content: center;
}

.ws-tele {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f5c400;
  box-shadow: 0 0 0 3px rgba(245, 196, 0, 0.22);
  transition: background-color 0.4s ease, box-shadow 0.4s ease;
}

.ws--learned .ws-tele {
  background: #4a4a4a;
  box-shadow: 0 0 0 3px rgba(74, 74, 74, 0.08);
}

.ws-bars {
  display: grid;
  gap: 3px;
}

.ws-ebar {
  position: relative;
  display: block;
  height: 5px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--ws-line-soft);
}

.ws-ebar::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
  border-radius: 3px;
  transition: width 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ws-ebar--coop::after {
  background: var(--ws-coop);
}

.ws-ebar--local::after {
  background: var(--ws-local);
}

.ws--learned .ws-ebar::after {
  width: var(--w, 0%);
}

.ws-st-axis {
  height: 16px;
  margin-top: 1px;
  color: var(--ws-muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.ws--learned .ws-st-axis {
  opacity: 1;
}

.ws-st-ticks {
  position: relative;
  height: 16px;
}

.ws-st-ticks span {
  position: absolute;
  top: 2px;
  transform: translateX(-50%);
}

.ws-st-ticks span::before {
  content: "";
  position: absolute;
  top: -3px;
  left: 50%;
  width: 1px;
  height: 3px;
  background: #c4c4c4;
}

.ws-st-foot {
  margin: 6px 0 0;
  color: var(--ws-text);
  font-size: 12.5px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.ws-st-foot b {
  font-weight: 600;
}

.ws-st-main[hidden],
.ws-st-detail[hidden] {
  display: none;
}

/* one station: its estimates */
.ws-dt-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -4px 0 10px -6px;
}

.ws-back {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ws-text);
  cursor: pointer;
}

.ws-back:hover {
  background: var(--ws-soft);
  color: var(--ws-ink);
}

.ws-back .ws-ico {
  width: 18px;
  height: 18px;
}

.ws-dt-name {
  font-size: 14px;
  font-weight: 600;
}

.ws-mats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.ws-m {
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 5px;
  min-width: 0;
}

.ws-m-cap {
  color: var(--ws-muted);
  font-size: 12px;
  font-weight: 600;
}

.ws-m--coop .ws-m-cap {
  color: var(--ws-coop);
}

.ws-m--local .ws-m-cap {
  color: var(--ws-local-text);
}

.ws-mat {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 1px 9px;
  padding: 3px 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* square brackets */
.ws-mat::before,
.ws-mat::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 5px;
  border: 1.5px solid var(--ws-ink);
}

.ws-mat::before {
  left: 0;
  border-right: 0;
}

.ws-mat::after {
  right: 0;
  border-left: 0;
}

.ws-m-err {
  color: var(--ws-text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.ws-m-err b {
  font-weight: 600;
}

.ws-dt-note,
.ws-dt-wait {
  margin: 10px 0 0;
  color: var(--ws-muted);
  font-size: 12px;
}

.ws-dt-wait {
  color: var(--ws-text);
  font-size: 13px;
}

/* distance chart */
.ws-chart-key {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: -2px 0 6px;
  color: var(--ws-text);
  font-size: 12px;
}

.ws-ln {
  display: inline-block;
  width: 14px;
  height: 0;
  border-top: 2px solid;
}

.ws-ln--coop {
  border-color: var(--ws-coop);
}

.ws-ln--local {
  border-color: var(--ws-local);
}

.ws-val {
  min-width: 2.4em;
  color: var(--ws-ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.ws-chart-box {
  position: relative;
  height: 158px;
}

.ws-chart {
  display: block;
  width: 100%;
  height: 100%;
}

/* legend */
.ws-legend {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ws-legend li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin: 0;
  color: var(--ws-text);
  font-size: 13px;
  line-height: 1.3;
}

.ws-lg-sw {
  display: block;
  flex: none;
  width: 36px;
  height: 22px;
  overflow: hidden;
  border-radius: 5px;
  background: #5d8450;
}

.ws-lg-sw svg {
  display: block;
  width: 36px;
  height: 22px;
}

.ws-lg-sw .ws-lg-top,
.ws--top .ws-lg-sw--two .ws-lg-3d {
  display: none;
}

.ws--top .ws-lg-sw .ws-lg-top {
  display: block;
}

.ws-ico {
  display: block;
}

/* waiting for data */
.ws--loading-data .ws-console {
  min-height: 300px;
}

.ws--loading-data .ws-bar,
.ws--loading-data .ws-panes {
  visibility: hidden;
}

/* ------------------------------------------------------------------ responsive */

@media (max-width: 1060px) {
  .ws-panes {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .ws-pane--legend {
    grid-column: 1 / -1;
    border-top: 1px solid var(--ws-line-soft);
  }

  .ws-pane + .ws-pane.ws-pane--legend {
    border-left: 0;
  }

  .ws-legend {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 16px;
  }
}

@media (max-width: 860px) {
  .ws-stage {
    aspect-ratio: 4 / 3;
  }

  .ws-bar {
    flex-wrap: wrap;
    row-gap: 6px;
    padding: 10px 12px;
  }

  .ws-timeline {
    flex-basis: calc(100% - 56px);
  }

  .ws-tools {
    flex: 1 1 100%;
    justify-content: flex-end;
  }

  .ws-time {
    margin-right: auto;
    padding-left: 4px;
  }
}

@media (max-width: 680px) {
  .ws-stage {
    aspect-ratio: 1 / 1;
  }

  .ws-panes {
    grid-template-columns: minmax(0, 1fr);
  }

  .ws-pane + .ws-pane {
    border-left: 0;
    border-top: 1px solid var(--ws-line-soft);
  }

  .ws-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ws-tl-lab--fl {
    font-size: 0;
    gap: 0;
  }

  .ws-chip {
    font-size: 12px;
    padding: 5px 11px 5px 9px;
  }
}

@media (max-width: 420px) {
  .ws-stage {
    aspect-ratio: 5 / 6;
  }

  .ws-st-cols,
  .ws-st,
  .ws-st-axis {
    grid-template-columns: 10px minmax(0, 1.25fr) 50px minmax(0, 1fr);
    column-gap: 8px;
  }

  .ws-pane {
    padding: 12px 14px 14px;
  }

  .ws-tools {
    gap: 6px;
  }

  .ws-time {
    min-width: 0;
    font-size: 13px;
  }

  .ws-seg {
    min-width: 40px;
    padding: 0 10px;
  }

  .ws-select {
    padding: 0 26px 0 12px;
    background-position: right 10px center;
  }

  .ws-legend {
    grid-template-columns: minmax(0, 1fr);
  }

  .ws-mats {
    gap: 6px;
  }

  .ws-mat {
    gap: 1px 6px;
    padding: 3px 5px;
    font-size: 11px;
  }
}

@media (hover: none) {
  .ws-tip {
    display: none;
  }
}

/* touch: every target at least 40 px tall */
@media (pointer: coarse) {
  .ws-track::before {
    content: "";
    position: absolute;
    left: -6px;
    right: -6px;
    top: -7px;
    bottom: -7px;
  }

  .ws-st {
    height: 40px;
  }

  .ws-back {
    width: 40px;
    height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ws *,
  .ws *::before,
  .ws *::after {
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
}


/* ------------------------------------------------- 3D and top view side by side */

.ws-views {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2px;
  background: var(--ws-line-soft, #e4e4e4);
  border-radius: var(--ws-radius) var(--ws-radius) 0 0;
  overflow: hidden;
}

.ws-views .ws-stage {
  aspect-ratio: 4 / 3;
  max-height: none;
  border-radius: 0;
}

.ws-topbox {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--ws-ground);
  touch-action: pan-y;
}

.ws-topbox .ws-layer--top {
  display: block;
}


@media (max-width: 760px) {
  .ws-views {
    grid-template-columns: minmax(0, 1fr);
  }
  .ws-views .ws-stage,
  .ws-topbox {
    aspect-ratio: 4 / 3;
  }
  .ws-view + .ws-view .ws-view-head {
    border-top: 1px solid var(--ws-line-soft);
  }
}

/* a header over each view: one run, seen two ways */
.ws-views {
  border: 1px solid var(--ws-line);
  border-bottom: 0;
}

.ws-view {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #fff;
}

.ws-view-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  padding: 11px 14px 10px;
  border-bottom: 1px solid var(--ws-line-soft);
  background: #fff;
}

.ws-view-title {
  margin: 0;
  color: var(--ws-ink);
  font-family: var(--ws-font);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

.ws-view-note {
  color: var(--ws-muted);
  font-size: 13px;
  line-height: 1.3;
}

/* legend: the 3D and the top-view symbol of each item, side by side */
.ws-lg-sw {
  display: flex;
  gap: 3px;
  width: 75px;
  background: none;
  border-radius: 0;
}

.ws-lg-sw svg {
  flex: none;
  border-radius: 5px;
  background: #5d8450;
}

.ws-lg-sw .ws-lg-top,
.ws--top .ws-lg-sw--two .ws-lg-3d {
  display: block;
}
