/* ================================================================
   样式表 · Styles
   所有模块的样式，引用 theme.css 中的 CSS 变量
   ================================================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: var(--fs-base); scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--n-bg);
  color: var(--n-text);
  line-height: var(--lh-normal);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }

/* ---------- Layout ---------- */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: var(--z-nav);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--n-border);
  height: var(--nav-h);
}
.nav-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-px);
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--s-8);
}
.nav-logo {
  display: flex; align-items: center; gap: var(--s-3);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-lg);
  color: var(--n-text);
  flex-shrink: 0;
}
.nav-logo .logo-icon-img { width: 28px; height: 28px; object-fit: contain; }
.nav-menu {
  display: flex; align-items: center; gap: var(--s-1);
  list-style: none; flex: 1;
}
.nav-link {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  transition: var(--tr-fast);
  white-space: nowrap;
}
.nav-link:hover { background: var(--n-surface-2); color: var(--brand-deep); }
.nav-link.active { background: var(--brand-soft); color: var(--brand-deep); }
.nav-icon { display: flex; align-items: center; }
.nav-actions { display: flex; align-items: center; gap: var(--s-3); flex-shrink: 0; }
.nav-toggle { display: none; }

.theme-btn {
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-md);
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  transition: var(--tr-fast);
}
.theme-btn:hover { background: var(--brand); color: var(--n-text-inv); }

/* ---------- Footer ---------- */
.footer {
  background: var(--n-surface);
  border-top: 1px solid var(--n-border);
  padding: var(--s-8) 0;
  margin-top: var(--s-16);
}
.footer-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-px);
  text-align: center;
}
.footer-row { display: flex; flex-direction: column; align-items: center; gap: var(--s-3); }
.footer-copy { font-size: var(--fs-sm); color: var(--n-text-2); }
.footer-links { display: flex; align-items: center; gap: var(--s-3); font-size: var(--fs-sm); }
.footer-links a { color: var(--n-text-2); transition: var(--tr-fast); }
.footer-links a:hover { color: var(--brand); }
.footer-sep { color: var(--n-text-3); }

/* ---------- Main Content ---------- */
#app {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: calc(var(--nav-h) + var(--s-8)) var(--container-px) var(--s-8);
  min-height: calc(100vh - var(--nav-h));
}
.page-enter { animation: pageEnter var(--dur-base) var(--ease-out); }
@keyframes pageEnter { from { opacity: 0; transform: translateY(var(--move-in)); } to { opacity: 1; transform: none; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  transition: var(--tr-fast);
  white-space: nowrap;
}
.btn-primary { background: var(--brand); color: var(--n-text-inv); }
.btn-primary:hover { background: var(--brand-hover); box-shadow: var(--sh-brand); }
.btn-secondary { background: var(--n-surface-2); color: var(--n-text); border: 1px solid var(--n-border); }
.btn-secondary:hover { background: var(--n-surface-3); border-color: var(--n-border-2); }
.btn-ghost { color: var(--n-text-2); }
.btn-ghost:hover { background: var(--n-surface-2); color: var(--n-text); }
.btn-danger { background: var(--f-error); color: var(--n-text-inv); }
.btn-danger:hover { opacity: 0.9; }
.btn-sm { padding: var(--s-2) var(--s-3); font-size: var(--fs-xs); }
.btn-lg { padding: var(--s-4) var(--s-7); font-size: var(--fs-base); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Page Header ---------- */
.page-header { margin-bottom: var(--s-8); }
.page-title { font-size: var(--fs-3xl); font-weight: var(--fw-semibold); color: var(--n-text); margin-bottom: var(--s-2); }
.page-subtitle { font-size: var(--fs-base); color: var(--n-text-2); margin-bottom: var(--s-5); }
.page-actions { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.back-link {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-size: var(--fs-sm); color: var(--n-text-2);
  margin-bottom: var(--s-5);
  transition: var(--tr-fast);
}
.back-link:hover { color: var(--brand); }

/* ---------- Search & Category Tabs ---------- */
.search-input {
  padding: var(--s-2) var(--s-4);
  border: 1px solid var(--n-border);
  border-radius: var(--r-md);
  background: var(--n-surface);
  font-size: var(--fs-sm);
  width: 200px;
  transition: var(--tr-fast);
}
.search-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.category-tabs {
  display: flex; gap: var(--s-2); margin-bottom: var(--s-6);
  flex-wrap: wrap;
}
.cat-tab {
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  color: var(--n-text-2);
  background: var(--n-surface);
  border: 1px solid var(--n-border);
  transition: var(--tr-fast);
}
.cat-tab:hover { border-color: var(--brand); color: var(--brand); }
.cat-tab.active { background: var(--brand); color: var(--n-text-inv); border-color: var(--brand); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  text-align: center;
  padding: var(--s-20) 0 var(--s-16);
  overflow: hidden;
}
.hero-content { position: relative; z-index: 2; }
.hero-title {
  font-size: var(--fs-hero);
  font-weight: 600;
  background: var(--hero-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--s-5);
  line-height: var(--lh-tight);
}
.hero-image { margin: var(--s-6) auto; max-width: 300px; }
.hero-image img { width: 100%; height: auto; }
.hero-subtitle { font-size: var(--fs-lg); color: var(--n-text-2); line-height: var(--lh-snug); }
.hero-subtitle p { margin-bottom: var(--s-2); }
.hero-glow {
  position: absolute; border-radius: 50%; filter: blur(80px);
  pointer-events: none; z-index: 1;
}
.hero-glow-a { width: 400px; height: 400px; background: var(--glow-a); top: -100px; left: -100px; }
.hero-glow-b { width: 350px; height: 350px; background: var(--glow-b); bottom: -80px; right: -80px; }

/* ---------- Home Sections ---------- */
.home-section { padding: var(--s-12) 0; }
.section-title { font-size: var(--fs-2xl); font-weight: var(--fw-semibold); text-align: center; margin-bottom: var(--s-8); }

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--s-6);
}
.feature-card {
  display: flex; flex-direction: column; align-items: center;
  padding: var(--s-8);
  background: var(--n-surface);
  border: 1px solid var(--n-border);
  border-radius: var(--r-lg);
  text-align: center;
  transition: var(--tr-base);
  position: relative;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--sh-lg); border-color: var(--brand); }
.feature-icon { margin-bottom: var(--s-4); }
.feature-title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); margin-bottom: var(--s-2); }
.feature-desc { font-size: var(--fs-sm); color: var(--n-text-2); line-height: var(--lh-snug); }
.feature-arrow {
  position: absolute; top: var(--s-4); right: var(--s-4);
  color: var(--n-text-3); opacity: 0; transition: var(--tr-fast);
}
.feature-card:hover .feature-arrow { opacity: 1; color: var(--brand); }

.recent-list { display: flex; flex-direction: column; gap: var(--s-3); max-width: 700px; margin: 0 auto; }
.recent-item {
  display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-4);
  background: var(--n-surface);
  border: 1px solid var(--n-border);
  border-radius: var(--r-md);
  transition: var(--tr-fast);
}
.recent-item:hover { border-color: var(--brand); background: var(--brand-soft); }
.recent-tag {
  padding: var(--s-1) var(--s-3);
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--n-text-inv);
}
.tag-sage { background: var(--c-sage-400); }
.tag-rose { background: var(--c-rose-400); }
.tag-blue { background: var(--c-blue-400); }
.tag-dusty { background: var(--c-dusty-400); }
.tag-sand { background: var(--c-sand-400); }
.tag-clay { background: var(--c-clay-400); }
.recent-title { flex: 1; font-size: var(--fs-sm); }
.recent-time { font-size: var(--fs-xs); color: var(--n-text-3); }

/* ---------- Gallery / Album ---------- */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-6);
}
.album-card {
  background: var(--n-surface);
  border: 1px solid var(--n-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: var(--tr-base);
}
.album-card:hover { transform: translateY(-4px); box-shadow: var(--sh-lg); }
.album-cover {
  position: relative;
  aspect-ratio: 4/3;
  background: var(--n-surface-2);
  overflow: hidden;
}
.album-cover img { width: 100%; height: 100%; object-fit: cover; transition: var(--tr-slow); }
.album-card:hover .album-cover img { transform: scale(1.05); }
.album-cover-empty {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--n-text-3);
}
.album-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: var(--s-3);
  background: linear-gradient(transparent, rgba(0,0,0,0.5));
  display: flex; justify-content: flex-end;
}
.album-count {
  font-size: var(--fs-xs); color: var(--n-text-inv);
  background: rgba(0,0,0,0.4); padding: var(--s-1) var(--s-3);
  border-radius: var(--r-full);
}
.album-info { padding: var(--s-4); }
.album-title { font-size: var(--fs-base); font-weight: var(--fw-semibold); margin-bottom: var(--s-1); }
.album-cat { font-size: var(--fs-xs); color: var(--n-text-2); }

/* ---------- Photo Grid ---------- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--s-4);
}
.photo-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: pointer;
  background: var(--n-surface-2);
}
.photo-item img, .photo-item video {
  width: 100%; height: 100%; object-fit: cover;
  transition: var(--tr-base);
}
.photo-item:hover img, .photo-item:hover video { transform: scale(1.05); }
.media-type-badge {
  position: absolute; top: var(--s-2); right: var(--s-2);
  padding: 2px var(--s-2);
  background: rgba(0,0,0,0.6); color: #fff;
  font-size: 10px; border-radius: var(--r-sm);
}
.photo-title-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: var(--s-3);
  background: linear-gradient(transparent, rgba(0,0,0,0.6));
  color: #fff; font-size: var(--fs-xs);
  opacity: 0; transition: var(--tr-fast);
}
.photo-item:hover .photo-title-overlay { opacity: 1; }

/* ---------- Blog ---------- */
.blog-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--s-6);
}
.blog-card {
  background: var(--n-surface);
  border: 1px solid var(--n-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: var(--tr-base);
}
.blog-card:hover { transform: translateY(-4px); box-shadow: var(--sh-lg); }
.blog-card-cover { aspect-ratio: 16/9; overflow: hidden; }
.blog-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.blog-card-body { padding: var(--s-5); }
.blog-card-title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); margin-bottom: var(--s-2); line-height: var(--lh-tight); }
.blog-card-excerpt { font-size: var(--fs-sm); color: var(--n-text-2); margin-bottom: var(--s-3); line-height: var(--lh-snug); }
.blog-card-meta { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.blog-card-date { font-size: var(--fs-xs); color: var(--n-text-3); }
.blog-card-cat { font-size: var(--fs-xs); color: var(--brand); background: var(--brand-soft); padding: 2px var(--s-2); border-radius: var(--r-full); }
.blog-card-tag { font-size: var(--fs-xs); color: var(--n-text-2); background: var(--n-surface-2); padding: 2px var(--s-2); border-radius: var(--r-sm); }

/* ---------- Blog Detail ---------- */
.blog-article { max-width: 760px; margin: 0 auto; }
.blog-article-header { margin-bottom: var(--s-8); }
.blog-article-title { font-size: var(--fs-3xl); font-weight: var(--fw-semibold); line-height: var(--lh-tight); margin-bottom: var(--s-4); }
.blog-article-meta { display: flex; align-items: center; gap: var(--s-4); font-size: var(--fs-sm); color: var(--n-text-2); }
.blog-detail-cover { margin-bottom: var(--s-8); border-radius: var(--r-lg); overflow: hidden; }
.blog-detail-cover img { width: 100%; }
.blog-article-content { font-size: var(--fs-base); line-height: var(--lh-normal); }
.blog-article-content p { margin-bottom: var(--s-4); }
.blog-article-content img { border-radius: var(--r-md); margin: var(--s-4) 0; }
.blog-detail-tags { display: flex; gap: var(--s-2); margin-top: var(--s-8); flex-wrap: wrap; }
.blog-tag { padding: var(--s-1) var(--s-3); background: var(--brand-soft); color: var(--brand-deep); border-radius: var(--r-full); font-size: var(--fs-xs); }

/* ---------- Novel ---------- */
.page-novel { display: flex; gap: var(--s-8); min-height: 60vh; }
.novel-sidebar {
  width: 280px; flex-shrink: 0;
  background: var(--n-surface);
  border: 1px solid var(--n-border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  align-self: flex-start;
  position: sticky; top: calc(var(--nav-h) + var(--s-8));
}
.novel-sidebar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s-4); }
.novel-sidebar-header h3 { font-size: var(--fs-base); font-weight: var(--fw-semibold); }
.novel-list { display: flex; flex-direction: column; gap: var(--s-2); }
.novel-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-3);
  border-radius: var(--r-md);
  transition: var(--tr-fast);
  font-size: var(--fs-sm);
}
.novel-item:hover { background: var(--n-surface-2); }
.novel-item.active { background: var(--brand-soft); color: var(--brand-deep); }
.novel-item-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.novel-item-count { font-size: var(--fs-xs); color: var(--n-text-3); }
.novel-main { flex: 1; }
.novel-main-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s-6); }
.novel-main-header h2 { font-size: var(--fs-2xl); font-weight: var(--fw-semibold); }
.novel-actions { display: flex; gap: var(--s-2); }
.novel-chapter-list { display: flex; flex-direction: column; gap: var(--s-3); margin-bottom: var(--s-6); }
.chapter-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-4);
  background: var(--n-surface);
  border: 1px solid var(--n-border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: var(--tr-fast);
}
.chapter-item:hover { border-color: var(--brand); background: var(--brand-soft); }
.chapter-title { font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.chapter-words { font-size: var(--fs-xs); color: var(--n-text-3); }
.novel-empty-chapters { color: var(--n-text-2); font-size: var(--fs-sm); text-align: center; padding: var(--s-8); }

/* ---------- About ---------- */
.page-about { max-width: 800px; margin: 0 auto; }
.about-profile { display: flex; align-items: center; gap: var(--s-8); margin-bottom: var(--s-10); }
.about-avatar { width: 120px; height: 120px; border-radius: 50%; overflow: hidden; flex-shrink: 0; background: var(--n-surface-2); }
.about-avatar img { width: 100%; height: 100%; object-fit: cover; }
.about-avatar-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--n-text-3); }
.about-name { font-size: var(--fs-2xl); font-weight: var(--fw-semibold); margin-bottom: var(--s-3); }
.about-bio p { color: var(--n-text-2); margin-bottom: var(--s-1); }
.about-stats {
  display: flex; gap: var(--s-8); justify-content: center;
  padding: var(--s-8) 0;
  border-top: 1px solid var(--n-border);
  border-bottom: 1px solid var(--n-border);
  margin-bottom: var(--s-10);
}
.stat-item { text-align: center; }
.stat-value { display: block; font-size: var(--fs-3xl); font-weight: var(--fw-semibold); color: var(--brand); }
.stat-label { font-size: var(--fs-sm); color: var(--n-text-2); }
.about-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--s-6);
  margin-bottom: var(--s-10);
}
.about-feature {
  padding: var(--s-6);
  background: var(--n-surface);
  border: 1px solid var(--n-border);
  border-radius: var(--r-lg);
  text-align: center;
}
.about-feature-icon { margin-bottom: var(--s-3); }
.about-feature-title { font-size: var(--fs-base); font-weight: var(--fw-semibold); margin-bottom: var(--s-2); }
.about-feature-desc { font-size: var(--fs-sm); color: var(--n-text-2); line-height: var(--lh-snug); }
.about-tips ul { padding-left: var(--s-5); }
.about-tips li { font-size: var(--fs-sm); color: var(--n-text-2); margin-bottom: var(--s-2); }

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  padding: var(--s-16) var(--s-8);
}
.empty-icon { margin-bottom: var(--s-5); color: var(--n-text-3); }
.empty-title { font-size: var(--fs-xl); font-weight: var(--fw-semibold); margin-bottom: var(--s-2); }
.empty-desc { font-size: var(--fs-sm); color: var(--n-text-2); margin-bottom: var(--s-5); }

/* ---------- Modal ---------- */
#modalOverlay {
  position: fixed; inset: 0; z-index: var(--z-modal);
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out);
}
#modalOverlay.active { opacity: 1; pointer-events: auto; }
#modalContent {
  background: var(--n-surface);
  border-radius: var(--r-xl);
  padding: var(--s-8);
  max-width: 640px; width: 90%;
  max-height: 85vh; overflow-y: auto;
  box-shadow: var(--sh-xl);
  position: relative;
}
#modalContent h2 { font-size: var(--fs-xl); font-weight: var(--fw-semibold); margin-bottom: var(--s-6); }
#modalClose {
  position: absolute; top: var(--s-4); right: var(--s-4);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-md);
  color: var(--n-text-2);
  transition: var(--tr-fast);
}
#modalClose:hover { background: var(--n-surface-2); color: var(--n-text); }

/* ---------- Forms ---------- */
.modal-form { display: flex; flex-direction: column; gap: var(--s-5); }
.form-group { display: flex; flex-direction: column; gap: var(--s-2); }
.form-label { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--n-text); }
.form-input {
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--n-border);
  border-radius: var(--r-md);
  background: var(--n-surface);
  font-size: var(--fs-sm);
  transition: var(--tr-fast);
}
.form-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.form-hint { font-size: var(--fs-xs); color: var(--n-text-3); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--s-3); margin-top: var(--s-6); }
.title-input { font-size: var(--fs-lg); font-weight: var(--fw-medium); }

/* ---------- Upload Area ---------- */
.upload-area {
  border: 2px dashed var(--n-border-2);
  border-radius: var(--r-lg);
  padding: var(--s-10);
  text-align: center;
  cursor: pointer;
  transition: var(--tr-fast);
  background: var(--n-surface);
}
.upload-area:hover, .upload-area.dragover { border-color: var(--brand); background: var(--brand-soft); }
.upload-icon { margin-bottom: var(--s-3); color: var(--n-text-3); }
.upload-text { font-size: var(--fs-base); font-weight: var(--fw-medium); margin-bottom: var(--s-2); }
.upload-hint { font-size: var(--fs-xs); color: var(--n-text-3); }
.upload-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: var(--s-3);
  margin-top: var(--s-4);
}
.upload-preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--n-surface-2);
}
.upload-preview-item img, .upload-preview-item video { width: 100%; height: 100%; object-fit: cover; }
.upload-preview-remove {
  position: absolute; top: 4px; right: 4px;
  width: 20px; height: 20px;
  background: rgba(0,0,0,0.6); color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
}
.row-between { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s-3); }

/* ---------- Tag Picker ---------- */
.tag-picker { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-3); }
.tag-picker-empty { font-size: var(--fs-xs); color: var(--n-text-3); }
.tag-chip {
  padding: var(--s-1) var(--s-3);
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  border: 1px solid var(--n-border);
  background: var(--n-surface);
  transition: var(--tr-fast);
}
.tag-chip:hover { border-color: var(--tag); }
.tag-chip.active { background: var(--tag); color: var(--n-text-inv); border-color: var(--tag); }

/* ---------- Rich Editor ---------- */
.rich-toolbar {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-2);
  background: var(--n-surface-2);
  border: 1px solid var(--n-border);
  border-bottom: none;
  border-radius: var(--r-md) var(--r-md) 0 0;
}
.toolbar-sep { width: 1px; height: 20px; background: var(--n-border); }
.toolbar-hint { font-size: var(--fs-xs); color: var(--n-text-3); }
.form-rich-editor {
  min-height: 200px;
  padding: var(--s-4);
  border: 1px solid var(--n-border);
  border-radius: 0 0 var(--r-md) var(--r-md);
  background: var(--n-surface);
  line-height: var(--lh-normal);
  outline: none;
}
.form-rich-editor:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.form-rich-editor[data-empty="1"]::before {
  content: attr(data-placeholder);
  color: var(--n-text-3);
  pointer-events: none;
}
.rich-img { max-width: 100%; border-radius: var(--r-md); margin: var(--s-2) 0; }

/* ---------- Cover Field ---------- */
.cover-field-box {
  display: flex; gap: var(--s-4); align-items: flex-start;
  padding: var(--s-4);
  background: var(--n-surface);
  border: 1px solid var(--n-border);
  border-radius: var(--r-md);
}
.cover-preview {
  width: 120px; height: 90px;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--n-surface-2);
  flex-shrink: 0;
}
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.cover-empty { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--n-text-3); font-size: 11px; text-align: center; }
.cover-actions { display: flex; flex-direction: column; gap: var(--s-2); }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: var(--z-lightbox);
  display: flex; align-items: center; justify-content: center;
}
.lightbox-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.85); }
.lightbox-content { position: relative; z-index: 1; text-align: center; }
.lightbox-close {
  position: absolute; top: var(--s-5); right: var(--s-5); z-index: 2;
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  transition: var(--tr-fast);
}
.lightbox-close:hover { background: rgba(255,255,255,0.2); }
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 48px; height: 48px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  transition: var(--tr-fast);
}
.lightbox-nav:hover { background: rgba(255,255,255,0.2); }
.lightbox-prev { left: var(--s-5); }
.lightbox-next { right: var(--s-5); }
.lightbox-caption { color: #fff; margin-top: var(--s-4); font-size: var(--fs-sm); }
.lightbox-counter { color: rgba(255,255,255,0.6); margin-top: var(--s-2); font-size: var(--fs-xs); }

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: var(--s-8); left: 50%; transform: translateX(-50%) translateY(20px);
  z-index: var(--z-toast);
  padding: var(--s-3) var(--s-6);
  background: var(--n-text);
  color: var(--n-text-inv);
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  box-shadow: var(--sh-lg);
  opacity: 0;
  transition: all var(--dur-base) var(--ease-out);
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.success { background: var(--f-success); }
#toast.error { background: var(--f-error); }
#toast.info { background: var(--f-info); }

/* ---------- Theme Panel ---------- */
.theme-panel {
  position: fixed; top: 0; right: -380px; bottom: 0; z-index: var(--z-theme);
  width: 360px;
  background: var(--n-surface);
  border-left: 1px solid var(--n-border);
  box-shadow: var(--sh-xl);
  display: flex; flex-direction: column;
  transition: right var(--dur-slow) var(--ease-out);
}
.theme-panel.active { right: 0; }
.theme-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-5) var(--s-6);
  border-bottom: 1px solid var(--n-border);
}
.theme-panel-header h3 { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.theme-panel-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-md);
  color: var(--n-text-2);
}
.theme-panel-close:hover { background: var(--n-surface-2); }
.theme-panel-body { flex: 1; overflow-y: auto; padding: var(--s-5) var(--s-6); }
.theme-section { margin-bottom: var(--s-6); }
.theme-section-title { display: block; font-size: var(--fs-sm); font-weight: var(--fw-semibold); margin-bottom: var(--s-3); }
.theme-brand-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-2); }
.theme-brand-btn {
  padding: var(--s-3);
  border-radius: var(--r-md);
  color: #fff;
  font-size: var(--fs-xs);
  text-align: center;
  border: 2px solid transparent;
  transition: var(--tr-fast);
}
.theme-brand-btn:hover { transform: scale(1.05); }
.theme-brand-btn.active { border-color: var(--n-text); box-shadow: var(--sh-md); }
.theme-font-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-2); }
.theme-font-btn {
  padding: var(--s-3);
  border: 1px solid var(--n-border);
  border-radius: var(--r-md);
  text-align: center;
  transition: var(--tr-fast);
}
.theme-font-btn:hover { border-color: var(--brand); }
.theme-font-btn.active { border-color: var(--brand); background: var(--brand-soft); }
.theme-font-label { display: block; font-weight: var(--fw-medium); font-size: var(--fs-sm); }
.theme-font-name { font-size: var(--fs-xs); color: var(--n-text-3); }
.theme-radius-grid { display: flex; gap: var(--s-3); }
.theme-radius-btn {
  flex: 1;
  padding: var(--s-3);
  border: 1px solid var(--n-border);
  border-radius: var(--r-md);
  text-align: center;
  font-size: var(--fs-xs);
  transition: var(--tr-fast);
}
.theme-radius-btn:hover { border-color: var(--brand); }
.theme-radius-btn.active { border-color: var(--brand); background: var(--brand-soft); }
.theme-radius-preview { display: block; width: 40px; height: 24px; background: var(--brand-soft); margin: 0 auto var(--s-2); border: 1px solid var(--brand); }
.theme-slider-row { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-3); }
.theme-slider-label { font-size: var(--fs-xs); color: var(--n-text-2); width: 60px; }
.theme-slider-row input[type="range"] { flex: 1; }
.theme-slider-value { font-size: var(--fs-xs); color: var(--n-text-3); width: 40px; text-align: right; }
.theme-panel-footer {
  display: flex; justify-content: space-between;
  padding: var(--s-4) var(--s-6);
  border-top: 1px solid var(--n-border);
}

/* ---------- Site Admin Panel ---------- */
.site-admin-panel {
  position: fixed; inset: 0; z-index: var(--z-modal);
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out);
}
.site-admin-panel.active { opacity: 1; pointer-events: auto; }
.site-admin-panel::before {
  content: '';
  position: absolute; inset: 0;
}
.site-admin-panel > * { position: relative; z-index: 1; }
.site-admin-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-5) var(--s-6);
  background: var(--n-surface);
  border-bottom: 1px solid var(--n-border);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
.site-admin-header h2 { font-size: var(--fs-xl); font-weight: var(--fw-semibold); }
.site-admin-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-md);
  color: var(--n-text-2);
}
.site-admin-close:hover { background: var(--n-surface-2); }
.site-admin-body {
  background: var(--n-surface);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
  display: flex;
  max-width: 900px; width: 90vw;
  max-height: 80vh;
  box-shadow: var(--sh-xl);
}
.site-admin-tabs {
  display: flex; flex-direction: column;
  width: 180px; flex-shrink: 0;
  padding: var(--s-4);
  border-right: 1px solid var(--n-border);
}
.sa-tab {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  text-align: left;
  transition: var(--tr-fast);
  margin-bottom: var(--s-1);
}
.sa-tab:hover { background: var(--n-surface-2); }
.sa-tab.active { background: var(--brand-soft); color: var(--brand-deep); font-weight: var(--fw-medium); }
.site-admin-content { flex: 1; padding: var(--s-6); overflow-y: auto; }
.sa-section { margin-bottom: var(--s-8); }
.sa-section h3 { font-size: var(--fs-lg); font-weight: var(--fw-semibold); margin-bottom: var(--s-3); }
.sa-desc { font-size: var(--fs-sm); color: var(--n-text-2); margin-bottom: var(--s-4); }
.sa-form { display: flex; flex-direction: column; gap: var(--s-5); }
.sa-field { display: flex; flex-direction: column; gap: var(--s-2); }
.sa-field label { font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.sa-hint { font-size: var(--fs-xs); color: var(--n-text-3); }
.sa-actions { display: flex; gap: var(--s-3); margin-top: var(--s-5); }
.sa-icon-upload { display: flex; align-items: center; gap: var(--s-3); }
.sa-icon-preview { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; background: var(--n-surface-2); border-radius: var(--r-md); overflow: hidden; }
.sa-nav-list { display: flex; flex-direction: column; gap: var(--s-3); margin-bottom: var(--s-4); }
.sa-nav-item { display: flex; align-items: center; gap: var(--s-2); }
.sa-nav-handle { color: var(--n-text-3); cursor: grab; font-size: var(--fs-lg); }
.sa-nav-item .form-input { flex: 1; }
.sa-nav-remove { color: var(--f-error); font-size: var(--fs-lg); }
.sa-tag-list { display: flex; flex-direction: column; gap: var(--s-2); margin-bottom: var(--s-4); }
.sa-tag-item { display: flex; align-items: center; gap: var(--s-3); }
.sa-tag-item .form-input { flex: 1; }
.sa-tag-color { width: 36px; height: 36px; border: none; border-radius: var(--r-sm); cursor: pointer; }
.sa-tag-remove { color: var(--f-error); font-size: var(--fs-lg); }
.sa-warning { padding: var(--s-4); background: rgba(176, 142, 138, 0.1); border: 1px solid var(--c-rose-200); border-radius: var(--r-md); font-size: var(--fs-sm); color: var(--c-rose-600); margin-top: var(--s-4); }

/* ---------- History ---------- */
.history-sub { font-size: var(--fs-sm); color: var(--n-text-2); margin-bottom: var(--s-5); }
.history-list { display: flex; flex-direction: column; gap: var(--s-3); margin-bottom: var(--s-5); }
.history-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-4);
  border: 1px solid var(--n-border);
  border-radius: var(--r-md);
  transition: var(--tr-fast);
}
.history-item:hover { border-color: var(--brand); }
.history-info { cursor: pointer; flex: 1; }
.history-time { font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.history-diff { font-size: var(--fs-xs); color: var(--n-text-2); }
.history-preview-box { margin-top: var(--s-5); padding: var(--s-5); background: var(--n-surface-2); border-radius: var(--r-md); }
.history-preview-title { font-size: var(--fs-sm); font-weight: var(--fw-medium); margin-bottom: var(--s-3); }
.history-preview { max-height: 300px; overflow-y: auto; font-size: var(--fs-sm); }
.history-chapter { margin-bottom: var(--s-4); }
.history-chapter strong { display: block; margin-bottom: var(--s-2); }
.history-chapter p { color: var(--n-text-2); line-height: var(--lh-snug); }
.history-hr { border: none; border-top: 1px solid var(--n-border); margin: var(--s-4) 0; }

/* ---------- Icon System ---------- */
.icon-img { display: inline-block; vertical-align: middle; object-fit: contain; }
.icon-placeholder {
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--n-text-3);
}
.icon-size-20 { width: 20px; height: 20px; }
.icon-size-24 { width: 24px; height: 24px; }
.icon-size-28 { width: 28px; height: 28px; }
.icon-size-32 { width: 32px; height: 32px; }
.icon-size-40 { width: 40px; height: 40px; }
.icon-size-48 { width: 48px; height: 48px; }
.icon-size-56 { width: 56px; height: 56px; }
.icon-size-64 { width: 64px; height: 64px; }
.icon-size-96 { width: 96px; height: 96px; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  :root { --container-px: 16px; --nav-h: 60px; }
  .nav-menu {
    position: fixed; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column;
    background: var(--n-surface);
    border-bottom: 1px solid var(--n-border);
    padding: var(--s-4);
    transform: translateY(-100%);
    opacity: 0;
    transition: var(--tr-base);
    pointer-events: none;
  }
  .nav-menu.open { transform: none; opacity: 1; pointer-events: auto; }
  .nav-toggle {
    display: flex; flex-direction: column; gap: 4px;
    width: 24px; height: 24px;
    justify-content: center;
  }
  .nav-toggle span { display: block; height: 2px; background: var(--n-text); border-radius: 1px; transition: var(--tr-fast); }
  .hero-title { font-size: var(--fs-4xl); }
  .page-novel { flex-direction: column; }
  .novel-sidebar { width: 100%; position: static; }
  .about-profile { flex-direction: column; text-align: center; }
  .about-stats { flex-wrap: wrap; }
  .features-grid { grid-template-columns: 1fr; }
  .blog-list { grid-template-columns: 1fr; }
  .album-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .form-grid-2 { grid-template-columns: 1fr; }
  .site-admin-body { flex-direction: column; max-height: 90vh; }
  .site-admin-tabs { width: 100%; flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--n-border); }
  .theme-panel { width: 100%; right: -100%; }
}
