/* Bottom-right floating trigger + mini-player shell */
.music-fab-wrap {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 25;
  pointer-events: auto;
}

/* Solid glass at rest; on hover, translucent (see-through) with stronger blur — matches prior music FAB */
.music-fab {
  position: relative;
  z-index: 3; /* stay above the panel so ♫ always receives clicks to toggle */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 999px;
  border: 2px solid rgba(194, 178, 140, .4);
  background:
    radial-gradient(120px circle at 50% 42%, rgba(255, 255, 255, .4), rgba(245, 240, 230, .15) 70%),
    linear-gradient(135deg, rgba(222, 196, 160, .45) 0%, rgba(194, 178, 140, .35) 100%);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  box-shadow:
    0 10px 24px rgba(0, 0, 0, .25),
    inset 0 0 0 1px rgba(245, 240, 230, .25),
    0 0 20px rgba(194, 178, 140, .2);
  color: #2b2213;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    backdrop-filter 0.2s ease,
    -webkit-backdrop-filter 0.2s ease;
}

.music-fab:hover {
  transform: translateY(-1px);
  background:
    radial-gradient(120px circle at 50% 42%, rgba(255, 255, 255, .16), transparent 70%),
    linear-gradient(135deg, rgba(222, 196, 160, .14) 0%, rgba(194, 178, 140, .09) 100%);
  backdrop-filter: blur(18px) saturate(155%);
  -webkit-backdrop-filter: blur(18px) saturate(155%);
  border-color: rgba(194, 178, 140, .32);
  box-shadow:
    0 10px 24px rgba(0, 0, 0, .14),
    inset 0 0 0 1px rgba(245, 240, 230, .2),
    0 0 20px rgba(194, 178, 140, .12);
}

.music-fab:active {
  transform: translateY(0);
  box-shadow:
    0 8px 20px rgba(0, 0, 0, .25),
    inset 0 0 0 1px rgba(245, 240, 230, .25),
    0 0 20px rgba(194, 178, 140, .2);
  filter: none;
}

.music-fab:focus-visible {
  outline: 3px solid #2b2213;
  outline-offset: 2px;
}

.music-mini-panel {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 70px;
  width: min(360px, 92vw);
  border-radius: 18px;
  padding: 12px;
  border: 2px solid rgba(224,162,51,.85);
  background:
    radial-gradient(160px circle at 35% 15%, rgba(255,255,255,.62), rgba(255,255,255,.16) 72%),
    rgba(255,255,255,.9);
  box-shadow: 0 12px 24px rgba(0,0,0,.25);
  display: grid;
  gap: 10px;
}

/* Author `display: grid` otherwise wins over [hidden] in some browsers */
.music-mini-panel[hidden] {
  display: none !important;
  visibility: hidden;
  pointer-events: none;
}

/* Header row with title and iOS-style BuddyDoro toggle */
.music-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.music-panel-header h3 {
  margin: 0;
  font-size: 18px;
}

.music-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  user-select: none;
  cursor: pointer;
}

.music-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.music-toggle-ui {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  border: 2px solid #d0a14a;
  background: linear-gradient(180deg, #efe4c8 0%, #d8c39a 100%);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, .18);
  position: relative;
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.music-toggle-ui::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff7e3;
  border: 1px solid rgba(125, 92, 38, .45);
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  transition: transform .2s ease;
}

.music-toggle input:checked + .music-toggle-ui {
  border-color: #e0a233;
  background: linear-gradient(180deg, #ffd36b 0%, #f2b942 100%);
  box-shadow: inset 0 1px 2px rgba(255,255,255,.35);
}

.music-toggle input:checked + .music-toggle-ui::after {
  transform: translateX(18px);
}

.music-toggle input:focus-visible + .music-toggle-ui {
  outline: 3px solid rgba(43, 34, 19, .8);
  outline-offset: 2px;
}

.music-toggle-text {
  font-size: 12px;
  min-width: 20px;
}

/* Source selection pills (Default / Spotify placeholder) */
.music-source-row {
  display: flex;
  gap: 8px;
}

.music-source-pill {
  border: 2px solid #e0a233;
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 700;
  background: rgba(255, 235, 160, .45);
  cursor: pointer;
}

.music-source-pill input {
  margin-right: 6px;
}

/* Cassette-style now playing */
.music-player-card.music-cassette {
  position: relative;
  padding: 14px 12px 12px;
  border-radius: 10px;
  border: 1px solid #1a1a1d;
  background:
    linear-gradient(165deg, #4a4a52 0%, #35353a 40%, #2e2e32 100%);
  box-shadow:
    0 4px 0 #1a1a1c,
    0 8px 18px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.music-cassette-screw {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #6a6a72, #2a2a2e 70%);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.25);
  z-index: 2;
}
.music-cassette-screw--tl { top: 6px; left: 8px; }
.music-cassette-screw--tr { top: 6px; right: 8px; }
.music-cassette-screw--bl { bottom: 7px; left: 8px; }
.music-cassette-screw--br { bottom: 7px; right: 8px; }

.music-cassette-inner {
  display: grid;
  gap: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.45);
}

.music-cassette-window {
  display: grid;
  grid-template-columns: 1fr minmax(0, 1.4fr) 1fr;
  align-items: center;
  gap: 8px;
  padding: 12px 10px 10px;
  background:
    linear-gradient(180deg, #0d0d0f 0%, #1a1a1e 100%);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.85);
}

.music-cassette-reel-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  max-width: 56px;
  margin: 0 auto;
  width: 100%;
}

.music-cassette-reel {
  position: relative;
  display: block;
  width: 100%;
  max-width: 52px;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #2a1810 0%, #2a1810 28%, transparent 29%),
    radial-gradient(circle at 50% 50%, #c9a063 0%, #8b6914 45%, #4a3510 100%);
  box-shadow:
    inset 0 0 0 3px #1a0f08,
    inset 0 0 0 5px rgba(201, 160, 99, 0.35),
    0 2px 6px rgba(0, 0, 0, 0.6);
}

.music-cassette-reel::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-conic-gradient(
    from 0deg,
    rgba(0, 0, 0, 0.22) 0deg 4deg,
    transparent 4deg 8deg
  );
  pointer-events: none;
}

.music-cassette[data-playing="true"] .music-cassette-reel {
  animation: music-cassette-spin 2.6s linear infinite;
}

.music-cassette[data-playing="true"] .music-cassette-reel-wrap:last-child .music-cassette-reel {
  animation-direction: reverse;
}

@keyframes music-cassette-spin {
  to {
    transform: rotate(360deg);
  }
}

.music-cassette-label {
  min-width: 0;
  padding: 6px 8px;
  border-radius: 4px;
  background:
    linear-gradient(180deg, #f5e6c8 0%, #e8d4a8 55%, #d4bc88 100%);
  border: 1px solid rgba(60, 40, 20, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 1px 2px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.music-player-title {
  font-size: 13px;
  font-weight: 800;
  color: #1e1810;
  line-height: 1.3;
  letter-spacing: 0.02em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: 'Nunito', ui-sans-serif, system-ui, sans-serif;
}

.music-player-subtitle {
  margin-top: 3px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(40, 30, 20, 0.72);
}

/* Exposed tape / bottom edge */
.music-cassette-teeth {
  height: 10px;
  background:
    repeating-linear-gradient(
      90deg,
      #2a2a2e 0px,
      #2a2a2e 3px,
      #1a1a1e 3px,
      #1a1a1e 5px
    );
  border-top: 1px solid #0a0a0c;
}

/* Progress (default source only) */
.music-progress-section {
  display: grid;
  gap: 6px;
}

.music-progress-section[hidden] {
  display: none !important;
}

.music-progress-track {
  height: 9px;
  border-radius: 3px;
  background: linear-gradient(180deg, #1a1a1e 0%, #0e0e10 100%);
  border: 1px solid rgba(0, 0, 0, 0.4);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  cursor: pointer;
}

.music-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: linear-gradient(90deg, #e8a820, #f5d080);
  box-shadow: 0 0 10px rgba(245, 200, 80, 0.5);
  transition: width 0.12s linear;
  pointer-events: none;
}

.music-progress-times {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: rgba(43, 34, 19, 0.58);
  letter-spacing: 0.04em;
}

@media (prefers-reduced-motion: reduce) {
  .music-cassette[data-playing="true"] .music-cassette-reel {
    animation: none;
  }
}

.music-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.music-control-btn {
  border: 2px solid #e0a233;
  border-radius: 999px;
  padding: 8px 10px;
  font-weight: 800;
  background: rgba(255,255,255,.78);
  color: #2b2213;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.music-control-btn.music-control-round {
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}

.music-control-btn.music-control-main {
  width: 52px;
  height: 52px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.music-control-btn.is-primary {
  background: linear-gradient(#ffd36b, #f2b942);
}

.music-control-btn:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.music-control-btn:not(:disabled):active {
  transform: scale(0.96);
}

/* Horizontal playlist picker (default tracks) */
.music-track-strip {
  display: grid;
  gap: 8px;
}

.music-track-strip-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(43, 34, 19, 0.55);
}

.music-track-strip-tracks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.music-track-pill {
  appearance: none;
  border: 2px solid #e0a233;
  border-radius: 999px;
  padding: 6px 12px;
  max-width: 100%;
  background: rgba(255, 235, 160, 0.42);
  color: #2b2213;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.music-track-pill.is-active {
  background: linear-gradient(#ffd36b, #f2b942);
  border-color: #c98a2e;
}

/* Spotify playlist list below player */
.music-playlist-browse {
  display: grid;
  gap: 6px;
  max-height: 120px;
  overflow-y: auto;
}

.music-playlist-row {
  border: 2px solid #e0a233;
  border-radius: 12px;
  background: rgba(255,235,160,.42);
  color: #2b2213;
  text-align: left;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 10px;
  cursor: pointer;
  font-family: inherit;
}

.music-playlist-row:hover {
  filter: brightness(1.02);
}

.music-empty {
  border: 2px dashed rgba(224,162,51,.8);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  font-weight: 700;
}

/* Spotify Phase 1 placeholder CTA */
.music-spotify-btn {
  border: 2px solid #e0a233;
  border-radius: 999px;
  padding: 8px 12px;
  background: linear-gradient(#ffd36b, #f2b942);
  font-weight: 800;
  cursor: pointer;
}

.music-spotify-hint {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  opacity: .9;
}

/* Ambient sound option cards (icon-first) */
.music-ambient {
  display: grid;
  gap: 8px;
}

.music-ambient-title {
  font-size: 13px;
  font-weight: 800;
}

.music-ambient-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.music-ambient-option {
  border: 2px solid #e0a233;
  border-radius: 12px;
  padding: 8px;
  background: rgba(255,235,160,.42);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  cursor: pointer;
}

.music-ambient-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.music-ambient-option.is-active {
  background: linear-gradient(#ffd36b, #f2b942);
}

.ambient-icon {
  font-size: 16px;
}

.ambient-label {
  font-weight: 800;
  font-size: 12px;
}

@media (max-width: 640px) {
  .music-fab-wrap {
    right: 12px;
    bottom: 12px;
  }
}
