/* Тёмная приборная панель: эстетика аудиожелеза. Тёмный фон уместен в тёмной
   комнате, не слепит при прогоне, а свечение активного канала читается как
   «вот здесь сейчас звук» без всяких пояснений. */

:root {
  --bg: #0b0d10;
  --panel: #12161d;
  --panel-2: #161b24;
  --line: #232b37;
  --text: #d7dde7;
  --dim: #7d8797;
  /* Поднят с #4b5361: тот давал 2.5:1 на фоне против требуемых 4.5:1, а
     использовался для настоящего текста — подвала и подписей недоступных
     колонок. */
  --dimmer: #8f99a8;
  /* Отдельный токен для обводок, где порог 3:1, а не 4.5:1. */
  --outline-dim: #6b7481;

  --live: #46e0a8;
  --bed: #6ea8fe;
  --height: #4fd1e0;
  --wide: #7bdca0;
  --lfe: #e0a24f;
  --warn: #e07a5f;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --radius: 4px;
  --gap: clamp(0.75rem, 0.5rem + 1vw, 1.5rem);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.shell {
  max-width: 940px;
  margin: 0 auto;
  padding: var(--gap) var(--gap) 4rem;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

/* --- Телеметрия --- */

.telemetry {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.25rem;
  padding: 0.75rem 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.telemetry .brand {
  letter-spacing: 0.18em;
  font-weight: 600;
  margin-right: auto;
}

.telemetry .metric {
  color: var(--live);
  font-variant-numeric: tabular-nums;
}

.dim { color: var(--dim); }

/* --- Предупреждения --- */

.notices {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.notice {
  margin: 0;
  padding: 0.625rem 0.875rem;
  border-left: 2px solid var(--line);
  background: var(--panel);
  color: var(--dim);
  font-size: 13px;
}

.notice.warn {
  border-left-color: var(--warn);
  color: var(--text);
}

/* --- Схема --- */

.map {
  width: 100%;
  height: auto;
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.map .room polygon {
  fill: #0e1219;
  stroke: var(--line);
  stroke-width: 1.5;
}

.map .listener {
  fill: none;
  stroke: var(--warn);
  stroke-width: 1.5;
}

.map .axis {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 3 4;
}

.map .spk { cursor: pointer; }

.map .spk rect {
  fill: #10151d;
  stroke-width: 1.75;
  transition: fill 120ms ease, filter 120ms ease;
}

.map .spk text {
  fill: var(--dim);
  font-size: 11px;
  font-family: var(--mono);
  pointer-events: none;
}

.map .bed rect { stroke: var(--bed); }
.map .wide rect { stroke: var(--wide); }
.map .height rect { stroke: var(--height); }
.map .lfe rect { stroke: var(--lfe); }

/* Панорамируемая позиция: пунктир означает «дискретного канала нет». */
.map .panned rect { stroke-dasharray: 4 3; }

.map .unavailable rect { stroke: var(--outline-dim); }
.map .unavailable text { fill: var(--dimmer); }

/* Состояние до опроса устройства: маршрутизация неизвестна, и помечать
   позицию как панорамируемую было бы выдумкой. */
.map .unknown rect { stroke: var(--outline-dim); stroke-dasharray: 1 3; }
.map .unknown text { fill: var(--dim); }

.map .spk:hover rect { fill: #1a2230; }

.map .spk:focus-visible {
  outline: none;
}

.map .spk:focus-visible rect {
  fill: #1a2230;
  stroke: var(--live);
  stroke-width: 2.5;
}

.map .live rect {
  fill: var(--live);
  stroke: var(--live);
  filter: drop-shadow(0 0 9px var(--live));
}

.map .live text { fill: var(--live); }

/* --- Строка статуса --- */

.status {
  padding: 0.625rem 1rem;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 2.75rem;
  display: flex;
  align-items: center;
}

.status .line {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  font-size: 12px;
}

.status .line.idle { color: var(--dim); letter-spacing: 0.1em; }

.status .key {
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
}

.status .val {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin-right: 0.5rem;
}

/* --- Слоты устройства --- */

.slots {
  padding: 0.875rem 1rem 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.slots h2 {
  margin: 0 0 0.375rem;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 600;
}

.hint {
  margin: 0 0 0.5rem;
  color: var(--dim);
  font-size: 12px;
}

.hint:last-of-type { margin-bottom: 0.75rem; }

.slot-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 3.25rem;
  padding: 0.375rem 0.5rem;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}

.slot .idx {
  font-variant-numeric: tabular-nums;
  color: var(--dim);
}

.slot .lbl { letter-spacing: 0.06em; }

.slot:hover { background: #1c2431; border-color: var(--dim); }

.slot.live {
  border-color: var(--live);
  color: var(--live);
  box-shadow: 0 0 8px rgba(70, 224, 168, 0.35);
}

.slot.live .idx { color: var(--live); }

/* --- Панель управления --- */

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  align-items: end;
  gap: 0.875rem;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3125rem;
}

.field > span {
  color: var(--dim);
  font-size: 12px;
}

select,
input[type="range"] {
  width: 100%;
  font-family: var(--mono);
  font-size: 13px;
}

select {
  padding: 0.4375rem 0.5rem;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

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

input[type="range"] { accent-color: var(--live); }

.toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--dim);
  font-size: 12px;
  cursor: pointer;
}

.toggle input { accent-color: var(--live); }

.transport {
  padding: 0.625rem 1rem;
  border: 1px solid var(--live);
  border-radius: var(--radius);
  background: transparent;
  color: var(--live);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.transport:hover { background: rgba(70, 224, 168, 0.12); }

.transport.stop {
  border-color: var(--warn);
  color: var(--warn);
}

.transport.stop:hover { background: rgba(224, 122, 95, 0.14); }

/* --- Подвал --- */

.foot p {
  margin: 0;
  color: var(--dimmer);
  font-size: 12px;
}

@media (max-width: 560px) {
  .controls { grid-template-columns: 1fr; }
  .telemetry { font-size: 12px; }
}
