/* Toolbar music player — index.html only */

.mp-root {
  position: relative;
  flex: 0 1 clamp(200px, 22vw, 360px);
  min-width: 32px;
  height: 34px;
  margin: 0 6px;
  border-radius:var(--cg-radius);
  background: var(--ui-addr-bg);
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  overflow: visible;
  pointer-events: auto;
  transition:
    min-width 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    max-width 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    flex 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    padding 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    border-radius 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    border-color 0.2s ease,
    box-shadow 0.3s ease;
}

.mp-root:hover {
  border-color: rgba(255, 255, 255, 0.26);
}

.mp-root.is-open {
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

/* ── Collapsed (idle) ── */
.mp-root.is-minimized:not(:hover):not(:focus-within):not(.is-open) {
  flex: 0 0 32px;
  min-width: 32px;
  max-width: 32px;
  padding: 0;
  border-radius:calc(var(--cg-radius) * 2);
}

.mp-root.is-minimized:not(:hover):not(:focus-within):not(.is-open) .mp-chip-meta,
.mp-root.is-minimized:not(:hover):not(:focus-within):not(.is-open) .mp-chip-transport,
.mp-root.is-minimized:not(:hover):not(:focus-within):not(.is-open) .mp-chip-wave,
.mp-root.is-minimized:not(:hover):not(:focus-within):not(.is-open) .mp-chip-seek {
  opacity: 0;
  width: 0;
  flex: 0 0 0;
  margin: 0;
  padding: 0;
  pointer-events: none;
  overflow: hidden;
}

.mp-root.is-minimized:not(:hover):not(:focus-within):not(.is-open) .mp-chip {
  padding: 0;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.mp-root.is-minimized:not(:hover):not(:focus-within):not(.is-open) .mp-chip-body {
  justify-content: center;
  flex: 0 0 auto;
  width: 100%;
  height: 100%;
}

/* ── Toolbar chip ── */
.mp-chip {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 4px 0 5px;
}

.mp-chip-body {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: transparent;
  color: inherit;
  padding: 0;
  cursor: pointer;
  text-align: left;
  outline: none;
}

.mp-chip-body:focus-visible {
  border-radius:var(--cg-radius);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.mp-chip-meta,
.mp-chip-transport,
.mp-chip-seek,
.mp-chip-wave {
  transition: opacity 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), width 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), flex 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), margin 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), padding 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Artwork */
.mp-art {
  position: relative;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.mp-art-img {
  width: 24px;
  height: 24px;
  border-radius:calc(var(--cg-radius) * 2);
  object-fit: cover;
  display: none;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.mp-art-img:not([hidden]) {
  display: block;
}

.mp-art-fallback {
  width: 24px;
  height: 24px;
  border-radius:calc(var(--cg-radius) * 2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.07);
}

.mp-art-fallback[hidden] {
  display: none;
}

.mp-root.is-minimized:not(:hover):not(:focus-within) .mp-art-img,
.mp-root.is-minimized:not(:hover):not(:focus-within) .mp-art-fallback {
  border-radius:calc(var(--cg-radius) * 2);
  width: 24px;
  height: 24px;
}

.mp-root.is-minimized:not(:hover):not(:focus-within):not(.is-open) .mp-art {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.mp-art-ring {
  position: absolute;
  inset: -2px;
  border-radius:calc(var(--cg-radius) * 2);
  border: 2px solid transparent;
  pointer-events: none;
  transition: border-color 0.2s ease;
}

.mp-root.has-track:not(.is-playing) .mp-art-ring {
  border-color: rgba(255, 255, 255, 0.22);
}

.mp-root.is-playing .mp-art-ring {
  border-color: rgba(255, 255, 255, 0.45);
  animation: mp-ring-pulse 2s ease-in-out infinite;
}

@keyframes mp-ring-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* Meta text */
.mp-chip-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.15;
}

.mp-chip-title-wrap {
  overflow: hidden;
  white-space: nowrap;
}

.mp-chip-title {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ui-text);
  letter-spacing: 0.02em;
}

.mp-chip-title.is-scrolling {
  display: inline-flex;
  gap: 24px;
  animation: mp-title-scroll var(--mp-scroll-dur, 12s) linear infinite;
}

@keyframes mp-title-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.mp-chip-artist {
  font-size: 10px;
  color: var(--ui-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Waveform indicator */
.mp-chip-wave {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
  flex: 0 0 auto;
  padding-right: 2px;
}

.mp-root.is-playing .mp-chip-wave {
  display: flex;
}

.mp-chip-wave span {
  display: block;
  width: 2px;
  border-radius:var(--cg-radius);
  background: rgba(255, 255, 255, 0.75);
  animation: mp-wave 0.9s ease-in-out infinite;
}

.mp-chip-wave span:nth-child(1) { height: 6px; animation-delay: 0s; }
.mp-chip-wave span:nth-child(2) { height: 11px; animation-delay: 0.15s; }
.mp-chip-wave span:nth-child(3) { height: 8px; animation-delay: 0.3s; }
.mp-chip-wave span:nth-child(4) { height: 13px; animation-delay: 0.45s; }

@keyframes mp-wave {
  0%, 100% { transform: scaleY(0.45); opacity: 0.45; }
  50% { transform: scaleY(1); opacity: 1; }
}

/* Chip transport */
.mp-chip-transport {
  display: flex;
  align-items: center;
  gap: 1px;
  flex: 0 0 auto;
  padding-right: 4px;
}

.mp-btn {
  width: 24px;
  height: 24px;
  border: none;
  border-radius:calc(var(--cg-radius) * 2);
  background: transparent;
  color: var(--ui-text-sub);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: background 0.14s ease, color 0.14s ease, transform 0.12s ease;
}

.mp-btn:hover {
  background: var(--ui-hover);
  color: var(--ui-text);
}

.mp-btn:active {
  transform: scale(0.9);
}

.mp-btn-play {
  width: 26px;
  height: 26px;
  font-size: 12px;
  color: var(--ui-text);
  background: rgba(255, 255, 255, 0.1);
}

.mp-btn-play:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* Chip seek bar */
.mp-chip-seek {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
  border-radius:var(--cg-radius);
  overflow: hidden;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
}

.mp-root.is-playing .mp-chip-seek {
  opacity: 1;
  pointer-events: auto;
}

.mp-chip-seek-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.55), #fff);
  border-radius:inherit;
  transition: width 0.1s linear;
  pointer-events: none;
}

/* ── Dropdown panel ── */
.mp-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 340;
  width: min(380px, calc(100vw - 24px));
  max-height: min(78vh, 640px);
  display: flex;
  flex-direction: column;
  border-radius:calc(var(--cg-radius) * 5 / 4);
  background: rgba(28, 28, 30, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 28px 60px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  overflow: hidden;
}

.mp-panel[hidden] {
  display: none !important;
}

.mp-panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 12px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.mp-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius:calc(var(--cg-radius) * 5 / 8);
  background: rgba(255, 255, 255, 0.05);
}

.mp-tab {
  border: none;
  border-radius:calc(var(--cg-radius) * 1 / 2);
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  color: var(--ui-text-muted);
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.mp-tab:hover {
  color: var(--ui-text-sub);
}

.mp-tab.is-active {
  color: var(--ui-text);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.mp-icon-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius:calc(var(--cg-radius) * 1 / 2);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ui-text-sub);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex: 0 0 auto;
  transition: background 0.14s ease, color 0.14s ease;
}

.mp-icon-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: var(--ui-text);
}

/* Panel views */
.mp-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px 16px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

.mp-view[hidden] {
  display: none !important;
}

/* Player view */
.mp-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.mp-hero-art {
  position: relative;
  width: min(200px, 56vw);
  aspect-ratio: 1;
  border-radius:calc(var(--cg-radius) * 2);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  box-shadow:
    0 20px 48px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.mp-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.mp-hero-img:not([hidden]) {
  display: block;
}

.mp-hero-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: rgba(255, 255, 255, 0.25);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
}

.mp-hero-fallback[hidden] {
  display: none;
}

.mp-hero-info {
  width: 100%;
  min-width: 0;
}

.mp-hero-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ui-text);
  line-height: 1.25;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-hero-artist {
  font-size: 12px;
  color: var(--ui-text-muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-panel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.mp-panel-controls .mp-btn {
  width: 36px;
  height: 36px;
  font-size: 14px;
}

.mp-panel-controls .mp-btn-play {
  width: 48px;
  height: 48px;
  font-size: 18px;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.mp-seek {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mp-seek-time {
  font-size: 10px;
  color: var(--ui-text-muted);
  font-variant-numeric: tabular-nums;
  flex: 0 0 32px;
  text-align: center;
}

.mp-seek-bar {
  flex: 1;
  height: 4px;
  border-radius:var(--cg-radius);
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  overflow: hidden;
}

.mp-seek-fill {
  height: 100%;
  width: 0%;
  background: #fff;
  border-radius:inherit;
  transition: width 0.1s linear;
}

.mp-lyrics {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 12px;
  border-radius:calc(var(--cg-radius) * 7 / 8);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  min-height: 72px;
  justify-content: center;
}

.mp-root.is-playing .mp-lyrics.has-lines {
  display: flex;
}

.mp-lyric-line {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  line-height: 1.4;
  max-height: 40px;
  overflow: hidden;
}

.mp-lyric-line.is-new {
  animation: mp-lyric-pop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes mp-lyric-pop {
  from { transform: scale(0.96); opacity: 0.6; }
  to { transform: scale(1); opacity: 1; }
}

.mp-lyric-next {
  font-size: 11px;
  color: var(--ui-text-muted);
  text-align: center;
  opacity: 0.75;
}

.mp-volume {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 2px;
}

.mp-volume i {
  font-size: 11px;
  color: var(--ui-text-muted);
  width: 14px;
  text-align: center;
  flex: 0 0 auto;
}

.mp-volume input[type="range"] {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius:var(--cg-radius);
  outline: none;
  cursor: pointer;
}

.mp-volume input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius:calc(var(--cg-radius) * 2);
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.mp-volume input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: none;
  border-radius:calc(var(--cg-radius) * 2);
  background: #fff;
}

/* Search view */
.mp-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 36px;
  border-radius:calc(var(--cg-radius) * 3 / 4);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.mp-search-box:focus-within {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
}

.mp-search-box i {
  font-size: 12px;
  color: var(--ui-text-muted);
  flex: 0 0 auto;
}

.mp-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--ui-text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.mp-search-input::placeholder {
  color: var(--ui-text-dim);
}

.mp-search-status {
  font-size: 11px;
  color: var(--ui-text-muted);
  padding: 0 2px;
  min-height: 16px;
}

.mp-search-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: auto;
  flex: 1;
  min-height: 120px;
  max-height: 320px;
  padding-right: 2px;
}

.mp-search-results::-webkit-scrollbar {
  width: 5px;
}

.mp-search-results::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius:var(--cg-radius);
}

.mp-result {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius:calc(var(--cg-radius) * 3 / 4);
  background: transparent;
  color: var(--ui-text-sub);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.14s ease, color 0.14s ease, transform 0.12s ease;
}

.mp-result:hover {
  background: var(--ui-hover-2);
  color: var(--ui-text);
}

.mp-result:active {
  transform: scale(0.99);
}

.mp-result.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ui-text);
}

.mp-result-art {
  width: 40px;
  height: 40px;
  border-radius:calc(var(--cg-radius) * 1 / 2);
  object-fit: cover;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.06);
}

.mp-result-art-fallback {
  width: 40px;
  height: 40px;
  border-radius:calc(var(--cg-radius) * 1 / 2);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.06);
}

.mp-result-copy {
  flex: 1;
  min-width: 0;
}

.mp-result-title {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-result-meta {
  font-size: 10px;
  color: var(--ui-text-muted);
  line-height: 1.25;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--ui-text-muted);
  font-size: 12px;
  line-height: 1.45;
}

/* Skeleton Loaders for Music Search */
.mp-skeleton-result {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: calc(var(--cg-radius) * 3 / 4);
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.mp-skeleton-art {
  width: 40px;
  height: 40px;
  border-radius: calc(var(--cg-radius) * 1 / 2);
  flex: 0 0 auto;
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.09) 50%, rgba(255,255,255,0.04) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.mp-skeleton-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mp-skeleton-title {
  height: 12px;
  width: 70%;
  background: linear-gradient(90deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.08) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 2px;
}

.mp-skeleton-meta {
  height: 10px;
  width: 50%;
  background: linear-gradient(90deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.12) 50%, rgba(255,255,255,0.06) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 2px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Empty player state */
.mp-root:not(.has-track) .mp-view-player .mp-hero-art {
  width: 120px;
}

.mp-root:not(.has-track) .mp-panel-controls,
.mp-root:not(.has-track) .mp-seek,
.mp-root:not(.has-track) .mp-lyrics,
.mp-root:not(.has-track) .mp-volume {
  display: none;
}

.mp-root:not(.has-track) .mp-view-player {
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 100px;
}

.mp-root:not(.has-track) .mp-hero-info .mp-hero-title {
  font-size: 14px;
}

.mp-root:not(.has-track) .mp-hero-info .mp-hero-artist {
  font-size: 11px;
}
