/* =================================================
   AVERY TUNES — full-height player anchored bottom-right
   ================================================= */
.tunes {
  position: fixed;
  right: 8px;
  top: 8px;
  bottom: calc(var(--taskbar-h) + 8px);
  width: 260px;
  background: #001518;
  border: 2px solid var(--primary);
  box-shadow: 6px 6px 0 rgba(0,0,0,0.55);
  z-index: 80;
  display: flex; flex-direction: column;
  color: var(--primary);
  font-family: 'JetBrains Mono', monospace;
  overflow: visible;
}
/* --- collapsed mini bar --- */
.tunes.mini {
  top: auto;
  height: 48px;
  flex-direction: row;
  align-items: center;
  gap: 0;
}
.tunes.mini .tunes-title { display: none; }
.tunes.mini .tunes-now {
  display: flex; flex-direction: row; align-items: center; gap: 0;
  padding: 0; border: 0; flex: 1; min-width: 0;
}
.tunes.mini .tunes-art { width: 44px; height: 44px; font-size: 16px; border-width: 0; border-right: 1.5px solid var(--primary); flex-shrink: 0; }
.tunes.mini .tunes-meta { flex: 1; min-width: 0; padding: 0 10px; }
.tunes.mini .tunes-track { font-size: 11px; }
.tunes.mini .tunes-artist,
.tunes.mini .tunes-tags { display: none; }
.tunes.mini .tunes-scrub { margin-top: 3px; gap: 5px; font-size: 11px; }
.tunes.mini .tunes-bar { height: 4px; }
.tunes.mini .tunes-viz { display: none; }
.tunes.mini .tunes-ctrl {
  display: flex; gap: 0; padding: 0; background: transparent; flex-shrink: 0;
}
.tunes.mini .tunes-ctrl button { display: none; }
.tunes.mini .tunes-ctrl #t-prev,
.tunes.mini .tunes-ctrl button.play,
.tunes.mini .tunes-ctrl #t-next { display: inline-flex; border: 0; padding: 0 8px; font-size: 12px; }
.tunes.mini .tunes-ctrl button.play { font-size: 14px; }
.tunes.mini .tunes-list { display: none; }
/* new music badge */
.tunes-new-badge {
  position: absolute; top: -8px; right: -8px;
  background: var(--hover); color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px; font-weight: 700; letter-spacing: 1px;
  padding: 2px 6px; cursor: pointer; z-index: 5;
  animation: badge-pulse 2s ease-in-out infinite;
}
@keyframes badge-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
/* off state — player fully hidden */
.tunes.off { display: none; }

/* window chrome — title bar right side */
.tunes-chrome {
  display: flex; align-items: center; gap: 3px;
}
.tunes-count-lbl { font-size: 9px; opacity: 0.7; margin-right: 6px; }
.tc-btn {
  width: 17px; height: 17px;
  background: rgba(0,0,0,0.35); color: var(--primary);
  border: 1px solid rgba(255,255,255,0.18);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 11px; font-weight: 700; line-height: 1;
  padding: 0; flex-shrink: 0;
  transition: background 0.1s, color 0.1s;
}
.tc-btn:hover { background: rgba(255,255,255,0.12); color: var(--paper); }
.tc-close:hover { background: var(--hover); color: var(--ink); border-color: var(--hover); }

/* Avery Tunes page link — footer of tall player */
.tunes-page-link {
  display: block; flex-shrink: 0;
  padding: 7px 10px; text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; font-weight: 700; letter-spacing: 1.5px;
  color: var(--primary); text-decoration: none;
  border-top: 1px solid rgba(255,255,255,0.08);
  opacity: 0.6;
  transition: opacity 0.12s, background 0.12s;
}
.tunes-page-link:hover { opacity: 1; background: rgba(255,255,255,0.04); }
.tunes.mini .tunes-page-link { display: none; }

/* Mini expand button — shown only in mini strip */
.tunes-expand {
  display: none;
  align-items: center; justify-content: center;
  background: transparent; border: 0; border-left: 1.5px solid var(--primary);
  color: var(--primary); padding: 0 10px;
  font-size: 15px; cursor: pointer; height: 100%; flex-shrink: 0;
  transition: background 0.12s;
}
.tunes.mini .tunes-expand { display: inline-flex; }
.tunes-expand:hover { background: var(--primary); color: var(--ink); }

/* Mini close button — shown only in mini strip */
.tunes-mini-close {
  display: none;
  align-items: center; justify-content: center;
  background: transparent; border: 0; border-left: 1.5px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.5); padding: 0 9px;
  font-size: 13px; cursor: pointer; height: 100%; flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}
.tunes.mini .tunes-mini-close { display: inline-flex; }
.tunes-mini-close:hover { background: var(--hover); color: var(--ink); border-color: var(--hover); }
/* Skins */
body[data-tunes-skin="classic"] .tunes { background: #0a0a0a; border-color: #5cb85c; color: #5cb85c; }
body[data-tunes-skin="classic"] .tunes-title { background: #5cb85c; color: #0a0a0a; }
body[data-tunes-skin="classic"] .tunes-track,
body[data-tunes-skin="classic"] .tunes-viz .bar,
body[data-tunes-skin="classic"] .tunes-ctrl button { color: #5cb85c; border-color: #5cb85c; }
body[data-tunes-skin="classic"] .tunes-viz .bar { background: #5cb85c; box-shadow: 0 0 4px #5cb85c; }
body[data-tunes-skin="classic"] .tunes-ctrl button.play { background: #5cb85c; color: #0a0a0a; }
body[data-tunes-skin="vapor"] .tunes { background: #1a0a30; border-color: #FF2E7E; color: #FF2E7E; }
body[data-tunes-skin="vapor"] .tunes-title { background: #FF2E7E; color: var(--ink); }
body[data-tunes-skin="vapor"] .tunes-track,
body[data-tunes-skin="vapor"] .tunes-ctrl button { color: #FF2E7E; border-color: #FF2E7E; }
body[data-tunes-skin="vapor"] .tunes-viz .bar { background: #FF2E7E; box-shadow: 0 0 6px #FF2E7E; }
body[data-tunes-skin="vapor"] .tunes-ctrl button.play { background: #FF2E7E; color: var(--ink); }
/* Game Boy — olive LCD */
body[data-tunes-skin="gameboy"] .tunes { background: #2f3923; border-color: #8bac0f; color: #9bbc0f; }
body[data-tunes-skin="gameboy"] .tunes-title { background: #9bbc0f; color: #0f380f; }
body[data-tunes-skin="gameboy"] .tunes-track,
body[data-tunes-skin="gameboy"] .tunes-ctrl button { color: #9bbc0f; border-color: #8bac0f; }
body[data-tunes-skin="gameboy"] .tunes-viz .bar { background: #9bbc0f; box-shadow: 0 0 4px #9bbc0f; }
body[data-tunes-skin="gameboy"] .tunes-ctrl button.play { background: #9bbc0f; color: #0f380f; }
/* Cassette — warm brown/cream */
body[data-tunes-skin="cassette"] .tunes { background: #3b2a1a; border-color: #c69c6d; color: #e8d4b8; }
body[data-tunes-skin="cassette"] .tunes-title { background: #c69c6d; color: #2a1a0a; }
body[data-tunes-skin="cassette"] .tunes-track,
body[data-tunes-skin="cassette"] .tunes-ctrl button { color: #e8d4b8; border-color: #c69c6d; }
body[data-tunes-skin="cassette"] .tunes-viz .bar { background: #c69c6d; box-shadow: 0 0 4px #c69c6d; }
body[data-tunes-skin="cassette"] .tunes-ctrl button.play { background: #c69c6d; color: #2a1a0a; }
/* Brutalist B&W */
body[data-tunes-skin="mono"] .tunes { background: #0a0a0a; border-color: #F2F2EC; color: #F2F2EC; }
body[data-tunes-skin="mono"] .tunes-title { background: #F2F2EC; color: #0a0a0a; }
body[data-tunes-skin="mono"] .tunes-track,
body[data-tunes-skin="mono"] .tunes-ctrl button { color: #F2F2EC; border-color: #F2F2EC; }
body[data-tunes-skin="mono"] .tunes-viz .bar { background: #F2F2EC; box-shadow: none; }
body[data-tunes-skin="mono"] .tunes-ctrl button.play { background: #F2F2EC; color: #0a0a0a; }

.tunes-title {
  background: var(--primary);
  color: var(--ink);
  padding: 4px 10px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 10px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase;
  cursor: grab; user-select: none;
}
.tunes-title .name { display: flex; align-items: center; gap: 6px; }
.tunes-title .name .dot { width: 9px; height: 9px; background: var(--ink); }
.tunes-now {
  display: grid; grid-template-columns: 80px 1fr; gap: 10px;
  padding: 10px;
  border-bottom: 2px solid var(--primary);
  align-items: start;
}
.tunes-art {
  width: 80px; height: 80px;
  background: var(--c-arcade);
  border: 2px solid var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Geologica', sans-serif; font-weight: 900;
  font-size: 28px; color: var(--ink);
  position: relative; overflow: hidden;
  filter: grayscale(1);
  flex-shrink: 0;
}
.tunes-art .spinner { display: none; }
.tunes-meta { min-width: 0; }
.tunes-track {
  font-family: 'Geologica', sans-serif; font-weight: 900;
  font-size: 14px; color: var(--primary);
  text-shadow: 1px 1px 0 var(--ink);
  letter-spacing: 0.02em; line-height: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tunes-artist {
  font-size: 10px; opacity: 0.7; margin-top: 3px;
  letter-spacing: 1.5px; text-transform: uppercase;
}
.tunes-tags { margin-top: 5px; font-size: 9px; opacity: 0.55; letter-spacing: 1px; }
.tunes-scrub {
  display: flex; align-items: center; gap: 8px;
  font-family: 'VT323', monospace;
  font-size: 14px; margin-top: 6px;
}
.tunes-bar {
  flex: 1; height: 6px;
  background: rgba(22,224,224,0.15);
  border: 1px solid var(--primary);
  position: relative; cursor: pointer;
}
.tunes-bar .fill {
  position: absolute; inset: 0 auto 0 0;
  width: 38%; background: var(--primary);
}
.tunes-viz {
  display: flex; gap: 3px; align-items: flex-end;
  height: 36px;
  background: var(--ink); padding: 4px;
  border-top: 2px solid var(--primary);
  border-bottom: 2px solid var(--primary);
}
.tunes-viz .bar {
  flex: 1;
  background: var(--primary);
  box-shadow: 0 0 6px var(--primary);
  height: 6%;
  transition: height 0.05s linear;
}
.tunes-ctrl {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 3px; padding: 6px;
  background: rgba(0,0,0,0.4);
}
.tunes-ctrl button {
  background: var(--ink); border: 1.5px solid var(--primary);
  color: var(--primary); padding: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; font-weight: 700;
}
.tunes-ctrl button:hover { background: var(--primary); color: var(--ink); }
.tunes-ctrl button.play { background: var(--primary); color: var(--ink); font-size: 14px; }
.tunes-list {
  border-top: 2px solid var(--primary);
  flex: 1; min-height: 0;
  overflow-y: auto;
  font-family: 'JetBrains Mono', monospace;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
}
.tunes-list::-webkit-scrollbar { width: 8px; }
.tunes-list::-webkit-scrollbar-thumb { background: var(--primary); }
.tunes-list .song {
  display: grid; grid-template-columns: 24px 1fr auto;
  gap: 8px; padding: 6px 10px;
  align-items: center; cursor: pointer;
  border-bottom: 1px dotted rgba(22,224,224,0.22);
  font-size: 11px;
}
.tunes-list .song:hover { background: rgba(22,224,224,0.12); }
.tunes-list .song.playing { background: var(--primary); color: var(--ink); }
.tunes-list .song.playing .num::before { content: "▶"; }
.tunes-list .song .num { font-size: 10px; opacity: 0.55; }
.tunes-list .song .title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tunes-list .song .dur { font-family: 'VT323', monospace; font-size: 13px; opacity: 0.7; }
