/* ===== Base ===== */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", sans-serif;
}

/* ===== Animation ===== */
.fade-in {
  animation: fadeIn 0.4s ease-out both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Video list ===== */
#videoList div {
  border-radius: 8px;
}

#videoList a:hover {
  text-decoration: underline;
}

#videoList .playing {
  background-color: #fffbe6;
  border-left: 4px solid #facc15;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
  line-height: 1.4;
  white-space: nowrap;
}

.meta-label {
  font-weight: 600;
  margin-right: 2px;
  color: #374151;
}

.meta-value {
  margin-right: 16px;
}

.video-item-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  align-items: center;
  overflow-x: auto;
  white-space: nowrap;
  min-width: 0;
}

.video-title {
  flex: 3;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  font-weight: 600;
  color: #1e40af;
}

.video-artist {
  flex: 2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #374151;
}

.video-meta {
  display: flex;
  flex-wrap: nowrap;
  gap: 1rem;
  font-size: 0.875rem;
  color: #4b5563;
  overflow: hidden;
  white-space: nowrap;
}

.video-meta > span:first-child {
  flex: 0 0 auto;
}

.video-meta-waku {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.7rem;
  font-weight: 400;
  color: #6b7280;
}

/* ===== Header and sticky filter area ===== */
header {
  position: static;
  background-color: white;
}

section {
  position: sticky;
  top: 0;
  z-index: 20;
  background-color: white;
  padding-top: 8px;
  padding-bottom: 8px;
}

/* ===== Desktop filter panel ===== */
#desktopFilterPanel {
  max-height: min(58vh, 620px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

body.player-visible #desktopFilterPanel {
  max-height: min(36vh, 380px);
}

#desktopFilterPanel .modal-collab-scroll {
  max-height: 96px;
}

#desktopSortButtons button,
#desktopFormatTags button,
#desktopRoleTags button,
#desktopCollabLiverTags button,
#desktopCollabUnitTags button,
#filterModal [data-sort] {
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 500;
  padding: 0.25rem 0.75rem;
}

.tag-exclusion-active {
  font-size: 0.75rem !important;
  line-height: 1rem !important;
}

@media (max-height: 820px) {
  #desktopFilterPanel {
    max-height: 48vh;
  }

  body.player-visible #desktopFilterPanel {
    max-height: 32vh;
  }
}

/* ===== Active filter chips ===== */
#activeTagChips {
  position: sticky;
  top: 0;
  z-index: 18;
  margin-bottom: 12px;
  pointer-events: none;
}

#activeTagChipsInner {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.375rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;

  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 0.75rem;
  padding: 0.5rem 0.75rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);

  pointer-events: auto;
}

#activeTagChipsInner .tag-exclusion-chip {
  font-size: 0.75rem !important;
  line-height: 1rem !important;
}

#activeTagChipsInner::-webkit-scrollbar {
  display: none;
}

@media (min-width: 640px) {
  body.desktop-filter-open #activeTagChips {
    display: none !important;
    top: 0 !important;
  }
}

/* ===== Fixed player ===== */
#fixedPlayer {
  display: none;
  bottom: 0;
}

#fixedPlayer .controls-wrapper {
  padding-bottom: 8px;
}

#nowPlayingWrapper {
  background-color: #e0f2fe;
  box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.08);
  height: auto;
  padding-top: 2px;
  padding-bottom: 4px;
}

#playerResizeHandle {
  position: absolute;
  top: -10px;
  left: 0;
  width: 100%;
  height: 12px;
  cursor: ns-resize;
  z-index: 5;
  background: transparent;
  touch-action: none;
}

#playerResizeHandle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 4px;
  transform: translateX(-50%);
  width: 56px;
  height: 4px;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.25);
}

/* ===== Player controls ===== */
.random-auto-play-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: transparent;
  border: none;
  padding: 0;
  transition: opacity 0.2s ease, transform 0.1s ease;
}

.random-auto-play-btn img {
  width: 24px;
  height: 24px;
}

.random-auto-play-btn.is-off {
  opacity: 0.35;
}

.random-auto-play-btn.is-on {
  opacity: 1;
  background: transparent;
}

.random-auto-play-btn:active {
  transform: scale(0.96);
}

.auto-play-notice {
  font-size: 12px;
  color: #6b7280;
  text-align: center;
  margin-top: -4px;
  margin-bottom: 4px;
}

/* ===== Filter modal sections ===== */
.modal-section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 700;
}

.modal-section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

.modal-subsection-title {
  margin-top: 8px;
  margin-bottom: 4px;
  color: #9ca3af;
  font-size: 11px;
  font-weight: 700;
}

.modal-collab-scroll {
  max-height: 116px;
  overflow-y: auto;
  padding: 4px 4px 4px 0;
}
