/* Stopbar widget. Every rule stays under .stopbar so the PE-Calc shell is untouched. */
.stopbar {
  --cabinet: #c5cac2;
  --sheet: #e4e6df;
  --ink: #1a2018;
  --muted: #4e574c;
  --grass: #3e4a3c;
  --asphalt: #3a4046;
  --mark: #f2f0e7;
  --yellow: #e1b12c;
  --go: #1c9a45;
  --amber: #e6a817;
  --stop: #d23b2a;
  height: 760px;
  margin: 4px 0 20px;
  border: 1px solid var(--ink);
  background: var(--cabinet);
  color: var(--ink);
  font-family: Aptos, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.35;
}

.stopbar * { box-sizing: border-box; }

.stopbar button,
.stopbar input,
.stopbar select {
  font: inherit;
  color: inherit;
}

.stopbar button {
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 2px;
  padding: 4px 10px;
  cursor: pointer;
}

.stopbar button:hover { background: rgba(26, 32, 24, 0.06); }

.stopbar button[aria-pressed="true"],
.stopbar #play[data-running="false"] {
  background: var(--ink);
  color: var(--sheet);
}

.stopbar button:focus-visible,
.stopbar input:focus-visible,
.stopbar select:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.stopbar .app {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  grid-template-rows: auto minmax(0, 1fr) 196px;
  background: var(--sheet);
}

.stopbar header {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px 28px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--ink);
  flex-wrap: wrap;
  background: var(--sheet);
}

.stopbar h2 {
  font-weight: 600;
  letter-spacing: -0.03em;
  font-size: 15px;
  margin: 0 0 6px;
  padding: 0;
  border: 0;
  color: var(--ink);
}

.stopbar p { margin: 0; }

.stopbar .transport {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
}

.stopbar time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 5.6rem;
}

.stopbar .speeds { display: flex; gap: 4px; }

.stopbar .stage { min-height: 0; background: var(--grass); }

.stopbar .stage canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}

.stopbar .stage canvas:active { cursor: grabbing; }

.stopbar .timespace {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-top: 1px solid var(--ink);
  background: var(--sheet);
}

.stopbar .ts-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 12px 2px;
  flex-wrap: wrap;
}

.stopbar .ts-head label { font-weight: 600; }

.stopbar .ts-head p { margin: 0; color: var(--muted); font-size: 12.5px; }

.stopbar #ts { width: 100%; height: 100%; display: block; }

.stopbar aside {
  grid-column: 2;
  grid-row: 2 / 4;
  overflow: auto;
  border-left: 1px solid var(--ink);
  padding: 12px 14px 28px;
  background: var(--sheet);
}

.stopbar aside section { margin-bottom: 16px; }

.stopbar .quiet,
.stopbar .footnote { color: var(--muted); }

.stopbar .footnote { font-size: 13px; margin: 8px 0 0; }

.stopbar .presets,
.stopbar .measures { margin: 0 0 8px; }

.stopbar .presets { display: flex; gap: 6px; }

.stopbar .measures div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0;
}

.stopbar .measures dt { font-weight: 400; }

.stopbar .measures dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: right;
}

.stopbar .slider-block,
.stopbar .num-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  margin-top: 8px;
}

.stopbar .num-row span { flex: 1; padding-right: 8px; }
.stopbar .num-row input { width: 4.4rem; }

.stopbar input[type="range"] {
  width: 100%;
  accent-color: var(--ink);
  margin: 2px 0 0;
}

.stopbar .tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.stopbar .modes,
.stopbar .pair {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.stopbar .modes { margin-top: 2px; }

.stopbar #timing-note { margin: 8px 0 0; font-size: 13px; }

.stopbar #hint { font-size: 13.5px; margin: 8px 0; }

.stopbar #net-status {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stopbar .approach {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.stopbar #plan.tool-draw,
.stopbar #plan.tool-bulldoze { cursor: crosshair; }
.stopbar #plan.tool-hand { cursor: grab; }
.stopbar #plan.tool-junction { cursor: pointer; }
.stopbar #plan.panning,
.stopbar #plan.tool-hand:active { cursor: grabbing; }

@media (max-width: 860px) {
  .stopbar { height: auto; }

  .stopbar .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(360px, 62vh) 210px auto;
    height: auto;
    min-height: 0;
  }

  .stopbar .stage { grid-row: 2; height: 62vh; }
  .stopbar .timespace { grid-column: 1; grid-row: 3; }
  .stopbar aside {
    grid-column: 1;
    grid-row: 4;
    border-left: 0;
    border-top: 1px solid var(--ink);
    max-height: none;
  }
}
