/* ==============================================================================
   千剧工坊 v2 · 设计令牌 (Design Tokens)
   ==============================================================================
   规范来源 : docs/PART-2-视觉设计系统-完整版.md
              §2 色彩系统 / §3 字体系统 / §4 间距·圆角·阴影 / §6 动效 / §7 断点
   本文件定位: 全站唯一取值源。组件样式只允许引用 var(--token), 不得再写死颜色、
              字号、圆角、时长 —— 现有 36 个 CSS 已经出现 44 种字号、25 种圆角、
              671 个硬编码 HEX, 正是因为缺少唯一取值源。

   启用方式(属性可挂在 <html> 或任意容器上, 只作用于所在子树):
     <html data-theme="dark"  data-module="novel">     深色 + 小说创作(翠绿)
     <html data-theme="dark"  data-module="script">    深色 + 剧本创作(青蓝)
     <html data-theme="dark"  data-module="director">  深色 + 超级导演(琥珀)
     <html data-theme="light" data-module="novel">     明亮 + 小说创作(翠绿)
     <html data-theme="light">                         明亮 + 通用(蓝紫)

   默认值:
     - 未写 data-theme  → 深色主题 (§01 的深色值同时写在内核 :root 上, 见该节注释)
     - 未写 data-module → 通用蓝紫主题 (§07)

   引用示例:
     .panel {
       background: var(--layer-2);
       border: 1px solid var(--border-subtle);
       border-radius: var(--radius-lg);
       box-shadow: var(--shadow-sm);
       color: var(--text-primary);
       font-size: var(--text-base);
       line-height: var(--leading-normal);
       transition: background var(--duration-fast) var(--ease-out);
     }
     .scrim { background: rgba(var(--layer-0-rgb), 0.72); }   半透明场景请改用 -rgb 版本

   注意:
     1. 本文件只声明变量、关键帧与 reduced-motion 兜底, 不输出 .btn / .card 等组件类,
        避免与既有 .n-* (2073 次) / .s-* (1614 次) / .sh-* (76 次) 命名体系打架。
     2. 颜色类令牌写在 :root 与 [data-theme] 作用域内(深色值同时挂 :root 作为默认);
        非颜色令牌(字号/间距/圆角/动效/断点)只写在 :root, 二者互不覆盖。
   ============================================================================== */


/* ==============================================================================
   01 · 深色主题 (DEFAULT) —— 表面 / 交互叠加 / 边框 / 文本 / 阴影
   ------------------------------------------------------------------------------
   表面 5 层由深到浅递进(L0 应用底色 → L4 弹窗)。每层附 -rgb 版本, 供
   rgba(var(--surface-N-rgb), α) 做半透明叠加, 避免再写死一串 RGB。
   选择器同时包含 :root, 因此未设置 data-theme 时页面即为深色(默认主题)。
   ============================================================================== */

:root,
[data-theme="dark"] {
  color-scheme: dark;                              /* 原生滚动条/表单控件跟随深色 */

  /* ---- 表面层次 (L0 → L4) ---- */
  --layer-0: #05070C;                            /* L0 应用底色(最深), 铺满整页 */
  --layer-0-rgb: 5, 7, 12;                       /* L0 的 RGB 分量 */
  --layer-1: #0A0D12;                            /* L1 深层容器, 主要内容区背景 */
  --layer-1-rgb: 10, 13, 18;                     /* L1 的 RGB 分量 */
  --layer-2: #0F131C;                            /* L2 中层表面, 卡片 / 面板 */
  --layer-2-rgb: 15, 19, 28;                     /* L2 的 RGB 分量 */
  --layer-3: #161D2B;                            /* L3 抬升层, 悬浮条 / 次级按钮底 */
  --layer-3-rgb: 22, 29, 43;                     /* L3 的 RGB 分量 */
  --layer-4: #1E2636;                            /* L4 最高层, 弹窗 / 模态框 / Toast */
  --layer-4-rgb: 30, 38, 54;                     /* L4 的 RGB 分量 */

  /* ---- 交互状态叠加层 (叠加在任意 surface 之上的半透明遮罩) ---- */
  --overlay-hover: rgba(255, 255, 255, 0.06);      /* 悬停 */
  --overlay-active: rgba(255, 255, 255, 0.12);     /* 按下 */
  --overlay-selected: rgba(255, 255, 255, 0.08);   /* 选中(列表项 / 分集 / Tab) */

  /* ---- 边框层次 (弱 → 强) ---- */
  --border-subtle: rgba(255, 255, 255, 0.06);      /* 最弱: 分区线 / 卡片描边 */
  --border-default: rgba(255, 255, 255, 0.12);     /* 默认: 输入框 / 次级按钮 */
  --border-emphasis: rgba(255, 255, 255, 0.18);    /* 强调: 悬停态 / 弹窗描边 */
  --border-strong: rgba(255, 255, 255, 0.24);      /* 最强: 结构分割 / 聚焦外框 */

  /* ---- 文本层次 (强 → 弱) ---- */
  --text-primary: rgba(255, 255, 255, 0.95);       /* 正文 / 标题 */
  --text-secondary: rgba(255, 255, 255, 0.65);     /* 次要说明 / 表单标签 */
  --text-tertiary: rgba(255, 255, 255, 0.45);      /* 元信息 / 时间戳 / 弱图标 */
  --text-disabled: rgba(255, 255, 255, 0.25);      /* 禁用态文字 */
  --text-placeholder: rgba(255, 255, 255, 0.35);   /* 输入框 placeholder */
  --text-on-accent: rgba(0, 0, 0, 0.92);           /* 反色文字, 用于主题色实底按钮 */

  /* ---- 阴影 (深色背景需要更重的黑色才可见) ---- */
  --shadow-sm:                                     /* 细微: 卡片静置 */
    0 1px 2px 0 rgba(0, 0, 0, 0.3),
    0 1px 3px 0 rgba(0, 0, 0, 0.15);
  --shadow-md:                                     /* 默认: 悬浮 / 悬停抬升 */
    0 4px 6px -1px rgba(0, 0, 0, 0.4),
    0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg:                                     /* 强: 下拉面板 / 抽屉 / Toast */
    0 10px 15px -3px rgba(0, 0, 0, 0.5),
    0 4px 6px -2px rgba(0, 0, 0, 0.25);
  --shadow-xl:                                     /* 特强: 模态框 */
    0 20px 25px -5px rgba(0, 0, 0, 0.6),
    0 10px 10px -5px rgba(0, 0, 0, 0.3);
  --shadow-inner:                                  /* 内阴影: 凹陷 / 按下输入框 */
    inset 0 2px 4px 0 rgba(0, 0, 0, 0.25);
}


/* ==============================================================================
   02 · 明亮主题 —— 表面 / 交互叠加 / 边框 / 文本 / 阴影
   ------------------------------------------------------------------------------
   明亮主题的 L1 ~ L4 全部是纯白, 层次不靠底色而靠 box-shadow 表达(见本节阴影)。
   边框与文字改用黑色半透明。
   ============================================================================== */

[data-theme="light"] {
  color-scheme: light;                             /* 原生滚动条/表单控件跟随浅色 */

  /* ---- 表面层次 (L0 → L4) ---- */
  --layer-0: #FAFAFA;                            /* L0 应用底色(最浅), 铺满整页 */
  --layer-0-rgb: 250, 250, 250;                  /* L0 的 RGB 分量 */
  --layer-1: #FFFFFF;                            /* L1 深层容器, 主要内容区背景 */
  --layer-1-rgb: 255, 255, 255;                  /* L1 的 RGB 分量 */
  --layer-2: #FFFFFF;                            /* L2 中层表面, 卡片 / 面板 */
  --layer-2-rgb: 255, 255, 255;                  /* L2 的 RGB 分量 */
  --layer-3: #FFFFFF;                            /* L3 抬升层, 悬浮条 / 次级按钮底 */
  --layer-3-rgb: 255, 255, 255;                  /* L3 的 RGB 分量 */
  --layer-4: #FFFFFF;                            /* L4 最高层, 弹窗 / 模态框 / Toast */
  --layer-4-rgb: 255, 255, 255;                  /* L4 的 RGB 分量 */

  /* ---- 交互状态叠加层 ---- */
  --overlay-hover: rgba(0, 0, 0, 0.04);            /* 悬停 */
  --overlay-active: rgba(0, 0, 0, 0.08);           /* 按下 */
  --overlay-selected: rgba(0, 0, 0, 0.06);         /* 选中 */

  /* ---- 边框层次 (弱 → 强) ---- */
  --border-subtle: rgba(0, 0, 0, 0.06);            /* 最弱: 分区线 / 卡片描边 */
  --border-default: rgba(0, 0, 0, 0.12);           /* 默认: 输入框 / 次级按钮 */
  --border-emphasis: rgba(0, 0, 0, 0.18);          /* 强调: 悬停态 / 弹窗描边 */
  --border-strong: rgba(0, 0, 0, 0.24);            /* 最强: 结构分割 / 聚焦外框 */

  /* ---- 文本层次 (强 → 弱) ---- */
  --text-primary: rgba(0, 0, 0, 0.92);             /* 正文 / 标题 */
  --text-secondary: rgba(0, 0, 0, 0.65);           /* 次要说明 / 表单标签 */
  --text-tertiary: rgba(0, 0, 0, 0.45);            /* 元信息 / 时间戳 / 弱图标 */
  --text-disabled: rgba(0, 0, 0, 0.25);            /* 禁用态文字 */
  --text-placeholder: rgba(0, 0, 0, 0.38);         /* 输入框 placeholder */
  --text-on-accent: rgba(255, 255, 255, 0.98);     /* 反色文字, 用于主题色实底按钮 */

  /* ---- 阴影 (明亮主题更柔和, 层次全靠它) ---- */
  --shadow-sm:                                     /* 细微: 卡片静置 */
    0 1px 2px 0 rgba(0, 0, 0, 0.05),
    0 1px 3px 0 rgba(0, 0, 0, 0.1);
  --shadow-md:                                     /* 默认: 悬浮 / 悬停抬升 */
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg:                                     /* 强: 下拉面板 / 抽屉 / Toast */
    0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl:                                     /* 特强: 模态框 */
    0 20px 25px -5px rgba(0, 0, 0, 0.15),
    0 10px 10px -5px rgba(0, 0, 0, 0.08);
  --shadow-inner:                                  /* 内阴影: 凹陷 / 按下输入框 */
    inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
}


/* ==============================================================================
   03 · 主题色调色板 (4 套 × 双模式原值)
   ------------------------------------------------------------------------------
   这里只存"原值"(带 -dark / -light 后缀), 不直接给组件用;
   组件用 §05 的 --module-accent / --accent-dim / --accent-subtle / --accent-emphasis。
   每套 4 档: accent(主体) / dim(按下·悬停加深) / subtle(浅底) / emphasis(浅底描边)。
   ============================================================================== */

:root {
  /* ---- 小说创作 · 翠绿系 ---- */
  --accent-novel-dark: #6EE7B7;                        /* 深色模式主体色, 明亮翠绿 */
  --accent-novel-dark-dim: #10B981;                    /* 深色模式加深档, 用于 hover */
  --accent-novel-dark-subtle: rgba(110, 231, 183, 0.12);  /* 深色模式浅底(徽章底) */
  --accent-novel-dark-emphasis: rgba(110, 231, 183, 0.24);/* 深色模式浅底描边 */
  --accent-novel-light: #059669;                       /* 明亮模式主体色, 深绿(保证对比度) */
  --accent-novel-light-dim: #047857;                   /* 明亮模式加深档, 用于 hover */
  --accent-novel-light-subtle: rgba(5, 150, 105, 0.08);    /* 明亮模式浅底 */
  --accent-novel-light-emphasis: rgba(5, 150, 105, 0.16);  /* 明亮模式浅底描边 */

  /* ---- 剧本创作 · 青蓝系 ---- */
  --accent-script-dark: #38BDF8;                       /* 深色模式主体色, 青蓝 */
  --accent-script-dark-dim: #0EA5E9;                   /* 深色模式加深档 */
  --accent-script-dark-subtle: rgba(56, 189, 248, 0.12);   /* 深色模式浅底 */
  --accent-script-dark-emphasis: rgba(56, 189, 248, 0.24); /* 深色模式浅底描边 */
  --accent-script-light: #0284C7;                      /* 明亮模式主体色, 深青蓝 */
  --accent-script-light-dim: #0369A1;                  /* 明亮模式加深档 */
  --accent-script-light-subtle: rgba(2, 132, 199, 0.08);   /* 明亮模式浅底 */
  --accent-script-light-emphasis: rgba(2, 132, 199, 0.16); /* 明亮模式浅底描边 */

  /* ---- 超级导演 · 琥珀系 (文档原值 "#FBB A6D" 为笔误, 按规范取 #FB926D 并据此生成 rgba) ---- */
  --accent-director-dark: #FB926D;                     /* 深色模式主体色, 琥珀 */
  --accent-director-dark-dim: #F59E0B;                 /* 深色模式加深档 */
  --accent-director-dark-subtle: rgba(251, 146, 109, 0.12);   /* 深色模式浅底 */
  --accent-director-dark-emphasis: rgba(251, 146, 109, 0.24); /* 深色模式浅底描边 */
  --accent-director-light: #EA580C;                    /* 明亮模式主体色, 深琥珀 */
  --accent-director-light-dim: #C2410C;                /* 明亮模式加深档 */
  --accent-director-light-subtle: rgba(234, 88, 12, 0.08);    /* 明亮模式浅底 */
  --accent-director-light-emphasis: rgba(234, 88, 12, 0.16);  /* 明亮模式浅底描边 */

  /* ---- 通用 / 默认 · 蓝紫系 ---- */
  --accent-common-dark: #3B6DFF;                       /* 深色模式主体色, 蓝紫 */
  --accent-common-dark-dim: #2563EB;                   /* 深色模式加深档 */
  --accent-common-dark-subtle: rgba(59, 109, 255, 0.12);   /* 深色模式浅底 */
  --accent-common-dark-emphasis: rgba(59, 109, 255, 0.24); /* 深色模式浅底描边 */
  --accent-common-light: #1D4ED8;                      /* 明亮模式主体色, 深蓝 */
  --accent-common-light-dim: #1E40AF;                  /* 明亮模式加深档 */
  --accent-common-light-subtle: rgba(29, 78, 216, 0.08);   /* 明亮模式浅底 */
  --accent-common-light-emphasis: rgba(29, 78, 216, 0.16); /* 明亮模式浅底描边 */

  /* ---- 无限画布 · 紫罗兰系 ---- */
  --accent-canvas-dark: #C4A2FF;                       /* 深色模式主体色, 浅紫 */
  --accent-canvas-dark-dim: #8B5CF6;                   /* 深色模式加深档 */
  --accent-canvas-dark-subtle: rgba(196, 162, 255, 0.12);   /* 深色模式浅底 */
  --accent-canvas-dark-emphasis: rgba(196, 162, 255, 0.24); /* 深色模式浅底描边 */
  --accent-canvas-light: #7C3AED;                      /* 明亮模式主体色, 深紫 */
  --accent-canvas-light-dim: #6D28D9;                  /* 明亮模式加深档 */
  --accent-canvas-light-subtle: rgba(124, 58, 237, 0.08);   /* 明亮模式浅底 */
  --accent-canvas-light-emphasis: rgba(124, 58, 237, 0.16); /* 明亮模式浅底描边 */

  /* ---- 管理后台 · 石板灰蓝系 (克制, 不与创作区抢视觉) ---- */
  --accent-admin-dark: #94A3B8;                        /* 深色模式主体色 */
  --accent-admin-dark-dim: #64748B;                    /* 深色模式加深档 */
  --accent-admin-dark-subtle: rgba(148, 163, 184, 0.14);   /* 深色模式浅底 */
  --accent-admin-dark-emphasis: rgba(148, 163, 184, 0.26); /* 深色模式浅底描边 */
  --accent-admin-light: #475569;                       /* 明亮模式主体色 */
  --accent-admin-light-dim: #334155;                   /* 明亮模式加深档 */
  --accent-admin-light-subtle: rgba(71, 85, 105, 0.08);    /* 明亮模式浅底 */
  --accent-admin-light-emphasis: rgba(71, 85, 105, 0.16);  /* 明亮模式浅底描边 */
}


/* ==============================================================================
   04 · 语义色调色板 (原值)
   ------------------------------------------------------------------------------
   同样只存原值; 组件用 §06 的 --state-success / --state-warning / --state-error / --state-info 及 -bg / -border。
   ============================================================================== */

:root {
  --state-success-dark: #10B981;      /* 成功 · 深色模式主体色 */
  --state-success-light: #059669;     /* 成功 · 明亮模式主体色 */
  --state-warning-dark: #F59E0B;      /* 警告 · 深色模式主体色 */
  --state-warning-light: #D97706;     /* 警告 · 明亮模式主体色 */
  --state-error-dark: #EF4444;        /* 错误 · 深色模式主体色 */
  --state-error-light: #DC2626;       /* 错误 · 明亮模式主体色 */
  --state-info-dark: #3B82F6;         /* 信息 · 深色模式主体色 */
  --state-info-light: #2563EB;        /* 信息 · 明亮模式主体色 */
}


/* ==============================================================================
   05 · 主题色映射 (按 data-theme 生效)
   ------------------------------------------------------------------------------
   把 §03 的原值按当前主题落到 4 套模块色上。组件与 §07 只引用 --accent-novel 等。
   深色块同时挂在 :root 上, 这样未设置 data-theme 时也有完整的主题色(默认深色);
   明亮块在其后, 权重相同, 靠源码顺序覆盖。
   ============================================================================== */

:root,
[data-theme="dark"] {
  /* 小说 · 翠绿 */
  --accent-novel: var(--accent-novel-dark);            /* 主体色 */
  --accent-novel-dim: var(--accent-novel-dark-dim);    /* 加深档 */
  --accent-novel-subtle: var(--accent-novel-dark-subtle);    /* 浅底 */
  --accent-novel-emphasis: var(--accent-novel-dark-emphasis);/* 浅底描边 */

  /* 剧本 · 青蓝 */
  --accent-script: var(--accent-script-dark);          /* 主体色 */
  --accent-script-dim: var(--accent-script-dark-dim);  /* 加深档 */
  --accent-script-subtle: var(--accent-script-dark-subtle);    /* 浅底 */
  --accent-script-emphasis: var(--accent-script-dark-emphasis);/* 浅底描边 */

  /* 导演 · 琥珀 */
  --accent-director: var(--accent-director-dark);          /* 主体色 */
  --accent-director-dim: var(--accent-director-dark-dim);  /* 加深档 */
  --accent-director-subtle: var(--accent-director-dark-subtle);    /* 浅底 */
  --accent-director-emphasis: var(--accent-director-dark-emphasis);/* 浅底描边 */

  /* 通用 · 蓝紫 */
  --accent-common: var(--accent-common-dark);          /* 主体色 */
  --accent-common-dim: var(--accent-common-dark-dim);  /* 加深档 */
  --accent-common-subtle: var(--accent-common-dark-subtle);    /* 浅底 */
  --accent-common-emphasis: var(--accent-common-dark-emphasis);/* 浅底描边 */

  /* 画布 · 紫罗兰 */
  --accent-canvas: var(--accent-canvas-dark);          /* 主体色 */
  --accent-canvas-dim: var(--accent-canvas-dark-dim);  /* 加深档 */
  --accent-canvas-subtle: var(--accent-canvas-dark-subtle);    /* 浅底 */
  --accent-canvas-emphasis: var(--accent-canvas-dark-emphasis);/* 浅底描边 */

  /* 后台 · 石板灰蓝 */
  --accent-admin: var(--accent-admin-dark);            /* 主体色 */
  --accent-admin-dim: var(--accent-admin-dark-dim);    /* 加深档 */
  --accent-admin-subtle: var(--accent-admin-dark-subtle);    /* 浅底 */
  --accent-admin-emphasis: var(--accent-admin-dark-emphasis);/* 浅底描边 */
}

[data-theme="light"] {
  /* 小说 · 翠绿 */
  --accent-novel: var(--accent-novel-light);           /* 主体色 */
  --accent-novel-dim: var(--accent-novel-light-dim);   /* 加深档 */
  --accent-novel-subtle: var(--accent-novel-light-subtle);     /* 浅底 */
  --accent-novel-emphasis: var(--accent-novel-light-emphasis); /* 浅底描边 */

  /* 剧本 · 青蓝 */
  --accent-script: var(--accent-script-light);         /* 主体色 */
  --accent-script-dim: var(--accent-script-light-dim); /* 加深档 */
  --accent-script-subtle: var(--accent-script-light-subtle);     /* 浅底 */
  --accent-script-emphasis: var(--accent-script-light-emphasis); /* 浅底描边 */

  /* 导演 · 琥珀 */
  --accent-director: var(--accent-director-light);         /* 主体色 */
  --accent-director-dim: var(--accent-director-light-dim); /* 加深档 */
  --accent-director-subtle: var(--accent-director-light-subtle);     /* 浅底 */
  --accent-director-emphasis: var(--accent-director-light-emphasis); /* 浅底描边 */

  /* 通用 · 蓝紫 */
  --accent-common: var(--accent-common-light);         /* 主体色 */
  --accent-common-dim: var(--accent-common-light-dim); /* 加深档 */
  --accent-common-subtle: var(--accent-common-light-subtle);     /* 浅底 */
  --accent-common-emphasis: var(--accent-common-light-emphasis); /* 浅底描边 */

  /* 画布 · 紫罗兰 */
  --accent-canvas: var(--accent-canvas-light);         /* 主体色 */
  --accent-canvas-dim: var(--accent-canvas-light-dim); /* 加深档 */
  --accent-canvas-subtle: var(--accent-canvas-light-subtle);     /* 浅底 */
  --accent-canvas-emphasis: var(--accent-canvas-light-emphasis); /* 浅底描边 */

  /* 后台 · 石板灰蓝 */
  --accent-admin: var(--accent-admin-light);           /* 主体色 */
  --accent-admin-dim: var(--accent-admin-light-dim);   /* 加深档 */
  --accent-admin-subtle: var(--accent-admin-light-subtle);     /* 浅底 */
  --accent-admin-emphasis: var(--accent-admin-light-emphasis); /* 浅底描边 */
}


/* ==============================================================================
   06 · 语义色映射 (按 data-theme 生效)
   ------------------------------------------------------------------------------
   每个语义色输出三档: 主体色 / 背景(带透明) / 描边, 供 badge / toast / 表单校验复用。
   深色块同样挂在 :root 上, 保证零属性时 badge / toast 也有可用取值。
   ============================================================================== */

:root,
[data-theme="dark"] {
  --state-success: var(--state-success-dark);                  /* 成功主体色 */
  --state-success-bg: rgba(16, 185, 129, 0.12);          /* 成功浅底(徽章/提示条) */
  --state-success-border: rgba(16, 185, 129, 0.24);      /* 成功浅底描边 */

  --state-warning: var(--state-warning-dark);                  /* 警告主体色 */
  --state-warning-bg: rgba(245, 158, 11, 0.12);          /* 警告浅底 */
  --state-warning-border: rgba(245, 158, 11, 0.24);      /* 警告浅底描边 */

  --state-error: var(--state-error-dark);                      /* 错误主体色 */
  --state-error-bg: rgba(239, 68, 68, 0.12);             /* 错误浅底 */
  --state-error-border: rgba(239, 68, 68, 0.24);         /* 错误浅底描边 */

  --state-info: var(--state-info-dark);                        /* 信息主体色 */
  --state-info-bg: rgba(59, 130, 246, 0.12);             /* 信息浅底 */
  --state-info-border: rgba(59, 130, 246, 0.24);         /* 信息浅底描边 */
}

[data-theme="light"] {
  --state-success: var(--state-success-light);                 /* 成功主体色 */
  --state-success-bg: rgba(5, 150, 105, 0.08);           /* 成功浅底 */
  --state-success-border: rgba(5, 150, 105, 0.24);       /* 成功浅底描边 */

  --state-warning: var(--state-warning-light);                 /* 警告主体色 */
  --state-warning-bg: rgba(217, 119, 6, 0.08);           /* 警告浅底 */
  --state-warning-border: rgba(217, 119, 6, 0.24);       /* 警告浅底描边 */

  --state-error: var(--state-error-light);                     /* 错误主体色 */
  --state-error-bg: rgba(220, 38, 38, 0.08);             /* 错误浅底 */
  --state-error-border: rgba(220, 38, 38, 0.24);         /* 错误浅底描边 */

  --state-info: var(--state-info-light);                       /* 信息主体色 */
  --state-info-bg: rgba(37, 99, 235, 0.08);              /* 信息浅底 */
  --state-info-border: rgba(37, 99, 235, 0.24);          /* 信息浅底描边 */
}


/* ==============================================================================
   07 · 模块主题切换 (data-module)
   ------------------------------------------------------------------------------
   写作台切换模块时只需改 <html data-module="...">, 全站主题色随之改变。
   顺序要求: 默认值(:root)必须写在前面, 后写的 [data-module] 才能同权重覆盖。
   ============================================================================== */

/* 默认: 通用蓝紫 */
:root {
  --module-accent: var(--accent-common);                        /* 当前主题色主体 */
  --accent-dim: var(--accent-common-dim);                /* 当前主题色加深档(按下) */
  --accent-subtle: var(--accent-common-subtle);          /* 当前主题色浅底 */
  --accent-emphasis: var(--accent-common-emphasis);      /* 当前主题色浅底描边 */
}

/* 小说创作 · 翠绿 */
:root[data-module="novel"],
[data-module="novel"] {
  --module-accent: var(--accent-novel);                         /* 当前主题色主体 */
  --accent-dim: var(--accent-novel-dim);                 /* 当前主题色加深档 */
  --accent-subtle: var(--accent-novel-subtle);           /* 当前主题色浅底 */
  --accent-emphasis: var(--accent-novel-emphasis);       /* 当前主题色浅底描边 */
}

/* 剧本创作 · 青蓝 */
:root[data-module="script"],
[data-module="script"] {
  --module-accent: var(--accent-script);                        /* 当前主题色主体 */
  --accent-dim: var(--accent-script-dim);                /* 当前主题色加深档 */
  --accent-subtle: var(--accent-script-subtle);          /* 当前主题色浅底 */
  --accent-emphasis: var(--accent-script-emphasis);      /* 当前主题色浅底描边 */
}

/* 超级导演 · 琥珀 */
:root[data-module="director"],
[data-module="director"] {
  --module-accent: var(--accent-director);                      /* 当前主题色主体 */
  --accent-dim: var(--accent-director-dim);              /* 当前主题色加深档 */
  --accent-subtle: var(--accent-director-subtle);        /* 当前主题色浅底 */
  --accent-emphasis: var(--accent-director-emphasis);    /* 当前主题色浅底描边 */
}

/* 无限画布 · 紫罗兰 */
:root[data-module="canvas"],
[data-module="canvas"] {
  --module-accent: var(--accent-canvas);                        /* 当前主题色主体 */
  --accent-dim: var(--accent-canvas-dim);                /* 当前主题色加深档 */
  --accent-subtle: var(--accent-canvas-subtle);          /* 当前主题色浅底 */
  --accent-emphasis: var(--accent-canvas-emphasis);      /* 当前主题色浅底描边 */
}

/* 管理后台 · 石板灰蓝 */
:root[data-module="admin"],
[data-module="admin"] {
  --module-accent: var(--accent-admin);                         /* 当前主题色主体 */
  --accent-dim: var(--accent-admin-dim);                 /* 当前主题色加深档 */
  --accent-subtle: var(--accent-admin-subtle);           /* 当前主题色浅底 */
  --accent-emphasis: var(--accent-admin-emphasis);       /* 当前主题色浅底描边 */
}


/* ==============================================================================
   08 · 字体族
   ============================================================================== */

:root {
  --font-sans:                                     /* 界面主字体: 系统 UI 字体 + 中文黑体 */
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "PingFang SC",
    "Hiragino Sans GB",
    "Microsoft YaHei",
    "Noto Sans SC",
    sans-serif;

  --font-mono:                                     /* 等宽: 代码 / 数据 / 时间 / 版本号 */
    ui-monospace,
    "SF Mono",
    "Cascadia Code",
    "Consolas",
    "Liberation Mono",
    "Menlo",
    monospace;

  --font-serif:                                    /* 衬线: 长文本阅读 / 剧本正文预览(可选) */
    "Noto Serif SC",
    "Source Han Serif SC",
    Georgia,
    "Times New Roman",
    serif;
}


/* ==============================================================================
   09 · 字号 (流式 clamp: 随视口在区间内平滑缩放)
   ------------------------------------------------------------------------------
   格式 clamp(最小值, 中间值(rem + vw), 最大值)。桌面 1440px 视口约为区间中上段。
   ============================================================================== */

:root {
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);  /* 12-14px: 时间戳 / 元信息 / 标签 */
  --text-sm:   clamp(0.875rem, 0.825rem + 0.25vw, 1rem);      /* 14-16px: 表单标签 / 辅助文字 */
  --text-base: clamp(1rem,     0.95rem + 0.25vw, 1.125rem);   /* 16-18px: 正文 / 按钮 / 输入框 */
  --text-lg:   clamp(1.125rem, 1.05rem + 0.375vw, 1.25rem);   /* 18-20px: 小节标题 / 卡片标题 */
  --text-xl:   clamp(1.25rem,  1.15rem + 0.5vw, 1.5rem);      /* 20-24px: 页面小标题 / 模态框标题 */
  --text-2xl:  clamp(1.5rem,   1.35rem + 0.75vw, 2rem);       /* 24-32px: 页面主标题 */
  --text-3xl:  clamp(1.875rem, 1.65rem + 1.125vw, 2.5rem);    /* 30-40px: 首页大标题 */
  --text-4xl:  clamp(2.25rem,  1.95rem + 1.5vw, 3rem);        /* 36-48px: Hero / 品牌名 */
  --text-5xl:  clamp(2.75rem,  2.35rem + 2vw, 3.75rem);       /* 44-60px: 仅营销页使用 */
}


/* ==============================================================================
   10 · 字重 / 字间距 / 行高
   ============================================================================== */

:root {
  /* ---- 字重 ---- */
  --font-thin: 100;         /* 极细, 仅装饰性大字号 */
  --font-extralight: 200;   /* 超细 */
  --font-light: 300;        /* 细体 */
  --font-normal: 400;       /* 正文默认 */
  --font-medium: 500;       /* 按钮 / 标签 / 表格表头 */
  --font-semibold: 600;     /* 小标题 / 卡片标题 */
  --font-bold: 700;         /* 页面主标题 / 强调 */
  --font-extrabold: 800;    /* 特大标题 */
  --font-black: 900;        /* 极少使用 */

  /* ---- 字间距 ---- */
  --tracking-tighter: -0.05em;   /* 超大标题(4xl+) */
  --tracking-tight: -0.025em;    /* 大标题(2xl-3xl) */
  --tracking-normal: 0;          /* 默认, 中文最佳 */
  --tracking-wide: 0.025em;      /* 大写英文 / 全大写标签 */
  --tracking-wider: 0.05em;      /* 装饰性小字 */

  /* ---- 行高 ---- */
  --leading-none: 1;             /* 按钮 / 标签 / 单行控件 */
  --leading-tight: 1.25;         /* 大标题 */
  --leading-snug: 1.375;         /* 小标题 / 卡片标题 */
  --leading-normal: 1.5;         /* 正文默认 */
  --leading-relaxed: 1.625;      /* 长文本阅读 / 小说预览 */
  --leading-loose: 2;            /* 特殊排版 / 剧本对白分层 */
}


/* ==============================================================================
   11 · 间距 (严格 8px 基准, 全部为 rem, 随根字号缩放)
   ------------------------------------------------------------------------------
   用法分层: 组件内 space-1 ~ space-4(4-16px) / 组件间 space-4 ~ space-8(16-32px) /
             区块间 space-8 ~ space-16(32-64px) / 页面级 space-16 ~ space-24(64-96px)。
   ============================================================================== */

:root {
  --space-0: 0;              /* 清零 */
  --space-px: 1px;           /* 1px 发丝线, 仅用于描边补偿 */
  --space-0-5: 0.125rem;     /* 2px  极小间隙(图标与文字之间) */
  --space-1: 0.25rem;        /* 4px  最小间距 */
  --space-1-5: 0.375rem;     /* 6px  小号按钮内边距 */
  --space-2: 0.5rem;         /* 8px  基准单位 */
  --space-2-5: 0.625rem;     /* 10px 输入框内边距 */
  --space-3: 0.75rem;        /* 12px 常规内边距 */
  --space-3-5: 0.875rem;     /* 14px 输入框横向内边距 */
  --space-4: 1rem;           /* 16px 组件内边距 / 组件间距 */
  --space-5: 1.25rem;        /* 20px */
  --space-6: 1.5rem;         /* 24px 卡片内边距 / 区块内间距 */
  --space-7: 1.75rem;        /* 28px */
  --space-8: 2rem;           /* 32px 区块间距 / 关闭按钮尺寸 */
  --space-9: 2.25rem;        /* 36px */
  --space-10: 2.5rem;        /* 40px 带图标输入的左内边距 */
  --space-11: 2.75rem;       /* 44px 触摸目标最小尺寸 */
  --space-12: 3rem;          /* 48px */
  --space-14: 3.5rem;        /* 56px */
  --space-16: 4rem;          /* 64px  页面区块间距 */
  --space-20: 5rem;          /* 80px */
  --space-24: 6rem;          /* 96px  页面级留白 */
  --space-28: 7rem;          /* 112px */
  --space-32: 8rem;          /* 128px */
  --space-36: 9rem;          /* 144px */
  --space-40: 10rem;         /* 160px */
  --space-44: 11rem;         /* 176px */
  --space-48: 12rem;         /* 192px */
  --space-52: 13rem;         /* 208px */
  --space-56: 14rem;         /* 224px */
  --space-60: 15rem;         /* 240px */
  --space-64: 16rem;         /* 256px */
  --space-72: 18rem;         /* 288px */
  --space-80: 20rem;         /* 320px */
  --space-96: 24rem;         /* 384px */
}


/* ==============================================================================
   12 · 圆角
   ============================================================================== */

:root {
  --radius-none: 0;             /* 无圆角 */
  --radius-sm: 0.25rem;         /* 4px   极小组件(标签内图标底) */
  --radius-DEFAULT: 0.375rem;   /* 6px   小号按钮 / 小标签 / 关闭按钮 */
  --radius-md: 0.5rem;          /* 8px   默认: 按钮 / 输入框 */
  --radius-lg: 0.75rem;         /* 12px  卡片 / Toast */
  --radius-xl: 1rem;            /* 16px  大卡片 / 作品卡 */
  --radius-2xl: 1.5rem;         /* 24px  模态框 */
  --radius-3xl: 2rem;           /* 32px  特大容器 / 空状态插画底 */
  --radius-full: 9999px;        /* 圆形: 头像 / 胶囊按钮 / 徽章 */
}


/* ==============================================================================
   13 · 动效: 时长与缓动
   ------------------------------------------------------------------------------
   静置类动效一律用 --ease-out; 退出用 --ease-in; 循环/双向用 --ease-in-out。
   ============================================================================== */

:root {
  /* ---- 时长 ---- */
  --duration-instant: 50ms;     /* 50ms  立即反馈: 按钮按下 */
  --duration-fast: 120ms;       /* 120ms 快速: hover 状态变化 */
  --duration-normal: 180ms;     /* 180ms 普通: 输入框 focus / 一般过渡 */
  --duration-slow: 280ms;       /* 280ms 慢速: 下拉菜单 / 抽屉 */
  --duration-slower: 400ms;     /* 400ms 更慢: 侧边栏滑入 */
  --duration-slowest: 600ms;    /* 600ms 最慢: 页面淡入淡出 */

  /* ---- 缓动 ---- */
  --ease-linear: cubic-bezier(0, 0, 1, 1);                    /* 匀速: 进度条 / 旋转 */
  --ease-in: cubic-bezier(0.4, 0, 1, 1);                      /* 加速: 元素退出视图 */
  --ease-out: cubic-bezier(0, 0, 0.2, 1);                     /* 减速: 默认, 元素进入视图 */
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);                /* 两端缓: 双向 / 循环动画 */
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);      /* 回弹: 特殊强调, 少用 */
  --ease-snap: cubic-bezier(0.25, 0.46, 0.45, 0.94);          /* 快出慢停: 瞬时拖动 / 吸附 */
  --ease-smooth: cubic-bezier(0.4, 0, 0.6, 1);                /* 柔顺: 长距离移动 */
}


/* ==============================================================================
   14 · 响应式断点
   ------------------------------------------------------------------------------
   注意: CSS 变量无法用在 @media 条件里, 这里只作取值约定与 JS 侧读取
         (getComputedStyle 或 matchMedia 阈值), 媒体查询仍需写字面量。
   ============================================================================== */

:root {
  --breakpoint-xs: 475px;       /* 小手机 */
  --breakpoint-sm: 640px;       /* 手机竖屏 */
  --breakpoint-md: 768px;       /* 平板竖屏(两栏起点) */
  --breakpoint-lg: 1024px;      /* 平板横屏 / 小笔记本(三栏起点) */
  --breakpoint-xl: 1280px;      /* 笔记本 */
  --breakpoint-2xl: 1536px;     /* 桌面 / 大屏 */
}


/* ==============================================================================
   15 · 关键帧库
   ------------------------------------------------------------------------------
   只在这里定义一次, 组件用 animation: <name> var(--duration-*) var(--ease-*) 调用。
   同名关键帧重复定义会互相覆盖, 新增动画请先在本节检索是否已存在。
   ============================================================================== */

/* 淡入 / 淡出 */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* 纵向滑入: 12px */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 横向滑入: 24px */
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-24px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* 缩放: 0.96 起, 用于模态框 / 浮层 */
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes scaleOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.96); }
}

/* 旋转: 加载指示器 */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* 脉冲: 生成中占位 / 骨架屏 */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

/* 弹跳: 向上 8px, 用于点状加载 / 空状态提示 */
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

/* 摇摆: 表单校验失败 */
@keyframes shake {
  0%, 100%                        { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90%         { transform: translateX(-4px); }
  20%, 40%, 60%, 80%              { transform: translateX(4px); }
}


/* ==============================================================================
   16 · Reduced Motion 兜底
   ------------------------------------------------------------------------------
   系统开启"减少动态效果"时, 把所有动画/过渡压到不可感知, 同时保留终态。
   ============================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==============================================================================
   END · 千剧工坊 v2 设计令牌
   ============================================================================== */
