/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 * Copyright © 2026 Marcel Rymenhout and IniqDash contributors */
/* ==========================================================================
   Media Player Widget V1 — widget-specific CSS only (surfaces/colours/radii/type from shared tokens).

   Identity: the artwork leads (and, wide, tints the whole card through a blurred backdrop);
   without artwork a device icon well takes its place — never an empty frame. A round play/pause
   key, a slim volume rail and a source picker.

   Arrangements (container "mw" = the widget's own box):
     compact   < 276px   artwork/icon + play on top, device, title, artist
     standard  276–559   artwork on the left; device + state, title, artist; play + volume; source
     wide     >= 560px   blurred artwork backdrop; artwork | media | controls column
     tall     ≥ 360px tall, not landscape (≤ 3 : 2): "now playing" — the artwork large in the middle
                         (growing with both axes), title / artist under it, controls at the bottom
   ========================================================================== */

.mw {
  position: relative;
  container: mw / size;
  min-width: 0;
  min-height: 92px;
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--radius-device);
  color: var(--text-primary);
  font-family: var(--font);
  background: linear-gradient(165deg, var(--surface-primary-top), var(--surface-primary) 55%, var(--surface-secondary));
  box-shadow: var(--shadow-primary), inset 0 0 0 1px var(--border-subtle);
}
.mw__backdrop { display: none; }
.mw__in {
  --mw-art: 52px;
  position: relative;
  z-index: 1;
  height: 100%;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  grid-template-areas: "art ctrls" ". ." "dev dev" "media media";
  row-gap: 4px;
}

/* ---- artwork / icon ---- */
.mw__art { grid-area: art; position: relative; width: var(--mw-art); height: var(--mw-art); align-self: start; }
.mw__art img {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 8px 18px -8px rgba(0, 0, 0, .8), inset 0 0 0 1px var(--border-primary);
}
.mw__icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--text-secondary);
  background: var(--surface-tertiary);
  box-shadow: var(--shadow-icon);
}
.mw__icon svg { width: 21px; height: 21px; }
.mw[data-art="yes"] .mw__art img { display: block; }
.mw[data-art="yes"] .mw__icon { display: none; }
.mw:not([data-art="yes"]) .mw__art { width: 40px; height: 40px; }
.mw[data-state="off"] .mw__art, .mw[data-state="unavailable"] .mw__art, .mw[data-state="unknown"] .mw__art { opacity: var(--unavailable-opacity); filter: grayscale(.8); }
.mw[data-state="paused"] .mw__art img { filter: saturate(.55) brightness(.8); }

/* ---- device + state ---- */
.mw__dev { grid-area: dev; display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 11.5px; color: var(--text-muted); }
.mw__dev-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mw__state { display: inline-flex; margin-left: auto; flex: none; align-items: center; gap: 5px; font-weight: var(--iq-fw-status); color: var(--text-secondary); }
.mw[data-state="playing"] .mw__state { color: var(--accent); }
.mw__eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 10px; }
.mw__eq i { width: 2.5px; height: 40%; border-radius: 1px; background: currentColor; }
.mw__eq i:nth-child(2) { height: 75%; }
.mw__eq i:nth-child(3) { height: 55%; }
.mw[data-state="playing"] .mw__eq i { animation: mw-eq .9s ease-in-out infinite alternate; }
.mw[data-state="playing"] .mw__eq i:nth-child(2) { animation-delay: -.3s; }
.mw[data-state="playing"] .mw__eq i:nth-child(3) { animation-delay: -.6s; }
.mw:not([data-state="playing"]) .mw__eq { display: none; }
@keyframes mw-eq { from { height: 25%; } to { height: 100%; } }
@media (prefers-reduced-motion: reduce) { .mw[data-state="playing"] .mw__eq i { animation: none; } }

/* ---- media ---- */
.mw__media { grid-area: media; min-width: 0; }
.mw__title { margin: 1px 0 0; font-size: 14px; font-weight: var(--iq-fw-title); line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mw__artist { margin: 1px 0 0; font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mw__artist[hidden] { display: none; }
.mw:not([data-state="playing"]):not([data-state="paused"]) .mw__title { color: var(--text-secondary); font-weight: var(--iq-fw-title); }

/* ---- controls ---- */
.mw__ctrls { grid-area: ctrls; display: flex; align-items: center; gap: 10px; min-width: 0; }
.mw__play {
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text-primary);
  background: linear-gradient(180deg, var(--surface-tertiary), var(--surface-primary));
  box-shadow: 0 3px 8px rgba(0, 0, 0, .5), inset 0 1px 0 var(--edge-highlight), inset 0 0 0 1px var(--border-subtle);
}
.mw__play svg { width: 18px; height: 18px; }
.mw[data-state="playing"] .mw__play { color: var(--page-bg); background: var(--accent); box-shadow: 0 4px 14px -2px var(--accent-line), inset 0 1px 0 rgba(255, 255, 255, .35); }
.mw__play:disabled { cursor: not-allowed; opacity: var(--disabled-opacity); }
.mw__play:focus-visible, .mw__vol input:focus-visible, .mw__src select:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
.mw__vol, .mw__src { display: none; }

/* volume: a slim rail with a round knob (not the light's wide fill bar) */
.mw__vol { flex: 1 1 0; align-items: center; gap: 8px; min-width: 0; height: 40px; }
.mw__vol-i { flex: none; width: 17px; height: 17px; color: var(--text-muted); display: grid; }
.mw__vol-i svg { width: 100%; height: 100%; }
.mw__vol-v { flex: none; min-width: 22px; text-align: right; font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.mw__vol input {
  --v: .5;
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  height: 40px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.mw__vol input::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--text-secondary) calc(var(--v) * 100%), var(--page-bg) 0);
  box-shadow: inset 0 0 0 1px var(--border-subtle);
}
.mw__vol input::-moz-range-track { height: 5px; border-radius: 3px; background: var(--page-bg); }
.mw__vol input::-moz-range-progress { height: 5px; border-radius: 3px; background: var(--text-secondary); }
.mw__vol input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6.5px;
  border-radius: 50%;
  background: var(--text-primary);
  box-shadow: 0 2px 5px rgba(0, 0, 0, .6);
}
.mw__vol input::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: var(--text-primary); }
.mw[data-state="playing"] .mw__vol input::-webkit-slider-runnable-track { background: linear-gradient(90deg, var(--accent) calc(var(--v) * 100%), var(--page-bg) 0); }
.mw[data-state="playing"] .mw__vol input::-moz-range-progress { background: var(--accent); }
.mw__vol input:disabled { cursor: not-allowed; opacity: var(--disabled-opacity); }

/* source: native select (accessible), dressed in the theme */
.mw__src { align-items: center; gap: 8px; min-width: 0; height: 40px; padding: 0 4px 0 12px; border-radius: 12px; background: var(--page-bg); box-shadow: var(--shadow-icon), inset 0 0 0 1px var(--border-subtle); }
.mw__src-k { flex: none; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.mw__src select {
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;                                /* fills its 40px well: full-height target */
  padding: 0 26px 0 6px;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  font: 600 12.5px var(--font);
  color: var(--text-primary);
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237e838f' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 6px center / 14px;
  -webkit-appearance: none;
  appearance: none;
}
.mw__src select option { color: #111; }
.mw__src select:disabled { cursor: not-allowed; opacity: var(--unavailable-opacity); }

/* ---------------------------------------------------------------- standard: 276–559px */
@container mw (min-width: 276px) {
  .mw__in {
    --mw-art: clamp(64px, min(30cqw, calc(100cqh - 28px)), 124px);
    padding: 14px;
    grid-template-columns: var(--mw-art) minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-areas: "art dev" "art media" "art ." "art ctrls";
    column-gap: 14px;
    row-gap: 6px;
  }
  .mw:not([data-art="yes"]) .mw__in { grid-template-columns: var(--mw-art) minmax(0, 1fr); }
  .mw__art { align-self: start; }
  .mw__title { font-size: 15px; }              /* one line (media titles are unbounded: ellipsis + full text in title) */
  .mw__ctrls { flex-wrap: wrap; row-gap: 6px; }
  .mw__vol { display: flex; }
  .mw__src { display: flex; flex: 1 1 100%; }
  .mw[data-caps="playPause source"] .mw__src { flex: 1 1 0; }
}

/* ---------------------------------------------------------------- wide: ≥ 560px */
@container mw (min-width: 560px) {
  .mw__backdrop {                              /* the artwork tints the card */
    display: block;
    position: absolute;
    inset: -40px;
    z-index: 0;
    background: center / cover no-repeat;
    filter: blur(38px) saturate(1.3);
    opacity: .3;
  }
  .mw__backdrop::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, var(--surface-primary) 75%); }
  .mw[data-state="off"] .mw__backdrop, .mw[data-state="unavailable"] .mw__backdrop, .mw[data-state="unknown"] .mw__backdrop, .mw[data-state="idle"] .mw__backdrop { opacity: .08; }
  .mw__in {
    --mw-art: clamp(64px, calc(100cqh - 28px), 168px);
    padding: 14px 18px 14px 14px;
    grid-template-columns: var(--mw-art) minmax(0, 1fr) minmax(200px, 38%);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "art dev dev" "art media ctrls" "art . ctrls";
    column-gap: 18px;
    row-gap: 6px;
  }
  .mw:not([data-art="yes"]) .mw__in { grid-template-columns: var(--mw-art) minmax(0, 1fr) minmax(200px, 38%); grid-template-areas: "art dev dev" "art media ctrls" "art . ctrls"; }
  .mw__media { align-self: center; }
  .mw__title { font-size: 18px; white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .mw__artist { font-size: 13px; }
  .mw__ctrls { align-self: center; flex-wrap: wrap; }
}

/* ---------------------------------------------------------------- tall: ≥ 360px tall, not landscape */
@container mw (min-height: 290px) and (min-width: 220px) and (max-aspect-ratio: 3 / 2) {
  .mw__in, .mw:not([data-art="yes"]) .mw__in {
    --mw-art: clamp(64px, min(calc(100cqw - 28px), calc(100cqh - 214px)), 360px);
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "dev" "art" "media" "ctrls";
    row-gap: 10px;
  }
  .mw__art { align-self: center; justify-self: center; }
  .mw__media { align-self: end; }
  .mw__title { font-size: clamp(15px, 5cqw, 20px); }
  .mw__artist { font-size: clamp(12px, 3.6cqw, 14px); }
}

/* previous / next and mute: only present when the device supports them */
.mw__skip { flex: none; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--text-secondary); background: var(--surface-tertiary); }
.mw__skip svg { width: 15px; height: 15px; }
.mw__skip:hover:not(:disabled) { color: var(--text-primary); }
.mw__skip:disabled, .mw__mute:disabled { cursor: not-allowed; opacity: var(--disabled-opacity); }
.mw__skip:focus-visible, .mw__mute:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
.mw__mute { padding: 0; border: 0; background: none; cursor: pointer; width: 22px; height: 22px; }
.mw__mute[aria-pressed="true"] { color: var(--accent); }

/* ================================================================ variants: Compact · Mini Bar (and the real progress line)
   New elements use the iq-media-* names. The card (.mw__in) is the Artwork variant; the others are their own block, arranged from the
   widget's OWN box (container "mw"). */
.mw[data-mw-variant="compact"], .mw[data-mw-variant="minibar"] { min-height: 44px; }
.mw__in[hidden], .mw__backdrop[hidden] { display: none !important; }
.iq-media-alt { position: absolute; inset: 0; display: flex; align-items: center; gap: 10px; padding: 8px 12px; box-sizing: border-box; min-width: 0; }
.iq-media-alt__art { position: relative; flex: none; width: 44px; height: 44px; border-radius: 8px; overflow: hidden; display: grid; place-items: center; background: var(--control-well); color: var(--text-secondary); }
.iq-media-alt__art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }
.iq-media-alt[data-art="yes"] .iq-media-alt__art img { display: block; }
.iq-media-alt[data-art="yes"] .iq-media-alt__icon { display: none; }
.iq-media-alt__icon svg { width: 22px; height: 22px; }
.iq-media-alt__txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.iq-media-alt__title { font-size: 14px; font-weight: var(--iq-fw-title); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iq-media-alt__sub { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iq-media-alt[data-state="off"] .iq-media-alt__title, .iq-media-alt[data-state="idle"] .iq-media-alt__title, .iq-media-alt[data-state="unavailable"] .iq-media-alt__title, .iq-media-alt[data-state="unknown"] .iq-media-alt__title { color: var(--text-secondary); font-weight: var(--iq-fw-title); }
.iq-media-alt__ctl { flex: none; display: inline-flex; gap: 6px; align-items: center; }
.iq-media-btn { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--text-primary); background: var(--control-well); box-shadow: var(--control-well-shadow); }
.iq-media-btn svg { width: 16px; height: 16px; }
.iq-media-btn--play { color: var(--page-bg); background: var(--accent); }
.iq-media-alt[data-state="playing"] .iq-media-btn--play { box-shadow: 0 4px 14px -2px var(--accent-line); }
.iq-media-alt[data-state="paused"] .iq-media-btn--play, .iq-media-alt[data-state="idle"] .iq-media-btn--play { color: var(--text-primary); background: var(--control-raised, var(--control-well)); }
.iq-media-btn:disabled { cursor: not-allowed; opacity: var(--disabled-opacity, .45); }
.iq-media-btn:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
/* mini bar: the play button first, a thin bar */
.iq-media-alt--minibar { gap: 8px; padding: 4px 10px; }
.iq-media-alt--minibar .iq-media-alt__art { width: 32px; height: 32px; order: 1; }
.iq-media-alt--minibar .iq-media-alt__ctl { order: 0; }
.iq-media-alt--minibar .iq-media-alt__txt { order: 2; flex-direction: row; align-items: baseline; gap: 6px; }
.iq-media-alt--minibar .iq-media-alt__title { flex: 0 1 auto; font-size: 13px; }
.iq-media-alt--minibar .iq-media-alt__sub { flex: 1 1 0; min-width: 0; }
.iq-media-alt--minibar .iq-media-alt__sub:not(:empty)::before { content: "— "; }
.iq-media-alt--minibar .iq-media-btn { width: 32px; height: 32px; }
@container mw (max-width: 260px) { .iq-media-alt--minibar .iq-media-alt__art { display: none; } .iq-media-alt--minibar .iq-media-alt__sub { display: none; } }
@container mw (max-width: 200px) { .iq-media-alt--compact .iq-media-btn--prev, .iq-media-alt--compact .iq-media-btn--next { display: none; } .iq-media-alt--compact .iq-media-alt__sub { display: none; } }
@container mw (max-height: 56px) { .iq-media-alt--compact .iq-media-alt__art { width: 32px; height: 32px; } }
/* the progress line: real position / duration only */
.iq-media-prog { display: flex; align-items: center; gap: 8px; min-width: 0; margin-top: 6px; }
.iq-media-prog[hidden] { display: none; }
.iq-media-prog__bar { flex: 1 1 auto; height: 4px; border-radius: 2px; background: var(--control-well); overflow: hidden; }
.iq-media-prog__bar i { display: block; height: 100%; background: var(--text-secondary); transition: width .9s linear; }
.mw[data-state="playing"] .iq-media-prog__bar i { background: var(--accent); }
.iq-media-prog__t { flex: none; font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.iq-media-prog--line { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; }
.iq-media-prog--line .iq-media-prog__bar { height: 3px; border-radius: 0; background: transparent; }
@container mw (max-height: 150px) { .mw__in .iq-media-prog { display: none; } }
@container mw (max-width: 275px) { .iq-media-opt { display: none; } }
/* shuffle / repeat (only for a player that supports them) */
.iq-media-opt[aria-pressed="true"] { color: var(--accent); }
.iq-media-opt--repeat[data-mode="one"]::after { content: "1"; position: absolute; font-size: 8px; font-weight: 700; margin-top: -1px; }
.iq-media-opt { position: relative; }

/* ================================================================ pass 2 — a deliberate fallback when there is no artwork: a lit record sleeve with the device glyph, tinted when playing */
@container mw (min-width: 276px) {
  .mw:not([data-art="yes"]) .mw__art { width: var(--mw-art); height: var(--mw-art); }
  .mw:not([data-art="yes"]) .mw__icon {
    position: absolute; inset: 0; width: auto; height: auto; border-radius: 18%;
    background: radial-gradient(circle at 30% 22%, color-mix(in srgb, var(--accent) 12%, var(--surface-interactive)), var(--surface-tertiary) 72%);
    box-shadow: var(--shadow-icon), inset 0 1px 0 var(--edge-highlight), inset 0 0 0 1px var(--border-subtle);
    overflow: hidden;
  }
  .mw:not([data-art="yes"]) .mw__icon::before { content: ""; position: absolute; inset: 14%; border-radius: 50%; box-shadow: 0 0 0 1px var(--border-subtle), 0 0 0 calc(var(--mw-art) * .07) transparent, inset 0 0 0 calc(var(--mw-art) * .1) rgba(255, 255, 255, .02); }
  .mw:not([data-art="yes"]) .mw__icon::after { content: ""; position: absolute; inset: 30%; border-radius: 50%; box-shadow: 0 0 0 1px var(--border-subtle); }
  .mw:not([data-art="yes"]) .mw__icon svg { position: relative; width: 34%; height: 34%; z-index: 1; }
  .mw[data-state="playing"]:not([data-art="yes"]) .mw__icon { color: var(--accent); background: radial-gradient(circle at 30% 22%, color-mix(in srgb, var(--accent) 30%, var(--surface-interactive)), var(--surface-tertiary) 72%); }
}
@container mw (min-width: 276px) and (max-height: 189px) { .mw__src { display: none !important; } }

/* ================================================================ STAGE (variant "stage"): the player as a full panel — the cover's own
   colours fill the card (a blurred, slowly breathing backdrop), the album large with a VINYL record that slides out from behind it and
   spins while it plays, the title big, the progress, the transport and the volume. Same controls and data as the Artwork card; a layout
   of its own, stronger than a design collection's card rules. */
.mw.mw[data-variant="stage"] { background: #0c0d12; }
.mw.mw[data-variant="stage"] .mw__backdrop { display: block; position: absolute; inset: -18%; z-index: 0; background: center / cover no-repeat;
  filter: blur(46px) saturate(1.6) brightness(.72); transform: scale(1.1); animation: mw-breathe 14s ease-in-out infinite alternate; opacity: 1; }
.mw.mw[data-variant="stage"] .mw__backdrop::after { display: none; }
.mw.mw[data-variant="stage"][data-state="paused"] .mw__backdrop { opacity: .55; }
.mw.mw[data-variant="stage"]:is([data-state="off"], [data-state="idle"], [data-state="unavailable"]) .mw__backdrop { opacity: .2; }
.mw.mw[data-variant="stage"]::after { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(70% 90% at 25% 50%, transparent, rgba(8, 9, 13, .55) 75%), linear-gradient(180deg, rgba(8, 9, 13, .1), rgba(8, 9, 13, .6)); }
@keyframes mw-breathe { from { transform: scale(1.1) rotate(0deg); } to { transform: scale(1.22) rotate(4deg); } }
.mw.mw[data-variant="stage"] .mw__in { --mw-art: min(36cqw, calc(100cqh - 80px)); padding: clamp(18px, 4cqmin, 34px); display: grid; align-items: center; column-gap: 18px; row-gap: 10px;
  grid-template-columns: var(--mw-art) minmax(0, 1fr); grid-template-rows: auto auto auto auto; grid-template-areas: "art dev" "art media" "art ctrls" "art ."; align-content: center; }
.mw.mw[data-variant="stage"] .mw__in::before { display: none; }
/* the ALBUM, large, with its vinyl */
.mw.mw[data-variant="stage"] .mw__art { width: var(--mw-art); height: var(--mw-art); margin: 0; align-self: center; border-radius: 22px; z-index: 2;
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .85), 0 0 0 1px rgba(255, 255, 255, .08); }
.mw.mw[data-variant="stage"] .mw__art img { border-radius: 22px; width: 100%; height: 100%; object-fit: cover; position: relative; z-index: 2; }
.mw.mw[data-variant="stage"] .mw__art::before { content: ""; position: absolute; z-index: 1; top: 5%; bottom: 5%; left: 5%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, #0b0b0d 0 2.2%, var(--accent, #f69a2e) 2.6% 15%, #121216 15.5% 17%, transparent 17.5%),
    conic-gradient(from 40deg, rgba(255, 255, 255, .16), transparent 12%, transparent 38%, rgba(255, 255, 255, .12) 50%, transparent 62%, transparent 88%, rgba(255, 255, 255, .16)),
    repeating-radial-gradient(circle, rgba(255, 255, 255, .07) 0 1px, transparent 1.5px 3.5px), #0a0a0c; box-shadow: 0 10px 30px rgba(0, 0, 0, .6); transform: translateX(0) rotate(0deg); transition: transform .9s cubic-bezier(.2, .8, .2, 1); }
.mw.mw[data-variant="stage"][data-state="playing"] .mw__art::before { transform: translateX(42%); animation: mw-spin 3.4s linear infinite .9s; }
@keyframes mw-spin { from { transform: translateX(42%) rotate(0deg); } to { transform: translateX(42%) rotate(360deg); } }
.mw.mw[data-variant="stage"] .mw__art .mw__icon { width: 100%; height: 100%; border-radius: 22px; position: relative; z-index: 2; }
.mw.mw[data-variant="stage"] .mw__art .mw__icon svg { width: 34%; height: 34%; }
/* the TEXT */
.mw.mw[data-variant="stage"] .mw__dev { grid-area: dev; padding-left: calc(var(--mw-art) * .42); font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; color: rgba(255, 255, 255, .7); }
.mw.mw[data-variant="stage"] .mw__dev-name { font-size: inherit; font-weight: 600; color: inherit; }
.mw.mw[data-variant="stage"] .mw__state { display: inline-flex; margin-left: 12px; color: var(--accent, #f69a2e); letter-spacing: .08em; }
.mw.mw[data-variant="stage"] .mw__eq { height: 14px; gap: 3px; }
.mw.mw[data-variant="stage"] .mw__eq i { width: 3px; }
.mw.mw[data-variant="stage"] .mw__media { grid-area: media; padding-left: calc(var(--mw-art) * .42); margin: 0; text-align: left; }
.mw.mw[data-variant="stage"] .mw__media::before { display: none; }
.mw.mw[data-variant="stage"] .mw__title { font-size: clamp(22px, 4.6cqw, 40px); font-weight: 700; letter-spacing: -.02em; line-height: 1.1; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: #fff; }
.mw.mw[data-variant="stage"] .mw__artist { font-size: clamp(14px, 2.2cqw, 18px); margin-top: 6px; color: rgba(255, 255, 255, .72); }
.mw.mw[data-variant="stage"] .iq-media-prog { display: flex; margin-top: 18px; }
.mw.mw[data-variant="stage"] .iq-media-prog[hidden] { display: none; }
.mw.mw[data-variant="stage"] .iq-media-prog__bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .14); }
.mw.mw[data-variant="stage"] .iq-media-prog__bar i { border-radius: 3px; background: linear-gradient(90deg, #fff, var(--accent, #f69a2e)); box-shadow: 0 0 14px var(--accent, #f69a2e); }
.mw.mw[data-variant="stage"] .iq-media-prog__t { font-size: 12px; color: rgba(255, 255, 255, .7); }
/* the TRANSPORT: shuffle · previous · PLAY · next · repeat; the volume and the source under it */
.mw.mw[data-variant="stage"] .mw__ctrls { grid-area: ctrls; padding-left: calc(var(--mw-art) * .42); display: flex; flex-wrap: wrap; justify-content: flex-start; align-items: center; gap: 14px 18px; margin: 10px 0 0; }
.mw.mw[data-variant="stage"] .iq-media-opt--shuffle { order: 1; } .mw.mw[data-variant="stage"] .mw__skip--prev { order: 2; } .mw.mw[data-variant="stage"] .mw__play { order: 3; }
.mw.mw[data-variant="stage"] .mw__skip--next { order: 4; } .mw.mw[data-variant="stage"] .iq-media-opt--repeat { order: 5; }
.mw.mw[data-variant="stage"] .mw__vol { order: 6; display: flex; flex: 1 0 100%; max-width: 420px; height: 34px; }
.mw.mw[data-variant="stage"] .mw__src { order: 7; display: flex; }
.mw.mw[data-variant="stage"] .mw__skip, .mw.mw[data-variant="stage"] .iq-media-opt { width: 46px; height: 46px; border-radius: 50%; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); color: #fff;
  backdrop-filter: blur(10px); display: grid; place-items: center; box-shadow: none; }
.mw.mw[data-variant="stage"] .mw__skip svg, .mw.mw[data-variant="stage"] .iq-media-opt svg { width: 20px; height: 20px; }
.mw.mw[data-variant="stage"] .mw__play { width: 72px; height: 72px; border-radius: 50%; background: #fff; color: #0c0d12; border: 0;
  box-shadow: 0 14px 40px -8px rgba(255, 255, 255, .45); transition: transform .15s ease, box-shadow .3s ease; }
.mw.mw[data-variant="stage"][data-state="playing"] .mw__play { background: var(--accent, #f69a2e); color: #fff; box-shadow: 0 14px 44px -6px var(--accent, #f69a2e); animation: mw-pulse 2.4s ease-in-out infinite; }
@keyframes mw-pulse { 0%, 100% { box-shadow: 0 14px 44px -10px var(--accent, #f69a2e); } 50% { box-shadow: 0 14px 60px -2px var(--accent, #f69a2e); } }
.mw.mw[data-variant="stage"] .mw__play:active { transform: scale(.94); }
.mw.mw[data-variant="stage"] .mw__play svg { width: 28px; height: 28px; }
.mw.mw[data-variant="stage"] .mw__vol-i { color: rgba(255, 255, 255, .75); }
.mw.mw[data-variant="stage"] .mw__vol-v { color: rgba(255, 255, 255, .75); }
/* narrow (a phone, a small card): the album on top, everything centred under it */
@container mw (max-width: 560px) {
  .mw.mw[data-variant="stage"] .mw__in { --mw-art: min(70cqw, 46cqh); grid-template-columns: minmax(0, 1fr); grid-template-areas: "art" "dev" "media" "ctrls"; justify-items: center; text-align: center; }
  .mw.mw[data-variant="stage"] :is(.mw__dev, .mw__media, .mw__ctrls) { padding-left: 0; justify-content: center; text-align: center; }
  .mw.mw[data-variant="stage"][data-state="playing"] .mw__art::before { transform: none; animation: none; }
}
@media (prefers-reduced-motion: reduce) { .mw.mw[data-variant="stage"] .mw__backdrop, .mw.mw[data-variant="stage"] .mw__art::before, .mw.mw[data-variant="stage"] .mw__play { animation: none !important; } }

/* ================================================================ CARD (variant 'card') — artwork · what it is doing · title · controls ·
   volume, over the device picture (IniqDeviceBg) */
.mw-card { position: relative; isolation: isolate; box-sizing: border-box; height: 100%; min-width: 0; padding: 18px; display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 22px; align-items: center;
  overflow: hidden; color: #fff; font-family: var(--mai-font, var(--font)); border-radius: 18px; border: 1px solid rgba(255, 255, 255, .06);
  background: radial-gradient(90% 90% at 0% 0%, rgba(192, 75, 255, .16), transparent 60%), linear-gradient(180deg, #22252e 0%, #1f222a 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), 0 6px 16px rgba(0, 0, 0, .25); }
.mw-card > :not(.idb) { position: relative; z-index: 1; }
.mwc__art { position: relative; aspect-ratio: 1; border-radius: 18px; overflow: hidden; display: grid; place-items: center; font-size: 64px; color: rgba(255, 255, 255, .88);
  background: linear-gradient(150deg, #c06bff 0%, #7a22e6 55%, #3b1580 100%); box-shadow: 0 16px 32px rgba(122, 34, 230, .35); }
.mw-card[data-kind="tv"] .mwc__art { background: linear-gradient(150deg, #5ed7ff 0%, #2a8ff0 55%, #173f86 100%); box-shadow: 0 16px 32px rgba(42, 143, 240, .3); }
.mwc__art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mw-card:not(.is-on) .mwc__art { filter: saturate(.35) brightness(.7); box-shadow: none; }
.mwc__info { min-width: 0; }
.mwc__kick { display: flex; align-items: center; gap: 6px; height: 16px; font-size: 9.5px; line-height: 13px; color: #8b909c; }
.mwc__ttl { display: flow-root; }
.mwc__dot { width: 8px; height: 8px; border-radius: 50%; background: #5c616e; flex: none; }
.mwc__dot[data-tone="ok"] { background: #3ce06a; } .mwc__dot[data-tone="warn"] { background: #ffb347; } .mwc__dot[data-tone="err"] { background: #f13c3c; }
.mwc__ttl b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 21px; font-weight: 600; line-height: 1.2; margin-top: 6px; }
.mwc__ttl small { display: block; font-size: 11px; line-height: 15px; color: #c9ccd4; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mwc__ctl { display: flex; align-items: center; gap: 14px; margin: 18px 0 14px; }
.mwc__b { width: 44px; height: 44px; padding: 0; border-radius: 50%; display: grid; place-items: center; font-size: 18px; color: #c9ccd4; cursor: pointer; border: 1px solid rgba(255, 255, 255, .09); background: #282b35; flex: none; }
.mwc__b:hover:not(:disabled) { color: #fff; }
.mwc__b.is-on { color: #e9d8ff; border-color: rgba(192, 75, 255, .55); box-shadow: 0 0 12px rgba(138, 45, 255, .3); }
.mwc__b.is-skip { border-color: transparent; background: transparent; font-size: 20px; color: #fff; }
.mwc__b:disabled { opacity: .35; cursor: not-allowed; }
.mwc__orb { width: 52px; height: 52px; padding: 0; flex: none; border: 0; border-radius: 50%; display: inline-grid; place-items: center; cursor: pointer; font-size: 24px; color: #fff;
  background: radial-gradient(circle at 35% 30%, #c06bff 0%, #8a2dff 60%, #6a17e0 100%); box-shadow: 0 0 14px rgba(138, 45, 255, .65); }
.mwc__orb:active:not(:disabled) { transform: scale(.93); }
.mwc__orb:disabled { background: #282b35; box-shadow: none; color: #5c616e; cursor: not-allowed; }
.mwc__vol { display: flex; align-items: center; gap: 10px; height: 20px; }
.mwc__vol .bi { color: #858a97; font-size: 13px; }
.mwc__vol output { min-width: 44px; text-align: right; font-size: 9.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mwc__vol input { -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; height: 20px; background: transparent; cursor: pointer; margin: 0; --p: 50%; --accent: #c04bff; }
.mwc__vol input::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--accent) 0 var(--p), #3a3d48 var(--p) 100%); }
.mwc__vol input::-moz-range-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--accent) 0 var(--p), #3a3d48 var(--p) 100%); }
.mwc__vol input::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 0 6px color-mix(in srgb, var(--accent) 70%, transparent); }
.mwc__vol input::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; }
.mwc__vol input:disabled { opacity: .4; cursor: not-allowed; }
/* PLAYERS: the segmented bar of the players (each with its state dot), the selected player's card below */
.mwc-players { height: 100%; min-width: 0; display: flex; flex-direction: column; gap: 12px; font-family: var(--mai-font, var(--font)); }
.mwc-players > .mw-card { flex: 1 1 auto; min-height: 0; }
.mwc-seg { display: flex; gap: 4px; padding: 4px; background: #171a21; border-radius: 990px; overflow-x: auto; scrollbar-width: none; flex: none; }
.mwc-seg::-webkit-scrollbar { display: none; }
.mwc-seg button { flex: 1 0 auto; height: 34px; padding: 0 14px; border: 0; border-radius: 990px; background: transparent; color: #c9ccd4; font: 500 10.5px var(--mai-font, var(--font));
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; white-space: nowrap; }
.mwc-seg button:hover { color: #fff; }
.mwc-seg button.is-active { color: #fff; background: #282b35; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); }
.mwc-seg__dot { width: 8px; height: 8px; border-radius: 50%; background: #5c616e; flex: none; }
.mwc-seg__dot[data-tone="ok"] { background: #3ce06a; } .mwc-seg__dot[data-tone="warn"] { background: #ffb347; } .mwc-seg__dot[data-tone="err"] { background: #f13c3c; }

/* ================================================================ MINI (variant 'mini') — art · title · prev / play / next · progress and times */
.mw-mini { box-sizing: border-box; height: 100%; min-width: 0; padding: 8px 15px 0 14px; border-radius: 18px; color: #fff; font-family: var(--mai-font, var(--font));
  background: linear-gradient(180deg, #22252e 0%, #1f222a 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04); }
.mw-mini .mwm__row { display: flex; align-items: center; gap: 10px; }
.mw-mini .mwm__art { position: relative; flex: none; width: 38px; height: 38px; border-radius: 8px; overflow: hidden; display: grid; place-items: center; font-size: 16px; color: rgba(255, 255, 255, .85);
  background: radial-gradient(circle at 70% 25%, rgba(255, 210, 120, .9) 0%, transparent 35%), radial-gradient(circle at 25% 80%, #3a7bff 0%, transparent 50%), linear-gradient(135deg, #ff4f6d 0%, #9c2bd8 55%, #2a1d6b 100%);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .35); }
.mw-mini .mwm__art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mw-mini .mwm__meta { flex: 1; min-width: 0; }
.mw-mini .mwm__title { font-size: 11.2px; font-weight: 600; line-height: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mw-mini .mwm__artist { font-size: 8px; line-height: 11px; color: #8b909c; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mw-mini .mwm__ctl { display: flex; align-items: center; gap: 3px; }
.mw-mini .mwm__b { border: 0; background: transparent; color: #9095a2; font-size: 14px; padding: 0 2px; cursor: pointer; transition: color .2s; line-height: 1; }
.mw-mini .mwm__b:hover { color: #fff; }
.mw-mini .mwm__play { width: 33px; height: 33px; padding: 0; border-radius: 50%; border: 0; display: grid; place-items: center; font-size: 19px; color: #fff; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #c06bff 0%, #8a2dff 60%, #6a17e0 100%); box-shadow: 0 0 14px rgba(138, 45, 255, .65); transition: transform .15s; }
.mw-mini .mwm__play:active { transform: scale(.92); }
.mw-mini :is(.mwm__b, .mwm__play).is-disabled { opacity: .35; cursor: not-allowed; filter: grayscale(.6); }
.mw-mini .mwm__prog { position: relative; margin-top: 12.5px; height: 3px; border-radius: 3px; background: #383b46; }
.mw-mini .mwm__fill { position: absolute; left: 0; top: 0; bottom: 0; width: var(--pos, 0%); border-radius: inherit; background: linear-gradient(90deg, #6a2dff, #c04bff); }
.mw-mini .mwm__thumb { position: absolute; top: 50%; left: var(--pos, 0%); width: 11px; height: 11px; transform: translate(-50%, -50%); border-radius: 50%; background: #c04bff; box-shadow: 0 0 9px rgba(192, 75, 255, .9); }
.mw-mini .mwm__times { display: flex; justify-content: space-between; margin-top: 5.5px; font-size: 7.5px; line-height: 10px; color: #8b909c; }
