/* ============================================================
   Kazumi Web — Material 3 设计令牌与通用组件
   种子色默认绿色（对应 Flutter 端 colorSchemeSeed: Colors.green）
   ============================================================ */

:root {
  --font: "HarmonyOS Sans SC", "MiSans", "PingFang SC", "Noto Sans SC",
          system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;

  /* 形状（M3 Expressive 圆角梯度） */
  --r-xs: 4px;  --r-sm: 8px;  --r-md: 12px; --r-lg: 16px;
  --r-xl: 20px; --r-2xl: 28px; --r-3xl: 32px; --r-full: 999px;

  /* 动效：禁用动画时统一归零 */
  --dur-short: 140ms;
  --dur-med: 230ms;
  --dur-long: 400ms;
  --ease-std: cubic-bezier(.2, 0, 0, 1);
  --ease-emph: cubic-bezier(.2, 0, 0, 1.2);

  --rail-w: 88px;
  --bottom-h: 80px;
}

/* 禁用动画（设置 disableAnimations / playerDisableAnimations） */
html.no-anim *, html.no-anim *::before, html.no-anim *::after {
  animation-duration: 0ms !important;
  animation-delay: 0ms !important;
  transition-duration: 0ms !important;
  transition-delay: 0ms !important;
  scroll-behavior: auto !important;
}

/* ---------- 亮色 ---------- */
:root, [data-theme="light"] {
  --primary: #3B6939;
  --on-primary: #FFFFFF;
  --primary-container: #BCF0B4;
  --on-primary-container: #002204;
  --secondary: #52634F;
  --on-secondary: #FFFFFF;
  --secondary-container: #D5E8CF;
  --on-secondary-container: #101F10;
  --tertiary: #38656A;
  --on-tertiary: #FFFFFF;
  --tertiary-container: #BCEBF0;
  --on-tertiary-container: #002022;
  --error: #BA1A1A;
  --on-error: #FFFFFF;
  --error-container: #FFDAD6;
  --on-error-container: #410002;

  --surface: #F8FAF3;
  --on-surface: #191D17;
  --surface-dim: #D9DBD3;
  --surface-bright: #F8FAF3;
  --surface-container-lowest: #FFFFFF;
  --surface-container-low: #F2F4ED;
  --surface-container: #ECEFE7;
  --surface-container-high: #E6E9E1;
  --surface-container-highest: #E1E4DB;
  --on-surface-variant: #424940;
  --outline: #72796F;
  --outline-variant: #C2C9BD;
  --scrim: 0, 0, 0;
  --inverse-surface: #2E312C;
  --inverse-on-surface: #EFF2E9;
  --shadow: 0 1px 2px rgba(0,0,0,.14), 0 1px 3px 1px rgba(0,0,0,.08);
  --shadow-2: 0 2px 6px rgba(0,0,0,.16), 0 6px 18px 2px rgba(0,0,0,.10);
  --shadow-3: 0 6px 16px rgba(0,0,0,.20), 0 12px 40px 4px rgba(0,0,0,.12);
  --img-tint: 0.35;
}

/* ---------- 暗色 ---------- */
[data-theme="dark"] {
  --primary: #A1D39A;
  --on-primary: #0A390F;
  --primary-container: #235024;
  --on-primary-container: #BCF0B4;
  --secondary: #B9CCB4;
  --on-secondary: #253422;
  --secondary-container: #3B4B38;
  --on-secondary-container: #D5E8CF;
  --tertiary: #A0CFD4;
  --on-tertiary: #00363A;
  --tertiary-container: #1E4D52;
  --on-tertiary-container: #BCEBF0;
  --error: #FFB4AB;
  --on-error: #690005;
  --error-container: #93000A;
  --on-error-container: #FFDAD6;

  --surface: #11140E;
  --on-surface: #E1E4DB;
  --surface-dim: #11140E;
  --surface-bright: #373A33;
  --surface-container-lowest: #0C0F09;
  --surface-container-low: #191D17;
  --surface-container: #1D211B;
  --surface-container-high: #282B25;
  --surface-container-highest: #32362F;
  --on-surface-variant: #C2C9BD;
  --outline: #8C9388;
  --outline-variant: #424940;
  --scrim: 0, 0, 0;
  --inverse-surface: #E1E4DB;
  --inverse-on-surface: #2E312C;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 1px 3px 1px rgba(0,0,0,.24);
  --shadow-2: 0 2px 8px rgba(0,0,0,.5), 0 8px 22px 2px rgba(0,0,0,.32);
  --shadow-3: 0 8px 20px rgba(0,0,0,.56), 0 16px 48px 4px rgba(0,0,0,.36);
  --img-tint: 0.5;
}

/* OLED 增强 */
[data-oled="true"] {
  --surface: #000000;
  --surface-container-lowest: #000000;
  --surface-container-low: #080907;
  --surface-container: #0D0F0C;
  --surface-container-high: #151713;
  --surface-container-highest: #1E211B;
  --surface-dim: #000000;
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: var(--surface);
  color: var(--on-surface);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

body { overflow: hidden; }

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
img { display: block; max-width: 100%; }
::selection { background: var(--primary-container); color: var(--on-primary-container); }

/* 滚动条 */
* { scrollbar-width: thin; scrollbar-color: var(--outline-variant) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--outline) 55%, transparent);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--outline); background-clip: content-box; }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 70%, transparent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ---------- 启动画面 ---------- */
#splash {
  position: fixed; inset: 0; z-index: 900;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  background: var(--surface);
  transition: opacity var(--dur-long) var(--ease-std);
}
#splash.out { opacity: 0; pointer-events: none; }
.splash-logo { color: var(--primary); animation: splash-pop 900ms var(--ease-emph); }
@keyframes splash-pop { from { transform: scale(.82); opacity: 0 } to { transform: scale(1); opacity: 1 } }
.splash-title { font-size: 26px; font-weight: 700; letter-spacing: .5px; }
.splash-sub { color: var(--on-surface-variant); font-size: 13px; }
.splash-bar {
  width: 132px; height: 4px; margin-top: 12px;
  background: var(--surface-container-highest); border-radius: 99px; overflow: hidden;
}
.splash-bar i {
  display: block; height: 100%; width: 40%;
  background: var(--primary); border-radius: 99px;
  animation: splash-slide 1.2s var(--ease-std) infinite;
}
@keyframes splash-slide { 0% { margin-left: -40% } 100% { margin-left: 100% } }

/* ---------- 布局骨架 ---------- */
#app { display: flex; height: 100%; }
.shell { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }

.view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  outline: none;
  scroll-behavior: smooth;
}
.view.no-scroll { overflow: hidden; }

/* 侧栏（宽屏）：搜索 FAB 顶部、导航沉底（对齐上游桌面侧栏） */
.rail {
  width: var(--rail-w);
  flex: 0 0 var(--rail-w);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 0 18px;
  background: var(--surface-container-low);
  border-right: 1px solid color-mix(in srgb, var(--outline-variant) 40%, transparent);
  position: relative; z-index: 1; /* 盖过详情页的 fixed 背景层 */
}
.rail-fab {
  width: 60px; height: 60px; margin-bottom: 10px;
  display: grid; place-items: center;
  border: 0; border-radius: var(--r-lg);
  background: var(--primary); color: var(--on-primary);
  cursor: pointer;
  transition: filter var(--dur-short), transform var(--dur-short) var(--ease-emph);
}
.rail-fab:hover { filter: brightness(1.08); transform: translateY(-1px); }
.rail-fab .ico svg { width: 26px; height: 26px; }
.rail-spacer { flex: 1; }
.rail-item {
  width: 64px; padding: 8px 4px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: 0; background: transparent; color: var(--on-surface-variant);
  border-radius: var(--r-lg); cursor: pointer;
  transition: background var(--dur-short) var(--ease-std), color var(--dur-short) var(--ease-std);
}
.rail-item:hover { background: color-mix(in srgb, var(--on-surface) 8%, transparent); }
.rail-item .ico {
  width: 56px; height: 34px; display: grid; place-items: center;
  border-radius: var(--r-full);
  transition: background var(--dur-med) var(--ease-emph);
}
.rail-item[aria-current="page"] { color: var(--on-surface); }
.rail-item[aria-current="page"] .ico { background: var(--secondary-container); color: var(--on-secondary-container); }
.rail-item span:last-child { font-size: 11.5px; font-weight: 500; }
/* 对齐上游：侧栏仅当前项显示文字 */
.rail-item span:last-child { display: none; }
.rail-item[aria-current="page"] span:last-child { display: block; }

/* 底部导航（窄屏） */
.bottom-nav {
  display: flex;
  height: var(--bottom-h);
  flex: 0 0 var(--bottom-h);
  background: var(--surface-container);
  border-top: 1px solid color-mix(in srgb, var(--outline-variant) 40%, transparent);
  padding-bottom: env(safe-area-inset-bottom, 0);
  position: relative; z-index: 1;
}
.bottom-nav button {
  flex: 1; border: 0; background: transparent; color: var(--on-surface-variant);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  cursor: pointer; padding: 0;
}
.bottom-nav .ico {
  width: 62px; height: 30px; display: grid; place-items: center;
  border-radius: var(--r-full); transition: background var(--dur-med) var(--ease-emph);
}
.bottom-nav span { font-size: 11.5px; font-weight: 500; }
.bottom-nav button[aria-current="page"] { color: var(--on-surface); }
.bottom-nav button[aria-current="page"] .ico { background: var(--secondary-container); color: var(--on-secondary-container); }

@media (min-width: 1000px) {
  .rail { display: flex; }
  .bottom-nav { display: none; }
}

/* ---------- 图标 ---------- */
.ico svg, .icon svg { width: 24px; height: 24px; display: block; }
.icon { display: inline-grid; place-items: center; width: 24px; height: 24px; flex: none; }
.icon.sm svg { width: 20px; height: 20px; }
.icon.lg svg { width: 28px; height: 28px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 20px;
  border: 0; border-radius: var(--r-full);
  background: transparent; color: var(--primary);
  font-size: 14px; font-weight: 600; letter-spacing: .1px;
  cursor: pointer; white-space: nowrap;
  transition: background var(--dur-short) var(--ease-std), box-shadow var(--dur-short);
}
.btn:hover { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.btn:active { background: color-mix(in srgb, var(--primary) 16%, transparent); }
.btn:disabled { opacity: .38; cursor: not-allowed; }
.btn.filled { background: var(--primary); color: var(--on-primary); }
.btn.filled:hover { box-shadow: var(--shadow-2); background: color-mix(in srgb, var(--primary) 92%, var(--on-primary)); }
.btn.tonal { background: var(--secondary-container); color: var(--on-secondary-container); }
.btn.tonal:hover { box-shadow: var(--shadow); }
.btn.outlined { border: 1px solid var(--outline); }
.btn.text { padding: 0 12px; }
.btn.danger { color: var(--error); }
.btn.danger:hover { background: color-mix(in srgb, var(--error) 12%, transparent); }
.btn.filled.danger { background: var(--error); color: var(--on-error); }
.btn.lg { height: 56px; padding: 0 26px; font-size: 15px; border-radius: var(--r-lg); }
.btn.sm { height: 32px; padding: 0 14px; font-size: 13px; }

.icon-btn {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  border: 0; border-radius: var(--r-full);
  background: transparent; color: var(--on-surface-variant);
  cursor: pointer;
  transition: background var(--dur-short) var(--ease-std), color var(--dur-short);
}
.icon-btn:hover { background: color-mix(in srgb, var(--on-surface) 8%, transparent); color: var(--on-surface); }
.icon-btn.tonal { background: var(--surface-container-high); }
.icon-btn.tonal:hover { background: var(--surface-container-highest); }
.icon-btn.filled { background: var(--primary); color: var(--on-primary); }
.icon-btn[aria-pressed="true"] { background: var(--secondary-container); color: var(--on-secondary-container); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm svg { width: 20px; height: 20px; }

.fab {
  position: fixed; right: 22px; bottom: calc(var(--bottom-h) + 22px);
  height: 56px; padding: 0 22px 0 18px;
  display: inline-flex; align-items: center; gap: 10px;
  border: 0; border-radius: var(--r-lg);
  background: var(--primary-container); color: var(--on-primary-container);
  font-weight: 650; font-size: 15px;
  box-shadow: var(--shadow-2); cursor: pointer; z-index: 40;
  transition: transform var(--dur-med) var(--ease-emph), box-shadow var(--dur-med);
}
.fab:hover { box-shadow: var(--shadow-3); transform: translateY(-1px); }
@media (min-width: 1000px) { .fab { bottom: 26px; right: 28px; } }

/* ---------- 顶栏 ---------- */
.appbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  transition: box-shadow var(--dur-short);
}
.appbar.scrolled { box-shadow: 0 1px 0 color-mix(in srgb, var(--outline-variant) 60%, transparent); }
.appbar h1 {
  font-size: 20px; font-weight: 650; margin: 0; letter-spacing: .1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0;
}
.appbar .spacer { flex: 1; }
.appbar.large { display: block; padding: 10px 12px 6px; }
.appbar.large .bar-row { display: flex; align-items: center; gap: 6px; }
.appbar.large .headline {
  font-size: clamp(26px, 5vw, 34px); font-weight: 700; letter-spacing: -.4px;
  padding: 6px 6px 0; display: flex; align-items: center; gap: 6px;
  cursor: pointer; border-radius: var(--r-md); width: fit-content; max-width: 100%;
}
.appbar.large .headline:hover { background: color-mix(in srgb, var(--on-surface) 6%, transparent); }
.appbar.large .headline .txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 页面容器 / 栅格 ---------- */
.page { padding: 0 16px 96px; max-width: 1560px; margin: 0 auto; }
@media (min-width: 1000px) { .page { padding: 0 28px 48px; } }

.section { margin: 26px 0 0; }

/* 网格密度对齐上游 BangumiCard（疏朗大卡，标题在下） */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 22px 18px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 26px 20px; } }
@media (min-width: 1200px) { .grid { grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 28px 22px; } }
.grid.compact { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px 14px; }
@media (min-width: 640px) { .grid.compact { grid-template-columns: repeat(auto-fill, minmax(164px, 1fr)); gap: 18px 16px; } }
.section-title {
  font-size: 17px; font-weight: 650; margin: 0 0 12px;
  display: flex; align-items: center; gap: 8px;
}

.grid.list-mode { grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 760px) { .grid.list-mode { grid-template-columns: repeat(2, 1fr); } }

/* ---------- 番剧卡片 ---------- */
.card {
  display: flex; flex-direction: column; gap: 8px;
  border: 0; padding: 0; background: transparent; text-align: left;
  cursor: pointer; color: inherit; position: relative;
}
.card .poster {
  position: relative;
  width: 100%; aspect-ratio: 2 / 3;
  border-radius: var(--r-xl);
  overflow: hidden;
  background: var(--surface-container-high);
  box-shadow: var(--shadow);
  transition: transform var(--dur-med) var(--ease-emph), box-shadow var(--dur-med);
}
.card:hover .poster { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.card .poster img {
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity var(--dur-long) var(--ease-std);
}
.card .poster img.loaded { opacity: 1; }
.card .poster .ph {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: color-mix(in srgb, var(--on-surface-variant) 50%, transparent);
  font-size: 26px; font-weight: 700;
}
.card .badge {
  position: absolute; left: 8px; top: 8px;
  padding: 3px 8px; border-radius: var(--r-full);
  font-size: 11.5px; font-weight: 700;
  background: color-mix(in srgb, black 62%, transparent);
  color: #fff; backdrop-filter: blur(6px);
}
.card .badge.rating {
  left: auto; right: 8px;
  background: color-mix(in srgb, var(--primary) 88%, black);
  color: var(--on-primary);
  display: inline-flex; align-items: center; gap: 3px;
}
.card .badge.rating svg { width: 12px; height: 12px; }
.card .meta { padding: 0 2px; }
.card .title {
  font-size: 13.5px; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.7em;
}
.card .sub {
  font-size: 11.5px; color: var(--on-surface-variant); margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card .collect-dot {
  position: absolute; right: 8px; bottom: 8px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--tertiary); box-shadow: 0 0 0 2px color-mix(in srgb, black 45%, transparent);
}

/* 列表模式行 */
.row-card {
  display: flex; gap: 12px; align-items: center;
  padding: 10px; border-radius: var(--r-lg);
  background: var(--surface-container-low);
  border: 0; text-align: left; width: 100%; color: inherit; cursor: pointer;
  transition: background var(--dur-short);
}
.row-card:hover { background: var(--surface-container); }
.row-card .poster {
  width: 62px; aspect-ratio: 2/3; border-radius: var(--r-md);
  overflow: hidden; flex: none; background: var(--surface-container-high);
}
.row-card .poster img { width: 100%; height: 100%; object-fit: cover; }
.row-card .body { min-width: 0; flex: 1; }
.row-card .title { font-size: 14.5px; font-weight: 600; margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-card .sub { font-size: 12px; color: var(--on-surface-variant);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-card .tail { flex: none; color: var(--on-surface-variant); font-size: 12px; text-align: right; }

/* ---------- 骨架 ---------- */
.skel {
  background: linear-gradient(100deg,
    var(--surface-container) 30%,
    var(--surface-container-high) 50%,
    var(--surface-container) 70%);
  background-size: 300% 100%;
  animation: skel 1.4s ease-in-out infinite;
  border-radius: var(--r-md);
}
html.no-anim .skel { animation: none; }
@keyframes skel { 0% { background-position: 120% 0 } 100% { background-position: -40% 0 } }
.skel-card .poster { aspect-ratio: 2/3; border-radius: var(--r-xl); }
.skel-card .l1 { height: 13px; margin-top: 10px; width: 90%; }
.skel-card .l2 { height: 11px; margin-top: 6px; width: 55%; }

/* ---------- 标签 / 徽章 ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--outline-variant);
  background: transparent; color: var(--on-surface-variant);
  font-size: 13px; font-weight: 550; cursor: pointer; white-space: nowrap;
  transition: background var(--dur-short), color var(--dur-short), border-color var(--dur-short);
}
.chip:hover { background: color-mix(in srgb, var(--on-surface) 6%, transparent); }
.chip[aria-pressed="true"], .chip.selected {
  background: var(--secondary-container); color: var(--on-secondary-container);
  border-color: transparent;
}
.chip.filter { border-radius: var(--r-sm); }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }

.tag {
  display: inline-block; padding: 2px 9px; border-radius: var(--r-full);
  font-size: 11.5px; font-weight: 600;
  background: var(--surface-container-high); color: var(--on-surface-variant);
}
.tag.primary { background: var(--primary-container); color: var(--on-primary-container); }
.tag.tertiary { background: var(--tertiary-container); color: var(--on-tertiary-container); }
.tag.error { background: var(--error-container); color: var(--on-error-container); }

/* ---------- 选项卡 ---------- */
.tabs {
  display: flex; gap: 4px; overflow-x: auto;
  padding: 4px 2px; scrollbar-width: none;
  border-bottom: 1px solid color-mix(in srgb, var(--outline-variant) 50%, transparent);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs .tab {
  border: 0; background: transparent; color: var(--on-surface-variant);
  padding: 12px 16px; border-radius: var(--r-full);
  font-size: 14px; font-weight: 550; cursor: pointer; white-space: nowrap;
  position: relative; transition: background var(--dur-short);
}
.tabs .tab:hover { background: color-mix(in srgb, var(--on-surface) 6%, transparent); }
.tabs .tab[aria-selected="true"] { color: var(--on-surface); font-weight: 700; }
.tabs .tab[aria-selected="true"]::after {
  content: ""; position: absolute; left: 16px; right: 16px; bottom: 4px;
  height: 3px; border-radius: 99px; background: var(--primary);
}
.tabs.pill { border-bottom: 0; gap: 6px; padding: 6px 0; }
.tabs.pill .tab { padding: 9px 18px; }
.tabs.pill .tab[aria-selected="true"] {
  background: var(--primary-container); color: var(--on-primary-container);
}
.tabs.pill .tab[aria-selected="true"]::after { display: none; }

/* ---------- 表单控件 ---------- */
.field {
  position: relative; display: block;
  background: var(--surface-container-high);
  border-radius: var(--r-xs) var(--r-xs) 0 0;
  border-bottom: 1px solid var(--on-surface-variant);
  padding: 8px 14px 6px;
  transition: background var(--dur-short), border-color var(--dur-short);
}
.field:focus-within { border-bottom: 2px solid var(--primary); padding-bottom: 5px; }
.field > label {
  display: block; font-size: 11.5px; font-weight: 600;
  color: var(--on-surface-variant); margin-bottom: 1px;
}
.field input, .field textarea, .field select {
  width: 100%; border: 0; background: transparent; outline: none;
  font-size: 15px; padding: 2px 0; resize: vertical;
}
.field textarea { font-family: var(--mono); font-size: 13px; line-height: 1.6; }
.field .hint { font-size: 11.5px; color: var(--on-surface-variant); margin-top: 4px; }
.field.outlined {
  background: transparent; border: 1px solid var(--outline);
  border-radius: var(--r-xs); padding: 10px 14px;
}
.field.outlined:focus-within { border-color: var(--primary); border-width: 2px; padding: 9px 13px; }

.search-bar {
  display: flex; align-items: center; gap: 10px;
  height: 52px; padding: 0 8px 0 16px;
  background: var(--surface-container-high);
  border-radius: var(--r-full);
  transition: background var(--dur-short), box-shadow var(--dur-short);
}
.search-bar:focus-within { box-shadow: var(--shadow-2); background: var(--surface-container-highest); }
.search-bar input {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 15px;
}

/* 开关 */
.switch {
  position: relative; width: 52px; height: 32px; flex: none;
  border-radius: var(--r-full); border: 2px solid var(--outline);
  background: var(--surface-container-highest);
  cursor: pointer; padding: 0;
  transition: background var(--dur-med) var(--ease-std), border-color var(--dur-med);
}
.switch::after {
  content: ""; position: absolute; top: 50%; left: 4px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--outline); transform: translateY(-50%);
  transition: left var(--dur-med) var(--ease-emph), width var(--dur-med),
              height var(--dur-med), background var(--dur-med);
}
.switch[aria-checked="true"] { background: var(--primary); border-color: var(--primary); }
.switch[aria-checked="true"]::after {
  left: 26px; width: 22px; height: 22px; background: var(--on-primary);
}
.switch:active::after { width: 26px; height: 26px; }

/* 滑杆 */
.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; cursor: pointer; }
.slider::-webkit-slider-runnable-track {
  height: 6px; border-radius: 99px;
  background: linear-gradient(to right, var(--primary) var(--pct, 50%), var(--surface-container-highest) var(--pct, 50%));
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; margin-top: -6px;
  border-radius: 50%; background: var(--primary);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 24%, transparent);
  transition: box-shadow var(--dur-short);
}
.slider:hover::-webkit-slider-thumb { box-shadow: 0 0 0 9px color-mix(in srgb, var(--primary) 18%, transparent); }
.slider::-moz-range-track { height: 6px; border-radius: 99px; background: var(--surface-container-highest); }
.slider::-moz-range-progress { height: 6px; border-radius: 99px; background: var(--primary); }
.slider::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: var(--primary); }

/* 分段选择 */
.segmented {
  display: inline-flex; padding: 3px; gap: 2px;
  border: 1px solid var(--outline-variant); border-radius: var(--r-full);
  background: var(--surface-container-low);
}
.segmented button {
  border: 0; background: transparent; color: var(--on-surface-variant);
  height: 34px; padding: 0 16px; border-radius: var(--r-full);
  font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.segmented button[aria-pressed="true"] {
  background: var(--secondary-container); color: var(--on-secondary-container);
}

/* ---------- 列表项 / 设置项 ---------- */
.list { display: flex; flex-direction: column; }
.list.grouped {
  background: var(--surface-container-low);
  border-radius: var(--r-2xl);
  overflow: hidden;
}
.tile {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; min-height: 56px;
  border: 0; background: transparent; color: inherit;
  text-align: left; width: 100%; cursor: pointer;
  transition: background var(--dur-short);
}
.list.grouped .tile + .tile { border-top: 1px solid color-mix(in srgb, var(--outline-variant) 34%, transparent); }
.tile:hover { background: color-mix(in srgb, var(--on-surface) 5%, transparent); }
.tile.static { cursor: default; }
.tile.static:hover { background: transparent; }
.tile .lead {
  width: 40px; height: 40px; flex: none; border-radius: var(--r-full);
  display: grid; place-items: center;
  background: var(--secondary-container); color: var(--on-secondary-container);
}
.tile .lead.tertiary { background: var(--tertiary-container); color: var(--on-tertiary-container); }
.tile .lead.surface { background: var(--surface-container-high); color: var(--on-surface); }
.tile .body { flex: 1; min-width: 0; }
.tile .body .t { font-size: 15px; font-weight: 550; }
.tile .body .d { font-size: 12.5px; color: var(--on-surface-variant); margin-top: 2px; }
.tile .tail { flex: none; color: var(--on-surface-variant); font-size: 13px; display: flex; align-items: center; gap: 10px; }
.tile.selectable { border-radius: var(--r-lg); }
.tile.section-head {
  font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
  color: var(--primary); padding: 22px 18px 8px; min-height: 0; cursor: default;
}
.tile.selectable .radio {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--outline);
  flex: none; display: grid; place-items: center;
}
.tile.selectable[aria-selected="true"] .radio { border-color: var(--primary); }
.tile.selectable[aria-selected="true"] .radio::after {
  content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--primary);
}

/* ---------- 对话框 / 底表 ---------- */
/* 层级：页面 < 播放器(400) < 弹窗(500~) —— 播放器之上的弹窗必须盖住播放器 */
.scrim {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(var(--scrim), .55);
  animation: fade-in var(--dur-med) var(--ease-std);
  display: grid; place-items: center;
  padding: 20px;
}
@keyframes fade-in { from { opacity: 0 } to { opacity: 1 } }

.dialog {
  width: min(560px, 100%); max-height: min(84vh, 780px);
  display: flex; flex-direction: column;
  background: var(--surface-container-high);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-3);
  overflow: hidden;
  /* 入场只用 transform：不用带 opacity:0 的帧，动画被冻结（后台标签/合成器繁忙）
     时对话框也绝不「打开了却看不见」。 */
  animation: dialog-in var(--dur-med) var(--ease-emph);
}
.dialog.wide { width: min(880px, 100%); }
@keyframes dialog-in { from { transform: scale(.94) translateY(8px) } to { transform: none } }
.dialog .head {
  padding: 22px 24px 10px; display: flex; align-items: flex-start; gap: 12px;
}
.dialog .head h2 { font-size: 21px; font-weight: 600; margin: 0; flex: 1; }
.dialog .content { padding: 0 24px 8px; overflow-y: auto; flex: 1; }
.dialog .actions {
  display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 18px; flex-wrap: wrap;
}

.sheet-wrap {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(var(--scrim), .5);
  animation: fade-in var(--dur-med) var(--ease-std);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: min(720px, 100%); max-height: 86vh;
  background: var(--surface-container-high);
  border-radius: var(--r-3xl) var(--r-3xl) 0 0;
  box-shadow: var(--shadow-3);
  display: flex; flex-direction: column;
  animation: sheet-in var(--dur-long) var(--ease-emph);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
@keyframes sheet-in { from { transform: translateY(100%) } to { transform: none } }
.sheet .grab {
  width: 32px; height: 4px; border-radius: 99px; margin: 12px auto 4px;
  background: var(--outline-variant);
}
.sheet .head { padding: 8px 22px 6px; display: flex; align-items: center; gap: 10px; }
.sheet .head .grow { flex: 1; min-width: 0; }
.sheet .head h2 { font-size: 18px; font-weight: 650; margin: 0; }
.sheet .head .desc { font-size: 13px; color: var(--on-surface-variant); margin-top: 3px; }
.sheet .content { padding: 8px 16px 20px; overflow-y: auto; }
/* 弹窗内分区标题（对应上游 SectionHeader） */
.sheet-sec { font-size: 13.5px; font-weight: 650; color: var(--primary); padding: 14px 2px 8px; }
.sheet .content > .sheet-sec:first-child { padding-top: 2px; }

/* ---------- 菜单 ---------- */
.menu {
  position: fixed; z-index: 520;
  min-width: 190px; max-width: 280px; max-height: min(60vh, 420px);
  overflow-y: auto; padding: 8px;
  background: var(--surface-container-high);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-3);
  /* 入场只用 transform：不用带 opacity:0 帧的 dialog-in，
     动画被冻结（后台标签/合成器繁忙）时菜单也绝不「打开却看不见」。 */
  animation: menu-in var(--dur-short) var(--ease-std);
}
@keyframes menu-in { from { transform: scale(.96); } to { transform: none; } }
.menu button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 14px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--on-surface);
  font-size: 14px; text-align: left; cursor: pointer;
}
.menu button:hover { background: color-mix(in srgb, var(--on-surface) 8%, transparent); }
.menu button[aria-checked="true"] { color: var(--primary); font-weight: 600; }
.menu button.danger { color: var(--error); }
.menu .sep { height: 1px; margin: 6px 8px; background: var(--outline-variant); }

/* ---------- 提示条 ---------- */
.snackbar-host {
  position: fixed; left: 50%; bottom: calc(var(--bottom-h) + 16px);
  transform: translateX(-50%);
  z-index: 560; display: flex; flex-direction: column; gap: 8px;
  align-items: center; pointer-events: none; width: max-content; max-width: 92vw;
}
@media (min-width: 1000px) { .snackbar-host { bottom: 24px; } }
.snackbar {
  pointer-events: auto;
  display: flex; align-items: center; gap: 14px;
  padding: 13px 18px; min-height: 48px;
  background: var(--inverse-surface); color: var(--inverse-on-surface);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-2);
  font-size: 14px; max-width: 92vw;
  animation: snack-in var(--dur-med) var(--ease-emph);
}
@keyframes snack-in { from { transform: translateY(14px); opacity: 0 } to { transform: none; opacity: 1 } }
.snackbar.out { animation: snack-out var(--dur-short) var(--ease-std) forwards; }
@keyframes snack-out { to { opacity: 0; transform: translateY(8px) } }
.snackbar button {
  border: 0; background: transparent; color: var(--primary);
  font-weight: 700; font-size: 13.5px; cursor: pointer; padding: 4px 2px; flex: none;
}
[data-theme="dark"] .snackbar button { color: var(--primary); }

/* ---------- 空状态 / 错误 ---------- */
.state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 64px 24px; text-align: center;
  color: var(--on-surface-variant);
}
.state .icon { width: 64px; height: 64px; border-radius: var(--r-2xl);
  background: var(--surface-container-high); color: var(--on-surface-variant); }
.state .icon svg { width: 32px; height: 32px; }
.state h3 { margin: 6px 0 0; font-size: 16px; font-weight: 600; color: var(--on-surface); }
.state p { margin: 0; font-size: 13px; max-width: 42ch; line-height: 1.6; }

.progress-line {
  height: 4px; border-radius: 99px; overflow: hidden;
  background: var(--surface-container-highest);
}
.progress-line i {
  display: block; height: 100%; width: 40%; border-radius: 99px;
  background: var(--primary);
  animation: splash-slide 1.1s var(--ease-std) infinite;
}

/* 顶部加载条 */
.loadbar {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 300;
  background: transparent; overflow: hidden; pointer-events: none;
  opacity: 0; transition: opacity var(--dur-short);
}
.loadbar.on { opacity: 1; }
.loadbar::before {
  content: ""; display: block; height: 100%; width: 30%;
  background: var(--primary); border-radius: 99px;
  animation: loadbar 1.05s var(--ease-std) infinite;
}
@keyframes loadbar { 0% { margin-left: -30% } 100% { margin-left: 100% } }

/* 分区内容（ContentSection 对应） */
.content-section { margin-bottom: 8px; }
.content-section > .st {
  font-size: 12.5px; font-weight: 700; color: var(--primary);
  padding: 18px 18px 6px; letter-spacing: .4px;
}

/* 详情页头部 */
.hero {
  position: relative;
  padding: 18px 16px 10px;
  overflow: hidden;
}
.hero-bg {
  position: absolute; inset: -20px -20px 0;
  background-size: cover; background-position: center 30%;
  filter: blur(26px) saturate(1.25) brightness(.62);
  opacity: .55; z-index: 0;
}
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom,
    color-mix(in srgb, var(--surface) 45%, transparent),
    var(--surface) 88%);
}
.hero-inner { position: relative; z-index: 1; display: flex; gap: 16px; }
.hero-poster {
  width: 116px; flex: none; aspect-ratio: 2/3;
  border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow-2); background: var(--surface-container-high);
}
.hero-poster img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- 推荐页收起式大标题（对齐上游 SliverAppBar） ---------- */
.appbar.hero-bar {
  position: sticky; top: 0; z-index: 30;
  height: auto; padding: 30px 26px 18px;
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  transition: height .22s var(--ease-std), padding .22s var(--ease-std);
}
.appbar.hero-bar .bar-row { display: flex; align-items: center; gap: 8px; width: 100%; }
.appbar.hero-bar .headline { padding: 4px 12px; }
.appbar.hero-bar .headline .txt {
  font-size: 30px; font-weight: 700; letter-spacing: -.3px;
  transition: font-size .22s var(--ease-std);
}
.appbar.hero-bar .headline .icon.sm svg { width: 22px; height: 22px; transition: width .22s, height .22s; }
.appbar.hero-bar.collapsed { padding: 9px 22px; }
.appbar.hero-bar.collapsed .headline .txt { font-size: 17px; }
.appbar.hero-bar.collapsed .headline .icon.sm svg { width: 16px; height: 16px; }

/* ---------- 搜索页发现态（对齐上游 search_page） ---------- */
.search-discovery { max-width: 1100px; margin: 26px auto 0; }
.search-big {
  height: 58px; padding: 0 20px;
  display: flex; align-items: center; gap: 14px;
  background: var(--surface-container-high);
  border-radius: var(--r-full);
}
.search-big .icon { color: var(--on-surface-variant); }
.search-big input {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none;
  font: inherit; font-size: 15.5px; color: inherit; padding: 2px 0;
}
.search-cond {
  margin-top: 20px; width: 100%; padding: 12px 16px;
  display: flex; align-items: center; gap: 14px;
  border: 0; border-radius: var(--r-lg);
  background: transparent; color: inherit; cursor: pointer; text-align: left;
}
.search-cond:hover { background: color-mix(in srgb, var(--on-surface) 6%, transparent); }
.search-cond .body { flex: 1; min-width: 0; }
.search-cond .t { font-size: 14.5px; font-weight: 600; }
.search-cond .sub { font-size: 12.5px; color: var(--on-surface-variant); margin-top: 2px; }
.search-history { margin-bottom: 30px; }
.history-list { display: flex; flex-direction: column; }
.history-row {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 2px; border-radius: var(--r-md);
}
.history-row .history-kw {
  flex: 0 1 auto; padding: 10px 8px; border: 0; background: transparent;
  color: inherit; font-size: 14.5px; cursor: pointer; text-align: left;
  border-radius: var(--r-sm);
}
.history-row .history-kw:hover { background: color-mix(in srgb, var(--on-surface) 6%, transparent); }

/* ---------- 详情页（对齐上游沉浸式布局） ---------- */
.info-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-color: var(--surface);
  background-position: center; background-size: cover; background-repeat: no-repeat;
  filter: blur(70px) brightness(.3) saturate(.85);
  transform: scale(1.2);
  opacity: 0; transition: opacity var(--dur-long) var(--ease-std);
}
.info-bg.on { opacity: 1; }
.info-page { position: relative; z-index: 1; }
.info-title { font-size: 28px; font-weight: 700; margin: 4px 0 0; letter-spacing: -.3px; }
.info-alt { font-size: 13px; color: var(--on-surface-variant); margin-top: 4px; }
.info-head { display: flex; flex-wrap: wrap; gap: 26px 34px; margin-top: 20px; align-items: flex-start; }
.info-poster {
  width: 228px; aspect-ratio: 2 / 3; border-radius: var(--r-lg); overflow: hidden;
  background: var(--surface-container-high); flex: none;
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
}
.info-poster img { width: 100%; height: 100%; object-fit: cover; }
.info-meta { display: flex; flex-direction: column; gap: 14px; min-width: 190px; padding-top: 4px; }
.im-label { font-size: 13px; color: var(--on-surface-variant); margin-bottom: 2px; }
.im-strong { font-size: 24px; font-weight: 700; color: var(--primary); line-height: 1.25; }
.im-rating { display: flex; align-items: center; gap: 10px; }
.im-stars { display: inline-flex; gap: 2px; color: var(--primary); }
.im-stars .star.dim { opacity: .22; }
.collect-pill {
  margin-top: 8px; height: 42px; padding: 0 26px; border: 0; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 8px; width: fit-content;
  background: var(--primary-container); color: var(--on-primary-container);
  font-size: 14px; font-weight: 650; cursor: pointer;
  transition: filter var(--dur-short);
}
.collect-pill:hover { filter: brightness(1.08); }
.info-dist { margin-left: auto; min-width: 280px; padding-top: 4px; }
.dist-chart { display: flex; align-items: flex-end; gap: 14px; margin-top: 12px; height: 118px; }
.dist-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.dist-bar { width: min(24px, 100%); border-radius: 6px; background: color-mix(in srgb, var(--on-surface) 32%, transparent); }
.dist-num { font-size: 12px; color: var(--on-surface-variant); }
.info-summary.folded { max-height: 136px; overflow: hidden; }
.fold-wrap { position: relative; }
.fold-wrap .btn { margin-top: 8px; }
/* 详细信息：infobox 结构化条目 */
.info-ib { display: grid; grid-template-columns: minmax(96px, 160px) 1fr; gap: 8px 18px; margin-top: 8px; }
.info-ib .ib-k { font-size: 13px; color: var(--on-surface-variant); }
.info-ib .ib-v { font-size: 13.5px; line-height: 1.7; }
@media (max-width: 900px) { .info-dist { margin-left: 0; } .info-poster { width: 168px; } .info-ib { grid-template-columns: 96px 1fr; } }
.hero-info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.hero-title { font-size: 19px; font-weight: 700; line-height: 1.3; margin: 0; }
.hero-sub { font-size: 12.5px; color: var(--on-surface-variant); }
.hero-rating { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 700; color: var(--primary); }
.hero-actions { display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap; }

/* 剧集网格 */
.ep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 8px; }
.ep {
  height: 42px; border-radius: var(--r-md); border: 1px solid var(--outline-variant);
  background: var(--surface-container-low); color: var(--on-surface);
  font-size: 13px; font-weight: 600; cursor: pointer;
  display: grid; place-items: center;
  transition: background var(--dur-short), border-color var(--dur-short);
}
.ep:hover { background: var(--surface-container-high); }
.ep[aria-current="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.ep.watched { border-color: color-mix(in srgb, var(--primary) 50%, transparent); }

/* 播放来源分组（对应 source_sheet_view.dart） */
.src-group {
  margin-bottom: 10px;
  border-radius: var(--r-xl);
  overflow: hidden;
  background: var(--surface-container-low);
}
.src-head { display: flex; align-items: center; gap: 4px; padding-right: 6px; }
.src-head-main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 8px 4px 8px 14px;
  border: 0; background: transparent; color: inherit; cursor: pointer; text-align: left;
}
.src-name {
  flex: 1; min-width: 0; font-size: 14px; font-weight: 550;
  color: var(--on-surface-variant);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.src-status { flex: none; font-size: 12px; color: var(--on-surface-variant); }
.src-status.primary { color: var(--primary); font-weight: 600; }
.src-status.error { color: var(--error); }
.src-caret { flex: none; color: var(--on-surface-variant); transition: transform var(--dur-short) var(--ease-std); }
.src-caret.open { transform: rotate(180deg); }
.src-keyword { font-size: 12px; color: var(--on-surface-variant); padding: 0 14px 8px; }
.src-list { padding: 0 8px 8px; }
.src-result { border-radius: var(--r-lg); min-height: 56px; }
.src-result .t { font-size: 14.5px; font-weight: 500; }
.src-result .primary-icon { color: var(--primary); }
.src-more {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; width: calc(100% - 16px); margin: 4px 8px 8px;
  border: 0; border-radius: var(--r-lg);
  background: var(--surface-container-high); color: var(--primary);
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.src-more:hover { background: var(--surface-container-highest); }
.src-searching {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px 18px; font-size: 13.5px; color: var(--on-surface-variant);
}
.src-searching .spinner {
  border-radius: 50%; border: 2px solid var(--outline-variant);
  border-top-color: var(--primary); animation: spin .9s linear infinite; flex: none;
}
.src-empty { padding: 14px 16px 18px; }
.src-empty-text { font-size: 13.5px; color: var(--on-surface-variant); }
.src-issue { padding: 12px 16px 16px; }
.src-issue-title { font-size: 13.5px; font-weight: 600; }
.src-issue-hint { font-size: 12.5px; color: var(--on-surface-variant); margin-top: 2px; }

/* 评论 */
.comment { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid color-mix(in srgb, var(--outline-variant) 30%, transparent); }
.comment .av { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-container-high); }
.comment .body { min-width: 0; flex: 1; }
.comment .who { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.comment .when { font-size: 11.5px; color: var(--on-surface-variant); font-weight: 400; }
.comment .txt { font-size: 13.5px; margin-top: 4px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.stars { display: inline-flex; gap: 1px; color: var(--primary); }
.stars svg { width: 13px; height: 13px; }

/* 人物卡 */
.person {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 84px; flex: none;
}
.person .ph { width: 72px; height: 72px; border-radius: 50%; overflow: hidden; background: var(--surface-container-high); }
.person .ph img { width: 100%; height: 100%; object-fit: cover; }
.person .n { font-size: 12px; font-weight: 600; text-align: center; line-height: 1.3; }
.person .r { font-size: 11px; color: var(--on-surface-variant); text-align: center; }

/* 滚动横条 */
.hscroll { display: flex; gap: 12px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }

/* 时间表（对齐上游 timeline_page） */
.tl-wrap { max-width: 1280px; margin: 0 auto; padding-top: 8px; }
.season-btn {
  display: flex; align-items: center; gap: 12px;
  margin: 4px 0 0; padding: 6px 10px 6px 2px;
  border: 0; background: transparent; color: var(--on-surface);
  cursor: pointer; border-radius: 20px; text-align: left;
}
.season-btn:hover { background: color-mix(in srgb, var(--on-surface) 6%, transparent); }
.season-btn .txt { font-size: clamp(24px, 3vw, 32px); font-weight: 700; letter-spacing: -.4px; }
.season-btn .chev {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--secondary-container); color: var(--on-secondary-container);
}
.season-btn .chev svg { width: 22px; height: 22px; }
.season-sub { margin: 4px 0 18px; font-size: 13.5px; color: var(--on-surface-variant); }

/* 周选择条：单个圆角容器内 7 等分 Tab，选中为主色胶囊（今天显示「今天」） */
.week-strip {
  display: flex; gap: 4px; padding: 4px; margin: 0 0 18px;
  background: var(--surface-container-low); border-radius: 28px;
  overflow-x: auto; scrollbar-width: none;
}
.week-strip::-webkit-scrollbar { display: none; }
.day-tab {
  flex: 1 0 64px; min-height: 64px; padding: 6px 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 0; border-radius: 24px; background: transparent;
  color: var(--on-surface-variant); font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background var(--dur-short), color var(--dur-short);
}
.day-tab:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.day-tab .n { font-size: 11.5px; font-weight: 500; opacity: .92; }
.day-tab[aria-selected="true"] { background: var(--primary); color: var(--on-primary); }
.day-tab[aria-selected="true"]:hover { background: var(--primary); }

/* 横版番剧卡（对应 BangumiTimelineCard） */
.tl-grid { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); }
.tl-card {
  display: flex; gap: 16px; padding: 12px; min-height: 160px;
  border: 0; border-radius: 28px; background: var(--surface-container-low);
  color: var(--on-surface); text-align: left; cursor: pointer;
  transition: background var(--dur-short), box-shadow var(--dur-short);
}
.tl-card:hover { background: var(--surface-container); box-shadow: var(--shadow); }
.tl-card .poster {
  position: relative; width: 88px; flex: none; border-radius: 16px;
  overflow: hidden; background: var(--surface-container-high);
}
.tl-card .poster img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity var(--dur-long) var(--ease-std);
}
.tl-card .poster img.loaded { opacity: 1; }
.tl-card .poster .ph {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: color-mix(in srgb, var(--on-surface-variant) 50%, transparent);
  font-size: 24px; font-weight: 700;
}
.tl-card .body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tl-card .title {
  font-size: 16px; font-weight: 700; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tl-card .meta {
  font-size: 12px; line-height: 1.35; color: var(--on-surface-variant); margin-top: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tl-card .foot { margin-top: auto; display: flex; align-items: center; gap: 8px; padding-top: 10px; }
.tl-card .score {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 10px; border-radius: 999px;
  background: var(--secondary-container); color: var(--on-secondary-container);
  font-size: 12px; font-weight: 700;
}
.tl-card .score svg { width: 16px; height: 16px; }
.tl-card .score.none { background: transparent; padding: 6px 0; color: var(--on-surface-variant); font-weight: 500; }
.tl-card .mark { margin-left: auto; color: var(--primary); display: inline-flex; }
.tl-card .mark svg { width: 20px; height: 20px; }
@media (max-width: 599px) {
  .tl-card { gap: 12px; min-height: 144px; }
  .tl-card .poster { width: 80px; }
}

/* 顶栏「排序与筛选」胶囊按钮（FilledButton.tonal + 图标角标） */
.tl-options {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px;
  margin-left: auto; border: 0; border-radius: 999px; flex: none;
  background: var(--secondary-container); color: var(--on-secondary-container);
  font-size: 13.5px; font-weight: 650; cursor: pointer;
  transition: box-shadow var(--dur-short);
}
.tl-options:hover { box-shadow: var(--shadow); }
.tl-options .opt-ico { position: relative; display: inline-flex; }
.tl-options .opt-ico svg { width: 19px; height: 19px; }
.tl-options .opt-ico .badge {
  position: absolute; top: -6px; right: -8px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--primary); color: var(--on-primary);
  font-size: 10.5px; font-weight: 700; font-style: normal;
  display: grid; place-items: center;
}

/* 放送季度弹窗：年份分组 + 4 季胶囊（未来的季度禁用） */
.season-group {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  background: var(--surface-container-low); border-radius: var(--r-xl); padding: 8px;
  margin-bottom: 10px;
}
.season-opt {
  height: 44px; border: 0; border-radius: 999px; background: transparent;
  color: var(--on-surface); font-size: 13.5px; font-weight: 550; cursor: pointer;
  transition: background var(--dur-short), color var(--dur-short);
}
.season-opt:hover:not(:disabled) { background: color-mix(in srgb, var(--on-surface) 6%, transparent); }
.season-opt[aria-pressed="true"] { background: var(--secondary-container); color: var(--on-secondary-container); font-weight: 650; }
.season-opt:disabled { opacity: .38; cursor: not-allowed; }

/* 统计卡 */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat {
  padding: 18px; border-radius: var(--r-2xl);
  background: var(--surface-container-low);
}
.stat .v { font-size: 30px; font-weight: 700; line-height: 1.1; }
.stat .k { font-size: 12.5px; color: var(--on-surface-variant); margin-top: 2px; }

/* 工具卡网格 */
.tool-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 720px) { .tool-grid { grid-template-columns: repeat(4, 1fr); } }
.tool-card {
  padding: 18px 16px; border-radius: var(--r-2xl); border: 0;
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  background: var(--surface-container-low); color: var(--on-surface);
  text-align: left; cursor: pointer; min-height: 118px;
  transition: background var(--dur-short), transform var(--dur-med) var(--ease-emph);
}
.tool-card:hover { transform: translateY(-2px); }
.tool-card .ic { width: 40px; height: 40px; border-radius: var(--r-full); display: grid; place-items: center;
  background: var(--secondary-container); color: var(--on-secondary-container); }
.tool-card .t { font-size: 14px; font-weight: 650; }
.tool-card .d { font-size: 12px; color: var(--on-surface-variant); }

/* ---------- 历史记录页（对齐上游 history_list_view / history_record_tile） ---------- */
.history-bar h1.h-bar-title { font-size: 23px; font-weight: 700; letter-spacing: .2px; flex: none; }
.history-bar .grow { flex: 1; }

.history-wrap { max-width: 960px; margin: 0 auto; padding: 0 16px 96px; }
@media (min-width: 600px) { .history-wrap { padding: 0 24px 96px; } }

/* 搜索框：高 56 胶囊（圆角 28），focus 时主色描边 */
.h-search {
  display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 0 10px 0 18px;
  background: var(--surface-container-high);
  border-radius: 28px;
  transition: box-shadow var(--dur-short), background var(--dur-short);
}
.h-search:focus-within {
  background: var(--surface-container-highest);
  box-shadow: inset 0 0 0 2px var(--primary);
}
.h-search > .icon { color: var(--on-surface-variant); }
.h-search input {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none;
  font-size: 15px; padding: 12px 0;
}
.h-search input::placeholder { color: var(--on-surface-variant); }
.h-search .icon-btn[hidden] { display: none; }

/* 筛选 chips：选中圆角 20 + 对勾，未选圆角 12（AnimatedContainer 250ms） */
.h-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.h-chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 12px 20px;
  border: 0; border-radius: 12px;
  background: var(--surface-container-low); color: var(--on-surface-variant);
  font-size: 14px; font-weight: 550; cursor: pointer; white-space: nowrap;
  transition: background var(--dur-med) var(--ease-std), border-radius var(--dur-med) var(--ease-std), color var(--dur-med);
}
.h-chip:hover { background: var(--surface-container); }
.h-chip.on {
  border-radius: 20px;
  background: var(--secondary-container); color: var(--on-secondary-container);
  font-weight: 700;
}
.h-chip .icon svg { width: 18px; height: 18px; }

/* 计数行 */
.h-count { margin-top: 20px; font-size: 14px; color: var(--on-surface-variant); }

/* 日期分组头（titleLarge 700 + 右侧「N 条」） */
.h-group-head {
  display: flex; align-items: center; gap: 10px;
  padding: 24px 4px 12px;
  font-size: 22px; font-weight: 700; letter-spacing: .2px;
}
.h-group-count { font-size: 14px; font-weight: 650; color: var(--on-surface-variant); }

/* 连体卡片（surfaceContainerLow，组内首末张 24 圆角、其余 4，行距 2px） */
.h-card {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 2px; padding: 16px;
  background: var(--surface-container-low); color: var(--on-surface);
  overflow: hidden;
}
.h-card.clickable { cursor: pointer; }
.h-card.clickable:hover { background: color-mix(in srgb, var(--on-surface) 4%, var(--surface-container-low)); }
.h-cover {
  width: 72px; aspect-ratio: 5 / 7; flex: none;
  border-radius: 12px; overflow: hidden;
  background: var(--surface-container-high);
  display: grid; place-items: center;
  color: var(--on-surface-variant);
}
.h-cover img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity var(--dur-long) var(--ease-std); }
.h-cover img.loaded { opacity: 1; }
@media (max-width: 599px) { .h-cover { width: 60px; } }
.h-body { flex: 1; min-width: 0; }
.h-title {
  font-size: 16px; font-weight: 700; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.h-ep {
  margin-top: 6px; font-size: 14px; color: var(--on-surface-variant);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.h-pos { margin-top: 4px; font-size: 12.5px; font-weight: 600; color: var(--primary); }
.h-meta {
  margin-top: 8px; font-size: 12px; color: var(--on-surface-variant); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere;
}

/* 右侧动作：48px 圆形按钮（play: primaryContainer，more: 透明，删除: errorContainer） */
.h-actions { flex: none; display: flex; align-items: center; gap: 4px; }
.h-act {
  width: 48px; height: 48px; border: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  transition: background var(--dur-short), transform var(--dur-short) var(--ease-std);
}
.h-act:active { transform: scale(.94); }
.h-act.play { background: var(--primary-container); color: var(--on-primary-container); }
.h-act.play:hover { filter: brightness(1.06); }
.h-act.more { background: transparent; color: var(--on-surface-variant); }
.h-act.more:hover { background: color-mix(in srgb, var(--on-surface) 8%, transparent); }
.h-act.danger { background: var(--error-container); color: var(--on-error-container); }
.h-act.danger:hover { filter: brightness(1.06); }
.h-busy { width: 48px; height: 48px; display: grid; place-items: center; }
.h-busy .spinner {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--outline-variant); border-top-color: var(--primary);
  animation: spin .9s linear infinite;
}

/* 编辑态顶栏按钮（IconButton.filledTonal / FilledButton.tonal） */
.h-edit {
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: var(--secondary-container); color: var(--on-secondary-container);
  transition: filter var(--dur-short), transform var(--dur-short) var(--ease-std);
}
.h-edit:hover { filter: brightness(1.06); }
.h-edit:active { transform: scale(.95); }
.h-done {
  height: 40px; padding: 0 18px; border: 0; border-radius: var(--r-full);
  background: var(--secondary-container); color: var(--on-secondary-container);
  font-size: 14px; font-weight: 650; cursor: pointer;
  transition: filter var(--dur-short);
}
.h-done:hover { filter: brightness(1.06); }
.h-done:disabled { opacity: .38; cursor: not-allowed; }

/* 空状态 */
.h-empty { padding: 72px 24px; }

@media (max-width: 599px) {
  .history-bar h1.h-bar-title { font-size: 20px; }
  .h-card { align-items: flex-start; }
}

/* 播放器 */
.player-shell {
  position: fixed; inset: 0; z-index: 400;
  background: #000; color: #fff;
  display: flex; flex-direction: column;
  animation: fade-in var(--dur-med) var(--ease-std);
}
.player-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #000; }
.player-stage video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.player-stage.ratio-fill video { object-fit: cover; }
.player-stage.ratio-16-9 video { object-fit: fill; }
.danmaku-layer {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none;
  contain: strict;
}
.dm {
  position: absolute; white-space: nowrap; will-change: transform;
  font-weight: var(--dm-weight, 600);
  text-shadow: var(--dm-stroke, -1px 0 rgba(0,0,0,.85), 1px 0 rgba(0,0,0,.85), 0 -1px rgba(0,0,0,.85), 0 1px rgba(0,0,0,.85));
}
.dm.top, .dm.bottom { transform: translateX(-50%); }
.player-ui {
  position: absolute; inset: 0; z-index: 3;
  display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(to bottom, rgba(0,0,0,.62) 0%, rgba(0,0,0,0) 22%,
              rgba(0,0,0,0) 62%, rgba(0,0,0,.78) 100%);
  opacity: 1; transition: opacity var(--dur-med) var(--ease-std);
  /* 渐变遮罩层本身不接点击，否则会挡住 center-hit（z-index 2 在其下），
     视频区域的单击播放/暂停就永远点不到；只有上下两条控制栏接收事件。 */
  pointer-events: none;
}
.player-ui.hide { opacity: 0; }
.player-top, .player-bottom { pointer-events: auto; }
.player-top { display: flex; align-items: center; gap: 6px; padding: 12px 14px; }
.player-top .t { flex: 1; min-width: 0; font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 3px #000; }
.player-bottom { padding: 6px 14px 12px; display: flex; flex-direction: column; gap: 6px; }
.player-bottom .row { display: flex; align-items: center; gap: 4px; }
.player-bottom .grow { flex: 1; }
.player-btn {
  width: 38px; height: 38px; border: 0; border-radius: 50%;
  background: transparent; color: #fff; display: grid; place-items: center;
  cursor: pointer; opacity: .92; transition: background var(--dur-short), opacity var(--dur-short);
}
.player-btn:hover { background: rgba(255,255,255,.14); opacity: 1; }
.player-btn.on { color: var(--primary); }
.player-btn.play { width: 46px; height: 46px; }
.player-btn.play svg { width: 30px; height: 30px; }
.player-seek {
  position: relative; flex: 1; min-width: 60px; height: 18px;
  display: flex; align-items: center; cursor: pointer;
  touch-action: none; /* 触摸拖动进度条时不要被页面滚动抢走手势 */
}
.player-seek .track { position: absolute; left: 0; right: 0; height: 4px; border-radius: 99px; background: rgba(255,255,255,.26); pointer-events: none; }
.player-seek .buf { position: absolute; left: 0; height: 4px; border-radius: 99px; background: rgba(255,255,255,.4); pointer-events: none; }
.player-seek .fill { position: absolute; left: 0; height: 4px; border-radius: 99px; background: var(--primary); pointer-events: none; }
.player-seek .knob {
  position: absolute; width: 13px; height: 13px; border-radius: 50%;
  background: var(--primary); transform: translateX(-50%); pointer-events: none;
}
.player-seek:hover .track, .player-seek:hover .buf, .player-seek:hover .fill { height: 6px; }
.time-label { font-size: 12px; font-variant-numeric: tabular-nums; opacity: .9; min-width: 92px; text-align: center; }
.player-center-hit { position: absolute; left: 0; right: 0; top: 0; bottom: 96px; z-index: 2; }
/* 播放器 HUD（音量/倍速瞬时提示）与解析中提示 */
.player-hud {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.96);
  z-index: 7; padding: 10px 18px; border-radius: 12px; pointer-events: none;
  background: rgba(0,0,0,.62); color: #fff; font-size: 15px; font-weight: 600;
  opacity: 0; transition: opacity .18s ease, transform .18s ease;
}
.player-hud.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.player-hint { margin-top: 12px; font-size: 13.5px; opacity: .85; }
.player-fatal {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  z-index: 4; width: min(420px, calc(100vw - 48px)); max-height: 76vh; overflow: auto;
  padding: 22px 20px 18px; text-align: center;
  background: rgba(20,22,18,.9); backdrop-filter: blur(16px);
  border-radius: var(--r-xl); box-shadow: var(--shadow-3);
}
.player-fatal .icon { display: inline-flex; opacity: .9; }
.player-fatal .icon svg { width: 34px; height: 34px; fill: var(--error); }
.player-fatal h3 { margin: 10px 0 6px; font-size: 16px; font-weight: 650; }
.player-fatal p { margin: 0; font-size: 13.5px; line-height: 1.7; opacity: .86; word-break: break-word; }
.player-fatal pre {
  margin: 10px 0 0; padding: 10px; text-align: left; font-size: 11.5px;
  white-space: pre-wrap; word-break: break-all; opacity: .7;
  background: rgba(0,0,0,.35); border-radius: var(--r-sm); max-height: 160px; overflow: auto;
}
.player-big-state {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 2; pointer-events: none;
}
.player-big-state .spinner {
  width: 52px; height: 52px; border-radius: 50%;
  border: 4px solid rgba(255,255,255,.22); border-top-color: var(--primary);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }
/* ---------- 播放器内暗色上下文 ----------
   播放器之上的菜单/底表/对话框/侧板统一走暗色令牌（上游播放器强制暗色主题），
   通过局部覆盖 CSS 变量让现有组件（slider/segmented/switch/chip/comment）自动变暗。 */
.side-panel, .menu.dark, .dialog.dark, .sheet.dark {
  --primary: #A1D39A;
  --on-primary: #0A390F;
  --primary-container: #235024;
  --on-primary-container: #BCF0B4;
  --secondary-container: #3B4B38;
  --on-secondary-container: #D5E8CF;
  --tertiary-container: #1E4D52;
  --on-tertiary-container: #BCEBF0;
  --surface: #11140E;
  --on-surface: #E1E4DB;
  --on-surface-variant: #C2C9BD;
  --surface-container-lowest: #0C0F09;
  --surface-container-low: #191D17;
  --surface-container: #1D211B;
  --surface-container-high: #282B25;
  --surface-container-highest: #32362F;
  --outline: #8C9388;
  --outline-variant: #424940;
  --error: #FFB4AB;
  --on-error: #690005;
  --error-container: #93000A;
  --on-error-container: #FFDAD6;
  color-scheme: dark;
}
.dialog.dark { background: var(--surface-container-high); color: var(--on-surface); }
.sheet.dark { background: var(--surface-container-low); color: var(--on-surface); }
.menu.dark { background: var(--surface-container); border: 1px solid rgba(255,255,255,.08); }
.menu.dark button:hover { background: rgba(255,255,255,.08); }
/* 菜单二级结构（desc 副标题 / 子菜单箭头 / 前导对勾） */
.menu .menu-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.menu .menu-desc { font-size: 11.5px; opacity: .65; font-weight: 400; }
.menu .icon.sm { flex: none; opacity: .85; }
.menu .lead-check { color: var(--primary); opacity: 1; }

/* ---------- 底栏文字按钮 / 弹幕输入区（对应上游 _wideControls） ---------- */
.player-btn-text {
  width: auto; height: 38px; border-radius: var(--r-sm);
  padding: 0 10px; font-size: 13.5px; font-weight: 600; letter-spacing: .2px;
  white-space: nowrap;
}
.player-btn.sm { width: 32px; height: 32px; }
.player-btn.sm svg { width: 20px; height: 20px; }
.danmaku-area {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 2px;
}
.danmaku-box {
  display: flex; align-items: center; gap: 4px;
  width: min(500px, 44vw); height: 33px;
  margin-left: 4px; padding: 0 3px 0 10px;
  background: rgba(255,255,255,.16); border-radius: 8px;
}
.danmaku-input {
  flex: 1; min-width: 40px; height: 100%;
  border: 0; outline: none; background: transparent; color: #fff;
  font-size: 13.5px;
}
.danmaku-input::placeholder { color: rgba(255,255,255,.6); }
.danmaku-send {
  flex: none; height: 27px; padding: 0 12px;
  border: 0; border-radius: 6px; cursor: pointer;
  background: var(--primary-container); color: var(--on-primary-container);
  font-size: 12.5px; font-weight: 650;
}
.danmaku-send:disabled { background: rgba(255,255,255,.16); color: rgba(255,255,255,.55); cursor: default; }

/* ---------- 窄屏 compact（对应上游 compact 布局：<600 逻辑像素） ---------- */
.compact-only { display: none !important; }
@media (max-width: 640px) {
  .wide-only { display: none !important; }
  .compact-only { display: grid !important; }
  .player-top { padding: 8px 10px; gap: 2px; }
  .player-top .t { font-size: 13px; }
  .player-bottom { padding: 4px 10px 10px; gap: 4px; }
  .player-btn { width: 40px; height: 40px; }
  .player-btn.play { width: 44px; height: 44px; }
  .time-label { font-size: 11px; min-width: 84px; text-align: left; }
  .player-center-hit { bottom: 84px; }
  .side-panel { width: 100vw; border-radius: 0; }
}

/* ---------- 选集 / 评论侧板（对应上游 episode_selection_panel + VideoSidePanel） ---------- */
@keyframes drawer-in { from { transform: translateX(100%) } to { transform: none } }
.side-scrim {
  position: absolute; inset: 0; z-index: 5;
  background: linear-gradient(to right, rgba(0,0,0,.55), rgba(0,0,0,.12) 55%, transparent);
  animation: fade-in var(--dur-med) var(--ease-std);
}
.side-panel {
  position: absolute; right: 0; top: 0; bottom: 0; z-index: 6;
  width: min(430px, 94vw);
  background: var(--surface-container);
  border-radius: 28px 0 0 28px;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-3);
  animation: drawer-in var(--dur-med) var(--ease-std);
}
.sp-tabs { display: flex; flex: none; height: 48px; }
.sp-tab {
  flex: 1; border: 0; background: transparent; color: var(--on-surface-variant);
  font-size: 14px; font-weight: 550; cursor: pointer; position: relative;
}
.sp-tab:hover { color: var(--on-surface); }
.sp-tab.active { color: var(--primary); font-weight: 700; }
.sp-tab.active::after {
  content: ""; position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 0; width: min(56px, 60%); height: 3px; border-radius: 99px 99px 0 0;
  background: var(--primary);
}
.sp-tabs.in-sheet {
  margin: 0 22px;
  border-bottom: 1px solid color-mix(in srgb, var(--outline-variant) 40%, transparent);
}
.sp-body { flex: 1; min-height: 0; overflow-y: auto; }
.sp-title {
  margin: 16px 18px 10px; font-size: 20px; font-weight: 700; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sp-road {
  display: flex; align-items: center; gap: 8px; width: calc(100% - 32px);
  margin: 0 16px 6px; padding: 11px 16px;
  border: 0; border-radius: 20px; cursor: pointer; text-align: left;
  background: var(--surface-container-low); color: var(--on-surface);
}
.sp-road:hover { background: var(--surface-container-high); }
.sp-road .col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sp-road .label { font-size: 12px; color: var(--on-surface-variant); }
.sp-road .name {
  font-size: 14px; font-weight: 700; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sp-road .icon { flex: none; color: var(--on-surface-variant); }
.sp-road .icon svg { width: 22px; height: 22px; }
.sp-toolbar {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; gap: 2px;
  padding: 8px 8px 8px 16px;
  background: var(--surface-container);
}
.sp-toolbar .count { font-size: 13px; color: var(--on-surface-variant); }
.sp-tool { color: var(--on-surface); }
.sp-tool:disabled { opacity: .35; cursor: default; }
.sp-tool.fill { background: var(--secondary-container); color: var(--on-secondary-container); }
.sp-eps { display: flex; flex-direction: column; gap: 2px; padding: 0 16px 16px; }
.sp-ep {
  border: 0; text-align: left; cursor: pointer;
  background: var(--surface-container-low); color: var(--on-surface);
  min-height: 56px; padding: 12px 20px; border-radius: 4px;
}
.sp-ep.first { border-radius: 20px 20px 4px 4px; }
.sp-ep.last { border-radius: 4px 4px 20px 20px; }
.sp-ep.first.last { border-radius: 20px; }
.sp-ep:hover:not(.selected) { background: var(--surface-container-high); }
.sp-ep.selected { background: var(--primary); color: var(--on-primary); border-radius: 20px; }
.sp-ep .col { display: flex; flex-direction: column; gap: 2px; }
.sp-ep .name {
  font-size: 14px; font-weight: 500; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sp-ep.selected .name { font-weight: 700; }
.sp-ep .sub { font-size: 12px; opacity: .85; }
.sp-ep.thin { min-height: 44px; padding: 9px 16px; }
.sp-eps.picker { max-height: 52vh; overflow-y: auto; margin: 4px 0 8px; }
.sp-empty { padding: 36px 20px; text-align: center; font-size: 13.5px; color: var(--on-surface-variant); }
/* 弹幕切换面板头部 */
.dsw-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 2px 20px; }
.dsw-head h3 { margin: 0; font-size: 17px; font-weight: 700; flex: 1; }
.dsw-sub { padding: 2px 20px 10px; font-size: 12px; color: var(--on-surface-variant); }

/* EP 卡片 + 评论工具栏（对应上游 _EpisodeHeader / _buildToolbar） */
.sp-epcard {
  margin: 14px 16px 4px; padding: 18px;
  background: var(--primary-container); color: var(--on-primary-container);
  border-radius: 28px;
}
.sp-epcard .row { display: flex; align-items: center; gap: 8px; }
.ep-chip {
  background: var(--primary); color: var(--on-primary);
  border-radius: 12px; padding: 7px 12px; font-size: 13px; font-weight: 700;
}
.sp-switch {
  display: inline-flex; align-items: center; gap: 7px;
  border: 0; border-radius: var(--r-full); cursor: pointer;
  padding: 10px 16px; background: var(--surface); color: var(--primary);
  font-size: 13px; font-weight: 650;
}
.sp-switch .icon svg { width: 18px; height: 18px; }
.ep-title { margin-top: 14px; font-size: 18px; font-weight: 700; line-height: 1.3; }
.ep-sub {
  margin-top: 5px; font-size: 12.5px; opacity: .8;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sp-ct-toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 20px 6px; }
.ct-title { font-size: 15px; font-weight: 700; }
.ct-badge {
  background: var(--secondary-container); color: var(--on-secondary-container);
  border-radius: var(--r-full); padding: 3px 11px; font-size: 12.5px; font-weight: 650;
}
.sp-ct-sort {
  display: inline-flex; align-items: center; gap: 4px;
  border: 0; background: transparent; cursor: pointer;
  color: var(--primary); font-size: 13px; font-weight: 550; padding: 8px 6px;
}
.sp-ct-sort .icon svg { width: 17px; height: 17px; }
.sp-ct-refresh {
  width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center;
  background: var(--secondary-container); color: var(--on-secondary-container);
}
.sp-ct-refresh svg { width: 21px; height: 21px; }
.sp-clist { padding: 0 20px; }
.sp-ct-footer { padding: 10px 20px 24px; text-align: center; font-size: 12px; color: var(--on-surface-variant); }

/* ---------- 弹幕设置 / 播放信息（底表内容） ---------- */
.dm-settings { padding: 2px 14px 16px; }
.set-title {
  margin: 16px 4px 8px; font-size: 12.5px; font-weight: 700; letter-spacing: .4px;
  color: var(--primary);
}
.set-card {
  background: color-mix(in srgb, var(--on-surface) 6%, transparent);
  border-radius: 16px; padding: 2px 14px;
}
.set-tile { padding: 12px 0; }
.set-tile + .set-tile { border-top: 1px solid color-mix(in srgb, var(--outline-variant) 35%, transparent); }
.set-tile .row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.set-tile.row { display: flex; align-items: center; gap: 10px; }
.set-tile .t { font-size: 14px; font-weight: 550; }
.set-tile .t.grow { flex: 1; min-width: 0; }
.set-tile .val {
  font-size: 12px; font-weight: 650; padding: 2px 9px; border-radius: 8px;
  background: color-mix(in srgb, var(--on-surface) 10%, transparent);
  font-variant-numeric: tabular-nums;
}
.set-tile .desc { font-size: 12.5px; color: var(--on-surface-variant); }
.set-tile.as-btn {
  width: 100%; border: 0; background: transparent; color: inherit;
  text-align: left; cursor: pointer; border-radius: 10px;
}
.set-tile.as-btn:hover { background: color-mix(in srgb, var(--on-surface) 6%, transparent); }
.set-tile .icon.sm { flex: none; color: var(--on-surface-variant); }
.dm-type-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 4px 0; }
.dm-type-chips .chip.active {
  background: var(--secondary-container); color: var(--on-secondary-container); border-color: transparent;
}

/* 播放信息概览 */
.vd-av { padding: 4px 8px 10px; }
.vd-resolution { font-size: 27px; font-weight: 650; font-variant-numeric: tabular-nums; }
.vd-metrics { display: flex; gap: 32px; margin-top: 12px; }
.vd-metrics .lb { font-size: 12px; color: var(--on-surface-variant); margin-bottom: 2px; }
.vd-metrics > div > div:last-child { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.vd-value {
  flex: 1; min-width: 0; font-size: 12.5px; color: var(--on-surface-variant);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vd-log {
  max-height: 46vh; overflow-y: auto;
  background: color-mix(in srgb, var(--on-surface) 6%, transparent);
  border-radius: 12px; padding: 6px 2px;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.5;
}
.vd-log-row { padding: 4px 10px; color: var(--on-surface-variant); word-break: break-all; }

/* 「发送到」选择框 */
.dm-dest { display: flex; flex-direction: column; gap: 6px; padding: 4px 0 8px; }
.dm-dest-row {
  display: flex; align-items: center; gap: 14px;
  border: 0; background: transparent; color: inherit; text-align: left;
  padding: 12px; border-radius: 14px; cursor: pointer;
}
.dm-dest-row:hover { background: color-mix(in srgb, var(--on-surface) 8%, transparent); }
.dm-dest-row .icon { color: var(--primary); }
.dm-dest-row .icon svg { width: 24px; height: 24px; }
.dm-dest-row .t { font-size: 14.5px; font-weight: 600; }
.dm-dest-row .s { font-size: 12.5px; color: var(--on-surface-variant); margin-top: 1px; }

/* 屏蔽词管理 */
.shield-list {
  max-height: 44vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px; margin-top: 4px;
}
.shield-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 4px 4px 14px; border-radius: 10px;
  background: color-mix(in srgb, var(--on-surface) 6%, transparent); font-size: 13.5px;
}

/* 快捷键表 */
.kbd-table { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: center; }
.kbd-table .k { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
kbd {
  font-family: var(--font); font-size: 11.5px; font-weight: 600;
  padding: 2px 7px; border-radius: var(--r-xs);
  background: var(--surface-container-highest);
  border: 1px solid var(--outline-variant);
  border-bottom-width: 2px;
}

/* 规则编辑器 JSON 区 */
.code-area {
  width: 100%; min-height: 260px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.65;
  background: var(--surface-container-lowest);
  color: var(--on-surface);
  border: 1px solid var(--outline-variant);
  border-radius: var(--r-md); padding: 12px;
  resize: vertical; outline: none;
  tab-size: 2;
}
.code-area:focus { border-color: var(--primary); }
.issues { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.issue {
  font-size: 12.5px; padding: 8px 12px; border-radius: var(--r-sm);
  background: var(--error-container); color: var(--on-error-container);
}
.issue.ok { background: var(--primary-container); color: var(--on-primary-container); }

/* 杂项 */
.muted { color: var(--on-surface-variant); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px } .mt-12 { margin-top: 12px } .mt-16 { margin-top: 16px }
.mt-24 { margin-top: 24px } .mb-8 { margin-bottom: 8px } .mb-16 { margin-bottom: 16px }
.grow { flex: 1; }
.nowrap { white-space: nowrap; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hidden { display: none !important; }
.center { text-align: center; }
.pill-num {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px;
  background: var(--surface-container-highest); color: var(--on-surface-variant);
  font-size: 11px; font-weight: 700; display: inline-grid; place-items: center;
}

@media (max-width: 999px) {
  .fab { bottom: calc(var(--bottom-h) + 18px); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ============================================================
   我的页（1:1 对齐上游 my_space_view：1120 限宽 / 50-25-25 磁贴）
   ============================================================ */
.my-wrap { max-width: 1120px; margin: 0 auto; }
.my-top { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: stretch; padding-top: 10px; }
.my-heading { display: flex; align-items: center; gap: 12px; min-width: 0; }
.my-heading h1 {
  flex: 1; min-width: 0; margin: 0;
  font-size: 36px; font-weight: 800; letter-spacing: -.3px; line-height: 1.2;
}

/* Material 形状徽章（太阳 / 四叶草）：圆并集 SVG 铺满底层 */
.shape-icon { position: relative; flex: none; display: grid; place-items: center; }
.shape-icon .shape-bg { position: absolute; inset: 0; width: 100%; height: 100%; fill: currentColor; }
.my-avatar { width: 64px; height: 64px; color: var(--tertiary-container); }
.my-avatar .icon { position: relative; color: var(--on-tertiary-container); }
.my-avatar .icon svg { width: 28px; height: 28px; }

.my-stats {
  min-width: 0; min-height: 128px; padding: 16px 24px 18px;
  border-radius: 48px; background: var(--surface-container-high);
  display: flex; flex-direction: column; justify-content: center; gap: 8px;
}
.my-stats .ms-title { text-align: center; font-size: 12.5px; color: var(--on-surface-variant); }
.my-stats .ms-nums { display: flex; align-items: center; }
.ms-num { flex: 1; text-align: center; }
.ms-num .v { font-size: 36px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.ms-num .k { font-size: 12.5px; color: var(--on-surface-variant); margin-top: 2px; }
.ms-spark { flex: none; display: grid; place-items: center; padding: 0 12px; color: var(--primary); }
.ms-spark svg { width: 20px; height: 20px; }

/* 磁贴网格：规则设置 / 偏好设置跨 2 列 = 50%，其余 25%（对应上游 _AdaptivePair 嵌套） */
.my-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.my-tiles-first { margin-top: 28px; }
.my-tiles + .my-tiles { margin-top: 12px; }
.tile-card {
  position: relative; min-height: 156px; padding: 20px;
  display: flex; flex-direction: column; justify-content: center; gap: 26px;
  border: 0; border-radius: var(--r-2xl); cursor: pointer; text-align: left;
  background: var(--surface-container); color: var(--on-surface);
  transition: transform var(--dur-med) var(--ease-emph), box-shadow var(--dur-med);
}
.tile-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.tile-card:active { transform: scale(.97); }
.tile-card .tt-top { display: flex; align-items: center; justify-content: space-between; }
.tile-card .ic svg { width: 30px; height: 30px; }
.tile-card .arrow svg { width: 20px; height: 20px; }
.tile-card .tc-body { display: flex; flex-direction: column; gap: 3px; }
.tile-card .t { font-size: 16px; font-weight: 700; }
.tile-card .d { font-size: 12.5px; opacity: .86; }

/* 规则设置大卡：primary 底 + 右上 64 大圆角 + 四叶草拼图徽章 */
.tile-rules {
  grid-column: span 2; min-height: 156px; padding: 24px; gap: 12px;
  flex-direction: row; align-items: center;
  background: var(--primary); color: var(--on-primary);
  border-radius: 28px 64px 28px 28px;
}
.tile-rules .tr-body { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.tile-rules .t { font-size: 24px; font-weight: 700; }
.tile-rules .d { font-size: 13.5px; opacity: 1; }
.tile-rules .go-pill {
  margin-top: 14px; width: 52px; height: 32px; border-radius: 20px;
  display: grid; place-items: center;
  background: var(--on-primary); color: var(--primary);
}
.tile-rules .tr-icon { width: 80px; height: 80px; color: var(--primary-container); }
.tile-rules .tr-icon .icon { position: relative; color: var(--on-primary-container); }
.tile-rules .tr-icon .icon svg { width: 35px; height: 35px; fill: currentColor; }

/* 偏好设置面板：三个连体圆角按钮（外角 24 / 内角 8） */
.tile-pref { grid-column: span 2; min-height: 168px; padding: 20px; gap: 16px; background: var(--surface-container-low); }
.tile-pref .pf-title { font-size: 16px; font-weight: 700; }
.tile-pref .pf-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; width: 100%; }
.pf-btn {
  border: 0; border-radius: 8px; padding: 16px 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: var(--secondary-container); color: var(--on-secondary-container);
  cursor: pointer; font-size: 13.5px; font-weight: 700;
  transition: filter var(--dur-short);
}
.pf-btn:hover { filter: brightness(1.12); }
.pf-btn:first-child { border-radius: 24px 8px 8px 24px; }
.pf-btn:last-child { border-radius: 8px 24px 24px 8px; }
.pf-btn .icon svg { width: 28px; height: 28px; }

/* 工具磁贴配色（对应上游 secondaryContainer / tertiaryContainer / surfaceContainer） */
.t-hist { background: var(--secondary-container); color: var(--on-secondary-container); }
.t-dl { background: var(--tertiary-container); color: var(--on-tertiary-container); }
.t-sync, .t-store { background: var(--surface-container); color: var(--on-surface); }

@media (max-width: 999px) {
  .my-top { grid-template-columns: 1fr; }
  .my-tiles { grid-template-columns: 1fr 1fr; }
  .tile-rules, .tile-pref { grid-column: 1 / -1; }
}

/* ============================================================
   设置页（对齐上游 SettingsPage：全窗壳 + 分组侧栏 + SplitList 行卡）
   ============================================================ */
#app.settings-mode .rail,
#app.settings-mode .bottom-nav { display: none !important; }

:root { --m3-track-off: color-mix(in srgb, var(--primary) 20%, var(--surface-container-high)); }

.set-page { display: flex; flex-direction: column; height: 100%; }
.set-appbar {
  flex: none; height: 64px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
}
.set-appbar h1 {
  flex: 1; margin: 0; font-size: 20px; font-weight: 650; letter-spacing: .1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.set-body { flex: 1; min-height: 0; display: flex; }

/* 侧栏：分组标签 + 圆角胶囊项（上游 _RailDestination） */
.set-nav { width: 280px; flex: 0 0 280px; overflow-y: auto; padding: 4px 0 16px; scrollbar-width: none; }
.set-nav::-webkit-scrollbar { display: none; }
.set-nav-group { padding: 16px 28px 8px; font-size: 13.5px; font-weight: 650; color: var(--primary); }
.set-nav-item {
  display: flex; align-items: center; gap: 12px;
  width: calc(100% - 24px); height: 56px; margin: 2px 12px; padding: 0 16px;
  border: 0; border-radius: 28px; background: transparent;
  color: var(--on-surface-variant); font-size: 14.5px; font-weight: 550; text-align: left;
  cursor: pointer;
  transition: background var(--dur-short) var(--ease-std), color var(--dur-short) var(--ease-std);
}
.set-nav-item .ico { display: inline-grid; place-items: center; flex: none; }
.set-nav-item .ico svg { width: 24px; height: 24px; }
.set-nav-item:hover { background: color-mix(in srgb, var(--on-surface) 8%, transparent); }
.set-nav-item[aria-current="true"] { background: var(--secondary-container); color: var(--on-secondary-container); }

/* 内容面板：64px 标题头 + 滚动区 */
.set-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.set-pane-top { flex: none; height: 64px; display: flex; align-items: center; padding: 0 24px; }
.set-pane-top h2 { margin: 0; font-size: 24px; font-weight: 650; letter-spacing: -.2px; }
.set-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.set-content { max-width: 1000px; margin: 0 auto; padding: 4px 16px 64px; }

/* 分区：绿色小标题 + 连体行卡组（SplitListGroup：行距 4 / 外角 20 / 内角 4） */
.set-sec { margin: 0 0 18px; }
.set-sec-head { padding: 6px 16px 8px; font-size: 13.5px; font-weight: 650; color: var(--primary); }
.set-sec-cap { padding: 8px 16px 0; font-size: 12px; color: var(--on-surface-variant); }
.set-group { display: flex; flex-direction: column; gap: 4px; }

.set-row {
  position: relative;
  display: flex; align-items: center; gap: 16px;
  width: 100%; min-height: 48px; padding: 12px 16px;
  border: 0; border-radius: 4px;
  background: var(--surface-container-low); color: inherit;
  font-family: inherit; font-size: inherit; text-align: left;
  transition: background var(--dur-short) var(--ease-std), border-radius 250ms var(--ease-std);
}
.set-group .set-row:first-child { border-radius: var(--r-xl) var(--r-xl) 4px 4px; }
.set-group .set-row:last-child { border-radius: 4px 4px var(--r-xl) var(--r-xl); }
.set-group .set-row:only-child { border-radius: var(--r-xl); }
button.set-row { cursor: pointer; }
button.set-row:not(.static):hover { background: color-mix(in srgb, var(--on-surface) 5%, var(--surface-container-low)); }
.set-row.static { cursor: default; }
.set-row.disabled { opacity: .38; pointer-events: none; }

.set-lead { display: inline-grid; place-items: center; width: 24px; height: 24px; flex: none; color: var(--on-surface-variant); }
.set-lead svg { width: 24px; height: 24px; }
.set-lead.circle { width: 36px; height: 36px; border-radius: 50%; background: var(--secondary-container); color: var(--on-secondary-container); }
.set-lead.circle svg { width: 18px; height: 18px; }
.set-row .body { flex: 1; min-width: 0; }
.set-row .t { font-size: 15px; font-weight: 500; }
.set-row .d { font-size: 12.5px; color: var(--on-surface-variant); margin-top: 2px; overflow-wrap: anywhere; }
.set-value {
  flex: none; display: inline-flex; align-items: center; gap: 2px;
  max-width: 46%; font-size: 14px; color: var(--on-surface-variant);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.set-value .icon { flex: none; }
.set-value .icon svg { width: 22px; height: 22px; }
.set-badge {
  flex: none; padding: 4px 10px; border-radius: 8px;
  background: var(--secondary-container); color: var(--on-secondary-container);
  font-size: 12px; font-weight: 550; font-variant-numeric: tabular-nums;
}
.set-kbd { display: inline-flex; gap: 4px; flex: none; }
.set-radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--outline); flex: none; display: grid; place-items: center; }
.set-row[aria-selected="true"] .set-radio { border-color: var(--primary); }
.set-row[aria-selected="true"] .set-radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }

/* 行内输入 */
.set-input {
  width: 100%; padding: 6px 0;
  background: transparent; border: 0; border-bottom: 1px solid color-mix(in srgb, var(--outline-variant) 70%, transparent);
  outline: none; font: inherit; color: inherit;
  transition: border-color var(--dur-short);
}
.set-input:focus { border-bottom-color: var(--primary); }
.set-input.num { width: 86px; text-align: right; border-bottom: 0; }
.set-row.static > .set-input.num { flex: none; }

/* 滑杆行 */
.set-slider-row { flex-direction: column; align-items: stretch; gap: 10px; padding: 14px 16px 12px; }
.set-slider-row .top { display: flex; align-items: center; gap: 16px; min-width: 0; }

/* M3 Expressive 滑杆：16px 轨道 + 分段圆点 + 竖条滑块 */
.m3s { position: relative; height: 30px; }
.m3s .dots { position: absolute; inset: 0; pointer-events: none; }
.m3s .dot { position: absolute; top: 50%; left: 0; width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 50%; }
.m3s .dot.on { background: color-mix(in srgb, var(--on-primary) 62%, var(--primary)); }
.m3s .dot.off { background: color-mix(in srgb, var(--primary) 62%, var(--m3-track-off)); }
.m3s input {
  position: absolute; inset: 0; width: 100%; height: 30px; margin: 0;
  -webkit-appearance: none; appearance: none;
  background: transparent; cursor: pointer;
}
.m3s input:focus-visible { outline: none; }
.m3s input::-webkit-slider-runnable-track {
  height: 16px; border-radius: 8px;
  background: linear-gradient(to right, var(--primary) var(--pct, 50%), var(--m3-track-off) var(--pct, 50%));
}
.m3s input::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 4px; height: 30px; margin-top: -7px;
  border: 0; border-radius: 2px; background: var(--primary);
}
.m3s input::-moz-range-track {
  height: 16px; border-radius: 8px;
  background: linear-gradient(to right, var(--primary) var(--pct, 50%), var(--m3-track-off) var(--pct, 50%));
}
.m3s input::-moz-range-thumb { width: 4px; height: 30px; border: 0; border-radius: 2px; background: var(--primary); }

/* 配色方案对话框 */
.palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 16px 8px; padding: 4px 2px 16px; }
.palette-cell { display: flex; flex-direction: column; align-items: center; gap: 8px; border: 0; background: transparent; cursor: pointer; color: var(--on-surface); font-family: inherit; }
.palette-swatch { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; color: rgba(255, 255, 255, .95); transition: transform var(--dur-short) var(--ease-emph); }
.palette-cell:hover .palette-swatch { transform: scale(1.06); }
.palette-swatch svg { width: 26px; height: 26px; }
.palette-label { font-size: 12.5px; }

/* 关于页头 */
.set-hero {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 26px 16px 22px; margin-bottom: 18px;
  background: var(--surface-container-low); border-radius: var(--r-2xl);
}
.set-hero-logo { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; background: var(--primary-container); color: var(--on-primary-container); }
.set-hero-name { font-size: 20px; font-weight: 700; }
.set-hero-sub { font-size: 12.5px; color: var(--on-surface-variant); }

/* 窄屏设置：侧栏退化为目录行（.cat）与布局修正 */
.set-content.narrow { padding-top: 8px; }
@media (max-width: 899px) {
  .set-page { height: auto; min-height: 100%; }
  .set-nav { display: none; }
}

/* 单选对话框行（上游 SimpleDialog + RadioListTile：圆点在左，标题/说明在右） */
.radio-list { display: flex; flex-direction: column; padding: 2px 0 10px; }
.radio-row {
  display: flex; align-items: center; gap: 16px;
  min-height: 52px; padding: 8px 6px;
  border: 0; border-radius: var(--r-md);
  background: transparent; color: inherit; text-align: left;
  cursor: pointer; font-family: inherit; font-size: inherit;
  transition: background var(--dur-short);
}
.radio-row:hover { background: color-mix(in srgb, var(--on-surface) 6%, transparent); }
.radio-row .set-radio { flex: none; }
.radio-row .radio-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.radio-row .radio-t { font-size: 15px; font-weight: 500; }
.radio-row .radio-d { font-size: 12.5px; color: var(--on-surface-variant); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.radio-row[aria-selected="true"] .set-radio { border-color: var(--primary); }
.radio-row[aria-selected="true"] .set-radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }

/* 代理配置子页（上游 proxy_editor_page：outlined 输入框 + 右下保存并测试） */
.set-editor { max-width: 800px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; padding-top: 8px; }
.set-field {
  display: flex; flex-direction: column; gap: 2px;
  border: 1px solid var(--outline); border-radius: var(--r-xs);
  padding: 8px 14px 6px;
  transition: border-color var(--dur-short), border-width var(--dur-short);
}
.set-field:focus-within { border: 2px solid var(--primary); padding: 7px 13px 5px; }
.set-field-label { font-size: 12px; font-weight: 600; color: var(--on-surface-variant); }
.set-field .set-input { border-bottom: 0; padding: 2px 0; }
.set-field .set-input:focus { border-bottom: 0; }
.set-field-error { font-size: 12px; color: var(--error); padding-top: 2px; }
.set-editor-foot {
  position: sticky; bottom: 16px;
  display: flex; justify-content: flex-end;
  padding: 8px 0 2px;
  pointer-events: none;
}
.set-editor-foot .editor-fab { pointer-events: auto; box-shadow: var(--shadow-2); border-radius: var(--r-lg); padding: 0 22px; height: 52px; }
.set-editor-foot .editor-fab .icon svg { width: 22px; height: 22px; }

/* ============================================================
   规则管理（对齐上游 plugin_view_page / plugin_catalog_view /
   plugin_editor_page：hero 卡、RuleCard、分段表单编辑器）
   ============================================================ */
.rule-page { width: 100%; }
.rule-page-inner { max-width: 1000px; margin: 0 auto; padding: 4px 16px 24px; }
.rule-page-inner.editor { max-width: 900px; }

/* RulePageIntro：primaryContainer 大圆角 hero */
.rule-hero {
  background: var(--primary-container); color: var(--on-primary-container);
  border-radius: 32px; padding: 24px; margin-bottom: 20px;
}
.rule-hero-title { margin: 0; font-size: 24px; font-weight: 700; flex: 1; min-width: 0; }
.rule-hero-icon { flex: none; }
.rule-hero-icon svg { width: 32px; height: 32px; }
.rule-hero-desc { margin-top: 8px; font-size: 14px; line-height: 1.6; }
.rule-hero-actions { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 8px; }

/* 按钮：FilledButton(primary) / FilledButton.tonal(secondaryContainer) */
.rule-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 48px; padding: 0 20px; border: 0; border-radius: 999px;
  font-size: 14px; font-weight: 650; cursor: pointer;
  transition: filter var(--dur-short), opacity var(--dur-short);
}
.rule-btn:hover { filter: brightness(1.06); }
.rule-btn:disabled { opacity: .5; cursor: default; }
.rule-btn.filled { background: var(--primary); color: var(--on-primary); }
.rule-btn.tonal { background: var(--secondary-container); color: var(--on-secondary-container); }
.rule-btn.grow { flex: 1; }

/* 搜索框 / 筛选 chips 行 */
.rule-search {
  display: flex; align-items: center; gap: 10px;
  height: 52px; padding: 0 8px 0 18px;
  background: var(--surface-container-highest); border-radius: 16px;
}
.rule-search .icon { color: var(--on-surface-variant); }
.rule-search .rule-input {
  flex: 1; min-width: 0; height: 100%;
  border: 0; background: transparent; outline: none; font-size: 15px; padding: 0;
}
.rule-clear {
  width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%;
  background: transparent; color: var(--on-surface-variant);
  display: grid; place-items: center; cursor: pointer;
}
.rule-clear:hover { background: color-mix(in srgb, var(--on-surface) 8%, transparent); }
.rule-chips { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.chip.active {
  background: var(--secondary-container); color: var(--on-secondary-container);
  border-color: transparent;
}
.rule-text-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 12px; border: 0; border-radius: var(--r-full);
  background: transparent; color: var(--primary); font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.rule-text-btn:hover { background: color-mix(in srgb, var(--on-surface) 6%, transparent); }
.rule-text-btn:disabled { opacity: .55; cursor: default; }
.rule-text-btn.danger { color: var(--error); }

/* RuleCard 行卡 */
.rule-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.rule-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-container-low); border-radius: 20px;
  padding: 10px 12px 10px 16px; min-height: 76px;
}
.rule-card.selected { outline: 2px solid var(--primary); }
.rule-card.dragging { opacity: .45; }
.rule-card.drop-target { outline: 2px dashed var(--primary); }
.rule-avatar {
  width: 48px; height: 48px; flex: none; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--primary-container); color: var(--on-primary-container);
}
.rule-card-body { flex: 1; min-width: 0; cursor: pointer; }
.rule-card .t { font-size: 16px; font-weight: 600; }
.rule-card .d {
  font-size: 13px; color: var(--on-surface-variant); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rule-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.rule-tag {
  display: inline-block; padding: 2px 9px; border-radius: 8px;
  font-size: 11.5px; font-weight: 600;
  background: var(--surface-container-highest); color: var(--on-surface-variant);
}
.rule-tag.update { background: var(--secondary-container); color: var(--on-secondary-container); }
.rule-tag.tertiary { background: var(--tertiary-container); color: var(--on-tertiary-container); }
.rule-drag {
  width: 44px; height: 48px; flex: none; border: 0; border-radius: 50%;
  background: transparent; color: var(--on-surface-variant);
  display: grid; place-items: center; cursor: grab; touch-action: none;
}
.rule-drag:active { cursor: grabbing; }
.rule-check {
  width: 26px; height: 26px; flex: none; border-radius: 50%;
  border: 2px solid var(--outline); background: transparent; color: transparent;
  display: grid; place-items: center; cursor: pointer;
}
.rule-check svg { width: 16px; height: 16px; }
.rule-check[aria-checked="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.rule-card-action { margin-left: auto; flex: none; display: flex; align-items: center; padding-right: 8px; }
.rule-installed {
  display: inline-flex; align-items: center; gap: 6px; padding: 0 16px;
  color: var(--on-surface-variant); font-size: 13.5px; font-weight: 600;
}
.rule-toolbar { display: flex; align-items: center; gap: 8px; margin: 14px 0 8px; }
.rule-refresh {
  width: 44px; height: 44px; border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center;
  background: var(--secondary-container); color: var(--on-secondary-container);
}
.rule-refresh:disabled { opacity: .5; cursor: default; }
.rule-catalog-note { font-size: 12.5px; color: var(--on-surface-variant); margin: 8px 2px; }
.rule-empty { padding: 48px 20px; text-align: center; color: var(--on-surface-variant); }
.rule-empty .icon svg { width: 34px; height: 34px; opacity: .8; }
.rule-empty p { margin: 12px 0 10px; font-size: 14.5px; font-weight: 600; }
.rule-empty span { font-size: 12.5px; }

/* 对话框内容 */
.rule-dialog-desc { font-size: 13.5px; line-height: 1.7; color: var(--on-surface-variant); margin: 0 0 14px; }
.rule-add-list { display: flex; flex-direction: column; gap: 4px; }
.rule-add-row {
  display: flex; align-items: center; gap: 14px; width: 100%;
  border: 0; background: var(--surface-container-low); color: var(--on-surface);
  padding: 13px 16px; border-radius: 12px; cursor: pointer; text-align: left;
}
.rule-add-row.hot { background: var(--secondary-container); color: var(--on-secondary-container); border-radius: 20px; }
.rule-add-row:hover { filter: brightness(1.08); }
.rule-add-row .body { flex: 1; min-width: 0; }
.rule-add-row .t { font-size: 14.5px; font-weight: 600; }
.rule-add-row .d { font-size: 12.5px; color: var(--on-surface-variant); margin-top: 1px; }
.rule-add-row.hot .d { color: var(--on-secondary-container); opacity: .85; }
.rule-import-error { min-height: 20px; margin-top: 8px; font-size: 12.5px; color: var(--error); }
.rule-share-name { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.rule-share-link {
  width: 100%; min-height: 120px; margin-top: 12px;
  background: var(--surface-container-low); color: var(--on-surface);
  border: 0; border-radius: 16px; padding: 12px 14px;
  font-family: var(--mono); font-size: 12px; line-height: 1.6; resize: vertical;
}

/* 测试规则对话框 */
.rule-test-out { margin-top: 14px; max-height: 46vh; overflow-y: auto; }
.rule-test-count { font-size: 12.5px; color: var(--on-surface-variant); margin: 6px 2px 8px; }
.rule-test-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 0; background: var(--surface-container-low); color: var(--on-surface);
  padding: 12px 14px; border-radius: 12px; cursor: pointer; text-align: left; margin-bottom: 6px;
}
.rule-test-row:hover { background: var(--surface-container); }
.rule-test-row .body { flex: 1; min-width: 0; }
.rule-test-row .t { font-size: 14px; font-weight: 600; }
.rule-test-row .d {
  font-size: 12px; color: var(--on-surface-variant); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rule-test-road { background: var(--surface-container-low); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.rule-test-road .t { font-size: 14px; font-weight: 600; }
.rule-test-road .d { font-size: 12.5px; color: var(--on-surface-variant); margin-top: 2px; }

/* 分段表单编辑器 */
.rule-editor-tabs { display: flex; gap: 10px; margin: 4px 0 16px; }
.rule-editor-tab {
  flex: 1; height: 48px; border: 0; border-radius: 16px; cursor: pointer;
  background: var(--surface-container-low); color: var(--on-surface-variant);
  font-size: 14px; font-weight: 600;
}
.rule-editor-tab:hover { color: var(--on-surface); }
.rule-editor-tab.active { background: var(--primary-container); color: var(--on-primary-container); font-weight: 700; }
.rule-section {
  background: var(--surface-container-low); border-radius: 28px; padding: 20px;
}
.rule-section-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.rule-section-head .icon { color: var(--primary); margin-top: 2px; }
.rule-section-title { font-size: 18px; font-weight: 650; }
.rule-section-desc { font-size: 13.5px; color: var(--on-surface-variant); margin-top: 2px; }
.rule-field { display: block; margin-bottom: 16px; }
.rule-field:last-child { margin-bottom: 0; }
.rule-field-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.rule-input {
  width: 100%; height: 50px; padding: 0 16px;
  background: var(--surface-container-highest); color: var(--on-surface);
  border: 0; border-radius: 14px; font-size: 14.5px; outline: none;
  transition: box-shadow var(--dur-short);
}
textarea.rule-input { height: auto; padding: 12px 16px; font-family: var(--mono); font-size: 13px; line-height: 1.6; resize: vertical; }
.rule-input:focus { box-shadow: 0 0 0 2px var(--primary); }
.rule-input::placeholder { color: color-mix(in srgb, var(--on-surface-variant) 70%, transparent); }
.rule-field-hint { display: block; font-size: 12px; color: var(--on-surface-variant); margin-top: 5px; line-height: 1.5; }
.rule-seg { display: flex; gap: 8px; background: var(--surface-container-highest); border-radius: 16px; padding: 4px; }
.rule-seg-btn {
  flex: 1; height: 42px; border: 0; border-radius: 12px; cursor: pointer;
  background: transparent; color: var(--on-surface-variant); font-size: 13.5px; font-weight: 600;
}
.rule-seg-btn[aria-pressed="true"] { background: var(--secondary-container); color: var(--on-secondary-container); font-weight: 700; }
.rule-seg-desc { font-size: 12.5px; color: var(--on-surface-variant); margin-top: 7px; }
.rule-switch-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; }
.rule-switch-row .body { flex: 1; min-width: 0; }
.rule-switch-row .t { font-size: 14.5px; font-weight: 550; }
.rule-switch-row .d { font-size: 13px; color: var(--on-surface-variant); margin-top: 1px; }
.rule-subheader { font-size: 13px; font-weight: 700; color: var(--primary); margin: 20px 0 4px; }
.rule-editor-error {
  background: var(--error-container); color: var(--on-error-container);
  border-radius: 16px; padding: 14px 16px; font-size: 13.5px; line-height: 1.6;
  white-space: pre-wrap; margin: 0 0 16px;
}
.rule-editor-bar {
  position: sticky; bottom: 0; z-index: 2;
  display: flex; gap: 12px; padding: 14px 0 4px; margin-top: 20px;
  background: linear-gradient(to top, var(--surface) 78%, transparent);
}
