.drone-toy {
  --dt-accent: #b9472b;
  --dt-paper: #f1f0eb;
  --dt-hair: rgba(14, 14, 12, 0.18);
  border: 1px solid var(--dt-hair);
  padding: clamp(12px, 2vw, 24px);
  background: var(--bg);
  overflow: hidden;
}
.drone-toy canvas {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}
.drone-toy button,
.drone-toy select {
  font: inherit;
  font-size: 12px;
  line-height: 1.35;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--dt-hair);
  border-radius: 2px;
  padding: 8px 11px;
  cursor: pointer;
  min-height: 36px;
}
.drone-toy button:hover,
.drone-toy button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}
.drone-toy :focus-visible {
  outline: 2px solid var(--dt-accent);
  outline-offset: 3px;
}
.drone-toy input {
  accent-color: var(--dt-accent);
  min-width: 0;
}
.dt-heading,
.dt-transport,
.dt-presets,
.dt-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.dt-heading {
  justify-content: space-between;
  margin-bottom: 12px;
}
.dt-pid-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  align-items: center;
}
.dt-pid-grid [data-view="mass"] {
  cursor: crosshair;
  touch-action: none;
}
.dt-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 20px;
  margin: 14px 0;
}
.dt-control {
  display: grid;
  grid-template-columns: 100px minmax(40px, 1fr) 58px;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  margin: 6px 0;
}
.dt-control output {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.dt-readout {
  font-size: 12px !important;
  line-height: 1.65;
  margin: 14px 0 0 !important;
  min-height: 3em;
  color: var(--ink-soft);
}
.dt-flow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
.dt-flow button {
  flex: 1;
  font-size: 14px;
  padding: 16px 3px;
}
.dt-flow small {
  font-size: 10px;
}
.dt-feedback {
  border-bottom: 1px solid var(--dt-hair);
  padding: 14px 0;
  text-align: center;
  font-size: 11px;
  color: var(--ink-soft);
}
.dt-plots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.dt-stage {
  height: clamp(270px, 40vw, 440px);
  position: relative;
  background: var(--dt-paper);
  border: 1px solid var(--dt-hair);
}
.dt-stage canvas {
  width: 100%;
  height: 100%;
  touch-action: none;
}
.dt-scene-note {
  position: absolute;
  bottom: 10px;
  left: 12px;
  font-size: 10px;
  color: var(--ink-soft);
  pointer-events: none;
}
.dt-transport {
  margin: 12px 0;
}
.dt-transport input {
  flex: 1;
  min-width: 80px;
}
.dt-time {
  font-size: 11px;
  min-width: 48px;
  text-align: right;
}
.dt-legend button {
  font-size: 10px;
  border-bottom: 3px solid var(--run-color);
}
.dt-legend button::before {
  content: "●";
  color: var(--run-color);
  margin-right: 5px;
}
.dt-plots {
  margin-top: 15px;
}
.drone-toy figcaption {
  margin-top: 18px;
}
.dt-breakdown {
  display: grid;
  gap: 9px;
  margin: 16px 0;
}
.dt-phase {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px;
  font-size: 11px;
}
.dt-phase i {
  grid-column: 1/-1;
  height: 4px;
  background: var(--dt-hair);
  position: relative;
}
.dt-phase i::before {
  content: "";
  display: block;
  width: var(--share);
  height: 100%;
  background: var(--phase, var(--ink-soft));
}
.dt-error {
  padding: 25px;
  font-size: 13px;
}
.dt-error a {
  text-decoration: underline;
}
@media (max-width: 600px) {
  .dt-pid-grid {
    grid-template-columns: 1fr;
  }
  .dt-pid-grid [data-view="mass"] {
    max-height: 260px;
    width: 208px;
    margin: auto;
    object-fit: contain;
  }
  .dt-controls,
  .dt-plots,
  .dt-net-detail,
  .dt-term-detail {
    grid-template-columns: 1fr;
  }
  .dt-control {
    grid-template-columns: 92px minmax(30px, 1fr) 55px;
  }
  .dt-flow button {
    font-size: 11px;
    padding: 14px 2px;
  }
  .dt-heading .mono {
    font-size: 9px;
  }
  .dt-transport {
    gap: 5px;
  }
  .dt-transport button {
    padding: 7px 9px;
  }
  .dt-perf-detail {
    min-height: 0;
  }
  .dt-stage {
    height: 300px;
  }
  .dt-scene-note {
    font-size: 9px;
  }
  .dt-plots {
    gap: 4px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .drone-toy * {
    scroll-behavior: auto !important;
  }
}
.drone-toy [hidden] {
  display: none !important;
}

.dt-dynamics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
}
.dt-slide-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}
.dt-slide-nav button:disabled {
  opacity: 0.3;
  cursor: default;
}
.dt-slide h3 {
  margin: 22px 0 16px;
  font-size: 19px;
}
.dt-slide {
  min-height: 380px;
}
.blog-body .dt-inputs {
  font-size: 13px;
  line-height: 1.65;
  margin: 14px 0;
}
.dt-equation {
  overflow-x: auto;
  padding: 4px 0;
  font-size: clamp(12px, 1.4vw, 16px);
}
.blog-body .dt-equation .katex-display {
  margin: 0.5em 0;
}
.blog-body .dt-results-note {
  margin-top: clamp(32px, 4vw, 52px);
}
@media (max-width: 600px) {
  .dt-dynamics-grid {
    grid-template-columns: 1fr;
  }
  .dt-dynamics-grid canvas {
    max-width: 400px;
    margin: auto;
  }
  .dt-slide {
    min-height: 430px;
  }
}

/* ---------- wall-time plot, log scale ---------- */
.dt-perf-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.dt-perf-legend i {
  width: 2px;
  height: 12px;
  background: #286a9b;
}
.dt-log {
  padding: 8px 0 22px 44px;
}
.dt-log-plot {
  position: relative;
  height: 220px;
}
.dt-log-tick {
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--y);
  border-top: 1px solid var(--dt-hair);
}
.dt-log-tick span {
  position: absolute;
  right: 100%;
  top: -0.6em;
  margin-right: 8px;
  font-size: 10px;
  color: var(--ink-soft);
  white-space: nowrap;
}
.dt-log-bars {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: stretch;
  gap: 6px;
}
.drone-toy .dt-log-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 0;
  border: none;
  border-radius: 0;
  min-height: 0;
  min-width: 0;
  position: relative;
  font-size: 10px;
  color: var(--ink-soft);
}
.drone-toy .dt-log-bar:hover,
.drone-toy .dt-log-bar[aria-pressed="true"] {
  background: transparent;
  color: var(--ink);
}
.dt-log-bar i {
  display: block;
  width: 100%;
  max-width: 36px;
  height: var(--h);
  background: var(--ink-soft);
}
.dt-log-bar:hover i,
.dt-log-bar[aria-pressed="true"] i {
  background: var(--ink);
}
.dt-log-bar span {
  position: absolute;
  top: 100%;
  margin-top: 6px;
}
.dt-perf-detail {
  font-size: 12px;
  min-height: 200px;
  margin-top: 16px;
}
.dt-phase i {
  height: 14px;
  overflow: visible;
}
.dt-phase i::before {
  background: var(--ink);
}
.dt-phase i.has-prev::after {
  content: "";
  position: absolute;
  left: var(--prev);
  top: -4px;
  bottom: -4px;
  width: 2px;
  margin-left: -1px;
  background: #286a9b;
}

/* ---------- network graph, static diagrams ---------- */
.dt-net,
.dt-diagram {
  display: block;
  width: 100%;
  height: auto;
}
.dt-net-layer {
  cursor: pointer;
  outline: none;
}
.dt-net-layer:focus-visible circle {
  stroke: var(--dt-accent);
}
.dt-net-detail,
.dt-term-detail {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 18px;
  align-items: start;
  margin-top: 14px;
  font-size: 12px;
  line-height: 1.65;
  color: var(--ink-soft);
  min-height: 170px;
}
.dt-net-detail strong,
.dt-term-detail strong {
  display: block;
  color: var(--ink);
  font-weight: 400;
  margin-bottom: 6px;
}
.blog-body .dt-net-detail p,
.blog-body .dt-term-detail p {
  font-size: 12px;
  line-height: 1.65;
  margin: 0;
}

/* ---------- reward terms ---------- */
[data-toy="rewards"] .dt-slide {
  min-height: 0;
}
.dt-terms {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 6px;
  font-size: clamp(15px, 1.8vw, 20px);
}
.dt-term {
  cursor: pointer;
  padding: 2px 6px;
  border: 1px solid transparent;
  border-radius: 2px;
  transition: background 120ms ease, color 120ms ease;
}
.dt-term:hover,
.dt-term[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}
.dt-term:focus-visible {
  outline: 2px solid var(--dt-accent);
  outline-offset: 2px;
}
.dt-terms .dt-eq {
  color: var(--ink-soft);
}

/* ---------- track generator ---------- */
.dt-control--wide {
  flex: 1;
  min-width: 200px;
  margin: 0;
}
@media (max-width: 600px) {
  .dt-log-bars {
    gap: 3px;
  }
  .dt-log-plot {
    height: 160px;
  }
}
@media (max-width: 600px) {
  .dt-net-detail,
  .dt-term-detail {
    grid-template-columns: 1fr;
  }
}
.dt-maps {
  margin-bottom: 12px;
}
