:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #17191f;
  --panel-2: #1e222a;
  --panel-3: #252a33;
  --line: #343b47;
  --text: #f3f0e8;
  --muted: #a9abb2;
  --soft: #d7d2c6;
  --cyan: #7bdff2;
  --green: #90e0a8;
  --pink: #ff8ab3;
  --amber: #f3c969;
  --red: #ff6b6b;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
  font-family:
    Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(123, 223, 242, 0.09), transparent 30%),
    linear-gradient(225deg, rgba(255, 138, 179, 0.08), transparent 28%),
    var(--bg);
  color: var(--text);
}

body[data-theme="liquid"] {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: rgba(255, 255, 255, 0.62);
  --panel-2: rgba(255, 255, 255, 0.5);
  --panel-3: rgba(235, 241, 250, 0.72);
  --line: rgba(80, 99, 128, 0.2);
  --text: #172033;
  --muted: #617086;
  --soft: #253047;
  --cyan: #007aff;
  --green: #1f9d61;
  --pink: #e84f83;
  --amber: #a66a00;
  --red: #d83a3a;
  --shadow: 0 22px 65px rgba(52, 73, 104, 0.18);
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.96), rgba(224, 238, 255, 0.78) 44%, rgba(255, 242, 248, 0.88)),
    var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  height: 100vh;
  padding: 22px 14px;
  border-right: 1px solid var(--line);
  background: rgba(18, 19, 24, 0.88);
  backdrop-filter: blur(18px);
}

.sidebar-bottom {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.theme-switcher {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.theme-switcher span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.theme-switcher select {
  min-height: 34px;
  padding: 0 8px;
  font-size: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-mark {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(123, 223, 242, 0.45);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(123, 223, 242, 0.18), rgba(255, 138, 179, 0.16)),
    var(--panel-2);
  color: var(--cyan);
  font-size: 18px;
  font-weight: 800;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.section-head h3,
.section-head p,
.metric-card p,
.metric-card span,
.movie-card p,
.empty-state p,
.settings-row p {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  letter-spacing: 0;
}

.brand p {
  display: none;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--soft);
  text-align: left;
}

.nav-item-with-action {
  position: relative;
  padding-right: 40px;
}

.nav-add-button {
  position: absolute;
  right: 9px;
  top: 50%;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--cyan);
  font-size: 18px;
  line-height: 1;
  transform: translateY(-50%);
}

.nav-add-button:hover {
  border-color: rgba(123, 223, 242, 0.5);
  filter: brightness(1.1);
  transform: translateY(-50%);
}

.nav-item:hover,
.nav-item.active {
  border-color: rgba(123, 223, 242, 0.34);
  background: rgba(123, 223, 242, 0.1);
  color: var(--text);
}

.nav-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: var(--cyan);
}

.media-library-nav {
  display: grid;
  gap: 8px;
  padding: 0 0 4px 30px;
}

.media-library-nav.collapsed {
  display: none;
}

.media-library-nav > span,
.media-library-nav > .icon-button {
  display: none;
}

.media-library-nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.icon-button {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--cyan);
  font-size: 18px;
  line-height: 1;
}

.media-library-list {
  display: grid;
  gap: 6px;
}

.media-library-item {
  position: relative;
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 54px;
  padding: 8px 62px 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--soft);
  text-align: left;
}

.media-library-item:hover,
.media-library-item.active {
  border-color: rgba(123, 223, 242, 0.35);
  background: rgba(123, 223, 242, 0.09);
}

.media-library-item span {
  overflow: hidden;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-library-item .media-library-name {
  overflow: visible;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.media-library-item small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-library-actions {
  position: absolute;
  right: 6px;
  top: 50%;
  display: flex;
  gap: 4px;
  overflow: visible;
  transform: translateY(-50%);
}

.library-action-button {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(123, 223, 242, 0.08);
  color: var(--cyan);
  font-size: 11px;
  font-weight: 800;
}

.library-action-button.danger {
  background: rgba(255, 107, 107, 0.08);
  color: var(--red);
}

.sidebar-status {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.sidebar-status strong {
  display: block;
  font-size: 13px;
}

.sidebar-status p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.app-version {
  margin: -4px 2px 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.app-version a {
  color: inherit;
  text-decoration: none;
}

.app-version a:hover {
  color: var(--cyan);
  text-decoration: underline;
}

.status-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(144, 224, 168, 0.13);
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.eyebrow {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 700;
}

.topbar h2 {
  margin-top: 4px;
  font-size: clamp(26px, 3vw, 42px);
}

.topbar-actions,
.button-row,
.movie-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.actor-card-size-control {
  display: none;
}

body[data-view="actors"] .actor-card-size-control {
  display: inline-flex;
}

.card-size-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--cyan);
}

.card-size-control span {
  font-size: 16px;
  line-height: 1;
}

.card-size-control input {
  width: 120px;
  min-height: auto;
  padding: 0;
  accent-color: var(--cyan);
  background: transparent;
}

body:not([data-view="actors"]) .topbar .actor-card-size-control {
  display: none !important;
}

body[data-view="actors"] .topbar .actor-card-size-control {
  display: inline-flex !important;
}

.action-row-break {
  flex: 0 0 100%;
  height: 0;
}

.primary-button,
.ghost-button,
.small-button {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid transparent;
  color: var(--text);
}

.primary-button {
  padding: 0 18px;
  background: linear-gradient(135deg, #1f9bb0, #b94974);
  box-shadow: 0 10px 22px rgba(31, 155, 176, 0.18);
  font-weight: 700;
}

.ghost-button,
.small-button {
  background: var(--panel-2);
  border-color: var(--line);
}

.ghost-button {
  padding: 0 16px;
}

.small-button {
  min-height: 34px;
  padding: 0 12px;
  color: var(--soft);
  font-size: 13px;
}

.small-button.light-button,
.ghost-button.light-button {
  background: #d9dce2;
  border-color: #eceff3;
  color: #1d2028;
  font-weight: 700;
}

.small-button.light-button:hover,
.ghost-button.light-button:hover {
  background: #f0f2f5;
}

.primary-button:hover,
.ghost-button:hover,
.small-button:hover {
  filter: brightness(1.08);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card,
.scrape-card,
.log-panel,
.settings-card,
.movie-list-panel,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 25, 31, 0.82);
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 130px;
  padding: 18px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  display: block;
  margin: 10px 0 6px;
  color: var(--text);
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1;
}

.metric-card p {
  color: var(--muted);
  font-size: 13px;
}

.metric-card.accent strong {
  color: var(--amber);
  font-size: clamp(20px, 2vw, 28px);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 160px 170px;
  gap: 12px;
  margin-bottom: 18px;
}

.search-box,
.select-box,
.form-grid label {
  display: grid;
  gap: 8px;
}

.search-box span,
.select-box span,
.form-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: #111319;
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(123, 223, 242, 0.13);
}

.card-size-control input[type="range"] {
  width: 120px;
  min-height: auto;
  padding: 0;
  border: 0;
  box-shadow: none;
  accent-color: var(--cyan);
  background: transparent;
}

.card-size-control input[type="range"]:focus {
  border-color: transparent;
  box-shadow: none;
}

.compact-select {
  width: auto;
  min-width: 120px;
  min-height: 34px;
  padding: 0 10px;
}

body[data-theme="liquid"] .sidebar,
body[data-theme="liquid"] .theme-switcher,
body[data-theme="liquid"] .sidebar-status,
body[data-theme="liquid"] .metric-card,
body[data-theme="liquid"] .scrape-card,
body[data-theme="liquid"] .log-panel,
body[data-theme="liquid"] .settings-card,
body[data-theme="liquid"] .movie-list-panel,
body[data-theme="liquid"] .detail-panel,
body[data-theme="liquid"] .movie-card,
body[data-theme="liquid"] .actor-card,
body[data-theme="liquid"] .modal-panel,
body[data-theme="liquid"] .modal-movie-card,
body[data-theme="liquid"] .media-library-item,
body[data-theme="liquid"] .icon-button,
body[data-theme="liquid"] .nav-add-button,
body[data-theme="liquid"] .library-action-button,
body[data-theme="liquid"] .movie-detail-artwork-pane,
body[data-theme="liquid"] .detail-artwork-placeholder,
body[data-theme="liquid"] .storage-root,
body[data-theme="liquid"] .directory-row {
  background: var(--panel);
  backdrop-filter: blur(28px) saturate(1.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 24px 70px rgba(74, 96, 128, 0.16);
}

body[data-theme="liquid"] .nav-item:hover,
body[data-theme="liquid"] .nav-item.active,
body[data-theme="liquid"] .media-library-item:hover,
body[data-theme="liquid"] .media-library-item.active {
  background: rgba(255, 255, 255, 0.58);
}

body[data-theme="liquid"] input,
body[data-theme="liquid"] select,
body[data-theme="liquid"] textarea,
body[data-theme="liquid"] .queue-toggle,
body[data-theme="liquid"] .detail-rating,
body[data-theme="liquid"] .card-size-control,
body[data-theme="liquid"] .ghost-button,
body[data-theme="liquid"] .small-button {
  background: rgba(255, 255, 255, 0.54);
  color: var(--text);
}

body[data-theme="liquid"] .primary-button {
  background: linear-gradient(135deg, #007aff, #ff5e8a);
  color: white;
}

body[data-theme="liquid"] .small-button.light-button,
body[data-theme="liquid"] .ghost-button.light-button {
  background: rgba(244, 246, 250, 0.92);
  border-color: rgba(255, 255, 255, 0.74);
}

body[data-theme="liquid"] .tag {
  border-color: rgba(232, 79, 131, 0.44);
  background: rgba(255, 255, 255, 0.62);
  color: #26324a;
}

textarea {
  min-height: 92px;
  padding: 10px 12px;
  line-height: 1.5;
  resize: vertical;
}

.movie-layout {
  display: block;
}

.movie-list-panel {
  position: relative;
}

.movie-list-panel > .movie-card-size-control {
  position: absolute;
  right: 18px;
  top: 20px;
  z-index: 1;
}

.library-path-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  max-width: min(640px, 58%);
  padding-right: 210px;
  text-align: right;
}

.library-path-tools strong {
  display: block;
  color: var(--soft);
}

.library-path-tools p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.library-path-tools .button-row {
  flex-shrink: 0;
}

.library-path-tools.is-default .small-button.light-button {
  display: none;
}

.source-select-control {
  display: flex;
  gap: 8px;
}

.source-select-control select {
  min-width: 0;
}

.source-select-control .small-button {
  flex: 0 0 auto;
  min-width: 64px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.section-head h3 {
  font-size: 18px;
}

.section-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.movie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--movie-card-min, 250px), 1fr));
  gap: 14px;
  padding: 18px;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 18px 18px;
  color: var(--muted);
  font-size: 13px;
}

.pagination-top {
  justify-content: flex-end;
  padding: 14px 18px 0;
}

.pagination-bar span {
  min-width: 180px;
  text-align: center;
}

.movie-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  min-height: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.movie-card.selected {
  border-color: rgba(123, 223, 242, 0.68);
}

.poster {
  display: grid;
  width: 100%;
  min-height: 0;
  aspect-ratio: 16 / 9;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(160deg, rgba(123, 223, 242, 0.3), transparent 44%),
    linear-gradient(25deg, rgba(255, 138, 179, 0.25), transparent 50%),
    #242832;
}

.poster span {
  display: block;
  width: 62px;
  height: 38px;
  border: 2px solid rgba(243, 240, 232, 0.68);
  border-radius: 5px;
  box-shadow: inset 0 -14px 0 rgba(243, 201, 105, 0.24);
}

.poster img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.movie-card-body {
  display: grid;
  min-width: 0;
  gap: 8px;
  cursor: pointer;
}

.movie-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.movie-title {
  display: block;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.35;
}

.movie-code {
  color: var(--cyan);
  font-size: 13px;
  font-weight: 700;
}

.movie-meta,
.movie-path {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-overflow: ellipsis;
}

.movie-path {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.status-pill {
  flex: 0 0 auto;
  height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(243, 201, 105, 0.14);
  color: var(--amber);
  font-size: 12px;
  font-weight: 700;
}

.status-pill.ready {
  background: rgba(144, 224, 168, 0.14);
  color: var(--green);
}

.queue-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #151820;
  color: var(--soft);
  font-size: 13px;
}

.queue-toggle input {
  width: 15px;
  min-height: 15px;
  accent-color: var(--cyan);
}

.rating-control {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 34px;
}

.heart-button {
  display: grid;
  width: 24px;
  height: 30px;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--pink);
  font-size: 20px;
  line-height: 1;
  padding: 0;
}

.heart-button:hover {
  color: #ffc1d5;
  transform: translateY(-1px);
}

.detail-panel {
  position: sticky;
  top: 24px;
  min-height: 460px;
}

.empty-state {
  display: grid;
  min-height: 460px;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
}

.empty-state span {
  color: var(--cyan);
  font-size: 44px;
}

.empty-state h3 {
  margin: 0;
}

.empty-state p {
  max-width: 260px;
  color: var(--muted);
  line-height: 1.6;
}

.movie-detail {
  padding: 18px;
}

.detail-artwork {
  width: 100%;
  max-height: 260px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: var(--panel-3);
}

.detail-rating {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #151820;
}

.detail-rating span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.movie-detail h3 {
  margin: 0 0 6px;
  overflow-wrap: anywhere;
  font-size: 24px;
}

.detail-code {
  margin: 0 0 18px;
  color: var(--cyan);
  font-weight: 700;
}

.detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 16px;
  gap: 12px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.detail-list li {
  display: grid;
  gap: 5px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.detail-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.detail-list strong {
  overflow-wrap: anywhere;
  color: var(--soft);
  font-weight: 600;
}

.movie-detail-info-pane .detail-list li:nth-child(6),
.movie-detail-info-pane .detail-list li:nth-child(9) {
  grid-column: 1 / -1;
}

.movie-detail-info-pane .detail-list li:nth-child(7),
.movie-detail-info-pane .detail-list li:nth-child(8) {
  display: none;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.tag {
  padding: 5px 9px;
  border: 1px solid rgba(255, 138, 179, 0.28);
  border-radius: 999px;
  background: rgba(255, 138, 179, 0.1);
  color: #ffd8e5;
  font-size: 12px;
}

.actor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--actor-card-min, 260px), 1fr));
  gap: 14px;
}

.actor-card {
  min-height: 170px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(155deg, rgba(144, 224, 168, 0.1), transparent 45%),
    var(--panel);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.actor-card:hover {
  border-color: rgba(123, 223, 242, 0.54);
}

.actor-avatar {
  display: grid;
  width: clamp(54px, calc(var(--actor-card-min, 260px) * 0.28), 104px);
  height: clamp(54px, calc(var(--actor-card-min, 260px) * 0.28), 104px);
  margin-bottom: 16px;
  place-items: center;
  border-radius: 8px;
  background: var(--panel-3);
  color: var(--green);
  font-size: clamp(24px, calc(var(--actor-card-min, 260px) * 0.11), 42px);
  font-weight: 800;
  overflow: hidden;
}

.actor-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.actor-card h3 {
  margin: 0 0 8px;
}

.actor-card p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.scraper-layout,
.settings-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.scrape-card,
.settings-card,
.log-panel {
  overflow: hidden;
}

.form-grid {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.full-width {
  width: 100%;
}

.batch-list {
  display: grid;
  max-height: 380px;
  overflow: auto;
  padding: 12px 18px 18px;
}

.batch-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 56px;
  border-bottom: 1px solid var(--line);
}

.batch-item input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--cyan);
}

.batch-item strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.batch-item span {
  color: var(--muted);
  font-size: 12px;
}

.log-panel {
  margin-top: 18px;
}

.scrape-log {
  display: grid;
  gap: 8px;
  min-height: 180px;
  max-height: 320px;
  margin: 0;
  padding: 18px 18px 18px 42px;
  overflow: auto;
}

.scrape-log li {
  color: var(--soft);
  font-size: 13px;
  line-height: 1.6;
}

.scrape-log time {
  color: var(--cyan);
  font-weight: 700;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-top: 1px solid var(--line);
}

.settings-row strong {
  display: block;
  margin-bottom: 5px;
}

.settings-row p {
  color: var(--muted);
  line-height: 1.5;
}

.settings-row select {
  max-width: 210px;
}

.donate-panel {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-top: 1px solid var(--line);
}

.donate-panel strong,
.donate-panel p {
  margin: 0;
}

.donate-panel p {
  color: var(--muted);
  line-height: 1.5;
}

.donate-qr-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
}

.donate-qr-list img {
  width: min(180px, calc(50% - 6px));
  height: 180px;
  object-fit: contain;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.stacked-row {
  align-items: stretch;
  flex-direction: column;
}

.stacked-row input {
  max-width: none;
}

.hidden {
  display: none;
}

.empty-list {
  padding: 26px;
  color: var(--muted);
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(10px);
}

.modal-backdrop.hidden {
  display: none;
}

.modal-panel {
  width: min(960px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 4px 0 0;
  font-size: 22px;
}

.movie-detail-modal-panel {
  width: min(1040px, 100%);
}

.movie-detail-modal-body {
  padding: 18px;
}

.movie-detail-shell {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.movie-detail-info-pane {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.movie-detail-artwork-pane {
  display: grid;
  min-height: 360px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.movie-detail-artwork-pane .detail-artwork {
  width: 100%;
  max-height: min(620px, calc(100vh - 180px));
  margin: 0;
  border: 0;
  object-fit: contain;
}

.detail-artwork-placeholder {
  display: grid;
  width: 100%;
  min-height: 360px;
  place-items: center;
  color: var(--muted);
  background:
    linear-gradient(160deg, rgba(123, 223, 242, 0.22), transparent 44%),
    linear-gradient(25deg, rgba(255, 138, 179, 0.2), transparent 50%),
    var(--panel-3);
}

.movie-detail-info-pane h3 {
  margin: 0 0 6px;
  overflow-wrap: anywhere;
  font-size: 24px;
  line-height: 1.28;
}

.detail-gallery {
  display: grid;
  grid-column: 1;
  gap: 10px;
}

.detail-gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.detail-gallery-head strong {
  color: var(--soft);
  font-size: 16px;
}

.detail-preview-carousel {
  position: relative;
  display: grid;
  min-height: 220px;
  place-items: center;
  overflow: hidden;
  padding: 10px 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.detail-preview-carousel img {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border-radius: 6px;
  background: var(--panel-3);
}

.gallery-nav-button {
  position: absolute;
  top: 50%;
  display: grid;
  width: 34px;
  height: 46px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 19, 25, 0.78);
  color: var(--text);
  font-size: 28px;
  line-height: 1;
  transform: translateY(-50%);
}

.gallery-nav-button:first-of-type {
  left: 10px;
}

.gallery-nav-button:last-of-type {
  right: 10px;
}

.gallery-nav-button:disabled {
  cursor: default;
  opacity: 0.35;
}

.detail-gallery-item {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.detail-gallery-item img {
  width: 100%;
  max-height: 160px;
  object-fit: contain;
  border-radius: 6px;
  background: var(--panel-3);
}

.detail-gallery-item figcaption {
  display: grid;
  gap: 3px;
}

.detail-gallery-item span,
.detail-gallery-empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.detail-gallery-item strong {
  overflow-wrap: anywhere;
  color: var(--soft);
  font-size: 13px;
}

.detail-gallery-empty {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  text-align: center;
}

.detail-controls {
  margin-bottom: 18px;
}

.modal-movie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  padding: 18px;
}

.modal-movie-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  cursor: pointer;
}

.modal-movie-card:hover {
  border-color: rgba(123, 223, 242, 0.54);
}

.modal-poster {
  min-height: 0;
}

.modal-movie-body {
  display: grid;
  gap: 8px;
}

.modal-movie-body strong {
  overflow-wrap: anywhere;
}

.video-hint {
  margin: 0;
  padding: 12px 18px 18px;
  color: #f0f2f5;
  background: rgba(217, 220, 226, 0.08);
  border-top: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.6;
}

.modal-movie-body p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.video-modal-panel {
  width: min(1080px, 100%);
}

#videoPlayer {
  display: block;
  width: 100%;
  max-height: calc(100vh - 170px);
  background: #050507;
}

.directory-modal-panel {
  width: min(960px, 100%);
}

.directory-picker {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 420px;
  border-top: 1px solid var(--line);
}

.storage-list {
  padding: 14px;
  border-right: 1px solid var(--line);
}

.storage-root {
  display: block;
  width: 100%;
  min-height: 42px;
  margin-bottom: 10px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--soft);
  text-align: left;
  cursor: pointer;
}

.storage-root:hover,
.storage-root.active {
  border-color: rgba(123, 223, 242, 0.5);
  background: rgba(123, 223, 242, 0.12);
}

.directory-browser {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  min-width: 0;
}

.directory-toolbar,
.directory-typed-path,
.directory-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.directory-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.directory-typed-path {
  border-bottom: 1px solid var(--line);
}

.directory-typed-path input {
  flex: 1;
  min-width: 0;
}

.directory-toolbar p {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.directory-list {
  padding: 18px;
  overflow: auto;
}

.directory-row {
  display: grid;
  grid-template-columns: 24px 28px minmax(0, 1fr);
  align-items: center;
  width: 100%;
  min-height: 44px;
  margin-bottom: 8px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--soft);
  text-align: left;
  cursor: pointer;
}

.directory-row:hover {
  border-color: rgba(123, 223, 242, 0.35);
  background: rgba(123, 223, 242, 0.09);
}

.directory-row span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.directory-empty {
  margin: 18px;
  color: var(--muted);
}

@media (max-width: 1180px) {
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .movie-layout,
  .scraper-layout,
  .settings-layout {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 18px;
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .media-library-nav {
    grid-column: 1 / -1;
    padding: 0;
  }

  .nav-item {
    justify-content: center;
    min-height: 44px;
  }

  .nav-item span:last-child {
    display: none;
  }

  .sidebar-status {
    display: none;
  }

  .workspace {
    padding: 18px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .library-path-tools {
    align-items: stretch;
    flex-direction: column;
    max-width: none;
    padding-right: 0;
    text-align: left;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .movie-detail-shell {
    grid-template-columns: 1fr;
  }

  .movie-detail-info-pane,
  .detail-gallery {
    grid-column: auto;
    grid-row: auto;
  }

  .directory-picker {
    grid-template-columns: 1fr;
  }

  .storage-list {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .detail-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .metrics-grid,
  .movie-grid {
    grid-template-columns: 1fr;
  }

  .movie-card {
    grid-template-columns: 1fr;
  }

  .poster {
    min-height: 180px;
  }

  .settings-row,
  .section-head,
  .directory-typed-path,
  .source-select-control {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-row select {
    max-width: none;
  }
}
