:root {
  color-scheme: dark;
  --app-bg-a: #252642;
  --app-bg-b: #10112c;
  --panel: #162132;
  --panel-soft: #1b2436;
  --line: #33435f;
  --line-hot: #7fcbff;
  --text: #f8fafc;
  --muted: #b8c7e8;
  --accent: #ffb020;
  --blue: #38bdf8;
  --danger: #e75263;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: linear-gradient(135deg, var(--app-bg-a), var(--app-bg-b));
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0;
  touch-action: manipulation;
}

button,
input {
  font: inherit;
}

button {
  min-height: 42px;
  border: 1px solid #4d79af;
  border-radius: 8px;
  background: #31507b;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

button:active {
  background: #274264;
}

.shell {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  padding: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0;
  overflow: hidden;
}

.top-panel,
.playlist-panel,
.bottom-panel {
  border: 0;
  border-radius: 0;
  background: rgba(17, 20, 32, 0.92);
  box-shadow: none;
}

.top-panel {
  grid-row: 1;
  min-width: 0;
  padding: 4px 0 0;
  display: grid;
  grid-template-rows: auto auto;
  gap: 4px;
  border-bottom: 1px solid var(--line);
}

.bottom-panel {
  grid-row: 3;
  position: relative;
  z-index: 20;
  min-width: 0;
  padding: 4px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 4px;
  overflow: visible;
}

.now-section {
  min-width: 0;
}

.now-section {
  position: relative;
  height: 18.48px;
  min-height: 18.48px;
  max-height: 18.48px;
  margin: 0 4px;
  overflow: hidden;
}

.now-section.brand {
  display: grid;
  place-items: center;
}

.remote-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 18.48px;
}

.remote-brand-icon-frame {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
}

.remote-brand-icon {
  width: 14px;
  height: 14px;
  object-fit: contain;
}

.remote-brand-title {
  min-width: 0;
  color: white;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.now-title {
  min-width: 0;
  min-height: 1.2em;
  max-width: 100%;
  font-size: 15.4px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.now-tags {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  max-width: min(72vw, 100%);
}

.meta-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.play-progress-panel {
  position: relative;
  min-width: 0;
  background: #050505;
  overflow: hidden;
}

.simple-play-progress {
  position: relative;
  height: 10px;
  background: #120b0c;
}

.simple-play-progress-fill {
  height: 100%;
  width: var(--value);
  background: #e21818;
  transition: width 50ms linear;
}

.position-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--left);
  z-index: 8;
  width: 2px;
  background: white;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.75);
  transform: translateX(-1px);
  pointer-events: none;
  transition: left 50ms linear;
}

.wave-display {
  position: relative;
  height: var(--remote-wave-height, 40px);
  background: #050505;
  overflow: hidden;
}

.wave-display.empty {
  background: #111420;
}

.wave-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

.wave-image.gray {
  z-index: 1;
}

.wave-image.red {
  z-index: 2;
  clip-path: inset(0 calc(100% - var(--active-right)) 0 var(--active-left));
}

.wave-overlay,
.wave-fade,
.wave-progress-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  pointer-events: none;
}

.wave-overlay {
  left: var(--left);
  width: var(--width);
  z-index: 3;
}

.wave-overlay.silence-start {
  background: rgba(32, 32, 255, 0.5);
}

.wave-overlay.silence-end {
  right: 0;
  left: auto;
  background: rgba(32, 32, 255, 0.25);
}

.wave-fade {
  left: var(--left);
  width: var(--width);
  z-index: 4;
  background: rgba(255, 32, 255, 0.5);
  outline: 1px solid rgba(128, 128, 128, 0.5);
}

.wave-fade.fade-in {
  clip-path: polygon(100% 0, 0 50%, 100% 100%);
}

.wave-fade.fade-out {
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.wave-progress-fill {
  left: 0;
  z-index: 6;
  width: var(--value);
  background: rgba(32, 32, 32, 0.69);
  transition: width 50ms linear;
}

.wave-position-control {
  position: absolute;
  inset: 0;
  z-index: 9;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.position-blocked-badge {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 100;
  max-width: calc(100vw - 16px);
  padding: 4px 10px;
  border: 1px solid #fff2a6;
  border-radius: 999px;
  background: #ffd84a;
  color: #241a00;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.15;
  opacity: 1;
  pointer-events: none;
  text-align: center;
  text-overflow: ellipsis;
  transform: translate(-50%, -50%);
  transition: opacity 450ms ease;
  white-space: nowrap;
  overflow: hidden;
}

.position-blocked-badge.fade {
  opacity: 0;
}

.headphone-audio-gesture-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(7, 10, 18, 0.54);
  pointer-events: auto;
  touch-action: none;
}

.headphone-audio-gesture-backdrop[hidden] {
  display: none;
}

.headphone-audio-gesture-popup {
  width: min(320px, calc(100vw - 36px));
  min-height: 0;
  padding: 18px 18px 16px;
  border: 1px solid #6982af;
  border-radius: 8px;
  background: #182238;
  color: #f8fafc;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.46);
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
  cursor: pointer;
}

.headphone-audio-gesture-popup:hover {
  border-color: #8ec9ff;
  background: #1f2d48;
}

.headphone-audio-gesture-popup:active {
  background: #121a2e;
}

.headphone-audio-gesture-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #243456;
}

.headphone-audio-gesture-icon img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.headphone-audio-gesture-title {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
}

.headphone-audio-gesture-message {
  color: #c7d5f3;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.headphone-audio-gesture-action {
  margin-top: 4px;
  padding: 8px 12px;
  border-radius: 6px;
  background: #31507b;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
}

.remote-reconnect-backdrop {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  place-items: center;
  padding: 18px;
  pointer-events: none;
}

.remote-reconnect-backdrop[hidden] {
  display: none;
}

.remote-reconnect-popup {
  width: min(294px, calc(100vw - 36px));
  min-height: 0;
  padding: 16px 18px;
  border: 1px solid #6b7280;
  border-radius: 8px;
  background: rgba(20, 25, 36, 0.97);
  color: #f8fafc;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.48);
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.remote-reconnect-icons {
  width: 78px;
  height: 42px;
  position: relative;
}

.remote-reconnect-disconnect-icon {
  position: absolute;
  left: 0;
  top: 2px;
  width: 39px;
  height: 39px;
  display: block;
}

.remote-reconnect-disconnect-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.remote-reconnect-disconnect-icon .remote-reconnect-wifi-arc,
.remote-reconnect-disconnect-icon circle,
.remote-reconnect-disconnect-icon .remote-reconnect-wifi-slash {
  fill: none;
  stroke: #ef4444;
  stroke-width: 3.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.remote-reconnect-disconnect-icon circle {
  fill: #ef4444;
}

.remote-reconnect-disconnect-icon .remote-reconnect-wifi-slash {
  stroke-width: 3.8;
}

.remote-reconnect-search-icon {
  position: absolute;
  right: 1px;
  top: 3px;
  width: 30px;
  height: 30px;
  border: 3px solid #38bdf8;
  border-radius: 50%;
  transform-origin: 16px 16px;
  animation: remote-reconnect-search 1.15s ease-in-out infinite;
}

.remote-reconnect-search-icon::after {
  content: "";
  position: absolute;
  right: -8px;
  bottom: -6px;
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: #38bdf8;
  transform: rotate(45deg);
}

.remote-reconnect-title {
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
}

.remote-reconnect-message {
  color: #c7d5f3;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

@keyframes remote-reconnect-search {
  0% {
    transform: translateX(-2px) rotate(-8deg);
  }

  50% {
    transform: translateX(6px) rotate(10deg);
  }

  100% {
    transform: translateX(-2px) rotate(-8deg);
  }
}

.wave-loading {
  height: var(--remote-wave-height, 40px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #050505;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.wave-loading-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(248, 250, 252, 0.28);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: wave-loading-spin 0.8s linear infinite;
}

@keyframes wave-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.meter {
  position: relative;
  flex: 0 0 auto;
  width: 10px;
  height: var(--remote-control-size, 40px);
  background: #202020;
  overflow: hidden;
}

.meter-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--value);
  background: green;
}

.volume-row {
  min-width: 0;
  flex: 1 1 0;
  align-self: stretch;
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.volume-control {
  position: relative;
  min-width: 0;
  height: calc(var(--remote-control-size, 40px) + 8px);
  margin: -4px 0;
  overflow: visible;
}

.volume {
  position: absolute;
  inset: 0;
  z-index: 2;
  min-width: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  accent-color: var(--accent);
  background: transparent;
}

.volume-label {
  position: absolute;
  left: 8px;
  top: 4px;
  z-index: 1;
  max-width: calc(100% - 58px);
  overflow: hidden;
  color: rgba(248, 250, 252, 0.78);
  font-size: 11px;
  line-height: 1.25;
  pointer-events: none;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px #000;
  white-space: nowrap;
}

.volume-value {
  position: absolute;
  top: 4px;
  right: 0;
  z-index: 1;
  color: rgba(248, 250, 252, 0.78);
  font-size: 11px;
  line-height: 1.25;
  pointer-events: none;
  text-shadow: 0 1px 2px #000;
  white-space: nowrap;
}

.control-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.remote-mode-area {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
}

.remote-mode-button {
  position: relative;
  width: var(--remote-control-size, 40px);
  height: var(--remote-control-size, 40px);
  min-height: var(--remote-control-size, 40px);
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid #4a4f6e;
  border-radius: 4px;
  background: #2a2d4a;
  color: #fff;
  cursor: pointer;
}

.remote-mode-button:hover {
  background: #3a3d5a;
}

.remote-mode-button:active {
  background: #1a1d34;
}

.remote-mode-button:disabled {
  opacity: 0.48;
  cursor: default;
}

.remote-mode-button.back {
  border-color: #7fcbff;
  background: #203c5a;
}

.remote-mode-button.back:hover {
  border-color: #9bd8ff;
  background: #294968;
}

.remote-mode-button img {
  display: block;
  width: var(--remote-control-icon-size, 24px);
  height: var(--remote-control-icon-size, 24px);
  object-fit: contain;
  image-rendering: auto;
}

.remote-mode-button.back img {
  filter: invert(92%) sepia(10%) saturate(998%) hue-rotate(184deg) brightness(104%) contrast(101%);
}

.main-audio-toggle.active {
  border-color: #44d06d;
  background: #1a3724;
}

.main-audio-toggle.active:hover {
  border-color: #76e297;
  background: #24472f;
}

.main-audio-toggle.active:active {
  border-color: #44d06d;
  background: #13281b;
}

.controls {
  flex: 0 0 auto;
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: flex-end;
}

.song-explorer-controls {
  min-width: var(--remote-control-size, 40px);
}

.transport-button {
  width: var(--remote-control-size, 40px);
  height: var(--remote-control-size, 40px);
  min-height: var(--remote-control-size, 40px);
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid #4a4f6e;
  border-radius: 4px;
  background: #2a2d4a;
  color: #fff;
  cursor: pointer;
}

.transport-button:hover {
  background: #3a3d5a;
}

.transport-button:active {
  background: #1a1d34;
}

.transport-button:disabled {
  opacity: 0.5;
  cursor: default;
}

.transport-button img {
  display: block;
  width: var(--remote-control-icon-size, 24px);
  height: var(--remote-control-icon-size, 24px);
  object-fit: contain;
  image-rendering: auto;
}

.transport-button.automix img {
  width: var(--remote-automix-icon-size, 26px);
  height: var(--remote-automix-icon-size, 26px);
}

.transport-button.play.active {
  border-color: #44d06d;
  background: #1a3724;
}

.transport-button.play.active:hover {
  border-color: #76e297;
  background: #24472f;
}

.transport-button.play.active:active {
  border-color: #44d06d;
  background: #13281b;
}

.transport-button.automix.active {
  border-color: #ffd700;
  background: #3a3318;
}

.transport-button.automix.active:hover {
  border-color: #ffe45c;
  background: #4c441f;
}

.transport-button.automix.active:active {
  border-color: #ffd700;
  background: #2a250f;
}

.playlist-panel {
  grid-row: 2;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.song-explorer-panel {
  grid-row: 1 / 3;
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  border: 0;
  border-radius: 0;
  background: rgba(17, 20, 32, 0.92);
  box-shadow: none;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.song-explorer-header {
  min-width: 0;
  padding: 6px 6px 5px;
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 5px;
  border-bottom: 1px solid var(--line);
  background: rgba(20, 25, 42, 0.96);
}

.song-explorer-drives {
  min-width: 0;
  display: flex;
  gap: 5px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.song-explorer-drive {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #4a4f6e;
  border-radius: 4px;
  background: #2a2d4a;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.song-explorer-drive:hover {
  background: #3a3d5a;
}

.song-explorer-drive.active {
  border-color: #5fa0eb;
  background: #215898;
}

.song-explorer-search-box {
  position: relative;
  min-width: 0;
  height: 32px;
}

.song-explorer-search {
  width: 100%;
  min-width: 0;
  height: 32px;
  border: 1px solid #4a4f6e;
  border-radius: 4px;
  background: #1b1d33;
  color: #fff;
  padding: 0 36px 0 9px;
  outline: none;
}

.song-explorer-search:focus {
  border-color: #b8c7ff;
}

.song-explorer-search-clear-button {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #b8c7ff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.song-explorer-search-clear-button:hover {
  background: rgba(58, 61, 90, 0.32);
}

.song-explorer-search-clear-button:active {
  background: rgba(26, 29, 52, 0.45);
}

.song-explorer-path {
  min-width: 0;
  height: 28px;
  display: flex;
  align-items: center;
  border: 1px solid #4a4f6e;
  border-radius: 4px;
  background: #1b1d33;
  color: #dfe7ff;
  padding: 0 8px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-explorer-status-text {
  min-width: 0;
  color: #b8c7ff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-explorer-list-toolbar {
  min-width: 0;
  min-height: 36px;
  display: flex;
  align-items: center;
  padding: 3px 6px;
  border-bottom: 1px solid rgba(51, 67, 95, 0.55);
  background: rgba(17, 20, 32, 0.95);
}

.song-explorer-folder-up-button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid #4a4f6e;
  border-radius: 4px;
  background: #2a2d4a;
  color: #fff;
  cursor: pointer;
}

.song-explorer-folder-up-button:hover {
  background: #3a3d5a;
}

.song-explorer-folder-up-button:active {
  background: #1a1d34;
}

.song-explorer-folder-up-button img {
  display: block;
  width: 21px;
  height: 21px;
  object-fit: contain;
}

.song-explorer-scroll {
  position: relative;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.song-explorer-scroll.loading .song-explorer-row {
  opacity: 0.58;
}

.song-explorer-loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.song-explorer-loading-spinner {
  width: 42px;
  height: 42px;
  border-width: 4px;
}

.song-explorer-row {
  min-height: var(--remote-playlist-row-height, 46px);
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(51, 67, 95, 0.55);
  background: transparent;
  cursor: pointer;
}

.song-explorer-row:hover {
  background: rgba(96, 138, 255, 0.14);
}

.song-explorer-row.directory {
  background: rgba(255, 3, 231, 0.08);
}

.song-explorer-row.previewing {
  background: rgba(68, 208, 109, 0.16);
}

.song-explorer-status-cell {
  grid-column: 1;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  overflow: visible;
}

.song-explorer-status-icon {
  display: block;
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.song-explorer-song-cell {
  grid-column: 2;
}

.song-explorer-rating-slot {
  min-width: 22px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
}

.song-explorer-rating-star {
  position: relative;
  width: 17px;
  height: 17px;
  display: block;
  font-size: 0;
  line-height: 0;
}

.song-explorer-rating-frame,
.song-explorer-rating-fill {
  position: absolute;
  inset: 0;
  display: block;
}

.song-explorer-rating-frame {
  background: var(--rating-frame-color);
  -webkit-mask: url("/Images/StarFrame.png") center / contain no-repeat;
  mask: url("/Images/StarFrame.png") center / contain no-repeat;
}

.song-explorer-rating-fill {
  background: var(--rating-fill-color);
  -webkit-mask: url("/Images/StarWhite.png") center / contain no-repeat;
  mask: url("/Images/StarWhite.png") center / contain no-repeat;
  clip-path: inset(var(--rating-fill-top) 0 var(--rating-fill-bottom) 0);
}

.playlist-panel *,
.playlist-panel *::before,
.playlist-panel *::after {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  -webkit-tap-highlight-color: transparent;
}

.playlist-panel ::selection {
  background: transparent;
}

.playlist-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) var(--remote-drag-column-width, 42px);
  align-items: center;
  gap: 4px;
}

.playlist-scroll {
  position: relative;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.playlist-loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.playlist-loading-spinner {
  width: 42px;
  height: 42px;
  border-width: 4px;
}

.playlist-row {
  position: relative;
  min-height: var(--remote-playlist-row-height, 46px);
  padding: 6px 0;
  border-bottom: 1px solid rgba(51, 67, 95, 0.55);
  background: transparent;
  cursor: pointer;
}

.playlist-row.playing {
  background: rgba(255, 0, 0, 0.125);
}

.playlist-row.next {
  background: rgba(255, 255, 0, 0.125);
}

.playlist-row.copying {
  background: rgba(255, 165, 0, 0.125);
}

.playlist-row.analyzing {
  background: rgba(0, 255, 255, 0.125);
}

.playlist-row.missing {
  background: rgba(47, 111, 211, 0.188);
}

.playlist-row.stored-song-audio-settings:not(.missing) .song-name,
.playlist-row.stored-song-audio-settings:not(.missing) .time {
  color: #a6ffb3;
}

.playlist-row.missing .song-name,
.playlist-row.missing .time {
  color: #86c5ff;
}

.playlist-row.selected {
  background: rgba(0, 0, 255, 0.25);
}

.playlist-row.selected.playing,
.playlist-row.selected.next,
.playlist-row.selected.copying,
.playlist-row.selected.analyzing,
.playlist-row.selected.missing {
  background:
    linear-gradient(rgba(0, 0, 255, 0.25), rgba(0, 0, 255, 0.25)),
    var(--playlist-status-background);
}

.playlist-row.playing {
  --playlist-status-background: rgba(255, 0, 0, 0.125);
}

.playlist-row.next {
  --playlist-status-background: rgba(255, 255, 0, 0.125);
}

.playlist-row.copying {
  --playlist-status-background: rgba(255, 165, 0, 0.125);
}

.playlist-row.analyzing {
  --playlist-status-background: rgba(0, 255, 255, 0.125);
}

.playlist-row.missing {
  --playlist-status-background: rgba(47, 111, 211, 0.188);
}

.playlist-row.played .song-name {
  opacity: 0.4;
}

.playlist-panel.dragging .playlist-row > * {
  pointer-events: none;
}

.playlist-row.dragging-source {
  opacity: 0.45;
}

.playlist-row.insert-before::before,
.playlist-row.insert-after::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 999px;
  background: var(--line-hot);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.9), 0 0 10px rgba(127, 203, 255, 0.75);
  z-index: 5;
  pointer-events: none;
}

.playlist-row.insert-before::before {
  top: -2px;
}

.playlist-row.insert-after::after {
  bottom: -2px;
}

.drag-safety-zone {
  position: absolute;
  top: 0;
  right: var(--remote-drag-column-width, 42px);
  bottom: 0;
  z-index: 3;
  width: 18px;
  cursor: default;
}

.status-cell {
  grid-column: 1;
  position: relative;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  overflow: visible;
}

.status-main-icon {
  display: block;
  width: 20px;
  height: 20px;
  object-fit: contain;
  transform: scale(var(--status-scale, 1));
  transform-origin: center;
}

.status-cell.playing .status-main-icon {
  transform: scale(var(--status-playing-scale, 1.2));
}

.status-cell.blink .status-main-icon {
  animation: status-blink 0.2s steps(1, end) infinite;
}

.status-headphone {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  object-fit: contain;
  z-index: 2;
}

.status-copy-overlay {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 12px;
  height: 12px;
  z-index: 2;
}

.status-copy-overlay::before,
.status-copy-overlay::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 8px;
  border: 1px solid #ffb347;
  border-radius: 1px;
  background: #1c1c1c;
}

.status-copy-overlay::before {
  left: 0;
  bottom: 0;
  background: #050505;
}

.status-copy-overlay::after {
  top: 0;
  right: 0;
}

@keyframes status-blink {
  0%,
  49% {
    opacity: 1;
  }

  50%,
  100% {
    opacity: 0;
  }
}

.time {
  color: #f5f5dc;
  font-family: Consolas, monospace;
  font-size: 11px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-cell {
  grid-column: 2;
  position: relative;
  min-width: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto;
  gap: 1px;
}

.song-meta {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
}

.song-name {
  min-width: 0;
  width: 100%;
  padding-right: 0;
  color: #f5f5dc;
  font-family: Consolas, monospace;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tags {
  min-width: 0;
  max-width: min(72vw, 100%);
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  overflow: hidden;
  white-space: nowrap;
  pointer-events: none;
}

.tag {
  max-width: 92px;
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 2px 7px;
  color: white;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drag-handle {
  grid-column: 3;
  justify-self: start;
  width: var(--remote-drag-handle-width, 36px);
  height: var(--remote-drag-handle-height, 34px);
  min-height: var(--remote-drag-handle-height, 34px);
  display: grid;
  place-items: center;
  border: 1px solid #4a5e86;
  border-radius: 8px;
  background: #232845;
  cursor: grab;
  padding: 0;
  font: inherit;
  touch-action: none;
}

.drag-handle span,
.drag-handle::before,
.drag-handle::after {
  content: "";
  display: block;
  width: 14px;
  height: 2px;
  border-radius: 1px;
  background: #dce7ff;
}

.drag-handle {
  gap: 3px;
}

.playlist-context-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: transparent;
}

.playlist-context-menu {
  position: fixed;
  top: clamp(8px, var(--playlist-context-menu-top, 8px), calc(100dvh - 300px));
  left: clamp(8px, var(--playlist-context-menu-left, 8px), calc(100vw - 328px));
  z-index: 61;
  width: min(320px, calc(100vw - 16px));
  max-height: calc(100dvh - 16px);
  padding: 8px;
  border: 1px solid #536a96;
  border-radius: 8px;
  background: rgba(22, 33, 50, 0.98);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.42);
  display: grid;
  gap: 6px;
  overflow-y: auto;
}

.playlist-context-menu-button {
  width: 100%;
  min-height: 59px;
  padding: 0 17px;
  border: 1px solid #4a4f6e;
  border-radius: 6px;
  background: #2a2d4a;
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1.15;
  text-align: left;
  white-space: normal;
}

.playlist-context-menu-button:hover {
  background: #3a3d5a;
}

.playlist-context-menu-button:active {
  background: #1a1d34;
}

.playlist-context-menu-button.danger {
  border-color: #8d5362;
  background: #5b2631;
}

.playlist-context-menu-button.danger:hover {
  background: #70313e;
}

.playlist-context-menu-button.danger:active {
  background: #421b23;
}

.playlist-context-menu-button:disabled {
  opacity: 0.45;
  cursor: default;
}

@media (min-width: 760px) {
  .shell {
    padding: 0;
  }

  .now-section {
    min-width: 0;
  }

  .playlist-row {
    min-height: var(--remote-playlist-row-height-wide, 40px);
  }
}
