:root {
  --bg: #15181c;
  --panel: #1c2026;
  --border: #2a3038;
  --text: #e5e8ec;
  --muted: #95a0ad;
  --accent: #3d8bfd;
  --accent-text: #ffffff;
  --input: #252a31;
  --stage: #dfe5d3;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
}

#app {
  display: flex;
  height: 100vh;
  height: 100dvh;
}

#sidebar {
  width: 320px;
  flex-shrink: 0;
  overflow-y: auto;
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 2px 2px 4px;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.2px;
}

/* Testlabor (labor.html) */
.brand h1 small {
  font-size: 0.7em;
  font-weight: 600;
  color: var(--accent);
}

.version {
  font-size: 12px;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel[hidden] {
  display: none;
}

.panel h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}

/* Einklappbarer Bereich (Szenario): Pfeil rechts in der Überschrift */
.panel h2 .fold {
  padding: 0 6px;
  font-size: 14px;
  line-height: 1.2;
  color: var(--muted);
  background: none;
  border-color: transparent;
  transition: transform 0.15s;
}

.panel h2 .fold:hover {
  color: var(--text);
  border-color: var(--border);
}

.panel h2 .fold[aria-expanded='false'] {
  transform: rotate(-90deg);
}

.panel-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-body[hidden] {
  display: none;
}

/* Lange Beschreibung gekürzt, ein Klick zeigt alles */
.hint.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
}

.hint.clamp[hidden] {
  display: none;
}

.clock {
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-transform: none;
}

.hint {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
}

/* Zwischenüberschrift in einem Feld (z. B. je Zufahrt bei den Fahrbeziehungen) */
.field .sub {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--muted);
}

input[type='text'] {
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 10px;
  width: 100%;
}

input[type='text']:focus {
  outline: none;
  border-color: var(--accent);
}

.dirty {
  color: #f0b45a;
}

.status {
  margin: 0;
  font-size: 12.5px;
  color: #8fd19e;
}

.status.error {
  color: #ff8a80;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

.check[hidden] {
  display: none;
}

.check input {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  margin: 0;
}

button.danger {
  color: #ff9a8f;
}

button.danger:hover {
  border-color: #7a3a33;
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

.row.three {
  grid-template-columns: 1fr 1fr 1fr;
}

#inspector {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tools {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 24px);
  pointer-events: none;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  background: rgba(28, 32, 38, 0.94);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  max-width: 100%;
  overflow-x: auto;
  pointer-events: auto;
}

.toolbar[hidden] {
  display: none;
}

.toolbar button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.toolbar svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.toolbar svg text {
  fill: currentColor;
  stroke: none;
  font: 700 6.5px system-ui, sans-serif;
}

.toolbar.options {
  font-size: 13px;
  gap: 10px;
  padding: 5px 10px;
}

.toolbar.options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  color: var(--muted);
}

.toolbar.options select {
  padding: 4px 8px;
}

@media (max-width: 1450px) {
  .toolbar .lbl {
    display: none;
  }
}

.toolbar button {
  padding: 6px 11px;
  font-size: 13px;
  white-space: nowrap;
}

.toolbar button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.toolbar .sep {
  width: 1px;
  align-self: stretch;
  margin: 2px 4px;
  background: var(--border);
}

/* Ausgeklappte Werkzeuggruppe (unter der Werkzeugleiste) */
.toolbar.flyout .lbl {
  display: inline;
}

.toolbar .group .caret,
.toolbar .group .name {
  white-space: nowrap;
}

.toolbar .group .caret {
  font-size: 10px;
  opacity: 0.7;
  margin-left: -2px;
}

/* Schmale Fenster: Gruppen nur mit Symbol (Name im Tooltip) */
@media (max-width: 1250px) {
  .toolbar .group .name {
    display: none;
  }
}

.toolbar .group[aria-expanded='true'] {
  border-color: var(--accent);
}

.toolbar .check {
  padding: 0 6px;
  white-space: nowrap;
}

.toolbar .group canvas,
.toolbar.options canvas {
  flex-shrink: 0;
}

.toolbar.options input[type='text'] {
  font: inherit;
  color: var(--text);
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 4px 8px;
}

/* Buslinien in der Seitenleiste */
.busline {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 8px 10px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--line);
  border-radius: 8px;
}

.busline.selected {
  background: rgba(61, 139, 253, 0.08);
}

.busline-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.busline-head button {
  padding: 4px 8px;
  font-size: 12px;
}

.busline-name {
  width: 3.2em;
  font: 700 13px system-ui, sans-serif;
  text-align: center;
  color: #fff;
  background: var(--line);
  border: none;
  border-radius: 5px;
  padding: 4px 2px;
}

.busline-color {
  padding: 2px 4px;
  font-size: 14px;
}

.busline-route {
  flex: 1;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.busline-next {
  font-size: 12px;
  color: var(--muted);
}

.hint.error {
  color: #ff8a80;
}

/* Schilder-Palette: Fläche mit allen Verkehrszeichen unter der Werkzeugleiste */
.sign-palette {
  pointer-events: auto;
  width: min(660px, 100%);
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  padding: 10px 12px 12px;
  background: rgba(28, 32, 38, 0.97);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.sign-palette[hidden] {
  display: none;
}

.sign-palette .title {
  margin: 8px 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sign-palette .title:first-child {
  margin-top: 0;
}

.sign-palette .grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sign-palette button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 78px;
  padding: 6px 3px 4px;
  background: #2c323a;
}

.sign-palette button:hover {
  background: #353c46;
}

.sign-palette button.active {
  border-color: var(--accent);
  background: #24364f;
}

.sign-palette .nr {
  font-size: 10.5px;
  line-height: 1.2;
  min-height: 2.4em;
  color: var(--muted);
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 100%;
}

.sign-palette .hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

select,
button {
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 10px;
}

button {
  cursor: pointer;
}

button:hover {
  border-color: #3b4450;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

button.wide {
  width: 100%;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}

.segmented button {
  padding: 6px 0;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.segmented button.active {
  background: #2d3a4d;
  border-color: var(--accent);
}

.slider {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

.slider[hidden] {
  display: none;
}

.slider-head {
  display: flex;
  justify-content: space-between;
}

.slider output {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

input[type='range'] {
  width: 100%;
  accent-color: var(--accent);
}

.stats {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 10px;
  margin: 0;
  font-size: 13px;
}

.stats dt {
  color: var(--muted);
}

.stats dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#stage {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--stage);
}

#view {
  position: relative; /* über der WebGL-Zeichenfläche der Perspektive */
  display: block;
  width: 100%;
  flex: 1;
  min-height: 0;
  cursor: grab;
  touch-action: none;
}

/* Perspektive (WebGL): liegt genau unter #view, Lage und Größe setzt der Renderer */
#view-gl {
  position: absolute;
  display: block;
  pointer-events: none;
}

#view-gl[hidden] {
  display: none;
}

/* --- Auswertung (Diagramme) --- */

.charts {
  --surface-1: #1a1a19;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;
  height: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-1);
  border-top: 1px solid var(--border);
  color: var(--text-primary);
  position: relative;
}

.charts[hidden] {
  display: none;
}

.charts-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--grid);
}

.charts-head button {
  padding: 4px 10px;
  font-size: 12.5px;
}

.charts-head button[aria-pressed='true'] {
  border-color: var(--accent);
  background: #2d3a4d;
}

.field.inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.field.inline select {
  padding: 4px 8px;
}

.charts-note {
  flex: 1;
  font-size: 12px;
  color: var(--text-muted);
}

.charts-body {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 12px;
  padding: 10px 12px 12px;
  overflow-x: auto;
}

.chart-card {
  flex: 1 0 260px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chart-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 4px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.chart-legend .key {
  display: inline-block;
  width: 12px;
  height: 2px;
  border-radius: 1px;
  vertical-align: middle;
  margin-right: 5px;
}

.chart-card canvas {
  flex: 1;
  min-height: 0;
  width: 100%;
}

.chart-empty {
  margin: auto;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  max-width: 420px;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: #262624;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 12px;
  color: var(--text-secondary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  z-index: 5;
  white-space: nowrap;
}

.chart-tooltip .t {
  color: var(--text-muted);
  margin-bottom: 3px;
}

.chart-tooltip .row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-tooltip strong {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.chart-table-wrap {
  flex: 1;
  overflow: auto;
}

.chart-table {
  border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.chart-table th,
.chart-table td {
  padding: 3px 10px;
  text-align: right;
  border-bottom: 1px solid var(--grid);
  white-space: nowrap;
}

.chart-table th {
  position: sticky;
  top: 0;
  background: var(--surface-1);
  color: var(--text-secondary);
  font-weight: 600;
}

/* Auswertung, Ansicht „Unfälle“ */
.acc-card {
  flex: 1 0 230px;
}

.acc-card:last-child {
  flex-basis: 520px;
}

.acc-table th,
.acc-table td {
  text-align: left;
}

.acc-table + .chart-table-wrap,
.chart-table-wrap + .chart-table-wrap {
  margin-top: 8px;
}

.acc-table tr.link {
  cursor: pointer;
}

.acc-table tr.link:hover td,
.acc-table tr.link:focus td {
  background: #262624;
}

/* --- Phasenplan --- */

.phase {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.phase-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
}

.phase-head .icons {
  display: flex;
  gap: 4px;
}

.phase-head .icons button {
  padding: 2px 7px;
  font-size: 12px;
}

.movements .chips {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.movements {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 6px;
  align-items: center;
  font-size: 12.5px;
}

.movements .chip {
  padding: 3px 8px;
  font-size: 12px;
  border-radius: 999px;
}

.movements .chip[aria-pressed='true'] {
  background: #1f5d34;
  border-color: #34c759;
  color: #ffffff;
}

.warn {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: #f0b45a;
}

#view.dragging {
  cursor: grabbing;
}

.help,
.legend {
  position: absolute;
  font-size: 12px;
  color: #2b2f33;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 6px;
  padding: 5px 9px;
  pointer-events: none;
}

.help {
  right: 12px;
  bottom: 52px; /* über der Zeitleiste */
}

#view.tool-road,
#view.tool-delete {
  cursor: crosshair;
}

.help {
  max-width: min(560px, calc(100% - 190px));
  text-align: right;
}

/* (bei offener Auswertung über der Zeitleiste, nicht über den Diagrammen) */
body.charts-open .help {
  bottom: 352px;
}

.legend {
  left: 12px;
  top: 64px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend[hidden] {
  display: none;
}

/* Seitenleiste ausgeblendet */
body.sidebar-hidden #sidebar {
  display: none;
}

#btn-sidebar[aria-pressed='true'] {
  color: var(--accent);
}

/* Unfall auslösen: klein, mittel, groß */
.accident-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.accident-trigger .segmented {
  flex: 1;
  grid-template-columns: repeat(3, 1fr);
}

/* Unfallmeldungen rechts oben (Blaulicht, Klick schwenkt zur Unfallstelle) */
.accident-notices {
  position: absolute;
  top: 64px;
  right: 12px;
  width: min(300px, calc(100% - 24px));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  pointer-events: none;
}

.accident-notices[hidden] {
  display: none;
}

.accident-notice {
  pointer-events: auto;
  cursor: pointer;
  padding: 7px 8px 7px 10px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text);
  background: rgba(28, 32, 38, 0.94);
  border: 1px solid var(--border);
  border-left: 3px solid #3d8bfd;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.accident-notice:hover,
.accident-notice:focus-visible {
  border-color: #46505c;
  border-left-color: #6aa6ff;
  outline: none;
}

.accident-notice.serious {
  border-left-color: #e5484d;
}

.accident-notice.cleared {
  opacity: 0.72;
  border-left-color: #4a5560;
}

.accident-notice .head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 2px;
}

.accident-notice .time {
  margin-left: auto;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.accident-notice .close {
  padding: 0 5px;
  font-size: 11px;
  line-height: 18px;
  color: var(--muted);
  background: transparent;
  border: none;
}

.accident-notice .what {
  font-weight: 600;
}

.accident-notice .now {
  color: #9cc3ff;
}

.accident-notice .traffic {
  color: #ffb86b;
}

/* Einsatzfahrzeuge der Unfallstelle (Klick: verfolgen) und Einsatzwege */
.accident-notice .crew {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.accident-notice .chip {
  padding: 1px 7px;
  font-size: 11px;
  line-height: 17px;
  border-radius: 999px;
  border-left: 3px solid #8a96a3;
}

.accident-notice .chip.role-police {
  border-left-color: #3d8bfd;
}

.accident-notice .chip.role-ambulance {
  border-left-color: #f2f2f2;
}

.accident-notice .chip.role-fire {
  border-left-color: #e5484d;
}

.accident-notice .chip.role-tow {
  border-left-color: #f5a623;
}

.accident-notice .chip.watch {
  border-left-color: #ff8c1a;
}

.accident-notice .chip.watch.on {
  color: #ffd0a0;
  border-color: #ff8c1a;
}

/* Auftragsliste der Einsatzleitung (sim/command.js), sichtbar mit den Einsatzwegen */
.accident-notice .orders {
  margin: 5px 0 0;
  padding: 0;
  list-style: none;
  font-size: 11px;
  line-height: 15px;
}

.accident-notice .orders li {
  display: flex;
  gap: 5px;
}

.accident-notice .orders .state {
  flex: none;
  min-width: 48px;
  color: var(--muted);
}

.accident-notice .orders li.laeuft .state {
  color: #9cc3ff;
}

.accident-notice .orders li.wartet .state {
  color: #ffb86b;
}

.accident-notice .orders li.fertig {
  opacity: 0.6;
}

.accident-notice .orders .order {
  flex: 1;
  min-width: 0;
}

.accident-notice .orders .why {
  color: var(--muted);
}

/* Blaulicht: Kuppel, die doppelt aufblitzt */
.beacon {
  flex-shrink: 0;
  width: 13px;
  height: 9px;
  border-radius: 7px 7px 2px 2px;
  background: #1c3a75;
  animation: beacon 1.1s infinite;
}

@keyframes beacon {
  0%,
  9%,
  20%,
  29% {
    background: #5aa2ff;
    box-shadow: 0 0 8px 3px rgba(70, 145, 255, 0.85);
  }
  10%,
  19%,
  30%,
  100% {
    background: #1c3a75;
    box-shadow: none;
  }
}

.cleared .beacon {
  animation: none;
  background: #56606b;
}

@media (prefers-reduced-motion: reduce) {
  .beacon {
    animation: none;
    background: #3d8bfd;
  }
}

.accident-stats-link {
  pointer-events: auto;
  align-self: flex-end;
  padding: 3px 10px;
  font-size: 11.5px;
  border-radius: 999px;
  background: rgba(28, 32, 38, 0.92);
}

/* Hinweis während der Fahrzeugverfolgung */
.follow-badge {
  position: absolute;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px 5px 12px;
  font-size: 13px;
  color: #fff;
  background: rgba(28, 32, 38, 0.9);
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.follow-badge[hidden] {
  display: none;
}

.follow-badge button {
  padding: 2px 8px;
  border-radius: 999px;
}

.legend-bar {
  width: 110px;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, hsl(0, 72%, 46%), hsl(60, 72%, 46%), hsl(120, 72%, 46%));
}

@media (max-width: 800px) {
  #app {
    flex-direction: column-reverse;
    height: auto;
  }

  #sidebar {
    width: 100%;
    border-right: none;
    overflow: visible;
  }

  #stage {
    height: 62vh;
    flex: none;
  }

  .help {
    display: none;
  }
}

/* --- Zeitleiste unter der Zeichenfläche (zurückspulen, Szenen) --- */

.timeline {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.timeline button {
  padding: 4px 9px;
  font-size: 12.5px;
  white-space: nowrap;
}

.timeline button[aria-pressed='true'] {
  border-color: var(--accent);
  color: var(--accent);
}

.timeline .tl-play {
  min-width: 38px;
}

.timeline input[type='range'] {
  flex: 1;
  min-width: 80px;
  accent-color: var(--accent);
}

.timeline .tl-time {
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
}

@media (max-width: 800px) {
  .timeline {
    flex-wrap: wrap;
  }
}

/* --- Dialoge: Situation festhalten, Szene laden --- */

.scene-dialog {
  width: min(520px, calc(100vw - 32px));
  padding: 18px 20px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.scene-dialog::backdrop {
  background: rgba(10, 12, 15, 0.55);
}

.scene-dialog form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.scene-dialog h2 {
  margin: 0;
  font-size: 16px;
}

.scene-dialog textarea {
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  resize: vertical;
}

.scene-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 50vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.scene-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  padding: 8px 10px;
}

.scene-item span {
  font-size: 12px;
  color: var(--muted);
}

.scene-item em {
  font-size: 12.5px;
  font-style: normal;
  color: var(--text);
  opacity: 0.85;
}

/* --- Testlabor --- */

.lab-panel button[aria-pressed='true'] {
  border-color: var(--accent);
  color: var(--accent);
}

.lab-vehicle {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.lab-vehicle[hidden] {
  display: none;
}

#view.tool-place {
  cursor: copy;
}

/* Auswahlmenü beim Rechtsklick auf die Karte (ui/pickMenu.js) */
.pick-menu {
  position: fixed;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 200px;
  max-width: min(360px, calc(100vw - 16px));
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  padding: 5px;
  background: rgba(28, 32, 38, 0.97);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.pick-menu[hidden] {
  display: none;
}

.pick-menu .pick-head {
  padding: 3px 7px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pick-menu button {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  text-align: left;
  background: transparent;
  border-color: transparent;
}

.pick-menu button:hover,
.pick-menu button.active {
  background: #2c323a;
  border-color: var(--border);
}

/* (der angesteuerte Eintrag ist über .active markiert) */
.pick-menu button:focus {
  outline: none;
}

.pick-menu .pick-kind {
  flex-shrink: 0;
  min-width: 74px;
  font-size: 12px;
  color: var(--muted);
}

.pick-menu .pick-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
