:root {
  color-scheme: light;
  --page: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f5f5f5;
  --text: #111111;
  --muted: #686868;
  --border: #dedede;
  --strong: #111111;
  --strong-text: #ffffff;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.08);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --page: #0b0b0b;
  --surface: #151515;
  --surface-soft: #202020;
  --text: #f5f5f5;
  --muted: #a5a5a5;
  --border: #343434;
  --strong: #f5f5f5;
  --strong-text: #111111;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--page); }

body {
  min-height: 100vh;
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  transition: background-color .2s ease, color .2s ease;
}

a { color: var(--text); text-underline-offset: 3px; }
a:hover { color: var(--muted); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: color-mix(in srgb, var(--page) 94%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.navbar-brand { color: var(--text) !important; font-weight: 800; letter-spacing: -.04em; white-space: nowrap; }
.header-search {
  display: flex;
  width: 100%;
  max-width: 300px;
  min-width: 0;
  height: 38px;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
}
.header-search:focus-within { border-color: var(--text); }
.header-search input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0 0 0 .9rem;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: .86rem;
}
.header-search input::placeholder { color: var(--muted); }
.header-search button {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  color: var(--text);
  background: transparent;
}
.header-search button:hover { background: var(--strong); color: var(--strong-text); }
.nav-link { color: var(--muted) !important; border-radius: 999px; padding-inline: .8rem !important; }
.nav-link:hover, .nav-link.active { color: var(--text) !important; background: var(--surface-soft); }

.page-shell { min-height: calc(100vh - 155px); padding-top: 2rem; padding-bottom: 3.5rem; }
.page-heading { font-weight: 800; letter-spacing: -.035em; }
.section-title { font-weight: 750; letter-spacing: -.025em; }
.eyebrow { color: var(--muted); text-transform: uppercase; letter-spacing: .13em; font-size: .72rem; font-weight: 700; }

.surface,
.card,
.list-group-item,
.dropdown-menu,
.modal-content,
.accordion-item,
.table {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border) !important;
}

.surface { border: 1px solid var(--border); border-radius: 18px; }
.card { border: 1px solid var(--border); border-radius: 16px; box-shadow: none; overflow: hidden; }
.card:hover { border-color: var(--muted) !important; }
.card-body { padding: 1rem; }
.card-img-top, .comic-cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: var(--surface-soft);
}

.home-community-modal .modal-dialog { width: min(92vw, 540px); }
.home-community-modal .modal-content {
  position: relative;
  overflow: hidden;
  padding: clamp(1.7rem, 5vw, 2.6rem);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .28);
}
.home-community-modal .modal-content::before {
  position: absolute;
  top: -95px;
  right: -75px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--strong) 7%, transparent);
  content: "";
  pointer-events: none;
}
.home-community-close {
  position: absolute;
  z-index: 2;
  top: 1rem;
  right: 1rem;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text);
  background: var(--surface-soft);
}
.home-community-close:hover { color: var(--strong-text); background: var(--strong); }
.home-community-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  margin-bottom: 1.35rem;
  border-radius: 18px;
  color: var(--strong-text);
  background: var(--strong);
  font-size: 1.65rem;
  transform: rotate(-4deg);
}
.home-community-title {
  max-width: 440px;
  margin: .55rem 0 .8rem;
  font-size: clamp(1.75rem, 5vw, 2.55rem);
  font-weight: 850;
  letter-spacing: -.045em;
  line-height: 1.04;
}
.home-community-message {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.7;
  white-space: pre-line;
}
.home-community-zh {
  margin-top: 1.2rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
}
.home-community-zh strong { display: block; color: var(--text); font-size: .95rem; }
.home-community-zh p { margin: .35rem 0 0; font-size: .84rem; line-height: 1.65; white-space: pre-line; }
.home-community-action {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
  padding: .65rem 1rem .65rem 1.15rem;
  border-radius: 14px;
  text-align: left;
}
.home-community-action span { display: flex; flex-direction: column; font-weight: 750; }
.home-community-action small { margin-top: .05rem; font-size: .72rem; font-weight: 500; opacity: .72; }
.home-community-later {
  display: flex;
  width: 100%;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  margin: .8rem auto -.25rem;
  padding: .7rem 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  background: var(--surface-soft);
  font-size: 1rem;
  font-weight: 700;
  transition: border-color .18s ease, background-color .18s ease, transform .18s ease;
}
.home-community-later:hover {
  border-color: var(--muted);
  color: var(--text);
  background: var(--surface);
  transform: translateY(-1px);
}
.home-community-later:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--strong) 28%, transparent);
  outline-offset: 2px;
}
.home-community-later span { color: var(--muted); font-weight: 650; }

.comic-title { color: var(--text); font-weight: 700; line-height: 1.35; }
.comic-meta, .text-muted, .text-secondary { color: var(--muted) !important; }
.comic-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1rem; }
.comic-grid.compact { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.monthly-hot-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: start; gap: 1rem; }
.hot-rank {
  position: absolute;
  z-index: 2;
  top: .65rem;
  left: .65rem;
  padding: .3rem .55rem;
  border-radius: 999px;
  color: var(--strong-text);
  background: var(--strong);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .06em;
}
.hot-card-body { min-height: 0; padding: .72rem .78rem; }
.hot-basic-line { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; min-width: 0; }
.hot-basic-line .comic-title { min-width: 0; flex: 1 1 auto; }
.hot-basic-line > span { max-width: 48%; flex: 0 1 auto; font-size: .7rem; white-space: nowrap; }
.tag-list.hot-tag-line { flex-wrap: nowrap; margin-top: .5rem; overflow: hidden; }
.hot-tag-line .tag-pill { flex: 0 0 auto; padding: .24rem .48rem; font-size: .68rem; }

.tag-list { display: flex; flex-wrap: wrap; gap: .45rem; }
.tag-pill,
.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .38rem .68rem;
  border: 1px solid var(--border) !important;
  border-radius: 999px;
  background: var(--surface-soft) !important;
  color: var(--text) !important;
  font-size: .76rem;
  font-weight: 600;
  text-decoration: none;
}
.tag-pill:hover { border-color: var(--text) !important; color: var(--text); }

.btn {
  border-radius: 999px;
  font-weight: 650;
  padding-inline: 1.05rem;
}
.btn-primary,
.btn-dark,
.btn-success,
.btn-danger,
.btn-info,
.btn-warning,
.bg-primary,
.bg-dark,
.bg-info,
.bg-success,
.bg-danger,
.bg-warning,
.bg-secondary,
.text-bg-light {
  background: var(--strong) !important;
  border-color: var(--strong) !important;
  color: var(--strong-text) !important;
}
.btn-primary:hover,
.btn-dark:hover,
.btn-success:hover,
.btn-danger:hover,
.btn-info:hover,
.btn-warning:hover {
  opacity: .78;
  background: var(--strong) !important;
  border-color: var(--strong) !important;
  color: var(--strong-text) !important;
}
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-dark,
.btn-outline-danger,
.btn-outline-light {
  color: var(--text) !important;
  background: transparent !important;
  border-color: var(--border) !important;
}
.btn-outline-primary:hover,
.btn-outline-secondary:hover,
.btn-outline-dark:hover,
.btn-outline-danger:hover,
.btn-outline-light:hover {
  color: var(--strong-text) !important;
  background: var(--strong) !important;
  border-color: var(--strong) !important;
}
.btn-light { color: var(--strong-text); background: var(--strong); border-color: var(--strong); }

.form-control,
.form-select,
.form-check-input,
.input-group-text {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
  border-radius: 12px;
}
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  color: var(--text);
  background: var(--surface);
  border-color: var(--text);
  box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--text) 12%, transparent);
}
.form-check-input:checked { background-color: var(--strong); border-color: var(--strong); }
.form-control::placeholder { color: var(--muted); opacity: .8; }
.captcha-row { display: flex; align-items: center; gap: .5rem; }
.captcha-input { width: 78px; flex: 0 1 78px; }
.captcha-image { width: 120px; height: 38px; flex: 0 0 120px; object-fit: cover; }
.captcha-row .btn { padding-inline: .7rem; }

.alert { color: var(--text); background: var(--surface-soft); border: 1px solid var(--border); border-radius: 14px; }
.alert-success, .alert-warning, .alert-danger { color: var(--text); background: var(--surface-soft); border-color: var(--border); }
.btn-close { filter: grayscale(1); }
html[data-theme="dark"] .btn-close { filter: invert(1) grayscale(1); }

.hero {
  padding: clamp(2rem, 6vw, 5rem);
  border: 1px solid var(--border);
  border-radius: 26px;
  background: var(--surface-soft);
}
.hero h1 { max-width: 760px; font-size: clamp(2rem, 5vw, 4.5rem); font-weight: 850; letter-spacing: -.06em; line-height: .98; }
.search-bar { max-width: 760px; }
.search-bar .btn { min-width: 86px; white-space: nowrap; }

.feature-cover { min-height: 390px; object-fit: cover; }
.manga-detail-cover { border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); }
.chapter-list .list-group-item { padding: 1rem 1.1rem; }
.reader-page { display: block; max-width: 100%; margin: 0 auto; background: var(--surface-soft); }
.reader-shell { max-width: 1100px; margin-inline: auto; }

.stat-card { padding: 1.25rem; border: 1px solid var(--border); border-radius: 16px; }
.stat-number { margin: .25rem 0 0; font-size: 2rem; font-weight: 800; letter-spacing: -.04em; }
.profile-hero { display: flex; align-items: center; gap: 1.25rem; }
.profile-avatar { width: 92px; height: 92px; flex: 0 0 auto; border: 1px solid var(--border); border-radius: 50%; object-fit: cover; background: var(--surface-soft); }
.profile-avatar-edit { position: relative; display: block; flex: 0 0 auto; overflow: hidden; border-radius: 50%; color: #fff; text-decoration: none; }
.profile-avatar-edit .profile-avatar { display: block; }
.profile-avatar-edit > span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: .25rem; border-radius: 50%; color: #fff; background: rgba(0,0,0,.58); font-size: .72rem; font-weight: 700; opacity: 0; transition: opacity .18s ease; }
.profile-avatar-edit:hover > span,
.profile-avatar-edit:focus-visible > span { opacity: 1; }
.min-w-0 { min-width: 0; }
.profile-shortcuts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
.profile-shortcuts a { display: flex; align-items: center; gap: .8rem; padding: 1rem; text-decoration: none; }
.profile-shortcuts a > i { width: 34px; flex: 0 0 auto; text-align: center; font-size: 1.15rem; }
.profile-shortcuts strong,
.profile-shortcuts small { display: block; }
.profile-shortcuts small { margin-top: .2rem; color: var(--muted); }

.compact-search { display: flex; gap: .5rem; max-width: 720px; }
.novel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.novel-card { display: flex; min-width: 0; overflow: hidden; }
.novel-cover-wrap { width: 138px; min-height: 184px; flex: 0 0 138px; background: var(--surface-soft); text-decoration: none; }
.novel-cover { width: 100%; height: 100%; object-fit: cover; }
.novel-cover-placeholder { display: flex; width: 100%; height: 100%; min-height: 184px; align-items: center; justify-content: center; flex-direction: column; gap: .75rem; padding: 1rem; color: var(--text); background: var(--surface-soft); text-align: center; }
.novel-cover-placeholder i { font-size: 2rem; }
.novel-cover-placeholder b { line-height: 1.35; }
.novel-card-body { min-width: 0; padding: 1.15rem; }
.novel-summary { display: -webkit-box; margin: .75rem 0; overflow: hidden; line-height: 1.65; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.novel-manage-list .list-group-item { padding: 1rem 1.15rem; }
.writer-shell { max-width: 760px; margin-inline: auto; }
.writer-shell.wide { max-width: 980px; }
.novel-editor { min-height: 58vh; resize: vertical; line-height: 1.8; }
.novel-detail { display: flex; align-items: flex-start; gap: 2rem; }
.novel-detail-cover { width: 190px; min-height: 254px; flex: 0 0 190px; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-soft); }
.novel-detail-cover img { width: 100%; height: 254px; object-fit: cover; }
.novel-detail-cover .novel-cover-placeholder { min-height: 254px; }
.novel-detail-summary { max-width: 760px; color: var(--muted); line-height: 1.8; white-space: pre-wrap; }
.mini-avatar { width: 30px; height: 30px; border: 1px solid var(--border); border-radius: 50%; object-fit: cover; }
.novel-chapter-number { display: grid; width: 40px; height: 40px; flex: 0 0 auto; place-items: center; border: 1px solid var(--border); border-radius: 50%; font-weight: 700; }
.novel-like-btn.active,
.community-like.active { color: var(--strong-text) !important; background: var(--strong) !important; border-color: var(--strong) !important; }
.story-reader { max-width: 820px; margin-inline: auto; }
.story-reader-header { padding: 2rem 0; border-bottom: 1px solid var(--border); text-align: center; }
.story-reader-header h1 { margin: .5rem 0 1rem; font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; }
.story-content { padding: clamp(2rem, 6vw, 4.5rem) clamp(.25rem, 4vw, 2rem); font-family: "Noto Serif SC", "Songti SC", serif; font-size: 1.08rem; line-height: 2.05; white-space: pre-wrap; overflow-wrap: anywhere; }
.story-pager { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; padding: 1.5rem 0; border-top: 1px solid var(--border); }
.story-pager > :last-child { justify-self: end; }

.community-shell { max-width: 820px; margin-inline: auto; }
.community-feed { display: grid; gap: 1rem; }
.community-avatar { width: 46px; height: 46px; flex: 0 0 auto; border: 1px solid var(--border); border-radius: 50%; object-fit: cover; background: var(--surface-soft); }
.community-avatar.small { width: 36px; height: 36px; }
.community-compose-text { resize: vertical; box-shadow: none !important; }
.community-content-preview,
.community-post-content,
.community-comment-content { display: block; color: var(--text); line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.community-actions { display: flex; align-items: center; gap: 1.5rem; }
.community-actions button,
.community-actions a { display: inline-flex; align-items: center; gap: .4rem; padding: .25rem 0; border: 0; color: var(--muted); background: transparent; font-size: .88rem; text-decoration: none; }
.community-actions button:hover,
.community-actions a:hover { color: var(--text); }
.community-like.active { padding: .3rem .65rem; border-radius: 999px; }
.community-comments { display: grid; gap: 0; }
.community-comment { display: flex; gap: .75rem; padding: 1rem 0; border-top: 1px solid var(--border); }

.table { --bs-table-bg: var(--surface); --bs-table-color: var(--text); --bs-table-border-color: var(--border); }
.table-hover > tbody > tr:hover > * { --bs-table-accent-bg: var(--surface-soft); color: var(--text); }
.table td, .table th { vertical-align: middle; }

.admin-body {
  --admin-accent: #409eff;
  --admin-sidebar: #263445;
  --admin-sidebar-hover: #1f2d3d;
  --admin-sidebar-text: #bfcbd9;
  --admin-canvas: #f0f2f5;
  background: var(--admin-canvas);
}
html[data-theme="dark"] .admin-body { --admin-canvas: #101214; }

.admin-layout { min-height: 100vh; }
.admin-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1050;
  display: flex;
  width: 240px;
  flex-direction: column;
  overflow-y: auto;
  color: #fff;
  background: var(--admin-sidebar);
  box-shadow: 2px 0 8px rgba(0, 0, 0, .12);
  transition: transform .22s ease;
}
.admin-brand {
  display: flex;
  min-height: 64px;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1.2rem;
  color: #fff;
  text-decoration: none;
  background: rgba(0, 0, 0, .12);
}
.admin-brand:hover { color: #fff; }
.admin-brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: var(--admin-accent);
  font-weight: 800;
}
.admin-brand small { display: block; margin-top: .1rem; color: #8492a6; font-size: .58rem; letter-spacing: .16em; }
.admin-menu { flex: 1; padding: .8rem 0 1.25rem; }
.admin-menu-label { padding: 1rem 1.25rem .45rem; color: #738397; font-size: .7rem; font-weight: 700; letter-spacing: .1em; }
.admin-menu a,
.admin-sidebar-footer a {
  position: relative;
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: .85rem;
  padding: .72rem 1.35rem;
  color: var(--admin-sidebar-text);
  text-decoration: none;
  transition: color .15s ease, background-color .15s ease;
}
.admin-menu a i,
.admin-sidebar-footer a i { width: 20px; text-align: center; }
.admin-menu a:hover,
.admin-menu a.active,
.admin-sidebar-footer a:hover { color: #fff; background: var(--admin-sidebar-hover); }
.admin-menu a.active::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--admin-accent);
  content: "";
}
.admin-menu a.active i { color: var(--admin-accent); }
.admin-sidebar-footer { border-top: 1px solid rgba(255, 255, 255, .08); padding: .35rem 0; }
.admin-workspace { min-height: 100vh; margin-left: 240px; }
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  padding: .55rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 1px 4px rgba(0, 21, 41, .08);
  backdrop-filter: blur(14px);
}
.admin-content { width: 100%; max-width: 1680px; margin: 0 auto; padding: 1.5rem; }
.admin-content > .surface,
.admin-content > .card,
.admin-content .surface,
.admin-content .card { border-radius: 6px; box-shadow: 0 1px 4px rgba(0, 21, 41, .08); }
.admin-content .table-responsive { border-radius: 6px; background: var(--surface); }
.admin-content .btn { border-radius: 4px; }
.admin-content .form-control,
.admin-content .form-select,
.admin-content .input-group-text { border-radius: 4px; }
.admin-content .stat-card { border-radius: 6px; background: var(--surface); box-shadow: 0 1px 4px rgba(0, 21, 41, .08); }
.admin-icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
}
.admin-icon-button:hover { color: var(--admin-accent); border-color: var(--admin-accent); }
#adminMenuToggle { display: none; }
.admin-user-chip {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 38px;
  padding: 0 .8rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  font-size: .85rem;
}
.admin-switch-card {
  display: flex;
  height: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-soft);
}
.admin-switch-card small { display: block; margin-top: .35rem; color: var(--muted); font-weight: 400; }
.admin-switch-card .form-check-input { width: 2.5em; height: 1.35em; }
.admin-switch-card .form-check-input:checked { background-color: var(--admin-accent); border-color: var(--admin-accent); }
.admin-sidebar-backdrop { display: none; }

.analytics-metric { padding: 1.2rem; }
.analytics-metric-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 6px; color: #fff; background: var(--admin-accent); }
.analytics-metric-value { margin-top: 1rem; font-size: clamp(1.65rem, 3vw, 2.35rem); font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.analytics-delta { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.analytics-delta.up { color: #16803c; background: rgba(40, 167, 69, .12); }
.analytics-delta.down { color: #c03535; background: rgba(220, 53, 69, .12); }
.analytics-delta.flat { color: var(--muted); background: var(--surface-soft); }
.analytics-legend { display: flex; gap: 1rem; color: var(--muted); font-size: .78rem; }
.analytics-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.analytics-legend i { width: 10px; height: 10px; border-radius: 2px; }
.analytics-legend .pv,
.analytics-chart-bars .pv { background: var(--admin-accent); }
.analytics-legend .uv,
.analytics-chart-bars .uv { background: #8ebcff; }
.analytics-chart-scroll { overflow-x: auto; }
.analytics-chart { display: grid; min-width: max(620px, calc(var(--chart-columns) * 24px)); height: 270px; grid-template-columns: repeat(var(--chart-columns), minmax(12px, 1fr)); align-items: end; gap: clamp(3px, .6vw, 10px); overflow: visible; }
.analytics-chart-column { display: grid; height: 100%; min-width: 0; grid-template-rows: 1fr 24px; align-items: end; }
.analytics-chart-bars { display: flex; height: 220px; align-items: end; justify-content: center; gap: 2px; border-bottom: 1px solid var(--border); background: repeating-linear-gradient(to top, transparent 0, transparent 54px, var(--border) 55px); }
.analytics-chart-bars i { display: block; width: min(42%, 18px); min-height: 0; border-radius: 3px 3px 0 0; transition: height .2s ease; }
.analytics-chart-column > span { overflow: hidden; padding-top: .4rem; color: var(--muted); font-size: .65rem; text-align: center; white-space: nowrap; }
.analytics-comparison-card { min-height: 410px; }
.analytics-metric-switch .btn { min-width: 46px; }
.analytics-line-legend { display: flex; flex-wrap: wrap; gap: .5rem 1rem; color: var(--muted); font-size: .78rem; }
.analytics-line-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.analytics-line-legend i { width: 18px; height: 3px; border-radius: 999px; }
.analytics-line-legend .current { background: var(--admin-accent); }
.analytics-line-legend .previous { background: #8ebcff; }
.analytics-line-wrap { position: relative; min-width: 0; }
.analytics-line-canvas { display: block; width: 100%; height: 290px; touch-action: pan-y; }
.analytics-line-tooltip {
  position: absolute;
  z-index: 3;
  min-width: 165px;
  padding: .6rem .7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow);
  pointer-events: none;
  font-size: .75rem;
}
.analytics-line-tooltip strong,
.analytics-line-tooltip span { display: block; }
.analytics-line-tooltip span { margin-top: .25rem; color: var(--muted); }
.analytics-summary { display: grid; gap: 0; }
.analytics-summary > div { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 0; border-bottom: 1px solid var(--border); }
.analytics-summary dt { color: var(--muted); font-weight: 500; }
.analytics-summary dd { margin: 0; font-size: 1.1rem; font-weight: 750; text-align: right; }
.analytics-progress { display: inline-block; width: 80px; height: 6px; margin-right: .5rem; overflow: hidden; border-radius: 999px; background: var(--surface-soft); vertical-align: middle; }
.analytics-progress i { display: block; height: 100%; border-radius: inherit; background: var(--admin-accent); }
.geo-database-card { padding: 1rem 0; border-bottom: 1px solid var(--border); }
.geo-database-card:first-of-type { padding-top: .25rem; }
.geo-database-card:last-of-type { border-bottom: 0; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text);
  background: var(--surface);
}
.theme-toggle:hover { background: var(--strong); color: var(--strong-text); border-color: var(--strong); }

.submission-switch { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.submission-switch label { cursor: pointer; padding: 1rem; border: 1px solid var(--border); border-radius: 14px; }
.submission-switch label:has(input:checked) { border-color: var(--text); background: var(--surface-soft); }
.submission-switch input { margin-right: .4rem; }
.submission-kind-tabs { display: flex; gap: .5rem; }
.contribution-novel-icon { display: grid; width: 68px; height: 68px; place-items: center; border-radius: 18px; color: var(--strong-text); background: var(--strong); font-size: 1.6rem; }

.site-footer { margin-bottom: 6.5rem; border-top: 1px solid var(--border); background: var(--surface); }
.site-tabbar {
  position: fixed;
  z-index: 1040;
  right: 50%;
  bottom: 1rem;
  display: grid;
  width: min(560px, calc(100% - 2rem));
  grid-template-columns: repeat(5, 1fr);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow);
  transform: translateX(50%);
  backdrop-filter: blur(16px);
}
.site-tabbar a {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: .25rem;
  color: var(--muted);
  font-size: .74rem;
  font-weight: 650;
  text-decoration: none;
}
.site-tabbar a i { font-size: 1.05rem; }
.site-tabbar a:hover,
.site-tabbar a.active { color: var(--text); background: var(--surface-soft); }
.pagination .page-link { color: var(--text); background: var(--surface); border-color: var(--border); }
.pagination .active > .page-link { color: var(--strong-text); background: var(--strong); border-color: var(--strong); }

@media (max-width: 1199px) {
  .comic-grid, .comic-grid.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .profile-shortcuts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 991px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-body.admin-menu-open .admin-sidebar { transform: translateX(0); }
  .admin-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
    display: block;
    visibility: hidden;
    background: rgba(0, 0, 0, .45);
    opacity: 0;
    transition: opacity .22s ease, visibility .22s ease;
  }
  .admin-body.admin-menu-open .admin-sidebar-backdrop { visibility: visible; opacity: 1; }
  .admin-workspace { margin-left: 0; }
  #adminMenuToggle { display: inline-grid; }
  .admin-content { padding: 1rem; }
  .admin-topbar { padding-inline: 1rem; }
  .admin-user-chip span { display: none; }
}

@media (max-width: 767px) {
  .page-shell { padding-top: 1.25rem; }
  .comic-grid, .comic-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .monthly-hot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .novel-grid { grid-template-columns: 1fr; }
  .novel-card-body { padding: .9rem; }
  .novel-detail { flex-direction: column; gap: 1.25rem; }
  .novel-detail-cover { width: 138px; min-height: 184px; flex-basis: auto; }
  .novel-detail-cover img,
  .novel-detail-cover .novel-cover-placeholder { height: 184px; min-height: 184px; }
  .hero { padding: 1.5rem; border-radius: 20px; }
  .feature-cover { min-height: auto; }
  .table-responsive { border: 1px solid var(--border); border-radius: 14px; }
  .submission-switch { grid-template-columns: 1fr; }
  .profile-hero { align-items: flex-start; flex-wrap: wrap; }
  .profile-avatar { width: 76px; height: 76px; }
  .profile-avatar-edit > span { opacity: 1; background: linear-gradient(transparent 46%, rgba(0,0,0,.72)); justify-content: flex-end; padding-bottom: .45rem; font-size: .62rem; }
  .profile-avatar-edit > span i { display: none; }
  .site-footer { margin-bottom: 5.2rem; }
  .site-tabbar { right: 0; bottom: 0; width: 100%; border-width: 1px 0 0; border-radius: 0; transform: none; }
  .site-tabbar a { min-height: 66px; padding-bottom: env(safe-area-inset-bottom); }
  .admin-topbar strong { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .admin-user-chip { display: none; }
}

@media (max-width: 359px) {
  .navbar-brand { font-size: 1rem; }
  .header-search input { padding-left: .65rem; font-size: .78rem; }
  .captcha-row { gap: .35rem; }
  .captcha-input { width: 68px; flex-basis: 68px; }
  .captcha-image { width: 104px; flex-basis: 104px; }
  .captcha-row .btn { padding-inline: .45rem; font-size: .75rem; }
}
