:root {
  --bg: #121212;
  --bg-elevated: #1b1b1b;
  --bg-card: #222;
  --line: #2e2e2e;
  --text: #f3f3f3;
  --muted: #9a9a9a;
  --accent: #ff9000;
  --accent-dark: #d67800;
}

html,
body {
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
}

html {
  scroll-padding-top: 88px;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: #ffb44a;
}

.navbar {
  background: #0d0d0d;
  border-bottom: 1px solid var(--line);
}

.navbar-brand {
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent) !important;
}

.nav-link {
  color: #d8d8d8 !important;
}

.nav-link.disabled {
  color: #9a9a9a !important;
  opacity: 1;
}

.page-wrap {
  padding: 2rem 0 4rem;
}

.card,
.form-control,
.form-control:focus,
.form-select,
.form-select:focus {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--line);
}

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--line);
  --bs-table-striped-bg: #1a1a1a;
  color: var(--text);
}

.table-dark {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--line);
  --bs-table-hover-bg: #1f1f1f;
}

.form-control:focus,
.form-select:focus {
  box-shadow: 0 0 0 0.2rem rgba(255, 144, 0, 0.2);
}

.form-control::placeholder {
  color: #777;
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #111;
  font-weight: 600;
}

.btn-accent:hover,
.btn-accent:focus {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #111;
}

.hero-card,
.log-box,
.author-card,
.video-card {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.log-box {
  min-height: 180px;
  max-height: 320px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  color: #cfcfcf;
  white-space: pre-wrap;
}

.author-card {
  position: relative;
  transition: transform 0.15s ease, border-color 0.15s ease;
  height: 100%;
}

.author-check {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
}

.author-pick-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding: 4px 2px 0;
}

.author-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-card);
  cursor: pointer;
}

.author-pick-name {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

.badge-keyword {
  background: rgba(255, 144, 0, 0.15);
  color: var(--accent);
  border: 1px solid rgba(255, 144, 0, 0.35);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
}

.badge-keyword:hover {
  color: #ffb44a;
  border-color: #ffb44a;
}

.author-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
}

.stat-item {
  background: #2a2a2a;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  min-width: 88px;
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stat-value {
  font-weight: 700;
}

.author-bio {
  color: #d5d5d5;
  white-space: pre-wrap;
}

.author-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.author-avatar {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--accent);
  background: #333;
}

.author-name {
  color: var(--text);
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.video-card {
  overflow: hidden;
  height: 100%;
}

.thumb-wrap {
  position: relative;
  background: #000;
}

.thumb-wrap img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.badge-duration,
.badge-views {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 12px;
}

.badge-views {
  left: 8px;
  right: auto;
}

.badge-quality {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--accent);
  color: #111;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: 700;
}

.badge-source {
  appearance: none;
  background: rgba(255, 255, 255, 0.06);
  color: #d8d8d8;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
}

.badge-source:hover {
  color: #ffb44a;
  border-color: #ffb44a;
}

.badge-source.is-primary {
  background: rgba(255, 144, 0, 0.18);
  color: var(--accent);
  border-color: rgba(255, 144, 0, 0.45);
}

.video-title {
  color: var(--text);
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.placeholder-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--accent);
  border: 3px solid var(--accent);
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 4rem 1rem;
}

.player-shell {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.player-shell video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #000;
}

.player-shell.is-iframe video {
  display: none;
}

.player-shell iframe.site-frame {
  width: 100%;
  height: min(72vh, 740px);
  min-height: 420px;
  border: 0;
  display: none;
  background: #000;
}

.player-shell.is-iframe iframe.site-frame {
  display: block;
}

.player-status {
  color: var(--muted);
  font-size: 0.92rem;
}

.player-loading {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.62);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease, background 0.22s ease;
}

.player-loading.is-active {
  opacity: 1;
  visibility: visible;
}

.player-loading.is-buffering {
  background: rgba(0, 0, 0, 0.32);
}

.player-shell.is-loading video::-webkit-media-controls {
  display: none !important;
}

.player-loading-mark {
  position: relative;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  filter: drop-shadow(0 0 12px rgba(255, 144, 0, 0.35));
}

.player-loading.is-buffering .player-loading-mark {
  transform: scale(0.78);
}

.player-loading-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(255, 144, 0, 0.2);
  border-top-color: var(--accent);
  animation: player-spin 0.85s linear infinite;
}

.player-loading-ring.is-slow {
  inset: 8px;
  border-width: 2px;
  border-top-color: transparent;
  border-right-color: #ffb44a;
  animation-duration: 1.35s;
  animation-direction: reverse;
}

.player-loading-mark .bi {
  font-size: 1.55rem;
  margin-left: 3px;
  animation: player-pulse 1.2s ease-in-out infinite;
}

.player-loading-text {
  margin: 0;
  max-width: 26rem;
  color: #f3f3f3;
  font-size: 0.95rem;
  text-align: center;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.65);
}

#refresh-btn.is-busy .bi-arrow-repeat,
#download-btn.is-busy .bi {
  display: inline-block;
  animation: player-spin 0.85s linear infinite;
}

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

@keyframes player-pulse {
  0%,
  100% {
    opacity: 0.7;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

#quality-wrap .badge-source {
  cursor: pointer;
}

.settings-nav .nav-link {
  color: var(--muted) !important;
  border: 1px solid var(--line);
  border-radius: 999px;
  margin: 0 8px 8px 0;
  padding: 6px 14px;
}

.settings-nav .nav-link:hover {
  color: #ffb44a !important;
  border-color: #ffb44a;
}

.settings-nav .nav-link.active,
.settings-nav .nav-link.active:hover {
  color: #fff !important;
  -webkit-text-fill-color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

.pagination .page-link {
  background: var(--bg-card);
  border-color: var(--line);
  color: var(--text);
}

.pagination .page-link:hover {
  background: #2a2a2a;
  border-color: var(--accent);
  color: var(--accent);
}

.pagination .page-item.active .page-link {
  background: var(--accent);
  border-color: var(--accent);
  color: #111;
}

.pagination .page-item.disabled .page-link {
  background: var(--bg-elevated);
  color: #666;
  border-color: var(--line);
}

.task-table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--line);
  --bs-table-hover-bg: #1f1f1f;
  margin: 0;
}

.task-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.85rem;
}

.task-title {
  font-weight: 600;
}

.task-row.is-new td {
  box-shadow: inset 3px 0 0 var(--accent);
}

.task-status {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  background: #2a2a2a;
  color: var(--muted);
}

.task-status.is-pending {
  background: #2a2a2a;
  color: #d8d8d8;
}

.task-status.is-running {
  background: rgba(255, 144, 0, 0.2);
  color: var(--accent);
}

.task-status.is-stopping {
  background: rgba(255, 144, 0, 0.12);
  color: #ffb44a;
}

.task-status.is-done {
  background: rgba(46, 184, 92, 0.18);
  color: #6ee7a0;
}

.task-status.is-error {
  background: rgba(220, 53, 69, 0.18);
  color: #ff8a96;
}

.task-status.is-stopped {
  background: #2a2a2a;
  color: #9a9a9a;
}

.task-log {
  min-height: 120px;
}

.album-card,
.photo-card {
  display: block;
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  height: 100%;
  color: inherit;
  text-decoration: none;
  text-align: left;
  padding: 0;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.album-card:hover,
.photo-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  color: inherit;
}

.album-cover img {
  aspect-ratio: 4 / 5;
}

.photo-thumb img {
  aspect-ratio: 3 / 4;
}

body.lightbox-open {
  overflow: hidden;
}

.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1080;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
}

.photo-lightbox-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}

.photo-lightbox img {
  max-width: none;
  max-height: none;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center;
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
  cursor: zoom-in;
  will-change: transform;
}

.photo-lightbox.is-zoomed img {
  cursor: grab;
}

.photo-lightbox.is-panning img {
  cursor: grabbing;
}

.photo-lightbox-close,
.photo-lightbox-nav,
.photo-lightbox-fit {
  position: absolute;
  z-index: 2;
  border: 0;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  border-radius: 999px;
}

.photo-lightbox-close,
.photo-lightbox-nav {
  width: 44px;
  height: 44px;
  font-size: 28px;
  line-height: 1;
}

.photo-lightbox-close {
  top: 16px;
  right: 16px;
}

.photo-lightbox-fit {
  top: 16px;
  right: 68px;
  height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 14px;
}

.photo-lightbox-nav.prev {
  left: 12px;
}

.photo-lightbox-nav.next {
  right: 12px;
}
