:root {
  --bg: #eef2f6;
  --panel: #ffffff;
  --panel-soft: #f5f7f9;
  --line: #dde4ea;
  --line-soft: #e8edf2;
  --text: #1d2733;
  --muted: #617082;
  --brand: #2f7df6;
  --brand-dark: #1d63d0;
  --brand-soft: #eaf2fe;
  --danger: #c93a3a;
  --ok: #16834c;
  --orange: #e3722c;
  --orange-soft: #fdf0e7;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 10px 28px -18px rgba(15, 23, 42, 0.22);
  --shadow-lg: 0 2px 6px rgba(15, 23, 42, 0.08), 0 18px 44px -20px rgba(15, 23, 42, 0.3);
  --sticky-top: 26px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  background-color: var(--bg);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--text);
  line-height: 1.55;
}

body.has-bg {
  background-color: #d7dfe6;
}

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

button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  min-height: 36px;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

button:hover {
  border-color: #b9c5d0;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(47, 125, 246, 0.24);
  outline-offset: 1px;
}

button.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 1px 2px rgba(29, 99, 208, 0.24);
}

button.primary:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

button.danger {
  color: var(--danger);
  border-color: #f3c1c1;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  min-height: 38px;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 125, 246, 0.12);
}

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin: 14px 0 5px;
  line-height: 1.4;
}

.hidden {
  display: none !important;
}

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

.good {
  color: var(--ok);
  font-weight: 600;
}

.bad {
  color: var(--danger);
  font-weight: 600;
}

#login-screen,
#setup-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.login-box {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 34px 32px;
}

.login-box h1 {
  margin: 0;
  font-size: 24px;
  display: flex;
  align-items: center;
  gap: 9px;
}

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

.login-box .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  font-size: 18px;
}

.login-box .login-hint {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
}
.login-box .login-version {
  margin: 0;
  color: var(--brand-dark);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  width: 100%;
  padding-right: 40px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.password-toggle svg {
  width: 18px;
  height: 18px;
}

.password-toggle:hover {
  color: var(--text);
}

.login-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin-top: 18px;
}

.login-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--text);
  transition: border-color 0.15s ease, color 0.15s ease;
}

.login-links svg {
  width: 19px;
  height: 19px;
}

.login-links a:hover {
  border-color: var(--brand);
  color: var(--brand);
}

#app {
  display: none;
}

/* ---- sidebar ---- */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 232px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 64px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line-soft);
  flex: 0 0 auto;
}

#app:not(.sidebar-collapsed) .sidebar-head {
  justify-content: flex-start;
  padding-left: 14px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 6px 8px;
  margin: 0 -8px;
  border-radius: 8px;
}

.sidebar-brand:hover {
  background: var(--panel-soft);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #59a4ff, var(--brand-dark));
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  flex: 0 0 auto;
  box-shadow: 0 2px 8px rgba(29, 99, 208, 0.28);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  flex: 1 1 auto;
  line-height: 1.2;
  min-width: 0;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.brand-version {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  line-height: 1.2;
}

.sidebar-head-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--muted);
  border-radius: 7px;
}

.sidebar-toggle:hover {
  background: var(--panel-soft);
  color: var(--text);
}

.avatar-wrap {
  position: relative;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
  cursor: pointer;
  display: block;
}

.avatar-lg {
  width: 96px;
  height: 96px;
  display: block;
  margin-bottom: 8px;
}

.avatar-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 148px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 50;
  animation: menu-in 0.12s ease-out;
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.avatar-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 13px;
}

.avatar-menu button:hover {
  background: var(--panel-soft);
}

.cache-confirm-wrap {
  position: relative;
  display: block;
  width: 100%;
}

.cache-confirm {
  position: absolute;
  left: calc(100% + 8px);
  top: 0;
  width: 230px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 12px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cache-confirm p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.cache-confirm .row-actions {
  flex-wrap: nowrap;
  margin-top: 2px;
}

.cache-confirm .row-actions button {
  flex: 1 1 auto;
}

.sidebar-nav {
  flex: 1 1 auto;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 11px 12px;
  min-height: 42px;
  font-size: 14px;
  text-align: left;
  color: var(--text);
  white-space: nowrap;
}

.nav-item:hover {
  background: var(--panel-soft);
}

.nav-item.active {
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 600;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.nav-collapse {
  margin-top: 6px;
  border-top: 1px solid var(--line-soft);
  border-radius: 0 0 8px 8px;
}
.nav-more { display: none; }
.nav-collapse-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 15px;
  font-weight: 700;
  flex: 0 0 18px;
}

.sidebar-foot {
  padding: 12px 10px 14px;
  border-top: 1px solid var(--line-soft);
  flex: 0 0 auto;
}

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
}

.sidebar-logout:hover {
  background: #fdecec;
  color: var(--danger);
}

.sidebar-logout svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

#app.sidebar-collapsed .sidebar {
  width: 72px;
}

#app.sidebar-collapsed .main {
  margin-left: 72px;
}

#app.sidebar-collapsed .view {
  max-width: 1280px;
}

#app.sidebar-collapsed .brand-copy,
#app.sidebar-collapsed .nav-item .nav-label,
#app.sidebar-collapsed .sidebar-logout .nav-label {
  display: none;
}

#app.sidebar-collapsed .sidebar-brand,
#app.sidebar-collapsed .nav-item,
#app.sidebar-collapsed .sidebar-logout {
  justify-content: center;
  padding-left: 8px;
  padding-right: 8px;
}

#app.sidebar-collapsed .sidebar-head {
  padding-left: 8px;
  padding-right: 8px;
}

#app.sidebar-collapsed .avatar-wrap {
  display: none;
}

/* ---- main ---- */

.main {
  margin-left: 232px;
  min-height: 100vh;
  padding: 26px 30px 64px;
  transition: margin-left 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 1440px;
}

.warmup-banner {
  position: fixed;
  top: 14px;
  right: 18px;
  z-index: 1200;
  max-width: min(420px, calc(100vw - 36px));
  padding: 9px 14px;
  border-radius: 7px;
  background: #1d4ed8;
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
}

.warmup-banner.hidden {
  display: none;
}

.view {
  max-width: 1120px;
  margin: 0 auto;
  transition: max-width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.view-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.view-sticky {
  position: sticky;
  top: var(--sticky-top);
  z-index: 30;
  background: var(--bg);
}

.view-sticky::before {
  content: "";
  position: absolute;
  top: calc(-1 * var(--sticky-top));
  left: 0;
  right: 0;
  height: var(--sticky-top);
  background: var(--bg);
  z-index: -1;
}

.home-head.view-sticky {
  top: calc(var(--sticky-top) + 8px);
}

.home-head.view-sticky::before {
  top: calc(-1 * (var(--sticky-top) + 8px));
  height: calc(var(--sticky-top) + 8px);
}

.view-head h2,
.home-title h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.35;
  letter-spacing: 0;
}

.view-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.home-head {
  margin: 8px 0 24px;
}

.home-quick-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}

.home-quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 15px;
  border-radius: 8px;
  background: var(--brand-soft);
  border: 1px solid #c9dcf7;
  color: var(--brand-dark);
  font-weight: 600;
}

.home-quick-btn:hover {
  border-color: var(--brand);
}

.home-quick-btn svg {
  width: 18px;
  height: 18px;
}

.home-title p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.home-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  text-align: left;
  min-height: 128px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.home-card:hover {
  border-color: #b8c9de;
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.home-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.home-icon svg {
  width: 20px;
  height: 20px;
}

.home-card-title {
  font-size: 16px;
  font-weight: 600;
}

.home-card-desc {
  color: var(--muted);
  font-size: 13px;
  margin-top: -4px;
}

.home-stats-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 4px;
}
.home-emby-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.home-emby-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--panel-soft);
  text-align: center;
  min-width: 0;
}
.home-emby-tile strong {
  font-size: 19px;
  color: var(--brand-dark);
  font-variant-numeric: tabular-nums;
}
.home-emby-tile span {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.home-stat-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px 16px;
  min-width: 0;
}
.home-service-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.home-service {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--panel-soft);
}
.home-service .service-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 10px;
  margin-top: 5px;
}
.home-service .service-dot.ok { background: var(--ok); }
.home-service .service-dot.bad { background: var(--danger); }
.home-service .service-name { font-weight: 600; font-size: 13px; }
.home-service .service-detail { font-size: 12px; line-height: 1.5; word-break: break-word; }
.home-count-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.home-count-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--panel-soft);
  text-align: center;
  min-width: 0;
}
.home-count-tile strong { font-size: 19px; color: var(--brand-dark); }
.home-count-tile span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
#home-next-run { margin: 10px 0 0; font-size: 12px; white-space: pre-line; }

/* ---- search ---- */

.search-form-view {
  display: flex;
  gap: 10px;
  max-width: 380px;
  margin: 4px 0 18px;
}

.search-wrap {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}

.search-input {
  padding-left: 42px !important;
  height: 44px;
  min-height: 44px;
  border-radius: 8px;
  border-color: #cdd8e2;
}

.search-submit {
  min-width: 92px;
  height: 44px;
  min-height: 44px;
  border-radius: 8px;
  white-space: nowrap;
}

.search-history {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  min-width: 260px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 50;
}

.search-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 8px 8px;
  font-size: 12px;
  color: var(--muted);
}

.search-history-head button {
  min-height: 0;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 12px;
  color: var(--muted);
  background: var(--panel-soft);
}

.search-history-head button:hover {
  color: var(--danger);
  border-color: #f3c1c1;
}

#history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 4px 6px;
}

.search-history-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: 7px;
  padding: 4px 5px 4px 10px;
  font-size: 13px;
}

.search-history-label {
  border: 0;
  background: transparent;
  padding: 0;
  min-height: 0;
  font-size: 13px;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-history-label:hover {
  color: var(--brand-dark);
}

.search-history-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
}

.search-history-del:hover {
  background: #fdecec;
  color: var(--danger);
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
}

.filter-bar .site-filter-row,
.filter-bar .sort-row {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.filter-bar select {
  width: auto;
  min-width: 132px;
}

.status-line {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-line:not(:empty)::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  flex: 0 0 auto;
}

#results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 12px;
}

#results > .empty {
  grid-column: 1 / -1;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.result {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 15px 17px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  min-height: 190px;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.result:hover {
  border-color: var(--brand-soft);
  box-shadow: var(--shadow);
}

#results .result {
  position: relative;
  height: 200px;
  min-height: 200px;
  overflow: hidden;
  transition: border-color 0.12s, box-shadow 0.12s;
}

#results .result:hover {
  overflow: visible;
}

#results .result-main {
  position: relative;
}

#results .result-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.result.has-cover {
  align-items: stretch;
}

.result-cover {
  flex: 0 0 68px;
  width: 68px;
  min-height: 96px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--panel-soft);
}

.result-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.result-main {
  flex: 1 1 auto;
  min-width: 0;
}

.result-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.result-title {
  font-weight: 600;
  font-size: 15px;
  flex: 1 1 240px;
  min-width: 0;
  word-break: break-word;
  line-height: 1.45;
}

.tag {
  font-size: 11px;
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--panel-soft);
}

.tag.adult {
  color: var(--danger);
  border-color: #f3c1c1;
  background: #fff7f7;
}

.tag.site {
  color: var(--brand-dark);
  border-color: #c9dcf7;
  background: var(--brand-soft);
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 7px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}

.result-meta .size {
  color: var(--orange);
  background: var(--orange-soft);
  border: 1px solid #f5d9c2;
  border-radius: 999px;
  padding: 2px 9px;
  font-weight: 600;
}

.result-meta-primary {
  gap: 12px;
}

.result-meta-secondary {
  margin-top: 2px;
  gap: 10px;
  font-size: 12px;
}

.magnet {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  color: var(--muted);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 10px;
  overflow-wrap: anywhere;
  word-break: break-all;
  line-height: 1.5;
}

#results .magnet {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

#results .result:hover .magnet {
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  z-index: 40;
  margin-top: 0;
  -webkit-line-clamp: unset;
  overflow: visible;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 auto;
  margin-top: 2px;
}

.result-actions button {
  white-space: nowrap;
}

/* ---- generic controls ---- */

.row-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.row-actions input {
  flex: 1 1 180px;
}

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

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

.page-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.page-jump input {
  width: 76px;
  padding: 7px 9px;
}

.page-jump button {
  padding: 7px 11px;
  white-space: nowrap;
}

.token-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.token-row input,
.token-row textarea {
  flex: 1;
  min-width: 0;
}

.token-row button {
  width: 44px;
  flex: 0 0 44px;
  font-size: 16px;
  line-height: 1;
}

.token-row button.wide {
  width: auto;
  flex: 0 0 auto;
  padding: 8px 12px;
  font-size: 13px;
  line-height: normal;
}

.checkbox {
  width: auto;
  accent-color: var(--brand);
  height: 16px;
  min-height: 0;
  padding: 0;
}

.switch-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
}

.list-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  margin-top: 10px;
  background: #fff;
}

.list-item .row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

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

.site-block-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.site-block .site-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.gying-config {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  padding: 8px 10px;
}

.gying-config summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  user-select: none;
}

/* ---- settings ---- */

.settings-layout {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.settings-tabs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 168px;
  position: sticky;
  top: 18px;
}

.settings-tabs button {
  text-align: left;
  padding: 11px 14px;
  border-radius: 7px;
  background: transparent;
  border: 1px solid transparent;
}

.settings-tabs button:hover {
  background: var(--panel);
  border-color: var(--line);
}

.settings-tabs button.active {
  background: var(--brand-soft);
  border-color: #c9dcf7;
  color: var(--brand-dark);
  font-weight: 600;
}

.settings-content {
  flex: 1 1 auto;
  min-width: 0;
}

.admin-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  max-width: 820px;
}

.admin-section h3 {
  margin: 14px 0 2px;
  font-size: 17px;
  position: relative;
  padding-left: 12px;
}

.admin-section h3:first-child {
  margin-top: 0;
}

.admin-section h3::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 3px;
  border-radius: 2px;
  background: var(--brand);
}

.services-wrap {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.settings-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.settings-subtabs button {
  padding: 8px 14px;
  border-radius: 7px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
}

.settings-subtabs button:hover {
  border-color: var(--brand);
}

.settings-subtabs button.active {
  background: var(--brand-soft);
  border-color: #c9dcf7;
  color: var(--brand-dark);
  font-weight: 600;
}

.service-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

.service-section input,
.service-section .token-row,
.service-section select {
  max-width: 560px;
}

#p115-mode,
#p115-qrcode-source {
  width: 100%;
  max-width: 560px;
}

/* ---- subscriptions ---- */

.subs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
  align-items: start;
}

.subs-grid .admin-section {
  max-width: none;
  width: 100%;
}

.subs-list-panel {
  grid-column: 1 / -1;
}

.sub-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  margin-top: 10px;
  background: var(--panel);
}

.sub-row .muted {
  display: block;
  margin-top: 4px;
  font-size: 12px;
}

.sub-status {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}
.sub-status.good { color: var(--ok); font-weight: 600; }
.sub-status.bad { color: var(--danger); font-weight: 600; }
.sub-status.sub-status-pending { color: #b7791f; }

/* ---- movies & actors ---- */

.movie-grid,
.actor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.movie-card,
.actor-card {
  display: flex;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.movie-cover {
  flex: 0 0 96px;
  width: 96px;
  height: 136px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--panel-soft);
  position: relative;
}

.movie-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.movie-cover.missing,
.actor-avatar.missing {
  background: var(--panel-soft);
}

.movie-card.cover-blur .movie-cover img {
  filter: blur(20px) saturate(1.15);
  transform: scale(1.16);
}

.movie-card.cover-off .movie-cover {
  display: none;
}

.actor-avatar {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--brand-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--brand-dark);
}

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

.movie-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.movie-info strong {
  word-break: break-word;
}

.movie-info .muted {
  font-size: 12px;
}

.movie-info .row-actions {
  margin-top: auto;
}

/* ---- background & appearance ---- */

.bg-preview {
  height: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: var(--panel-soft);
  background-size: cover;
  background-position: center;
  margin-top: 10px;
}

.cover-mode-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.cover-mode-option {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
}

.cover-mode-option:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 600;
}

.cover-mode-option input {
  width: auto;
  accent-color: var(--brand);
  height: 15px;
  min-height: 0;
  margin: 0;
}

.avatar-upload {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.path-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.path-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  padding: 5px 6px 5px 11px;
  font-size: 13px;
}

.chip-x {
  width: 20px;
  height: 20px;
  padding: 0;
  min-height: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
}

.chip-x:hover {
  background: #e2e8f0;
  color: var(--danger);
}

/* ---- modal ---- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 60;
  backdrop-filter: blur(3px);
}

.modal-box {
  width: 100%;
  max-width: 460px;
  max-height: 82vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 22px;
}

.modal-box h3 {
  margin-top: 0;
}

#save115-options {
  margin-bottom: 12px;
}

.save-path-option {
  display: block;
  width: 100%;
  margin-top: 8px;
  text-align: left;
  overflow-wrap: anywhere;
}

.path-option {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  padding: 9px 11px;
  margin: 6px 0 0;
  cursor: pointer;
}

.path-option input {
  width: auto;
  accent-color: var(--brand);
}

.qrcode-box {
  text-align: center;
}

.qrcode-img-wrap {
  margin: 12px 0;
}

#qrcode-img {
  width: 220px;
  height: 220px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.dir-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.dir-item.selected {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.net-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  padding: 10px 12px;
  margin-top: 8px;
}

.net-name {
  font-weight: 600;
  font-size: 13px;
}

.net-latency {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.net-latency.good {
  color: var(--ok);
}

.net-latency.bad {
  color: var(--danger);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: #1c2733;
  color: #fff;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 100;
  max-width: min(92vw, 520px);
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.toast.show {
  opacity: 1;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---- responsive ---- */

/* ---- v1.5 sidebar user ---- */

.sidebar-user { position: relative; }
.sidebar-user .user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 8px;
  text-align: left;
  min-width: 0;
}
.sidebar-user .user-card:hover { background: var(--panel-soft); }
.sidebar-user .user-card .avatar { cursor: pointer; }
.sidebar-user .user-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}
.sidebar-user .user-name {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 128px;
}
.avatar-menu.user-menu { left: 0; right: auto; bottom: calc(100% + 8px); top: auto; }
#app.sidebar-collapsed .sidebar-user .user-card { justify-content: center; padding: 8px 0; }
#app.sidebar-collapsed .sidebar-user .user-copy { display: none; }
#app.sidebar-collapsed .sidebar-user .avatar-menu { left: calc(100% + 8px); top: auto; bottom: calc(100% + 8px); }

/* ---- v1.5 home emby ---- */

.emby-home { margin-top: 30px; }
.home-section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 0 10px; }
.home-section-head h3 { margin: 0; font-size: 17px; position: relative; padding-left: 12px; }
.home-section-head h3::before { content: ""; position: absolute; left: 0; top: 3px; bottom: 3px; width: 3px; border-radius: 2px; background: var(--brand); }
.emby-library-list { display: flex; flex-wrap: wrap; gap: 10px; }
.emby-library-chip { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 16px; font-weight: 600; box-shadow: var(--shadow-sm); }
.emby-recent-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.emby-recent-card { display: flex; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-width: 0; }
.emby-recent-cover { width: 52px; height: 76px; flex: 0 0 52px; border-radius: 5px; overflow: hidden; background: var(--brand-soft); color: var(--brand-dark); display: flex; align-items: center; justify-content: center; font-weight: 800; }
.emby-recent-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.emby-recent-copy { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.emby-recent-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emby-recent-copy .muted { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- v1.5 movie & actor cards ---- */

.movie-grid, .actor-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.movie-card, .actor-card { flex-direction: column; min-width: 0; }
.movie-card-main { display: flex; gap: 12px; min-width: 0; }
.movie-cover { flex: 0 0 92px; width: 92px; height: 132px; }
.movie-side { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.movie-number { font-size: 18px; font-weight: 800; line-height: 1.25; word-break: break-all; }
.movie-date { color: var(--muted); font-size: 12px; }
.movie-side .row-actions { margin-top: auto; }
.movie-titles { margin-top: 10px; border-top: 1px solid var(--line-soft); padding-top: 8px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.movie-titles .title-ja, .movie-titles .title-zh { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; line-height: 1.5; }
.movie-titles .title-ja { font-weight: 600; }
.movie-titles .title-zh { color: var(--muted); }
.actor-card { align-items: stretch; }
.actor-card .actor-avatar { width: 100%; height: 120px; border-radius: 6px; flex: 0 0 120px; font-size: 34px; }
.actor-card .actor-avatar img { object-fit: cover; }
.actor-card .actor-name { margin-top: 10px; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actor-card .actor-count { color: var(--muted); font-size: 13px; }
.actor-card .row-actions { margin-top: 10px; }
.actor-card .row-actions button { flex: 1 1 auto; }

/* ---- v1.5.2 card & log polish ---- */

.movie-card { min-height: 258px; }
.movie-card-main { align-items: flex-start; }
.movie-number { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.movie-side { gap: 6px; }
.movie-side .row-actions { margin-top: auto; }
.movie-side .row-actions button { min-height: 28px; padding: 4px 10px; font-size: 12px; }
.movie-side .row-actions button.primary { flex: 0 0 auto; min-width: 68px; padding: 4px 13px; }
.movie-titles { flex: 1 1 auto; min-height: 68px; justify-content: flex-end; }
.movie-titles .title-ja, .movie-titles .title-zh { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 100%; }

.actor-card { display: grid; grid-template-columns: 96px minmax(0, 1fr); grid-template-areas: "avatar copy" "actions actions"; gap: 10px; padding: 12px; min-height: 210px; }
.actor-card .actor-avatar { grid-area: avatar; width: 96px; height: 128px; flex: none; border-radius: 6px; font-size: 26px; }
.actor-card .actor-avatar img { object-fit: cover; }
.actor-card .actor-copy { grid-area: copy; display: flex; flex-direction: column; gap: 6px; min-width: 0; align-self: start; }
.actor-card .actor-name { margin: 0; font-size: 15px; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.actor-card .actor-name.jp { color: var(--text); font-size: 15px; font-weight: 700; }
.actor-card .actor-count { color: var(--muted); font-size: 13px; font-weight: 400; margin-top: 2px; }
.actor-card .actor-actions { grid-area: actions; display: flex; gap: 8px; align-self: end; }
.actor-card .actor-actions button { flex: 1 1 auto; min-height: 30px; font-size: 12px; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 0 4px; flex-wrap: wrap; }

.logs-panel { display: flex; flex-direction: column; gap: 6px; max-height: calc(100vh - 190px); overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.log-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; align-items: start; padding: 8px 10px; border-radius: 6px; background: var(--panel-soft); font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; font-size: 12px; word-break: break-word; }
.log-time { color: var(--muted); }
.log-error .log-text { color: #c0392b; }
.log-warn .log-text { color: #b7791f; }
.log-info .log-text { color: var(--text); }

.result-cover.landscape { flex-basis: 116px; width: 116px; min-height: 66px; height: 66px; }

.disclaimer { margin-top: 10px; font-size: 12px; line-height: 1.7; border-top: 1px solid var(--line-soft); padding-top: 10px; text-align: center; }
#tab-proxy { padding: 14px 18px; }
#tab-proxy .token-row { max-width: 560px; }
#tab-emby .token-row, #tab-emby input, #tab-proxy .token-row, #tab-proxy input { max-width: 560px; }
.actor-tabs, .subs-tabs { display: flex; gap: 8px; margin: 0 0 16px; }
.actor-tabs button, .subs-tabs button { border-radius: 7px; }
.actor-tabs button.active, .subs-tabs button.active { background: var(--brand-soft); border-color: #c9dcf7; color: var(--brand-dark); font-weight: 600; }

/* ---- v1.5 subscription search ---- */

.subs-search-form { display: flex; gap: 10px; max-width: 380px; margin: 0 0 16px; }
.subs-search-results { margin-bottom: 18px; }
.subs-works-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.subs-works-head button {
  border-radius: 7px;
}
.subs-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px; }
.subs-panel h3 { margin: 0 0 4px; font-size: 16px; position: relative; padding-left: 12px; }
.subs-panel h3::before { content: ""; position: absolute; left: 0; top: 3px; bottom: 3px; width: 3px; border-radius: 2px; background: var(--brand); }
.subs-panel .row-actions { justify-content: flex-start; }

/* ---- v1.5 about ---- */

.about-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  margin: 20px 0;
  padding: 24px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.about-card .brand-mark { width: 58px; height: 58px; border-radius: 14px; font-size: 30px; }
.about-card > strong { font-size: 22px; }
.about-version { color: var(--muted); font-size: 14px; }
.about-desc { max-width: 620px; margin: 0; color: var(--muted); line-height: 1.7; }
.about-links { display: flex; align-items: center; justify-content: center; gap: 12px; }
.about-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--text);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.about-link svg { width: 20px; height: 20px; }
.about-link:hover { border-color: var(--brand); color: var(--brand); }
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin: 8px 0 14px;
}
.about-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.about-panel h3 {
  margin: 0 0 8px;
  font-size: 15px;
}
.about-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}
.about-panel ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

@media (max-width: 960px) {
  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    bottom: auto;
    width: 100%;
    height: auto;
    flex-direction: row;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    align-items: center;
  }

  .sidebar-head {
    border-bottom: 0;
    height: 56px;
    padding: 0 10px 0 14px;
    flex: 0 0 auto;
  }

  .sidebar-head-actions .avatar-wrap {
    display: block;
  }

  #app.sidebar-collapsed .avatar-wrap {
    display: block;
  }

  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 2px;
    padding: 6px 8px;
    align-items: center;
    flex: 1 1 auto;
    scrollbar-width: none;
  }

  .sidebar-nav::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
    padding: 9px 11px;
    white-space: nowrap;
  }

  .sidebar-foot {
    display: none;
  }

  .movie-grid, .actor-grid, .emby-recent-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .home-stats-grid {
    grid-template-columns: 1fr;
  }

  .main {
    margin-left: 0;
    padding: 76px 16px 48px;
  }

  .settings-layout {
    flex-direction: column;
  }

  .settings-tabs {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
    flex-basis: auto;
  }

  .settings-tabs button {
    flex: 1 1 auto;
    text-align: center;
  }

  .settings-content {
    width: 100%;
  }

  .admin-section {
    max-width: none;
    width: 100%;
  }
}

@media (max-width: 640px) {
  #app.sidebar-collapsed .sidebar {
    width: 100%;
  }

  #app.sidebar-collapsed .main {
    margin-left: 0;
  }

  #app.sidebar-collapsed .brand-copy,
  #app.sidebar-collapsed .nav-item .nav-label {
    display: inline;
  }

  .sidebar-brand {
    padding: 4px;
  }

  .brand-copy {
    display: none !important;
  }

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

  .home-card {
    min-height: 110px;
    padding: 14px;
  }

  .home-card-desc {
    font-size: 12px;
  }

  .view {
    padding-top: 2px;
  }

  .view-head {
    margin-bottom: 12px;
  }

  #sub-number-list,
  #sub-actor-list {
    grid-template-columns: 1fr;
  }

  .view-head h2,
  .home-title h1 {
    font-size: 19px;
  }

  .search-form-view {
    flex-direction: column;
  }

  .search-submit {
    width: 100%;
  }

  .filter-bar {
    padding: 10px;
  }

  .filter-bar .site-filter-row,
  .filter-bar .sort-row {
    flex: 1 1 auto;
  }

  .filter-bar .site-filter-row span,
  .filter-bar .sort-row span {
    display: none;
  }

  .filter-bar select {
    flex: 1;
    min-width: 0;
  }

  #results {
    grid-template-columns: 1fr;
  }

  .result {
    flex-direction: column;
    padding: 12px;
  }

  .result.has-cover {
    flex-direction: row;
  }

  .result-actions {
    flex-direction: row;
    width: 100%;
  }

  .result-actions button {
    flex: 1 1 auto;
  }

  .result-meta {
    gap: 8px;
  }

  .movie-grid,
  .actor-grid,
  .emby-recent-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-service-grid,
  .home-count-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .admin-section {
    padding: 14px;
  }

  .token-row {
    flex-wrap: wrap;
  }

  .token-row input,
  .token-row textarea {
    flex: 1 1 100%;
  }

  .token-row button {
    flex: 1 1 44px;
  }

  .modal-box {
    padding: 16px;
  }

  .pagination {
    gap: 8px;
  }

  .page-jump {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 420px) {
  .home-grid {
    grid-template-columns: 1fr;
  }

  .movie-grid, .actor-grid, .emby-recent-row {
    grid-template-columns: 1fr;
  }

  .login-box {
    padding: 22px;
  }

  .nav-item {
    padding: 9px 9px;
  }

  .result-title {
    font-size: 14px;
  }
}

/* ---- v1.5.4 card layout / home stats / cover cache ---- */

.movie-card {
  min-height: 258px;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.movie-card-main {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
}
.movie-cover {
  width: 108px;
  height: 156px;
  flex: 0 0 108px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--brand-soft);
}
.movie-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.movie-side {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 6px;
}
.movie-zh {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  word-break: break-word;
}
.movie-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  min-width: 0;
}
.movie-id-line {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.movie-number {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.movie-date {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.movie-sub button {
  min-height: 28px;
  padding: 4px 12px;
  font-size: 12px;
  flex: 0 0 auto;
}
.movie-sub button.primary {
  min-width: 64px;
}

.movie-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.cover-blur .movie-cover img { filter: blur(10px); }
.cover-off .movie-cover { display: none; }

/* ---- home stats as compact rows ---- */
.home-count-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.home-count-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 4px;
  border-bottom: 1px solid var(--line-soft);
}
.home-count-row:last-child { border-bottom: 0; }
.home-count-row span {
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-count-row strong {
  color: var(--brand-dark);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

/* ---- subscription rows with persistent cover thumbs ---- */
.sub-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-soft);
  margin-bottom: 8px;
  min-width: 0;
}
.sub-row-cover {
  width: 52px;
  height: 74px;
  flex: 0 0 52px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--brand-soft);
  color: var(--brand-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
}
.sub-row-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.sub-row-cover.landscape {
  width: 96px;
  height: auto;
  aspect-ratio: 3 / 2;
  flex: 0 0 96px;
}
.sub-row-cover.landscape img {
  object-fit: contain;
  background: var(--panel-soft);
}
.sub-row-cover.missing {
  background: var(--panel);
}
.sub-row-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-start;
}
.sub-row-idx {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.sub-row-title {
  font-size: 15px;
  font-weight: 700;
  word-break: break-word;
}
.sub-row-subtitle {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  display: block;
}
.sub-row-info .sub-status {
  align-self: flex-start;
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 999px;
}
.sub-row-cancel {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
}
.sub-row-cancel:hover {
  border-color: var(--danger);
  color: var(--danger);
}
.subs-list-pagination {
  margin-top: 10px;
}

#sub-number-list,
#sub-actor-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: start;
}

#sub-number-list .sub-row,
#sub-actor-list .sub-row {
  margin-bottom: 0;
}

#sub-number-list .subs-list-pagination,
#sub-actor-list .subs-list-pagination {
  grid-column: 1 / -1;
}

/* ---- subscription search cover fills left side ---- */
.subs-search-results .result {
  align-items: stretch;
}
.subs-search-results .result-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.subs-search-results .result-actions {
  margin-top: auto;
}

/* ---- log badges ---- */
.log-row {
  grid-template-columns: 150px 88px minmax(0, 1fr);
}
.log-badge {
  justify-self: start;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.log-time {
  font-size: 11px;
}

.home-check-feedback {
  margin-top: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
}
.mini-log-head {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.home-check-feedback .log-row {
  grid-template-columns: 132px minmax(0, 1fr);
}

/* ---- proxy input matches emby URL ---- */
#tab-proxy {
  padding: 14px 18px;
}
#tab-proxy .token-row,
#tab-emby .token-row {
  max-width: 560px;
  width: 100%;
}
#tab-proxy .token-row input,
#tab-emby .token-row input {
  max-width: none;
  flex: 1 1 auto;
  min-width: 0;
}

@media (max-width: 960px) {
  .movie-grid, .actor-grid, .emby-recent-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .movie-grid, .actor-grid, .emby-recent-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .log-row {
    grid-template-columns: 110px 74px minmax(0, 1fr);
  }
}
@media (max-width: 420px) {
  .movie-grid, .actor-grid, .emby-recent-row {
    grid-template-columns: 1fr;
  }
}

/* ---- v1.7.0 ---- */
.movie-card { min-height: 0; }
.movie-card-main { align-items: stretch; height: 100%; }
.movie-side { height: 100%; }
.movie-zh {
  flex: 1 1 auto;
  min-height: 156px;
  -webkit-line-clamp: 8;
  line-clamp: 8;
}
.movie-foot { margin-top: 10px; }

.home-count-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 14px;
}
.home-count-row {
  padding: 7px 2px;
  justify-content: flex-start;
  gap: 6px;
}
.home-service { padding: 8px 10px; }

.emby-recent-carousel {
  display: flex;
  align-items: stretch;
  gap: 10px;
}
.emby-recent-carousel > button {
  flex: 0 0 34px;
  align-self: center;
  min-height: 34px;
  padding: 0;
  font-size: 16px;
  border-radius: 7px;
}
.emby-recent-grid { flex: 1 1 auto; min-width: 0; overflow: hidden; }
.emby-recent-row { display: flex; flex-wrap: nowrap; gap: 10px; width: max-content; max-width: none; transition: transform 0.25s ease; will-change: transform; }
.emby-recent-card {
  position: relative;
  display: block;
  padding: 0;
  overflow: hidden;
  aspect-ratio: 2 / 3;
  flex: 0 0 128px;
  width: 128px;
  border-radius: 6px;
}
.emby-recent-cover { width: 100%; height: 100%; flex: none; border-radius: 0; }
.emby-recent-cover.missing { color: var(--muted); font-size: 14px; }
.emby-recent-tip {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 8px 10px;
  background: rgba(15, 23, 32, 0.82);
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
  display: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}
.emby-recent-card:hover .emby-recent-tip { display: block; }
#actor-works-back { margin-left: 10px; }

/* ---- v1.8.0 home carousels ---- */
.emby-recent-carousel,
.home-subs-carousel {
  position: relative;
  padding: 0;
}
.emby-recent-carousel > button,
.home-subs-carousel > button,
.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 0;
  box-shadow: none;
  font-size: 18px;
  line-height: 1;
  z-index: 2;
}
.emby-recent-carousel > button:hover,
.home-subs-carousel > button:hover,
.carousel-nav:hover {
  border: 0;
  background: transparent;
  color: var(--brand);
}
.emby-recent-carousel > button:first-child,
.home-subs-carousel > button:first-child,
.carousel-nav:first-child {
  left: -34px;
}
.emby-recent-carousel > button:last-child,
.home-subs-carousel > button:last-child,
.carousel-nav:last-child {
  right: -34px;
}
.home-subs {
  margin-top: 26px;
}
.home-subs-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
}
.home-subs-tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 13px;
}
.home-subs-tabs button.active {
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 600;
}
.home-subs-grid {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}
.home-subs-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  width: max-content;
  max-width: none;
  transition: transform 0.25s ease;
  will-change: transform;
}
.home-subs-card {
  position: relative;
  display: block;
  padding: 0;
  overflow: hidden;
  aspect-ratio: 2 / 3;
  flex: 0 0 128px;
  width: 128px;
  border-radius: 6px;
}
.home-subs-card.landscape {
  aspect-ratio: 3 / 2;
  flex: 0 0 224px;
  width: 224px;
}
.home-subs-cover {
  width: 100%;
  height: 100%;
  border-radius: 0;
  overflow: hidden;
  background: var(--brand-soft);
  color: var(--brand-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}
.home-subs-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.home-subs-cover.landscape img {
  object-fit: contain;
  background: var(--panel-soft);
}
.home-subs-tip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 8px 10px;
  background: rgba(15, 23, 32, 0.82);
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
  display: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}
.home-subs-card:hover .home-subs-tip { display: block; }

.subs-search-results .result-cover.landscape {
  flex: 0 0 208px;
  width: 208px;
  height: auto;
  min-height: 117px;
  align-self: stretch;
}
.subs-search-results .result-cover.landscape img { width: 100%; height: 100%; object-fit: contain; background: var(--panel-soft); }
.subs-search-results .result-title {
  flex: 0 0 auto;
}
.subs-search-results .result-title.zh-title {
  flex-basis: auto;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.subs-search-results .result-meta {
  margin-top: 4px;
}
.sub-row-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  flex-wrap: nowrap;
}

/* v1.7.0 offline panel */
.offline-panel {
  width: 100%;
  max-width: 560px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
}
.offline-path-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}
.offline-path-options .path-option {
  min-width: 0;
  overflow-wrap: anywhere;
}
.offline-panel h3 {
  margin: 0 0 2px;
  font-size: 17px;
  position: relative;
  padding-left: 12px;
}
.offline-panel h3::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 3px;
  border-radius: 2px;
  background: var(--brand);
}
.offline-panel textarea {
  min-height: 92px;
  resize: vertical;
}
.offline-panel .row-actions {
  justify-content: flex-start;
}
.offline-panel .row-actions button {
  min-width: 112px;
}

.p115-tabs {
  max-width: 560px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.p115-tabs button.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.p115-tab {
  width: 100%;
  max-width: 560px;
}
.p115-tab.hidden { display: none; }
#p115-panel-transfer {
  max-width: 760px;
}
.p115-tab .offline-panel {
  max-width: none;
}
.p115-tab .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.p115-tab .panel-head h3 {
  margin: 0;
}
.p115-tab .panel-head .row-actions {
  flex-wrap: wrap;
}
.p115-tab .panel-head input {
  min-width: 180px;
}
.p115-task-list,
.p115-file-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.p115-task-row,
.p115-file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--panel-soft);
  min-width: 0;
}
.p115-task-row .grow,
.p115-file-row .grow {
  flex: 1 1 auto;
  min-width: 0;
}
.p115-task-row .name,
.p115-file-row .name {
  font-weight: 600;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.p115-task-row .muted,
.p115-file-row .muted {
  font-size: 12px;
}
.p115-file-row.folder > .file-icon {
  color: var(--brand-dark);
}
.p115-file-row .row-actions {
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}
.p115-file-row .row-actions button {
  min-width: 0;
  min-height: 28px;
  padding: 3px 10px;
  font-size: 12px;
}
.p115-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 12px 0 2px;
  font-size: 13px;
}
.p115-breadcrumb button {
  border-radius: 6px;
  min-height: 26px;
  padding: 2px 10px;
  font-size: 12px;
}
.p115-space-info {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.p115-space-item {
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-soft);
}
.p115-space-item strong {
  display: block;
  font-size: 20px;
  margin-top: 4px;
}
.p115-share-result.ok { color: var(--ok); }
.p115-share-result.bad { color: var(--danger); }

/* v1.7.0 mobile adaptation */
@media (max-width: 960px) {
  .sidebar {
    top: auto;
    bottom: 0;
    height: 58px;
    min-height: 58px;
    border-right: 0;
    border-bottom: 0;
    border-top: 1px solid var(--line);
    z-index: 50;
  }
  .sidebar-head {
    position: fixed;
    top: 0;
    bottom: auto;
    left: 0;
    right: 0;
    height: 56px;
    min-height: 56px;
    z-index: 60;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    justify-content: flex-start;
    padding-left: 14px;
  }
  .sidebar-nav {
    padding-right: 78px;
  }
  .nav-collapse {
    display: none !important;
  }
  .nav-more {
    display: flex;
  }
  .nav-more-item {
    display: none;
  }
  #app.nav-more-open .nav-more-item {
    display: flex;
  }
  .sidebar-foot {
    display: block;
    position: fixed;
    top: 6px;
    right: 8px;
    bottom: auto;
    transform: none;
    padding: 0;
    border: 0;
    z-index: 46;
    width: auto;
  }
  .sidebar-user,
  .sidebar-user .user-card {
    width: auto;
  }
  .sidebar-user .user-card {
    padding: 4px;
  }
  .sidebar-user .user-copy {
    display: none;
  }
  .sidebar-user .avatar {
    width: 36px;
    height: 36px;
  }
  .avatar-menu.user-menu {
    top: auto;
    bottom: auto;
    top: calc(100% + 10px);
    right: 0;
    left: auto;
    min-width: 176px;
  }
  .sidebar-user .cache-confirm {
    left: 0;
    right: auto;
    top: auto;
    bottom: calc(100% + 8px);
    width: min(230px, calc(100vw - 32px));
  }
  #app.sidebar-collapsed .sidebar {
    width: 100%;
  }
  #app.sidebar-collapsed .main {
    margin-left: 0;
  }
  .brand-copy {
    display: flex !important;
  }
  .main {
    padding: 76px 16px 72px;
  }
  #app.sidebar-collapsed .view {
    max-width: 100%;
  }
  .home-stats-grid {
    grid-template-columns: 1fr;
  }
  .home-count-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .home-service-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .settings-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
  }
  .settings-tabs button {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .admin-section {
    max-width: none;
    width: 100%;
  }
  .subs-grid {
    grid-template-columns: 1fr;
  }
  .logs-panel {
    max-height: calc(100vh - 220px);
  }
}

@media (max-width: 640px) {
  html,
  body {
    overflow-x: hidden;
  }
  .sidebar {
    height: 56px;
    min-height: 56px;
  }
  .sidebar-head {
    height: 56px;
    padding-left: 8px;
  }
  .sidebar-head .brand-mark {
    width: 30px;
    height: 30px;
    font-size: 16px;
  }
  .brand-name {
    font-size: 14px;
  }
  .brand-version {
    font-size: 10px;
  }
  .sidebar-nav {
    padding: 4px 64px 4px 6px;
  }
  .nav-item {
    padding: 8px 9px;
    min-height: 38px;
    font-size: 13px;
  }
  .main {
    padding: 66px 10px 70px;
  }
  .home-count-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 7px 6px;
  }
  .home-service-grid {
    grid-template-columns: 1fr;
  }
  .view-head {
    flex-direction: column;
    align-items: stretch;
  }
  .view-head .row-actions {
    justify-content: flex-start;
  }
  .search-form-view,
  .subs-search-form {
    flex-direction: column;
  }
  .search-submit {
    width: 100%;
  }
  .subs-search-results .result.has-cover {
    flex-direction: row;
  }
  .subs-search-results .result-cover.landscape {
    flex: 0 0 84px;
    width: 84px;
    height: 120px;
  }
  .sub-row {
    gap: 8px;
    padding: 9px 10px;
  }
  .sub-row-cover {
    width: 46px;
    height: 64px;
    flex-basis: 46px;
  }
  .actor-tabs,
  .subs-tabs {
    overflow-x: auto;
  }
  .actor-tabs button,
  .subs-tabs button {
    white-space: nowrap;
  }
  .log-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 8px;
  }
  .log-time,
  .log-badge {
    justify-self: start;
  }
  .pagination {
    gap: 6px;
  }
  .modal-box {
    padding: 16px;
    max-height: 86vh;
  }
  .emby-recent-card {
    flex-basis: 112px;
    width: 112px;
  }
  .offline-panel {
    padding: 14px 16px;
  }
  .offline-path-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #results .result {
    height: auto;
    min-height: 0;
    overflow: visible;
  }
  #results .result:hover {
    overflow: visible;
  }
  #results .result-title {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
  }
  #results .magnet {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
  }
  #results .result:hover .magnet {
    position: static;
    left: auto;
    right: auto;
    z-index: auto;
    margin-top: 10px;
    background: var(--panel-soft);
    box-shadow: none;
  }
}

@media (max-width: 420px) {
  .sidebar-nav {
    padding-right: 64px;
  }
  #results {
    grid-template-columns: 1fr;
  }
  .result.has-cover {
    flex-direction: column;
  }
  .result-cover {
    width: 100%;
    min-height: 0;
    aspect-ratio: 16 / 9;
  }
  .result-actions {
    flex-direction: column;
  }
  .movie-card-main {
    gap: 8px;
  }
  .movie-cover {
    width: 84px;
    height: 122px;
    flex-basis: 84px;
  }
  .actor-card {
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 8px;
    padding: 10px;
  }
  .actor-card .actor-avatar {
    width: 78px;
    height: 104px;
  }
  .subs-search-results .result.has-cover {
    flex-direction: column;
  }
  .subs-search-results .result-cover.landscape {
    flex: 0 0 140px;
    width: 140px;
    height: 84px;
  }
  .modal {
    padding: 0;
    align-items: flex-end;
  }
  .modal-box {
    border-radius: 14px 14px 0 0;
    max-height: 88vh;
  }
  .settings-tabs button {
    flex: 1 1 44%;
  }
  .row-actions {
    width: 100%;
  }
  .row-actions button {
    flex: 1 1 auto;
  }
  .home-count-list {
    grid-template-columns: 1fr 1fr;
  }
  .offline-path-options {
    grid-template-columns: 1fr;
  }
}

/* ---- v1.9.0 movie card (landscape banner) ---- */
.movie-card {
  flex-direction: column;
  gap: 0;
  padding: 0;
  overflow: hidden;
  min-height: 360px;
}
.movie-banner {
  aspect-ratio: 3 / 2;
  width: 100%;
  overflow: hidden;
  background: var(--panel-soft);
  position: relative;
  flex: 0 0 auto;
}
.movie-banner img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.movie-card.cover-blur .movie-banner img { filter: blur(20px) saturate(1.15); transform: scale(1.16); }
.movie-card.cover-off .movie-banner { display: none; }
.movie-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}
.movie-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.movie-id-copy {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.movie-id-copy .movie-number {
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
}
.movie-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  margin: 0;
  line-height: 1;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel-soft);
  color: var(--muted);
  cursor: pointer;
  flex: 0 0 20px;
}
.movie-copy:hover { color: var(--brand); border-color: var(--brand); }
.movie-actress {
  color: #2f6fed;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.movie-sub-state {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.movie-sub-state.in-library {
  color: #16a34a;
  font-weight: 700;
}
.emby-badge {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  color: #16a34a;
  background: rgba(22, 163, 74, 0.12);
  border: 1px solid rgba(22, 163, 74, 0.35);
  border-radius: 5px;
  padding: 2px 8px;
  white-space: nowrap;
}
.movie-body .movie-date {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.movie-body .movie-zh {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  min-height: 39px;
}
.movie-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}
.movie-actions-btns {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}
.movie-stills {
  min-height: 28px;
  padding: 4px 12px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  cursor: pointer;
}
.movie-sub-btn {
  min-height: 28px;
  padding: 4px 14px;
  font-size: 12px;
  min-width: 64px;
}

.movie-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
#app.sidebar-collapsed .movie-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

/* ---- v1.9.0 stills modal ---- */
.stills-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(8, 12, 18, 0.84);
  display: flex;
  align-items: center;
  justify-content: center;
}
.stills-modal.hidden { display: none; }
.stills-stage { position: relative; max-width: 92vw; max-height: 90vh; }
.stills-stage img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 6px;
  background: #000;
  display: block;
  margin: 0 auto;
}
.stills-close {
  position: absolute;
  top: -44px;
  right: 0;
  width: 34px;
  height: 34px;
  font-size: 20px;
  line-height: 1;
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  cursor: pointer;
  z-index: 2;
}
.stills-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  font-size: 26px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  cursor: pointer;
  z-index: 2;
}
.stills-prev { left: -60px; }
.stills-next { right: -60px; }
.stills-counter {
  position: absolute;
  bottom: -34px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
}

/* ---- v1.9.0 115 网盘管理 ---- */
.p115-account-card {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 560px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}
.p115-account-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}
.p115-account-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.p115-account-name { font-size: 16px; font-weight: 700; }
.p115-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.p115-toolbar input { flex: 1 1 220px; min-width: 160px; }
.p115-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 92vw);
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 32px rgba(0, 0, 0, 0.18);
  z-index: 900;
  display: flex;
  flex-direction: column;
}
.p115-drawer.hidden { display: none; }
.p115-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.p115-drawer-head h3 { margin: 0; }
.p115-drawer-close {
  width: 30px;
  height: 30px;
  font-size: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}
.p115-drawer-body { flex: 1 1 auto; overflow-y: auto; padding: 16px; }
#view-offline .p115-breadcrumb { margin-bottom: 8px; }

/* ---- home equal cards ---- */
.home-stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* ---- v1.9.0 responsive ---- */
@media (max-width: 960px) {
  .movie-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #app.sidebar-collapsed .movie-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stills-prev { left: 6px; }
  .stills-next { right: 6px; }
}
@media (max-width: 640px) {
  .movie-grid,
  #app.sidebar-collapsed .movie-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-stats-grid { grid-template-columns: 1fr; }
}

.home-libraries { margin-top: 18px; }
.emby-libraries-list {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 960px) {
  :root { --sticky-top: 76px; }
}

@media (max-width: 640px) {
  :root { --sticky-top: 66px; }
}
