/* ===== LOCAL FONTS (按需加载，见 app.js loadFontFace) ===== */

/* ===== GOTHIC SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--accent-primary); border-radius: var(--radius-sm); }
::-webkit-scrollbar-thumb:hover { background: var(--accent-primary-light); }
* { scrollbar-width: thin; scrollbar-color: var(--accent-primary) var(--bg-primary); outline: none; }
*:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary) 28%, transparent);
}

/* ===== LIGHT MODE - Pixiv Style ===== */
/* Global form element reset - consistent font and no border-radius */
input, select, textarea, button {
  font-family: var(--font-serif);
  border-radius: var(--radius-sm);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
.ms-icon { display: inline-block; vertical-align: middle; flex-shrink: 0; }

:root {
  /* Spacing System (base: 8px) */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-base: 16px;
  --space-lg: 20px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --space-3xl: 40px;
  --space-4xl: 48px;
  /* Gap Scale */
  --gap-compact: 8px;
  --gap-standard: 12px;
  --gap-relaxed: 16px;

  --bg-primary: #fafcfc;
  --bg-secondary: #f0f5f5;
  --bg-card: rgba(255, 255, 255, 0.7);
  --bg-popover: color-mix(in srgb, var(--bg-primary) 93%, transparent);
  --nav-bg: rgba(250, 252, 252, 0.9);
  --bg-card-hover: rgba(255, 255, 255, 0.85);
  --text-primary: #2a3a38;
  --text-secondary: #5a7a76;
  --text-muted: #8aa8a4;
  --border-light: rgba(57, 197, 187, 0.15);
  --border-hover: rgba(57, 197, 187, 0.35);
  --shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 1px 4px rgba(0, 0, 0, 0.03);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.06);
  --font-serif: 'Noto Serif SC', 'Georgia', serif;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-display: 'Noto Serif SC', 'Georgia', serif;
  --transition: all 0.3s ease;
  /* Motion Easing System */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-spring-sm: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring-bounce: cubic-bezier(0.68, -0.55, 0.27, 1.55);
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;
  --reader-font-size: 16px;
  --reader-line-height: 1.9;
  --radius-sm: 0px;
  --radius-md: 0px;
  --radius-lg: 0px;
  /* Default accent (Miku Teal) */
  --accent-primary: #39c5bb;
  --accent-primary-light: #5bbfb8;
  --accent-pink: #5bbfb8;
  --accent-rose: #8dd8d2;
  --accent-miku: #39c5bb;
  --accent-miku-light: #5bbfb8;
  --accent-miku-glow: rgba(57, 197, 187, 0.15);
  --accent-tag-bg: rgba(57, 197, 187, 0.08);
  --accent-gothic: #7a9e8a;
  --accent-gothic-light: #a0c4b0;
  --accent-blood: #b08080;
  --accent-silver: #8a8a8a;
}

/* ===== DARK MODE ===== */
[data-theme="dark"] {
  --bg-primary: #0a1a1a;
  --bg-secondary: #0e2020;
  --bg-card: rgba(20, 40, 38, 0.6);
  --nav-bg: rgba(10, 26, 26, 0.9);
  --bg-card-hover: rgba(28, 52, 50, 0.7);
  --text-primary: #d0e8e4;
  --text-secondary: #8ab8b0;
  --text-muted: #5a8a82;
  --accent-primary: #4dd4cc;
  --accent-primary-light: #6de0d8;
  --accent-pink: #6de0d8;
  --accent-rose: #8dd8d2;
  --accent-silver: #7a746c;
  --accent-gothic: #8ab8a0;
  --accent-gothic-light: #a8d4b8;
  --accent-blood: #c89898;
  --accent-miku: #4dd4cc;
  --accent-miku-light: #6de0d8;
  --accent-miku-glow: rgba(77, 212, 204, 0.1);
  --accent-tag-bg: rgba(57, 197, 187, 0.1);
  --border-light: rgba(57, 197, 187, 0.12);
  --border-hover: rgba(77, 212, 204, 0.3);
  --shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.3);
  --shadow-card: 0 1px 4px rgba(0, 0, 0, 0.2);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.35);
}

/* ===== COLOR SCHEME: Miku Teal (Default) ===== */
[data-color-scheme="miku"] {
  --accent-primary: #39c5bb;
  --accent-primary-light: #5bbfb8;
  --accent-pink: #5bbfb8;
  --accent-rose: #8dd8d2;
  --accent-miku: #39c5bb;
  --accent-miku-light: #5bbfb8;
  --accent-miku-glow: rgba(57, 197, 187, 0.15);
  --accent-gothic: #7a9e8a;
  --accent-gothic-light: #a0c4b0;
  --accent-blood: #b08080;
}
[data-color-scheme="miku"][data-theme="dark"] {
  --bg-primary: #0a1a1a;
  --bg-secondary: #0e2020;
  --bg-card: rgba(20, 40, 38, 0.6);
  --nav-bg: rgba(10, 26, 26, 0.9);
  --bg-card-hover: rgba(28, 52, 50, 0.7);
  --text-primary: #d0e8e4;
  --text-secondary: #8ab8b0;
  --text-muted: #5a8a82;
  --accent-primary: #4dd4cc;
  --accent-primary-light: #6de0d8;
  --accent-pink: #6de0d8;
  --accent-rose: #8dd8d2;
  --accent-miku: #4dd4cc;
  --accent-miku-light: #6de0d8;
  --accent-miku-glow: rgba(77, 212, 204, 0.1);
  --accent-gothic: #8ab8a0;
  --accent-gothic-light: #a8d4b8;
  --accent-blood: #c89898;
  --border-light: rgba(77, 212, 204, 0.12);
  --border-hover: rgba(77, 212, 204, 0.3);
}

/* ===== COLOR SCHEME: Rose Pink ===== */
[data-color-scheme="rose"] {
  --bg-primary: #fdf8fa;
  --bg-secondary: #f8f0f3;
  --bg-card: rgba(255, 255, 255, 0.7);
  --nav-bg: rgba(253, 248, 250, 0.9);
  --bg-card-hover: rgba(255, 255, 255, 0.85);
  --text-primary: #3a2a2e;
  --text-secondary: #7a5a62;
  --text-muted: #aa8a92;
  --accent-primary: #F23172;
  --accent-primary-light: #f5608e;
  --accent-pink: #f5608e;
  --accent-rose: #f8a0b8;
  --accent-miku: #F23172;
  --accent-miku-light: #f5608e;
  --accent-miku-glow: rgba(242, 49, 114, 0.12);
  --accent-tag-bg: rgba(242, 49, 114, 0.06);
  --accent-gothic: #c44a78;
  --accent-gothic-light: #e07098;
  --accent-blood: #d06060;
  --border-light: rgba(242, 49, 114, 0.12);
  --border-hover: rgba(242, 49, 114, 0.3);
}
[data-color-scheme="rose"][data-theme="dark"] {
  --bg-primary: #1a0a10;
  --bg-secondary: #200e16;
  --bg-card: rgba(40, 20, 28, 0.6);
  --nav-bg: rgba(26, 10, 16, 0.9);
  --bg-card-hover: rgba(52, 28, 38, 0.7);
  --text-primary: #e8d0d6;
  --text-secondary: #b08a96;
  --text-muted: #806070;
  --accent-primary: #f54888;
  --accent-primary-light: #f870a0;
  --accent-pink: #f870a0;
  --accent-rose: #f8a0b8;
  --accent-miku: #f54888;
  --accent-miku-light: #f870a0;
  --accent-miku-glow: rgba(245, 72, 136, 0.1);
  --accent-tag-bg: rgba(242, 49, 114, 0.1);
  --accent-gothic: #d05888;
  --accent-gothic-light: #e880a8;
  --accent-blood: #e07878;
  --border-light: rgba(245, 72, 136, 0.12);
  --border-hover: rgba(245, 72, 136, 0.3);
}

/* ===== COLOR SCHEME: Coral Sky ===== */
[data-color-scheme="coral"] {
  --bg-primary: #fefcfa;
  --bg-secondary: #f8f4f0;
  --bg-card: rgba(255, 255, 255, 0.7);
  --nav-bg: rgba(254, 252, 250, 0.9);
  --bg-card-hover: rgba(255, 255, 255, 0.85);
  --text-primary: #2e2a28;
  --text-secondary: #7a6a62;
  --text-muted: #aa9a92;
  --accent-primary: #ED6D52;
  --accent-primary-light: #f29078;
  --accent-pink: #f29078;
  --accent-rose: #f8b8a8;
  --accent-miku: #BADBF2;
  --accent-miku-light: #d0e8f8;
  --accent-miku-glow: rgba(186, 219, 242, 0.2);
  --accent-tag-bg: rgba(237, 109, 82, 0.08);
  --accent-gothic: #8a9ab8;
  --accent-gothic-light: #a8b8d0;
  --accent-blood: #b08070;
  --accent-secondary: #5a98c8;
  --accent-secondary-glow: rgba(90, 152, 200, 0.2);
  --accent-miku-alt: #ED6D52;
  --accent-miku-alt-light: #f29078;
  --border-light: rgba(237, 109, 82, 0.15);
  --border-hover: rgba(237, 109, 82, 0.35);
}
[data-color-scheme="coral"][data-theme="dark"] {
  --bg-primary: #1a1410;
  --bg-secondary: #201a14;
  --bg-card: rgba(40, 30, 24, 0.6);
  --nav-bg: rgba(26, 20, 16, 0.9);
  --bg-card-hover: rgba(52, 40, 32, 0.7);
  --text-primary: #e0d8d0;
  --text-secondary: #b0a090;
  --text-muted: #807060;
  --accent-primary: #f08068;
  --accent-primary-light: #f4a090;
  --accent-pink: #f4a090;
  --accent-rose: #f8c8b8;
  --accent-miku: #c8e0f4;
  --accent-miku-light: #dceaf8;
  --accent-miku-glow: rgba(200, 224, 244, 0.12);
  --accent-tag-bg: rgba(237, 109, 82, 0.1);
  --accent-gothic: #a0b0c8;
  --accent-gothic-light: #b8c8e0;
  --accent-blood: #d89888;
  --accent-secondary: #78b0d8;
  --accent-secondary-glow: rgba(120, 176, 216, 0.12);
  --accent-miku-alt: #f08068;
  --accent-miku-alt-light: #f4a090;
  --border-light: rgba(240, 128, 104, 0.12);
  --border-hover: rgba(240, 128, 104, 0.3);
}

/* ===== COLOR SCHEME: Deep Night ===== */
[data-color-scheme="night"] {
  --bg-primary: #f5f6fa;
  --bg-secondary: #eef0f5;
  --bg-card: rgba(255, 255, 255, 0.7);
  --nav-bg: rgba(245, 246, 250, 0.9);
  --bg-card-hover: rgba(255, 255, 255, 0.85);
  --text-primary: #1a1a2e;
  --text-secondary: #5a5a7a;
  --text-muted: #8a8aaa;
  --accent-primary: #3a5a9a;
  --accent-primary-light: #4a6ab0;
  --accent-pink: #4a6ab0;
  --accent-rose: #7a8ac0;
  --accent-miku: #001E44;
  --accent-miku-light: #1a3a6a;
  --accent-miku-glow: rgba(0, 30, 68, 0.1);
  --accent-tag-bg: rgba(58, 90, 154, 0.06);
  --accent-gothic: #6a4a8a;
  --accent-gothic-light: #8a6aa8;
  --accent-blood: #7a4060;
  --accent-secondary: #46266E;
  --accent-secondary-glow: rgba(70, 38, 110, 0.12);
  --accent-miku-alt: #6a4a8a;
  --accent-miku-alt-light: #8a6aa8;
  --border-light: rgba(0, 30, 68, 0.1);
  --border-hover: rgba(0, 30, 68, 0.25);
  --shadow-soft: 0 4px 20px rgba(0, 30, 68, 0.06);
  --shadow-card: 0 2px 8px rgba(0, 30, 68, 0.04);
  --shadow-hover: 0 8px 28px rgba(0, 30, 68, 0.1);
}
[data-color-scheme="night"][data-theme="dark"] {
  --bg-primary: #0a0a1a;
  --bg-secondary: #0e0e22;
  --bg-card: rgba(16, 16, 36, 0.6);
  --nav-bg: rgba(10, 10, 26, 0.9);
  --bg-card-hover: rgba(22, 22, 48, 0.7);
  --text-primary: #d0d0e8;
  --text-secondary: #a0a0c8;
  --text-muted: #6a6a8a;
  --accent-primary: #4a6ab0;
  --accent-primary-light: #6a8ac8;
  --accent-pink: #6a8ac8;
  --accent-rose: #8a9ad0;
  --accent-miku: #1a3a6a;
  --accent-miku-light: #2a5090;
  --accent-miku-glow: rgba(0, 30, 68, 0.15);
  --accent-tag-bg: rgba(58, 90, 154, 0.1);
  --accent-gothic: #7a4ea8;
  --accent-gothic-light: #9a70c0;
  --accent-blood: #a86888;
  --accent-secondary: #5a3888;
  --accent-secondary-glow: rgba(90, 56, 136, 0.15);
  --accent-miku-alt: #7a4ea8;
  --accent-miku-alt-light: #9a70c0;
  --border-light: rgba(0, 30, 68, 0.2);
  --border-hover: rgba(106, 62, 150, 0.35);
  --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 8px 28px rgba(0, 0, 0, 0.45);
}

/* ===== COLOR SCHEME: Mono Ink ===== */
[data-color-scheme="mono"] {
  --bg-primary: #fefefe;
  --bg-secondary: #f6f6f6;
  --bg-card: rgba(255, 255, 255, 0.7);
  --nav-bg: rgba(254, 254, 254, 0.9);
  --bg-card-hover: rgba(255, 255, 255, 0.85);
  --text-primary: #111111;
  --text-secondary: #555555;
  --text-muted: #999999;
  --accent-primary: #222222;
  --accent-primary-light: #444444;
  --accent-pink: #444444;
  --accent-rose: #666666;
  --accent-miku: #222222;
  --accent-miku-light: #444444;
  --accent-miku-glow: rgba(34, 34, 34, 0.08);
  --accent-tag-bg: rgba(34, 34, 34, 0.06);
  --accent-gothic: #555555;
  --accent-gothic-light: #777777;
  --accent-blood: #666666;
  --accent-secondary: #111111;
  --accent-secondary-glow: rgba(17, 17, 17, 0.06);
  --accent-miku-alt: #555555;
  --accent-miku-alt-light: #777777;
  --border-light: rgba(34, 34, 34, 0.1);
  --border-hover: rgba(34, 34, 34, 0.25);
}
[data-color-scheme="mono"][data-theme="dark"] {
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-card: rgba(22, 22, 22, 0.6);
  --nav-bg: rgba(10, 10, 10, 0.9);
  --bg-card-hover: rgba(34, 34, 34, 0.7);
  --text-primary: #e8e8e8;
  --text-secondary: #aaaaaa;
  --text-muted: #777777;
  --accent-primary: #cccccc;
  --accent-primary-light: #dddddd;
  --accent-pink: #dddddd;
  --accent-rose: #bbbbbb;
  --accent-miku: #cccccc;
  --accent-miku-light: #dddddd;
  --accent-miku-glow: rgba(200, 200, 200, 0.08);
  --accent-tag-bg: rgba(200, 200, 200, 0.08);
  --accent-gothic: #aaaaaa;
  --accent-gothic-light: #bbbbbb;
  --accent-blood: #999999;
  --accent-secondary: #aaaaaa;
  --accent-secondary-glow: rgba(170, 170, 170, 0.08);
  --accent-miku-alt: #aaaaaa;
  --accent-miku-alt-light: #bbbbbb;
  --border-light: rgba(200, 200, 200, 0.1);
  --border-hover: rgba(200, 200, 200, 0.25);
  --shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.3);
  --shadow-card: 0 1px 4px rgba(0, 0, 0, 0.2);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.35);
}

/* Text selection - themed highlight */
::selection {
  background: color-mix(in srgb, var(--accent-primary) 12%, transparent);
  color: inherit;
}
select::-moz-selection {
  background: color-mix(in srgb, var(--accent-primary) 12%, transparent);
  color: inherit;
}
/* Select option highlight - themed */
select option {
  background: var(--bg-card);
  color: var(--text-primary);
}
select option:hover,
select option:checked,
select option:active {
  background: color-mix(in srgb, var(--accent-primary) 20%, var(--bg-card));
  color: var(--text-primary);
}

/* Dark theme - specific element overrides */
[data-theme="dark"] .reader-chapter-title { color: var(--text-primary); border-bottom-color: var(--border-light); }
[data-theme="dark"] .reader-preface-block { color: var(--text-muted); border-bottom-color: var(--border-light); }
[data-theme="dark"] .novel-item { background: var(--bg-card); border-color: var(--border-light); }
[data-theme="dark"] .hero-section { background: var(--bg-card); border-color: var(--border-light); }
[data-theme="dark"] .social-link { color: var(--text-secondary); border-color: var(--border-light); }
[data-theme="dark"] .social-link:hover { color: var(--accent-primary); border-color: var(--accent-primary); }
[data-theme="dark"] .timeline-item { color: var(--text-primary); }
[data-theme="dark"] .timeline-item::before { border-color: var(--bg-primary); }
[data-theme="dark"] .reader-content p { color: var(--text-primary); }

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* Global link style - GitHub blue */
a { color: var(--accent-primary); text-decoration: none; }

/* Custom Cursor - .cur format for cross-browser support (.ani only works in IE)
   Two Miku cursor sets: Normal Miku for light theme, Snow Miku for dark theme */
:root {
  --cursor-arrow: url('cursors/miku/Arrow.cur') 6 0, auto;
  --cursor-link: url('cursors/miku/Link.cur') 6 0, pointer;
  --cursor-text: url('cursors/miku/IBeam.cur') 15 15, text;
  --cursor-wait: url('cursors/miku/Wait.cur') 16 16, wait;
}
[data-theme="dark"] {
  --cursor-arrow: url('cursors/snowmiku/Arrow.cur') 6 0, auto;
  --cursor-link: url('cursors/snowmiku/Link.cur') 6 0, pointer;
  --cursor-text: url('cursors/miku/IBeam.cur') 15 15, text;
  --cursor-wait: url('cursors/snowmiku/Wait.cur') 16 16, wait;
}
@media (hover: hover) and (pointer: fine) {
  html { cursor: var(--cursor-arrow); }
  a, button, [onclick], select, input[type="submit"], .nav-btn, .scheme-option,
  .category-card, .novel-card, .link-card, .interest-card, .back-to-top,
  .theme-toggle, .admin-toggle, .color-scheme-toggle, .settings-btn, .sort-btn,
  .reader-nav-btn, .timeline-item, .social-link, .admin-tab, .select-trigger,
  .select-option, .back-btn, .admin-small-btn { cursor: var(--cursor-link); }
  input[type="text"], input[type="password"], input[type="url"], textarea,
  [contenteditable="true"] { cursor: var(--cursor-text); }
  .loading-overlay { cursor: var(--cursor-wait); }
}

html { scroll-behavior: smooth; }
* { box-sizing: border-box; }
body {
  font-family: var(--font-serif);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.8;
  min-height: 100vh;
  overflow-x: clip;
  transition: background 0.3s ease, color 0.3s ease;
  position: relative;
}

/* Dot pattern - single color by default, dual for coral & night */
body::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    radial-gradient(circle, var(--accent-primary) 1.5px, transparent 1.5px),
    radial-gradient(circle, var(--accent-primary) 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  /* 百分比定位使棋盘相位以视口（即居中内容）为对称轴，两层相差 12px 保持棋盘错位 */
  background-position: 50% 50%, calc(50% + 12px) calc(50% + 12px);
  pointer-events: none;
  z-index: -1;
  opacity: 0.06;
  transition: opacity 0.3s ease;
}

[data-theme="dark"] body::before {
  opacity: 0.10;
}

/* Night dark: override dot colors to brighter versions for visibility */
[data-color-scheme="night"][data-theme="dark"] body::before {
  opacity: 0.12;
  background-image:
    radial-gradient(circle, #6a8ac8 1.5px, transparent 1.5px),
    radial-gradient(circle, #8a5ab8 1.5px, transparent 1.5px);
}

/* Miku light & Coral light: need stronger dot opacity */
[data-color-scheme="miku"]:not([data-theme="dark"]) body::before,
[data-color-scheme="coral"]:not([data-theme="dark"]) body::before {
  opacity: 0.12;
}

/* Dual-color dot pattern for coral & night */
[data-color-scheme="coral"] body::before,
[data-color-scheme="night"] body::before {
  background-image:
    radial-gradient(circle, var(--accent-primary) 1.5px, transparent 1.5px),
    radial-gradient(circle, var(--accent-secondary) 1.5px, transparent 1.5px);
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Gothic border decoration with lace effect */
.lace-border {
  position: relative;
  border: 1px solid var(--border-light);
}
.lace-border::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 0;
  right: 0;
  height: 4px;
  background-image:
    radial-gradient(circle at 0 4px, transparent 3px, var(--accent-primary) 3px, var(--accent-primary) 4px, transparent 4px),
    radial-gradient(circle at 8px 4px, transparent 3px, var(--accent-primary) 3px, var(--accent-primary) 4px, transparent 4px),
    radial-gradient(circle at 16px 4px, transparent 3px, var(--accent-primary) 3px, var(--accent-primary) 4px, transparent 4px);
  background-size: 16px 4px;
  background-repeat: repeat-x;
  opacity: 0.4;
}
.lace-border::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 4px;
  background-image:
    radial-gradient(circle at 0 0, transparent 3px, var(--accent-primary) 3px, var(--accent-primary) 4px, transparent 4px),
    radial-gradient(circle at 8px 0, transparent 3px, var(--accent-primary) 3px, var(--accent-primary) 4px, transparent 4px),
    radial-gradient(circle at 16px 0, transparent 3px, var(--accent-primary) 3px, var(--accent-primary) 4px, transparent 4px);
  background-size: 16px 4px;
  background-repeat: repeat-x;
  opacity: 0.4;
}

/* Corner gothic cross decoration */
.rose-corner {
  position: relative;
}
.rose-corner::before {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 14px;
  height: 14px;
  opacity: 0.6;
  border: 2px solid var(--accent-primary);
}
.rose-corner::after {
  content: '';
  position: absolute;
  top: 10px;
  right: 10px;
  width: 6px;
  height: 6px;
  opacity: 0.6;
  border: 2px solid var(--accent-primary);
  border-radius: var(--radius-sm);
}

/* Theme Toggle */
.theme-toggle {
  width: 40px; height: 40px;
  border: 1px solid var(--border-light);
  background: var(--bg-card); color: var(--text-secondary);
  font-size: 1rem; cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--accent-primary); color: var(--accent-primary); }

/* Top Toolbar */
.top-toolbar {
  position: fixed; top: var(--space-base); right: var(--space-base); z-index: 1000;
  display: flex; gap: var(--gap-compact); align-items: center;
  transition: transform 0.3s ease;
}

/* Color Scheme Dropdown */
.color-scheme-dropdown { position: relative; flex-shrink: 0; }
.color-scheme-toggle {
  width: 40px; height: 40px;
  border: 1px solid var(--border-light);
  background: var(--bg-card); color: var(--text-secondary);
  font-size: 1rem; cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.color-scheme-toggle:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
.scheme-current-dot {
  display: block; width: 14px; height: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(128,128,128,0.15);
}
.color-scheme-menu {
  display: block;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px) scale(0.96);
  position: absolute;
  top: 44px;
  right: 0;
  background: var(--bg-popover);
  border: 1px solid var(--border-light);
  z-index: 1001;
  min-width: 110px;
  padding: 4px;
  box-shadow: var(--shadow-hover);
  border-radius: var(--radius-sm);
  transition: opacity 0.2s var(--ease-out), transform 0.25s var(--ease-spring), visibility 0.2s;
}
.color-scheme-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.scheme-option {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: var(--space-sm) var(--space-md);
  background: transparent; border: none;
  cursor: pointer; transition: var(--transition);
  font-family: var(--font-serif); font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: left;
  border-radius: var(--radius-sm);
}
.scheme-option:hover { background: var(--accent-miku-glow); color: var(--text-primary); }
.scheme-option.active { color: var(--accent-primary); font-weight: 700; }
.scheme-dot {
  display: inline-block; width: 12px; height: 12px;
  border-radius: 50%; flex-shrink: 0;
  border: 1.5px solid rgba(128,128,128,0.15);
}

/* Admin Toggle */
.admin-toggle {
  width: 40px; height: 40px;
  border: 1px solid var(--border-light);
  background: var(--bg-card); color: var(--text-secondary);
  font-size: 0.875rem; cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.admin-toggle:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
.admin-toggle.active { background: var(--accent-primary); color: white; border-color: var(--accent-primary); }


/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  border-radius: var(--radius-sm);
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-to-top:hover {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* Layout */
.app-container { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; padding: 0 var(--space-xl); }

/* Header - Gothic Cathedral Style */
.site-header { text-align: center; padding: 60px 0 30px; position: relative; display: flex; flex-direction: column; align-items: center; }

.site-title { font-family: var(--font-display); font-size: 3rem; color: var(--text-primary); letter-spacing: 10px; position: relative; display: flex; align-items: center; justify-content: center; font-weight: 700; }
/* Kinetic Text - dynamic font-weight on hover */
.site-title.kinetic-text span {
  display: inline-block;
  font-weight: 700;
  transition: font-weight 0.3s ease, color 0.3s ease;
  cursor: default;
}
.site-title.kinetic-text span:hover {
  font-weight: 900;
  color: var(--accent-primary);
}
.site-title .star-left, .site-title .star-right { position: absolute; top: 50%; transform: translateY(-50%); font-size: 0.625rem; color: var(--accent-primary); opacity: 0.5; animation: twinkle 2s ease-in-out infinite; }
.site-title .star-left { left: -24px; animation-delay: 0s; }
.site-title .star-right { right: -24px; animation-delay: 1s; }
@keyframes twinkle {
  0%, 100% { opacity: 0.3; transform: translateY(-50%) scale(0.8); }
  50% { opacity: 0.8; transform: translateY(-50%) scale(1.2); }
}
.site-subtitle { font-size: 0.75rem; color: var(--text-muted); letter-spacing: 6px; text-transform: uppercase; display: block; text-align: center; margin-bottom: 0; padding-left: 6px; }
/* letter-spacing 会在末字符后产生尾部余量，导致整行视觉左偏；用负 margin / padding 补偿居中 */
.site-title span:last-child { margin-right: -10px; }
.site-divider {
  width: 60px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
  background-size: 200% 100%;
  animation: dividerGlow 3s ease-in-out infinite;
  margin: 16px auto 0;
  opacity: 0.5;
  transition: var(--transition);
  flex-shrink: 0;
}
@keyframes dividerGlow {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Navigation with star-moon divider */
.nav-bar { display: flex; justify-content: center; gap: var(--gap-compact); padding: var(--space-md) 0; margin-bottom: var(--space-2xl); flex-wrap: wrap; position: relative; }
.nav-bar::after {
  content: '\2727  \263E  \2727';
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: var(--accent-primary);
  opacity: 0.35;
  letter-spacing: 6px;
  white-space: pre;
}
.nav-btn {
  padding: 6px 16px;
  width: 5rem;
  text-align: center;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-serif);
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.nav-btn::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 50%; width: 0; height: 1px;
  background: var(--accent-primary);
  transition: var(--transition);
  transform: translateX(-50%);
}
.nav-btn:hover { color: var(--text-primary); }
.nav-btn:hover::after { width: 80%; }
.nav-btn.active { color: var(--accent-primary); }
.nav-btn.active::after { width: 80%; }

/* Page Sections */
.page { display: none; opacity: 0; transform: translateY(20px) scale(0.98); outline: none !important; }
/* transform:none — identity transform would hijack position:fixed dropdown portal */
.page.active { display: block; opacity: 1; transform: none; }

/* View Transitions API - pure crossfade between pages */
::view-transition-old(root) {
  animation: vt-fade-out 0.2s ease both;
}
::view-transition-new(root) {
  animation: vt-fade-in 0.2s ease 0.05s both;
}
/* Color scheme view transition (slightly longer for smooth color morph) */
::view-transition-old(color-scheme) {
  animation: vt-fade-out 0.3s ease both;
}
::view-transition-new(color-scheme) {
  animation: vt-fade-in 0.3s ease both;
}
@keyframes vt-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes vt-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

/* Staggered fade-in for lists */
@keyframes staggerFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Scroll reveal */
.scroll-reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.scroll-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
/* Staggered scroll reveal delays */
.scroll-reveal-d1 { transition-delay: 0.1s; }
.scroll-reveal-d2 { transition-delay: 0.2s; }
.scroll-reveal-d3 { transition-delay: 0.3s; }
.scroll-reveal-d4 { transition-delay: 0.4s; }
.scroll-reveal-d5 { transition-delay: 0.5s; }

/* Floating decorative elements */
.floating-deco {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  opacity: 0.15;
  animation: float 6s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(10deg); }
}

/* Glow pulse animation for accent elements */
.glow-pulse {
  animation: glowPulse 3s ease-in-out infinite;
}
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 5px rgba(122, 158, 138, 0.2); }
  50% { box-shadow: 0 0 20px rgba(122, 158, 138, 0.4), 0 0 40px rgba(122, 158, 138, 0.2); }
}

/* Shimmer effect for titles */
.shimmer {
  position: relative;
  overflow: hidden;
}
.shimmer::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(122, 158, 138, 0.1), transparent);
  animation: shimmer 4s ease-in-out infinite;
}
@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 200%; }
}

/* Bounce in animation */
@keyframes bounceIn {
  0% { opacity: 0; transform: scale(0.3); }
  50% { transform: scale(1.05); }
  70% { transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1); }
}

/* Rotate decoration */
@keyframes slowRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ===== NEW ANIMATIONS ===== */

/* Nav button ripple effect */
.nav-btn { overflow: hidden; }
.nav-btn::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 0; height: 0;
  background: var(--accent-primary);
  opacity: 0.1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.3s ease, height 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
}
.nav-btn:hover::before {
  width: 120px; height: 120px;
  opacity: 0.06;
}

/* Avatar hover animation (黑喵子) - card-style lift, same as category card */
.hero-avatar, .about-avatar { transition: transform 0.3s var(--ease-spring-sm), box-shadow 0.3s ease, border-color 0.3s ease; }
.hero-avatar:hover, .about-header-card .about-avatar:hover { transform: translateY(-2px); border-color: var(--accent-primary); box-shadow: 0 4px 20px var(--accent-miku-glow); }

/* Stat number count-up animation */
.stat-number {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

/* Category card tilt effect */
.category-card { transition: transform 0.3s var(--ease-spring), border-color 0.3s ease, box-shadow 0.3s ease; }

/* Floating particles background */
.bg-particles {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.bg-particle {
  position: absolute;
  width: 4px; height: 4px;
  background: var(--accent-primary);
  opacity: 0;
  border-radius: 50%;
  animation: particleFloat linear infinite;
}
@keyframes particleFloat {
  0% { opacity: 0; transform: translateY(100vh) scale(0); }
  10% { opacity: 0.15; }
  90% { opacity: 0.15; }
  100% { opacity: 0; transform: translateY(-10vh) scale(1); }
}

/* Social link hover bounce */
.social-link { transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.3s ease, border-color 0.3s ease; }
.social-link:hover { transform: translateY(-2px); }

/* Tag hover color fill */
.novel-tag:nth-child(even) {
  color: var(--accent-secondary, var(--accent-primary));
  background: var(--accent-secondary-glow, rgba(122, 158, 138, 0.06));
}
/* Darken secondary color for readability on light backgrounds */
[data-color-scheme="coral"] .novel-tag:nth-child(even) {
  color: #7aadd0;
  background: rgba(186, 219, 242, 0.15);
}
[data-color-scheme="night"] .novel-tag:nth-child(even) {
  color: #6a4a8a;
  background: rgba(70, 38, 110, 0.08);
}
[data-color-scheme="mono"] .novel-tag:nth-child(even) {
  color: #666;
  background: rgba(200, 200, 200, 0.1);
}
[data-color-scheme="mono"][data-theme="dark"] .novel-tag:nth-child(even) {
  color: #aaa;
  background: rgba(80, 80, 80, 0.2);
}
.novel-tag {
  transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease;
}
.novel-tag:hover {
  transform: scale(1.05);
}

/* Reader page fade transition */
.reader-content { transition: opacity 0.3s ease; }
.reader-content.turning { opacity: 0; }
/* Slider preset animation: smooth font-size/line-height transition (no per-frame reflow) */
.reader-content.reader-slider-animating { transition: opacity 0.3s ease, font-size 0.3s ease, line-height 0.3s ease; }

/* Scroll progress indicator */
.scroll-progress {
  position: fixed;
  top: 0; left: 0; height: 2px;
  background: var(--accent-primary);
  z-index: 9999;
  transition: width 0.1s linear;
  opacity: 0.6;
}

/* Random article button - consistent with nav buttons */
.random-btn { font-size: 1rem; }
.random-btn .music-notes { display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.random-btn:hover { color: var(--text-primary); }
.random-btn:hover::after { width: 80%; }

/* Back to top button appear animation */
.back-to-top {
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0.3s ease;
}
.back-to-top.visible {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
}

/* Footer link hover underline animation */
.footer-link {
  position: relative;
  display: inline-block;
}
.footer-link::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 0; height: 1px;
  background: var(--accent-primary);
  transition: width 0.3s ease;
}
.footer-link:hover::after {
  width: 100%;
}

/* Search input focus glow */

/* ===== END NEW ANIMATIONS ===== */

/* Active press feedback — 标准控件档（0.98） */
button:active,
.nav-btn:active,
.scheme-option:active,
.admin-btn:active,
.sort-btn:active,
.author-chip:active,
.reader-nav-btn:active,
.back-btn:active,
.back-to-top:active,
.social-link:active {
  transform: scale(0.98) !important;
  transition: transform 0.1s var(--ease-spring-sm) !important;
}
/* Active press feedback — 大尺寸/通栏元素档（0.99，宽元素视觉收缩更明显，按压幅度更小） */
.category-card:active,
.custom-select .select-trigger:active {
  transform: scale(0.99) !important;
  transition: transform 0.1s var(--ease-spring-sm) !important;
}

/* Search */
.search-container { max-width: 500px; margin: 0 auto var(--space-2xl); position: relative; }
.search-input {
  width: 100%; padding: var(--space-md) 50px var(--space-md) var(--space-lg); border: 1px solid var(--border-light);
  background: var(--bg-card); color: var(--text-primary); font-family: var(--font-serif);
  font-size: 1rem; transition: var(--transition);
  border-radius: var(--radius-sm);
}
.search-input:focus { outline: none; border-color: var(--accent-primary); box-shadow: 0 2px 12px color-mix(in srgb, var(--accent-primary) 20%, transparent); }
.search-input::placeholder { color: var(--text-muted); }
.search-icon { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; padding: 0; border: none; background: none; color: var(--text-muted); display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: var(--radius-sm); transition: var(--transition); }
.search-icon:hover { color: var(--accent-primary); }
/* 抵消全局 button:active 的 scale，避免覆盖 translateY(-50%) 导致按钮下跳 */
.search-icon:active { transform: translateY(-50%) !important; }

.search-results {
  display: block;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
  max-height: 400px; overflow-y: auto;
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08); margin-top: 4px;
  transition: opacity 0.2s var(--ease-out), transform 0.25s var(--ease-spring), visibility 0.2s;
}
.search-results.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.search-result-item {
  padding: var(--space-md) var(--space-lg); border-bottom: 1px solid var(--border-light); cursor: pointer;
  transition: background 0.2s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-primary); }
.search-result-item h4 { font-size: 0.875rem; margin-bottom: 2px; }
.search-result-item p { font-size: 0.75rem; color: var(--text-muted); }
.search-result-item .highlight { color: var(--accent-primary); background: color-mix(in srgb, var(--accent-primary) 12%, transparent); padding: 1px 3px; border-radius: 0; }
.search-empty { padding: var(--space-xl); font-size: 0.875rem; text-align: center; }

/* Hero Section */
.hero-section { background: var(--bg-card); border: 1px solid var(--border-light); padding: var(--space-xl); margin-bottom: var(--space-2xl); display: flex; gap: var(--space-xl); align-items: center; transition: var(--transition); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5); }
.hero-section:hover { border-color: var(--border-hover); }
.hero-avatar { width: 100px; height: 100px; flex-shrink: 0; object-fit: cover; border: 1px solid var(--border-light); border-radius: var(--radius-sm); display: block; }
.hero-content { flex: 1; }
.hero-content h2 { font-family: var(--font-display); font-size: 1.5rem; color: var(--text-primary); margin-top: 0; margin-bottom: var(--space-sm); }
.hero-content p { color: var(--text-secondary); font-size: 0.875rem; line-height: 1.8; margin-top: 0; margin-bottom: var(--space-base); }
.hero-tags { display: flex; flex-wrap: wrap; gap: var(--gap-compact); }
.hero-tag { padding: 4px 12px; border: 1px solid var(--border-light); font-size: 0.75rem; color: var(--text-muted); transition: var(--transition); border-radius: var(--radius-sm); }
.hero-tag:hover { border-color: var(--border-hover); }

/* Stats Row */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-base); margin-bottom: var(--space-2xl); }
.stat-item { background: var(--bg-card); border: 1px solid var(--border-light); padding: var(--space-lg); text-align: center; transition: var(--transition); border-radius: var(--radius-sm); }
.stat-item:hover { border-color: var(--border-hover); }
.stat-number { font-family: var(--font-display); font-size: 1.75rem; color: var(--accent-miku); font-weight: 700; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); letter-spacing: 1px; }

/* Section Title with cross decoration */
.section-title { font-family: var(--font-display); font-size: 1.25rem; color: var(--text-primary); margin-top: 0; margin-bottom: var(--space-lg); padding-left: var(--space-md); border-left: 2px solid var(--accent-primary); position: relative; letter-spacing: 2px; }
.section-title::after {
  content: '\2727';
  position: absolute;
  top: 2px;
  right: 0;
  font-size: 0.625rem;
  color: var(--accent-primary);
  opacity: 0.35;
  font-family: var(--font-serif);
}


/* Category Grid */
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-xl); margin-bottom: var(--space-3xl); }
.category-card {
  background: var(--bg-card); border: 1px solid var(--border-light);
  padding: 0;
  cursor: pointer; transition: var(--transition);
  overflow: hidden; position: relative;
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5);
}
.category-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-primary);
  box-shadow: 0 4px 20px var(--accent-miku-glow);
}
.category-card:hover .category-image { transform: scale(1.03); }
.category-image { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; transition: transform 0.3s ease; display: block; }
.category-body { padding: var(--space-base) var(--space-lg) var(--space-lg); }
.category-name { font-family: var(--font-display); font-size: 1.125rem; color: var(--text-primary); margin-top: 0; margin-bottom: var(--space-xs); transition: color 0.3s; }
.category-card:hover .category-name { color: var(--accent-primary); }
.category-desc { font-size: 0.75rem; color: var(--text-muted); margin-top: 0; margin-bottom: var(--space-md); }
.category-footer { display: flex; justify-content: space-between; align-items: center; padding-top: var(--space-md); border-top: 1px solid var(--border-light); }
.category-count { font-size: 0.75rem; color: var(--text-muted); }
.category-arrow { color: var(--text-muted); transition: var(--transition); opacity: 0.4; display: flex; align-items: center; }
.category-card:hover .category-arrow { opacity: 1; color: var(--accent-primary); transform: translateX(4px); }

/* Category Page with Header Image */
.category-hero { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; margin-top: 0; margin-bottom: var(--space-lg); border: 1px solid var(--border-light); border-radius: var(--radius-sm); }
.category-hero-fallback {
  width: 100%; aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--accent-primary-light), var(--accent-rose), var(--accent-primary));
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem; color: white; opacity: 0.5;
  margin-top: 0; margin-bottom: var(--space-lg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

/* Sidebar Layout */
.content-with-sidebar { display: flex; gap: var(--space-xl); }
.main-content { flex: 1; min-width: 0; }
.sidebar { width: 240px; flex-shrink: 0; }

/* Sidebar Widgets */
.sidebar-widget {
  background: var(--bg-card); border: 1px solid var(--border-light);
  padding: var(--space-lg); margin-top: 0; margin-bottom: var(--space-lg);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.sidebar-widget:hover { border-color: var(--border-hover); }
.sidebar-widget h4 {
  font-family: var(--font-display); font-size: 1rem; color: var(--text-primary);
  margin-top: 0; margin-bottom: var(--space-md); padding-bottom: var(--space-sm); border-bottom: 1px solid var(--border-light);
}
.sidebar-widget ul { list-style: none; }
.sidebar-widget li { padding: 6px 0; font-size: 0.875rem; color: var(--text-secondary); cursor: pointer; transition: var(--transition); border-bottom: 1px dashed var(--border-light); }
.sidebar-widget li:last-child { border-bottom: none; }
.sidebar-widget li:hover { color: var(--accent-primary); padding-left: 6px; }
.sidebar-widget .widget-count { float: right; font-size: 0.75rem; color: var(--text-muted); }

/* Author Filter */
.author-filter { display: flex; flex-wrap: wrap; gap: var(--gap-compact); margin-bottom: var(--space-sm); align-items: center; padding: var(--space-md) 0; border-bottom: 1px solid var(--border-light); }
.author-chip {
  padding: 5px 14px; border: 1px solid var(--border-light); background: transparent;
  color: var(--text-muted); font-size: 0.75rem; cursor: pointer; transition: var(--transition);
  border-radius: var(--radius-sm);
}
.author-chip:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
.author-chip.active { background: var(--accent-primary); color: white; border-color: var(--accent-primary); }

/* Page Header */
.page-header { text-align: center; padding: var(--space-md) 0 var(--space-xl); }
.page-header h2 { font-family: var(--font-display); font-size: 1.75rem; color: var(--text-primary); margin-top: 0; margin-bottom: 6px; }
.page-header p { color: var(--text-muted); font-size: 0.875rem; }

/* Sort Bar */
.sort-bar { display: flex; align-items: center; margin-top: 0; margin-bottom: var(--space-lg); padding: var(--space-md) 0; border-bottom: 1px solid var(--border-light); flex-wrap: wrap; gap: var(--gap-compact); }
.sort-label { font-size: 0.75rem; color: var(--text-muted); margin-right: 4px; }
.sort-btn { padding: 5px 14px; border: 1px solid var(--border-light); background: transparent; color: var(--text-muted); font-size: 0.75rem; cursor: pointer; transition: var(--transition); border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.sort-btn:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
.sort-order-btn { margin-left: auto; font-size: 0.75rem; opacity: 0.7; }
.sort-order-btn:hover { opacity: 1; }
.sort-btn.active { background: var(--accent-primary); color: white; border-color: var(--accent-primary); }

/* Novel List */
.novel-list { display: flex; flex-direction: column; gap: var(--space-md); padding-bottom: 60px; }
.novel-item {
  background: var(--bg-card); border: 1px solid var(--border-light);
  padding: var(--space-base) var(--space-lg); cursor: pointer; transition: var(--transition);
  display: flex; gap: var(--space-base); align-items: center;
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.novel-item:hover {
  transform: translateX(4px);
  border-color: var(--accent-primary);
  box-shadow: 0 2px 12px var(--accent-miku-glow);
}
.novel-item:hover .novel-number { background: var(--accent-primary); color: white; border-color: var(--accent-primary); }
.novel-item:hover .novel-arrow { transform: translateX(6px); opacity: 1; }
.novel-item:hover .novel-title { color: var(--accent-primary); }
.novel-number { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; font-size: 0.875rem; color: var(--accent-primary); border: 1px solid var(--border-light); flex-shrink: 0; transition: var(--transition); border-radius: var(--radius-sm); }
.novel-info { flex: 1; }
.novel-title { font-size: 1.125rem; color: var(--text-primary); margin-top: 0; margin-bottom: var(--space-xs); font-weight: 500; transition: color 0.3s; line-height: 1.5; word-break: break-all; }
.novel-author { font-size: 0.75rem; color: var(--accent-pink); margin-top: 0; margin-bottom: var(--space-xs); }
.novel-meta { font-size: 0.75rem; color: var(--text-muted); display: flex; gap: 14px; flex-wrap: wrap; }
.novel-tags { display: flex; gap: 6px; margin-top: var(--space-sm); flex-wrap: wrap; }
.novel-tag { padding: 2px 8px; background: var(--accent-tag-bg, rgba(122, 158, 138, 0.06)); font-size: 0.75rem; color: var(--accent-primary); }
.novel-arrow { color: var(--text-muted); display: flex; align-items: center; transition: var(--transition); opacity: 0.3; align-self: center; }
.novel-item:hover .novel-arrow { opacity: 1; color: var(--accent-primary); }

/* Reading progress badge on novel list */
.read-progress-badge {
  font-size: 0.75rem;
  color: var(--accent-primary);
  background: rgba(122, 158, 138, 0.08);
  padding: 2px 8px;
  margin-left: 8px;
  border-radius: var(--radius-sm);
}

/* Reader Page */
.reader-container { max-width: 680px; margin: 0 auto; padding: var(--space-md) 0 80px; }
.reader-header { text-align: center; padding: var(--space-lg) 0 var(--space-xl); border-bottom: 1px solid var(--border-light); margin-top: 0; margin-bottom: var(--space-2xl); position: relative; display: flex; flex-direction: column; align-items: center; }
.reader-header .reader-deco-line {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
  opacity: 0.5;
}
.reader-category-tag { display: inline-block; padding: var(--space-xs) var(--space-md); border: 1px solid var(--border-light); font-size: 0.75rem; color: var(--accent-primary); margin-top: 0; margin-bottom: var(--space-md); letter-spacing: 1px; transition: var(--transition); cursor: pointer; border-radius: var(--radius-sm); }
.reader-category-tag:hover { background: var(--accent-primary); color: white; }
.reader-title { font-family: var(--font-display); font-size: 1.5rem; color: var(--text-primary); margin-top: 0; margin-bottom: var(--gap-compact); line-height: 1.6; word-break: break-all; max-width: 100%; }
.reader-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 0; }
.reader-author { font-size: 0.875rem; color: var(--accent-pink); margin-top: var(--space-xs); }
.heart-icon {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-top: none;
  border-right: none;
  transform: rotate(-45deg);
  margin-right: 4px;
  position: relative;
  vertical-align: middle;
}
.heart-icon::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  border-bottom: none;
  border-right: none;
  top: -6px;
  left: -1.5px;
}
.heart-icon::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  border-bottom: none;
  border-right: none;
  top: -1.5px;
  left: -7px;
}
.heart-icon.filled {
  background: currentColor;
  border-color: currentColor;
}
.heart-icon.filled::before, .heart-icon.filled::after {
  background: currentColor;
  border-color: currentColor;
}

/* Chapter title display in content area */
.reader-chapter-title {
  text-align: center;
  font-family: inherit;
  font-size: calc(var(--reader-font-size, 16px) * 1.25);
  color: var(--text-primary);
  margin-top: 0;
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-base);
  border-bottom: 1px solid var(--border-light);
  letter-spacing: 2px;
}
/* Preface/notes in content area (AO3 style) */
.reader-preface-block {
  margin-top: 0;
  margin-bottom: var(--space-xl);
  padding: var(--space-base) 0;
  border-bottom: 1px dashed var(--border-light);
  font-size: var(--reader-font-size);
  color: var(--text-secondary);
  line-height: var(--reader-line-height, 1.9);
  text-align: justify;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Reader Settings */
.reader-settings { background: var(--bg-card); border: 1px solid var(--border-light); margin-top: 0; margin-bottom: var(--space-lg); border-radius: var(--radius-sm); transition: var(--transition); }
.reader-settings:hover { border-color: var(--accent-primary); }
.settings-header { padding: var(--space-md) var(--space-base); display: flex; justify-content: space-between; align-items: center; cursor: pointer; transition: var(--transition); }
.settings-header:hover .settings-title,
.settings-header:hover .settings-toggle { color: var(--accent-primary); }
.settings-title { font-size: 0.875rem; color: var(--text-muted); }
.settings-toggle { color: var(--text-muted); font-size: 0.75rem; transition: transform 0.3s; }
.settings-panel {
  padding: 0 var(--space-base);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  border-top: 1px solid var(--border-light);
  transition: max-height 0.3s var(--ease-spring-sm), opacity 0.3s ease, padding 0.3s ease;
}
.settings-panel.active {
  max-height: 300px;
  opacity: 1;
  padding: var(--space-base);
}
.settings-row { display: flex; align-items: center; gap: var(--space-base); margin-top: 0; margin-bottom: var(--space-md); }
.settings-row:last-child { margin-bottom: 0; }
.settings-label { font-size: 0.75rem; color: var(--text-muted); width: 50px; flex-shrink: 0; }
.settings-select {
  flex: 1;
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-serif);
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
/* Custom select (themed dropdown, replaces native select UI) */
.custom-select { position: relative; flex: 1; min-width: 0; }
.admin-form-row .custom-select { width: 100%; flex: none; }
.select-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm); border: 1px solid var(--border-light);
  background: var(--bg-popover); color: var(--text-primary); font-family: var(--font-serif);
  font-size: 0.875rem; border-radius: var(--radius-sm); cursor: pointer; text-align: left;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.select-trigger:hover, .select-trigger[aria-expanded="true"] { border-color: var(--accent-primary); }
.select-trigger .ms-icon { transition: transform 0.2s ease; flex-shrink: 0; }
.select-trigger[aria-expanded="true"] .ms-icon { transform: rotate(180deg); }
.select-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-options {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 1200;
  max-height: 200px; overflow-y: auto; display: none;
  background: var(--bg-popover); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-card);
  scrollbar-width: none;
}
.select-options::-webkit-scrollbar { display: none; }
.custom-select.open .select-options { display: block; }
.select-option {
  display: block; width: 100%; padding: var(--space-sm) var(--space-md);
  background: transparent; border: none; color: var(--text-primary);
  font-family: var(--font-serif); font-size: 0.875rem; text-align: left; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.select-option:hover, .select-option.highlighted {
  background: color-mix(in srgb, var(--accent-primary) 15%, var(--bg-popover));
}
.select-option[aria-selected="true"] { color: var(--accent-primary); }
.native-hidden {
  position: absolute; width: 1px; height: 1px; margin: 0; padding: 0;
  border: 0; opacity: 0; pointer-events: none;
}
.settings-slider { flex: 1; -webkit-appearance: none; height: 4px; background: var(--border-light); outline: none; }
.settings-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; background: var(--accent-primary); cursor: pointer; border-radius: var(--radius-sm); }
.settings-value { font-size: 0.75rem; color: var(--accent-primary); width: 40px; text-align: right; }
.settings-btns { display: flex; gap: var(--gap-compact); margin-top: var(--space-md); padding-top: var(--space-md); border-top: 1px solid var(--border-light); }
.settings-btn { padding: var(--space-xs) var(--space-md); border: 1px solid var(--border-light); background: transparent; color: var(--text-muted); font-size: 0.75rem; cursor: pointer; transition: var(--transition); border-radius: var(--radius-sm); }
.settings-btn:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
.settings-btn.active { background: var(--accent-primary); color: white; border-color: var(--accent-primary); }

/* Reader Content - Fixed drop cap */
.reader-content {
  background: var(--bg-card); border: 1px solid var(--border-light);
  padding: 35px 38px; font-size: var(--reader-font-size);
  line-height: var(--reader-line-height); color: var(--text-primary); transition: var(--transition);
  border-radius: var(--radius-sm);
  text-align: justify;
}
.reader-content p { margin-bottom: 1em; text-indent: 2em; line-height: 1.9; text-align: justify; text-justify: inter-ideograph; }
.reader-content p:first-child { text-indent: 0; }
.reader-content p:first-child::first-letter {
  font-size: 1.6em;
  float: none;
  line-height: 1.3;
  margin-right: 0;
  margin-top: 0;
  font-family: var(--font-display);
  color: var(--accent-primary);
  font-weight: 700;
}
.reader-content p:first-child {
  border-left: 3px solid var(--accent-primary);
  padding-left: var(--space-md);
}

/* 章节管理区域（后台） */
.chapter-manager {
  margin-top: 0; margin-bottom: var(--space-base);
  padding: var(--space-md);
  border: 1px solid var(--border-light);
  background: var(--bg-secondary);
}
.chapter-manager-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0;
  margin-bottom: var(--space-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chapter-item {
  margin-top: 0; margin-bottom: var(--space-md);
  padding: var(--space-md);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  position: relative;
}
.chapter-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0;
  margin-bottom: var(--gap-compact);
}
.chapter-item-header span {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.chapter-item input[type="text"] {
  width: 100%;
  padding: 6px var(--space-md);
  border: 1px solid var(--border-light);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-serif);
  font-size: 0.875rem;
  margin-top: 0;
  margin-bottom: var(--gap-compact);
  border-radius: var(--radius-sm);
}
.chapter-item textarea {
  width: 100%;
  min-height: 100px;
  padding: var(--gap-compact) var(--space-md);
  border: 1px solid var(--border-light);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-serif);
  font-size: 0.875rem;
  resize: vertical;
  border-radius: var(--radius-sm);
}
.chapter-item input:focus, .chapter-item textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
}
.chapter-add-btn {
  padding: 6px var(--space-md);
  border: 1px dashed var(--border-hover);
  background: transparent;
  color: var(--accent-primary);
  font-family: var(--font-serif);
  font-size: 0.75rem;
  cursor: pointer;
  transition: var(--transition);
  border-radius: var(--radius-sm);
  width: 100%;
  text-align: center;
}
.chapter-add-btn:hover {
  border-color: var(--accent-primary);
  background: var(--bg-card);
}
.chapter-del-btn {
  padding: var(--space-xs) var(--gap-compact);
  border: 1px solid var(--text-muted);
  background: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  font-family: var(--font-serif);
  transition: var(--transition);
  border-radius: var(--radius-sm);
}
.chapter-del-btn:hover {
  border-color: var(--accent-blood);
  color: var(--accent-blood);
}

/* Reader Nav */
.reader-nav { display: flex; justify-content: space-between; align-items: center; margin-top: var(--space-xl); padding-top: var(--space-lg); border-top: 1px solid var(--border-light); page-break-inside: avoid; break-inside: avoid; }
.reader-nav-btn { padding: var(--space-sm) var(--space-xl); border: 1px solid var(--border-light); background: var(--bg-card); color: var(--text-secondary); font-family: var(--font-serif); font-size: 0.875rem; cursor: pointer; transition: var(--transition); letter-spacing: 0.5px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.reader-nav-btn:hover { background: var(--accent-primary); color: white; border-color: var(--accent-primary); }
/* 箭头图标视觉偏高，向下微调与文字居中对齐 */
.reader-nav-btn svg { transform: translateY(1px); }

/* ===== Admin Panel - Floating Drawer Style ===== */
.admin-drawer {
  position: fixed; top: 0; right: -820px; width: 800px; height: 100%;
  background: var(--bg-primary); border-left: 1px solid var(--border-light);
  z-index: 1500; transition: right 0.3s ease, visibility 0.3s ease;
  overflow-y: auto;
  box-shadow: -8px 0 32px rgba(0,0,0,0.1);
  visibility: hidden;
}
.admin-drawer.active { right: 0; visibility: visible; }
.admin-drawer-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.3); z-index: 1400;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.admin-drawer-overlay.active {
  opacity: 1;
  visibility: visible;
}
.admin-drawer-header {
  padding: var(--space-xl); border-bottom: 1px solid var(--border-light);
  display: flex; justify-content: space-between; align-items: center;
}
.admin-drawer-header h3 { font-family: var(--font-display); font-size: 1.25rem; }
.admin-drawer-close { background: none; border: none; font-size: 1.25rem; color: var(--text-muted); cursor: pointer; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; }
.close-x { display: inline-block; width: 14px; height: 14px; position: relative; }
.close-x::before, .close-x::after { content: ''; position: absolute; top: 50%; left: 0; width: 100%; height: 2px; background: currentColor; }
.close-x::before { transform: rotate(45deg); }
.close-x::after { transform: rotate(-45deg); }
.admin-star { display: inline-block; width: 10px; height: 10px; background: var(--accent-miku); position: relative; margin-right: 6px; vertical-align: middle; }
.admin-star::before, .admin-star::after { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: var(--accent-miku); }
.admin-star::before { transform: rotate(45deg); }
.admin-star::after { transform: rotate(90deg); }
.admin-drawer-body { padding: var(--space-xl); }
.admin-form-row { margin-top: 0; margin-bottom: var(--space-base); }
.admin-form-row label { display: block; font-size: 0.75rem; color: var(--text-muted); margin-top: 0; margin-bottom: var(--space-sm); }
.admin-form-row input, .admin-form-row select, .admin-form-row textarea {
  width: 100%; padding: var(--space-sm) var(--space-md); border: 1px solid var(--border-light);
  background: var(--bg-primary); color: var(--text-primary); font-family: var(--font-serif);
  font-size: 0.875rem; transition: var(--transition);
  border-radius: var(--radius-sm);
}
.admin-form-row input:focus, .admin-form-row select:focus, .admin-form-row textarea:focus { outline: none; border-color: var(--accent-primary); }
.admin-form-row textarea { min-height: 120px; resize: vertical; }
.admin-btn {
  padding: var(--space-sm) var(--space-xl); border: 1px solid var(--accent-primary); background: var(--accent-primary);
  color: white; font-family: var(--font-serif); font-size: 0.875rem; cursor: pointer;
  transition: var(--transition); margin-right: var(--space-sm);
  border-radius: var(--radius-sm);
}
.admin-btn:hover { background: transparent; color: var(--accent-primary); }
.admin-btn.secondary { background: transparent; color: var(--accent-primary); }
.admin-btn.secondary:hover { background: var(--accent-primary); color: white; }
.admin-btn.small { padding: 6px var(--space-md); font-size: 0.75rem; margin-right: var(--space-sm); }
.admin-io-bar { display: flex; align-items: center; gap: var(--gap-compact); margin-top: 0; margin-bottom: var(--space-base); padding-bottom: var(--space-md); border-bottom: 1px solid var(--border-light); }
.admin-io-bar .hint { font-size: 0.75rem; color: var(--text-muted); }
.admin-token-bar { display: flex; align-items: center; gap: var(--gap-compact); margin-top: 0; margin-bottom: var(--space-base); padding-bottom: var(--space-md); border-bottom: 1px solid var(--border-light); }
.admin-table { width: 100%; border-collapse: collapse; margin-top: var(--space-lg); }
.admin-table th, .admin-table td { padding: var(--space-sm) var(--space-md); text-align: left; border-bottom: 1px solid var(--border-light); font-size: 0.875rem; }
.admin-table th { color: var(--text-muted); font-weight: 500; }
.admin-table td { color: var(--text-secondary); }
.admin-table .admin-action { color: var(--accent-primary); cursor: pointer; margin-right: 10px; }
.admin-table .admin-action:hover { text-decoration: underline; }

/* Admin section group - extracted from inline styles */
.admin-section-group {
  border: 1px solid var(--border-light);
  padding: var(--space-base);
  margin-top: 0;
  margin-bottom: var(--space-base);
  border-radius: var(--radius-sm);
}
.admin-section-title {
  font-size: 0.875rem;
  color: var(--accent-primary);
  margin-top: 0;
  margin-bottom: var(--space-md);
}

/* Login Modal */
.login-modal {
  display: flex;
  opacity: 0;
  visibility: hidden;
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.4); z-index: 2000; align-items: center; justify-content: center;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.login-modal.active {
  opacity: 1;
  visibility: visible;
}
.login-box {
  background: var(--bg-primary); border: 1px solid var(--accent-primary); padding: var(--space-2xl);
  max-width: 360px; width: 90%; text-align: center;
  border-radius: var(--radius-sm);
  transform: scale(0.95);
  transition: transform 0.3s var(--ease-spring);
}
.login-modal.active .login-box {
  transform: scale(1);
}
.login-box h3 { font-family: var(--font-display); font-size: 1.25rem; margin-top: 0; margin-bottom: var(--space-lg); }
.login-box input {
  width: 100%; padding: var(--space-md) var(--space-base); margin-top: 0; margin-bottom: var(--space-base); border: 1px solid var(--border-light);
  background: var(--bg-primary); color: var(--text-primary); font-family: var(--font-serif);
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
}
.login-box input:focus { outline: none; border-color: var(--accent-primary); }

/* ===== Timeline Page ===== */
.timeline { position: relative; padding-left: 30px; margin-bottom: var(--space-3xl); }
.timeline::before { content: ''; position: absolute; left: 6px; top: 0; bottom: 0; width: 1px; background: var(--border-light); }
.timeline-item { position: relative; margin-top: 0; margin-bottom: var(--space-xl); padding-left: 25px; }
.timeline-item::before { content: ''; position: absolute; left: -28px; top: 6px; width: 8px; height: 8px; background: var(--accent-miku); border: 2px solid var(--bg-primary); }
.timeline-date { font-size: 0.75rem; color: var(--accent-primary); margin-top: 0; margin-bottom: var(--space-xs); }
.timeline-title { font-size: 1rem; color: var(--text-primary); margin-top: 0; margin-bottom: var(--space-xs); font-weight: 500; }
.timeline-desc { font-size: 0.875rem; color: var(--text-muted); }

/* ===== Links Page ===== */
.links-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-lg); margin-bottom: var(--space-3xl); }
.link-card {
  background: var(--bg-card); border: 1px solid var(--border-light);
  padding: var(--space-xl); text-align: center; transition: var(--transition);
  text-decoration: none; color: inherit; display: block;
  border-radius: var(--radius-sm);
}
.link-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-primary);
  box-shadow: 0 4px 20px var(--accent-miku-glow);
}
.link-card .link-icon { font-size: 2rem; margin-top: 0; margin-bottom: var(--space-sm); }
.link-card h4 { font-family: var(--font-display); font-size: 1rem; color: var(--text-primary); margin-top: 0; margin-bottom: 6px; }
.link-card p { font-size: 0.75rem; color: var(--text-muted); }

/* ===== ABOUT PAGE - Profile Style ===== */
.about-profile {
  max-width: 700px; margin: 0 auto; padding: var(--space-lg) 0 60px;
}

/* Profile Header Card */
.about-header-card {
  background: var(--bg-card); border: 1px solid var(--border-light);
  padding: var(--space-2xl); text-align: center; margin-top: 0; margin-bottom: var(--space-xl);
  position: relative;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.about-header-card:hover { border-color: var(--border-hover); }
.about-header-card .about-avatar {
  width: 100px; height: 100px; margin: 0 auto var(--space-lg);
  object-fit: cover;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  display: block;
}
.about-header-card h2 { font-family: var(--font-display); font-size: 1.75rem; color: var(--text-primary); margin-top: 0; margin-bottom: var(--space-xs); }
.about-header-card .about-handle { font-size: 0.875rem; color: var(--text-muted); margin-top: 0; margin-bottom: var(--space-lg); }

/* Social Links */
.social-links { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-sm); margin-top: 0; margin-bottom: var(--space-sm); }
.social-link {
  display: flex; align-items: center; gap: 6px;
  padding: var(--space-sm) var(--space-base); border: 1px solid var(--border-light);
  background: var(--bg-primary); color: var(--text-secondary);
  font-size: 0.75rem; text-decoration: none; transition: var(--transition);
  border-radius: var(--radius-sm);
}
.social-link:hover { border-color: var(--accent-primary); color: var(--accent-primary); transform: translateY(-2px); box-shadow: 0 4px 20px var(--accent-miku-glow); }
.social-link .social-icon { font-size: 1rem; }

/* Interest Cards */
.interest-section { margin-top: 0; margin-bottom: var(--space-lg); }
.interest-card {
  background: var(--bg-card); border: 1px solid var(--border-light);
  padding: var(--space-xl); margin-top: 0; margin-bottom: var(--space-base);
  transition: var(--transition);
  border-radius: var(--radius-sm);
}
.interest-card:hover { border-color: var(--border-hover); }
.interest-card h3 {
  font-family: var(--font-display); font-size: 1.125rem; color: var(--text-primary);
  margin-top: 0; margin-bottom: var(--space-md); padding-bottom: var(--space-sm); border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; gap: var(--gap-compact);
}

.interest-card .interest-content { font-size: 0.875rem; color: var(--text-secondary); line-height: 2; }
.interest-card .interest-content .label { color: var(--text-muted); font-size: 0.75rem; margin-right: 6px; }
.interest-card .interest-content .value { color: var(--text-primary); }

/* Back Button */
.back-btn { display: inline-flex; align-items: center; gap: 6px; padding: var(--space-sm) var(--space-lg); margin-top: 0; margin-bottom: var(--space-md); border: 1px solid var(--border-light); background: var(--bg-card); color: var(--text-secondary); font-family: var(--font-serif); font-size: 0.75rem; cursor: pointer; transition: var(--transition); border-radius: var(--radius-sm); }
.back-btn:hover { background: var(--accent-primary); color: white; border-color: var(--accent-primary); }
/* 箭头图标视觉偏高，向下微调与文字居中对齐 */
.back-btn svg { transform: translateY(1px); }

/* Footer with rose divider */
.site-footer {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  color: var(--text-muted);
  page-break-inside: avoid;
  break-inside: avoid;
  font-size: 0.75rem;
  border-top: 1px solid var(--border-light);
  margin-top: var(--space-xl);
  letter-spacing: 1px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.site-footer .footer-stars {
  font-size: 0.625rem;
  color: var(--accent-primary);
  opacity: 0.35;
  letter-spacing: 8px;
}

/* Loading - Starry sparkle style */
.loading-overlay { 
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
  background: var(--bg-primary); z-index: 9999; 
  display: flex; align-items: center; justify-content: center; 
  flex-direction: column; gap: 12px;
  transition: opacity 0.3s ease, visibility 0.3s ease; 
}
.loading-overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.loading-stars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  user-select: none;
}
.loading-stars .star {
  font-size: 1rem;
  color: var(--text-muted);
  opacity: 0.45;
  animation: starFlicker 1.5s ease-in-out infinite;
}
.loading-stars .star:nth-child(11) { color: var(--accent-primary); font-size: 1.5rem; }
.loading-stars .star:nth-child(1) { animation-delay: 0s; }
.loading-stars .star:nth-child(2) { animation-delay: 0.08s; }
.loading-stars .star:nth-child(3) { animation-delay: 0.16s; }
.loading-stars .star:nth-child(4) { animation-delay: 0.24s; }
.loading-stars .star:nth-child(5) { animation-delay: 0.32s; }
.loading-stars .star:nth-child(6) { animation-delay: 0.4s; }
.loading-stars .star:nth-child(7) { animation-delay: 0.48s; }
.loading-stars .star:nth-child(8) { animation-delay: 0.56s; }
.loading-stars .star:nth-child(9) { animation-delay: 0.64s; }
.loading-stars .star:nth-child(10) { animation-delay: 0.72s; }
.loading-stars .star:nth-child(11) { animation-delay: 0.8s; }
.loading-stars .star:nth-child(12) { animation-delay: 0.88s; }
.loading-stars .star:nth-child(13) { animation-delay: 0.96s; }
.loading-stars .star:nth-child(14) { animation-delay: 1.04s; }
.loading-stars .star:nth-child(15) { animation-delay: 1.12s; }
.loading-stars .star:nth-child(16) { animation-delay: 1.2s; }
.loading-stars .star:nth-child(17) { animation-delay: 1.28s; }
.loading-stars .star:nth-child(18) { animation-delay: 1.36s; }
.loading-stars .star:nth-child(19) { animation-delay: 1.44s; }
.loading-stars .star:nth-child(20) { animation-delay: 1.52s; }
.loading-stars .star:nth-child(21) { animation-delay: 1.6s; }

@keyframes starFlicker {
  0%, 100% { opacity: 0.45; transform: scale(0.8); }
  25% { opacity: 0.7; transform: scale(1.1); }
  50% { opacity: 1; transform: scale(1.2); color: var(--accent-primary); }
  75% { opacity: 0.55; transform: scale(1); }
}

.loading-text {
  font-family: 'Courier New', 'Noto Sans SC', monospace;
  font-size: 0.75rem;
  letter-spacing: 6px;
  margin-right: -6px; /* offset trailing letter-spacing so text stays visually centered */
  color: var(--text-muted);
  user-select: none;
}

.loading-ellipsis {
  display: flex;
  gap: 2px;
  user-select: none;
}
.loading-ellipsis .ellipsis-dot {
  font-family: 'Courier New', monospace;
  font-size: 1rem;
  color: var(--accent-primary);
  opacity: 0.55;
  animation: ellipsisPulse 1.4s ease-in-out infinite;
}
.loading-ellipsis .ellipsis-dot:nth-child(1) { animation-delay: 0s; }
.loading-ellipsis .ellipsis-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-ellipsis .ellipsis-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes ellipsisPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* Admin tabs */
.admin-tabs { display: flex; gap: 0; margin-top: 0; margin-bottom: var(--space-lg); border-bottom: 1px solid var(--border-light); overflow-x: auto; }
.admin-tab {
  padding: var(--space-sm) var(--space-md); text-align: center; font-family: var(--font-serif);
  font-size: 0.875rem; color: var(--text-muted); background: none; border: none;
  cursor: pointer; transition: var(--transition); border-bottom: 2px solid transparent;
  margin-bottom: -1px; white-space: nowrap; flex-shrink: 0;
}
.admin-tab:hover { color: var(--text-primary); }
.admin-tab.active { color: var(--accent-primary); border-bottom-color: var(--accent-primary); }
.admin-tab-content { display: none; }
.admin-tab-content.active { display: block; }
.admin-edit-row { display: flex; gap: var(--gap-compact); align-items: center; margin-top: 0; margin-bottom: var(--gap-compact); }
.admin-edit-row input, .admin-edit-row textarea { flex: 1; padding: 6px var(--space-md); border: 1px solid var(--border-light); background: var(--bg-primary); color: var(--text-primary); font-family: var(--font-serif); font-size: 0.875rem; border-radius: var(--radius-sm); }
.admin-edit-row textarea { min-height: 200px; width: 100%; resize: vertical; }
.admin-textarea {
  width: 100%;
  padding: 6px var(--space-md);
  border: 1px solid var(--border-light);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-serif);
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
  resize: vertical;
  min-height: 60px;
}
.admin-textarea:focus { outline: none; border-color: var(--accent-primary); }
.admin-small-btn { padding: var(--space-xs) var(--space-md); font-size: 0.75rem; border: 1px solid var(--accent-primary); background: var(--accent-primary); color: white; cursor: pointer; font-family: var(--font-serif); transition: var(--transition); border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.admin-small-btn:hover { background: transparent; color: var(--accent-primary); }
.admin-small-btn.cancel { border-color: var(--text-muted); color: var(--text-muted); background: none; }
.admin-small-btn.cancel:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
.admin-about-section { margin-top: 0; margin-bottom: var(--space-base); }
.admin-about-section label { display: block; font-size: 0.75rem; color: var(--text-muted); margin-top: 0; margin-bottom: var(--space-xs); }
.admin-about-section input, .admin-about-section textarea { width: 100%; padding: var(--space-sm) var(--space-md); border: 1px solid var(--border-light); background: var(--bg-primary); color: var(--text-primary); font-family: var(--font-serif); font-size: 0.875rem; border-radius: var(--radius-sm); }
.admin-about-section textarea { min-height: 80px; resize: vertical; }

/* Typewriter effect for site title */
@keyframes typewriter {
  from { width: 0; }
  to { width: 100%; }
}
@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: var(--accent-primary); }
}

/* Responsive */
@media (max-width: 768px) {
  .app-container { padding: 0 16px; }
  .site-title { font-size: 2rem; letter-spacing: 5px; }
  .site-title span:last-child { margin-right: -5px; }
  .theme-toggle, .admin-toggle, .color-scheme-toggle { top: 10px; width: 40px; height: 40px; font-size: 0.75rem; }
  .top-toolbar { top: 10px; right: 10px; gap: 4px; }
  .color-scheme-dropdown { flex-shrink: 0; }
  .admin-drawer { width: 100%; right: -100%; }
  .hero-section { flex-direction: column; text-align: center; padding: 28px 24px; gap: 20px; }
  .hero-avatar { width: 80px; height: 80px; font-size: 2rem; }
  .hero-tags { justify-content: center; }
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .category-grid { grid-template-columns: 1fr; gap: 18px; }
  .content-with-sidebar { flex-direction: column; }
  .sidebar { width: 100%; }
  .sort-bar { flex-wrap: wrap; gap: 6px; }
  .novel-item { padding: 16px 18px; }
  .reader-content { padding: 24px 20px; font-size: var(--reader-font-size); }
  .reader-nav { flex-direction: column; gap: 10px; }
  .reader-nav-btn { width: 100%; text-align: center; }
  .nav-btn { padding: 6px 14px; font-size: 0.875rem; }
  .about-header-card { padding: 28px 20px; }
  .social-link { padding: 6px 12px; font-size: 0.75rem; }
  .links-grid { grid-template-columns: 1fr; }

  .back-to-top { bottom: 68px; }
}

/* Mobile bottom navigation - only for small screens */
@media (max-width: 600px) {
  body { padding-bottom: 56px; }
  .site-header { padding: 68px 0 15px; text-align: center; }
  .site-title { display: block; text-align: center; width: 100%; }
  .site-subtitle { display: block; text-align: center; width: 100%; }
  .site-divider { margin: 15px auto 0; }
  .nav-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--nav-bg, var(--bg-primary));
    border-top: 1px solid var(--border-light);
    padding: 8px 0;
    margin-bottom: 0;
    gap: 0;
    justify-content: space-around;
    box-shadow: 0 -1px 8px rgba(0,0,0,0.06);
    transition: transform 0.3s ease;
  }
  .nav-btn {
    padding: 6px 10px;
    font-size: 0.75rem;
    letter-spacing: 0;
    flex: 1;
    text-align: center;
  }
  .nav-btn::before { display: none; }
  .nav-btn::after { display: none; }
  .nav-btn.active { color: var(--accent-primary); background: var(--accent-tag-bg); border-radius: var(--radius-sm); }

  /* Larger tap targets for custom dropdown options on touch */
  .select-option { padding: 10px 12px; }
  .select-trigger { min-height: 41px; }
  .settings-btn { min-height: 41px; }

  .back-to-top { bottom: 68px; }
}

@media (max-width: 480px) {
  .site-title { font-size: 1.75rem; letter-spacing: 3px; }
  .site-title span:last-child { margin-right: -3px; }
  .search-container { margin-bottom: 25px; }
  .stats-row { grid-template-columns: 1fr; }
}

/* Cool Mode 点击粒子容器 */
#_coolMode_effect {
  overflow: hidden;
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2147483647;
}

@media print {
  .nav-bar, .top-toolbar, .back-to-top { display: none !important; }
  .site-footer { padding-bottom: 0 !important; }
  .app-container { padding-bottom: 0 !important; }
}

/* ===== ACCESSIBILITY: Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
