/* 音量つまみ（mixer-ui.js が作る .mx の中だけ） */
.mx {
  --mx-text: var(--text, #ece6dc);
  --mx-muted: var(--muted, #b9ad9c);
  --mx-accent: var(--accent, #f0b45a);
  --mx-line: var(--line, rgba(255, 255, 255, 0.12));
  --mx-track: rgba(255, 255, 255, 0.16);
  color: var(--mx-text);
  font-size: 14px;
  line-height: 1.45;
  container-type: inline-size;
}
.mx *,
.mx *::before,
.mx *::after { box-sizing: border-box; }
.mx [hidden] { display: none !important; }

.mx-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin-bottom: 6px;
}
.mx-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--mx-muted);
}
.mx-status {
  margin-left: auto;
  font-size: 12px;
  color: var(--mx-muted);
  text-align: right;
}

/* 消音（見出しの横）。押すと「音を戻す」に変わり、色が付く */
.mx-mute {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 2px 10px 2px 7px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--mx-text);
  font: inherit;
  font-size: 12.5px;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.mx-mute:hover { background: rgba(255, 255, 255, 0.1); }
.mx-mute:focus-visible { outline: 2px solid var(--mx-accent); outline-offset: 2px; }
.mx-mute-icon { display: inline-flex; width: 16px; height: 16px; flex: none; }
.mx-mute-icon svg { width: 100%; height: 100%; }
.mx-mute[aria-pressed="true"] {
  border-color: var(--mx-accent);
  background: var(--mx-accent);
  color: var(--accent-ink, #2b1b0d);
  font-weight: 700;
}
.mx-mute-tag {
  font-size: 11.5px;
  color: var(--mx-accent);
  white-space: nowrap;
}
/* 消音中：つまみは動かせる（値だけ変わる）。薄くして、いまは鳴っていないことを示す */
.mx.is-muted .mx-list { opacity: 0.5; transition: opacity 0.15s; }

.mx-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.mx-row {
  display: grid;
  grid-template-columns: 20px 6.9em minmax(0, 1fr) 2.2em;
  align-items: center;
  column-gap: 10px;
  min-height: 40px;
}
.mx-icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
  color: var(--mx-muted);
  transition: color 0.2s;
}
.mx-icon svg { width: 100%; height: 100%; }
.mx-row.is-on .mx-icon { color: var(--mx-accent); }
.mx-label {
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 「読み込み中…」はその行の名前の下に小さく（アイコンの明滅もつく） */
.mx-badge {
  display: block;
  margin-top: 1px;
  font-size: 10.5px;
  line-height: 1.15;
  color: var(--mx-accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mx-row.is-preparing .mx-label,
.mx-row.is-error .mx-label { line-height: 1.2; }
.mx-row.is-preparing .mx-label { color: var(--mx-muted); }
.mx-row.is-preparing .mx-icon { animation: mx-pulse 1.1s ease-in-out infinite; }
@keyframes mx-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.mx-val {
  font-size: 12.5px;
  color: var(--mx-muted);
  text-align: right;
  font-family: var(--font-num, inherit);
  font-variant-numeric: tabular-nums;
}
.mx-master-list {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--mx-line);
}

/* つまみ：見た目の線は細く、指で触れる高さは 36px */
.mx-range {
  --p: 50%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 36px;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mx-range:focus { outline: none; }
.mx-range:focus-visible { outline: 2px solid var(--mx-accent); outline-offset: 2px; border-radius: 8px; }
.mx-range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--mx-accent) 0 var(--p), var(--mx-track) var(--p) 100%);
}
.mx-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -8px;
  border: 0;
  border-radius: 50%;
  background: #fff8ee;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s;
}
.mx-range:active::-webkit-slider-thumb { transform: scale(1.12); }
.mx-range::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: var(--mx-track);
}
.mx-range::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--mx-accent);
}
.mx-range::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: #fff8ee;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

/* おすすめ */
.mx-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}
.mx-sub {
  margin-right: 2px;
  font-size: 12px;
  color: var(--mx-muted);
}
.mx-preset {
  -webkit-appearance: none;
  appearance: none;
  min-height: 34px;
  padding: 6px 13px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--mx-text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.mx-preset:hover { background: rgba(255, 255, 255, 0.1); }
.mx-preset:focus-visible { outline: 2px solid var(--mx-accent); outline-offset: 2px; }
.mx-preset[aria-pressed="true"] {
  border-color: var(--mx-accent);
  background: var(--mx-accent);
  color: var(--accent-ink, #2b1b0d);
  font-weight: 700;
}

/* 注意書き（小さく） */
.mx-hint {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--mx-muted);
  text-wrap: balance; /* 2 行になるときに最後の 1〜2 字だけが残らないように */
}
/* パソコンの横長はミキサーの高さに上限がある（テレビにかからないように）ので、補足は省く（1366×768 で中がスクロールになるため） */
@media (orientation: landscape) and (min-height: 561px) {
  .mx-hint-more { display: none; }
}

/* 読み込めなかった */
.mx-status.is-error { color: #f08a7a; }
.mx-row.is-error .mx-label,
.mx-row.is-error .mx-icon,
.mx-row.is-error .mx-badge { color: #f08a7a; }

/* 音の素材のクレジット（小さく） */
.mx-credit {
  margin: 6px 0 0;
  font-size: 10.5px;
  letter-spacing: -0.01em;
  line-height: 1.4;
  color: var(--mx-muted);
  opacity: 0.85;
}
.mx-credit a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.3);
  text-underline-offset: 2px;
}
.mx-credit a:hover { color: var(--mx-text); }
.mx-credit a:focus-visible { outline: 2px solid var(--mx-accent); outline-offset: 2px; border-radius: 2px; }

/* やや狭い枠：名前の列を細くして、長い名前は2行に */
@container (max-width: 300px) {
  .mx-row {
    grid-template-columns: 18px 74px minmax(0, 1fr) 2em; /* 「ノートと鉛筆」（12px×6字）が1行に収まる幅 */
    column-gap: 8px;
  }
  .mx-icon { width: 18px; height: 18px; }
  .mx-label {
    font-size: 12px;
    line-height: 1.2;
    white-space: normal;
    word-break: keep-all;
    overflow-wrap: anywhere;
  }
}
/* とても狭い枠：つまみを名前の下に */
@container (max-width: 200px) {
  .mx-row {
    grid-template-columns: 18px minmax(0, 1fr) 2em;
    grid-template-rows: auto 32px;
    row-gap: 0;
    padding-top: 4px;
  }
  .mx-icon { grid-row: 1; }
  .mx-label { grid-row: 1; grid-column: 2; }
  .mx-val { grid-row: 1; grid-column: 3; }
  .mx-range { grid-row: 2; grid-column: 1 / -1; height: 32px; }
}

/* 指で触る端末：消音の当たりを 44px に（見た目はそのまま） */
@media (pointer: coarse) {
  .mx-mute::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: max(100%, 44px);
    height: 44px;
    transform: translate(-50%, -50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mx-row.is-preparing .mx-icon { animation: none; opacity: 0.5; }
  .mx-icon, .mx-preset, .mx-mute, .mx.is-muted .mx-list, .mx-range::-webkit-slider-thumb { transition: none; }
}
