/*!
 * NekroAPI 皮肤 · 方案 A「纸本」
 * 浅色编辑风：暖纸底、墨色字、NXT 靛蓝 #3f5b8f 作唯一专色，黄铜 #b4884a 只做点缀；页面标题用宋体。
 * 适配 New API v1.0.0-rc.47 新前端（shadcn 式 CSS 变量，深色用 html.dark，用户配色预设写在 body[data-theme-preset]）。
 *
 * 原则：以覆盖变量为主。变量写在 html 上，用户在「主题定制」里选了别的配色预设时，body 上的预设变量自然生效，皮肤让位。
 *
 * 非变量选择器清单（升级后逐条核对；任何一条失效都只是退回 New API 原样）：
 *   [1] iframe[sandbox*="allow-top-navigation-by-user-activation"]
 *       首页自定义 iframe：高度 100vh → 100dvh，避免手机地址栏伸缩带来外层滚动。
 *   [2] #root :is(h1, h2)
 *       页面大标题（登录 / 注册 / 模型广场 / 控制台页头）改用宋体 Nekro Serif。
 *   [3] #root > .h-svh:has(form input[name="password"])::after
 *       登录 / 注册页（布局容器 div.relative.grid.h-svh）右下角放水月荧插画，宽屏才显示。
 *   [4] #root div.pointer-events-none[style*="radial-gradient"]
 *       模型广场顶部用内联 style 写死的蓝青渐变光斑，隐藏。
 */

@font-face { font-family: "Nekro Serif"; src: url("/_brand/fonts/nekro-serif.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Nekro Inter"; src: url("/_brand/fonts/inter.woff2") format("woff2"); font-weight: 400 700; font-display: swap;
  unicode-range: U+0000-02FF, U+2000-206F, U+20AC, U+2122, U+2190-21FF; }
@font-face { font-family: "Nekro Mono"; src: url("/_brand/fonts/jetbrains-mono.woff2") format("woff2"); font-weight: 400 600; font-display: swap; }

/* ── 浅色（html:root 的优先级高于 New API 的 :root 和 .dark，深色块再用 html.dark:root 压回来） */
html:root {
  --radius: 0.625rem;
  --font-ui-sans: "Nekro Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --font-public-sans: var(--font-ui-sans);
  --font-mono: "Nekro Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-serif: "Nekro Serif", "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif;

  --background: #f3f1ec;
  --foreground: #1b1a17;
  --card: #fbfaf7;
  --card-foreground: #1b1a17;
  --popover: #fbfaf7;
  --popover-foreground: #1b1a17;
  --primary: #3f5b8f;
  --primary-foreground: #ffffff;
  --secondary: #e9e6df;
  --secondary-foreground: #1b1a17;
  --muted: #ebe8e1;
  --muted-foreground: #615e57;
  --accent: #e4e6ea;
  --accent-foreground: #1b1a17;
  --destructive: #b03a30;
  --destructive-foreground: #ffffff;
  --success: #217a4f;
  --success-foreground: #ffffff;
  --warning: #a8721a;
  --warning-foreground: #ffffff;
  --info: #3f6fb0;
  --info-foreground: #ffffff;
  --neutral: #6d6a63;
  --neutral-foreground: #ffffff;
  --border: #dad6cd;
  --input: #cfcabf;
  --ring: #3f5b8f;
  --chart-1: #3f5b8f;
  --chart-2: #b4884a;
  --chart-3: #3fb1ea;
  --chart-4: #217a4f;
  --chart-5: #b03a30;
  --overview-accent-1: #3f5b8f;
  --overview-accent-2: #b4884a;
  --overview-accent-3: #6d6a63;

  --sidebar: #ece9e2;
  --sidebar-foreground: #1b1a17;
  --sidebar-primary: #3f5b8f;
  --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: #dfe3ea;
  --sidebar-accent-foreground: #2f4a7a;
  --sidebar-border: #dad6cd;
  --sidebar-ring: #3f5b8f;

  --skeleton-base: #e6e3dc;
  --skeleton-highlight: #efece6;
  --table-row: #fbfaf7;
  --table-header: #f0eee8;
  --table-header-hover: #ebe8e1;
  --table-disabled: #efece6;
  --table-disabled-hover: #e9e6df;
  --table-disabled-border: #d2cdc2;
}

/* ── 深色：门户深色中性灰 + 提亮的靛蓝 */
html.dark:root {
  --background: #0e0e0d;
  --foreground: #ecebe6;
  --card: #151513;
  --card-foreground: #ecebe6;
  --popover: #1b1a18;
  --popover-foreground: #ecebe6;
  --primary: #9db4de;
  --primary-foreground: #0e1626;
  --secondary: #1e1d1b;
  --secondary-foreground: #ecebe6;
  --muted: #1e1d1b;
  --muted-foreground: #aaa79f;
  --accent: #1d2330;
  --accent-foreground: #ecebe6;
  --destructive: #f08f83;
  --destructive-foreground: #1b0d0b;
  --success: #6dcf98;
  --success-foreground: #0b1a12;
  --warning: #e9bd68;
  --warning-foreground: #1d1406;
  --info: #7fa6e0;
  --info-foreground: #0b1524;
  --neutral: #aaa79f;
  --neutral-foreground: #0e0e0d;
  --border: #2b2a27;
  --input: #3d3c38;
  --ring: #9db4de;
  --chart-1: #9db4de;
  --chart-2: #d8af73;
  --chart-3: #3fb1ea;
  --chart-4: #6dcf98;
  --chart-5: #f08f83;
  --overview-accent-1: #9db4de;
  --overview-accent-2: #d8af73;
  --overview-accent-3: #aaa79f;

  --sidebar: #0e0e0d;
  --sidebar-foreground: #ecebe6;
  --sidebar-primary: #9db4de;
  --sidebar-primary-foreground: #0e1626;
  --sidebar-accent: #1d2330;
  --sidebar-accent-foreground: #c3d4f0;
  --sidebar-border: #2b2a27;
  --sidebar-ring: #9db4de;

  --skeleton-base: #1e1d1b;
  --skeleton-highlight: #2b2a27;
  --table-row: #151513;
  --table-header: #1a1917;
  --table-header-hover: #1e1d1b;
  --table-disabled: #1a1917;
  --table-disabled-hover: #1e1d1b;
  --table-disabled-border: #3d3c38;
}

::selection { background: color-mix(in srgb, var(--primary) 26%, transparent); }

/* [1] 首页 iframe */
iframe[sandbox*="allow-top-navigation-by-user-activation"] { height: 100dvh; display: block; }

/* [2] 标题宋体 */
#root :is(h1, h2) { font-family: var(--font-serif); font-weight: 700; letter-spacing: -0.005em; }

/* [3] 登录 / 注册页插画 */
@media (min-width: 1180px) {
  #root > .h-svh:has(form input[name="password"])::after {
    content: "";
    position: absolute;
    right: max(24px, calc((100vw - 1440px) / 2 + 40px));
    bottom: 0;
    width: 340px;
    height: 368px;
    background: url("/_brand/img/character.webp") right bottom / contain no-repeat;
    pointer-events: none;
    z-index: 0;
  }
}

/* [4] 去掉模型广场等页面顶部写死颜色的渐变光斑（New API 用内联 style 画的 radial-gradient 装饰层） */
#root div.pointer-events-none[style*="radial-gradient"] { display: none; }
