/* =========================================================
   明月庄主 · 夜色层
   深色模式变量覆盖 + 昼夜「天空翻页」过渡 + 主题开关按钮
   ---------------------------------------------------------
   接入（文件由站点自己引入，本文件不改动任何既有文件）：
     <link rel="stylesheet" href="assets/css/night.css">   ← 放在 bright.css 之后
     <script src="assets/js/night.js"></script>            ← 放在 <head> 里、同步执行
   ---------------------------------------------------------
   约定：
   · 主题状态写在 <html data-theme="day|night">；
   · 过渡期间 <html> 额外有 .is-theme-transition；
   · 过渡层 .theme-nightshift 的 z-index 为 9000（站点最高的是 .skip-link 的 999）；
   · 所有图形都用渐变 / box-shadow / clip-path 画，零图片、零外部请求；
   · 选择器统一带 html[data-theme="night"] body.theme-bright 前缀，
     特异性恒高于 bright.css 的 body.theme-bright .x，不靠 !important。
   ========================================================= */

/* =========================================================
   1. 夜色变量：深靛蓝底 + 暖奶油字 + 更亮的红石红
   ========================================================= */
html[data-theme="night"] body.theme-bright {
  /* 底色：偏蓝的近黑，比纯黑透气 */
  --bg: #070a17;
  --bg-soft: #0b1024;
  --surface: #121834;
  --surface-2: #172046;
  --surface-3: #1e2854;
  --paper: #121834;
  --paper-2: #182148;

  /* 线条：浅色低透明度，暗底上才不会像黑边 */
  --line: rgba(240, 222, 190, 0.15);
  --line-2: rgba(240, 222, 190, 0.28);

  /* 文字：奶油白系，正文对比度 14:1 以上 */
  --text: #f2e7d5;
  --ink: #f8efdf;
  --ink-soft: #cfbfa5;
  --text-2: #cfbfa5;
  --text-3: #a8987f;

  /* 强调色：暗底上要更亮才跳得出来 */
  --amber: #ff5a45;
  --amber-2: #ff9078;
  --amber-3: #ff3d2b;
  --amber-soft: rgba(255, 90, 69, 0.16);
  --gold: #ffd45c;
  --gold-deep: #a86f0c;

  --green: #58d98a;
  --violet: #b3a0ff;
  --sky: #6fc6f4;
  --grass: #6cc24a;
  --grass-dark: #2c5f21;
  --dirt: #1c1512;
  --dirt-dark: #0f0b09;

  /* 红石：亮红做字与描边，深红只做硬阴影 */
  --redstone: #ff5a45;
  --redstone-2: #ff9a83;
  --redstone-dark: #8d2115;
  --redstone-glow: rgba(255, 90, 69, 0.55);
}

/* 原生滚动条 / 表单控件直接跟随 */
html[data-theme="night"] {
  background-color: #060913;
  color-scheme: dark;
}
html[data-theme="night"]:has(body.theme-bright) {
  background: #060913;
  scrollbar-color: #333d66 #060913;
}
html[data-theme="night"] body.theme-bright::-webkit-scrollbar-track {
  background: #060913;
}
html[data-theme="night"] body.theme-bright::-webkit-scrollbar-thumb {
  background: #333d66;
  border-color: #060913;
}
html[data-theme="night"] body.theme-bright::-webkit-scrollbar-thumb:hover {
  background: #4a5688;
}

/* =========================================================
   2. 页面底：网格 + 噪点 + 选中 + 滚动进度
   ========================================================= */
html[data-theme="night"] body.theme-bright {
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(178, 202, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(178, 202, 255, 0.05) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--text);
}
/* 噪点：暗底上正片叠底会糊成一片，改用 screen */
html[data-theme="night"] body.theme-bright .grain {
  opacity: 0.05;
  mix-blend-mode: screen;
}
html[data-theme="night"] body.theme-bright ::selection {
  background: var(--redstone);
  color: #14100c;
}
html[data-theme="night"] body.theme-bright .scroll-progress span {
  background: linear-gradient(90deg, #58bdfa, var(--redstone-2) 58%, var(--redstone));
  box-shadow: 0 0 10px rgba(255, 90, 69, 0.45);
}

/* =========================================================
   3. 顶栏 / 导航 / 圆钮
   ========================================================= */
html[data-theme="night"] body.theme-bright .site-header {
  color: var(--ink);
}
html[data-theme="night"] body.theme-bright .site-header.is-scrolled {
  background: rgba(8, 12, 26, 0.88);
  border-bottom: 2px solid var(--line-2);
  box-shadow: 0 14px 34px -22px rgba(0, 0, 0, 0.95);
}
html[data-theme="night"] body.theme-bright .nav__link {
  color: var(--ink-soft);
}
html[data-theme="night"] body.theme-bright .nav__link:hover,
html[data-theme="night"] body.theme-bright .nav__link.is-active {
  color: var(--ink);
}
html[data-theme="night"] body.theme-bright .nav__link::after {
  background: var(--redstone);
  box-shadow: 0 0 10px var(--redstone-glow);
}
html[data-theme="night"] body.theme-bright .brand__mark {
  filter: drop-shadow(0 0 10px rgba(198, 220, 255, 0.45));
}
html[data-theme="night"] body.theme-bright .brand__en {
  color: var(--text-3);
}

/* 圆钮（GitHub 等）：亮边框保留像素感，但底子换成玻璃 */
html[data-theme="night"] body.theme-bright .icon-btn {
  border-color: var(--line-2);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}
html[data-theme="night"] body.theme-bright .icon-btn:hover {
  background: var(--redstone);
  border-color: var(--redstone-2);
  color: #fff6f0;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5), 0 0 18px var(--redstone-glow);
}
html[data-theme="night"] body.theme-bright .menu-btn {
  border-color: var(--line-2);
  background: rgba(255, 255, 255, 0.05);
}
html[data-theme="night"] body.theme-bright .menu-btn span {
  background: var(--ink);
}

/* =========================================================
   4. 首屏 / 详情页「天空」换成夜空
   ========================================================= */
html[data-theme="night"] body.theme-bright .hero {
  background:
    radial-gradient(70% 46% at 78% 6%, rgba(126, 160, 255, 0.22), transparent 68%),
    radial-gradient(90% 40% at 84% 84%, rgba(255, 120, 84, 0.14), transparent 70%),
    linear-gradient(180deg, #05081a 0%, #0a1030 32%, #121a3f 56%, #1a1d42 74%, #0d1226 100%);
}
html[data-theme="night"] body.theme-bright .hero__glow {
  background: radial-gradient(
    circle,
    rgba(198, 220, 255, 0.55),
    rgba(140, 172, 255, 0.2) 42%,
    transparent 66%
  );
  opacity: 0.75;
}
html[data-theme="night"] body.theme-bright .hero__grid {
  background-image:
    linear-gradient(rgba(150, 188, 255, 0.11) 1px, transparent 1px),
    linear-gradient(90deg, rgba(150, 188, 255, 0.11) 1px, transparent 1px);
}
/* 首屏右上的像素太阳：换成冷光，顺手转成月亮色 */
html[data-theme="night"] body.theme-bright .sky-sun {
  filter: drop-shadow(0 0 26px rgba(198, 220, 255, 0.7))
    drop-shadow(0 0 74px rgba(120, 160, 255, 0.35));
}
html[data-theme="night"] body.theme-bright .sky-sun img {
  filter: hue-rotate(186deg) saturate(0.32) brightness(1.04);
}
html[data-theme="night"] body.theme-bright .cloud {
  opacity: 0.7;
}
html[data-theme="night"] body.theme-bright .hero__eyebrow {
  color: var(--redstone-2);
}
html[data-theme="night"] body.theme-bright .hero__eyebrow .dot {
  background: var(--redstone);
  box-shadow: 0 0 0 3px rgba(255, 90, 69, 0.2), 0 0 12px var(--redstone-glow);
}
html[data-theme="night"] body.theme-bright .hero__lead {
  color: var(--text-2);
}
html[data-theme="night"] body.theme-bright .hero__lead strong {
  color: var(--ink);
}
html[data-theme="night"] body.theme-bright .hero__meta {
  color: var(--text-2);
}
html[data-theme="night"] body.theme-bright .detail-hero {
  background: linear-gradient(180deg, #070c22 0%, #101838 54%, var(--bg) 100%);
}
html[data-theme="night"] body.theme-bright .detail-hero__bg {
  background:
    radial-gradient(ellipse 55% 60% at 78% 30%, rgba(150, 178, 255, 0.22), transparent 68%),
    radial-gradient(ellipse 40% 45% at 8% 0%, rgba(255, 150, 110, 0.14), transparent 70%);
}
/* 白天的云图在夜里太亮，压下去当剪影用 */
html[data-theme="night"] body.theme-bright .detail-hero__bg::before {
  opacity: 0.16;
  filter: brightness(0.5) saturate(0.4);
}

/* =========================================================
   5. 卡片 / 面板：像素硬阴影换成「月光投影」
   ========================================================= */
html[data-theme="night"] body.theme-bright
  :is(
    .work-card,
    .log-row,
    .id-card,
    .feature,
    .method,
    .note,
    .zone-card,
    .tool-card,
    .version-card,
    .showcase,
    .person,
    .video,
    .toy,
    .contraption,
    .protocol-visual,
    .stat-strip,
    .auth-card,
    .mc-window,
    .gallery__item,
    .video-more__link,
    .hero-chip,
    .social,
    .redstone-note,
    .about-quote,
    .print,
    .device,
    .phone-shot,
    .auth-panel,
    .hero__stats
  ) {
  box-shadow: 5px 5px 0 rgba(238, 220, 190, 0.09), 0 24px 48px -30px rgba(0, 0, 0, 0.9);
}
html[data-theme="night"] body.theme-bright
  :is(
    .work-card:hover,
    .log-row:hover,
    .feature:hover,
    .zone-card:hover,
    .tool-card:hover,
    .version-card:hover,
    .person:hover,
    .toy:hover,
    .toy:focus-visible,
    .contraption:hover,
    .social:hover,
    .video-more__link:hover,
    .hero-chip:hover,
    .gallery__item:hover,
    .app-card:hover,
    .app-card:focus-within
  ) {
  box-shadow: 8px 8px 0 rgba(238, 220, 190, 0.13), 0 28px 54px -28px rgba(0, 0, 0, 0.95);
}
/* v2 的应用卡 & 筛选条 */
html[data-theme="night"] body.theme-bright .app-card {
  box-shadow: 3px 3px 0 rgba(238, 220, 190, 0.09), 0 22px 44px -30px rgba(0, 0, 0, 0.9);
}
html[data-theme="night"] body.theme-bright .filter-chip {
  box-shadow: 3px 3px 0 rgba(238, 220, 190, 0.1);
}
html[data-theme="night"] body.theme-bright .filter-chip:hover {
  box-shadow: 5px 5px 0 rgba(238, 220, 190, 0.14);
}
/* 红石横条：暗夜里就是一条通电的导轨 */
html[data-theme="night"] body.theme-bright .rs-bar {
  background: linear-gradient(180deg, #2a2438 0%, #191423 100%);
  border-color: var(--line-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 3px 3px 0 rgba(0, 0, 0, 0.5);
}
html[data-theme="night"] body.theme-bright .rs-bar__wire {
  box-shadow: 0 0 12px var(--redstone-glow);
}
html[data-theme="night"] body.theme-bright .rs-bar__label {
  color: #ffe2b8;
}

/* 按钮：保持硬朗的像素投影，暗底上换成更深的黑 */
html[data-theme="night"] body.theme-bright .btn {
  border-color: var(--ink);
  box-shadow: 0 5px 0 rgba(3, 5, 14, 0.9), 5px 5px 0 rgba(0, 0, 0, 0.45);
}
html[data-theme="night"] body.theme-bright .btn:hover {
  box-shadow: 0 7px 0 rgba(3, 5, 14, 0.9), 7px 7px 0 rgba(0, 0, 0, 0.45);
}
html[data-theme="night"] body.theme-bright .btn:active {
  box-shadow: 0 2px 0 rgba(3, 5, 14, 0.9), 2px 2px 0 rgba(0, 0, 0, 0.45);
}
html[data-theme="night"] body.theme-bright .btn--primary {
  background: linear-gradient(180deg, #cf3a2c, #a8271b 58%, #7a150e);
  color: #fff6f0;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
  box-shadow: 0 5px 0 #5e0f09, 5px 5px 0 rgba(0, 0, 0, 0.45),
    0 0 32px rgba(255, 90, 69, 0.4);
}
html[data-theme="night"] body.theme-bright .btn--primary:hover {
  box-shadow: 0 7px 0 #5e0f09, 7px 7px 0 rgba(0, 0, 0, 0.45),
    0 0 44px rgba(255, 90, 69, 0.55);
}
html[data-theme="night"] body.theme-bright .btn--ghost {
  background: var(--paper);
  border-color: var(--ink);
  color: var(--ink);
}
html[data-theme="night"] body.theme-bright .btn--ghost:hover {
  background: var(--surface-2);
}

/* =========================================================
   6. 文字配色校正：把为浅底准备的深色字换成夜色版
   ========================================================= */
/* 6.1 暖棕色小字（原 #8a745c / #8a6a3a / #a08a70 / #b9a58a / #6b563f） */
html[data-theme="night"] body.theme-bright
  :is(
    .work-card__tags li,
    .work-card__foot,
    .id-card__row,
    .stat-strip dd span,
    .zone-card__body span,
    .tool-card__spec li,
    .source-item__desc,
    .source-item__off,
    .muted-line,
    .showcase__cap,
    .protocol-visual__foot,
    .contraption__parts span,
    .work-card__by,
    .detail-byline,
    .person__nolink,
    .team__note,
    .video__meta,
    .video__tags span
  ) {
  color: var(--text-3);
}
html[data-theme="night"] body.theme-bright
  :is(
    .brand__en,
    .mobile-menu__link span,
    .id-card__name span,
    .meta-list dt,
    .stat-strip dt,
    .spec__row dt,
    .next-link span
  ) {
  color: var(--text-3);
}
html[data-theme="night"] body.theme-bright
  :is(.filter span, .work-card__title span, .tool-card__title span, .work-card__by span, .detail-byline span) {
  color: var(--text-3);
}
html[data-theme="night"] body.theme-bright .hero__meta {
  color: var(--text-2);
}

/* 6.2 琥珀 / 金色小字（原 #a26000 / #c47a00 / #d97706 / #e5a00f） */
html[data-theme="night"] body.theme-bright
  :is(
    .eyebrow,
    .log-row__date,
    .skills__label,
    .detail-title__en,
    .meta-list dd a,
    .version-card__dl,
    .note code,
    .contraption__num,
    .person__role
  ) {
  color: #ffc46b;
}
html[data-theme="night"] body.theme-bright
  :is(
    .link-arrow:hover,
    .back-link:hover,
    .log-row:hover h3,
    .method__num,
    .feature__num,
    .feature:hover h3,
    .version-card__dl:hover,
    .source-item__idx,
    .protocol-step__num,
    .next-link:hover h3,
    .detail-byline a:hover,
    .byline-link:hover
  ) {
  color: #ffb347;
}
html[data-theme="night"] body.theme-bright
  :is(.sec-title em, .split__statement em, .cta-band h2 em, .hero__title em, .hero__title em::after) {
  color: var(--redstone);
}
html[data-theme="night"] body.theme-bright .stat:nth-child(1) .stat__num {
  color: var(--redstone);
}
html[data-theme="night"] body.theme-bright .stat:nth-child(2) .stat__num {
  color: #6ee39a;
}
html[data-theme="night"] body.theme-bright .stat:nth-child(3) .stat__num,
html[data-theme="night"] body.theme-bright .stat:nth-child(4) .stat__num {
  color: #ffcd63;
}

/* 6.3 深红小字（原 #9e241a / #b4392c） */
html[data-theme="night"] body.theme-bright
  :is(.detail-byline a, .byline-link, .video-more__arrow, .toy__num, .toy:hover .toy__go, .toy:focus-visible .toy__go, .video__kicker) {
  color: var(--redstone-2);
}

/* 6.4 蓝色系小字（协议 / 登录面板里的原文 #2c6f9e / #1f6f9e ...） */
html[data-theme="night"] body.theme-bright
  :is(
    .auth-hint,
    .devlog__aside .link-arrow,
    .auth-card__head .mono,
    .protocol-visual__head .mono,
    .code-block .k,
    .auth-panel__head .lock,
    .auth-step b,
    .protocol-step code,
    .protocol-visual__head .lock,
    .protocol-visual .auth-node,
    .protocol-visual .auth-line__tag,
    .auth-ver,
    .auth-card__foot,
    .auth-panel__title span,
    .auth-panel__foot,
    .protocol-msgs .c,
    .code-block .c,
    .social--ghost,
    .video__go,
    .auth-ribbon,
    .mc-view__cap,
    .mc-window__title,
    .mc-window__tabs b,
    .auth-panel__row,
    .auth-step
  ) {
  color: #8fd0f5;
}

/* 6.5 绿色系小字 / 代码（原 #1d7a3a / #146c3a） */
html[data-theme="night"] body.theme-bright
  :is(
    .mc-cmd code,
    .feature p code,
    .version-note code,
    .tool-card__art .cmd-line code,
    .tool-card p code,
    .code-block .s,
    .auth-panel__ok,
    .mc-window__tabs b.on
  ) {
  color: #7de6a6;
}

/* 6.6 紫色系小字（原 #6a5a8a / #5d4b86 / #4b32a8） */
html[data-theme="night"] body.theme-bright :is(.vb-label, .art--vb .vb-label, .tag--mod) {
  color: #c3b2ff;
}
html[data-theme="night"] body.theme-bright :is(.vb-state, .art--vb .vb-state) {
  color: #b9a8ff;
}

/* =========================================================
   7. 各类浅色块：改成夜色面板
   ========================================================= */
html[data-theme="night"] body.theme-bright .devlog {
  background: #0d1430;
  border-color: var(--line-2);
}
html[data-theme="night"] body.theme-bright .log-row {
  background: var(--paper);
  border-color: var(--line);
}
html[data-theme="night"] body.theme-bright .log-row:hover {
  background: var(--surface-2);
  border-color: var(--line-2);
}
html[data-theme="night"] body.theme-bright :is(.note, .redstone-note, .about-quote, .next-link:hover) {
  background: #141c3c;
}
html[data-theme="night"] body.theme-bright .redstone {
  background: linear-gradient(180deg, #0a0f24, #121a3a);
  border-bottom-color: var(--line-2);
}
html[data-theme="night"] body.theme-bright .team-section {
  background: #0c1228;
}
html[data-theme="night"] body.theme-bright :is(.tool-card__spec li, .version-card__java, .contraption__parts span) {
  background: #141d3c;
}
html[data-theme="night"] body.theme-bright :is(.feature p code, .version-note code, .tool-card p code) {
  background: rgba(80, 220, 140, 0.12);
  border-color: rgba(125, 230, 166, 0.35);
}
html[data-theme="night"] body.theme-bright :is(.protocol-step code, .protocol-visual__head .lock, .auth-panel__head .lock, .protocol-visual .auth-node) {
  background: #0e1c36;
  border-color: rgba(143, 208, 245, 0.32);
}
html[data-theme="night"] body.theme-bright :is(.code-block, .protocol-msgs) {
  background: #0a1226;
  border-color: var(--line-2);
}
html[data-theme="night"] body.theme-bright .auth-panel__ok {
  background: rgba(88, 217, 138, 0.14);
  border-color: rgba(125, 230, 166, 0.45);
}
html[data-theme="night"] body.theme-bright .mc-window__bar {
  background: #0e1c30;
}
html[data-theme="night"] body.theme-bright .mc-window__tabs b.on {
  background: rgba(88, 217, 138, 0.16);
  border-color: rgba(125, 230, 166, 0.5);
}
html[data-theme="night"] body.theme-bright .mc-cmd {
  background: #0a1424;
}
html[data-theme="night"] body.theme-bright .person__avatar {
  background: #1a2346;
}
/* v2 应用卡的点缀块 */
html[data-theme="night"] body.theme-bright .app-card__tags > span,
html[data-theme="night"] body.theme-bright .app-card__tags li {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text-2);
}
html[data-theme="night"] body.theme-bright .app-card__badge {
  background: var(--paper);
  border-color: var(--line-2);
  color: var(--ink);
}
html[data-theme="night"] body.theme-bright .app-card__badge--game {
  background: var(--gold);
  border-color: #8a5c05;
  color: #2b1c00;
}
html[data-theme="night"] body.theme-bright .app-card__badge--tool {
  background: #8fd0f5;
  border-color: #2b6f95;
  color: #062332;
}
html[data-theme="night"] body.theme-bright .app-card__icon {
  background: var(--surface-2);
  border-color: var(--line-2);
}

/* 整段浅色区块：影像区是唯一自带底色的 section */
html[data-theme="night"] body.theme-bright .videos {
  background:
    radial-gradient(900px 460px at 82% -8%, rgba(255, 150, 90, 0.13), transparent 62%),
    linear-gradient(180deg, #0a1024 0%, #0c1430 100%);
  border-top-color: var(--line-2);
  border-bottom-color: var(--line-2);
}
html[data-theme="night"] body.theme-bright .work::before {
  background: radial-gradient(ellipse 55% 38% at 25% 0%, rgba(255, 120, 80, 0.1), transparent 70%);
}
html[data-theme="night"] body.theme-bright :is(.video__tags span, .protocol-visual .auth-line__tag) {
  background: var(--surface-2);
  border-color: var(--line);
}
html[data-theme="night"] body.theme-bright
  :is(.toy:hover, .toy:focus-visible, .hero-chip:hover, .video-more__link:hover, .next-link:hover) {
  background: var(--surface-3);
}
html[data-theme="night"] body.theme-bright .hero-chip__num {
  border-color: #7d5205;
  color: #2b1c00;
}

/* 作品插图 / 设备框：浅粉彩一律换成「夜色玻璃」，文字仍按夜色配色 */
html[data-theme="night"] body.theme-bright :is(.device, .phone-shot) {
  background: linear-gradient(160deg, #1c2547, #0f1731);
  border-color: var(--line-2);
}
html[data-theme="night"] body.theme-bright :is(.visual--mc, .art--mc) {
  background: linear-gradient(160deg, #14261f, #0c1714);
  border-color: var(--line-2);
}
html[data-theme="night"] body.theme-bright :is(.visual--vb, .art--vb) {
  background: linear-gradient(160deg, #1f1a3e, #14112b);
  border-color: var(--line-2);
}
html[data-theme="night"] body.theme-bright :is(.visual--auth, .art--auth) {
  background: linear-gradient(160deg, #10203c, #0a1526);
  border-color: var(--line-2);
}
html[data-theme="night"] body.theme-bright .tool-card__art {
  background: linear-gradient(160deg, #14261f, #0d1a16);
}
html[data-theme="night"] body.theme-bright :is(.visual--mc .slime-grid, .tool-card__art .slime-grid) {
  background: #16241f;
}
html[data-theme="night"] body.theme-bright .mc-window__dots i {
  background: #2f4a3c;
}
html[data-theme="night"] body.theme-bright .person__glyph {
  background: linear-gradient(160deg, #f0c16a, #d98b1b);
  box-shadow: 0 0 0 3px rgba(255, 235, 200, 0.14);
}

/* 小标签：暗底上做成「彩色描边的玻璃贴纸」 */
html[data-theme="night"] body.theme-bright .tag--game {
  background: rgba(255, 212, 92, 0.14);
  border-color: rgba(255, 212, 92, 0.5);
  color: #ffd97a;
}
html[data-theme="night"] body.theme-bright .tag--tool {
  background: rgba(88, 217, 138, 0.14);
  border-color: rgba(125, 230, 166, 0.5);
  color: #86e9ab;
}
html[data-theme="night"] body.theme-bright .tag--mod {
  background: rgba(179, 160, 255, 0.14);
  border-color: rgba(179, 160, 255, 0.5);
}
html[data-theme="night"] body.theme-bright .filter {
  background: var(--surface);
  border-color: var(--line-2);
  color: var(--ink-soft);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45);
}
html[data-theme="night"] body.theme-bright .filter:hover {
  color: var(--ink);
  border-color: var(--ink);
}
html[data-theme="night"] body.theme-bright .filter.is-active {
  background: #cf3a2c;
  border-color: #f0917f;
  color: #fff6f0;
  box-shadow: 0 3px 0 #5e0f09, 0 0 22px var(--redstone-glow);
}
html[data-theme="night"] body.theme-bright .filter.is-active span {
  color: rgba(255, 246, 240, 0.75);
}
html[data-theme="night"] body.theme-bright .filter-chip {
  background: var(--surface);
  border-color: var(--line-2);
  color: var(--ink-soft);
}
html[data-theme="night"] body.theme-bright .filter-chip[aria-pressed="true"] {
  background: #cf3a2c;
  border-color: #f0917f;
  color: #fff6f0;
  box-shadow: 0 0 22px var(--redstone-glow);
}
html[data-theme="night"] body.theme-bright .filter-chip--jump .filter-chip__num {
  color: var(--redstone-2);
}
/* 金色底上的深字：夜里改深色，别用奶油白 */
html[data-theme="night"] body.theme-bright .marquee__item b {
  color: var(--gold);
}
html[data-theme="night"] body.theme-bright .work-card:hover .work-card__foot .arrow,
html[data-theme="night"] body.theme-bright .log-row:hover .log-row__arrow {
  background: var(--gold);
  border-color: var(--gold);
  color: #2b1c00;
}
html[data-theme="night"] body.theme-bright .video__badge {
  background: var(--gold);
  border-color: #7d5205;
  color: #2b1c00;
}
html[data-theme="night"] body.theme-bright .mc-window__tabs b.on {
  color: #86e9ab;
}

/* =========================================================
   8. 图片：暗色下轻微压暗 + 提对比，保留像素观感
   ========================================================= */
html[data-theme="night"] body.theme-bright
  :is(.bm-bg, .gallery__item img, .showcase img, .contraption__art img, .person__avatar) {
  filter: brightness(0.86) contrast(1.12) saturate(1.04);
}
html[data-theme="night"] body.theme-bright .app-card__cover img {
  filter: brightness(0.72) contrast(1.06) saturate(0.94);
}
/* 白底截图在夜里像块灯板：压暗之后再蒙一层夜色，仍然看得清内容 */
html[data-theme="night"] body.theme-bright .app-card__cover::after {
  background:
    linear-gradient(180deg, rgba(10, 16, 40, 0.38) 0%, rgba(10, 16, 40, 0.16) 48%, rgba(4, 8, 20, 0.6) 100%);
}
html[data-theme="night"] body.theme-bright .video__cover {
  filter: brightness(0.78) contrast(1.12) saturate(1.02);
}
html[data-theme="night"] body.theme-bright .video:hover .video__cover,
html[data-theme="night"] body.theme-bright .video:focus-visible .video__cover {
  filter: brightness(0.88) contrast(1.1) saturate(1.08);
}
html[data-theme="night"] body.theme-bright .app-card:hover .app-card__cover img {
  filter: brightness(0.82) contrast(1.06) saturate(0.98);
}
html[data-theme="night"] body.theme-bright .video__shade {
  background:
    linear-gradient(180deg, rgba(120, 150, 255, 0.1) 0%, rgba(60, 80, 160, 0.06) 52%, rgba(4, 6, 16, 0.5) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.28) 0%, transparent 36%, transparent 56%, rgba(2, 3, 8, 0.62) 100%);
}
html[data-theme="night"] body.theme-bright .lightbox {
  background: rgba(3, 5, 12, 0.96);
}
html[data-theme="night"] body.theme-bright .lightbox__img {
  filter: brightness(0.94) contrast(1.06);
}
html[data-theme="night"] body.theme-bright .id-card__corner {
  border-color: rgba(255, 212, 92, 0.55);
}

/* =========================================================
   9. 红石：灯要亮、粉要发光
   ========================================================= */
html[data-theme="night"] body.theme-bright .redstone-bus {
  background: #232838;
  border-block-color: var(--line-2);
}
html[data-theme="night"] body.theme-bright .bus-node {
  background: #2a3145;
  border-color: var(--line-2);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.5);
}
html[data-theme="night"] body.theme-bright .bus-node--lamp {
  background: radial-gradient(circle at 50% 42%, #fff6cf, #ffcb4d 58%, #ff8f2e 100%);
  border-color: #ffd97a;
  box-shadow: 0 0 18px 4px rgba(255, 196, 90, 0.55), 0 0 52px 16px rgba(255, 140, 60, 0.3);
}
html[data-theme="night"] body.theme-bright .rs-bar__lamp {
  box-shadow: 0 0 14px var(--gold), 0 0 34px rgba(255, 212, 92, 0.45), inset 0 0 3px #fff;
}
html[data-theme="night"] body.theme-bright .redstone-note {
  border-left-color: var(--redstone);
  border-color: var(--line-2);
  border-left-color: var(--redstone);
}
html[data-theme="night"] body.theme-bright .redstone-note img {
  filter: drop-shadow(0 0 10px var(--redstone-glow)) brightness(1.15);
}
html[data-theme="night"] body.theme-bright .float-component {
  filter: drop-shadow(3px 3px 0 rgba(0, 0, 0, 0.45)) drop-shadow(0 0 10px rgba(255, 90, 69, 0.35));
}
html[data-theme="night"] body.theme-bright .contraption__art img {
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5), 0 0 18px rgba(255, 90, 69, 0.22);
}
html[data-theme="night"] body.theme-bright .bus-node img,
html[data-theme="night"] body.theme-bright .eyebrow::before {
  filter: drop-shadow(0 0 8px rgba(255, 110, 80, 0.6)) brightness(1.1);
}

/* =========================================================
   10. CTA 与页脚：换成夜里的草地 / 更深的泥土
   ========================================================= */
html[data-theme="night"] body.theme-bright .cta-band {
  background: #1d3323;
  border-top-color: var(--line-2);
}
html[data-theme="night"] body.theme-bright .cta-band::after {
  filter: brightness(0.5) saturate(0.75);
  border-top-color: rgba(0, 0, 0, 0.45);
}
html[data-theme="night"] body.theme-bright .cta-band__inner {
  background: var(--paper);
  border-color: var(--line-2);
  box-shadow: 8px 8px 0 rgba(238, 220, 190, 0.08), 0 30px 60px -34px rgba(0, 0, 0, 0.95);
}
html[data-theme="night"] body.theme-bright .cta-band h2 {
  color: var(--ink);
}
html[data-theme="night"] body.theme-bright .cta-band p {
  color: var(--ink-soft);
}
html[data-theme="night"] body.theme-bright .site-footer {
  background-color: #0a0e18;
  background-blend-mode: multiply;
  border-top-color: var(--line-2);
  color: #e8dcc6;
}
html[data-theme="night"] body.theme-bright .site-footer::before {
  filter: brightness(0.45) saturate(0.7);
  border-bottom-color: rgba(0, 0, 0, 0.5);
}
html[data-theme="night"] body.theme-bright .footer__brand strong {
  color: #f8efdf;
}
html[data-theme="night"] body.theme-bright .footer__brand span {
  color: #ffd08a;
}
html[data-theme="night"] body.theme-bright .footer__nav a {
  color: #e8d6b4;
}
html[data-theme="night"] body.theme-bright .footer__nav a:hover {
  color: #fff;
}
html[data-theme="night"] body.theme-bright .footer__wordmark {
  -webkit-text-stroke: 2px rgba(255, 235, 200, 0.22);
}
html[data-theme="night"] body.theme-bright .footer__bottom {
  border-top-color: rgba(255, 235, 200, 0.2);
  color: rgba(255, 235, 200, 0.68);
}
html[data-theme="night"] body.theme-bright .footer__bottom a {
  color: #ffd08a;
}

/* 移动端菜单 */
html[data-theme="night"] body.theme-bright .mobile-menu {
  background: rgba(9, 13, 28, 0.98);
  border-left-color: var(--line-2);
}
html[data-theme="night"] body.theme-bright .mobile-menu__link {
  color: var(--ink);
  border-bottom-color: var(--line-2);
}
html[data-theme="night"] body.theme-bright .mobile-menu__foot {
  color: var(--text-3);
}
html[data-theme="night"] body.theme-bright .page-veil {
  background: var(--bg);
}

/* =========================================================
   11. 主题开关按钮 .theme-toggle
   （按钮 markup 由页面提供：<button class="theme-toggle" id="theme-toggle">
     内含 .theme-toggle__sun / .theme-toggle__moon 两个 svg）
   ========================================================= */
body .theme-toggle {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 11px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(43, 33, 25, 0.16);
  transition: transform 0.32s var(--ease), box-shadow 0.32s var(--ease),
    background 0.32s var(--ease), border-color 0.32s var(--ease),
    color 0.32s var(--ease);
}
body .theme-toggle svg {
  width: 19px;
  height: 19px;
}
/* 白天显示太阳、夜里显示月亮：四个方向都写死，避免和上面的 svg 规则打架 */
html[data-theme="day"] body .theme-toggle__moon,
html[data-theme="night"] body .theme-toggle__sun,
html:not([data-theme]) body .theme-toggle__moon {
  display: none;
}
html[data-theme="day"] body .theme-toggle__sun,
html[data-theme="night"] body .theme-toggle__moon {
  display: block;
}
/* 从无到有出现的那一刻转一下，像换个天 */
@keyframes ns-toggle-icon {
  from {
    opacity: 0;
    transform: rotate(-40deg) scale(0.62);
  }
  to {
    opacity: 1;
    transform: rotate(0) scale(1);
  }
}
html[data-theme="night"] body .theme-toggle__moon,
html[data-theme="day"] body .theme-toggle__sun {
  animation: ns-toggle-icon 0.52s var(--ease) both;
}
body .theme-toggle:hover {
  transform: translate(-2px, -2px);
  border-color: var(--redstone);
  color: var(--redstone);
  box-shadow: 4px 4px 0 rgba(43, 33, 25, 0.2), 0 0 18px var(--redstone-glow);
}
body .theme-toggle:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 rgba(43, 33, 25, 0.24);
}
body .theme-toggle:focus-visible {
  outline: 3px solid var(--redstone-2);
  outline-offset: 3px;
  border-radius: 11px;
}
html[data-theme="night"] body .theme-toggle {
  border-color: var(--line-2);
  background: rgba(255, 255, 255, 0.05);
  color: #cfe0ff;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.55);
}
html[data-theme="night"] body .theme-toggle:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(255, 212, 92, 0.1);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.55), 0 0 20px rgba(255, 212, 92, 0.35);
}
html[data-theme="night"] body .theme-toggle:focus-visible {
  outline-color: var(--gold);
}
html[data-theme="day"] body .theme-toggle {
  color: #c47a00;
}
html[data-theme="day"] body .theme-toggle:hover {
  color: var(--redstone);
}

/* =========================================================
   12. 昼夜过渡：「天空翻页」
   ---------------------------------------------------------
   night.js 动态插入、用完即删：
     .theme-nightshift.ns-to-night | .ns-to-day
       .ns__scene              一整页新天空，靠 clip-path 擦进来
         .ns__stars            星星：淡入 + 轻微闪烁
         .ns__orb--sun         太阳下沉 / 升起
         .ns__orb--moon        月亮升起 / 落下
         ::before              地平线霞光
         ::after               地面剪影：挡住落到地平线以下的太阳
       .ns__edge               翻页那道亮边
   ========================================================= */
.theme-nightshift {
  --ns-dur: 1200ms; /* 与 night.js 的 DURATION 保持一致 */
  --ns-orb: clamp(56px, 7.2vw, 104px);
  --ns-wipe: cubic-bezier(0.45, 0.05, 0.55, 0.95); /* 慢起、中段走完、稳稳收住，像真的翻一页 */

  position: fixed;
  inset: 0;
  z-index: 9000; /* 站点最高的是 .skip-link 的 999 */
  overflow: hidden;
  pointer-events: none;
  isolation: isolate;
  opacity: 0;
  -webkit-user-select: none;
  user-select: none;
  animation: ns-layer var(--ns-dur) linear forwards;
}

@keyframes ns-layer {
  0% {
    opacity: 0;
  }
  6% {
    opacity: 1;
  }
  74% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* ---------- 12.1 天空：一整页被「翻」进来 ---------- */
.ns__scene {
  position: absolute;
  inset: 0;
  z-index: 1;
  will-change: clip-path;
}

.ns-to-night .ns__scene {
  background:
    radial-gradient(120% 58% at 64% 104%, rgba(255, 152, 80, 0.42) 0%, transparent 62%),
    radial-gradient(90% 48% at 16% 96%, rgba(122, 74, 160, 0.38) 0%, transparent 70%),
    linear-gradient(
      180deg,
      #05071a 0%,
      #080e2c 18%,
      #101641 36%,
      #1d1950 52%,
      #38204f 63%,
      #6b2f49 71%,
      #a2473c 78%,
      #d5693c 83%,
      #8b4a28 88%,
      #1a1626 100%
    );
  clip-path: inset(0 0 100% 0);
  animation: ns-sweep-down var(--ns-dur) var(--ns-wipe) forwards;
}

.ns-to-day .ns__scene {
  background:
    radial-gradient(110% 58% at 42% 104%, rgba(255, 228, 152, 0.6) 0%, transparent 62%),
    radial-gradient(80% 46% at 86% 6%, rgba(120, 190, 255, 0.45), transparent 70%),
    linear-gradient(
      180deg,
      #2f8fe0 0%,
      #57b2ec 20%,
      #8fd2f7 40%,
      #c6e9fc 58%,
      #ffeab8 74%,
      #ffd98e 82%,
      #fff0cc 89%,
      #efd2a0 100%
    );
  clip-path: inset(100% 0 0 0);
  animation: ns-sweep-up var(--ns-dur) var(--ns-wipe) forwards;
}

/* 夜晚从上面压下来；白天从地平线顶上来 */
@keyframes ns-sweep-down {
  0% {
    clip-path: inset(0 0 100% 0);
  }
  62% {
    clip-path: inset(0 0 0 0);
  }
  100% {
    clip-path: inset(0 0 0 0);
  }
}
@keyframes ns-sweep-up {
  0% {
    clip-path: inset(100% 0 0 0);
  }
  62% {
    clip-path: inset(0 0 0 0);
  }
  100% {
    clip-path: inset(0 0 0 0);
  }
}

/* ---------- 12.2 地平线霞光 ---------- */
.ns__scene::before {
  content: "";
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: 12%;
  height: 34%;
  border-radius: 50%;
  filter: blur(26px);
  opacity: 0;
  animation: ns-horizon var(--ns-dur) ease-out forwards;
}
.ns-to-night .ns__scene::before {
  background: radial-gradient(
    ellipse 60% 50% at 50% 50%,
    rgba(255, 196, 120, 0.85),
    rgba(255, 120, 80, 0.45) 42%,
    transparent 72%
  );
}
.ns-to-day .ns__scene::before {
  background: radial-gradient(
    ellipse 60% 50% at 50% 50%,
    rgba(255, 246, 214, 0.95),
    rgba(255, 214, 140, 0.5) 42%,
    transparent 72%
  );
}
@keyframes ns-horizon {
  0% {
    opacity: 0;
  }
  26% {
    opacity: 0.35;
  }
  56% {
    opacity: 0.9;
  }
  100% {
    opacity: 0.55;
  }
}

/* ---------- 12.3 星星：淡入 + 轻微闪烁 ---------- */
.ns__stars {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0;
}
.ns-to-night .ns__stars {
  animation: ns-stars-in var(--ns-dur) ease-out forwards;
}
.ns-to-day .ns__stars {
  animation: ns-stars-out var(--ns-dur) ease-in forwards;
}
@keyframes ns-stars-in {
  0%,
  22% {
    opacity: 0;
  }
  62% {
    opacity: 0.8;
  }
  100% {
    opacity: 0.95;
  }
}
@keyframes ns-stars-out {
  0% {
    opacity: 0.9;
  }
  38% {
    opacity: 0.25;
  }
  58%,
  100% {
    opacity: 0;
  }
}

.ns__stars::before,
.ns__stars::after {
  content: "";
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
}
/* 第一组：小而密 */
.ns__stars::before {
  background-image:
    radial-gradient(circle at 6% 12%, #fff 0 1.1px, transparent 1.9px),
    radial-gradient(circle at 14% 34%, #fff 0 1.3px, rgba(190, 214, 255, 0.5) 1.3px 2.4px, transparent 3.2px),
    radial-gradient(circle at 22% 8%, #fff 0 1px, transparent 1.8px),
    radial-gradient(circle at 31% 26%, #fff 0 1.2px, transparent 2px),
    radial-gradient(circle at 38% 52%, #fff 0 1px, transparent 1.7px),
    radial-gradient(circle at 44% 16%, #fff 0 1.4px, rgba(190, 214, 255, 0.45) 1.4px 2.6px, transparent 3.4px),
    radial-gradient(circle at 52% 38%, #fff 0 1px, transparent 1.8px),
    radial-gradient(circle at 58% 10%, #fff 0 1.2px, transparent 2px),
    radial-gradient(circle at 66% 30%, #fff 0 1px, transparent 1.7px),
    radial-gradient(circle at 72% 56%, #fff 0 1.3px, rgba(190, 214, 255, 0.5) 1.3px 2.4px, transparent 3.2px),
    radial-gradient(circle at 79% 18%, #fff 0 1px, transparent 1.8px),
    radial-gradient(circle at 86% 42%, #fff 0 1.2px, transparent 2px),
    radial-gradient(circle at 93% 12%, #fff 0 1px, transparent 1.7px),
    radial-gradient(circle at 97% 62%, #fff 0 1.1px, transparent 1.9px),
    radial-gradient(circle at 10% 62%, #fff 0 1px, transparent 1.8px),
    radial-gradient(circle at 27% 68%, #fff 0 1.2px, transparent 2px),
    radial-gradient(circle at 48% 64%, #fff 0 1px, transparent 1.7px),
    radial-gradient(circle at 62% 70%, #fff 0 1.1px, transparent 1.9px);
  animation: ns-twinkle-a 2.4s ease-in-out infinite;
}
/* 第二组：少、略大，错开相位才有「闪」的感觉 */
.ns__stars::after {
  background-image:
    radial-gradient(circle at 18% 20%, #fff 0 1.6px, rgba(200, 224, 255, 0.6) 1.6px 3.2px, transparent 4.2px),
    radial-gradient(circle at 35% 42%, #fff 0 1.5px, rgba(200, 224, 255, 0.5) 1.5px 3px, transparent 4px),
    radial-gradient(circle at 49% 22%, #fff 0 1.4px, rgba(200, 224, 255, 0.5) 1.4px 2.8px, transparent 3.8px),
    radial-gradient(circle at 63% 48%, #fff 0 1.6px, rgba(200, 224, 255, 0.55) 1.6px 3.2px, transparent 4.2px),
    radial-gradient(circle at 77% 34%, #fff 0 1.4px, rgba(200, 224, 255, 0.5) 1.4px 2.8px, transparent 3.8px),
    radial-gradient(circle at 89% 26%, #fff 0 1.5px, rgba(200, 224, 255, 0.5) 1.5px 3px, transparent 4px),
    radial-gradient(circle at 25% 52%, #fff 0 1.4px, rgba(200, 224, 255, 0.45) 1.4px 2.8px, transparent 3.8px),
    radial-gradient(circle at 55% 58%, #fff 0 1.5px, rgba(200, 224, 255, 0.45) 1.5px 3px, transparent 4px),
    radial-gradient(circle at 83% 54%, #fff 0 1.4px, rgba(200, 224, 255, 0.5) 1.4px 2.8px, transparent 3.8px);
  animation: ns-twinkle-b 3.2s ease-in-out infinite;
}
@keyframes ns-twinkle-a {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}
@keyframes ns-twinkle-b {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

/* ---------- 12.4 太阳 / 月亮 ---------- */
.ns__orb {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  width: var(--ns-orb);
  height: var(--ns-orb);
  margin-left: calc(var(--ns-orb) / -2);
  margin-top: calc(var(--ns-orb) / -2);
  border-radius: 50%;
  opacity: 0;
  will-change: transform, opacity;
}

.ns__orb--sun {
  background: radial-gradient(
    circle at 50% 48%,
    #fffdf2 0%,
    #ffeaa6 46%,
    #ffc24a 74%,
    #ff9a34 92%,
    #ff7a22 100%
  );
  box-shadow: 0 0 40px 8px rgba(255, 214, 120, 0.6), 0 0 130px 46px rgba(255, 150, 70, 0.34),
    inset -6px -8px 18px rgba(255, 122, 40, 0.4);
}

.ns__orb--moon {
  background: radial-gradient(
    circle at 36% 32%,
    #ffffff 0%,
    #f2f5ff 28%,
    #d2daf6 64%,
    #a9b6e2 100%
  );
  box-shadow: 0 0 34px 6px rgba(196, 214, 255, 0.55), 0 0 120px 40px rgba(120, 150, 255, 0.3),
    inset -6px -8px 16px rgba(120, 140, 200, 0.35);
}
/* 环形山：几个淡淡的圆斑 */
.ns__orb--moon::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 62%, rgba(126, 146, 195, 0.4) 0 9%, transparent 10%),
    radial-gradient(circle at 62% 38%, rgba(126, 146, 195, 0.32) 0 6%, transparent 7%),
    radial-gradient(circle at 56% 72%, rgba(126, 146, 195, 0.26) 0 4.5%, transparent 5.5%),
    radial-gradient(circle at 44% 40%, rgba(126, 146, 195, 0.22) 0 3.5%, transparent 4.5%);
}

/* 日落：高悬 → 划过 → 沉到地平线以下（被地面剪影挡住） */
.ns-to-night .ns__orb--sun {
  animation: ns-sun-set var(--ns-dur) cubic-bezier(0.42, 0, 0.6, 1) forwards;
}
@keyframes ns-sun-set {
  0% {
    opacity: 0;
    transform: translate3d(20vw, 14vh, 0) scale(0.8);
  }
  8% {
    opacity: 1;
  }
  46% {
    transform: translate3d(46vw, 40vh, 0) scale(1);
  }
  62% {
    transform: translate3d(56vw, 60vh, 0) scale(1.06);
  }
  100% {
    opacity: 1;
    transform: translate3d(68vw, 88vh, 0) scale(1.12);
  }
}

/* 月出：太阳沉下去之后，月亮从地面后面升上来 */
.ns-to-night .ns__orb--moon {
  animation: ns-moon-rise var(--ns-dur) cubic-bezier(0.35, 0, 0.55, 1) forwards;
}
@keyframes ns-moon-rise {
  0%,
  40% {
    opacity: 0;
    transform: translate3d(22vw, 94vh, 0) scale(0.76);
  }
  50% {
    opacity: 1;
    transform: translate3d(21vw, 88vh, 0) scale(0.82);
  }
  74% {
    transform: translate3d(20vw, 64vh, 0) scale(0.94);
  }
  100% {
    opacity: 1;
    transform: translate3d(19vw, 46vh, 0) scale(1);
  }
}

/* 天亮：月亮落下去，太阳顶上来 */
.ns-to-day .ns__orb--moon {
  animation: ns-moon-set var(--ns-dur) cubic-bezier(0.42, 0, 0.6, 1) forwards;
}
@keyframes ns-moon-set {
  0% {
    opacity: 1;
    transform: translate3d(19vw, 28vh, 0) scale(1);
  }
  36% {
    transform: translate3d(20vw, 60vh, 0) scale(1.05);
  }
  48% {
    opacity: 1;
    transform: translate3d(21vw, 82vh, 0) scale(1.06);
  }
  56% {
    opacity: 0;
    transform: translate3d(22vw, 90vh, 0) scale(1.06);
  }
  100% {
    opacity: 0;
    transform: translate3d(22vw, 94vh, 0) scale(1);
  }
}
.ns-to-day .ns__orb--sun {
  animation: ns-sun-rise var(--ns-dur) cubic-bezier(0.3, 0, 0.5, 1) forwards;
}
@keyframes ns-sun-rise {
  0%,
  38% {
    opacity: 0;
    transform: translate3d(62vw, 98vh, 0) scale(0.78);
  }
  50% {
    opacity: 1;
    transform: translate3d(61vw, 82vh, 0) scale(0.9);
  }
  74% {
    transform: translate3d(59vw, 58vh, 0) scale(1);
  }
  100% {
    opacity: 1;
    transform: translate3d(56vw, 38vh, 0) scale(1.05);
  }
}

/* ---------- 12.5 地面剪影：压在所有天体之上 ---------- */
.ns__scene::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  height: 18%;
  animation: ns-ground var(--ns-dur) ease-out both;
}
.ns-to-night .ns__scene::after {
  background:
    linear-gradient(180deg, rgba(255, 178, 112, 0.55) 0 2px, transparent 2px),
    linear-gradient(180deg, #2a1c2b 0%, #150f1c 58%, #0b0810 100%);
}
.ns-to-day .ns__scene::after {
  background:
    linear-gradient(180deg, rgba(255, 246, 206, 0.75) 0 2px, transparent 2px),
    linear-gradient(180deg, #3a4a2b 0%, #26331e 58%, #161d12 100%);
}
@keyframes ns-ground {
  0% {
    opacity: 0;
    transform: translateY(8%);
  }
  40% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- 12.6 翻页的亮边：跟着 clip 边界走 ---------- */
.ns__edge {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 4;
  height: 3px;
  opacity: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.4) 8%,
    #ffffff 50%,
    rgba(255, 255, 255, 0.4) 92%,
    rgba(255, 255, 255, 0) 100%
  );
}
.ns-to-night .ns__edge {
  box-shadow: 0 0 26px 5px rgba(170, 200, 255, 0.8), 0 0 80px 22px rgba(96, 128, 230, 0.42);
  animation: ns-edge-down var(--ns-dur) var(--ns-wipe) forwards;
}
.ns-to-day .ns__edge {
  box-shadow: 0 0 26px 5px rgba(255, 232, 168, 0.9), 0 0 80px 22px rgba(255, 178, 90, 0.5);
  animation: ns-edge-up var(--ns-dur) var(--ns-wipe) forwards;
}
/* top 与 clip-path 用同一条缓动、同一段区间，亮边才会咬住边界 */
@keyframes ns-edge-down {
  0% {
    top: 0%;
    opacity: 0;
  }
  6% {
    opacity: 1;
  }
  56% {
    opacity: 1;
  }
  62% {
    top: 100%;
    opacity: 0;
  }
  100% {
    top: 100%;
    opacity: 0;
  }
}
@keyframes ns-edge-up {
  0% {
    top: 100%;
    opacity: 0;
  }
  6% {
    opacity: 1;
  }
  56% {
    opacity: 1;
  }
  62% {
    top: 0%;
    opacity: 0;
  }
  100% {
    top: 0%;
    opacity: 0;
  }
}

/* =========================================================
   13. 减少动效 / 打印
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  /* 过渡层根本不出现（night.js 也不会插它，这里是兜底） */
  .theme-nightshift {
    display: none;
  }
  html[data-theme="night"] body .theme-toggle__moon,
  html[data-theme="day"] body .theme-toggle__sun {
    animation: none;
  }
  body .theme-toggle {
    transition: none;
  }
  html[data-theme="night"] body.theme-bright .rs-bar__wire,
  html[data-theme="night"] body.theme-bright .rs-bar__lamp,
  html[data-theme="night"] body.theme-bright .bus-node--lamp {
    animation: none;
  }
}

@media print {
  .theme-nightshift {
    display: none;
  }
}

/* =========================================================
   14. 窄屏微调：过渡图元别跑出画面
   ========================================================= */
@media (max-width: 520px) {
  .theme-nightshift {
    --ns-orb: clamp(48px, 15vw, 72px);
  }
  body .theme-toggle {
    width: 38px;
    height: 38px;
  }
  body .theme-toggle svg {
    width: 17px;
    height: 17px;
  }
}
