/* ============================================================
   比特片场跨平台产品设计规范 · V10-液态玻璃
   界面样式实现。全部视觉值来自 DESIGN.md 的语义 Token，
   变量命名按 --bfs-<组>-<名称> 映射。
   风格取自 Apple Human Interface Guidelines（macOS 26 Tahoe /
   iOS 26）：系统字体、系统色、Liquid Glass 分层材质、
   0.5px 玻璃描边与镜面高光、弹簧动效。
   ============================================================ */

/* ---------- 1. 语义 Token：深色工作主题（默认） ---------- */
:root {
  /* 表面 surface：内容层保持实体，不使用玻璃 */
  --bfs-surface-canvas: #08080B;
  --bfs-surface-sidebar: #0D0D11;
  --bfs-surface-panel: #141418;
  --bfs-surface-elevated: #1C1C21;
  --bfs-surface-hover: rgba(255, 255, 255, 0.055);
  --bfs-surface-pressed: rgba(255, 255, 255, 0.10);
  --bfs-surface-selected: rgba(10, 132, 255, 0.16);
  /* 玻璃层 glass：仅用于导航层与浮层，不叠玻璃 */
  --bfs-glass-chrome: rgba(18, 18, 22, 0.60);
  --bfs-glass-sidebar: rgba(13, 13, 17, 0.52);
  --bfs-glass-panel: rgba(30, 30, 35, 0.66);
  --bfs-glass-blur: blur(30px) saturate(190%);
  --bfs-glass-border: rgba(255, 255, 255, 0.12);
  --bfs-glass-rim: inset 0 0.5px 0 rgba(255, 255, 255, 0.22);
  --bfs-glass-specular: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.13) 0%,
    rgba(255, 255, 255, 0.035) 30%,
    rgba(255, 255, 255, 0) 48%,
    rgba(255, 255, 255, 0.025) 72%,
    rgba(255, 255, 255, 0.08) 100%
  );
  /* 文字 text：Apple 标签层级 */
  --bfs-text-primary: rgba(255, 255, 255, 0.92);
  --bfs-text-secondary: rgba(255, 255, 255, 0.60);
  --bfs-text-tertiary: rgba(255, 255, 255, 0.32);
  --bfs-text-disabled: rgba(255, 255, 255, 0.16);
  /* 边框 border：玻璃描边为 0.5px 半透明 */
  --bfs-border-subtle: rgba(255, 255, 255, 0.08);
  --bfs-border-default: rgba(255, 255, 255, 0.15);
  --bfs-border-control: rgba(255, 255, 255, 0.30);
  /* 强调 accent：Apple 系统蓝，仅用于重点操作与选中 */
  --bfs-accent-fill: #0A84FF;
  --bfs-accent-hover: #369DFF;
  --bfs-accent-pressed: #0070E0;
  --bfs-accent-on: #FFFFFF;
  --bfs-accent-text: #6BB2FF;
  --bfs-accent-gradient: linear-gradient(180deg, #3F9EFF, #0A7CFF);
  --bfs-accent-glow: 0 1px 2px rgba(0, 0, 0, 0.18), 0 6px 18px rgba(10, 132, 255, 0.28);
  --bfs-accent-glow-strong: 0 1px 2px rgba(0, 0, 0, 0.20), 0 10px 26px rgba(10, 132, 255, 0.36);
  --bfs-accent-glow-line: 0 0 10px rgba(10, 132, 255, 0.35);
  --bfs-accent-ring: inset 0 0.5px 0 rgba(255, 255, 255, 0.30);
  /* 焦点 focus */
  --bfs-focus-ring: #0A84FF;
  /* 状态 status：Apple 系统色 */
  --bfs-status-success: #30D158;
  --bfs-status-warning: #FF9F0A;
  --bfs-status-danger: #FF453A;
  --bfs-status-info: #A1A6B3;
  /* 媒体 media 与遮罩 overlay：观看区保持深色，不随主题改变 */
  --bfs-media-surround: #000000;
  --bfs-media-letterbox: #000000;
  --bfs-media-surface-a: #26262B;
  --bfs-media-surface-b: #131316;
  --bfs-media-text: rgba(255, 255, 255, 0.58);
  --bfs-media-text-strong: rgba(255, 255, 255, 0.94);
  --bfs-media-icon: rgba(255, 255, 255, 0.36);
  --bfs-media-chip: rgba(0, 0, 0, 0.60);
  --bfs-overlay-scrim: rgba(0, 0, 0, 0.48);
  /* 浮层阴影：多级低透明，随背景自适应 */
  --bfs-shadow-overlay: 0 24px 64px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.35),
    0 0 0 0.5px rgba(255, 255, 255, 0.10);
  /* 字体：始终使用系统字体栈 */
  --bfs-font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  --bfs-font-mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  /* 排版规格 type：字号 / 行高 / 字重（HIG 文本样式） */
  --bfs-type-caption-size: 12px;
  --bfs-type-caption-lh: 18px;
  --bfs-type-caption-weight: 400;
  --bfs-type-support-size: 13px;
  --bfs-type-support-lh: 20px;
  --bfs-type-support-weight: 400;
  --bfs-type-ui-size: 13px;
  --bfs-type-ui-lh: 18px;
  --bfs-type-ui-weight: 500;
  --bfs-type-body-size: 14px;
  --bfs-type-body-lh: 22px;
  --bfs-type-body-weight: 400;
  --bfs-type-reading-size: 15px;
  --bfs-type-reading-lh: 24px;
  --bfs-type-reading-weight: 400;
  --bfs-type-section-size: 22px;
  --bfs-type-section-lh: 28px;
  --bfs-type-section-weight: 600;
  --bfs-type-title-size: 28px;
  --bfs-type-title-lh: 36px;
  --bfs-type-title-weight: 600;
  --bfs-type-display-size: 34px;
  --bfs-type-display-lh: 42px;
  --bfs-type-display-weight: 600;
  /* 间距 space：4pt 基础网格 */
  --bfs-space-1: 4px;
  --bfs-space-2: 8px;
  --bfs-space-3: 12px;
  --bfs-space-4: 16px;
  --bfs-space-5: 20px;
  --bfs-space-6: 24px;
  --bfs-space-8: 32px;
  --bfs-space-10: 40px;
  --bfs-space-12: 48px;
  --bfs-space-16: 64px;
  /* 圆角 radius：连续圆角，最小玻璃圆角 10 */
  --bfs-radius-small: 6px;
  --bfs-radius-control: 11px;
  --bfs-radius-panel: 16px;
  --bfs-radius-dialog: 22px;
  --bfs-radius-composer: 30px;
  --bfs-radius-pill: 999px;
  /* 描边 stroke：玻璃与分隔线使用 0.5px */
  --bfs-stroke-default: 0.5px;
  --bfs-stroke-focus: 2px;
  /* 布局 layout */
  --bfs-chrome-toolbar: 52px;
  --bfs-layout-sidebar: 248px;
  --bfs-layout-inspector: 280px;
  /* 动效 motion：弹簧曲线，不使用线性过渡 */
  --bfs-motion-feedback: 150ms;
  --bfs-motion-component: 240ms;
  --bfs-motion-panel: 380ms;
  --bfs-motion-enter: cubic-bezier(0.22, 1, 0.36, 1);
  --bfs-motion-exit: cubic-bezier(0.4, 0, 1, 1);
  --bfs-motion-standard: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --bfs-motion-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- 浅色主题：整体切换同一组语义角色 ---------- */
[data-theme="light"] {
  --bfs-surface-canvas: #F2F2F7;
  --bfs-surface-sidebar: #EEEEF3;
  --bfs-surface-panel: #FFFFFF;
  --bfs-surface-elevated: #FFFFFF;
  --bfs-surface-hover: rgba(0, 0, 0, 0.045);
  --bfs-surface-pressed: rgba(0, 0, 0, 0.09);
  --bfs-surface-selected: rgba(0, 122, 255, 0.14);
  --bfs-glass-chrome: rgba(255, 255, 255, 0.72);
  --bfs-glass-sidebar: rgba(246, 246, 250, 0.64);
  --bfs-glass-panel: rgba(255, 255, 255, 0.80);
  --bfs-glass-blur: blur(30px) saturate(180%);
  --bfs-glass-border: rgba(60, 60, 67, 0.12);
  --bfs-glass-rim: inset 0 0.5px 0 rgba(255, 255, 255, 0.85);
  --bfs-glass-specular: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.55) 0%,
    rgba(255, 255, 255, 0.18) 30%,
    rgba(255, 255, 255, 0.02) 48%,
    rgba(255, 255, 255, 0.12) 72%,
    rgba(255, 255, 255, 0.40) 100%
  );
  --bfs-text-primary: #0B0B0F;
  --bfs-text-secondary: rgba(60, 60, 67, 0.62);
  --bfs-text-tertiary: rgba(60, 60, 67, 0.34);
  --bfs-text-disabled: rgba(60, 60, 67, 0.20);
  --bfs-border-subtle: rgba(60, 60, 67, 0.10);
  --bfs-border-default: rgba(60, 60, 67, 0.16);
  --bfs-border-control: rgba(60, 60, 67, 0.30);
  --bfs-accent-fill: #007AFF;
  --bfs-accent-hover: #3395FF;
  --bfs-accent-pressed: #0067D6;
  --bfs-accent-on: #FFFFFF;
  --bfs-accent-text: #0063CC;
  --bfs-accent-gradient: linear-gradient(180deg, #3395FF, #0071E3);
  --bfs-accent-glow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 6px 16px rgba(0, 122, 255, 0.22);
  --bfs-accent-glow-strong: 0 1px 2px rgba(0, 0, 0, 0.10), 0 10px 24px rgba(0, 122, 255, 0.28);
  --bfs-accent-glow-line: 0 0 8px rgba(0, 122, 255, 0.22);
  --bfs-accent-ring: inset 0 0.5px 0 rgba(255, 255, 255, 0.40);
  --bfs-focus-ring: #007AFF;
  --bfs-status-success: #1F8A3D;
  --bfs-status-warning: #B26B00;
  --bfs-status-danger: #D70015;
  --bfs-status-info: #6C6C72;
  --bfs-overlay-scrim: rgba(0, 0, 0, 0.38);
  --bfs-shadow-overlay: 0 24px 64px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.10),
    0 0 0 0.5px rgba(0, 0, 0, 0.08);
}

/* ---------- 2. 基础 ---------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* 带 display 样式的元素也能被 hidden 属性隐藏 */
[hidden] {
  display: none !important;
}

/* 滚动条：跟随主题的中性滚动条，不使用系统默认样式 */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: var(--bfs-border-default);
  border-radius: var(--bfs-radius-pill);
  border: 3px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--bfs-border-control);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--bfs-border-default) transparent;
}

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

/* 画布：模拟 Tahoe 壁纸的柔和光斑，玻璃层从其上方浮起 */
body {
  font-family: var(--bfs-font-ui);
  font-size: var(--bfs-type-body-size);
  line-height: var(--bfs-type-body-lh);
  font-weight: var(--bfs-type-body-weight);
  color: var(--bfs-text-primary);
  background:
    radial-gradient(1100px 720px at 8% -12%, rgba(10, 132, 255, 0.18), transparent 60%),
    radial-gradient(900px 640px at 92% -4%, rgba(94, 92, 230, 0.14), transparent 62%),
    radial-gradient(760px 520px at 50% 112%, rgba(64, 210, 255, 0.08), transparent 60%),
    var(--bfs-surface-canvas);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

[data-theme="light"] body {
  background:
    radial-gradient(1100px 720px at 8% -12%, rgba(0, 122, 255, 0.12), transparent 60%),
    radial-gradient(900px 640px at 92% -4%, rgba(120, 100, 255, 0.10), transparent 62%),
    radial-gradient(760px 520px at 50% 112%, rgba(90, 200, 250, 0.10), transparent 60%),
    var(--bfs-surface-canvas);
}

/* 文字选区使用 surface.selected 与 text.primary */
::selection {
  background: var(--bfs-surface-selected);
  color: var(--bfs-text-primary);
}

/* 键盘焦点：2px 外轮廓，间隔 2px */
:focus-visible {
  outline: var(--bfs-stroke-focus) solid var(--bfs-focus-ring);
  outline-offset: 2px;
}

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

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

a:hover {
  text-decoration: underline;
}

code {
  font-family: var(--bfs-font-mono);
  font-size: var(--bfs-type-support-size);
  color: var(--bfs-text-secondary);
}

/* ---------- 3. 液态玻璃材质 ---------- */

/* 浮层统一：0.5px 描边 + 顶边镜面高光 + 方向性反光 */
.menu,
.dialog,
.drawer,
.toast {
  position: relative;
  isolation: isolate;
  border: var(--bfs-stroke-default) solid var(--bfs-glass-border);
  border-radius: var(--bfs-radius-panel);
  background: var(--bfs-glass-panel);
  backdrop-filter: var(--bfs-glass-blur);
  -webkit-backdrop-filter: var(--bfs-glass-blur);
  box-shadow: var(--bfs-glass-rim), var(--bfs-shadow-overlay);
}

/* 镜面高光：液态玻璃与普通毛玻璃的分界，随悬停提亮 */
.menu::before,
.dialog::before,
.drawer::before,
.toast::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--bfs-glass-specular);
  pointer-events: none;
  z-index: 1;
  opacity: 0.65;
  transition: opacity var(--bfs-motion-component) var(--bfs-motion-standard);
}

.menu:hover::before,
.dialog:hover::before,
.toast:hover::before {
  opacity: 1;
}

/* ---------- 4. 应用骨架：工作台布局 ---------- */
.app {
  display: grid;
  grid-template-columns: var(--bfs-layout-sidebar) minmax(0, 1fr);
  grid-template-rows: var(--bfs-chrome-toolbar) minmax(0, 1fr);
  grid-template-areas:
    "topbar topbar"
    "sidebar main";
  height: 100vh;
  overflow: hidden;
}

/* 顶栏：Tahoe 窗口 chrome，玻璃背板 + 浮动控件 */
.app-toolbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  gap: var(--bfs-space-2);
  padding: 0 var(--bfs-space-3);
  background: var(--bfs-glass-specular), var(--bfs-glass-chrome);
  backdrop-filter: var(--bfs-glass-blur);
  -webkit-backdrop-filter: var(--bfs-glass-blur);
  border-bottom: var(--bfs-stroke-default) solid var(--bfs-glass-border);
  box-shadow: var(--bfs-glass-rim);
  z-index: 50;
}

.app-toolbar .app-brand {
  display: flex;
  align-items: center;
  gap: var(--bfs-space-2);
  flex: none;
  font-size: var(--bfs-type-ui-size);
  line-height: var(--bfs-type-ui-lh);
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* 品牌标志：蓝渐变超椭圆方块，顶边光模拟玻璃凸面 */
.brand-mark {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 8px;
  background: var(--bfs-accent-gradient);
  color: var(--bfs-accent-on);
  box-shadow: var(--bfs-accent-ring), var(--bfs-accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

.app-toolbar .project-switch {
  display: inline-flex;
  align-items: center;
  gap: var(--bfs-space-1);
  min-height: 30px;
  min-width: 0;
  max-width: min(28vw, 180px);
  padding: 0 var(--bfs-space-3);
  background: transparent;
  border: none;
  border-radius: var(--bfs-radius-pill);
  font-size: var(--bfs-type-ui-size);
  line-height: var(--bfs-type-ui-lh);
  font-weight: 400;
  color: var(--bfs-text-secondary);
  cursor: pointer;
  transition: background-color var(--bfs-motion-feedback) var(--bfs-motion-standard),
    color var(--bfs-motion-feedback) var(--bfs-motion-standard);
}

/* 项目名单行，尾部省略裁切，不换行 */
.app-toolbar .project-switch .project-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-toolbar .project-switch:hover {
  background: var(--bfs-surface-hover);
  color: var(--bfs-text-primary);
}

.app-toolbar .toolbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--bfs-space-2);
}

.app-toolbar .toolbar-search {
  width: 220px;
}

/* 侧栏：Liquid Glass regular，导航层唯一的常驻材质 */
.app-sidebar {
  grid-area: sidebar;
  background: var(--bfs-glass-specular), var(--bfs-glass-sidebar);
  backdrop-filter: var(--bfs-glass-blur);
  -webkit-backdrop-filter: var(--bfs-glass-blur);
  border-right: var(--bfs-stroke-default) solid var(--bfs-glass-border);
  box-shadow: var(--bfs-glass-rim);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: var(--bfs-space-3);
}

.app-sidebar .nav-group-title {
  font-size: 11px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--bfs-text-tertiary);
  padding: var(--bfs-space-3) var(--bfs-space-3) var(--bfs-space-1);
}

.app-sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: var(--bfs-space-2);
  min-height: 32px;
  padding: 0 var(--bfs-space-3);
  font-size: var(--bfs-type-ui-size);
  line-height: var(--bfs-type-ui-lh);
  font-weight: 400;
  color: var(--bfs-text-secondary);
  border-radius: 9px;
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  transition: background-color var(--bfs-motion-feedback) var(--bfs-motion-standard),
    color var(--bfs-motion-feedback) var(--bfs-motion-standard);
}

.app-sidebar .nav-item:hover {
  background: var(--bfs-surface-hover);
  color: var(--bfs-text-primary);
}

.app-sidebar .nav-item.active {
  background: var(--bfs-surface-selected);
  color: var(--bfs-text-primary);
  font-weight: 500;
}

.app-sidebar .nav-item.active svg {
  color: var(--bfs-accent-text);
}

.app-sidebar .nav-item .nav-count {
  margin-left: auto;
  font-family: var(--bfs-font-mono);
  font-size: 11px;
  line-height: 16px;
  color: var(--bfs-text-tertiary);
}

.app-sidebar .sidebar-foot {
  margin-top: auto;
  padding: var(--bfs-space-3);
  border-top: var(--bfs-stroke-default) solid var(--bfs-border-subtle);
}

.storage-line {
  display: flex;
  flex-direction: column;
  gap: var(--bfs-space-1);
}

.storage-line .storage-head {
  display: flex;
  justify-content: space-between;
  font-size: var(--bfs-type-caption-size);
  line-height: var(--bfs-type-caption-lh);
  color: var(--bfs-text-tertiary);
}

.storage-line .progress-track {
  height: 4px;
}

/* 主区 */
.app-main {
  grid-area: main;
  display: flex;
  min-width: 0;
  overflow: hidden;
}

.workspace {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: var(--bfs-space-6);
  display: flex;
  flex-direction: column;
  gap: var(--bfs-space-4);
}

/* 属性区：内容层实体表面，不使用玻璃 */
.inspector {
  width: var(--bfs-layout-inspector);
  flex: none;
  background: var(--bfs-surface-panel);
  border-left: var(--bfs-stroke-default) solid var(--bfs-border-subtle);
  overflow-y: auto;
  padding: var(--bfs-space-4);
}

.inspector[hidden] {
  display: none;
}

.inspector .inspector-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--bfs-space-4);
}

.inspector .inspector-title {
  font-size: var(--bfs-type-ui-size);
  line-height: var(--bfs-type-ui-lh);
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* 视图头 */
.view-head {
  display: flex;
  align-items: center;
  gap: var(--bfs-space-3);
  flex-wrap: wrap;
}

.view-head h1 {
  font-size: var(--bfs-type-section-size);
  line-height: var(--bfs-type-section-lh);
  font-weight: var(--bfs-type-section-weight);
  letter-spacing: -0.02em;
}

.view-head .view-count {
  font-size: var(--bfs-type-support-size);
  line-height: var(--bfs-type-support-lh);
  color: var(--bfs-text-tertiary);
}

.view-head .view-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--bfs-space-2);
}

/* 视图切换：macOS 分段控件，选中项为亮起的独立胶囊 */
.seg-group {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: var(--bfs-surface-panel);
  border: var(--bfs-stroke-default) solid var(--bfs-border-subtle);
  border-radius: var(--bfs-radius-pill);
}

.seg-group .btn-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--bfs-radius-pill);
}

.seg-group .btn-icon.active {
  background: var(--bfs-surface-elevated);
  color: var(--bfs-text-primary);
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.18), 0 1px 3px rgba(0, 0, 0, 0.18);
}

[data-theme="light"] .seg-group .btn-icon.active {
  background: #FFFFFF;
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.9), 0 1px 3px rgba(0, 0, 0, 0.10);
}

/* ---------- 5. 界面补充组件 ---------- */

/* 悬停提示：玻璃胶囊，不抢焦点 */
.tooltip-wrap {
  position: relative;
  display: inline-flex;
}

.tooltip-wrap .tooltip-tip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(2px);
  padding: var(--bfs-space-1) 10px;
  background: var(--bfs-glass-panel);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: var(--bfs-stroke-default) solid var(--bfs-glass-border);
  border-radius: var(--bfs-radius-pill);
  box-shadow: var(--bfs-glass-rim), var(--bfs-shadow-overlay);
  font-size: var(--bfs-type-caption-size);
  line-height: var(--bfs-type-caption-lh);
  color: var(--bfs-text-primary);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  z-index: 80;
  transition: opacity var(--bfs-motion-feedback) var(--bfs-motion-standard),
    transform var(--bfs-motion-feedback) var(--bfs-motion-spring);
}

.tooltip-wrap:hover .tooltip-tip,
.tooltip-wrap:focus-visible .tooltip-tip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 等宽文字：文件名、时间码、参数、路径 */
.mono {
  font-family: var(--bfs-font-mono);
}

/* 属性面板元数据行 */
.meta-list .meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--bfs-space-2);
  min-height: 30px;
  border-bottom: var(--bfs-stroke-default) solid var(--bfs-border-subtle);
  font-size: var(--bfs-type-support-size);
  line-height: var(--bfs-type-support-lh);
}

.meta-list .meta-row:last-child {
  border-bottom: none;
}

.meta-list .meta-label {
  color: var(--bfs-text-tertiary);
  flex: none;
}

.meta-list .meta-value {
  font-family: var(--bfs-font-mono);
  color: var(--bfs-text-secondary);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 缩略图网格视图 */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--bfs-space-3);
}

/* 渲染任务行 */
.task-row {
  display: flex;
  align-items: center;
  gap: var(--bfs-space-3);
  min-height: 44px;
  padding: var(--bfs-space-2) var(--bfs-space-3);
  border-bottom: var(--bfs-stroke-default) solid var(--bfs-border-subtle);
}

.task-row:last-child {
  border-bottom: none;
}

.task-row .task-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.task-row .task-name {
  font-size: var(--bfs-type-ui-size);
  line-height: var(--bfs-type-ui-lh);
  font-weight: var(--bfs-type-ui-weight);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-row .task-sub {
  display: flex;
  align-items: center;
  gap: var(--bfs-space-2);
  font-size: var(--bfs-type-caption-size);
  line-height: var(--bfs-type-caption-lh);
  color: var(--bfs-text-tertiary);
}

.task-row .task-sub .progress {
  flex: 1;
}

.task-row .task-actions {
  display: flex;
  gap: var(--bfs-space-1);
  flex: none;
}

/* ---------- 6. 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--bfs-space-2);
  min-height: 36px;
  padding: 0 14px;
  font-size: var(--bfs-type-ui-size);
  line-height: var(--bfs-type-ui-lh);
  font-weight: var(--bfs-type-ui-weight);
  border-radius: var(--bfs-radius-pill);
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--bfs-motion-feedback) var(--bfs-motion-spring),
    border-color var(--bfs-motion-feedback) var(--bfs-motion-standard),
    box-shadow var(--bfs-motion-feedback) var(--bfs-motion-standard),
    color var(--bfs-motion-feedback) var(--bfs-motion-standard),
    transform var(--bfs-motion-feedback) var(--bfs-motion-spring),
    filter var(--bfs-motion-feedback) var(--bfs-motion-standard);
}

.btn:active {
  transform: scale(0.96);
}

/* 主按钮：tinted 液态玻璃，实色主体 + 顶边镜面 + 蓝色浮光 */
.btn-primary {
  background: var(--bfs-accent-gradient);
  color: var(--bfs-accent-on);
  box-shadow: var(--bfs-accent-glow), var(--bfs-accent-ring);
}

.btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: var(--bfs-accent-glow-strong), var(--bfs-accent-ring);
}

.btn-primary:active {
  filter: brightness(0.94);
  box-shadow: var(--bfs-accent-glow), var(--bfs-accent-ring);
}

/* 次按钮：中性填充，不叠加玻璃材质 */
.btn-secondary {
  background: rgba(255, 255, 255, 0.10);
  color: var(--bfs-text-primary);
  border: var(--bfs-stroke-default) solid var(--bfs-glass-border);
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.14);
}

[data-theme="light"] .btn-secondary {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(60, 60, 67, 0.18);
  box-shadow: inset 0 0.5px 0 #FFFFFF, 0 1px 3px rgba(0, 0, 0, 0.06);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.16);
}

[data-theme="light"] .btn-secondary:hover {
  background: #FFFFFF;
}

.btn-secondary:active {
  background: rgba(255, 255, 255, 0.09);
}

/* 轻量操作：透明背景 + 可读文字 */
.btn-text {
  background: transparent;
  color: var(--bfs-text-primary);
  padding: 0 12px;
}

.btn-text:hover {
  background: var(--bfs-surface-hover);
}

.btn-text:active {
  background: var(--bfs-surface-pressed);
}

/* 危险操作：红色文字与轮廓，不铺大块红色 */
.btn-danger {
  background: color-mix(in srgb, var(--bfs-status-danger) 10%, transparent);
  color: var(--bfs-status-danger);
  border: var(--bfs-stroke-default) solid
    color-mix(in srgb, var(--bfs-status-danger) 40%, transparent);
}

.btn-danger:hover {
  background: color-mix(in srgb, var(--bfs-status-danger) 16%, transparent);
}

/* 禁用：文字禁用色，无激活行为 */
.btn:disabled {
  color: var(--bfs-text-disabled);
  background: var(--bfs-surface-hover);
  border: var(--bfs-stroke-default) solid var(--bfs-border-subtle);
  box-shadow: none;
  cursor: not-allowed;
}

.btn:disabled:active {
  transform: none;
}

/* 密度变体：紧凑 32 / 触控 44 */
.btn-compact {
  min-height: 30px;
  padding: 0 10px;
}

.btn-touch {
  min-height: 44px;
}

/* 图标按钮：圆形，命中区至少 28×28 */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 28px;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  color: var(--bfs-text-primary);
  border: none;
  border-radius: var(--bfs-radius-pill);
  cursor: pointer;
  transition: background-color var(--bfs-motion-feedback) var(--bfs-motion-standard),
    color var(--bfs-motion-feedback) var(--bfs-motion-standard),
    transform var(--bfs-motion-feedback) var(--bfs-motion-spring);
}

.btn-icon:hover {
  background: var(--bfs-surface-hover);
}

.btn-icon:active {
  background: var(--bfs-surface-pressed);
  transform: scale(0.94);
}

.btn-icon:disabled {
  color: var(--bfs-text-disabled);
  background: transparent;
  border: none;
}

/* 图标按钮尺寸变体 */
.btn-icon.btn-icon-compact {
  width: 28px;
  height: 28px;
}

.btn-icon.btn-icon-touch {
  width: 44px;
  height: 44px;
}

/* 加载中的按钮：位置不动，展示真实状态 */
.btn .spinner {
  width: 14px;
  height: 14px;
  flex: none;
}

/* ---------- 7. 表单输入 ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--bfs-space-2);
  margin-bottom: var(--bfs-space-4);
}

.field > label {
  font-size: var(--bfs-type-ui-size);
  line-height: var(--bfs-type-ui-lh);
  font-weight: var(--bfs-type-ui-weight);
}

.input,
.textarea,
.select {
  width: 100%;
  min-height: 36px;
  padding: var(--bfs-space-2) var(--bfs-space-3);
  background: rgba(255, 255, 255, 0.06);
  border: var(--bfs-stroke-default) solid var(--bfs-border-default);
  border-radius: var(--bfs-radius-control);
  color: var(--bfs-text-primary);
  font-size: var(--bfs-type-ui-size);
  line-height: var(--bfs-type-ui-lh);
  font-weight: 400;
  transition: border-color var(--bfs-motion-feedback) var(--bfs-motion-standard),
    background-color var(--bfs-motion-feedback) var(--bfs-motion-standard);
}

[data-theme="light"] .input,
[data-theme="light"] .textarea,
[data-theme="light"] .select {
  background: #FFFFFF;
}

.textarea {
  min-height: 88px;
  resize: vertical;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--bfs-text-tertiary);
}

/* placeholder 只提供格式示例 */
.input.example::placeholder {
  font-family: var(--bfs-font-mono);
}

.input:hover,
.textarea:hover,
.select:hover {
  border-color: var(--bfs-border-control);
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: var(--bfs-stroke-focus) solid var(--bfs-focus-ring);
  outline-offset: 2px;
}

.input:disabled,
.textarea:disabled {
  color: var(--bfs-text-disabled);
  border-color: var(--bfs-border-subtle);
  cursor: not-allowed;
}

.input[readonly] {
  border-color: var(--bfs-border-subtle);
}

/* 错误：状态色轮廓 + 具体文本 */
.field.has-error .input {
  border-color: var(--bfs-status-danger);
}

.field-error {
  display: flex;
  align-items: flex-start;
  gap: var(--bfs-space-1);
  font-size: var(--bfs-type-support-size);
  line-height: var(--bfs-type-support-lh);
  color: var(--bfs-status-danger);
}

.field-hint {
  font-size: var(--bfs-type-support-size);
  line-height: var(--bfs-type-support-lh);
  color: var(--bfs-text-tertiary);
}

/* 搜索框：Spotlight 风格胶囊 */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-wrap .search-icon {
  position: absolute;
  left: var(--bfs-space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--bfs-text-tertiary);
  pointer-events: none;
  display: inline-flex;
}

.search-wrap .input {
  padding-left: 34px;
  border-radius: var(--bfs-radius-pill);
  background: rgba(255, 255, 255, 0.055);
}

[data-theme="light"] .search-wrap .input {
  background: rgba(255, 255, 255, 0.72);
}

/* 字段组间距 16 */
.field-group {
  display: grid;
  gap: var(--bfs-space-4);
}

/* ---------- 8. 复选、单选、开关、滑块 ---------- */
.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--bfs-space-4);
  align-items: center;
}

.choice {
  display: inline-flex;
  align-items: center;
  gap: var(--bfs-space-2);
  font-size: var(--bfs-type-ui-size);
  line-height: var(--bfs-type-ui-lh);
  font-weight: 400;
  cursor: pointer;
  min-height: 36px;
}

.choice input {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  flex: none;
  margin: 0;
  background: rgba(255, 255, 255, 0.06);
  border: var(--bfs-stroke-default) solid var(--bfs-border-control);
  cursor: pointer;
  transition: background-color var(--bfs-motion-feedback) var(--bfs-motion-standard),
    border-color var(--bfs-motion-feedback) var(--bfs-motion-standard);
}

.choice input[type="checkbox"] {
  border-radius: 6px;
}

.choice input[type="radio"] {
  border-radius: 50%;
}

.choice input:hover {
  border-color: var(--bfs-border-control);
}

.choice input:disabled {
  border-color: var(--bfs-border-subtle);
  background: var(--bfs-surface-hover);
  cursor: not-allowed;
}

.choice input:disabled + span {
  color: var(--bfs-text-disabled);
}

/* 选中：accent.fill 底 + 白色对勾，顶边镜面高光 */
.choice input[type="checkbox"]:checked {
  background: var(--bfs-accent-fill);
  border-color: var(--bfs-accent-fill);
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.30);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FFFFFF' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  background-size: 14px;
  background-position: center;
  background-repeat: no-repeat;
}

.choice input[type="radio"]:checked {
  border-color: var(--bfs-accent-fill);
  background:
    radial-gradient(circle,
      var(--bfs-accent-fill) 0 5px,
      transparent 5px) center / 18px 18px no-repeat,
    var(--bfs-surface-panel);
}

/* 开关：即时启停，Apple 开关绿 */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 44px;
  height: 26px;
  flex: none;
}

.switch input {
  appearance: none;
  -webkit-appearance: none;
  position: absolute;
  inset: 0;
  margin: 0;
  border-radius: var(--bfs-radius-pill);
  background: var(--bfs-surface-pressed);
  border: var(--bfs-stroke-default) solid var(--bfs-border-control);
  cursor: pointer;
  transition: background-color var(--bfs-motion-feedback) var(--bfs-motion-standard),
    border-color var(--bfs-motion-feedback) var(--bfs-motion-standard);
}

.switch input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform var(--bfs-motion-component) var(--bfs-motion-spring),
    background-color var(--bfs-motion-feedback) var(--bfs-motion-standard);
}

.switch input:checked {
  background: var(--bfs-status-success);
  border-color: transparent;
}

.switch input:checked::after {
  transform: translateX(16px);
}

.switch input:disabled {
  background: var(--bfs-surface-hover);
  border-color: var(--bfs-border-subtle);
  cursor: not-allowed;
}

.switch input:disabled::after {
  background: var(--bfs-text-disabled);
}

/* 滑块：Apple 白色圆钮 + 细轨道 */
.slider-field {
  display: flex;
  flex-direction: column;
  gap: var(--bfs-space-2);
  min-width: 0;
}

.slider-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: var(--bfs-type-ui-size);
  line-height: var(--bfs-type-ui-lh);
  font-weight: var(--bfs-type-ui-weight);
}

.slider-head .slider-value {
  font-family: var(--bfs-font-mono);
  font-weight: 400;
  color: var(--bfs-text-secondary);
}

.slider {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 24px;
  background: transparent;
  cursor: pointer;
}

.slider::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: var(--bfs-radius-pill);
  background: var(--bfs-surface-pressed);
}

.slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 0.5px solid rgba(0, 0, 0, 0.18);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
}

.slider::-moz-range-track {
  height: 4px;
  border-radius: var(--bfs-radius-pill);
  background: var(--bfs-surface-pressed);
}

.slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 0.5px solid rgba(0, 0, 0, 0.18);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
}

.slider:disabled {
  cursor: not-allowed;
}

.slider:disabled::-webkit-slider-thumb {
  background: var(--bfs-text-disabled);
}

/* ---------- 9. 标签页与菜单 ---------- */

/* 标签页：字重 + 2px 圆角指示线 */
.tabs {
  display: flex;
  gap: var(--bfs-space-2);
  border-bottom: var(--bfs-stroke-default) solid var(--bfs-border-subtle);
}

.tab {
  appearance: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: var(--bfs-space-2) var(--bfs-space-2) var(--bfs-space-3);
  font-size: var(--bfs-type-ui-size);
  line-height: var(--bfs-type-ui-lh);
  font-weight: 500;
  color: var(--bfs-text-secondary);
  border-radius: 0;
  position: relative;
  transition: color var(--bfs-motion-feedback) var(--bfs-motion-standard);
}

.tab:hover {
  color: var(--bfs-text-primary);
}

.tab[aria-selected="true"] {
  color: var(--bfs-text-primary);
}

.tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -1px;
  height: 2px;
  border-radius: var(--bfs-radius-pill);
  background: var(--bfs-accent-fill);
  box-shadow: var(--bfs-accent-glow-line);
}

.tab-panel {
  padding: var(--bfs-space-4) 0 0;
  font-size: var(--bfs-type-body-size);
  line-height: var(--bfs-type-body-lh);
  color: var(--bfs-text-secondary);
}

.tab-panel[hidden] {
  display: none;
}

/* 菜单：Liquid Glass thick，圆角 16，内边距 4 */
.menu {
  min-width: 200px;
  border-radius: var(--bfs-radius-panel);
  padding: var(--bfs-space-1);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: var(--bfs-space-2);
  width: 100%;
  min-height: 32px;
  padding: 0 var(--bfs-space-3);
  background: transparent;
  border: none;
  border-radius: 9px;
  font-size: var(--bfs-type-ui-size);
  line-height: var(--bfs-type-ui-lh);
  font-weight: 400;
  color: var(--bfs-text-primary);
  cursor: pointer;
  text-align: left;
  transition: background-color var(--bfs-motion-feedback) var(--bfs-motion-standard);
}

.menu-item:hover {
  background: var(--bfs-surface-hover);
}

.menu-item.danger {
  color: var(--bfs-status-danger);
}

.menu-separator {
  height: var(--bfs-stroke-default);
  background: var(--bfs-border-subtle);
  margin: var(--bfs-space-1) var(--bfs-space-2);
}

/* 下拉演示 */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-panel {
  position: absolute;
  top: calc(100% + var(--bfs-space-2));
  left: 0;
  z-index: 60;
  display: none;
}

.dropdown-panel.open {
  display: block;
  animation: dropdown-enter var(--bfs-motion-component) var(--bfs-motion-enter);
}

@keyframes dropdown-enter {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ---------- 10. 面板、卡片、列表、表格 ---------- */
.panel {
  background: var(--bfs-surface-panel);
  border: var(--bfs-stroke-default) solid var(--bfs-border-subtle);
  border-radius: var(--bfs-radius-panel);
  padding: var(--bfs-space-4);
}

.panel > .panel-title {
  font-size: var(--bfs-type-ui-size);
  line-height: var(--bfs-type-ui-lh);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: var(--bfs-space-3);
}

.card {
  background: var(--bfs-surface-panel);
  border: var(--bfs-stroke-default) solid var(--bfs-border-default);
  border-radius: var(--bfs-radius-panel);
  padding: var(--bfs-space-4);
}

.card .card-title {
  font-size: var(--bfs-type-ui-size);
  line-height: var(--bfs-type-ui-lh);
  font-weight: var(--bfs-type-ui-weight);
  margin-bottom: var(--bfs-space-1);
}

.card .card-meta {
  font-size: var(--bfs-type-caption-size);
  line-height: var(--bfs-type-caption-lh);
  color: var(--bfs-text-tertiary);
  margin-bottom: var(--bfs-space-2);
}

.card .card-desc {
  font-size: var(--bfs-type-support-size);
  line-height: var(--bfs-type-support-lh);
  color: var(--bfs-text-secondary);
  margin-bottom: var(--bfs-space-3);
}

/* 列表 */
.list {
  background: var(--bfs-surface-panel);
  border: var(--bfs-stroke-default) solid var(--bfs-border-subtle);
  border-radius: var(--bfs-radius-panel);
  overflow: hidden;
}

.list-item {
  display: flex;
  align-items: center;
  gap: var(--bfs-space-3);
  min-height: 40px;
  padding: var(--bfs-space-2) var(--bfs-space-4);
  border-bottom: var(--bfs-stroke-default) solid var(--bfs-border-subtle);
}

.list-item:last-child {
  border-bottom: none;
}

.list-item.clickable {
  cursor: pointer;
  transition: background-color var(--bfs-motion-feedback) var(--bfs-motion-standard);
}

.list-item.clickable:hover {
  background: var(--bfs-surface-hover);
}

.list-item .item-main {
  font-size: var(--bfs-type-ui-size);
  line-height: var(--bfs-type-ui-lh);
  font-weight: var(--bfs-type-ui-weight);
}

.list-item .item-meta {
  font-size: var(--bfs-type-support-size);
  line-height: var(--bfs-type-support-lh);
  color: var(--bfs-text-tertiary);
  font-family: var(--bfs-font-mono);
}

.item-actions {
  margin-left: auto;
  display: flex;
  gap: var(--bfs-space-1);
}

.item-actions .item-actions {
  margin-left: 0;
}

/* 表格：Apple 表格，0.5px 分隔，表头轻量，行悬停提亮 */
.data-table-wrap {
  border: var(--bfs-stroke-default) solid var(--bfs-border-subtle);
  border-radius: var(--bfs-radius-panel);
  overflow: auto;
  background: var(--bfs-surface-panel);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.data-table th {
  text-align: left;
  font-size: var(--bfs-type-caption-size);
  line-height: var(--bfs-type-caption-lh);
  font-weight: 500;
  color: var(--bfs-text-secondary);
  padding: var(--bfs-space-2) var(--bfs-space-3);
  border-bottom: var(--bfs-stroke-default) solid var(--bfs-border-default);
  white-space: nowrap;
}

.data-table th.num,
.data-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table th .sort-arrow {
  display: inline-flex;
  vertical-align: -2px;
  margin-left: var(--bfs-space-1);
  color: var(--bfs-text-tertiary);
}

.data-table td {
  padding: var(--bfs-space-3);
  font-size: var(--bfs-type-ui-size);
  line-height: var(--bfs-type-ui-lh);
  font-weight: 400;
  border-bottom: var(--bfs-stroke-default) solid var(--bfs-border-subtle);
}

.data-table td.mono {
  font-family: var(--bfs-font-mono);
  font-size: var(--bfs-type-support-size);
  color: var(--bfs-text-secondary);
}

.data-table tbody tr {
  transition: background-color var(--bfs-motion-feedback) var(--bfs-motion-standard);
}

.data-table tbody tr:hover {
  background: var(--bfs-surface-hover);
}

.data-table td .cell-select {
  margin-right: var(--bfs-space-3);
}

/* 批量选择操作条 */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: var(--bfs-space-3);
  padding: var(--bfs-space-2) var(--bfs-space-4);
  background: var(--bfs-surface-selected);
  border: var(--bfs-stroke-default) solid
    color-mix(in srgb, var(--bfs-accent-fill) 26%, transparent);
  border-radius: var(--bfs-radius-control);
  font-size: var(--bfs-type-ui-size);
  line-height: var(--bfs-type-ui-lh);
}

/* ---------- 11. 对话框、抽屉、提示 ---------- */
.dialog-scrim {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bfs-overlay-scrim);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--bfs-space-4);
}

.dialog-scrim.open {
  display: flex;
}

.dialog {
  width: 480px;
  max-width: calc(100vw - var(--bfs-space-8));
  max-height: calc(100vh - var(--bfs-space-8));
  overflow: auto;
  border-radius: var(--bfs-radius-dialog);
  padding: var(--bfs-space-6);
}

.dialog-scrim.open .dialog {
  animation: dialog-enter var(--bfs-motion-panel) var(--bfs-motion-enter);
}

@keyframes dialog-enter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dialog-title {
  font-size: var(--bfs-type-section-size);
  line-height: var(--bfs-type-section-lh);
  font-weight: var(--bfs-type-section-weight);
  letter-spacing: -0.02em;
  margin-bottom: var(--bfs-space-2);
}

.dialog-body {
  font-size: var(--bfs-type-body-size);
  line-height: var(--bfs-type-body-lh);
  color: var(--bfs-text-secondary);
  margin-bottom: var(--bfs-space-6);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--bfs-space-2);
}

/* 抽屉：保持当前上下文的补充任务 */
.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 210;
  background: var(--bfs-overlay-scrim);
  display: none;
}

.drawer-scrim.open {
  display: block;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 211;
  width: 360px;
  max-width: calc(100vw - var(--bfs-space-8));
  border-radius: var(--bfs-radius-dialog) 0 0 var(--bfs-radius-dialog);
  padding: var(--bfs-space-6);
  overflow: auto;
  transform: translateX(100%);
  transition: transform var(--bfs-motion-panel) var(--bfs-motion-enter);
}

.drawer-scrim.open .drawer {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--bfs-space-4);
}

.drawer-title {
  font-size: var(--bfs-type-section-size);
  line-height: var(--bfs-type-section-lh);
  font-weight: var(--bfs-type-section-weight);
  letter-spacing: -0.02em;
}

/* 轻提示：胶囊玻璃，不抢焦点 */
.toast-region {
  position: fixed;
  right: var(--bfs-space-6);
  bottom: var(--bfs-space-6);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--bfs-space-2);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--bfs-space-2);
  min-width: 240px;
  max-width: 360px;
  padding: var(--bfs-space-3) var(--bfs-space-5);
  border-radius: var(--bfs-radius-pill);
  font-size: var(--bfs-type-ui-size);
  line-height: var(--bfs-type-ui-lh);
  animation: toast-enter var(--bfs-motion-component) var(--bfs-motion-spring);
}

@keyframes toast-enter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast.leaving {
  animation: toast-exit var(--bfs-motion-component) var(--bfs-motion-exit) forwards;
}

@keyframes toast-exit {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}

/* 键帽 */
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  font-family: var(--bfs-font-mono);
  font-size: var(--bfs-type-caption-size);
  color: var(--bfs-text-secondary);
  background: var(--bfs-surface-elevated);
  border: var(--bfs-stroke-default) solid var(--bfs-border-default);
  border-bottom-width: 2px;
  border-radius: var(--bfs-radius-small);
}

/* ---------- 12. 徽章、状态条与反馈 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--bfs-space-1);
  padding: 0 var(--bfs-space-2);
  height: 22px;
  font-size: 11px;
  line-height: 16px;
  font-weight: 500;
  border-radius: var(--bfs-radius-pill);
  white-space: nowrap;
}

.badge.success { color: var(--bfs-status-success); background: color-mix(in srgb, var(--bfs-status-success) 16%, transparent); }
.badge.warning { color: var(--bfs-status-warning); background: color-mix(in srgb, var(--bfs-status-warning) 16%, transparent); }
.badge.danger { color: var(--bfs-status-danger); background: color-mix(in srgb, var(--bfs-status-danger) 16%, transparent); }
.badge.info { color: var(--bfs-status-info); background: color-mix(in srgb, var(--bfs-status-info) 16%, transparent); }
.badge.neutral { color: var(--bfs-text-secondary); background: var(--bfs-surface-hover); }

/* 状态条：状态色文字与图标，不做大块底色 */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--bfs-space-2);
  padding: var(--bfs-space-3) var(--bfs-space-4);
  border-radius: var(--bfs-radius-panel);
  font-size: var(--bfs-type-support-size);
  line-height: var(--bfs-type-support-lh);
  border: var(--bfs-stroke-default) solid var(--bfs-border-subtle);
  background: var(--bfs-surface-panel);
}

.alert .alert-icon {
  flex: none;
  margin-top: 1px;
}

.alert .alert-title {
  font-weight: 600;
  color: var(--bfs-text-primary);
}

.alert.success .alert-icon, .alert.success .alert-title { color: var(--bfs-status-success); }
.alert.warning .alert-icon, .alert.warning .alert-title { color: var(--bfs-status-warning); }
.alert.danger .alert-icon, .alert.danger .alert-title { color: var(--bfs-status-danger); }
.alert.info .alert-icon, .alert.info .alert-title { color: var(--bfs-status-info); }
.alert .alert-text { color: var(--bfs-text-secondary); }

/* 进度：真实进度，不编造百分比 */
.progress {
  display: flex;
  flex-direction: column;
  gap: var(--bfs-space-1);
}

.progress-head {
  display: flex;
  justify-content: space-between;
  font-size: var(--bfs-type-support-size);
  line-height: var(--bfs-type-support-lh);
  color: var(--bfs-text-secondary);
}

.progress-track {
  height: 4px;
  border-radius: var(--bfs-radius-pill);
  background: var(--bfs-surface-pressed);
  overflow: hidden;
}

.progress-fill {
  display: block;
  height: 100%;
  border-radius: var(--bfs-radius-pill);
  background: var(--bfs-accent-gradient);
  box-shadow: var(--bfs-accent-glow-line);
  transition: width var(--bfs-motion-panel) var(--bfs-motion-standard);
}

.progress-fill.indeterminate {
  width: 32%;
  animation: progress-slide 1.2s var(--bfs-motion-standard) infinite;
}

@keyframes progress-slide {
  from { transform: translateX(-100%); }
  to { transform: translateX(320%); }
}

/* 加载指示：旋转 2px 线宽 */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--bfs-border-subtle);
  border-top-color: var(--bfs-text-secondary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner.small {
  width: 14px;
  height: 14px;
}

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

/* 骨架屏 */
.skeleton {
  border-radius: var(--bfs-radius-small);
  background: var(--bfs-surface-hover);
  animation: skeleton-pulse 1.6s ease-in-out infinite;
}

.skeleton.line { height: 14px; margin-bottom: var(--bfs-space-2); }
.skeleton.line.w-60 { width: 60%; }
.skeleton.line.w-40 { width: 40%; }
.skeleton.thumb { width: 96px; height: 54px; border-radius: var(--bfs-radius-control); }

@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* 空状态与无结果 */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--bfs-space-2);
  padding: var(--bfs-space-10) var(--bfs-space-6);
  text-align: center;
}

.empty .empty-icon {
  color: var(--bfs-text-tertiary);
}

.empty .empty-title {
  font-size: var(--bfs-type-ui-size);
  line-height: var(--bfs-type-ui-lh);
  font-weight: var(--bfs-type-ui-weight);
  color: var(--bfs-text-secondary);
}

.empty .empty-desc {
  font-size: var(--bfs-type-support-size);
  line-height: var(--bfs-type-support-lh);
  color: var(--bfs-text-tertiary);
}

/* ---------- 13. 影像内容 ---------- */

/* 观看区：纯黑周边，恒定深色 */
.media-stage {
  background: var(--bfs-media-surround);
  border-radius: var(--bfs-radius-dialog);
  padding: var(--bfs-space-6);
  display: flex;
  flex-direction: column;
  gap: var(--bfs-space-3);
}

/* 图像容器：2.39 宽银幕框 */
.media-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 2.39 / 1;
  background: var(--bfs-media-letterbox);
  border-radius: var(--bfs-radius-panel);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* 原比例播放留边：16:9 内容在 2.39 容器中上下留黑 */
.media-frame .letterbox-inner {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: linear-gradient(180deg, var(--bfs-media-surface-a), var(--bfs-media-surface-b));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--bfs-space-2);
  color: var(--bfs-media-text);
  font-size: var(--bfs-type-support-size);
  font-family: var(--bfs-font-mono);
}

/* 叠加名称与时间码：玻璃胶囊，保持独立底板 */
.media-frame .media-badge {
  position: absolute;
  left: var(--bfs-space-3);
  bottom: var(--bfs-space-3);
  padding: var(--bfs-space-1) 10px;
  background: var(--bfs-media-chip);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: var(--bfs-stroke-default) solid rgba(255, 255, 255, 0.16);
  color: var(--bfs-media-text-strong);
  font-size: 11px;
  line-height: 16px;
  font-family: var(--bfs-font-mono);
  border-radius: var(--bfs-radius-pill);
}

/* 播放按钮：液态玻璃圆钮，浮在画面上方 */
.media-frame .play-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: var(--bfs-stroke-default) solid rgba(255, 255, 255, 0.30);
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.35), 0 8px 24px rgba(0, 0, 0, 0.35);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color var(--bfs-motion-feedback) var(--bfs-motion-standard),
    transform var(--bfs-motion-feedback) var(--bfs-motion-spring);
}

.media-frame .play-button:hover {
  background: rgba(255, 255, 255, 0.24);
  transform: translate(-50%, -50%) scale(1.04);
}

.media-frame .play-button:active {
  transform: translate(-50%, -50%) scale(0.94);
}

.media-frame .timecode {
  position: absolute;
  right: var(--bfs-space-3);
  bottom: var(--bfs-space-3);
  padding: var(--bfs-space-1) var(--bfs-space-2);
  background: var(--bfs-media-chip);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: var(--bfs-stroke-default) solid rgba(255, 255, 255, 0.16);
  color: var(--bfs-media-text-strong);
  font-family: var(--bfs-font-mono);
  font-size: 11px;
  line-height: 16px;
  border-radius: var(--bfs-radius-pill);
}

/* 观看区内的控件使用恒定深色语义值，不随浅色主题变化 */
.media-stage .media-controls {
  display: flex;
  align-items: center;
  gap: var(--bfs-space-2);
  color: var(--bfs-media-text);
}

.media-stage .btn-icon {
  color: var(--bfs-media-text-strong);
}

.media-stage .btn-icon:hover {
  background: rgba(255, 255, 255, 0.10);
}

.media-stage .btn-icon:active {
  background: rgba(255, 255, 255, 0.16);
}

/* 缩略图网格：统一容器比例，能进入完整预览 */
.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--bfs-space-3);
}

.thumb-card {
  background: var(--bfs-surface-panel);
  border: var(--bfs-stroke-default) solid var(--bfs-border-subtle);
  border-radius: var(--bfs-radius-panel);
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--bfs-motion-feedback) var(--bfs-motion-standard),
    transform var(--bfs-motion-component) var(--bfs-motion-spring),
    box-shadow var(--bfs-motion-component) var(--bfs-motion-standard);
}

.thumb-card:hover {
  border-color: var(--bfs-border-default);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.thumb-card .thumb-frame {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--bfs-media-surface-a), var(--bfs-media-surface-b));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bfs-media-icon);
}

.thumb-card .thumb-info {
  padding: var(--bfs-space-2) var(--bfs-space-3);
}

.thumb-card .thumb-name {
  font-size: var(--bfs-type-support-size);
  line-height: var(--bfs-type-support-lh);
  color: var(--bfs-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thumb-card .thumb-meta {
  font-family: var(--bfs-font-mono);
  font-size: 11px;
  line-height: 16px;
  color: var(--bfs-text-tertiary);
}

/* 缺失状态：缺失封面、损坏文件、不支持格式分别表达 */
.missing-card {
  aspect-ratio: 16 / 9;
  border-radius: var(--bfs-radius-panel);
  border: var(--bfs-stroke-default) dashed var(--bfs-border-default);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--bfs-space-2);
  color: var(--bfs-text-tertiary);
  font-size: var(--bfs-type-support-size);
  background: var(--bfs-surface-sidebar);
}

.missing-card .missing-title {
  color: var(--bfs-text-secondary);
}

/* ---------- 14. 图标 ---------- */

/* Lucide 线性图标，统一 1.75 视觉线宽 */
.icon-14 svg, svg.icon-14 { width: 14px; height: 14px; }
.icon-16 svg, svg.icon-16 { width: 16px; height: 16px; }
.icon-20 svg, svg.icon-20 { width: 20px; height: 20px; }
svg.lucide { stroke-width: 1.75; }

/* 铃铛造型重心偏下，上移 1px 做光学平衡 */
svg.lucide-bell {
  transform: translateY(-1px);
}

/* 主题切换图标：按当前主题显示 */
.theme-icon-moon {
  display: none;
}

[data-theme="light"] .theme-icon-sun {
  display: none;
}

[data-theme="light"] .theme-icon-moon {
  display: inline-flex;
}

/* 通用横排容器 */
.demo-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--bfs-space-3);
}

/* 窄屏专用按钮 */
.only-narrow {
  display: none;
}

@media (max-width: 899px) {
  .only-narrow {
    display: inline-flex;
  }
}

/* 窄屏侧栏遮罩 */
.sidebar-scrim {
  position: fixed;
  inset: 0;
  top: var(--bfs-chrome-toolbar);
  z-index: 110;
  background: var(--bfs-overlay-scrim);
  display: none;
}

/* ---------- 15. 减少动态 ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .progress-fill.indeterminate {
    animation: none;
    width: 100%;
    opacity: 0.4;
  }

  .spinner {
    animation: none;
    border-top-color: transparent;
    border-color: var(--bfs-text-secondary);
  }
}

/* ---------- 16. 减少透明度：玻璃改为不透明表面 ---------- */
@media (prefers-reduced-transparency: reduce) {
  .app-toolbar,
  .app-sidebar {
    background: var(--bfs-surface-sidebar);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .menu,
  .dialog,
  .drawer,
  .toast,
  .tooltip-tip {
    background: var(--bfs-surface-elevated);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .menu::before,
  .dialog::before,
  .drawer::before,
  .toast::before {
    display: none;
  }

  .search-wrap .input,
  .input,
  .textarea,
  .select {
    background: var(--bfs-surface-panel);
  }

  .media-frame .play-button,
  .media-frame .media-badge,
  .media-frame .timecode {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* ---------- 容器适配：按可用宽度切换 ---------- */

/* 900–1279：属性区收起，由预览抽屉承担 */
@media (max-width: 1279px) {
  .inspector {
    display: none;
  }
}

/* 600–899：导航改为可打开抽屉 */
@media (max-width: 899px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "topbar"
      "main";
  }

  .app-sidebar {
    position: fixed;
    top: var(--bfs-chrome-toolbar);
    left: 0;
    bottom: 0;
    z-index: 120;
    width: 248px;
    transform: translateX(-100%);
    transition: transform var(--bfs-motion-panel) var(--bfs-motion-enter);
  }

  .app-sidebar.open {
    transform: translateX(0);
    box-shadow: var(--bfs-shadow-overlay);
  }

  .sidebar-scrim.open {
    display: block;
  }

  .app-toolbar .toolbar-search {
    width: 140px;
  }

  .app-toolbar .hide-narrow {
    display: none;
  }
}

/* <600：单列，内容内边距 16，顶栏收缩 */
@media (max-width: 599px) {
  .workspace {
    padding: var(--bfs-space-4);
  }

  .app-toolbar .toolbar-search {
    display: none;
  }

  /* 顶栏收缩：品牌仅保留标志，主按钮仅保留图标 */
  .app-brand .brand-text {
    display: none;
  }

  .app-toolbar .btn-primary .btn-label {
    display: none;
  }

  .app-toolbar .btn-primary {
    width: 36px;
    padding: 0;
  }

  .view-head .view-tools {
    width: 100%;
    margin-left: 0;
  }
}

