/* Дев-инструменты скрыты для посетителей; класс dev-tools-on ставит
   scripts/dev-mode.js по ?dev=1 (см. подключение в <head> страниц). */
html:not(.dev-tools-on) .stage-console,
html:not(.dev-tools-on) .track-tune-panel,
html:not(.dev-tools-on) .stage-dev,
html:not(.dev-tools-on) .track-stage-devtool {
  display: none !important;
}

.stage-console {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(760px, calc(100% - 22px));
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: rgba(3, 3, 4, 0.86);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(22px);
}

.stage-console__label {
  flex: 0 0 auto;
  padding: 0 10px 0 8px;
  color: rgba(244, 241, 234, 0.4);
  font: 900 9px/1 Manrope, sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.stage-console__tabs {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.stage-console__tab {
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  color: rgba(244, 241, 234, 0.66);
  background: transparent;
  font: 800 10px/1 Manrope, sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.stage-console__tab[aria-selected='true'] {
  color: #0b0d0e;
  background: linear-gradient(135deg, var(--gold), #fff0b8);
}

.track-tune-panel {
  position: fixed;
  z-index: 42;
  top: max(70px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  width: min(340px, calc(100vw - 24px));
  max-height: calc(100svh - 108px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(4, 5, 6, 0.9);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(22px) saturate(120%);
  -webkit-backdrop-filter: blur(22px) saturate(120%);
  color: rgba(244, 241, 234, 0.82);
  font: 500 12px/1.35 Manrope, sans-serif;
}

.track-tune-panel--collapsed {
  width: auto;
}

.track-tune-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid var(--line-soft);
}

.track-tune-panel--collapsed .track-tune-panel__head {
  border-bottom: 0;
}

.track-tune-panel__toggle,
.track-tune-panel__btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(244, 241, 234, 0.78);
  cursor: pointer;
  font: 800 10px/1 Manrope, sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.track-tune-panel__toggle {
  min-height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
}

.track-tune-panel__btn {
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
}

.track-tune-panel__toggle:hover,
.track-tune-panel__btn:hover {
  border-color: rgba(232, 195, 106, 0.34);
  color: rgba(244, 241, 234, 0.94);
}

.track-tune-panel__body {
  max-height: calc(100svh - 164px);
  overflow: auto;
  padding: 12px;
}

.track-tune-panel--collapsed .track-tune-panel__body {
  display: none;
}

.track-tune-panel__hint {
  margin: 0 0 12px;
  color: rgba(244, 241, 234, 0.48);
}

.track-tune-section {
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.035);
}

.track-tune-section + .track-tune-section {
  margin-top: 10px;
}

.track-tune-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.track-tune-section__title {
  color: rgba(244, 241, 234, 0.9);
  font: 800 11px/1.2 Manrope, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.track-tune-section__jump {
  color: var(--gold);
  font: 800 9px/1 Manrope, sans-serif;
  letter-spacing: 0.1em;
  text-decoration: none;
  text-transform: uppercase;
}

.track-tune-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 4.5ch;
  gap: 8px 10px;
  align-items: center;
}

.track-tune-control + .track-tune-control {
  margin-top: 9px;
}

.track-tune-control__label {
  color: rgba(244, 241, 234, 0.62);
  font: 700 10px/1.2 Manrope, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.track-tune-control__value {
  color: rgba(244, 241, 234, 0.76);
  font: 800 10px/1 Manrope, sans-serif;
  text-align: right;
}

.track-tune-control input {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: var(--gold);
}

.track-tune-panel__actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.track-tune-output {
  width: 100%;
  min-height: 90px;
  margin-top: 10px;
  padding: 10px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.26);
  color: rgba(244, 241, 234, 0.72);
  font: 500 11px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
