/* 管理台共用样式。颜色和间距集中在这里，后续换主题不用逐块查找。 */
:root {
  color-scheme: light;
  --ink: #172036;
  --muted: #69738d;
  --soft: #8d96aa;
  --line: #dfe4ef;
  --paper: #ffffff;
  --canvas: #f5f7fb;
  --primary: #5167e9;
  --primary-deep: #3549bd;
  --primary-soft: #e8ebff;
  --green: #18a770;
  --green-soft: #e4f7ef;
  --amber: #d88a1b;
  --shadow: 0 22px 60px rgba(28, 39, 73, 0.09);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(112, 130, 244, 0.14), transparent 32rem),
    radial-gradient(circle at 90% 16%, rgba(60, 202, 151, 0.08), transparent 26rem),
    var(--canvas);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(81, 103, 233, 0.25);
  outline-offset: 3px;
}

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0;
}

/* 品牌图形全部用 CSS 绘制，镜像无需额外携带图片或字体文件。 */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: inherit;
  text-decoration: none;
}

.brand > span:last-child {
  display: grid;
  line-height: 1.1;
}

.brand strong {
  font-size: 17px;
  letter-spacing: -0.02em;
}

.brand small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.brand-mark {
  position: relative;
  display: block;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--ink);
  box-shadow: 0 8px 20px rgba(23, 32, 54, 0.2);
}

.brand-mark span,
.brand-mark i {
  position: absolute;
  display: block;
  background: #fff;
  transform: rotate(9deg);
}

.brand-mark span {
  width: 6px;
  height: 7px;
  border-radius: 50%;
}

.brand-mark span:nth-child(1) { left: 9px; top: 11px; }
.brand-mark span:nth-child(2) { left: 17px; top: 7px; }
.brand-mark span:nth-child(3) { left: 26px; top: 9px; }
.brand-mark span:nth-child(4) { left: 30px; top: 17px; }

.brand-mark i {
  left: 13px;
  top: 19px;
  width: 17px;
  height: 14px;
  border-radius: 55% 55% 44% 44%;
}

.version-pill {
  padding: 8px 13px;
  border: 1px solid rgba(81, 103, 233, 0.16);
  border-radius: 999px;
  color: var(--primary-deep);
  background: rgba(255, 255, 255, 0.74);
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(12px);
}

/* 顶部概览与健康状态。 */
.hero {
  display: grid;
  grid-template-columns: 1.6fr 0.8fr;
  gap: 38px;
  align-items: end;
  padding: 62px 64px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 32px;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.96), rgba(245, 246, 255, 0.92)),
    var(--paper);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 20px;
  font-size: clamp(36px, 5vw, 62px);
  line-height: 1.08;
  letter-spacing: -0.055em;
}

.hero-description {
  max-width: 610px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.health-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 160px;
  padding: 28px;
  border: 1px solid rgba(81, 103, 233, 0.12);
  border-radius: 24px;
  background: linear-gradient(145deg, #f1f4ff, #fff);
}

.health-orbit {
  display: grid;
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  place-items: center;
  border: 1px solid rgba(24, 167, 112, 0.22);
  border-radius: 50%;
  background: var(--green-soft);
}

.health-dot {
  width: 14px;
  height: 14px;
  border: 4px solid #fff;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 8px rgba(24, 167, 112, 0.13);
}

.health-card > div:last-child {
  display: grid;
}

.health-label,
.health-card small {
  color: var(--muted);
  font-size: 12px;
}

.health-card strong {
  margin: 6px 0;
  font-size: 22px;
}

/* 三张指标卡在窄屏下会自动折成单列。 */
.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 18px 0 0;
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  padding: 24px;
  border: 1px solid rgba(223, 228, 239, 0.8);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.82);
}

.metric-card > div {
  display: grid;
  min-width: 0;
}

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

.metric-card strong {
  margin: 5px 0 4px;
  overflow: hidden;
  font-size: 19px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card div > span {
  overflow: hidden;
  color: var(--soft);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-icon,
.action-symbol {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 14px;
}

.metric-icon {
  width: 44px;
  height: 44px;
  background: var(--primary-soft);
}

.icon-source::before {
  width: 16px;
  height: 16px;
  border: 2px solid var(--primary);
  border-radius: 50%;
  content: "";
  box-shadow: 9px 0 0 -5px var(--primary-soft), 9px 0 0 -3px var(--primary);
}

.icon-sites::before {
  width: 17px;
  height: 15px;
  border: 2px solid var(--primary);
  border-radius: 4px;
  content: "";
  box-shadow: 5px -5px 0 -2px var(--primary-soft), 5px -5px 0 0 var(--primary);
}

.icon-profile::before {
  width: 15px;
  height: 18px;
  border: 2px solid var(--primary);
  border-radius: 8px 8px 5px 5px;
  content: "";
}

/* 后续功能区共用的标题、卡片和间距。 */
.section-block {
  margin-top: 78px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.section-heading h2,
.source-intro h2 {
  margin-bottom: 0;
  font-size: 30px;
  letter-spacing: -0.035em;
}

.section-heading > p {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.action-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 17px;
  align-items: center;
  min-height: 112px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  color: var(--ink);
  background: var(--paper);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.action-card:hover {
  border-color: rgba(81, 103, 233, 0.35);
  box-shadow: 0 14px 38px rgba(31, 41, 79, 0.09);
  transform: translateY(-2px);
}

.action-card > span:nth-child(2) {
  display: grid;
}

.action-card strong {
  font-size: 16px;
}

.action-card small {
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.4;
}

.action-card > i {
  color: var(--soft);
  font-size: 20px;
  font-style: normal;
}

.action-symbol {
  width: 48px;
  height: 48px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 15px;
  font-weight: 800;
}

.action-primary {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(140deg, #546bed, #3f52c9);
}

.action-primary small,
.action-primary > i {
  color: rgba(255, 255, 255, 0.75);
}

.action-primary .action-symbol {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
}

.arrow-symbol::before {
  width: 17px;
  height: 13px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  content: "";
  transform: rotate(-45deg);
}

.pulse-symbol::before {
  width: 19px;
  height: 10px;
  border-bottom: 2px solid var(--primary);
  content: "";
  transform: skew(-35deg);
}

/* 猫源、订阅和密码管理分别保留独立的视觉层级。 */
.source-panel {
  padding: 42px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 0 16px 50px rgba(28, 39, 73, 0.06);
}

.subscription-panel {
  padding: 42px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 0 16px 50px rgba(28, 39, 73, 0.06);
}

.security-panel {
  padding: 42px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 0 16px 50px rgba(28, 39, 73, 0.06);
}

.password-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin-top: 28px;
}

.password-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.password-form input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: #f8f9fd;
}

.password-form .button {
  min-height: 48px;
}

/* 设置页登录保持单页布局，不复用管理台的复杂网格。 */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(480px, 100%);
}

.login-shell > .brand {
  margin: 0 0 22px 8px;
}

.login-card {
  padding: 42px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin-bottom: 14px;
  font-size: 34px;
}

.login-card > p:not(.eyebrow),
.login-card > small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.login-card form {
  display: grid;
  gap: 12px;
  margin: 28px 0 20px;
}

.login-card form label {
  color: var(--muted);
  font-size: 12px;
}

.login-card form input {
  width: 100%;
  height: 52px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: #f8f9fd;
}

.login-card form .button {
  min-height: 52px;
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: #a63d46;
  font-size: 12px;
}

.login-lock {
  position: relative;
  display: block;
  width: 48px;
  height: 42px;
  margin-bottom: 26px;
  border-radius: 12px;
  background: var(--primary-soft);
}

.login-lock::before {
  position: absolute;
  left: 14px;
  top: -12px;
  width: 16px;
  height: 22px;
  border: 3px solid var(--primary);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  content: "";
}

.login-lock::after {
  position: absolute;
  left: 21px;
  top: 16px;
  width: 6px;
  height: 12px;
  border-radius: 999px;
  background: var(--primary);
  content: "";
}

/* 订阅开关和周期选择在手机上允许自然换行。 */
.subscription-controls {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr auto;
  gap: 14px;
  align-items: stretch;
  margin-top: 30px;
}

.switch-control,
.select-control {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8f9fd;
}

.switch-control > span {
  display: grid;
  gap: 5px;
}

.switch-control small,
.select-control > span {
  color: var(--muted);
  font-size: 12px;
}

.switch-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-control > i {
  position: relative;
  width: 48px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #c8ceda;
  transition: background 160ms ease;
}

.switch-control > i::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(28, 39, 73, 0.18);
  content: "";
  transition: transform 160ms ease;
}

.switch-control input:checked + i {
  background: var(--primary);
}

.switch-control input:checked + i::after {
  transform: translateX(20px);
}

.select-control select {
  min-width: 120px;
  height: 42px;
  padding: 0 34px 0 12px;
  border: 1px solid #ccd3e1;
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.subscription-actions {
  display: grid;
  gap: 8px;
}

.subscription-status {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.subscription-status > div {
  display: grid;
  gap: 6px;
  padding: 17px 18px;
  border-radius: 14px;
  background: #f7f8fc;
}

.subscription-status small,
.subscription-status p {
  color: var(--muted);
  font-size: 12px;
}

.subscription-status strong {
  font-size: 14px;
}

.subscription-status p {
  grid-column: 1 / -1;
  margin: 0;
  padding: 0 2px;
}

.release-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.release-status > div {
  display: grid;
  gap: 6px;
  padding: 17px 18px;
  border-radius: 14px;
  background: #f7f8fc;
}

.release-status small {
  color: var(--muted);
  font-size: 12px;
}

.release-status strong {
  overflow-wrap: anywhere;
  font-size: 14px;
}

.release-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.release-actions .button {
  min-width: 150px;
}

/* 猫源切换表单与当前来源信息。 */
.source-intro {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 30px;
}

.source-intro > div {
  max-width: 750px;
}

.source-intro p:last-child {
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.security-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 9px 12px;
  border-radius: 999px;
  color: #087c53;
  background: var(--green-soft);
  font-size: 12px;
  font-weight: 700;
}

.security-badge i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.source-current {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  margin: 32px 0;
  padding: 16px 18px;
  border-radius: 14px;
  color: var(--muted);
  background: #f7f8fc;
  font-size: 12px;
}

.source-current code {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-mini {
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  color: var(--primary-deep);
  background: var(--primary-soft);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

#source-form {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 20px;
}

#source-form > label:first-child {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input[type="url"] {
  min-width: 0;
  height: 52px;
  padding: 0 16px;
  border: 1px solid #ccd3e1;
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  font-size: 14px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input[type="url"]:focus {
  border-color: var(--primary);
  outline: 0;
  box-shadow: 0 0 0 4px rgba(81, 103, 233, 0.1);
}

.button {
  min-height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  transition: opacity 160ms ease, transform 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.button-primary {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 8px 18px rgba(81, 103, 233, 0.22);
}

.button-quiet {
  color: var(--primary-deep);
  background: var(--primary-soft);
}

.trust-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.trust-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.trust-check span {
  display: grid;
  width: 19px;
  height: 19px;
  place-items: center;
  border: 1px solid #bbc3d2;
  border-radius: 6px;
  background: #fff;
}

.trust-check input:checked + span {
  border-color: var(--primary);
  background: var(--primary);
}

.trust-check input:checked + span::after {
  width: 7px;
  height: 4px;
  border-bottom: 2px solid #fff;
  border-left: 2px solid #fff;
  content: "";
  transform: rotate(-45deg) translateY(-1px);
}

.form-note {
  margin: 14px 0 0;
  color: var(--soft);
  font-size: 12px;
  line-height: 1.6;
}

.source-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 24px;
}

.source-footer > div {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.source-footer small {
  color: var(--muted);
}

.source-footer code {
  overflow: hidden;
  max-width: 720px;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 诊断详情、目录进度和辅助链接。 */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.detail-card {
  min-height: 180px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.76);
}

.detail-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 23px;
  color: var(--muted);
  font-size: 12px;
}

.detail-head i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(24, 167, 112, 0.1);
}

.detail-card > strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 18px;
}

.detail-card p,
.detail-card > small {
  display: block;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.detail-card > .detail-link {
  color: var(--primary);
  font-weight: 700;
}

.progress-track {
  height: 6px;
  margin-top: 20px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8ebf2;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #7d8df3);
  transition: width 300ms ease;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 44px 0 34px;
  color: var(--soft);
  font-size: 11px;
}

/* Toast 只承载短消息，长错误仍留在状态卡片中。 */
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: min(390px, calc(100% - 32px));
  padding: 14px 18px;
  border-radius: 12px;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 16px 44px rgba(16, 24, 43, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: #a63d46;
}

/* 站点扫描明细使用独立滚动层，避免撑高管理台主体。 */
.site-layer {
  position: fixed;
  inset: 0;
  z-index: 28;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 27, 48, 0.58);
  backdrop-filter: blur(10px);
}

.site-layer[hidden] {
  display: none;
}

.site-panel {
  width: min(960px, 100%);
  max-height: min(780px, calc(100vh - 48px));
  overflow: auto;
  padding: 34px;
  border-radius: 28px;
  background: #fff;
  box-shadow: var(--shadow);
}

.site-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
}

.site-panel-head h2 {
  margin-bottom: 9px;
  font-size: 28px;
}

.site-panel-head p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.site-panel-close {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: var(--canvas);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.site-result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 28px;
}

.site-result-group {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fbfcfe;
}

.site-result-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 14px;
}

.site-result-title > span {
  min-width: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.site-result-errors .site-result-title > span {
  color: #a63d46;
  background: #fbecef;
}

.site-result-list {
  display: grid;
  gap: 10px;
  max-height: 460px;
  overflow: auto;
}

.site-result-item {
  padding: 14px;
  border: 1px solid #e8ecf3;
  border-radius: 14px;
  background: #fff;
}

.site-result-item > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.site-result-item > div > strong {
  overflow-wrap: anywhere;
  font-size: 14px;
}

.site-result-item > div > span {
  flex: 0 0 auto;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
}

.site-result-item.failed > div > span {
  color: #a63d46;
}

.site-result-item > small {
  display: block;
  margin-top: 8px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.site-result-item > .site-block-button,
.site-result-item > .button-danger-soft {
  min-height: 34px;
  margin-top: 12px;
  padding: 7px 12px;
  font-size: 12px;
}

/* FW 失败站点的重试按钮保持轻量，避免把错误原因和操作挤在一行。 */
.site-retry-button {
  min-height: 34px;
  margin-top: 12px;
  padding: 7px 12px;
  font-size: 12px;
}

.fw-address-panel {
  padding: 28px;
}

.fw-address-panel .source-current code {
  max-width: none;
}

.site-result-empty {
  margin: 0;
  padding: 28px 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.release-panel {
  width: min(840px, 100%);
}

.changelog-list {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

.changelog-item {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfcfe;
}

.changelog-item > div {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.changelog-item strong {
  line-height: 1.5;
}

.changelog-item time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.changelog-item ul {
  display: grid;
  gap: 9px;
  margin: 16px 0 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

/* 切源或订阅更新期间锁住页面，防止重复提交写操作。 */
.restart-layer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 27, 48, 0.58);
  backdrop-filter: blur(10px);
}

.restart-layer[hidden] {
  display: none;
}

.restart-card {
  width: min(420px, 100%);
  padding: 42px;
  border-radius: 26px;
  background: #fff;
  box-shadow: var(--shadow);
  text-align: center;
}

.restart-card h2 {
  margin: 24px 0 10px;
}

.restart-card p,
.restart-card small {
  color: var(--muted);
}

.restart-spinner {
  display: inline-block;
  width: 52px;
  height: 52px;
  border: 4px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

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

/* 平板与窄窗口：收紧留白并把多列布局改为单列。 */
@media (max-width: 820px) {
  .page-shell {
    width: min(100% - 24px, 680px);
  }

  .hero {
    grid-template-columns: 1fr;
    padding: 42px 30px 30px;
  }

  .health-card {
    min-height: auto;
  }

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

  .action-grid,
  .detail-grid,
  .site-result-grid {
    grid-template-columns: 1fr;
  }

  .section-block {
    margin-top: 56px;
  }

  .source-panel {
    padding: 28px 22px;
  }

  .subscription-panel {
    padding: 28px 22px;
  }

  .security-panel {
    padding: 28px 22px;
  }

  .subscription-controls {
    grid-template-columns: 1fr;
  }

  .password-form {
    grid-template-columns: 1fr 1fr;
  }

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

  .source-intro {
    display: block;
  }

  .security-badge {
    margin-top: 20px;
  }

  .site-panel {
    padding: 26px 20px;
  }
}

/* 手机：按钮和输入框改为整行，减少误触。 */
@media (max-width: 560px) {
  .strm-library-item {
    grid-template-columns: 1fr;
  }

  .strm-library-item .button {
    grid-column: auto;
    grid-row: auto;
    width: 100%;
  }
  .topbar {
    padding: 20px 2px;
  }

  .hero {
    border-radius: 24px;
  }

  h1 {
    font-size: 38px;
  }

  .password-form {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 34px 24px;
  }

  .section-heading {
    align-items: start;
  }

  .section-heading > p {
    display: none;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .button-primary {
    min-height: 52px;
  }

  .source-current {
    grid-template-columns: 1fr auto;
  }

  .source-current > span {
    grid-column: 1 / -1;
  }

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

  .source-footer .button {
    width: 100%;
  }

  .subscription-actions,
  .subscription-status {
    grid-template-columns: 1fr;
  }

  .release-status {
    grid-template-columns: 1fr;
  }

  .subscription-status p {
    grid-column: auto;
  }

  footer {
    flex-direction: column;
    line-height: 1.6;
  }
}

/* 尊重系统的减少动态效果设置。 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* STRM 独立页面：使用管理台同一套颜色，但不依赖 app.js 的布局或状态。 */
.strm-hero {
  grid-template-columns: 1.35fr 0.8fr;
}

.strm-section-nav {
  position: sticky;
  top: 12px;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 24px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 28px rgba(28, 39, 73, 0.08);
  backdrop-filter: blur(14px);
}

.strm-section-nav a {
  min-width: 0;
  padding: 10px 14px;
  border-radius: 11px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.strm-section-nav a:hover,
.strm-section-nav a:focus-visible,
.strm-section-nav a[aria-selected="true"] {
  color: var(--primary-deep);
  background: var(--primary-soft);
}

.strm-section-nav a[aria-selected="true"] {
  box-shadow: inset 0 0 0 1px rgba(81, 103, 233, 0.12);
}

.home-section-nav {
  position: sticky;
  top: 12px;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 24px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 28px rgba(28, 39, 73, 0.08);
  backdrop-filter: blur(14px);
}

.home-section-nav button {
  min-width: 0;
  padding: 10px 14px;
  border: 0;
  border-radius: 11px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.home-section-nav button:hover,
.home-section-nav button:focus-visible,
.home-section-nav button[aria-selected="true"] {
  color: var(--primary-deep);
  background: var(--primary-soft);
}

.strm-area {
  /* 分区是 section；即使旧缓存/异常模板把它解析成 fieldset，也不能带出 UA 黑框。 */
  display: block;
  min-width: 0;
  min-inline-size: 0;
  max-width: 100%;
  margin-top: 58px;
  margin-inline: 0;
  padding: 0;
  border: 0;
  background: transparent;
  scroll-margin-top: 20px;
}

.strm-area > legend {
  display: none;
}

.strm-page main {
  min-width: 0;
  max-width: 100%;
}

.strm-area[hidden] {
  display: none !important;
}

.strm-area-heading {
  min-width: 0;
  display: grid;
  gap: 7px;
  margin-bottom: 24px;
}

.strm-area-heading .eyebrow {
  margin-bottom: 0;
}

.strm-area-heading h2 {
  margin: 0;
  font-size: clamp(26px, 3vw, 36px);
  letter-spacing: -0.04em;
}

.strm-area-heading p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.strm-area > .section-block {
  min-width: 0;
  max-width: 100%;
  margin-top: 28px;
}

.strm-area > .section-block:first-of-type {
  margin-top: 0;
}

.strm-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.field-control {
  display: grid;
  gap: 8px;
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.field-control > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.field-control input,
.field-control select {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  border: 1px solid #ccd3e1;
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-weight: 500;
}

.field-control input:focus,
.field-control select:focus {
  border-color: var(--primary);
  outline: 0;
  box-shadow: 0 0 0 4px rgba(81, 103, 233, 0.1);
}

.field-control-wide {
  grid-column: 1 / -1;
}

.strm-site-selects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.strm-site-field,
.emby-site-field {
  min-width: 0;
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8f9fd;
}

.strm-site-field legend,
.emby-site-field legend {
  padding: 0 6px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.strm-site-field legend small,
.emby-site-field legend small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.checkbox-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  margin-top: 5px;
  padding-right: 3px;
}

.site-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
}

.site-option:hover {
  border-color: rgba(81, 103, 233, 0.25);
}

.site-option input {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
}

.site-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-option small {
  max-width: 120px;
  overflow: hidden;
  color: var(--soft);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-option-missing {
  border-color: rgba(216, 138, 27, 0.3);
  background: #fffaf0;
}

.strm-site-empty,
.strm-results-empty {
  display: block;
  padding: 14px 4px;
  color: var(--soft);
  font-size: 12px;
}

.strm-check {
  margin-top: 20px;
}

.strm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.strm-actions .button {
  min-width: 120px;
}

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

.strm-progress > div {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 16px;
  border-radius: 14px;
  background: #f7f8fc;
}

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

.strm-progress strong {
  overflow-wrap: anywhere;
  font-size: 18px;
}

.strm-sync-error-message {
  display: inline;
}

.strm-sync-failure-note {
  color: var(--soft);
}

.strm-sync-failures {
  display: block;
  margin-top: 10px;
  border: 1px solid rgba(216, 138, 27, 0.28);
  border-radius: 12px;
  background: #fffaf0;
}

.strm-sync-failures > summary {
  cursor: pointer;
  padding: 10px 12px;
  color: #8b5a08;
  font-size: 12px;
  font-weight: 750;
}

.strm-sync-failure-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0 12px 12px 30px;
}

.strm-sync-failure-item {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 9px 10px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.82);
}

.strm-sync-failure-item strong,
.strm-sync-failure-reason {
  min-width: 0;
  overflow-wrap: anywhere;
}

.strm-sync-failure-item strong {
  color: var(--ink);
  font-size: 12px;
}

.strm-sync-failure-reason {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.strm-sync-failure-item small {
  color: var(--soft);
  font-size: 11px;
}

.strm-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px auto;
  gap: 12px;
  align-items: end;
}

.strm-search-form .button {
  min-height: 48px;
}

.strm-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.strm-tmdb-result-group {
  display: grid;
  grid-column: 1 / -1;
  gap: 10px;
  min-width: 0;
}

.strm-tmdb-result-group > h3 {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 15px;
}

.strm-tmdb-result-group-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
}

.strm-result-card {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.strm-result-card > img,
.strm-poster-placeholder {
  width: 76px;
  height: 108px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--primary-soft);
}

.strm-poster-placeholder {
  display: grid;
  place-items: center;
  color: var(--primary-deep);
  font-size: 12px;
  font-weight: 800;
}

.strm-result-info {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
}

.strm-result-info h3 {
  margin: 2px 0 8px;
  overflow: hidden;
  max-width: 100%;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strm-result-info p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.strm-result-info .button {
  min-height: 38px;
  margin-top: auto;
  padding: 0 13px;
  font-size: 12px;
}

.strm-line-controls {
  display: grid;
  gap: 8px;
  width: 100%;
  margin-top: auto;
}

.strm-line-select {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 12px;
}

.strm-line-controls .button {
  width: 100%;
  margin-top: 0;
}

@media (max-width: 820px) {
  .strm-hero,
  .strm-form-grid,
  .strm-site-selects,
  .strm-results {
    grid-template-columns: 1fr;
  }

  .strm-tmdb-result-group-list {
    grid-template-columns: 1fr;
  }

  .strm-progress {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .strm-search-form {
    grid-template-columns: 1fr 1fr;
  }

  .strm-search-form .button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .strm-section-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    padding: 6px;
  }

  .strm-section-nav a {
    padding: 9px 8px;
    font-size: 12px;
  }

  .home-section-nav {
    gap: 4px;
    padding: 6px;
  }

  .home-section-nav button {
    padding: 9px 6px;
    font-size: 11px;
  }

  .strm-area {
    margin-top: 42px;
  }

  .strm-area-heading {
    margin-bottom: 18px;
  }

  .strm-site-field {
    padding: 22px 16px;
  }

  .strm-progress {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .strm-search-form {
    grid-template-columns: 1fr;
  }

  .strm-search-form .button {
    grid-column: auto;
    width: 100%;
  }

  .strm-result-card {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .strm-result-card > img,
  .strm-poster-placeholder {
    width: 64px;
    height: 96px;
  }

  .strm-actions .button {
    flex: 1 1 100%;
  }
}

/* 2.1 TMDB 与追剧卡片：秘密只提交到后台，列表展示使用 textContent 创建节点。 */
.strm-card-form,
.subscription-settings-form {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--paper);
}

.strm-check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  margin-top: 12px;
}

.strm-check-row .trust-check {
  margin-top: 0;
}

.tmdb-status-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 24px 0 0;
}

.tmdb-status-grid > div {
  min-width: 0;
  padding: 14px;
  border-radius: 14px;
  background: #f7f8fc;
}

.tmdb-status-grid dt {
  color: var(--muted);
  font-size: 11px;
}

.tmdb-status-grid dd {
  margin: 7px 0 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.subscription-settings-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 14px;
}

.subscription-settings-form .strm-actions,
.subscription-settings-form .form-note {
  grid-column: 1 / -1;
}

.subscription-settings-form .strm-actions {
  margin-top: 4px;
}

.strm-subscriptions-list {
  display: grid;
  gap: 12px;
}

.strm-subscription-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.strm-subscription-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.strm-subscription-heading h3 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
}

.strm-subscription-card p {
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.subscription-tag {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  color: #087c53;
  background: var(--green-soft);
  font-size: 11px;
  font-weight: 800;
}

.subscription-tag.is-paused {
  color: var(--muted);
  background: #eef0f5;
}

.subscription-error {
  color: #b42318 !important;
}

.strm-subscription-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  margin-top: 6px;
}

.strm-subscription-actions .button {
  max-width: 100%;
  min-height: 36px;
  padding: 0 13px;
  font-size: 12px;
}

/* 订阅线路和手动入库使用同一种“先读取、再选择、最后保存”的下拉框，
   线路很多时独占一行，按钮仍保留在下面，避免把订阅卡片撑成横向溢出。 */
.strm-subscription-actions .strm-line-select {
  flex: 1 1 100%;
  width: 100%;
  min-width: min(220px, 100%);
}

.strm-subscription-episodes {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(247, 249, 255, 0.72);
}

.strm-subscription-episodes summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 700;
}

.strm-subscription-episodes summary > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strm-download-selection-summary,
.strm-download-selection-count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.strm-download-selection-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 0 14px 10px;
}

.strm-download-selection-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.strm-download-selection-actions .button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 11px;
}

.strm-subscription-episode-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  max-height: 280px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 14px 14px;
}

.strm-subscription-episode-list span {
  min-width: 0;
}

.strm-download-empty {
  grid-column: 1 / -1;
  padding: 8px 2px;
  color: var(--soft);
  font-size: 12px;
}

.strm-download-choice {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid rgba(223, 228, 239, 0.9);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}

.strm-download-choice input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
}

.strm-download-choice > span {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  text-overflow: ellipsis;
}

.strm-library-list {
  display: grid;
  min-width: 0;
  max-width: 100%;
  gap: 14px;
  margin-top: 18px;
}

.strm-library-site,
.strm-library-category,
.strm-library-overflow {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
}

.strm-library-site > summary,
.strm-library-category > summary,
.strm-library-overflow > summary {
  cursor: pointer;
  list-style-position: inside;
  user-select: none;
}

.strm-library-site > summary {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 15px 18px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
}

.strm-library-category-list {
  display: grid;
  min-width: 0;
  gap: 10px;
  padding: 0 12px 12px;
}

.strm-library-category {
  border-radius: 13px;
  background: #f8f9fd;
}

.strm-library-category > summary {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 11px 14px;
  color: var(--primary-deep);
  font-size: 13px;
  font-weight: 750;
}

.strm-library-entry-list {
  display: grid;
  min-width: 0;
  max-width: 100%;
  gap: 8px;
  padding: 0 10px 10px;
}

.strm-library-overflow {
  border-radius: 11px;
  background: #fff;
}

.strm-library-overflow > summary {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 9px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.strm-library-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 18px;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.strm-library-entry-info {
  display: grid;
  min-width: 0;
  max-width: 100%;
  gap: 3px;
}

.strm-library-item small,
.strm-library-item span {
  color: var(--muted);
}

.strm-library-item strong,
.strm-library-item small,
.strm-library-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.strm-library-item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strm-library-item > .strm-subscription-episodes,
.strm-library-item > .strm-subscription-actions {
  grid-column: 1 / -1;
}

.strm-library-item > .strm-subscription-actions {
  justify-content: flex-start;
  width: 100%;
}

.strm-library-entry-status {
  white-space: nowrap;
  font-size: 12px;
}

.strm-library-item .button {
  min-height: 34px;
  padding: 0 11px;
  font-size: 12px;
}

.strm-downloads-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.strm-downloads-panel h3 {
  margin: 0;
  font-size: 16px;
}

.strm-downloads-list {
  display: grid;
  min-width: 0;
  max-width: 100%;
  gap: 10px;
  /* 轮询会替换任务节点，关闭浏览器自动锚定，位置由脚本按用户状态恢复。 */
  overflow-anchor: none;
}

.strm-download-history {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f8f9fd;
}

.strm-download-history > summary {
  cursor: pointer;
  padding: 12px 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  user-select: none;
}

.strm-download-history-list {
  display: grid;
  max-height: 420px;
  gap: 8px;
  overflow-y: auto;
  overflow-anchor: none;
  padding: 0 10px 10px;
}

.strm-download-category {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(248, 249, 253, 0.72);
}

.strm-download-category > summary {
  cursor: pointer;
  padding: 10px 12px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.strm-download-category > .strm-download-history-list {
  max-height: 320px;
}

.strm-download-item {
  display: grid;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}

.strm-download-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.strm-download-heading strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.download-state-tag {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  color: #087c53;
  background: var(--green-soft);
  font-size: 11px;
  font-weight: 800;
}

.download-state-tag.is-error {
  color: #a32121;
  background: #fff0f0;
}

.strm-download-meta,
.strm-download-details,
.download-error {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.strm-download-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9edf6;
}

.strm-download-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #6e83f5);
  transition: width 240ms ease;
}

.strm-download-progress.is-unknown span {
  width: 34%;
  background: repeating-linear-gradient(
    -45deg,
    var(--primary),
    var(--primary) 8px,
    #7d8df0 8px,
    #7d8df0 16px
  );
  animation: strm-download-indeterminate 1.2s linear infinite;
}

.strm-download-progress.is-complete span {
  width: 100%;
  background: var(--green);
}

.strm-download-progress.is-terminal span {
  width: 0;
  background: #cbd2e1;
}

.strm-download-details {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 14px;
}

.download-error {
  color: #b42318;
}

@keyframes strm-download-indeterminate {
  from { transform: translateX(-35%); }
  to { transform: translateX(100%); }
}

.button-danger {
  color: #a32121;
  background: #fff0f0;
}

@media (max-width: 820px) {
  .tmdb-status-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .subscription-settings-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .strm-card-form,
  .subscription-settings-form {
    padding: 18px 16px;
  }

  .strm-library-site > summary {
    padding: 13px 14px;
  }

  .strm-library-category-list {
    padding: 0 8px 8px;
  }

  .strm-library-item {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 12px;
  }

  .strm-library-entry-status {
    white-space: normal;
  }

  .strm-library-item .button {
    width: 100%;
  }

  .tmdb-status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .strm-subscription-actions .button {
    flex: 1 1 100%;
  }
}

/* Emby 独立设置页的账号、搜索站点和连接地址布局。 */
.emby-hero .hero-description {
  max-width: 650px;
}

.emby-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.emby-form-grid .switch-control {
  grid-column: 1 / -1;
}

.emby-site-selects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.emby-site-selects-single {
  grid-template-columns: minmax(0, 1fr);
}

/* Emby 策略独立保存，但操作结构与 FW 站点状态保持一致。 */
.emby-site-policy {
  margin-top: 24px;
  padding: 20px;
  border: 1px solid rgba(81, 103, 233, 0.16);
  border-radius: 20px;
  background: #fbfcff;
}

.emby-site-policy-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.emby-site-policy-heading h3 {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 18px;
}

.emby-site-policy-note {
  margin: 9px 0 0;
}

.emby-site-policy-grid {
  margin-top: 16px;
}

.button-danger-soft {
  color: #9b3c20;
  background: #fff1ec;
}

.emby-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.emby-site-empty {
  display: block;
  padding: 14px 4px;
  color: var(--soft);
  font-size: 12px;
}

.emby-endpoint-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px;
  border: 1px solid rgba(81, 103, 233, 0.16);
  border-radius: 18px;
  background: #f8f9ff;
}

.emby-endpoint-card > div {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.emby-endpoint-card span {
  color: var(--muted);
  font-size: 12px;
}

.emby-endpoint-card code {
  overflow-wrap: anywhere;
  color: var(--primary-deep);
  font-size: 15px;
  font-weight: 700;
}

@media (max-width: 820px) {
  .emby-form-grid,
  .emby-site-selects,
  .emby-site-policy-grid {
    grid-template-columns: 1fr;
  }

  .emby-form-grid .switch-control {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  .emby-endpoint-card,
  .emby-site-field {
    padding: 22px 16px;
  }

  .emby-site-policy {
    padding: 18px 14px;
  }

  .emby-site-policy-heading {
    flex-direction: column;
  }

  .emby-site-policy .site-result-item > .button {
    width: 100%;
  }

  .emby-endpoint-card {
    align-items: stretch;
    flex-direction: column;
  }

  .emby-endpoint-card .button {
    width: 100%;
  }

  .emby-actions .button {
    flex: 1 1 100%;
  }
}
