/* ============================================================================
   MTing OS — Standalone 4-OS Native Music Player (`window.MTingMusic`)
   Decoupled from `os-pulse.js`; subscribes to `CustomEvent("mting:host-state")`
   to automatically switch/play tracks across Host States when State Sync is on.
   ============================================================================ */

/* Shared Animated Coral / Accent Equalizer Bars */
.mus-eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
  vertical-align: middle;
}
.mus-eq > i {
  width: 2.5px;
  height: 3px;
  border-radius: 1.5px;
  background: currentColor;
  transition: height 0.2s ease;
}
.mus-eq.playing > i {
  animation: musEqBounce 0.68s ease-in-out infinite alternate;
}
.mus-eq.playing > i:nth-child(1) { animation-duration: 0.54s; }
.mus-eq.playing > i:nth-child(2) { animation-duration: 0.78s; animation-delay: 0.14s; }
.mus-eq.playing > i:nth-child(3) { animation-duration: 0.62s; animation-delay: 0.26s; }
@keyframes musEqBounce {
  0% { height: 3px; }
  100% { height: 12px; }
}

/* Apple Music "Top Picks" Cards (`精选推荐`) */
.mus-picks-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 22px;
}
.mus-pick-card {
  border-radius: 16px;
  padding: 14px 15px;
  color: #FFFFFF;
  background: linear-gradient(140deg, var(--mus-c1, #1B3B4B), var(--mus-c2, #C96A4B));
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.mus-pick-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.20), inset 0 1px 0 rgba(255, 255, 255, 0.26);
}
.mus-pick-top {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.mus-pick-kicker {
  font-size: 10.5px;
  font-weight: 700;
  opacity: 0.78;
  letter-spacing: 0.4px;
}
.mus-pick-title {
  font-size: 17px;
  font-weight: 800;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mus-pick-sub {
  font-size: 11.5px;
  opacity: 0.84;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mus-pick-art-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 11px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
}
.mus-pick-art-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.mus-pick-play {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(6px);
  color: #FFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ios-music-page .mus-picks-grid,
.and-music-app .mus-picks-grid {
  grid-template-columns: 1fr;
  gap: 11px;
}
.mus-track-genre {
  font-size: 11.5px;
  opacity: 0.54;
  flex-shrink: 0;
}

/* ============================================================================
   1. macOS 27 TAHOE APPLE MUSIC DESKTOP WINDOW
   ============================================================================ */
.mac-music {
  display: grid;
  grid-template-columns: 204px 1fr;
  width: 100%;
  height: 100%;
  background: #FFFFFF;
  color: #1D1D1F;
  overflow: hidden;
}
html[data-appearance="dark"] .mac-music {
  background: #1C1C20;
  color: #F5F5F7;
}

.mac-mus-sidebar {
  display: flex;
  flex-direction: column;
  padding: 12px 10px 14px;
  background: rgba(244, 244, 248, 0.88);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-right: 0.5px solid rgba(128, 128, 136, 0.22);
  gap: 2px;
}
html[data-appearance="dark"] .mac-mus-sidebar {
  background: rgba(34, 34, 40, 0.88);
}

.mac-mus-nav {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 31px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: inherit;
  border: none;
  background: transparent;
  text-align: left;
}
.mac-mus-nav:hover { background: rgba(120, 120, 128, 0.10); }
.mac-mus-nav.active {
  background: rgba(250, 35, 59, 0.14);
  color: #FA233B;
  font-weight: 700;
}
html[data-appearance="dark"] .mac-mus-nav.active {
  background: rgba(255, 55, 95, 0.22);
  color: #FF5E78;
}
.mac-mus-nav-ic { color: #FA233B; display: inline-flex; flex-shrink: 0; }
.mac-mus-sec {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.48;
  padding: 12px 10px 4px;
  letter-spacing: 0.2px;
}

.mac-mus-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.mac-mus-toolbar {
  height: 54px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 0.5px solid rgba(128, 128, 136, 0.20);
  background: rgba(250, 250, 252, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  flex-shrink: 0;
}
html[data-appearance="dark"] .mac-mus-toolbar {
  background: rgba(28, 28, 34, 0.86);
}

.mac-mus-ctrls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.mac-mus-tbtn {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.82;
}
.mac-mus-tbtn:hover { background: rgba(120, 120, 128, 0.14); opacity: 1; }
.mac-mus-tbtn.on { color: #FA233B; opacity: 1; }

.mac-mus-lcd {
  flex: 1;
  max-width: 316px;
  height: 40px;
  border-radius: 9px;
  border: 0.5px solid rgba(128, 128, 136, 0.24);
  background: rgba(120, 120, 128, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 0 5px;
  position: relative;
  overflow: hidden;
  min-width: 0;
}
.mac-mus-lcd img {
  width: 30px;
  height: 30px;
  border-radius: 5px;
  object-fit: cover;
  flex-shrink: 0;
}
.mac-mus-lcd-meta {
  flex: 1;
  min-width: 0;
  text-align: center;
  padding-bottom: 3px;
}
.mac-mus-lcd-title {
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mac-mus-lcd-sub {
  font-size: 10.5px;
  opacity: 0.65;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mac-mus-lcd-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(128, 128, 136, 0.20);
  cursor: pointer;
}
.mac-mus-lcd-bar > i {
  display: block;
  height: 100%;
  width: var(--mus-pct, 0%);
  background: #FA233B;
}

.mac-mus-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mac-mus-vol {
  width: 72px;
  accent-color: #FA233B;
  cursor: pointer;
}

.mac-mus-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 22px 26px;
}

/* ============================================================================
   2. SHARED STATE-SYNC HERO BANNER, STATION GRID & TRACK TABLE
   ============================================================================ */
.mus-hero-card {
  position: relative;
  border-radius: 18px;
  padding: 18px 20px;
  color: #FFFFFF;
  background: linear-gradient(135deg, var(--mus-c1, #1B3B4B), var(--mus-c2, #C96A4B));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  gap: 16px;
  overflow: hidden;
  margin-bottom: 20px;
}
.mus-hero-art {
  width: 88px;
  height: 88px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.34);
  flex-shrink: 0;
}
.mus-hero-body {
  flex: 1;
  min-width: 0;
}
.mus-hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(8px);
  letter-spacing: 0.2px;
}
.mus-hero-dot {
  width: 6.5px;
  height: 6.5px;
  border-radius: 50%;
  background: #30D158;
  box-shadow: 0 0 6px #30D158;
}
.mus-hero-title {
  font-size: 19px;
  font-weight: 800;
  margin-top: 7px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mus-hero-sub {
  font-size: 12.5px;
  opacity: 0.86;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mus-hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 11px;
  flex-wrap: wrap;
}
.mus-btn-play {
  height: 32px;
  padding: 0 15px;
  border-radius: 999px;
  border: none;
  background: #FFFFFF;
  color: #141417;
  font: inherit;
  font-size: 12.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}
.mus-btn-glass {
  height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  border: 0.5px solid rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.16);
  color: #FFFFFF;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.mus-btn-glass.on {
  background: rgba(48, 209, 88, 0.28);
  border-color: rgba(48, 209, 88, 0.85);
}

.mus-sec-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 800;
  margin: 6px 0 11px;
  letter-spacing: -0.2px;
}
.mus-sec-hd small {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.56;
}

/* 4-Station Grid */
.mus-station-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.mus-station-card {
  border-radius: 13px;
  padding: 9px;
  background: rgba(120, 120, 128, 0.08);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
  position: relative;
}
.mus-station-card:hover {
  transform: translateY(-2px);
  background: rgba(120, 120, 128, 0.13);
}
.mus-station-card.linked {
  border-color: rgba(250, 35, 59, 0.58);
  background: rgba(250, 35, 59, 0.08);
}
.mus-station-art-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 9px;
  overflow: hidden;
  margin-bottom: 7px;
}
.mus-station-art-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.mus-station-badge {
  position: absolute;
  left: 6px;
  top: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(10, 12, 18, 0.76);
  backdrop-filter: blur(8px);
  color: #FFF;
  font-size: 10px;
  font-weight: 700;
}
.mus-station-badge.live {
  background: #FA233B;
}
.mus-station-name {
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mus-station-sub {
  font-size: 11px;
  opacity: 0.62;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* Song Rows */
.mus-track-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.mus-track-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 7px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.14s ease;
}
.mus-track-row:hover {
  background: rgba(120, 120, 128, 0.10);
}
.mus-track-row.active {
  background: rgba(250, 35, 59, 0.11);
}
.mus-track-num {
  width: 20px;
  text-align: center;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  opacity: 0.5;
  flex-shrink: 0;
}
.mus-track-row.active .mus-track-num {
  color: #FA233B;
  opacity: 1;
}
.mus-track-art {
  width: 40px;
  height: 40px;
  border-radius: 7px;
  object-fit: cover;
  flex-shrink: 0;
}
.mus-track-info {
  flex: 1;
  min-width: 0;
}
.mus-track-title {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mus-track-row.active .mus-track-title {
  color: #FA233B;
  font-weight: 700;
}
.mus-track-sub {
  font-size: 11.5px;
  opacity: 0.62;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.mus-track-scene-tag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(120, 120, 128, 0.12);
  opacity: 0.85;
  flex-shrink: 0;
}
.mus-track-scene-tag.match {
  background: rgba(48, 209, 88, 0.18);
  color: #209942;
  opacity: 1;
}
html[data-appearance="dark"] .mus-track-scene-tag.match { color: #30D158; }
.mus-track-dur {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  opacity: 0.55;
  flex-shrink: 0;
}

/* Host State Mapping Matrix Card (`状态联动` Tab) */
.mus-rule-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mus-rule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 13px;
  background: rgba(120, 120, 128, 0.08);
  border: 1px solid transparent;
  cursor: pointer;
}
.mus-rule-row.current {
  border-color: rgba(48, 209, 88, 0.62);
  background: rgba(48, 209, 88, 0.10);
}
.mus-rule-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.mus-rule-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mus-rule-state b { display: block; font-size: 13px; font-weight: 700; }
.mus-rule-state small { display: block; font-size: 11px; opacity: 0.65; }
.mus-rule-song {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.mus-rule-song img { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; }
.mus-rule-song span { font-size: 12px; font-weight: 700; }

/* ============================================================================
   3. iOS 26 APPLE MUSIC (LIQUID GLASS + FULL-SCREEN BLURRED NOW PLAYING)
   ============================================================================ */
.ios-music-page {
  --lg-accent: #FA233B;
}
.mus-mini-title {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ios-music-page .ap26-tabs .ios-lg-tabbtn.active {
  color: #FA233B !important;
}
.ios-mus-toprow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0 10px;
}
.ios-mus-toprow .ios-large-title {
  margin: 0 !important;
  padding: 0 !important;
}
.ios-music-page .mus-hero-card {
  padding: 15px 16px;
  border-radius: 20px;
  gap: 13px;
}
.ios-music-page .mus-hero-art {
  width: 76px;
  height: 76px;
  border-radius: 13px;
}
.ios-music-page .mus-hero-title {
  font-size: 17px;
}
.ios-music-page .mus-station-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

/* iOS Full-Screen Blurred-Artwork Apple Music Now Playing */
.mus-ios-np {
  position: relative;
  width: 100%;
  height: 100%;
  color: #FFFFFF;
  background: #14151C;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.mus-ios-np-bg {
  position: absolute;
  inset: -40px;
  background-image: var(--np-art);
  background-size: cover;
  background-position: center;
  filter: blur(52px) saturate(195%) brightness(0.54);
  transform: scale(1.18);
  pointer-events: none;
}
.mus-ios-np-inner {
  position: relative;
  z-index: 2;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(var(--sys-top, 48px) + 4px) 24px calc(var(--sys-bottom, 24px) + 18px);
  box-sizing: border-box;
}
.mus-ios-grabber {
  width: 40px;
  height: 5px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.36);
  margin: 0 auto 8px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.mus-ios-art-box {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 6px 0 10px;
}
.mus-ios-art {
  width: min(264px, 66vw);
  height: min(264px, 66vw);
  border-radius: 18px;
  object-fit: cover;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.48);
  transform: scale(0.90);
  transition: transform 0.42s cubic-bezier(0.22, 1.2, 0.36, 1), box-shadow 0.42s ease;
}
.mus-ios-art.playing {
  transform: scale(1);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.62);
}
.mus-ios-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.mus-ios-song {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mus-ios-artist {
  font-size: 15.5px;
  color: rgba(255, 255, 255, 0.72);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mus-ios-scene-chip {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  font-size: 11.5px;
  font-weight: 700;
  color: #FFFFFF;
  border: 0.5px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
}
.mus-ios-scene-chip.on {
  background: rgba(48, 209, 88, 0.26);
  border-color: rgba(48, 209, 88, 0.72);
}

.mus-scrub-wrap {
  margin-top: 14px;
}
.mus-scrub-bar {
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
  overflow: hidden;
  cursor: pointer;
}
.mus-scrub-bar > i {
  display: block;
  height: 100%;
  width: var(--mus-pct, 0%);
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.92);
}
.mus-scrub-times {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.62);
  margin-top: 6px;
}

.mus-ios-transport {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 6px 10px;
}
.mus-ios-transport button {
  border: none;
  background: transparent;
  color: #FFFFFF;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  transition: transform 0.12s ease, opacity 0.15s ease;
}
.mus-ios-transport button:active { transform: scale(0.88); }

.mus-ios-vol {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.68);
}
.mus-ios-vol input[type="range"] {
  flex: 1;
  accent-color: #FFFFFF;
  cursor: pointer;
}

.mus-ios-foot {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-top: 4px;
}
.mus-ios-foot button {
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.85);
  height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.mus-ios-foot button.on {
  background: rgba(255, 255, 255, 0.92);
  color: #14151C;
}

/* ============================================================================
   4. ANDROID 16 YT MUSIC DARK MATERIAL 3 ADAPTATION
   ============================================================================ */
.and-music-app {
  background: #0F0F13 !important;
  color: #F4F4F6 !important;
}
.and-music-app .m3-topbar {
  background: #0F0F13 !important;
  color: #F4F4F6 !important;
  padding-top: var(--sys-top, 36px);
  height: calc(56px + var(--sys-top, 36px)) !important;
  box-sizing: border-box;
}
.and-music-app .m3-navbar {
  background: #18181F !important;
  color: #E4E4EA !important;
}
.and-music-app .m3-nav-item { color: rgba(255, 255, 255, 0.72) !important; }
.and-music-app .m3-nav-item.active { color: #FFFFFF !important; }
.and-music-app .m3-nav-item.active .m3-nav-pill {
  background: rgba(255, 0, 51, 0.28) !important;
  color: #FF4D6A !important;
}
.and-music-app .m3-miniplayer {
  background: #20202A !important;
  color: #FFFFFF !important;
}
.and-music-app .m3-mini-sub { color: rgba(255, 255, 255, 0.65) !important; }
.and-music-app .mus-station-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
