/* ============================================================
   智读次元 ZD · Design System
   暗色为主，亮色可切；一切动效都包在 prefers-reduced-motion 里
   ============================================================ */

@layer tokens, reset, base, layout, components, pages, motion, utilities;

@layer tokens {
  :root {
    color-scheme: dark;

    --ink-0: #05070e;
    --ink-1: #080b15;
    --ink-2: #0d1120;
    --ink-3: #121729;
    --ink-4: #1a2138;
    --line: #232b46;
    --line-soft: #1a2136;

    --text: #e9eef9;
    --text-2: #b8c2d8;
    --muted: #7f8aa3;

    --accent: #46e6c8;
    --accent-2: #4aa8ff;
    --gold: #f5c56b;
    --rose: #ff7f9e;
    --violet: #a78bfa;
    --on-accent: #04120f;
    --danger: #ff6b6b;

    --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
    --gold-soft: color-mix(in srgb, var(--gold) 15%, transparent);
    --rose-soft: color-mix(in srgb, var(--rose) 14%, transparent);

    --radius-xs: 8px;
    --radius-sm: 12px;
    --radius: 18px;
    --radius-lg: 26px;
    --radius-pill: 999px;

    --shadow-1: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px -12px rgb(0 0 0 / .6);
    --shadow-2: 0 24px 60px -28px rgb(0 0 0 / .85);

    --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-serif: "Songti SC", "Source Han Serif SC", "Noto Serif SC", "STSong", Georgia, serif;
    --font-mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, monospace;

    --max: 1280px;
    --gutter: clamp(16px, 4vw, 40px);
    --header-h: 64px;

    --ease: cubic-bezier(.2, .7, .2, 1);
    --ease-out: cubic-bezier(.16, 1, .3, 1);

    --tracking-wide: .18em;
  }

  [data-theme="light"] {
    color-scheme: light;
    --ink-0: #f7f3ec;
    --ink-1: #fcf9f4;
    --ink-2: #ffffff;
    --ink-3: #f3ede3;
    --ink-4: #e9e0d1;
    --line: #e2d8c8;
    --line-soft: #ece4d7;
    --text: #221d1a;
    --text-2: #4a423b;
    --muted: #857a6e;
    --accent: #c94f74;
    --accent-2: #7a5cff;
    --gold: #a9762f;
    --rose: #d94f7a;
    --violet: #7a5cff;
    --on-accent: #ffffff;
    --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
    --gold-soft: color-mix(in srgb, var(--gold) 14%, transparent);
    --rose-soft: color-mix(in srgb, var(--rose) 12%, transparent);
    --shadow-1: 0 1px 2px rgb(40 30 20 / .06), 0 10px 26px -18px rgb(40 30 20 / .35);
    --shadow-2: 0 30px 70px -40px rgb(40 30 20 / .55);
  }
}

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
  body {
    margin: 0;
    min-height: 100svh;
    background: var(--ink-0);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
  }
  img, svg, video { display: block; max-width: 100%; }
  button, input, select, textarea { font: inherit; color: inherit; }
  button { cursor: pointer; background: none; border: 0; padding: 0; }
  a { color: inherit; text-decoration: none; }
  h1, h2, h3, h4, p, dl, dd, ul, ol, figure { margin: 0; }
  ul, ol { list-style: none; padding: 0; }
  :focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 6px;
  }
  ::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); color: var(--text); }
  [hidden] { display: none !important; }
  .sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
  }
}

@layer base {
  body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
      radial-gradient(1000px 620px at 12% -12%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 62%),
      radial-gradient(900px 620px at 96% 6%, color-mix(in srgb, var(--violet) 8%, transparent), transparent 60%),
      radial-gradient(900px 700px at 50% 110%, color-mix(in srgb, var(--accent-2) 6%, transparent), transparent 60%);
  }

  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--line) 80%, transparent);
    border-radius: 999px;
    border: 3px solid transparent;
    background-clip: content-box;
  }

  .display {
    font-family: var(--font-serif);
    font-weight: 600;
    letter-spacing: .01em;
    line-height: 1.12;
  }
  .kicker {
    font-size: 11px;
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
  }
  .num { font-variant-numeric: tabular-nums; }
  .muted { color: var(--muted); }
  .accent { color: var(--accent); }
  .gold { color: var(--gold); }
  .rose { color: var(--rose); }
  .serif { font-family: var(--font-serif); }
  .mono { font-family: var(--font-mono); }
}

@layer layout {
  .shell { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
  .page { padding-block: clamp(24px, 4vw, 48px) 96px; }
  .page-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 28px; }
  .page-head h1 { font-family: var(--font-serif); font-size: clamp(28px, 4.4vw, 46px); line-height: 1.08; }
  .page-head p { color: var(--muted); max-width: 62ch; margin-top: 10px; }
  .stack { display: grid; gap: 12px; }
  .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
  .grid { display: grid; gap: clamp(14px, 2vw, 22px); }

  .section { padding-block: clamp(32px, 5vw, 64px); }
  .section + .section { padding-top: 0; }
  .section-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; margin-bottom: 22px; flex-wrap: wrap;
  }
  .section-head h2 {
    font-family: var(--font-serif);
    font-size: clamp(22px, 2.6vw, 32px);
    line-height: 1.2;
    display: flex; align-items: baseline; gap: 12px;
  }
  .section-head h2 small { font-family: var(--font-sans); font-size: 12px; letter-spacing: var(--tracking-wide); color: var(--muted); font-weight: 500; }
  .section-head .more { color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
  .section-head .more:hover { color: var(--accent); }

  .card-grid { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
  @media (min-width: 1024px) { .card-grid { grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); } }
}

@layer components {
  /* ---------- header ---------- */
  .site-header {
    position: sticky; top: 0; z-index: 60;
    height: var(--header-h);
    backdrop-filter: blur(18px) saturate(1.3);
    background: color-mix(in srgb, var(--ink-0) 78%, transparent);
    border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
  }
  .site-header .inner { height: 100%; display: flex; align-items: center; gap: 20px; }
  .brand { display: inline-flex; align-items: center; gap: 10px; flex: none; }
  .brand-mark {
    width: 34px; height: 34px; border-radius: 11px;
    background: linear-gradient(145deg, var(--accent) 0%, var(--accent-2) 58%, var(--violet) 100%);
    display: grid; place-items: center;
    color: var(--on-accent); font-family: var(--font-serif); font-weight: 700; font-size: 17px;
    box-shadow: 0 8px 22px -10px color-mix(in srgb, var(--accent) 65%, transparent);
  }
  .brand-mark svg { width: 20px; height: 20px; }
  .brand-word { display: flex; flex-direction: column; line-height: 1.05; }
  .brand-word b { font-size: 16px; letter-spacing: .04em; }
  .brand-word span { font-size: 9px; letter-spacing: .3em; color: var(--muted); }

  .nav { display: flex; gap: 4px; margin-left: 8px; }
  .nav a {
    padding: 7px 12px; border-radius: var(--radius-pill); font-size: 14px; color: var(--text-2);
    transition: background .18s, color .18s;
  }
  .nav a:hover { background: var(--ink-3); color: var(--text); }
  .nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

  .header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
  .search {
    display: flex; align-items: center; gap: 8px;
    height: 38px; padding: 0 14px;
    background: var(--ink-2); border: 1px solid var(--line-soft);
    border-radius: var(--radius-pill); min-width: 210px;
    transition: border-color .2s, box-shadow .2s;
  }
  .search:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: 0 0 0 4px var(--accent-soft); }
  .search input { border: 0; background: none; outline: none; width: 100%; font-size: 13px; }
  .search svg { width: 15px; height: 15px; color: var(--muted); flex: none; }
  .icon-btn {
    width: 38px; height: 38px; border-radius: 50%;
    display: grid; place-items: center; color: var(--text-2);
    border: 1px solid transparent;
    transition: background .18s, color .18s, border-color .18s;
  }
  .icon-btn:hover { background: var(--ink-3); color: var(--text); border-color: var(--line-soft); }
  .icon-btn svg { width: 18px; height: 18px; }

  /* ---------- buttons ---------- */
  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 42px; padding: 0 18px; border-radius: var(--radius-pill);
    font-size: 14px; font-weight: 600; white-space: nowrap;
    border: 1px solid transparent;
    transition: transform .16s var(--ease), background .18s, border-color .18s, color .18s, box-shadow .2s;
  }
  .btn:active { transform: scale(.97); }
  .btn svg { width: 16px; height: 16px; }
  .btn-primary {
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--accent-2)));
    color: var(--on-accent);
    box-shadow: 0 12px 26px -16px color-mix(in srgb, var(--accent) 80%, transparent);
  }
  .btn-primary:hover { box-shadow: 0 16px 34px -14px color-mix(in srgb, var(--accent) 85%, transparent); }
  .btn-ghost { background: color-mix(in srgb, var(--ink-2) 70%, transparent); border-color: var(--line); color: var(--text); }
  .btn-ghost:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); color: var(--text); background: var(--ink-3); }
  .btn-gold { background: var(--gold-soft); color: var(--gold); border-color: color-mix(in srgb, var(--gold) 35%, transparent); }
  .btn-gold:hover { background: color-mix(in srgb, var(--gold) 22%, transparent); }
  .btn-rose { background: var(--rose-soft); color: var(--rose); border-color: color-mix(in srgb, var(--rose) 32%, transparent); }
  .btn-sm { height: 34px; padding: 0 13px; font-size: 12.5px; }
  .btn-lg { height: 50px; padding: 0 26px; font-size: 15px; }
  .btn-block { width: 100%; }
  .btn[aria-pressed="true"] { border-color: color-mix(in srgb, var(--accent) 55%, transparent); color: var(--accent); background: var(--accent-soft); }

  /* ---------- chips / tags ---------- */
  .chip {
    display: inline-flex; align-items: center; gap: 6px;
    height: 30px; padding: 0 12px; border-radius: var(--radius-pill);
    border: 1px solid var(--line-soft); background: var(--ink-2);
    color: var(--text-2); font-size: 12.5px; white-space: nowrap;
    transition: border-color .18s, color .18s, background .18s;
  }
  .chip:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); color: var(--text); }
  .chip[aria-pressed="true"], .chip.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 50%, transparent); color: var(--accent); }
  .tag {
    display: inline-flex; align-items: center; height: 24px; padding: 0 9px;
    border-radius: 7px; font-size: 11.5px; color: var(--text-2);
    background: color-mix(in srgb, var(--ink-3) 90%, transparent);
    border: 1px solid var(--line-soft);
  }
  .badge {
    display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px;
    border-radius: 6px; font-size: 11px; font-weight: 600; letter-spacing: .04em;
    background: var(--ink-4); color: var(--text-2);
  }
  .badge-accent { background: var(--accent-soft); color: var(--accent); }
  .badge-gold { background: var(--gold-soft); color: var(--gold); }
  .badge-rose { background: var(--rose-soft); color: var(--rose); }
  .badge-live { background: color-mix(in srgb, var(--danger) 16%, transparent); color: #ff9c9c; }
  .badge-18 { background: color-mix(in srgb, var(--danger) 14%, transparent); color: #ffb0b0; }

  /* ---------- stats ---------- */
  .stat-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
  .stat { display: inline-flex; align-items: baseline; gap: 6px; font-size: 13px; color: var(--muted); }
  .stat b { color: var(--text); font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
  .stat svg { width: 14px; height: 14px; }
  .stat-stone b { color: var(--gold); }
  .stat-like b { color: var(--rose); }
  .stat-fav b { color: var(--violet); }

  /* ---------- novel card ---------- */
  .n-card { position: relative; display: flex; flex-direction: column; min-width: 0; }
  .n-card.is-closed .n-card-media { filter: saturate(.72) brightness(.86); }
  .n-card.is-closed .n-card-media:hover { filter: saturate(.85) brightness(.95); }
  .n-card.is-closed .cover-title { color: rgb(233 238 249 / .82); }
  .n-card-media {
    display: block;
    position: relative; aspect-ratio: 3 / 4; border-radius: var(--radius);
    overflow: hidden; background: var(--ink-3); isolation: isolate;
    border: 1px solid var(--line-soft);
    transition: transform .4s var(--ease-out), box-shadow .4s var(--ease-out), border-color .3s;
  }
  .n-card:hover .n-card-media { transform: translateY(-4px); box-shadow: var(--shadow-2); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
  .n-card-media img, .n-card-media .cover-art {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .7s var(--ease-out), filter .5s;
  }
  .n-card:hover .n-card-media img { transform: scale(1.045); }
  .cover-art {
    position: absolute; inset: 0;
    background-size: cover; background-position: center;
  }
  .cover-fallback {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 14px;
    background:
      radial-gradient(120% 80% at 70% 8%, color-mix(in srgb, var(--card-accent, var(--accent)) 34%, transparent), transparent 60%),
      linear-gradient(160deg, color-mix(in srgb, var(--card-accent, var(--accent)) 18%, #07090f) 0%, #07090f 62%, color-mix(in srgb, var(--card-accent, var(--accent)) 8%, #07090f) 100%);
  }
  .cover-fallback .cf-top { display: flex; justify-content: space-between; align-items: start; gap: 6px; }
  .cover-fallback .cf-genre { font-size: 10px; letter-spacing: .26em; color: color-mix(in srgb, var(--card-accent, var(--accent)) 82%, #fff); text-transform: uppercase; }
  .cover-fallback .cf-title {
    font-family: var(--font-serif); font-size: clamp(15px, 1.35vw, 19px); line-height: 1.28;
    color: #f2f5ff; text-shadow: 0 2px 18px rgb(0 0 0 / .5);
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  }
  .cover-fallback .cf-sub { margin-top: 6px; font-size: 10.5px; color: rgb(255 255 255 / .62); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .cover-pattern { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: .92; }
  .cover-veil { position: absolute; inset: 0; background: linear-gradient(to top, rgb(3 5 10 / .92) 0%, rgb(3 5 10 / .35) 42%, transparent 72%); }
  .cover-top { position: absolute; inset: 12px 12px auto; display: flex; justify-content: space-between; align-items: start; gap: 8px; z-index: 2; }
  .cover-bottom { position: absolute; inset: auto 12px 12px; z-index: 2; }
  .cover-title { font-family: var(--font-serif); font-size: 17px; line-height: 1.25; text-shadow: 0 2px 14px rgb(0 0 0 / .8); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .cover-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 11px; color: rgb(255 255 255 / .68); }
  .cover-stats { display: flex; gap: 10px; margin-top: 8px; font-size: 10.5px; color: rgb(255 255 255 / .62); }
  .cover-stats b { color: rgb(255 255 255 / .9); font-weight: 600; }

  .n-card-body { padding: 10px 2px 0; display: grid; gap: 5px; }
  .n-card-title { font-size: 14px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
  .n-card-sub { font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
  .n-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--muted); }
  .n-card-foot svg, .cover-stats svg, .stat svg { width: 12px; height: 12px; flex: none; }
  .n-card-foot span { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }

  /* ---------- trailer (5s) ---------- */
  .trailer {
    position: relative; overflow: hidden; border-radius: var(--radius);
    background: #05070d; isolation: isolate;
    contain: paint;
  }
  .trailer video, .trailer .t-poster { width: 100%; height: 100%; object-fit: cover; }
  .trailer .t-copy {
    position: absolute; inset: auto 12px 14px; z-index: 2; display: grid; gap: 3px;
    text-shadow: 0 2px 14px rgb(0 0 0 / .8);
    pointer-events: none;
  }
  .trailer .t-copy::before {
    content: ""; position: absolute; inset: -34px -12px -14px; z-index: -1;
    background: linear-gradient(to top, rgb(4 6 12 / .88), transparent);
  }
  .trailer .t-copy b { font-family: var(--font-serif); font-size: 15px; font-weight: 600; color: #fff; }
  .trailer .t-copy span { font-size: 11px; color: rgb(255 255 255 / .72); }
  .trailer .t-badge {
    position: absolute; top: 10px; left: 10px; z-index: 4;
    display: inline-flex; align-items: center; gap: 5px;
    height: 22px; padding: 0 8px; border-radius: 6px;
    background: rgb(5 8 14 / .72); backdrop-filter: blur(8px);
    color: #eaf1ff; font-size: 10.5px; letter-spacing: .08em;
  }
  .trailer .t-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #ff5c7a; box-shadow: 0 0 8px #ff5c7a; }
  .trailer .t-play {
    position: absolute; inset: 0; z-index: 3; display: grid; place-items: center;
    background: radial-gradient(60% 60% at 50% 55%, rgb(0 0 0 / .18), rgb(0 0 0 / .46));
  }
  .trailer .t-play span {
    width: 46px; height: 46px; border-radius: 50%;
    display: grid; place-items: center;
    background: rgb(255 255 255 / .9); color: #0a0d14;
    box-shadow: 0 10px 30px -8px rgb(0 0 0 / .7);
    transform: scale(.96); transition: transform .2s var(--ease);
  }
  .trailer:hover .t-play span, .trailer:focus-within .t-play span { transform: scale(1.06); }
  .trailer .t-play svg { width: 18px; height: 18px; margin-left: 2px; }

  /* 5 秒程序化预告：海报缩放 + 光扫 + 标题逐行入场，5s 一循环 */
  .motion-trailer { position: relative; width: 100%; height: 100%; overflow: hidden; }
  .motion-trailer .mt-bg { position: absolute; inset: -4%; background-size: cover; background-position: center; }
  .motion-trailer .mt-veil { position: absolute; inset: 0; background: linear-gradient(180deg, rgb(4 6 12 / .18), rgb(4 6 12 / .82)); }
  .motion-trailer .mt-text { position: absolute; inset: auto 16px 20px; z-index: 2; }
  .motion-trailer .mt-line { font-family: var(--font-serif); font-size: 16px; line-height: 1.4; opacity: .96; text-shadow: 0 2px 16px rgb(0 0 0 / .7); }
  .motion-trailer .mt-text::before { content: ""; position: absolute; inset: -28px -14px -18px; z-index: -1; background: linear-gradient(to top, rgb(4 6 12 / .88), transparent); }
  .motion-trailer .mt-line + .mt-line { margin-top: 4px; color: rgb(255 255 255 / .74); font-size: 12px; }
  .motion-trailer .mt-sweep { position: absolute; inset: 0; background: linear-gradient(105deg, transparent 30%, rgb(255 255 255 / .22) 48%, transparent 62%); mix-blend-mode: screen; opacity: 0; }
  .motion-trailer .mt-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: rgb(255 255 255 / .12); z-index: 3; }
  .motion-trailer .mt-progress i { display: block; height: 100%; width: 0; background: var(--accent); }

  /* ---------- rank list ---------- */
  .rank-list { display: grid; gap: 2px; }
  .rank-item {
    display: grid; grid-template-columns: 34px 44px 1fr auto; align-items: center; gap: 12px;
    padding: 10px 10px; border-radius: 12px;
    transition: background .18s;
  }
  .rank-item:hover { background: var(--ink-3); }
  .rank-no { font-family: var(--font-serif); font-size: 19px; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
  .rank-item:nth-child(1) .rank-no { color: var(--gold); }
  .rank-item:nth-child(2) .rank-no { color: #cfd6e6; }
  .rank-item:nth-child(3) .rank-no { color: #d8a183; }
  .rank-thumb { width: 44px; height: 58px; border-radius: 8px; overflow: hidden; background: var(--ink-4); position: relative; }
  .rank-thumb img { width: 100%; height: 100%; object-fit: cover; }
  .rank-main { min-width: 0; }
  .rank-title { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rank-sub { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rank-main > span { display: block; }
  .rank-val { text-align: right; }
  .rank-val b { display: block; font-size: 14px; font-variant-numeric: tabular-nums; }
  .rank-val span { font-size: 10.5px; color: var(--muted); }
  .delta { font-size: 10.5px; }
  .delta.up { color: var(--accent); }
  .delta.down { color: var(--danger); }

  /* ---------- tabs ---------- */
  .tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    position: relative; flex: none;
    height: 34px; padding: 0 14px; border-radius: var(--radius-pill);
    font-size: 13px; color: var(--text-2); background: transparent;
    border: 1px solid transparent;
    transition: color .18s, background .18s, border-color .18s;
  }
  .tab:hover { color: var(--text); background: var(--ink-3); }
  .tab[aria-selected="true"] { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 32%, transparent); }
  .tab[aria-selected="true"]::after {
    content: ""; position: absolute; left: 14px; right: 14px; bottom: 4px;
    border-block-end: 2px solid currentColor; opacity: .9;
  }

  /* ---------- form ---------- */
  .field { display: grid; gap: 7px; }
  .field > label, .field-label { font-size: 12.5px; color: var(--text-2); }
  .input, .select, .textarea {
    width: 100%; height: 42px; padding: 0 13px;
    background: var(--ink-2); border: 1px solid var(--line);
    border-radius: var(--radius-sm); outline: none;
    transition: border-color .18s, box-shadow .18s;
  }
  .textarea { height: auto; min-height: 96px; padding: 11px 13px; resize: vertical; line-height: 1.6; }
  .input:focus, .select:focus, .textarea:focus { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: 0 0 0 4px var(--accent-soft); }
  .hint { font-size: 11.5px; color: var(--muted); }
  .form-error { font-size: 12px; color: #ff9c9c; min-height: 18px; }

  /* ---------- dialog ---------- */
  dialog.zd {
    width: min(440px, calc(100vw - 32px));
    padding: 0; border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--ink-2); color: var(--text);
    box-shadow: var(--shadow-2);
    margin: auto;
  }
  dialog.zd::backdrop { background: rgb(2 4 9 / .66); backdrop-filter: blur(6px); }
  dialog.zd:modal { overscroll-behavior: contain; }
  dialog.zd::backdrop { overflow: hidden; overscroll-behavior: contain; }
  dialog.zd .dlg-head {
    display: flex; align-items: start; justify-content: space-between; gap: 16px;
    padding: 22px 22px 0;
  }
  dialog.zd .dlg-head h2 { font-family: var(--font-serif); font-size: 21px; }
  dialog.zd .dlg-head p { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
  dialog.zd .dlg-body { padding: 18px 22px 22px; display: grid; gap: 14px; }
  dialog.zd .dlg-close { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
  dialog.zd .dlg-close:hover { background: var(--ink-3); color: var(--text); }
  dialog.zd .dlg-foot { display: flex; gap: 10px; }

  /* ---------- toast ---------- */
  .toast-wrap { position: fixed; left: 50%; bottom: 28px; translate: -50% 0; z-index: 200; display: grid; gap: 8px; pointer-events: none; }
  .toast {
    padding: 11px 18px; border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--ink-3) 92%, transparent);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-2);
    font-size: 13px; color: var(--text);
    display: flex; align-items: center; gap: 8px;
  }
  .toast.ok { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
  .toast.warn { border-color: color-mix(in srgb, var(--gold) 45%, transparent); }

  /* ---------- empty / skeleton ---------- */
  .empty {
    display: grid; place-items: center; gap: 10px; text-align: center;
    padding: 64px 20px; color: var(--muted); border: 1px dashed var(--line);
    border-radius: var(--radius); background: color-mix(in srgb, var(--ink-2) 60%, transparent);
  }
  .empty b { color: var(--text); font-size: 15px; }
  .skeleton { position: relative; overflow: hidden; background: var(--ink-3); border-radius: var(--radius); }
  .skeleton::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--ink-4) 80%, transparent), transparent);
    transform: translateX(-100%);
  }
  @media (prefers-reduced-motion: no-preference) { .skeleton::after { animation: shimmer 1.4s infinite; } }

  /* ---------- percent bar ---------- */
  .meter { height: 4px; border-radius: 999px; background: var(--ink-4); overflow: hidden; }
  .meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

  /* ---------- footer ---------- */
  .site-footer {
    border-top: 1px solid var(--line-soft);
    padding: 52px 0 40px; margin-top: 40px;
    background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--ink-2) 55%, transparent));
  }
  .footer-grid { display: grid; gap: 32px; grid-template-columns: 1.4fr repeat(3, 1fr); }
  .footer-grid h3 { font-size: 12px; color: var(--muted); letter-spacing: .12em; margin-bottom: 12px; }
  .footer-grid a { display: block; font-size: 13px; color: var(--text-2); padding: 4px 0; }
  .footer-grid a:hover { color: var(--accent); }
  .footer-note { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line-soft); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
  @media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } }

  /* ---------- mobile tabbar ---------- */
  .tabbar { display: none; }
  body.reader .tabbar { display: none !important; }
  @media (max-width: 760px) {
    .nav, .search { display: none; }
    .header-actions > .btn-primary { display: none; }
    .header-actions { gap: 4px; }
    .brand-word span { display: none; }
    .novel-actions .btn { flex: 1 1 auto; min-width: 0; padding: 0 12px; font-size: 13px; }
    .novel-actions .btn-lg { flex-basis: 100%; }
    .tabbar {
      position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
      display: grid; grid-template-columns: repeat(5, 1fr);
      padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
      background: color-mix(in srgb, var(--ink-1) 92%, transparent);
      backdrop-filter: blur(18px);
      border-top: 1px solid var(--line-soft);
    }
    .tabbar a { display: grid; place-items: center; gap: 3px; font-size: 10px; color: var(--muted); padding: 5px 0; border-radius: 10px; }
    .tabbar a[aria-current="page"] { color: var(--accent); }
    .tabbar svg { width: 19px; height: 19px; }
    .page { padding-bottom: 120px; }
  }
}

@layer pages {
  /* hero */
  .hero {
    /* 首屏永远是深色影院感：立绘/视频在深底上最好看 */
    --text: #eef2fb; --text-2: #c3ccdd; --muted: #98a0b3;
    --ink-0: #05070e; --ink-1: #080b15; --ink-2: #0d1120; --ink-3: #121729; --ink-4: #1a2138;
    --line: #232b46; --line-soft: #1a2136;
    color: var(--text);
    position: relative;
    min-height: clamp(500px, 66vh, 700px);
    display: grid; align-items: end;
    overflow: hidden;
    border-bottom: 1px solid var(--line-soft);
  }
  .hero-media { position: absolute; inset: 0; z-index: -2; }
  .hero-media video, .hero-media img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; }
  /* 竖版视频只在手机出现；桌面用横版主视觉，避免 9:16 被裁成一条 */
  .hero-media .hero-video { display: none; }
  @media (max-width: 899px) {
    .hero-media .hero-video { display: block; object-position: 50% 42%; }
    .hero-media .hero-image { display: none; }
  }
  .hero-media::after {
    content: ""; position: absolute; inset: 0;
    background:
      linear-gradient(90deg, #05070e 4%, rgb(5 7 14 / .74) 38%, transparent 72%),
      linear-gradient(0deg, #05070e 2%, transparent 46%);
  }
  .hero-inner { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, .62fr); gap: clamp(24px, 4vw, 64px); align-items: end; padding-block: clamp(32px, 6vw, 72px); }
  .hero-copy { max-width: 620px; }
  .hero-eyebrow { display: inline-flex; align-items: center; gap: 10px; font-size: 11.5px; letter-spacing: .16em; color: var(--accent); text-transform: uppercase; }
  .hero-eyebrow::before { content: ""; width: 26px; height: 1px; background: currentColor; opacity: .6; }
  .hero h1 { font-family: var(--font-serif); font-size: clamp(34px, 5.2vw, 64px); line-height: 1.02; margin: 14px 0 12px; letter-spacing: .01em; }
  .hero h1 em { font-style: normal; color: var(--accent); }
  .hero-sub { color: var(--text-2); font-size: clamp(14px, 1.4vw, 16px); max-width: 46ch; }
  .hero-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 18px; color: var(--muted); font-size: 12.5px; }
  .hero-actions { display: flex; gap: 10px; margin-top: 26px; flex-wrap: wrap; }
  .hero-side { display: none; }
  .hero-side h2 { font-size: 12px; letter-spacing: .16em; color: var(--muted); text-transform: uppercase; display: flex; justify-content: space-between; align-items: center; }
  .hero-side h2 a { color: var(--accent); letter-spacing: 0; text-transform: none; font-size: 12px; }
  .hero-new {
    display: grid; grid-template-columns: 46px 1fr auto; gap: 10px; align-items: center;
    padding: 9px 10px; border-radius: 12px;
    background: color-mix(in srgb, var(--ink-2) 62%, transparent);
    border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
    backdrop-filter: blur(10px);
    transition: border-color .2s, background .2s, transform .2s;
  }
  .hero-new:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); background: color-mix(in srgb, var(--ink-3) 80%, transparent); transform: translateX(-2px); }
  .hero-new .hn-art { width: 46px; height: 60px; border-radius: 8px; overflow: hidden; position: relative; background: var(--ink-4); }
  .hero-new .hn-art img { width: 100%; height: 100%; object-fit: cover; }
  .hero-new b { display: block; font-size: 13px; font-weight: 600; }
  .hero-new span { font-size: 11px; color: var(--muted); }
  .updates { padding-block: 26px 0; }
  .updates-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
  .updates-head h2 { font-family: var(--font-serif); font-size: 17px; font-weight: 600; }
  .updates-head .more { font-size: 12px; color: var(--muted); }
  .updates-head .more:hover { color: var(--accent); }
  .updates-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(16px, 3vw, 40px); }
  .update-col { display: grid; gap: 8px; align-content: start; }
  .update-col .kicker { margin-bottom: 2px; }
  .hero-scroll { position: absolute; right: var(--gutter); bottom: 18px; font-size: 10px; letter-spacing: .22em; color: var(--muted); writing-mode: vertical-rl; }

  @media (max-width: 900px) {
    .hero-inner { grid-template-columns: 1fr; }
    .hero { min-height: 70svh; }
    .updates-grid { grid-template-columns: 1fr; gap: 18px; }
  }

  /* open shelf */
  .open-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
  .open-card { display: flex; gap: 12px; padding: 10px; border-radius: 14px; background: color-mix(in srgb, var(--ink-2) 80%, transparent); border: 1px solid var(--line-soft); transition: border-color .2s, transform .2s; }
  .open-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); transform: translateY(-2px); }
  .oc-art { width: 68px; height: 92px; flex: none; border-radius: 10px; overflow: hidden; background: var(--ink-3); }
  .oc-art img { width: 100%; height: 100%; object-fit: cover; }
  .oc-pattern { display: block; width: 100%; height: 100%; background-size: cover; }
  .oc-body { min-width: 0; display: grid; align-content: center; gap: 4px; }
  .oc-body b { font-family: var(--font-serif); font-size: 14px; font-weight: 600; line-height: 1.3; }
  .oc-body span { font-size: 11px; color: var(--muted); }
  .oc-body em { font-style: normal; font-size: 11.5px; color: var(--accent); }
  @media (max-width: 900px) { .open-grid { grid-template-columns: 1fr 1fr; } }
  @media (max-width: 420px) { .open-grid { grid-template-columns: 1fr; } }

  /* promise */
  .feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .feature-card {
    position: relative; overflow: hidden;
    padding: 18px 18px 16px; border-radius: var(--radius);
    background: color-mix(in srgb, var(--ink-2) 82%, transparent);
    border: 1px solid var(--line-soft);
    display: grid; gap: 6px;
  }
  .feature-card .fc-ic {
    width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
    background: var(--accent-soft); color: var(--accent); margin-bottom: 4px;
  }
  .feature-card .fc-ic svg { width: 18px; height: 18px; }
  .feature-card b { font-family: var(--font-serif); font-size: 16px; font-weight: 600; }
  .feature-card p { font-size: 12.5px; color: var(--muted); line-height: 1.55; }
  .ori-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
  .ori-chip {
    display: inline-flex; align-items: baseline; gap: 6px;
    padding: 8px 14px; border-radius: 999px;
    border: 1px solid var(--line-soft); background: var(--ink-2);
    font-size: 13px; transition: border-color .18s, background .18s, transform .18s;
  }
  .ori-chip:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--ink-3); transform: translateY(-1px); }
  .ori-chip b { font-weight: 600; }
  .ori-chip span { font-size: 11px; color: var(--muted); }
  @media (max-width: 760px) { .feature-grid { grid-template-columns: 1fr 1fr; } .feature-card { padding: 14px; } }
  @media (max-width: 380px) { .feature-grid { grid-template-columns: 1fr; } }

  /* living NPC */
  .alive-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(18px, 3vw, 36px); align-items: start; }
  .alive-quote { font-family: var(--font-serif); font-size: clamp(22px, 3vw, 32px); line-height: 1.4; margin-bottom: 14px; }
  .alive-desc { font-size: 13.5px; color: var(--text-2); line-height: 1.8; margin: 16px 0 18px; }
  .alive-desc b { color: var(--accent); font-weight: 600; }
  .alive-cards { display: grid; gap: 10px; }
  .npc-card { padding: 14px 16px; border-radius: 14px; background: color-mix(in srgb, var(--ink-2) 82%, transparent); border: 1px solid var(--line-soft); }
  .npc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
  .npc-av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-serif); font-size: 15px; color: #04121a; background: linear-gradient(145deg, var(--accent), var(--accent-2)); }
  .npc-head b { display: block; font-size: 13.5px; }
  .npc-head span { display: block; font-size: 11px; color: var(--muted); }
  .npc-line { font-family: var(--font-serif); font-size: 14.5px; line-height: 1.7; color: var(--text); }
  .npc-line[data-live="1"] { color: var(--accent); }
  .alive-band { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 24px; }
  .alive-band > div { padding: 16px; border-radius: 14px; border: 1px solid var(--line-soft); background: var(--ink-2); display: grid; gap: 4px; }
  .alive-band .k { font-size: 10.5px; letter-spacing: .14em; color: var(--accent); }
  .alive-band b { font-family: var(--font-serif); font-size: 15px; }
  .alive-band p { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
  @media (max-width: 900px) {
    .alive-grid { grid-template-columns: 1fr; }
    .alive-band { grid-template-columns: 1fr; }
  }

  /* spotlight strip */
  .spotlight { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 28px; position: relative; z-index: 3; }
  .spot {
    display: grid; gap: 6px; padding: 14px; border-radius: var(--radius);
    background: color-mix(in srgb, var(--ink-2) 88%, transparent);
    border: 1px solid var(--line-soft); backdrop-filter: blur(14px);
    box-shadow: var(--shadow-1);
  }
  .spot .k { font-size: 10.5px; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; }
  .spot .v { font-family: var(--font-serif); font-size: 22px; line-height: 1.1; }
  .spot .s { font-size: 11.5px; color: var(--text-2); }
  @media (max-width: 860px) { .spotlight { grid-template-columns: 1fr 1fr; margin-top: 20px; } }

  /* genre tiles */
  .genre-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .genre-tile {
    position: relative; overflow: hidden; border-radius: 14px;
    padding: 16px 14px; min-height: 92px;
    border: 1px solid var(--line-soft);
    background: linear-gradient(150deg, color-mix(in srgb, var(--g-accent) 16%, #080b12), #080b12 70%);
    display: flex; flex-direction: column; justify-content: space-between;
    transition: transform .25s var(--ease-out), border-color .25s;
  }
  .genre-tile:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--g-accent) 45%, var(--line)); }
  .genre-tile b { font-family: var(--font-serif); font-size: 15px; font-weight: 600; }
  .genre-tile span { font-size: 11px; color: var(--muted); }
  .genre-tile::after {
    content: ""; position: absolute; right: -30px; bottom: -40px; width: 110px; height: 110px; border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--g-accent) 35%, transparent), transparent 68%);
    opacity: .8;
  }

  /* shelf rows */
  .shelf { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(168px, 1fr); gap: 16px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
  .shelf > * { scroll-snap-align: start; }
  @media (min-width: 1100px) { .shelf { grid-auto-flow: row; grid-template-columns: repeat(6, 1fr); overflow: visible; } }

  /* library filters */
  .filters {
    display: grid; gap: 14px; padding: 18px; margin-bottom: 26px;
    background: color-mix(in srgb, var(--ink-2) 80%, transparent);
    border: 1px solid var(--line-soft); border-radius: var(--radius);
  }
  .filter-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
  .filter-row .label { font-size: 11.5px; color: var(--muted); width: 46px; flex: none; letter-spacing: .08em; }
  .filter-row .chips { display: flex; gap: 8px; flex-wrap: wrap; }
  .filter-foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding-top: 6px; border-top: 1px solid var(--line-soft); }
  .result-count { font-size: 12.5px; color: var(--muted); }
  .sort-select { height: 36px; padding: 0 12px; border-radius: 10px; }

  /* novel detail */
  .novel-hero { position: relative; padding-block: clamp(24px, 4vw, 44px) 32px; overflow: hidden; }
  .novel-hero-bg { position: absolute; inset: 0; z-index: -1; background-size: cover; background-position: center 26%; filter: blur(26px) saturate(.9); opacity: .28; transform: scale(1.08); }
  .novel-hero-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, color-mix(in srgb, var(--ink-0) 72%, transparent), var(--ink-0) 92%); }
  .novel-top { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: clamp(20px, 3vw, 40px); }
  .novel-poster { position: relative; border-radius: var(--radius-lg); overflow: hidden; aspect-ratio: 3/4; border: 1px solid var(--line); box-shadow: var(--shadow-2); background: var(--ink-3); }
  .novel-poster img { width: 100%; height: 100%; object-fit: cover; }
  .novel-info h1 { font-family: var(--font-serif); font-size: clamp(28px, 4vw, 46px); line-height: 1.08; margin-bottom: 8px; }
  .novel-info .sub { color: var(--text-2); font-size: 15px; }
  .novel-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
  .novel-hook { margin-top: 18px; padding: 14px 16px; border-left: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); border-radius: 0 12px 12px 0; font-family: var(--font-serif); font-size: 15px; color: var(--text); }
  .novel-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 20px; }
  .novel-stat { padding: 11px 13px; border-radius: 12px; background: color-mix(in srgb, var(--ink-2) 75%, transparent); border: 1px solid var(--line-soft); }
  .novel-stat .k { font-size: 11px; color: var(--muted); }
  .novel-stat .v { font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 2px; }
  .novel-stat .v small { font-size: 11px; color: var(--muted); font-weight: 500; margin-left: 3px; }
  .novel-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
  @media (max-width: 780px) {
    .novel-top { grid-template-columns: 1fr; gap: 16px; }
    .novel-poster { width: 148px; aspect-ratio: 3/4; justify-self: start; }
    .novel-stats { grid-template-columns: 1fr 1fr; }
    .novel-stat .v { font-size: 17px; }
    .novel-stat .k, .novel-stat .v small { white-space: nowrap; }
    .novel-info h1 { font-size: 24px; }
    .novel-hook { font-size: 14px; }
    .novel-body { padding-bottom: 40px; }
  }

  .novel-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: clamp(20px, 3vw, 40px); padding-top: 20px; }
  .panel { padding: 22px; border-radius: var(--radius); background: color-mix(in srgb, var(--ink-2) 82%, transparent); border: 1px solid var(--line-soft); }
  .panel + .panel { margin-top: 16px; }
  .panel h2 { font-family: var(--font-serif); font-size: 18px; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .panel h2 small { font-family: var(--font-sans); font-size: 11.5px; color: var(--muted); font-weight: 500; }
  .prose { color: var(--text-2); line-height: 1.85; font-size: 14px; }
  .prose p + p { margin-top: 12px; }
  @media (max-width: 980px) { .novel-body { grid-template-columns: 1fr; } }

  .cast-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
  .cast-card { border-radius: 14px; overflow: hidden; background: var(--ink-3); border: 1px solid var(--line-soft); }
  .cast-card .cc-art { aspect-ratio: 3/4; overflow: hidden; position: relative; }
  .cast-card .cc-art img { width: 100%; height: 100%; object-fit: cover; }
  .cast-card .cc-art .cc-fallback { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-serif); font-size: 30px; color: var(--muted); background: radial-gradient(circle at 40% 30%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%), var(--ink-3); }
  .cast-card .cc-body { padding: 9px 10px; }
  .cast-card b { font-size: 13px; }
  .cast-card span { display: block; font-size: 11px; color: var(--muted); }

  .chapter-list { display: grid; gap: 2px; }
  .chapter {
    display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center;
    padding: 10px; border-radius: 10px; font-size: 13px;
    transition: background .16s;
  }
  .chapter:hover { background: var(--ink-3); }
  .chapter .c-no { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
  .chapter .c-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .chapter .c-state { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
  .chapter .c-state svg { width: 12px; height: 12px; }
  .chapter.locked .c-title { color: var(--muted); }

  .tip-wall { display: grid; gap: 10px; }
  .tip-item { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; font-size: 12.5px; }
  .tip-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--ink-4); display: grid; place-items: center; font-size: 11px; color: var(--text-2); overflow: hidden; }
  .tip-avatar img { width: 100%; height: 100%; object-fit: cover; }
  .tip-item b { color: var(--gold); font-variant-numeric: tabular-nums; }

  /* reader */
  .reader { min-height: 100svh; display: grid; grid-template-rows: auto 1fr; }
  .reader-bar {
    position: sticky; top: 0; z-index: 50; height: 56px;
    display: flex; align-items: center; gap: 12px; padding-inline: var(--gutter);
    background: color-mix(in srgb, var(--ink-1) 88%, transparent);
    backdrop-filter: blur(16px); border-bottom: 1px solid var(--line-soft);
  }
  .reader-bar .title { flex: 0 1 auto; min-width: 0; font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .reader-bar { overflow: hidden; }
    /* 阅读器是竖版正文；立绘只做背景，不占一列 */
  .reader-main { display: block; position: relative; }
  .reader-art {
    position: fixed; inset: 0; z-index: -1; height: 100svh;
    border: 0; opacity: .22; filter: blur(3px) saturate(.9);
    pointer-events: none;
  }
  [data-theme="light"] .reader-art { opacity: .1; }
  .reader-art img { width: 100%; height: 100%; object-fit: cover; opacity: .92; }
  .reader-art .ra-veil { position: absolute; inset: 0; background: linear-gradient(90deg, var(--ink-1), transparent 30%), linear-gradient(0deg, var(--ink-1), transparent 40%); }
  .reader-art .ra-caption { display: none; }
  .reader-page { max-width: 680px; margin-inline: auto; padding: clamp(20px, 5vw, 56px) var(--gutter) 120px; }
  .reader-chapter-head { margin-bottom: 28px; padding-bottom: 18px; border-bottom: 1px solid var(--line-soft); }
  .reader-chapter-head .kicker { margin-bottom: 8px; }
  .reader-chapter-head h1 { font-family: var(--font-serif); font-size: clamp(24px, 3.4vw, 34px); }
  .reader-content { font-family: var(--font-serif); font-size: var(--reader-fs, 18px); line-height: var(--reader-lh, 2); color: var(--text); }
  .reader-content p { margin: 0 0 1.1em; text-indent: 2em; }
  .reader-content p.no-indent { text-indent: 0; }
  .reader-content .say { display: block; margin: 0 0 .9em; text-indent: 0; }
  .reader-content .say b { color: var(--accent); font-weight: 600; }
  .reader-content .line { margin: 0 0 .6em; text-indent: 0; color: var(--text-2); }
  .reader-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line-soft); }
  .reader-progress { position: fixed; left: 0; right: 0; top: 0; height: 2px; z-index: 60; background: transparent; }
  .reader-progress i { display: block; height: 100%; width: var(--p, 0%); background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .2s linear; }
  .reader-float { position: fixed; right: 20px; bottom: 24px; z-index: 45; display: grid; gap: 8px; }
  .reader-float .icon-btn { width: 44px; height: 44px; background: color-mix(in srgb, var(--ink-2) 92%, transparent); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
  .reader-sheet {
    position: fixed; right: 0; top: 0; bottom: 0; width: min(340px, 92vw); z-index: 90;
    background: var(--ink-1); border-left: 1px solid var(--line);
    transform: translateX(102%); transition: transform .32s var(--ease-out);
    display: flex; flex-direction: column;
  }
  .reader-sheet.open { transform: none; }
  .reader-sheet header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line-soft); }
  .ai-turn { padding: 10px 12px; border-radius: 12px; background: var(--ink-3); border: 1px solid var(--line-soft); }
  .ai-turn b { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
  .ai-turn p { font-size: 13.5px; line-height: 1.65; }
  .ai-turn.ai-npc { background: color-mix(in srgb, var(--accent) 7%, var(--ink-2)); border-color: color-mix(in srgb, var(--accent) 22%, transparent); }
  .ai-turn.ai-npc b { color: var(--accent); }
  .reader-sheet .sheet-body { overflow: auto; padding: 12px; }
  .reader-sheet .chapter { grid-template-columns: 26px 1fr auto; }
  @media (max-width: 760px) { .reader-art { display: none; } }

  /* gate / paywall */
  .gate-wrap { min-height: 72svh; display: grid; place-items: center; padding-block: 24px; }
  .gate-wrap .gate { margin-top: 0; max-width: 580px; }
  .gate {
    margin-top: 32px; padding: 26px; border-radius: var(--radius-lg);
    border: 1px solid color-mix(in srgb, var(--gold) 30%, var(--line));
    background:
      radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--gold) 12%, transparent), transparent 60%),
      var(--ink-2);
    text-align: center;
  }
  .gate h2 { font-family: var(--font-serif); font-size: 22px; margin-bottom: 8px; }
  .gate p { color: var(--text-2); font-size: 13.5px; max-width: 46ch; margin: 0 auto 18px; }
  .gate .row { justify-content: center; }

  /* profile */
  .profile-head { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 22px; align-items: center; padding: 24px; border-radius: var(--radius-lg); background: color-mix(in srgb, var(--ink-2) 82%, transparent); border: 1px solid var(--line-soft); }
  .avatar-edit { position: relative; width: 120px; height: 120px; border-radius: 50%; overflow: hidden; background: var(--ink-4); border: 2px solid var(--line); }
  .avatar-edit img { width: 100%; height: 100%; object-fit: cover; }
  .avatar-edit .pick { position: absolute; inset: auto 0 0; background: rgb(4 8 14 / .72); color: #fff; font-size: 11px; text-align: center; padding: 6px 0; cursor: pointer; }
  .profile-name { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
  .profile-name h1 { font-family: var(--font-serif); font-size: 26px; }
  .profile-bio { color: var(--text-2); font-size: 13.5px; margin-top: 6px; max-width: 60ch; }
  .profile-stats { display: flex; gap: 22px; margin-top: 14px; flex-wrap: wrap; }
  .profile-stats .v { font-size: 18px; font-weight: 650; }
  .profile-stats .k { font-size: 11px; color: var(--muted); }
  @media (max-width: 760px) { .profile-head { grid-template-columns: 84px 1fr; } .avatar-edit { width: 84px; height: 84px; } }

  .folder-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
  .folder {
    flex: none; display: inline-flex; align-items: center; gap: 7px;
    height: 34px; padding: 0 13px; border-radius: 10px;
    background: var(--ink-2); border: 1px solid var(--line-soft); font-size: 12.5px; color: var(--text-2);
  }
  .folder[aria-pressed="true"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: var(--accent-soft); }
  .folder small { color: var(--muted); }

  .history-item { display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; }
  .history-item:hover { background: var(--ink-3); }
  .history-thumb { width: 48px; height: 64px; border-radius: 8px; overflow: hidden; background: var(--ink-4); }
  .history-thumb img { width: 100%; height: 100%; object-fit: cover; }

  /* pricing */
  .price-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .price-card {
    position: relative; display: flex; flex-direction: column; gap: 14px;
    padding: 22px; border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--ink-2) 85%, transparent);
    border: 1px solid var(--line-soft);
  }
  .price-card.featured { border-color: color-mix(in srgb, var(--accent) 46%, transparent); background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 9%, transparent), transparent 60%), color-mix(in srgb, var(--ink-2) 92%, transparent); }
  .price-card .pc-tag { position: absolute; top: -11px; left: 20px; }
  .price-card h3 { font-size: 15px; }
  .price-card .amount { font-family: var(--font-serif); font-size: 34px; line-height: 1; }
  .price-card .amount small { font-family: var(--font-sans); font-size: 12px; color: var(--muted); font-weight: 500; }
  .price-card ul { display: grid; gap: 8px; font-size: 12.5px; color: var(--text-2); }
  .price-card li { display: flex; gap: 8px; align-items: start; }
  .price-card li::before { content: ""; width: 14px; height: 14px; border-radius: 50%; flex: none; margin-top: 3px; background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); }
  @media (max-width: 1000px) { .price-grid { grid-template-columns: 1fr 1fr; } }
  @media (max-width: 560px) { .price-grid { grid-template-columns: 1fr; } }

  .table { width: 100%; border-collapse: collapse; font-size: 13px; }
  .table th, .table td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
  @media (max-width: 720px) {
    .table thead { display: none; }
    .table tr { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 3px 10px; padding: 12px 4px; border-bottom: 1px solid var(--line-soft); }
    .table td { border: 0; padding: 0; }
    .table td:nth-child(1) { grid-row: 1 / 3; align-self: center; }
    .table td:nth-child(2) { grid-column: 2; grid-row: 1; min-width: 0; }
    .table td:nth-child(3) { grid-column: 2; grid-row: 2; }
    .table td:nth-child(4) { grid-column: 3; grid-row: 1 / 3; align-self: center; text-align: right; }
    .table td:nth-child(n+5) { display: none; }
  }
  .table th { color: var(--muted); font-weight: 500; font-size: 12px; }
  .table tr:last-child td { border-bottom: 0; }
  .table .num { text-align: right; font-variant-numeric: tabular-nums; }

  .compare { display: grid; grid-template-columns: 1fr auto auto auto; gap: 0; border: 1px solid var(--line-soft); border-radius: 14px; overflow: hidden; }
  .compare > div { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; }
  .compare > div:nth-last-child(-n+4) { border-bottom: 0; }
  .compare .ch { color: var(--muted); font-size: 11.5px; letter-spacing: .08em; background: color-mix(in srgb, var(--ink-3) 60%, transparent); }
  .compare .on { color: var(--accent); }
  .compare .off { color: var(--muted); }

  /* rankings */
  .rank-board { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .rank-panel { padding: 18px; border-radius: var(--radius); background: color-mix(in srgb, var(--ink-2) 82%, transparent); border: 1px solid var(--line-soft); }
  .rank-panel h2 { font-family: var(--font-serif); font-size: 17px; margin-bottom: 4px; }
  .rank-panel .cap { font-size: 11.5px; color: var(--muted); margin-bottom: 12px; }
  @media (max-width: 900px) { .rank-board { grid-template-columns: 1fr; } }

  /* trailers */
  .trailer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
  .trailer-card { position: relative; aspect-ratio: 3/4; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line-soft); background: var(--ink-3); }
  .trailer-card .tc-info { position: absolute; inset: auto 0 0; padding: 14px; z-index: 3; background: linear-gradient(to top, rgb(4 6 12 / .92), transparent); }
  .trailer-card .tc-info b { font-family: var(--font-serif); font-size: 16px; }
  .trailer-card .tc-info span { display: block; font-size: 11.5px; color: rgb(255 255 255 / .64); }

  /* article / notes */
  .note-list { display: grid; gap: 12px; }
  .note { padding: 16px 18px; border-radius: 14px; background: color-mix(in srgb, var(--ink-2) 78%, transparent); border: 1px solid var(--line-soft); }
  .note h3 { font-size: 14px; margin-bottom: 6px; }
  .note p { font-size: 13px; color: var(--text-2); }
}

@layer motion {
  @keyframes shimmer { to { transform: translateX(100%); } }
  @keyframes rise { from { opacity: 0; translate: 0 18px; } to { opacity: 1; translate: 0 0; } }
  @keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

  @media (prefers-reduced-motion: no-preference) {
    .reveal {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 8% cover 26%;
    }
    .fade-in { animation: fade-in .5s var(--ease) both; }
  }

  /* 5s 预告动效：由 .playing 控制，默认静止；播放器按钮可暂停/重播 */
  .motion-trailer.playing .mt-bg { animation: mt-zoom 5s linear both; }
  .motion-trailer.playing .mt-sweep { animation: mt-sweep 5s linear both; }
  .motion-trailer.playing .mt-line:nth-child(1) { animation: mt-line 5s linear both; animation-delay: .25s; }
  .motion-trailer.playing .mt-line:nth-child(2) { animation: mt-line 5s linear both; animation-delay: .9s; }
  .motion-trailer.playing .mt-progress i { animation: mt-progress 5s linear both; }

  @keyframes mt-zoom { from { transform: scale(1.06); } to { transform: scale(1.16); } }
  @keyframes mt-sweep { 0% { opacity: 0; transform: translateX(-30%); } 18% { opacity: .9; } 52% { opacity: .25; transform: translateX(40%); } 100% { opacity: 0; transform: translateX(70%); } }
  @keyframes mt-line { 0% { opacity: 0; translate: 0 12px; } 14% { opacity: 1; translate: 0 0; } 82% { opacity: 1; } 100% { opacity: .7; } }
  @keyframes mt-progress { from { width: 0; } to { width: 100%; } }

  @media (prefers-reduced-motion: reduce) {
    .motion-trailer.playing .mt-bg, .motion-trailer.playing .mt-sweep,
    .motion-trailer.playing .mt-line, .motion-trailer.playing .mt-progress i { animation-duration: 0s !important; }
    .motion-trailer .mt-line { opacity: 1; translate: 0 0; }
    html { scroll-behavior: auto; }
  }

  @media (prefers-reduced-motion: no-preference) {
    @view-transition { navigation: auto; }
    ::view-transition-old(root) { animation: vt-out .24s var(--ease) both; }
    ::view-transition-new(root) { animation: vt-in .3s var(--ease-out) both; }
    @keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
    @keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }
  }
}

@layer utilities {
  .mt-16 { margin-top: 16px; }
  .mt-24 { margin-top: 24px; }
  .mt-32 { margin-top: 32px; }
  .flex { display: flex; }
  .between { justify-content: space-between; }
  .center { align-items: center; }
  .grow { flex: 1; min-width: 0; }
  .truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hide-sm { }
  @media (max-width: 700px) { .hide-sm { display: none !important; } }
  .container-narrow { max-width: 880px; margin-inline: auto; }
}

/* 大列表延迟渲染：只给首屏以下的区块，避免 LCP 被拖慢 */
.defer-rows {
  content-visibility: auto;
  contain-intrinsic-size: auto 720px;
}
