/* Reserve the taller caption at each viewport width when the player changes. */
.intro-copy > :is(.eyebrow, h1, .intro-instructions) {
  display: grid;
}
.intro-copy [data-intro] {
  grid-area: 1 / 1;
  color: inherit;
}
[data-hardware="turntables"] [data-intro="cdjs"],
[data-hardware="cdjs"] [data-intro="turntables"] {
  visibility: hidden;
}

/* Room-wide controls stay together in the header on both player surfaces. */
.site-header {
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: clamp(10px, 1.2vw, 22px);
}
.header-identity, .room-controls, .rig-toolbar {
  display: flex;
  align-items: center;
}
.header-identity { gap: clamp(12px, 1.4vw, 24px); min-width: 0; }
.header-identity .edition { text-align: left; letter-spacing: 1.2px; }
.header-identity .edition span { white-space: nowrap; }
.room-controls { position: relative; gap: 12px; }
.rig-toolbar { gap: 5px; }
.rig-toolbar #deckCountToggle { width: 70px; min-width: 70px; flex-basis: 70px; }
.rig-toolbar #hardwareToggle { text-transform: uppercase; }
[data-hardware=turntables] #hardwareToggle { color: #4ade80; border-color: #4ade80; background: rgba(74,222,128,.08); }
[data-hardware=cdjs] #hardwareToggle { color: #38bdf8; border-color: #38bdf8; background: rgba(56,189,248,.08); }
.night [data-hardware=turntables] #hardwareToggle { background: rgba(74,222,128,.12); }
.night [data-hardware=cdjs] #hardwareToggle { background: rgba(56,189,248,.12); }
.rig-toolbar #autoMix { width: 110px; max-width: 110px; flex-basis: 110px; }
.site-header .rig-toolbar button { height: 38px; font-size: 10px; letter-spacing: .2px; }
.site-header .header-actions button { height: 38px; white-space: nowrap; }
.auto-mix-control { position: relative; display: flex; flex: none; }
.auto-mix-control .auto-mix-status {
  position: absolute;
  inset: calc(100% + 2px) 0 auto;
  font-size: 10px;
  line-height: 1.2;
  letter-spacing: 0;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mixer-card > .mixer-heading { display: block; }
.turntable-host[hidden], .cdj-face[hidden],
[data-hardware="turntables"] :is(.cdj-enlarge, .cdj-detail, [data-surface="cdjs"]),
[data-hardware="cdjs"] [data-surface="turntables"] { display: none !important; }

.beat-clock, .deck-beat-controls {
  display: flex;
  align-items: center;
  gap: 3px;
}
.beat-clock {
  width: fit-content;
  margin: 0;
  gap: 5px;
}
.beat-clock label, .beat-clock button, .deck-beat-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 29px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}
.beat-clock input { width: 8ch; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; }
.beat-clock button[aria-pressed="true"], .deck-beat-controls button[aria-pressed="true"],
.deck-beat-controls button.active { border-color: #d28d3e; box-shadow: inset 0 -2px #d28d3e; }
.deck-card > .deck-heading .deck-heading-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 8px;
}
.deck-beat-controls {
  grid-column: 1 / -1;
  grid-row: 2;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto auto;
}
.deck-beat-controls button { min-width: 26px; touch-action: manipulation; }
.beat-state { grid-column: 3; grid-row: 1; color: var(--ink); font-size: 10px; text-align: end; line-height: 1.15; }
.turntable-beats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(2px, .25vw, 4px);
  width: min(100%, 100px);
}
.turntable-beats i { height: 4px; background: #425466; }
.turntable-beats .lit { background: #cf680d; }
.night .turntable-beats i { background: #334253; }
.night .turntable-beats .lit { background: #ffa651; }
@media (max-width: 600px) {
  .deck-card > .deck-heading .deck-heading-line { gap: 4px; }
  .deck-beat-controls button { padding-inline: 5px; }
}

.site-header .beat-clock :is(button, label) { height: 38px; }
@media (max-width: 1120px) {
  .site-header {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "identity actions" "controls controls";
    row-gap: 12px;
    padding-bottom: 20px;
  }
  .header-identity { grid-area: identity; }
  .room-controls { grid-area: controls; flex-wrap: wrap; }
  .header-actions { grid-area: actions; }
}
@media (min-width: 875px) and (max-width: 1120px) {
  .site-header { grid-template-areas: "identity identity" "controls actions"; }
}
@media (max-width: 610px) {
  .site-header {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "identity" "controls" "actions";
    position: relative;
    gap: 18px;
    padding: 14px;
  }
  .room-controls { gap: 18px 12px; }
}

.deck-heading > .eyebrow:has(.phrase-count) { display: flex; align-items: center; gap: 12px; }
.deck-phase {
  position: relative;
  display: block;
  height: 17px;
  background: rgba(68, 80, 84, .12);
  color: var(--ink);
}
.night .deck-phase { background: #262c2e; }
.deck-phase::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(currentColor, currentColor) 50% / 1px 100% no-repeat,
    linear-gradient(currentColor, currentColor) 25% / 1px 48% no-repeat,
    linear-gradient(currentColor, currentColor) 75% / 1px 48% no-repeat;
  opacity: .55;
}
.deck-phase i {
  position: absolute;
  inset-block: 3px;
  left: calc(50% + var(--phase-left, 0%));
  width: var(--phase-width, 0%);
  background: #b66412;
}
.night .deck-phase i { background: #e99943; }
.deck-phase:not([data-active="true"])::after { opacity: .28; }

.phrase-count { min-width: 3ch; font-variant-numeric: tabular-nums; letter-spacing: 0; }
