/* player-bridge.css — player-generated DOM styles extracted from the Studio Console domain/components/glue layer, tokens shared with site.css */
/* ==========================================================================
   UBT — domain components (player, mixer, notation) + commerce components
   ========================================================================== */

/* ---- Channel strip -------------------------------------------------------- */

.channel-strip {
  --ch-tint: var(--accent);
  display: flex; flex-direction: column; align-items: center; gap: var(--space-3);
  width: 96px; padding: var(--space-4) var(--space-3) var(--space-3);
  background: var(--surface); border: var(--border-hair) solid var(--border);
  border-top: 3px solid var(--ch-tint);
  border-radius: var(--radius-md);
}
.channel-strip[data-channel="drums"]  { --ch-tint: var(--ch-drums); }
.channel-strip[data-channel="guitar"] { --ch-tint: var(--ch-guitar); }
.channel-strip[data-channel="solo"]   { --ch-tint: var(--ch-solo); }
.channel-strip[data-channel="bass"]   { --ch-tint: var(--ch-bass); }
.channel-strip[data-channel="vocals"] { --ch-tint: var(--ch-vocals); }
.channel-strip__icon {
  width: 28px; height: 28px; border-radius: var(--radius-xs);
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in oklch, var(--ch-tint) 18%, transparent);
  color: var(--ch-tint);
}
.channel-strip__icon svg { width: 16px; height: 16px; }
.channel-strip__name { font-size: var(--text-xs); font-weight: 700; color: var(--fg-strong); text-align: center; }
.channel-strip__meter {
  display: flex; flex-direction: column-reverse; gap: 3px;
  width: 14px; height: 176px; padding: 4px 3px;
  background: var(--meter-off); border-radius: var(--radius-xs);
}
.channel-strip__meter-seg { flex: 1; border-radius: 1px; background: color-mix(in oklch, var(--fg) 8%, transparent); transition: background-color var(--duration-meter) var(--ease-linear); }
.channel-strip__meter-seg.is-lit-low { background: var(--meter-low); }
.channel-strip__meter-seg.is-lit-mid { background: var(--meter-mid); }
.channel-strip__meter-seg.is-lit-hot { background: var(--meter-hot); }
.channel-strip__fader-row { display: flex; align-items: flex-start; gap: var(--space-2); }
.channel-strip__pct { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--muted); }
.channel-strip__mute {
  width: 100%; min-width: 0; height: 40px; border-radius: var(--radius-xs);
  border: var(--border-hair) solid var(--border-strong); background: var(--surface-2);
  color: var(--muted); font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: 0;
  cursor: pointer;
}
.channel-strip__mute:hover { border-color: var(--border-strong); color: var(--fg); }
.channel-strip__mute[aria-pressed="true"] { background: var(--danger); border-color: var(--danger); color: var(--danger-fg); }
.channel-strip__btns { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-1); }
.channel-strip__solo {
  width: 100%; min-width: 0; height: 40px; border-radius: var(--radius-xs);
  border: var(--border-hair) solid var(--border-strong); background: var(--surface-2);
  color: var(--muted); font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  cursor: pointer;
}
.channel-strip__solo:hover { border-color: var(--border-strong); color: var(--fg); }
.channel-strip__solo[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent); color: var(--accent-contrast, var(--bg));
}
.channel-strip.solo-silenced { opacity: 0.5; }
.mixer-rack { display: flex; gap: var(--space-3); padding: var(--space-4); background: var(--bg-raised); border: var(--border-hair) solid var(--border); border-radius: var(--radius-lg); overflow-x: auto; }
/* ---- Tempo / transpose control group ---------------------------------------- */

.control-group { display: flex; align-items: center; gap: var(--space-5); flex-wrap: wrap; }
.stepper { display: flex; align-items: center; gap: 0; border: var(--border-hair) solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.stepper__btn {
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  background: var(--surface); border: none; color: var(--fg-strong); cursor: pointer; font-size: var(--text-md);
}
.stepper__btn:hover { background: var(--surface-2); }
.stepper__value {
  min-width: 76px; text-align: center; font-family: var(--font-mono); font-size: var(--text-sm); font-weight: 700;
  color: var(--fg-strong); background: var(--bg-raised); padding: 0 var(--space-2); height: 40px; display: flex; align-items: center; justify-content: center;
  border-left: var(--border-hair) solid var(--border-strong); border-right: var(--border-hair) solid var(--border-strong);
}
.stepper__label { font-family: var(--font-mono); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--muted); margin-bottom: var(--space-1); display: block; }
.preset-chips { display: flex; gap: var(--space-1); }
.preset-chip {
  min-width: 40px; height: 40px; padding: 0 var(--space-2); display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: var(--text-xs); border-radius: var(--radius-sm);
  border: var(--border-hair) solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer;
}
.preset-chip:hover { border-color: var(--border-strong); color: var(--fg); }
.preset-chip.is-active { background: var(--accent-tint); border-color: var(--accent); color: var(--accent); }
/* Vertical fader — used in the channel strip; round thumb, tinted per channel */
.fader {
  --fader-tint: var(--accent);
  position: relative;
  width: 44px; height: 176px;
  display: flex; justify-content: center;
  touch-action: none;
}
.fader__track {
  position: relative; width: 6px; height: 100%; border-radius: var(--radius-full);
  background: var(--surface-3);
  box-shadow: var(--shadow-inset);
}
.fader__fill { position: absolute; bottom: 0; left: 0; width: 100%; border-radius: var(--radius-full); background: var(--fader-tint); }
.fader__thumb {
  position: absolute; left: 50%; width: 32px; height: 18px; border-radius: var(--radius-xs);
  background: var(--fg-strong); border: 2px solid var(--fader-tint);
  transform: translate(-50%, 50%);
  cursor: grab;
  box-shadow: var(--shadow-sm);
}
.fader__thumb::after { content: ""; position: absolute; left: 4px; right: 4px; top: 50%; height: 2px; background: var(--fader-tint); transform: translateY(-50%); }
.fader:active .fader__thumb { cursor: grabbing; }
/* Practice panel (transpose / tempo) under the mixer — the desktop app's
   flagship controls, demoed live in the web player via SoundTouch. */
.practice-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4);
  justify-content: space-between;
  padding: var(--space-4);
  background: var(--surface);
  border: var(--border-hair) solid var(--border);
  border-radius: var(--radius-md);
}
.practice-row__hint {
  font-family: var(--font-mono); font-size: var(--text-xs);
  color: var(--muted-2); letter-spacing: 0.02em;
}
@media (max-width: 700px){
  .practice-row { justify-content: flex-start; }
  .practice-row__hint { flex-basis: 100%; }}

/* A-B loop controls on the transport seekbar. */
.seekbar { flex-wrap: wrap; }
.seekbar__track { position: relative; }
.loop-ctl { display: flex; gap: var(--space-1); flex: 0 0 auto; }
.loop-btn {
  width: 32px; height: 32px; border-radius: var(--radius-xs);
  border: var(--border-hair) solid var(--border-strong); background: var(--surface-2);
  color: var(--muted); font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  cursor: pointer;
}
.loop-btn:hover { color: var(--fg); border-color: var(--border-strong); }
.loop-btn.is-set { background: var(--accent-tint); border-color: var(--accent); color: var(--accent); }
.loop-btn--clear[hidden] { display: none; }
.loop-region {
  position: absolute; top: 50%; height: 8px; transform: translateY(-50%);
  border-radius: var(--radius-full);
  background: color-mix(in oklch, var(--accent) 32%, transparent);
  pointer-events: none;
  z-index: 0;
}
.loop-region[hidden], .loop-mark[hidden] { display: none; }
.loop-mark {
  position: absolute; top: 50%; width: 2px; height: 22px;
  transform: translate(-50%, -50%);
  border-radius: 1px; background: var(--accent);
  pointer-events: none;
  z-index: 3;
}
.loop-mark span {
  position: absolute; top: -16px; left: 50%; transform: translateX(-50%);
  font-family: var(--font-mono); font-size: 9px; font-weight: 700; color: var(--accent);
}
/* --------------------------------------------------------------------------
   Mixer-rack skeleton: visible while JS hasn't mounted channel strips yet.
   The rack starts empty; mount() appends real .channel-strip children.
   :empty catches "no children" (the whitespace-only case too in modern CSS). */
.mixer-rack:empty {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--space-3);
  padding: var(--space-4);
  min-height: 320px;
}
.mixer-rack:empty::before {
  content: "";
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: var(--text-xs);
  color: var(--muted-2); letter-spacing: var(--tracking-caps);
}

/* Hero console (index): 5 полос без горизонтального скролла — грид на всю
   ширину консоли. На узких экранах возвращаем естественный свайп. */
.console .mixer-rack { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); overflow: visible; }
.console .channel-strip { width: auto; min-width: 0; padding: var(--space-3) var(--space-2) var(--space-2); }
@media (max-width: 700px) {
  .console .mixer-rack { display: flex; overflow-x: auto; scrollbar-width: thin; }
  .console .channel-strip { width: 84px; flex: 0 0 auto; }
}

/* Чипы выбора инструмента в шапке нотации (лежат на «бумаге»). */
.notation-tracks { display: flex; gap: 6px; flex-wrap: wrap; }
.notation-track-chip {
  font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 600;
  padding: 3px 10px; border-radius: var(--radius-full); cursor: pointer;
  background: transparent; color: var(--notation-muted);
  border: 1px solid var(--notation-rule);
  transition: color var(--duration-fast), border-color var(--duration-fast), background-color var(--duration-fast);
}
.notation-track-chip:hover { color: var(--notation-fg); border-color: var(--notation-muted); }
.notation-track-chip.is-active {
  background: var(--notation-current-bar-bg);
  border-color: var(--notation-current-bar-border);
  color: var(--notation-fg);
}
.notation-sections { display: flex; gap: 6px; flex-wrap: wrap; width: 100%; }
.notation-section-chip {
  font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 600;
  padding: 4px 10px; border-radius: var(--radius-xs); cursor: pointer;
  background: color-mix(in oklch, var(--notation-bg) 72%, var(--notation-rule));
  color: var(--notation-muted);
  border: 1px solid var(--notation-rule);
  transition: color var(--duration-fast), border-color var(--duration-fast), background-color var(--duration-fast);
}
.notation-section-chip:hover { color: var(--notation-fg); border-color: var(--notation-muted); }
.notation-section-chip.is-active {
  background: var(--notation-current-bar-bg);
  border-color: var(--notation-current-bar-border);
  color: var(--notation-fg);
}
.notation-surface {
  display: flex;
  flex-direction: column;
}
.notation-surface__head {
  align-items: center;
  flex-wrap: wrap;
}
.notation-surface__body {
  min-height: 320px;
  max-height: min(62vh, 620px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scroll-behavior: smooth;
  padding-bottom: clamp(80px, 12vh, 140px);
}
.notation-surface__body::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.notation-surface__body::-webkit-scrollbar-thumb {
  background: var(--notation-rule);
  border-radius: 6px;
}
.notation-follow-toggle {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--notation-rule);
  background: transparent;
  color: var(--notation-muted);
  cursor: pointer;
}
.notation-follow-toggle:hover {
  color: var(--notation-fg);
  border-color: var(--notation-muted);
}
.notation-follow-toggle.is-active {
  background: var(--notation-current-bar-bg);
  border-color: var(--notation-current-bar-border);
  color: var(--notation-fg);
}
@media (max-width: 640px) {
  .notation-tracks, .notation-sections { order: 3; width: 100%; }
  .notation-surface__body {
    min-height: 260px;
    max-height: 58vh;
    padding: var(--space-5) var(--space-4) 96px;
  }
  .notation-follow-toggle { margin-left: auto; }
  .loop-ctl { width: 100%; justify-content: flex-end; }
}
