
/* Microphone: the key that turns it on and off says so in words, then the input, then
   the apps that hear it. The rings and the glow around the old round button go. */
:root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-mixer {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 8px;
}
:root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-key {
  display: grid;
  position: relative;
}
:root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-key > :is(.btn-wrap, .mic-head) { grid-area: 1 / 1; }
:root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) :is(.ring, .ring2, .glow) { display: none; }
:root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .btn-wrap {
  display: block;
  width: 100%;
  height: 64px;
}
:root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  height: 100%;
  padding: 0 16px;
  border: 0;
  border-radius: 14px;
  background: var(--mix-on);
  box-shadow: inset 0 0 0 1px var(--mix-edge);
}
:root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-btn.muted { background: var(--mix-off); box-shadow: inset 0 0 0 1px var(--mix-edge); }
:root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-btn:hover { transform: none; }
:root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-btn:active { transform: scale(0.98); }
:root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-btn svg,
:root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-btn.muted svg {
  width: 24px;
  height: 24px;
  fill: var(--text);
  filter: none;
}
:root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-head {
  align-self: center;
  justify-self: start;
  align-items: flex-start;
  gap: 2px;
  width: auto;
  max-width: calc(100% - 72px);
  margin-left: 56px;
  text-align: start;
  z-index: 2;
  pointer-events: none;
}
:root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .status-label,
:root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .status-label.muted {
  min-height: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}
:root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-context {
  width: 100%;
  color: var(--muted-text);
  font-size: 13px;
  font-weight: 600;
}

/* The input volume: drawn by the track's pseudo-elements, set by the invisible range on
   top of it (MicPanel.css). The light theme paints that track with !important. The
   panel's own named area would put the row in a column of its own. */
:root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-vol {
  grid-area: auto / 1 / auto / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  width: auto;
  height: auto;
  gap: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}
:root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-vol > * { grid-area: 1 / 1; order: 0; }
:root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-vol-track {
  width: 100%;
  height: 44px;
  flex: none;
  border-radius: 12px;
}
/* The range on top has no paint of its own: the keyboard ring goes on the track. */
:root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-vol-track:has(> .mic-vol-slider:focus-visible) {
  outline: 2px solid rgba(var(--accent-rgb), 0.8);
  outline-offset: -2px;
}
:root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-vol .mic-vol-track::before {
  inset: 0;
  width: auto;
  height: auto;
  transform: none;
  border-radius: 12px;
  background: linear-gradient(to right, var(--mix-fill) 0%, var(--mix-fill) var(--mic-level), var(--mix-track) var(--mic-level), var(--mix-track) 100%) !important;
  box-shadow: inset 0 0 0 1px var(--mix-edge);
}
:root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-vol .mic-vol-track.muted::before { opacity: 0.38; }
:root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-vol .mic-vol-track::after { display: none; }
/* The range lies along the bar. The widget's own stands upright for its round layout. */
:root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-vol-slider {
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%);
  touch-action: pan-y;
}
:root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) :is(.mic-vol-label, .mic-vol-value) {
  position: relative;
  z-index: 1;
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  pointer-events: none;
}
:root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-vol-label { justify-self: start; margin-left: 14px; font-weight: 600; }
:root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-vol-value { justify-self: end; margin-right: 14px; font-weight: 700; text-align: end; }

/* ── Strips: a tab at least 480 x 300 with room for every channel ──
   Master first, a line, then the apps, centred in the tab; each fader no taller than
   340px. Subgrid rows keep every level, fader, name and key on one line across strips.
   The strips never scroll sideways: a finger on a fader moves the level, so a hidden
   channel could not be reached, and the page itself swipes sideways. When they would
   spill, fit-row.js gives the mixer data-fit="1" and it keeps the bars above. */
@container syspane (min-width: 480px) and (min-height: 300px) {
  :root[data-style="liquid"] .audio-panel .audio-block:has(> .volume-wrap:not([data-fit="1"])),
  :root[data-style="liquid"] .audio-panel .volume-wrap:not([data-fit="1"]) { flex-shrink: 1; min-height: 0; }
  :root[data-style="liquid"] :is(.system-audio-pane, .audio-panel) .volume-wrap:not([data-fit="1"]) {
    --strip: clamp(84px, 9cqw, 140px);
    grid-template-columns: var(--strip) 1px minmax(0, max-content);
    grid-template-rows: auto minmax(120px, 340px) auto auto;
    justify-content: center;
    align-content: center;
    gap: 10px;
    padding: 8px 0;
  }
  :root[data-style="liquid"] :is(.system-audio-pane, .audio-panel) .volume-wrap:not([data-fit="1"]) .vol-value { grid-area: 1 / 1; justify-self: center; margin: 0; font-size: 16px; }
  :root[data-style="liquid"] :is(.system-audio-pane, .audio-panel) .volume-wrap:not([data-fit="1"]) > .mix-fader { grid-area: 2 / 1; }
  :root[data-style="liquid"] :is(.system-audio-pane, .audio-panel) .volume-wrap:not([data-fit="1"]) .vol-title { grid-area: 3 / 1; justify-self: center; max-width: 100%; margin: 0; }
  :root[data-style="liquid"] :is(.system-audio-pane, .audio-panel) .volume-wrap:not([data-fit="1"]) .vol-mute-btn { grid-area: 4 / 1; justify-self: center; }
  :root[data-style="liquid"] :is(.system-audio-pane, .audio-panel) .volume-wrap:not([data-fit="1"]):has(> .speaker-apps:not([hidden]))::after {
    content: '';
    grid-area: 1 / 2 / -1 / 3;
    margin-block: 4px;
    background: var(--lg-sep);
  }

  :root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-mixer:not([data-fit="1"]) {
    --strip: clamp(104px, 11cqw, 140px);
    flex: 1 1 auto;
    min-height: 0;
    margin-block: 0;
    grid-template-columns: minmax(150px, 210px) var(--strip) 1px minmax(0, max-content);
    grid-template-rows: auto minmax(120px, 340px) auto auto;
    justify-content: center;
    align-content: center;
    gap: 10px;
    padding: 4px 2px 2px;
  }
  :root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-mixer:not([data-fit="1"]):has(> .mic-apps:not([hidden]))::after {
    content: '';
    grid-area: 1 / 3 / -1 / 4;
    margin-block: 4px;
    background: var(--lg-sep);
  }

  /* The mic key: a square with the icon over the words. */
  :root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-mixer:not([data-fit="1"]) .mic-key {
    grid-area: 1 / 1 / -1 / 2;
    align-self: center;
    aspect-ratio: 1;
    margin-right: 16px;
  }
  :root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-mixer:not([data-fit="1"]) .btn-wrap { height: 100%; }
  :root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-mixer:not([data-fit="1"]) .mic-btn {
    justify-content: center;
    padding: 0 0 56px;
    border-radius: 24px;
  }
  :root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-mixer:not([data-fit="1"]) .mic-btn svg,
  :root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-mixer:not([data-fit="1"]) .mic-btn.muted svg { width: 44px; height: 44px; }
  :root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-mixer:not([data-fit="1"]) .mic-btn:active { transform: scale(0.96); }
  :root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-mixer:not([data-fit="1"]) .mic-head {
    align-self: end;
    justify-self: stretch;
    align-items: center;
    max-width: none;
    margin: 0;
    padding: 0 14px 24px;
    text-align: center;
  }
  :root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-mixer:not([data-fit="1"]) .status-label { font-size: 16px; }

  /* The input fader stands in the second column; the key above is its mute. */
  :root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-mixer:not([data-fit="1"]) .mic-vol { display: contents; }
  :root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-mixer:not([data-fit="1"]) .mic-vol-value { grid-area: 1 / 2; justify-self: center; margin: 0; font-size: 16px; }
  :root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-mixer:not([data-fit="1"]) .mic-vol-track {
    grid-area: 2 / 2;
    justify-self: center;
    width: 60px;
    height: 100%;
    border-radius: 20px;
    container-type: size;
  }
  :root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-mixer:not([data-fit="1"]) .mic-vol .mic-vol-track::before {
    border-radius: 20px;
    background: linear-gradient(to top, var(--mix-fill) 0%, var(--mix-fill) var(--mic-level), var(--mix-track) var(--mic-level), var(--mix-track) 100%) !important;
  }
  :root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-mixer:not([data-fit="1"]) .mic-vol-slider {
    width: 100cqh;
    height: 100cqw;
    transform: translate(-50%, -50%) rotate(-90deg);
    touch-action: none;
  }
  :root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-mixer:not([data-fit="1"]) .mic-vol-label {
    grid-area: 3 / 2;
    align-self: start;
    justify-self: center;
    max-width: 100%;
    margin: 0;
    line-height: 1.2;
    text-align: center;
    text-wrap: balance;
    overflow-wrap: break-word;
    hyphens: auto;
  }

  /* The apps of either tab: one strip each, flowing to the right. */
  :root[data-style="liquid"] :is(.system-audio-pane, .audio-panel) .volume-wrap:not([data-fit="1"]) > .speaker-apps:not([hidden]) { grid-area: 1 / 3 / -1 / 4; }
  :root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-mixer:not([data-fit="1"]) .mic-apps:not([hidden]) { grid-area: 1 / 4 / -1 / 5; }
  :root[data-style="liquid"] :is(.system-audio-pane, .audio-panel) .volume-wrap:not([data-fit="1"]) > .speaker-apps:not([hidden]),
  :root[data-style="liquid"] :is(.system-mic-pane, .mic-panel) .mic-mixer:not([data-fit="1"]) .mic-apps:not([hidden]) {
    grid-template-rows: subgrid;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: var(--strip);
    gap: 10px;
    min-height: 0;
    overflow: auto hidden;
    scrollbar-width: thin;
  }
  :root[data-style="liquid"] :is(:is(.system-audio-pane, .audio-panel) .volume-wrap, :is(.system-mic-pane, .mic-panel) .mic-mixer):not([data-fit="1"]) .app-mix-row {
    grid-row: 1 / -1;
    grid-template-rows: subgrid;
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: 10px 0;
  }
  :root[data-style="liquid"] :is(:is(.system-audio-pane, .audio-panel) .volume-wrap, :is(.system-mic-pane, .mic-panel) .mic-mixer):not([data-fit="1"]) .app-mix-row > .app-mix-vol { grid-area: 1 / 1; justify-self: center; margin: 0; font-size: 16px; }
  :root[data-style="liquid"] :is(:is(.system-audio-pane, .audio-panel) .volume-wrap, :is(.system-mic-pane, .mic-panel) .mic-mixer):not([data-fit="1"]) .app-mix-row > .mix-fader { grid-area: 2 / 1; }
  :root[data-style="liquid"] :is(:is(.system-audio-pane, .audio-panel) .volume-wrap, :is(.system-mic-pane, .mic-panel) .mic-mixer):not([data-fit="1"]) .app-mix-row > .app-mix-icon {
    grid-area: 2 / 1;
    align-self: end;
    justify-self: center;
    width: 28px;
    height: 28px;
    margin: 0 0 12px;
    border-radius: 8px;
  }
  :root[data-style="liquid"] :is(:is(.system-audio-pane, .audio-panel) .volume-wrap, :is(.system-mic-pane, .mic-panel) .mic-mixer):not([data-fit="1"]) .app-mix-row > .app-mix-name {
    grid-area: 3 / 1;
    justify-self: center;
    max-width: 100%;
    margin: 0;
    text-align: center;
  }
  :root[data-style="liquid"] :is(:is(.system-audio-pane, .audio-panel) .volume-wrap, :is(.system-mic-pane, .mic-panel) .mic-mixer):not([data-fit="1"]) .app-mix-row > .app-mix-mute { grid-area: 4 / 1; justify-self: center; }

  /* Each fader: a box as tall as its row, the range inside it turned upright, so the
     fill volume.js paints from the left runs from the bottom. */
  :root[data-style="liquid"] :is(:is(.system-audio-pane, .audio-panel) .volume-wrap, :is(.system-mic-pane, .mic-panel) .mic-mixer):not([data-fit="1"]) .mix-fader {
    justify-self: center;
    width: 60px;
    height: 100%;
    min-height: 0;
    container-type: size;
  }
  :root[data-style="liquid"] :is(:is(.system-audio-pane, .audio-panel) .volume-wrap, :is(.system-mic-pane, .mic-panel) .mic-mixer):not([data-fit="1"]) .mix-fader > input {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 100cqh;
    height: 100cqw;
    border-radius: 20px;
    transform: translate(-50%, -50%) rotate(-90deg);
    touch-action: none;
  }
}
