html, body {
  margin: 0;
  height: 100dvh;
  overflow: hidden;
  background: #e8e2d2;
  touch-action: manipulation;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  filter: saturate(1.22) contrast(1.04);
}

#ui {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  font: 400 13px/1.25 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  max-width: calc(100vw - 20px);
  box-sizing: border-box;
}

#ui button {
  box-sizing: border-box;
  width: 148px;
  margin: 0;
  padding: 9px 11px;
  border: 1px solid rgba(245, 240, 226, .22);
  border-radius: 7px;
  background: rgba(25, 23, 20, .62);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 4px 14px rgba(28, 24, 18, .12);
  color: rgba(248, 244, 233, .84);
  text-align: left;
  font: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: border-color .14s, color .14s, background-color .14s;
}

#ui button[hidden] { display: none; }

.ui-top-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

#modes {
  display: flex;
  gap: 2px;
  padding: 2px;
  border-radius: 9px;
  background: rgba(25, 23, 20, .5);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(245, 240, 226, .18);
}
#modes button {
  width: auto;
  flex: 1;
  border: none;
  border-radius: 6px;
  background: transparent;
  text-align: center;
  padding: 8px 12px;
}
#modes button[aria-pressed="true"] {
  background: rgba(248, 244, 233, .18);
  color: #fffdf5;
}

/* --- Small Circle Actions Button (···) that grows into a big menu --- */
.ui-actions-group {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.actions-circle-btn {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  border-radius: 50% !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(25, 23, 20, .62) !important;
  border: 1px solid rgba(245, 240, 226, .22) !important;
  color: rgba(248, 244, 233, .84) !important;
  box-shadow: 0 4px 14px rgba(28, 24, 18, .12) !important;
  cursor: pointer;
  transition:
    transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    background-color 0.14s ease,
    border-color 0.14s ease !important;
}

.actions-circle-btn:hover {
  transform: scale(1.08);
  background: rgba(35, 32, 28, .88) !important;
  border-color: rgba(248, 244, 233, .5) !important;
  color: #fffdf5 !important;
}

.ui-actions-group.open .actions-circle-btn {
  background: rgba(248, 244, 233, .22) !important;
  border-color: rgba(248, 244, 233, .6) !important;
  color: #fffdf5 !important;
  transform: scale(0.94);
}

.ui-actions-drawer {
  position: absolute;
  top: 44px;
  right: 0;
  width: 176px;
  background: rgba(22, 20, 18, 0.88);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  backdrop-filter: blur(28px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55), 0 1px 0 rgba(255, 255, 255, 0.15) inset;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transform-origin: top right;
  transform: scale(0.75) translateY(-8px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.18s ease,
    visibility 0.22s;
  z-index: 110;
}

.ui-actions-group.open .ui-actions-drawer {
  transform: scale(1) translateY(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.actions-drawer-header {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  padding: 6px 10px 4px;
}

.menu-action-btn {
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 9px 12px !important;
  border: none !important;
  border-radius: 10px !important;
  background: transparent !important;
  color: rgba(255, 255, 255, 0.88) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  text-align: left !important;
  box-shadow: none !important;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease !important;
}

.menu-action-btn:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #fff !important;
}

/* --- Rain Control & Prominent Overflow Volume Bar --- */
.rain-control-group {
  display: flex;
  align-items: center;
  gap: 0;
  width: auto;
  align-self: flex-end;
}

.rain-control-group #bRain {
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
  justify-content: flex-start;
  width: auto;
  box-sizing: border-box;
}
.rain-control-group #bRain svg {
  flex-shrink: 0;
  stroke: rgba(248, 244, 233, .75);
  transition: transform 0.2s ease, stroke 0.2s ease;
}
.rain-control-group #bRain[aria-pressed="true"] {
  background: rgba(45, 90, 140, 0.75);
  border-color: rgba(140, 200, 255, 0.6);
  color: #dbf0ff;
  box-shadow: 0 0 16px rgba(90, 170, 255, 0.3), 0 4px 14px rgba(28, 24, 18, .18);
}
.rain-control-group #bRain[aria-pressed="true"] svg {
  stroke: #7ec4ff;
  transform: translateY(1px);
}

/* Big Accessible Overflow Volume Bar */
.rain-vol-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  max-width: 0;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  padding: 0;
  margin-left: 0;
  box-sizing: border-box;
  border: 0 solid transparent;
  border-radius: 8px;
  background: rgba(20, 24, 32, 0.85);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  transition:
    max-width 0.28s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.22s ease,
    padding 0.28s ease,
    margin 0.28s ease,
    border 0.2s ease;
}

/* When Rain is ON: Volume bar is prominently open & accessible */
.rain-control-group:has(#bRain[aria-pressed="true"]) .rain-vol-wrap,
.rain-vol-wrap.active {
  max-width: 175px;
  opacity: 1;
  pointer-events: auto;
  padding: 0 10px;
  margin-left: 6px;
  border: 1px solid rgba(120, 190, 255, 0.45);
}

.rain-vol-slider-box {
  position: relative;
  width: 90px;
  height: 20px;
  display: flex;
  align-items: center;
}

.rain-vol-track {
  width: 100%;
  height: 6px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.16);
  position: relative;
  overflow: hidden;
}

.rain-vol-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: #7ec4ff;
  border-radius: 9999px;
  pointer-events: none;
  transition: width 0.04s ease;
}

.rain-vol-range {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.rain-vol-label {
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #cce7ff;
  min-width: 28px;
  text-align: right;
  user-select: none;
}

#ui button:focus-visible {
  outline: 2px solid rgba(248, 244, 233, .9);
  outline-offset: 2px;
}

@media (hover: hover) {
  #ui button:hover {
    border-color: rgba(248, 244, 233, .5);
    background: rgba(25, 23, 20, .84);
    color: #fffdf5;
  }
}

@media (max-width: 780px) {
  #ui { top: 12px; right: 12px; max-width: calc(100vw - 20px); }
  #modes button { padding: 7px 10px; font-size: 12px; }
}

@media (max-width: 480px) {
  #ui { top: 8px; right: 8px; gap: 4px; max-width: calc(100vw - 16px); }
  #modes button { padding: 6px 7px; font-size: 11px; }
  .actions-circle-btn { width: 32px !important; height: 32px !important; min-width: 32px !important; }
  .rain-control-group #bRain { height: 32px; padding: 0 10px; font-size: 12px; }
  .rain-vol-wrap { height: 32px; }
  .rain-control-group:has(#bRain[aria-pressed="true"]) .rain-vol-wrap,
  .rain-vol-wrap.active { max-width: 135px; padding: 0 7px; margin-left: 4px; }
  .rain-vol-slider-box { width: 66px; }
  .rain-vol-label { font-size: 10px; min-width: 24px; }
  .apple-glass-capsule { bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  #ui button { transition: none; }
  .cd-disc { animation: none !important; }
}

/* ==========================================================================
   Apple-esque Glassmorphism Music Player
   ========================================================================== */

#yt-player-hidden {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 200px;
  height: 200px;
  opacity: 0.001;
  pointer-events: none;
  overflow: hidden;
  z-index: -1;
}

#yt-player-hidden iframe {
  width: 200px !important;
  height: 200px !important;
  border: none;
}

.apple-glass-capsule {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px 8px 10px;
  width: calc(100vw - 36px);
  max-width: 620px;
  min-width: 310px;
  box-sizing: border-box;
  border-radius: 9999px;
  background: rgba(22, 20, 18, 0.76);
  -webkit-backdrop-filter: blur(24px) saturate(190%);
  backdrop-filter: blur(24px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow:
    0 16px 36px rgba(0, 0, 0, 0.4),
    0 2px 8px rgba(0, 0, 0, 0.2),
    0 1px 0 rgba(255, 255, 255, 0.18) inset,
    0 -1px 0 rgba(0, 0, 0, 0.35) inset;
  color: #fffdf8;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  transition:
    width 0.28s cubic-bezier(0.16, 1, 0.3, 1),
    max-width 0.28s cubic-bezier(0.16, 1, 0.3, 1),
    min-width 0.28s cubic-bezier(0.16, 1, 0.3, 1),
    height 0.28s cubic-bezier(0.16, 1, 0.3, 1),
    padding 0.28s cubic-bezier(0.16, 1, 0.3, 1),
    border-radius 0.28s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.2s ease;
}

/* --- Collapsed Mode: Sleek Floating Squared Song Art Tile --- */
.apple-glass-capsule.collapsed {
  width: 52px;
  height: 52px;
  min-width: 52px;
  max-width: 52px;
  padding: 3px;
  border-radius: 14px;
  gap: 0;
  overflow: hidden;
  cursor: pointer;
  background: rgba(20, 18, 16, 0.88);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.22);
}

.apple-glass-capsule.collapsed:hover {
  transform: translateX(-50%) scale(1.08);
  box-shadow:
    0 14px 36px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(255, 255, 255, 0.4);
}

.apple-glass-capsule.collapsed .cd-section {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.apple-glass-capsule.collapsed .cd-disc {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  animation: none !important;
  transform: none !important;
  box-shadow: none;
  background: none;
}

.apple-glass-capsule.collapsed .cd-artwork-mask {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15) inset;
}

.apple-glass-capsule.collapsed .cd-thumb-img {
  border-radius: 10px;
}

.apple-glass-capsule.collapsed .cd-grooves,
.apple-glass-capsule.collapsed .cd-center-hole,
.apple-glass-capsule.collapsed .cd-sheen,
.apple-glass-capsule.collapsed .player-main,
.apple-glass-capsule.collapsed .player-controls {
  display: none !important;
}

.mini-expand-hint {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  border-radius: 10px;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  color: #ffffff;
  transition: opacity 0.16s ease;
}

.apple-glass-capsule.collapsed .mini-expand-hint {
  display: flex;
}

.apple-glass-capsule.collapsed:hover .mini-expand-hint {
  opacity: 1;
}

/* --- Left: Spinning CD / Vinyl Artwork --- */
.cd-section {
  flex-shrink: 0;
  position: relative;
}

.cd-disc {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  position: relative;
  cursor: pointer;
  background: radial-gradient(
    circle at 50% 50%,
    #111111 0%,
    #191919 40%,
    #2c2c2c 44%,
    #181818 48%,
    #2a2a2a 72%,
    #121212 100%
  );
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.15),
    0 0 0 2px rgba(0, 0, 0, 0.6);
  animation: cd-spin 10s linear infinite;
  animation-play-state: paused;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.18s ease;
}

.cd-disc:hover {
  transform: scale(1.05);
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.28);
}

.cd-disc:active {
  transform: scale(0.96);
}

.cd-disc.playing {
  animation-play-state: running;
}

.cd-disc.paused {
  animation-play-state: paused;
}

@keyframes cd-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.cd-grooves {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-radial-gradient(
    circle at 50% 50%,
    transparent 0,
    transparent 2px,
    rgba(255, 255, 255, 0.03) 3px,
    transparent 4px
  );
  pointer-events: none;
}

.cd-artwork-mask {
  position: absolute;
  top: 18%;
  left: 18%;
  width: 64%;
  height: 64%;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 0 0 2px rgba(255, 255, 255, 0.12);
  background: #201e1c;
}

.cd-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cd-center-hole {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 15%;
  height: 15%;
  border-radius: 50%;
  background: #111;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.9) inset;
  z-index: 2;
}

.cd-sheen {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    from 40deg,
    rgba(255, 255, 255, 0.18) 0deg,
    transparent 45deg,
    rgba(255, 255, 255, 0.18) 90deg,
    transparent 135deg,
    rgba(255, 255, 255, 0.18) 180deg,
    transparent 225deg,
    rgba(255, 255, 255, 0.18) 270deg,
    transparent 315deg,
    rgba(255, 255, 255, 0.18) 360deg
  );
  mix-blend-mode: overlay;
  pointer-events: none;
}

/* --- Center: Track info & Seek Bar --- */
.player-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}

.track-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.track-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.track-title {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.track-artist {
  font-size: 11px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.62);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.track-count {
  font-size: 10px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.1);
  padding: 1px 6px;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.seek-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.time-label {
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.52);
  min-width: 25px;
  text-align: center;
  line-height: 1;
}

.seek-track-container {
  flex: 1;
  height: 4px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.14);
  position: relative;
  cursor: pointer;
  transition: height 0.15s ease;
}

.seek-track-container:hover {
  height: 6px;
}

.seek-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: #ffffff;
  border-radius: 9999px;
  pointer-events: none;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

.custom-range {
  position: absolute;
  inset: -6px 0;
  width: 100%;
  height: calc(100% + 12px);
  margin: 0;
  opacity: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  z-index: 3;
}

/* --- Right: Controls --- */
.player-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.glass-icon-btn {
  background: transparent;
  border: none;
  padding: 6px;
  color: rgba(255, 255, 255, 0.78);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.14s ease, background-color 0.14s ease, transform 0.14s ease;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.glass-icon-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.08);
}

.glass-icon-btn:active {
  transform: scale(0.92);
}

.glass-icon-btn.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.22);
}

#btn-infinity.active {
  color: #ff9ee2;
  background: rgba(255, 120, 200, 0.22);
  box-shadow: 0 0 12px rgba(255, 120, 200, 0.35);
}
#btn-infinity.active svg {
  stroke: #ff9ee2;
}

.glass-play-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #ffffff;
  color: #121110;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  transition: transform 0.14s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.14s ease;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.glass-play-btn:hover {
  transform: scale(1.07);
  background: #f4f2eb;
}

.glass-play-btn:active {
  transform: scale(0.93);
}

.volume-container {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 2px;
}

.volume-track-container {
  width: 50px;
  height: 4px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.14);
  position: relative;
  cursor: pointer;
  transition: height 0.15s ease;
}

.volume-track-container:hover {
  height: 6px;
}

.volume-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 9999px;
  pointer-events: none;
}

/* --- Expandable Playlist Drawer --- */
.apple-glass-panel {
  position: fixed;
  bottom: 86px;
  left: 50%;
  transform: translateX(-50%) translateY(14px);
  z-index: 101;
  width: calc(100vw - 36px);
  max-width: 450px;
  max-height: 400px;
  background: rgba(22, 20, 18, 0.84);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  backdrop-filter: blur(28px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  box-shadow:
    0 20px 48px rgba(0, 0, 0, 0.5),
    0 1px 0 rgba(255, 255, 255, 0.18) inset;
  color: #fff;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0.22s;
}

.player-notice {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 102;
  background: rgba(32, 28, 22, 0.92);
  -webkit-backdrop-filter: blur(24px) saturate(190%);
  backdrop-filter: blur(24px) saturate(190%);
  border: 1px solid rgba(245, 180, 80, 0.4);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), 0 1px 0 rgba(255, 255, 255, 0.15) inset;
  color: #fffaf0;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 12px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 40px);
  box-sizing: border-box;
  animation: notice-fade 0.2s ease;
}

.player-notice a {
  color: #ffd880;
  text-decoration: underline;
  font-weight: 500;
}

@keyframes notice-fade {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.apple-glass-panel.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.playlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.playlist-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.playlist-header-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #fff;
}

.playlist-header-badge {
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.7);
}

.playlist-search-wrap {
  position: relative;
  padding: 8px 12px 6px;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 20px;
  color: rgba(255, 255, 255, 0.4);
  pointer-events: none;
}

#playlist-search {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 10px 6px 28px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.14s ease, background 0.14s ease;
}

#playlist-search:focus {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.4);
}

#playlist-search::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.playlist-list-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 4px 6px 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.playlist-list-scroll::-webkit-scrollbar {
  width: 4px;
}

.playlist-list-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.playlist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.14s ease;
  user-select: none;
}

.playlist-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.playlist-item.active {
  background: rgba(255, 255, 255, 0.14);
}

.playlist-item-num {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  width: 16px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.playlist-item-thumb-box {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: #191715;
}

.playlist-item-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.playlist-item-eq {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.playlist-item.active.playing .playlist-item-eq {
  display: flex;
}

.playlist-item-eq span {
  width: 2px;
  height: 10px;
  background: #fff;
  border-radius: 1px;
  animation: eq-bounce 0.8s ease-in-out infinite alternate;
}
.playlist-item-eq span:nth-child(2) { animation-delay: 0.2s; height: 14px; }
.playlist-item-eq span:nth-child(3) { animation-delay: 0.4s; height: 8px; }

@keyframes eq-bounce {
  from { transform: scaleY(0.3); }
  to { transform: scaleY(1); }
}

.playlist-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.playlist-item-title {
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-item.active .playlist-item-title {
  color: #fffdf5;
  font-weight: 600;
}

.playlist-item-artist {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-item-dur {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.45);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.playlist-mix-banner {
  margin: 6px 12px 2px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 120, 200, 0.12);
  border: 1px solid rgba(255, 120, 200, 0.3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mix-banner-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mix-banner-badge {
  font-size: 11px;
  font-weight: 600;
  color: #ffbcee;
}

.mix-banner-seed {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mix-return-btn {
  padding: 5px 9px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.14s ease;
}

.mix-return-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.item-mix-btn {
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.7);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.14s ease, background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
  flex-shrink: 0;
}

.playlist-item:hover .item-mix-btn {
  opacity: 1;
}

.item-mix-btn:hover {
  background: rgba(255, 120, 200, 0.25);
  border-color: rgba(255, 120, 200, 0.5);
  color: #ffd2f2;
  opacity: 1;
}

/* --- Minimalist Pencil Signature Badge (Bottom Right) --- */
.author-badge {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 8px;
  border-radius: 9999px;
  background: rgba(22, 20, 18, 0.55);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 253, 245, 0.78);
  text-decoration: none;
  font-family: 'Caveat', 'Segoe Script', 'Nanum Pen Script', 'Bradley Hand', cursive, -apple-system, sans-serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.3px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.2s ease;
}

.author-badge:hover {
  background: rgba(22, 20, 18, 0.85);
  border-color: rgba(255, 255, 255, 0.32);
  color: #fffdf5;
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.author-badge:active {
  transform: translateY(0) scale(0.96);
}

.author-pencil-icon {
  opacity: 0.72;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease;
}

.author-badge:hover .author-pencil-icon {
  opacity: 1;
  transform: rotate(-15deg) scale(1.15);
  color: #ffd88a;
}

.author-name {
  position: relative;
  top: -0.5px;
}

/* --- Responsive Layout Adjustments --- */
@media (max-width: 600px) {
  .apple-glass-capsule {
    bottom: 14px;
    padding: 7px 10px 7px 8px;
    gap: 10px;
    width: calc(100vw - 20px);
  }
  .cd-disc {
    width: 42px;
    height: 42px;
  }
  .volume-container {
    display: none;
  }
  .opt-btn {
    display: none;
  }
  .apple-glass-panel {
    bottom: 74px;
    width: calc(100vw - 20px);
    max-height: 340px;
  }
  .author-badge {
    bottom: 82px;
    right: 14px;
    font-size: 15px;
    padding: 3px 9px 3px 7px;
    background: rgba(22, 20, 18, 0.68);
  }
}

