/* Copyright (c) 2026, Lenny Karpel.  All rights reserved. */

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --border: #2a2a2a;
  --text: #f1f1f1;
  --muted: #aaa;
  --accent: #ff4444;
  --ui-cyan: #00dddd;
  --ui-cyan-hover: #66eeee;
  --active: #2d2d2d;
  --list-width: 490px;
  --video-max-w: 533px;
  --video-max-h: 300px;
  --video-compact-w: 356px;
  --video-compact-h: 200px;
}
* { box-sizing: border-box; }
html {
  height: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Arial Rounded MT Bold", "Arial Rounded MT", arial, verdana, sans-serif;
  line-height: 1.4;
  /* Lock to the visible viewport — iPad Chrome toolbars break 100vh/dvh. */
  position: fixed;
  top: var(--app-top, 0px);
  left: 0;
  right: 0;
  width: 100%;
  height: var(--app-height, 100dvh);
  overflow: hidden;
}
.layout {
  display: flex;
  flex-direction: row;
  height: 100%;
  max-height: 100%;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  overflow: hidden;
}
.player-panel {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg);
  border-left: 1px solid var(--border);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
}
.player-wrap {
  flex: 1;
  min-width: 0;
  min-height: 0;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto auto;
  grid-template-areas:
    "fireworks"
    "meta"
    "transport";
  column-gap: 0.75rem;
  row-gap: 0.75rem;
  overflow: hidden;
}
.player-wrap .player-fireworks {
  grid-area: fireworks;
  align-self: stretch;
  min-width: 0;
  min-height: 0;
  margin-bottom: 0;
}
.player-wrap .player-meta {
  grid-area: meta;
  align-self: end;
  position: relative;
  z-index: 2;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.player-wrap .now-playing-transport {
  grid-area: transport;
  position: relative;
  z-index: 3;
  width: 100%;
  min-width: 0;
  padding-block: 0.15rem;
}
.player-wrap .video-shell {
  grid-area: video;
  align-self: end;
  justify-self: end;
  box-sizing: border-box;
  width: min(100%, var(--video-max-w));
  height: auto;
  aspect-ratio: 16 / 9;
  max-height: var(--video-max-h);
  margin: 0;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}
/* Off-flow until a track is selected — not display:none (breaks YT mount). */
.player-wrap:not(.has-video) .video-shell {
  position: absolute;
  left: -9999px;
  top: 0;
  width: 356px;
  height: 200px;
  pointer-events: none;
  opacity: 0;
}
.player-wrap.has-video {
  grid-template-columns: minmax(0, 1fr) minmax(200px, var(--video-max-w));
  grid-template-areas:
    "fireworks fireworks"
    "meta video"
    "transport video";
}
.player-wrap.has-video .video-shell {
  position: relative;
  left: auto;
  opacity: 1;
  pointer-events: auto;
}
.player-wrap.is-compact.has-video {
  grid-template-columns: minmax(0, 1fr) minmax(160px, var(--video-compact-w));
}
.player-wrap.is-compact .video-shell {
  width: min(100%, var(--video-compact-w));
  max-height: var(--video-compact-h);
}
.player-fireworks {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 12rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: #202020;
}
.player-fireworks canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  background: #202020;
}
.player-fireworks-rate,
.player-fireworks-sfx {
  position: absolute;
  bottom: 0.45rem;
  z-index: 2;
  box-sizing: border-box;
  width: 8.75rem;
  padding: 0.18rem 0.3rem;
  background: rgba(15, 15, 15, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 3px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.55rem;
  letter-spacing: 0.02em;
}
.player-fireworks-rate {
  display: none;
  left: 0.45rem;
}
.player-fireworks.is-fullscreen .player-fireworks-rate {
  display: block;
}
.player-fireworks-slider-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  cursor: pointer;
  user-select: none;
  width: 100%;
}
.player-fireworks-slider-label span {
  white-space: nowrap;
  flex: 0 0 2.75rem;
}
.player-fireworks-sfx .player-fireworks-slider-label span {
  text-align: right;
}
#fw-rate-slider,
#fw-sfx-volume {
  flex: 1 1 auto;
  width: 0;
  min-width: 0;
  height: 0.7rem;
  accent-color: #00dddd;
  cursor: pointer;
}
.player-fireworks-full-btn {
  position: absolute;
  top: 0.45rem;
  right: 0.55rem;
  z-index: 2;
  background: rgba(15, 15, 15, 0.55);
  color: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  padding: 0.2rem 0.45rem;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
}
.player-fireworks-full-btn:hover {
  color: #fff;
  border-color: rgba(0, 221, 221, 0.65);
}
.player-fireworks-hint {
  position: absolute;
  right: 0.75rem;
  bottom: 0.55rem;
  z-index: 2;
  margin: 0;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  pointer-events: none;
  user-select: none;
}
.player-fireworks-hint-full {
  right: auto;
  left: 50%;
  bottom: 0.35rem;
  transform: translateX(-50%);
  font-size: 0.8rem;
  white-space: nowrap;
}
.player-fireworks.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 200;
  width: auto;
  height: auto;
  min-height: 0;
  margin: 0;
  border: none;
  border-radius: 0;
  flex: none;
  container-type: inline-size;
  container-name: fireworks;
}
.player-fireworks.is-fullscreen .player-logo {
  display: none;
}
.player-fireworks.is-fullscreen .player-fireworks-hint:not(.player-fireworks-hint-full) {
  display: none;
}
.player-fireworks.is-fullscreen .player-fireworks-hint-full {
  display: block;
}
/* Hide rather than wrap when the full-window hint can't fit on one line. */
@container fireworks (max-width: 720px) {
  .player-fireworks-hint-full {
    display: none !important;
  }
}
.player-fireworks.is-fullscreen .player-fireworks-full-btn {
  top: 0.65rem;
  right: 0.75rem;
}
.player-fireworks-sfx {
  display: none;
  right: 0.65rem;
}
.player-fireworks.is-fullscreen.has-sfx-control .player-fireworks-sfx {
  display: block;
}
.player-logo {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(800px, 100%, 70vmin);
  margin: 0 auto;
  padding: 1.25rem 1rem;
  min-height: 100%;
  box-sizing: border-box;
  /* Empty overlay areas pass clicks through to the canvas. */
  pointer-events: none;
}
.player-logo-art {
  position: relative;
  width: 100%;
  line-height: 0;
}
.player-logo-art img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}
.player-meta .player-logo-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
  width: 100%;
  min-width: 0;
  margin-bottom: 2rem;
  padding-bottom: 0.35rem;
}
.player-logo-link-sep {
  align-self: stretch;
  height: 0;
  margin: 0.15rem 0 0.25rem;
  border-bottom: 1px solid rgba(0, 221, 221, 0.35);
  pointer-events: none;
}
.player-logo-link {
  color: #00dddd;
  font-size: clamp(0.75rem, 1.6vw, 0.95rem);
  font-weight: bold;
  line-height: 1.35;
  text-decoration: none;
  text-align: left;
  max-width: 100%;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-logo-link.player-logo-link-who {
  font-size: clamp(1rem, 2.2vw, 1.35rem);
}
.player-logo-link:visited {
  color: #00dddd;
}
.player-logo-link:hover {
  color: #ff0000;
  text-decoration: underline;
}
.video-shell {
  position: relative;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}
.video-shell #yt-player,
.video-shell #yt-player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  z-index: 0;
}
/* Programmatic focus target only — must not cover YouTube controls. */
.yt-focus-trap {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  outline: none;
}
.now-playing {
  margin-top: 0;
  line-height: 1.15;
  font-size: 0.95rem;
  min-width: 0;
}
.now-playing .concert,
.now-playing .track {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.now-playing .concert {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}
.now-playing .track {
  font-weight: 600;
}
.now-playing-transport {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-width: 0;
}
.player-wrap.is-compact .now-playing-transport .audio-seek-row {
  flex: 1 1 100%;
  margin-left: 0;
}
.now-playing-transport .transport-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-appearance: none;
  appearance: none;
  background: var(--surface);
  color: var(--text);
  -webkit-text-fill-color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0.35rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  touch-action: manipulation;
}
.now-playing-transport .transport-btn:hover {
  border-color: var(--accent);
}
.now-playing-transport .transport-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.now-playing-transport .transport-btn-play {
  min-width: 3rem;
  min-height: 3rem;
}
.now-playing-transport .transport-icon {
  width: 22px;
  height: 22px;
  display: block;
  flex-shrink: 0;
  fill: currentColor;
  pointer-events: none;
}
.now-playing-transport .transport-btn-play .transport-icon {
  width: 26px;
  height: 26px;
}
.audio-seek-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  margin-left: 0.25rem;
}
.seek-wrap {
  flex: 1;
  position: relative;
  height: 1.75rem;
  display: flex;
  align-items: center;
  padding: 0;
  cursor: pointer;
  min-width: 4rem;
  touch-action: none;
}
.seek-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  pointer-events: none;
}
.seek-wrap:has(#seek-bar:disabled) .seek-track {
  opacity: 0.35;
}
.seek-buffer {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  background: rgba(255, 255, 255, 0.35);
}
.seek-played {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  background: var(--accent);
  z-index: 1;
}
.seek-knob {
  position: absolute;
  top: 50%;
  left: 0;
  width: 24px;
  height: 24px;
  margin-top: -12px;
  background: url('images/seek-thumb.png') center / contain no-repeat;
  pointer-events: none;
  z-index: 3;
  transform: translateX(-50%);
}
.seek-wrap:has(#seek-bar:disabled) .seek-knob {
  opacity: 0.35;
}
.audio-seek-row .time {
  font-size: 0.75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 2.75rem;
  flex-shrink: 0;
}
.audio-seek-row .time-end {
  text-align: right;
}
#seek-bar {
  position: relative;
  z-index: 2;
  flex: 1;
  width: 100%;
  height: 1.75rem;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
#seek-bar::-webkit-slider-runnable-track {
  height: 6px;
  background: transparent;
  border: none;
}
#seek-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  box-shadow: none;
  margin-top: -9px;
}
#seek-bar::-moz-range-track {
  height: 6px;
  background: transparent;
  border: none;
}
#seek-bar::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  box-shadow: none;
}
#seek-bar:disabled {
  cursor: default;
}
#seek-bar:disabled::-webkit-slider-thumb {
  opacity: 0.35;
}
#seek-bar:disabled::-moz-range-thumb {
  opacity: 0.35;
}
.list-panel {
  width: var(--list-width);
  max-width: calc(100% - 360px);
  flex-shrink: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
.panel-resizer {
  flex-shrink: 0;
  width: 6px;
  cursor: col-resize;
  background: transparent;
  position: relative;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.panel-resizer::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--border);
  transition: background 0.15s ease;
  pointer-events: none;
}
.panel-resizer:is(:hover, .is-hover, .dragging)::before {
  background: var(--ui-cyan);
}
.panel-resizer::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  /* Wider hit target for finger / Apple Pencil; bar itself stays thin. */
  left: -12px;
  right: -12px;
}
.list-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1rem 1rem 0.5rem;
  color: #fff;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}
.list-header-thumb-link {
  flex-shrink: 0;
  line-height: 0;
  border-radius: 4px;
}
.list-header-thumb-link:hover {
  opacity: 0.85;
}
.list-header-thumb {
  width: 4.75rem;
  height: 4.75rem;
  object-fit: contain;
  display: block;
}
.list-header-text {
  min-width: 0;
  flex: 1;
}
.list-header-title {
  font-size: 1.5rem;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-header-credit {
  margin-top: 0.2rem;
  font-size: 0.72rem;
  font-weight: normal;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-header-stats {
  margin-top: 0.15rem;
  font-size: 0.72rem;
  font-weight: normal;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-header-title a {
  color: inherit;
  text-decoration: none;
}
.list-header-title a:hover,
.list-header-title a:focus-visible {
  color: inherit;
  text-decoration: none;
}
.list-header-credit a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.12em;
}
.list-header-credit a:hover,
.list-header-credit a:focus-visible {
  color: inherit;
  text-decoration: underline;
}
#track-list {
  flex: 1;
  overflow-y: scroll;
  scrollbar-gutter: stable;
  padding: 0 0.5rem 1rem;
}
#track-list,
.player-panel {
  scrollbar-width: thin;
  scrollbar-color: #555 var(--surface);
}
#track-list::-webkit-scrollbar,
.player-panel::-webkit-scrollbar {
  width: 10px;
}
#track-list::-webkit-scrollbar-track,
.player-panel::-webkit-scrollbar-track {
  background: var(--surface);
}
#track-list::-webkit-scrollbar-thumb,
.player-panel::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 5px;
  border: 2px solid var(--surface);
}
#track-list::-webkit-scrollbar-thumb:hover,
.player-panel::-webkit-scrollbar-thumb:hover {
  background: #666;
}
.tree {
  list-style: none;
  margin: 0;
  padding: 0.1rem 0;
}
.tree-children {
  list-style: none;
  margin: 0;
  padding: 0;
  display: none;
}
.tree-node.expanded > .tree-children { display: block; }
.tree-node.expanded > .tree-row .tree-chevron { transform: rotate(90deg); }
.tree-row {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.08rem 0.5rem;
  border-radius: 6px;
  min-height: 1.65rem;
}
.tree-chevron,
.tree-label,
.track-menu-btn,
.playlist-action-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.tree-row.active > .tree-label { color: #fff; font-weight: 600; }
.tree-chevron {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.1rem 0.2rem;
  font-size: 0.7rem;
  line-height: 1;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}
.tree-label {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: 0.92rem;
  line-height: 1.25;
  padding: 0.2rem 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tree-label.performer-label {
  font-weight: 600;
  color: #eee;
}
.tree-label.date-label {
  font-weight: 500;
  color: #ccc;
  font-size: 0.88rem;
}
.tree-node.date-node > .tree-row {
  padding-left: 1.5rem;
}
.tree-label.track-label {
  font-size: 0.88rem;
  color: var(--muted);
  padding-left: 0.25rem;
  flex: 1;
}
.tree-row.track-row.active .tree-label.track-label {
  color: #fff;
}
.tree-row.track-row.active {
  background: var(--active);
  border-radius: 4px;
  border-left: 3px solid var(--accent);
  padding-left: calc(2.5rem - 3px);
}
.track-menu-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  font-size: 0.9rem;
  line-height: 1;
  opacity: 0;
}
.track-menu-btn:focus-visible,
.track-menu-btn.menu-open {
  opacity: 1;
}
.track-menu {
  position: fixed;
  z-index: 1000;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0;
  min-width: 11rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.track-menu[hidden] { display: none; }
.track-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
}
.track-menu button:hover { background: var(--active); }
.track-menu button.danger { color: #ff8888; }
.track-toast {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
  z-index: 1001;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
.track-toast[hidden] { display: none; }
.app-dialog {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.app-dialog[hidden] { display: none; }
.app-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
}
.app-dialog-card {
  position: relative;
  width: min(22rem, 100%);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1rem 0.85rem;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
}
.app-dialog-title {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.app-dialog-message {
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.4;
}
.app-dialog-message[hidden] { display: none; }
.app-dialog-field {
  display: block;
  margin: 0 0 0.9rem;
}
.app-dialog-field[hidden] { display: none; }
.app-dialog-label[hidden] { display: none; }
.app-dialog-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
  color: var(--muted);
}
.app-dialog-input {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem 0.65rem;
  font: inherit;
  font-size: 0.9rem;
  outline: none;
}
.app-dialog-input:focus {
  border-color: var(--accent);
}
.app-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
}
.app-dialog-btn {
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.app-dialog-btn:hover {
  color: var(--text);
  border-color: #444;
}
.app-dialog-btn-primary {
  background: var(--active);
  color: var(--text);
  border-color: var(--accent);
}
.app-dialog-btn-primary:hover {
  color: #fff;
  border-color: var(--accent);
}
.app-dialog-btn-danger {
  color: #ff8888;
  border-color: rgba(255, 136, 136, 0.45);
}
.app-dialog-btn-danger:hover {
  color: #ffaaaa;
  border-color: #ff8888;
}
.tree-leaf .tree-row { padding-left: 2.5rem; }
.tree-section { margin-bottom: 0.25rem; }
.tree-section-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
}
.tree-section-head .tree-section-header {
  position: static;
  z-index: auto;
}
.tree-section-search {
  display: block;
  padding: 0 0.75rem 0.45rem;
  border-bottom: 1px solid var(--border);
}
.tree-section-search-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--surface);
  color: var(--text);
  border: 1px solid rgba(0, 221, 221, 0.35);
  border-radius: 4px;
  padding: 0.35rem 0.55rem;
  font: inherit;
  font-size: 0.84rem;
  outline: none;
}
.tree-section-search-input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}
.tree-section-search-input:focus {
  border-color: var(--accent);
}
.tree.search-active .search-hidden {
  display: none !important;
}
.tree-section-header {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.6rem 0.75rem 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #00dddd;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 2;
}
.tree-section-header .tree-section-title {
  flex: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}
.tree-section-header button {
  background: var(--surface);
  color: #00dddd;
  border: 1px solid rgba(0, 221, 221, 0.35);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  font-size: 0.75rem;
  cursor: pointer;
}
.tree-section-header .tree-section-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55rem;
  min-height: 1.55rem;
  padding: 0.2rem 0.4rem;
  font-size: 0.7rem;
  line-height: 1;
}
.tree-section-header #btn-new-playlist {
  font-size: 1rem;
  font-weight: 500;
  line-height: 1;
}
.tree-section-header .section-info-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 50%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  font-size: 0.72rem;
  font-weight: 400;
  font-style: normal;
  line-height: 1;
  color: #00dddd;
  opacity: 1;
}
.section-info-icon {
  width: 1.05em;
  height: 1.05em;
  display: block;
}
.tree-section-header .section-info-btn:hover {
  color: #66eeee;
  opacity: 1;
}
.section-info-btn[aria-expanded="true"] {
  color: #66eeee;
  opacity: 1;
}
.section-info-popup {
  position: fixed;
  z-index: 1000;
  width: min(18.5rem, calc(100vw - 1.5rem));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  padding: 0.85rem 0.95rem;
  color: var(--text);
  line-height: 1.45;
}
.section-info-popup[hidden] { display: none; }
.section-info-popup-title {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #00dddd;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.section-info-popup-lead {
  margin: 0 0 0.55rem;
  font-size: 0.86rem;
  color: var(--text);
}
.section-info-popup-list {
  margin: 0 0 0.55rem;
  padding-left: 1.1rem;
  font-size: 0.84rem;
  color: var(--muted);
}
.section-info-popup-list li + li { margin-top: 0.3rem; }
.section-info-popup-note {
  margin: 0;
  font-size: 0.78rem;
  font-style: italic;
  color: var(--muted);
}
.tree-section-header button:hover {
  color: #66eeee;
  border-color: #00dddd;
}
.tree-empty {
  padding: 0.75rem 1rem;
  color: var(--muted);
  font-size: 0.88rem;
  font-style: italic;
}
.tree-label.playlist-label { font-weight: 600; color: #ddd; }
.tree-node.playlist-node > .tree-row { padding-left: 0.25rem; }
.drag-handle {
  flex-shrink: 0;
  color: var(--muted);
  cursor: grab;
  padding: 0.15rem 0.25rem;
  font-size: 0.82rem;
  user-select: none;
}
.drag-handle:active { cursor: grabbing; }
.tree-row.playlist-track-row { cursor: grab; }
.tree-row.playlist-track-row.dragging { cursor: grabbing; }
.tree-row.playlist-track-row .track-label,
.tree-row.playlist-track-row .track-menu-btn,
.tree-row.playlist-track-row .playlist-action-btn { cursor: pointer; }
.tree-row.dragging { opacity: 0.45; }
.tree-row.drag-over { background: rgba(255, 68, 68, 0.12); }
.playlist-drop-end {
  min-height: 0.35rem;
  margin: 0 0.5rem 0.1rem 2.5rem;
  border-radius: 4px;
}
.playlist-drop-end.drag-over {
  background: rgba(255, 68, 68, 0.12);
  min-height: 0.85rem;
}
.playlist-action-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  font-size: 0.85rem;
  line-height: 1;
  opacity: 0;
}
.playlist-action-btn.menu-open { opacity: 1; }
.track-menu-sep {
  height: 1px;
  background: var(--border);
  margin: 0.25rem 0;
}
.track-menu-label {
  padding: 0.35rem 0.75rem 0.15rem;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }
  .list-panel {
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    max-height: 45%;
    order: 1;
  }
  .panel-resizer {
    display: none;
  }
  .player-panel {
    flex: 1 1 auto;
    min-height: 0;
    order: 2;
    border-left: none;
    border-top: 1px solid var(--border);
  }
  .player-logo-art {
    display: none;
    margin-bottom: 0;
  }
  .player-logo {
    width: 100%;
    justify-content: flex-start;
    padding-top: 0.85rem;
  }
  .player-fireworks {
    min-height: 12rem;
  }
}
@media (min-width: 900px) {
  .player-panel { padding: 1.25rem 1.5rem; }
}

/* Desktop: hover highlights; touch: no sticky hover (avoids double-tap on iPad) */
@media (hover: hover) and (pointer: fine) {
  .tree-row:hover { background: var(--active); }
  .tree-chevron:hover { color: var(--text); }
  .tree-label.track-label:hover { color: var(--text); }
  .tree-row.track-row:hover .track-menu-btn,
  .tree-row.track-row:hover .playlist-action-btn,
  .tree-node.performer-node > .tree-row:hover .track-menu-btn,
  .tree-node.performer-node > .tree-row:hover .playlist-action-btn,
  .tree-node.date-node > .tree-row:hover .track-menu-btn,
  .tree-node.date-node > .tree-row:hover .playlist-action-btn,
  .tree-node.playlist-node > .tree-row:hover .playlist-action-btn,
  .tree-node.playlist-node > .tree-row:hover .track-menu-btn {
    opacity: 1;
  }
  .track-menu-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
  }
  .playlist-action-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
  }
}
@media (hover: none), (pointer: coarse) {
  .track-menu-btn,
  .playlist-action-btn {
    opacity: 1;
  }
  .player-wrap.has-video {
    grid-template-columns: minmax(0, 1fr) minmax(160px, var(--video-compact-w));
  }
  .player-wrap.has-video .video-shell {
    width: min(100%, var(--video-compact-w));
    max-height: var(--video-compact-h);
  }
}

/* Touch: Who Played overlay so audio keeps playing (iOS pauses background tabs). */
.who-played-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.who-played-overlay[hidden] {
  display: none;
}
.who-played-overlay-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  padding-top: max(0.55rem, env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.who-played-overlay-close {
  -webkit-appearance: none;
  appearance: none;
  background: none;
  border: none;
  color: var(--ui-cyan);
  font: inherit;
  font-weight: bold;
  font-size: 0.95rem;
  padding: 0.35rem 0.15rem;
  cursor: pointer;
  -webkit-text-fill-color: var(--ui-cyan);
}
.who-played-overlay-close:hover {
  color: var(--ui-cyan-hover);
  -webkit-text-fill-color: var(--ui-cyan-hover);
  text-decoration: underline;
}
.who-played-overlay-frame {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 0;
  background: var(--bg);
}
body.who-played-overlay-open {
  overflow: hidden;
}
