:root {
  --page-bg: #f2f4f6;
  --surface: #ffffff;
  --surface-hover: #f7f8fa;
  --border: #e5e8eb;
  --text: #191f28;
  --text-muted: #8b95a1;
  --accent: #3182f6;
  --accent-hover: #1b64da;
  --accent-soft: #eaf2fe;
  --queued-bg: #f2f4f6;
  --queued-fg: #8b95a1;
  --downloading-bg: #fff4e5;
  --downloading-fg: #d97a00;
  --done-bg: #e6f9ee;
  --done-fg: #06a35a;
  --failed-bg: #feecee;
  --failed-fg: #f04452;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -12px rgba(15, 23, 42, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --page-bg: #101113;
    --surface: #1c1e22;
    --surface-hover: #24272c;
    --border: #2c2f34;
    --text: #f2f3f5;
    --text-muted: #8b95a1;
    --accent: #4c94fd;
    --accent-hover: #6ba5fd;
    --accent-soft: rgba(76, 148, 253, 0.14);
    --queued-bg: #24272c;
    --queued-fg: #8b95a1;
    --downloading-bg: rgba(217, 122, 0, 0.16);
    --downloading-fg: #f0a83f;
    --done-bg: rgba(6, 163, 90, 0.16);
    --done-fg: #3ecb84;
    --failed-bg: rgba(240, 68, 82, 0.16);
    --failed-fg: #ff6b76;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.5);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  padding: 3.5rem 1.25rem;
  background: var(--page-bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

main {
  max-width: 1240px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.top {
  width: 100%;
  flex-shrink: 0;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.settings-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  padding: 0;
  border-radius: 999px;
  background: var(--queued-bg);
  color: var(--text);
  font-size: 1.45rem;
}

.settings-toggle:hover {
  background: var(--surface-hover);
}

h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.subtitle {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

#kind-tabs {
  position: relative;
  display: flex;
  flex-shrink: 0;
  background: var(--queued-bg);
  border-radius: 999px;
  padding: 0.3rem;
}

#kind-tabs-thumb {
  position: absolute;
  top: 0.3rem;
  left: 0;
  bottom: 0.3rem;
  width: 0;
  background: var(--surface);
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.14), 0 1px 2px rgba(15, 23, 42, 0.08);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.kind-tab {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  padding: 0.55rem 1.25rem;
  font-size: 0.86rem;
  font-weight: 600;
  background: transparent;
  color: var(--text-muted);
  border-radius: 999px;
  transition: color 0.2s ease;
}

.kind-tab-eq {
  display: none;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  width: 0.75rem;
  height: 0.75rem;
  margin-right: 0.4rem;
}

.kind-tab-eq.active {
  display: inline-flex;
  color: var(--accent);
}

.kind-tab:hover .kind-tab-eq.active {
  color: #fff;
}

.kind-tab-eq span {
  width: 2px;
  background: currentColor;
  animation: eq-bounce 0.9s ease-in-out infinite;
}

.kind-tab-eq span:nth-child(1) { height: 40%; animation-delay: -0.6s; }
.kind-tab-eq span:nth-child(2) { height: 100%; animation-delay: -0.3s; }
.kind-tab-eq span:nth-child(3) { height: 65%; animation-delay: 0s; }

@media (prefers-reduced-motion: reduce) {
  .kind-tab-eq span {
    animation: none;
    height: 70%;
  }
}

.kind-tab:hover {
  background: var(--accent);
  color: #fff;
}

.kind-tab.selected,
.kind-tab.selected:hover {
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  cursor: default;
}

.kind-tab:has(.kind-tab-eq.active) {
  color: var(--accent);
}

.kind-tab:has(.kind-tab-eq.active):hover {
  color: #fff;
}

.kind-tab.selected:hover,
.kind-tab.selected:has(.kind-tab-eq.active):hover {
  background: transparent;
  color: var(--accent);
}

.kind-tab.selected:hover .kind-tab-eq.active {
  color: var(--accent);
}

#download-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

#download-form[hidden] {
  display: none;
}

.upload-dropzone[hidden] {
  display: none;
}

.upload-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0.6rem;
  padding: 2.5rem 1rem;
  border: 2px dashed var(--accent);
  border-radius: 16px;
  text-align: center;
  color: var(--accent);
  background: var(--accent-soft);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.upload-dropzone.dragover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

.upload-dropzone-title {
  margin: 0.2rem 0 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.upload-dropzone-hint {
  margin: 0;
  font-size: 0.8rem;
  opacity: 0.85;
}

.form-error {
  margin: 0 0 0.6rem;
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
  background: var(--failed-bg);
  color: var(--failed-fg);
  font-size: 0.82rem;
  font-weight: 600;
}

#quality-select {
  flex-shrink: 0;
  padding: 0 1rem;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  outline: none;
  box-shadow: var(--shadow);
}

#group-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

#group-form input,
#group-form button {
  font-size: 0.82rem;
  padding: 0.6rem 0.9rem;
}

#url-input,
#group-input {
  flex: 1;
  padding: 0.85rem 1rem;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
  outline: none;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s ease;
}

#url-input:focus,
#group-input:focus {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

#url-input::placeholder,
#group-input::placeholder {
  color: var(--text-muted);
}

button {
  padding: 0.85rem 1.4rem;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

button:hover {
  background: var(--accent-hover);
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* now playing strip */

#now-playing {
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.now-playing-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

#now-playing-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

#player {
  display: none;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.player-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  line-height: 1;
}

.player-toggle:hover {
  background: var(--accent-hover);
}

.player-toggle:disabled {
  background: var(--queued-bg);
  color: var(--text-muted);
  cursor: default;
}

.player-nav {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  border-radius: 999px;
  background: var(--queued-bg);
  color: var(--text-muted);
  font-size: 0.68rem;
  line-height: 1;
}

.player-nav:hover {
  background: var(--surface-hover);
}

.player-nav:disabled {
  opacity: 0.4;
  cursor: default;
}

.player-seek {
  width: 120px;
  accent-color: var(--accent);
}

.player-time {
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.volume-control {
  position: relative;
  display: flex;
  flex-shrink: 0;
}

.volume-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  border-radius: 999px;
  background: var(--queued-bg);
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1;
}

.volume-toggle:hover {
  background: var(--surface-hover);
}

.volume-toggle.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.volume-popup {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  padding: 0.75rem 0.55rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
  z-index: 10;
}

.volume-popup[hidden] {
  display: none;
}

.player-volume {
  accent-color: var(--accent);
  -webkit-appearance: slider-vertical;
  writing-mode: vertical-lr;
  direction: rtl;
  width: 6px;
  height: 90px;
  margin: 0;
}

.video-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.video-modal[hidden] {
  display: none;
}

.video-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
}

.video-modal-content {
  position: relative;
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.video-modal-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.video-modal-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.video-modal-close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 999px;
  background: var(--queued-bg);
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
}

.video-modal-close:hover {
  background: var(--surface-hover);
}

#video-player {
  width: 100%;
  max-height: 70vh;
  border-radius: 12px;
  background: #000;
}

.pdf-modal-content {
  max-width: 900px;
  height: 90vh;
}

#pdf-modal-frame {
  flex: 1;
  width: 100%;
  border: none;
  border-radius: 12px;
  background: #fff;
}

.video-player-wrap {
  position: relative;
}

.video-replay-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.75);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
}

.video-replay-button:hover {
  background: rgba(15, 23, 42, 0.9);
}

.video-replay-button[hidden] {
  display: none;
}

.settings-modal-content {
  max-width: 480px;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.settings-field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.settings-field input {
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--page-bg);
  color: var(--text);
  font-size: 0.86rem;
  outline: none;
}

.settings-field input:focus {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.settings-restart-note {
  margin: 0;
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
}

.settings-footer {
  display: flex;
  justify-content: flex-end;
}

#repeat-toggle {
  flex-shrink: 0;
  padding: 0.45rem 0.85rem;
  font-size: 0.76rem;
  font-weight: 600;
  border-radius: 999px;
  background: var(--queued-bg);
  color: var(--text-muted);
}

#repeat-toggle:hover {
  background: var(--surface-hover);
}

#repeat-toggle.active {
  background: var(--accent-soft);
  color: var(--accent);
}

#shuffle-toggle {
  flex-shrink: 0;
  padding: 0.45rem 0.85rem;
  font-size: 0.76rem;
  font-weight: 600;
  border-radius: 999px;
  background: var(--queued-bg);
  color: var(--text-muted);
}

#shuffle-toggle:hover {
  background: var(--surface-hover);
}

#shuffle-toggle.active {
  background: var(--accent-soft);
  color: var(--accent);
}

/* layout */

.layout {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 1.25rem;
  align-items: stretch;
}

.track-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.track-toolbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.extension-filter {
  flex-shrink: 0;
  padding: 0.7rem 2.2rem 0.7rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
  outline: none;
  box-shadow: var(--shadow);
  cursor: pointer;
}

#search-input {
  flex: 0 1 400px;
  min-width: 0;
  padding: 0.7rem 1rem;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
  outline: none;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s ease;
}

#search-input:focus {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

#search-input::placeholder {
  color: var(--text-muted);
}

.select-mode-toggle {
  flex-shrink: 0;
  padding: 0.65rem 0.9rem;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: var(--shadow);
}

.select-mode-toggle:hover {
  background: var(--accent-hover);
}

.select-mode-toggle.active {
  background: var(--accent-hover);
}

.bulk-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.bulk-bar[hidden] {
  display: none;
}

.select-all-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
}

#bulk-count {
  color: var(--text-muted);
  font-size: 0.82rem;
}

#bulk-group-select {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.8rem;
}

#bulk-move-button {
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
}

#bulk-move-button:hover {
  background: var(--accent-hover);
}

#bulk-move-button:disabled {
  background: var(--queued-bg);
  color: var(--text-muted);
  cursor: default;
}

#bulk-delete-button {
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  background: var(--failed-bg);
  color: var(--failed-fg);
  font-size: 0.8rem;
  font-weight: 600;
}

#bulk-delete-button:hover {
  filter: brightness(0.97);
}

#bulk-delete-button:disabled {
  background: var(--queued-bg);
  color: var(--text-muted);
  cursor: default;
  filter: none;
}

#groups-nav {
  flex-shrink: 0;
  width: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 16px;
  padding: 0.6rem;
  box-shadow: var(--shadow);
}

#groups-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

#group-form {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.6rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

#group-form #group-input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.65rem;
  font-size: 0.78rem;
  border-radius: 8px;
  box-shadow: none;
  border: 1px solid var(--border);
}

#group-form button {
  flex-shrink: 0;
  width: 2rem;
  padding: 0;
  font-size: 1rem;
  border-radius: 8px;
}

.group-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  border-radius: 10px;
}

.group-nav-item.selected {
  background: var(--accent-soft);
}

.group-nav-item.selected::before {
  content: "";
  position: absolute;
  left: -0.6rem;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.group-nav-select {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  background: transparent;
  color: var(--text-muted);
  border: none;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
}

.group-nav-eq {
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  width: 0.7rem;
  height: 0.7rem;
  margin-right: 0.4rem;
  color: var(--accent);
  vertical-align: middle;
}

.group-nav-eq span {
  width: 2px;
  background: currentColor;
  animation: eq-bounce 0.9s ease-in-out infinite;
}

.group-nav-eq span:nth-child(1) { height: 40%; animation-delay: -0.6s; }
.group-nav-eq span:nth-child(2) { height: 100%; animation-delay: -0.3s; }
.group-nav-eq span:nth-child(3) { height: 65%; animation-delay: 0s; }

.group-nav-select:hover {
  background: transparent;
}

.group-nav-item.selected .group-nav-select {
  color: var(--accent);
  font-weight: 800;
}

.group-nav-edit,
.group-nav-delete {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  margin-right: 0.4rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease, color 0.12s ease;
}

.group-nav-item:hover .group-nav-edit,
.group-nav-item:hover .group-nav-delete {
  opacity: 1;
  pointer-events: auto;
}

.group-nav-edit:hover {
  background: transparent;
  color: var(--accent);
}

.group-nav-delete:hover {
  background: transparent;
  color: var(--failed-fg);
}

.group-rename-input {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
  box-shadow: none;
}

@media (hover: none) {
  .group-nav-edit,
  .group-nav-delete {
    opacity: 1;
    pointer-events: auto;
  }
}

/* track list */

#track-panel {
  flex: 1;
  min-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 16px;
  padding: 0.4rem 0.9rem;
  box-shadow: var(--shadow);
}

.track-panel-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.job-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.job-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0.1rem;
  border-bottom: 1px solid var(--border);
}

.job-list li:last-child {
  border-bottom: none;
}

.job-list li:hover .group-select,
.job-list li:hover .rename-button,
.job-list li:hover .delete-button {
  opacity: 1;
  pointer-events: auto;
}

.job-list.thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 1rem;
}

.job-list.thumbnail-grid li.thumbnail-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  padding: 0;
  border-bottom: none;
}

.thumbnail-select {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 1;
}

.thumbnail-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--queued-bg);
  cursor: pointer;
}

.thumbnail-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.thumbnail-preview.thumbnail-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.thumbnail-title {
  position: relative;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0 0.1rem;
}

.thumbnail-title-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thumbnail-title::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 0.4rem);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 320px;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.85);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: normal;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  z-index: 20;
}

.thumbnail-title:hover::after {
  opacity: 1;
}

.thumbnail-ext {
  position: absolute;
  top: 0.4rem;
  left: 0.4rem;
  z-index: 1;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--accent);
  font-size: 0.65rem;
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
}

.thumbnail-download {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
}

.thumbnail-download:hover {
  background: #fff;
  color: var(--accent);
}

.thumbnail-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}

.thumbnail-actions .group-select {
  flex: 1;
  min-width: 0;
}

.job-select {
  flex-shrink: 0;
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent);
}

.job-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 0.88rem;
  font-weight: 500;
}

.job-title-text {
  display: inline-flex;
  white-space: nowrap;
}

.marquee-copy {
  white-space: nowrap;
  padding-right: 2.5rem;
}

.marquee-copy:last-child {
  visibility: hidden;
}

.job-title-text.marquee-active .marquee-copy:last-child {
  visibility: visible;
}

.job-title-text.marquee-active {
  animation-name: marquee-scroll;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

@keyframes marquee-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .job-title-text.marquee-active {
    animation: none;
  }
}

.search-highlight {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 3px;
  padding: 0 1px;
}

.job-size {
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.job-resolution {
  flex-shrink: 0;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--queued-bg);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.now-playing-row .job-title {
  color: var(--accent);
  font-weight: 700;
}

.job-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.play-button {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 999px;
  background: var(--queued-bg);
  border: none;
  color: var(--text);
  font-size: 0.7rem;
  line-height: 1;
}

.play-button:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.now-playing-row .play-button {
  background: var(--accent-soft);
}

.eq {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  width: 0.9rem;
  height: 0.9rem;
}

.eq span {
  width: 2px;
  background: var(--accent);
  animation: eq-bounce 0.9s ease-in-out infinite;
}

.eq span:nth-child(1) { height: 40%; animation-delay: -0.6s; }
.eq span:nth-child(2) { height: 100%; animation-delay: -0.3s; }
.eq span:nth-child(3) { height: 65%; animation-delay: 0s; }

@keyframes eq-bounce {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}

@media (prefers-reduced-motion: reduce) {
  .eq span {
    animation: none;
    height: 70%;
  }
}

.group-select {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.76rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.rename-button {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
}

.rename-button:hover {
  background: transparent;
  color: var(--accent);
}

.delete-button {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  background: transparent;
  color: var(--text);
  border: none;
  opacity: 0;
  pointer-events: none;
}

.delete-button:hover {
  background: transparent;
  color: var(--failed-fg);
}

.track-rename-input {
  width: 100%;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  outline: none;
  box-shadow: none;
}

@media (hover: none) {
  .group-select,
  .rename-button,
  .delete-button {
    opacity: 1;
    pointer-events: auto;
  }
}

.status {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
}

.status-queued { background: var(--queued-bg); color: var(--queued-fg); }
.status-downloading { background: var(--downloading-bg); color: var(--downloading-fg); }
.status-done { background: var(--done-bg); color: var(--done-fg); }
.status-failed { background: var(--failed-bg); color: var(--failed-fg); }

#empty-state {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  padding: 3rem 0;
}

@media (max-width: 960px) {
  .layout {
    flex-direction: column;
  }

  #groups-nav {
    width: 100%;
    height: auto;
  }

  #groups-list {
    flex-direction: row;
    flex-wrap: wrap;
  }
}
