/* 全站视觉收束：公开阅读与私有工作台共用纸色、字阶和控件。
 * 保留首页角色构图、独立展厅画屏及各页布局/业务状态。
 */
:root {
  --archive-surface: #fffdf7;
  --archive-canvas: #f7f2e7;
  --archive-stroke: #ddd0b5;
  --archive-heading: #202744;
  --archive-caption: #6b6470;
  --archive-radius: 12px;
  --archive-shadow: 0 8px 28px #26203708;
}

body.backend-page,
body.public-site-page:not(.palace-home-page) {
  background: radial-gradient(ellipse at 12% 0, #e9dbc34a, transparent 42rem), var(--archive-canvas);
}

/* 工作台保持可阅读的纸页，不让不同批次的卡片边角各自成形。 */
body.backend-page .page-shell {
  width: min(1200px, calc(100% - 48px));
  margin-block: 32px 64px;
}
body.backend-page main.page-shell .panel {
  min-width: 0;
  padding: clamp(24px, 3.5vw, 40px);
  border: 1px solid var(--archive-stroke);
  border-radius: var(--archive-radius);
  background: var(--archive-surface);
  box-shadow: var(--archive-shadow);
}
body.backend-page main.page-shell .panel + .panel { margin-top: 24px; }
body.backend-page main.page-shell :is(h1, h2, h3) {
  color: var(--archive-heading);
  font-family: var(--ui-serif, "Noto Serif SC", "Songti SC", "SimSun", serif);
  line-height: 1.45;
  letter-spacing: .025em;
  overflow-wrap: anywhere;
}
body.backend-page main.page-shell h1 { margin: .3em 0 .5em; font-size: clamp(30px, 3.2vw, 42px); }
body.backend-page main.page-shell h2 { margin: 0 0 .65em; font-size: clamp(23px, 2.2vw, 28px); }
body.backend-page main.page-shell h3 { font-size: 21px; }
body.backend-page main.page-shell .eyebrow { font-size: 11px; letter-spacing: .12em; }
body.backend-page main.page-shell :is(.helptext, small, .byline, .summary) { color: var(--archive-caption); }
body.backend-page main.page-shell :is(.studio-author-hero, .account-banner, .profile-editor-intro) {
  border-top: 3px solid #b79957;
  background: linear-gradient(120deg, #fffdf7, #f7efdd);
  border-radius: var(--archive-radius);
}
body.backend-page main.page-shell :is(.section-heading, .profile-section-heading) { gap: 24px; }
body.backend-page main.page-shell .section-heading > div { min-width: 0; }
body.backend-page main.page-shell .section-heading p { margin-bottom: 0; max-width: 56em; }
body.backend-page main.page-shell :is(.work-card, .work-row, .saved-item, .notification-list article, .session-card, .chapter-card) {
  border-color: var(--archive-stroke);
  border-radius: var(--archive-radius);
}
body.backend-page main.page-shell :is(.saved-item, .work-row, .chapter-card) { background: var(--archive-surface); }
body.backend-page main.page-shell .saved-item.is-unavailable { background: #f3ebdb; border-style: dashed; }
body.backend-page main.page-shell .saved-item :is(h2, h3) { font-size: 21px; }
body.backend-page main.page-shell .saved-item :is(h2, h3) a { color: var(--archive-heading); text-decoration: none; }
body.backend-page main.page-shell .saved-item :is(h2, h3) a:hover { color: #9f2945; text-decoration: underline; text-underline-offset: 4px; }
body.backend-page main.page-shell :is(.studio-shortcuts, .compose-steps) { border-radius: var(--archive-radius); }
body.backend-page main.page-shell :is(.studio-shortcuts a, .compose-steps a) { border-radius: 6px; }
body.backend-page main.page-shell :is(.studio-shortcuts a, .compose-steps a):hover { background: #f0e5ce; }
body.backend-page .backend-footer { margin-top: auto; border-top: 1px solid #c5a46755; }

/* 普通按钮与表单统一高度；画屏箭头、动图、菜单和角色切换沿用专有形状。 */
body.backend-page main.page-shell :is(.button, button:not(.text-button):not(.notice-dismiss)),
body.public-site-page main :is(.button, .reader-actions .button) {
  min-height: 44px;
  box-sizing: border-box;
  border-radius: 8px;
  padding: 10px 18px;
  line-height: 1.6;
  white-space: normal;
  max-width: 100%;
}
body.backend-page main.page-shell :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea) {
  border-color: #cfc2aa;
  border-radius: 8px;
  background: #fffefa;
}
body.backend-page main.page-shell :is(.field, .account-panel) label { font-size: 14px; }
body.backend-page main.page-shell :is(.notice, .empty-state, .security-method) {
  border-radius: 8px;
  background: #f5eddd;
  color: #625565;
}
body.backend-page main.page-shell :is(.form-errors, .errorlist) { background: #fff0ee; color: #92233e; }
body.backend-page main.page-shell :is(a, button, summary, input, select, textarea):focus-visible {
  outline: 3px solid #9e7836;
  outline-offset: 3px;
}

/* 公开页的内容层与工作台呼应，图像比例和阅读宽度由原页面负责。 */
body.public-site-page main :is(.work-card, .post-card, .profile-series-grid article, .profile-post-list article) {
  border: 1px solid var(--archive-stroke);
  border-radius: var(--archive-radius);
  background: var(--archive-surface);
  box-shadow: var(--archive-shadow);
}
body.public-site-page main .work-card .card-visual { border-radius: 11px 11px 0 0; }
body.public-site-page.serial-collection-page main .series-entry .card-visual { border-radius: 11px 0 0 11px; }
body.public-site-page main .work-card .card-body { padding: 22px; }
body.public-site-page main .work-card .card-body h3 { margin-top: 0; color: var(--archive-heading); font-size: 21px; }
body.public-site-page main .work-card .card-summary { color: #625d69; line-height: 1.85; }
body.public-site-page:not(.palace-home-page) main :is(.page-hero, .post-hero, .profile-cover, .series-hero) {
  background: linear-gradient(120deg, #fffdf7, #f3e8d2);
  border-bottom: 1px solid var(--archive-stroke);
}
body.public-site-page:not(.palace-home-page):not(.media-reading-page) main :is(.page-hero, .post-hero, .profile-cover, .series-hero) h1 {
  font-size: clamp(30px, 3.4vw, 44px);
  line-height: 1.4;
  color: var(--archive-heading);
}
body.public-site-page main :is(.profile-stats, .series-reader-actions, .series-progress-note, .post-compose-studio) {
  border: 1px solid var(--archive-stroke);
  border-radius: var(--archive-radius);
  background: var(--archive-surface);
}
body.public-site-page main :is(.profile-tabs a, .archive-category-tabs a) { text-underline-offset: 5px; }
/* 单张作品仍占一个正常卡位，避免被 auto-fit 拉成长横幅。 */
body.public-site-page.author-profile-page main .work-grid.compact-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
}
body.public-site-page main :is(.pagination, .saved-pagination, .profile-pagination, .post-pagination) a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--archive-stroke);
  border-radius: 8px;
  background: var(--archive-surface);
  text-decoration: none;
}

/* 错误页也沿用同一张纸，仍可在模板异常时独立加载。 */
.archive-error-page .error-paper { border-radius: 18px; border-color: var(--archive-stroke); }
.archive-error-page .error-actions a { border-radius: 8px; min-height: 44px; }

@media (max-width: 760px) {
  body.backend-page .page-shell { width: calc(100% - 28px); margin-block: 20px 40px; }
  body.backend-page main.page-shell .panel { padding: 22px 18px; }
  body.backend-page main.page-shell .panel + .panel { margin-top: 18px; }
  body.backend-page main.page-shell :is(.section-heading, .profile-section-heading) { gap: 16px; }
  body.backend-page main.page-shell .section-heading > .button { align-self: flex-start; }
  body.public-site-page main .work-card .card-body { padding: 18px; }
}
@media (max-width: 480px) {
  body.public-site-page.serial-collection-page main .series-entry .card-visual { border-radius: 11px 11px 0 0; }
}
