:root {
  --neo-bg: #f2ece1;
  --neo-surface: #faf6ee;
  --neo-subtle: #eae1d2;
  --neo-celadon-tint: #e3ece8;
  --neo-ink: #221f1b;
  --neo-muted: #675f55;
  --neo-celadon: #265650;
  --neo-celadon-soft: rgba(38, 86, 80, 0.11);
  --neo-cinnabar: #9d3327;
  --neo-cinnabar-soft: rgba(157, 51, 39, 0.1);
  --neo-line: rgba(44, 36, 26, 0.1);
  --neo-shadow: 0 12px 36px rgba(42, 33, 22, 0.055);
  --font-display: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --page-inset: clamp(1.25rem, 5.5vw, 5rem);
  --masthead-height: 64px;
}

body {
  background-color: var(--neo-bg);
  background-image: radial-gradient(ellipse 90% 460px at 50% 0%, #e9decb 0%, var(--neo-bg) 76%);
  background-repeat: no-repeat;
  color: var(--neo-ink);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.site-masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  width: 100%;
  max-width: none;
  margin: 0;
  height: var(--masthead-height);
  min-height: var(--masthead-height);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 var(--page-inset);
  background: rgba(242, 236, 225, 0.9);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  transform: translateZ(0);
  border-bottom: 1px solid var(--neo-line);
  color: var(--neo-ink);
}

.site-masthead .brand,
.site-footer .brand-footer {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 700 1.08rem/1 var(--font-display);
  letter-spacing: 0.04em;
  color: var(--neo-ink);
  text-decoration: none;
  white-space: nowrap;
}

.brand-logo {
  display: block;
  border-radius: 7px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(157, 51, 39, 0.18);
}

.top-nav {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 2.4vw, 2rem);
}

.top-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--neo-muted);
  text-decoration: none;
  transition: color 0.18s ease;
}

.top-nav a:hover {
  color: var(--neo-ink);
}

.top-nav .nav-record {
  padding: 0.38rem 1rem;
  border-radius: 999px;
  background: var(--neo-surface);
  border: 1px solid var(--neo-line);
  color: var(--neo-ink);
  font-weight: 600;
}

.top-nav .nav-record:hover {
  background: var(--neo-subtle);
}

.site-footer {
  padding: 3rem var(--page-inset) 2.6rem;
  color: var(--neo-muted);
  background: #ebe3d4;
  border-top: 1px solid var(--neo-line);
  text-align: left;
}

.footer-inner {
  max-width: 1040px;
  margin: 0 auto;
}

.footer-brand-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
}

.footer-tagline {
  font-size: 0.82rem;
  color: var(--neo-muted);
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  max-width: none;
  gap: 0.3rem 1.6rem;
  margin: 1rem 0 0.4rem;
}

.site-footer nav a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  font-size: 0.85rem;
  color: var(--neo-muted);
  text-decoration: none;
}

.site-footer nav a:hover {
  color: var(--neo-ink);
  text-decoration: underline;
}

.site-footer #preview-banner {
  background: transparent;
  text-align: left;
  padding: 0;
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--neo-celadon);
}

.page {
  max-width: 860px;
  margin: 0 auto;
  padding: clamp(2.4rem, 5vw, 4rem) var(--page-inset) 4.2rem;
}

.page.wide {
  max-width: 1060px;
}

.page h1, .page h2, dialog h2 {
  font-family: var(--font-display);
  letter-spacing: 0.02em;
}

.page h3 {
  font-family: var(--font-ui);
  letter-spacing: -0.01em;
}

.page > h1 {
  font-size: clamp(1.85rem, 3.4vw, 2.45rem);
  font-weight: 700;
  margin-bottom: 0.9rem;
}

.page .box, dialog {
  background: var(--neo-surface);
  border: 1px solid var(--neo-line);
  border-radius: 20px;
  box-shadow: var(--neo-shadow);
}

.page .box {
  padding: clamp(1.4rem, 3vw, 2.2rem);
  margin: 1.4rem 0;
}

dialog {
  max-width: min(540px, calc(100vw - 24px));
  padding: 1.75rem;
  color: var(--neo-ink);
}

dialog::backdrop {
  background: rgba(28, 24, 19, 0.42);
  backdrop-filter: blur(5px);
}

input[type=text], input[type=password], input[type=date], textarea, select {
  background: #fdfbf7;
  border: 1px solid rgba(44, 36, 26, 0.18);
  border-radius: 12px;
  color: var(--neo-ink);
  padding: 0.78rem 0.95rem;
  font-size: 1rem;
}

.artwork-view {
  margin: 0;
  text-align: center;
}

.artwork-view img {
  width: min(100%, 340px);
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 20px;
  margin: 0 auto 1.15rem;
  display: block;
  box-shadow: 0 14px 34px rgba(34, 28, 20, 0.14);
}

.artwork-view figcaption h2 {
  font-size: 1.45rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
}

.artwork-view figcaption .art-modal-craft {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--neo-celadon);
  background: var(--neo-celadon-soft);
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 0.65rem;
}

.artwork-view figcaption p {
  font-size: 0.92rem;
  color: var(--neo-muted);
  line-height: 1.7;
  margin: 0.35rem 0;
}

.page .primary, dialog .primary, .btn-ink {
  background: var(--neo-celadon);
  color: #faf6ee;
  border: 1px solid var(--neo-celadon);
  border-radius: 999px;
  font-weight: 600;
  padding: 0.72rem 1.65rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: transform 0.16s ease, background 0.16s ease;
}

.page .primary:hover, dialog .primary:hover, .btn-ink:hover {
  background: #1e4641;
  color: #ffffff;
}

.page .secondary, dialog .secondary, .btn-pill-ghost {
  background: var(--neo-surface);
  color: var(--neo-ink);
  border: 1px solid rgba(44, 36, 26, 0.16);
  border-radius: 999px;
  font-weight: 550;
  padding: 0.7rem 1.45rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.16s ease;
}

.page .secondary:hover, dialog .secondary:hover, .btn-pill-ghost:hover {
  background: var(--neo-subtle);
}

#toast {
  border-radius: 999px;
  background: rgba(34, 31, 27, 0.94);
  backdrop-filter: blur(10px);
  color: #faf6ee;
  padding: 0.68rem 1.35rem;
  font-size: 0.88rem;
  box-shadow: 0 10px 28px rgba(24, 20, 14, 0.2);
}

@media (max-width: 700px) {
  :root {
    --masthead-height: 92px;
  }
  .site-masthead {
    height: auto;
    min-height: 0;
    flex-wrap: wrap;
    align-items: center;
    padding: 0.55rem var(--page-inset) 0.45rem;
    gap: 0.35rem 0.5rem;
  }
  .site-masthead .brand {
    font-size: 1rem;
    gap: 8px;
  }
  .site-masthead .top-nav {
    width: 100%;
    max-width: none;
    justify-content: space-between;
    gap: 0.25rem;
    padding-top: 0.32rem;
    border-top: 1px solid rgba(44, 36, 26, 0.08);
  }
  .site-masthead .top-nav a,
  .site-footer nav a {
    display: inline-flex;
  }
  .site-masthead .top-nav a {
    font-size: 0.82rem;
    min-height: 36px;
    padding: 0.15rem 0.2rem;
    white-space: nowrap;
  }
  .site-masthead .top-nav .nav-record {
    padding: 0.25rem 0.72rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 350px) {
  .site-masthead .top-nav a {
    font-size: 0.75rem;
    padding: 0.15rem 0.08rem;
  }
  .site-masthead .top-nav .nav-record {
    padding: 0.22rem 0.52rem;
    font-size: 0.74rem;
  }
}

@media print {
  .site-masthead, .site-footer { display: none !important; }
  body { background: white !important; background-image: none !important; }
}

/* <dialog> fallback for WebViews without showModal(). */
dialog:not([open]) { display: none; }
dialog.dialog-fallback {
  position: fixed;
  inset: 0;
  margin: auto;
  z-index: 1000;
  height: fit-content;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 0 0 100vmax rgba(28, 24, 19, 0.42), 0 20px 90px rgba(28, 24, 19, 0.25);
}
#modal.dialog-fallback { background: var(--neo-surface); }
html.dialog-fallback-open { overflow: hidden; }

/* WeChat in-app browser guidance. */
.wechat-tip {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  background: #f8eedb;
  border: 1px solid #dcc08e;
  color: #634314;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.6;
}

.footer-filing { margin: 0.65rem 0 0; font-size: 0.8rem; }
.footer-filing a { color: inherit; }

/* Share dialog Xiaohongshu 3:4 & Douyin 9:16 polish */
.share-dialog {
  background: var(--neo-surface);
  max-width: min(880px, calc(100vw - 24px));
}
.share-preview {
  background: var(--neo-subtle);
  border-radius: 18px;
  padding: 12px;
  aspect-ratio: auto;
}
.share-preview img {
  border-radius: 12px;
  max-height: 62vh;
  width: auto;
  max-width: 100%;
  margin: 0 auto;
}
.share-caption-box {
  margin: 0.85rem 0 0.35rem;
  background: var(--neo-bg);
  border: 1px solid var(--neo-line);
  border-radius: 14px;
  padding: 0.65rem 0.8rem;
}
.share-caption-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--neo-ink);
  margin-bottom: 0.4rem;
}
.share-caption-head .text-button {
  min-height: 0;
  padding: 0.15rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--neo-celadon);
  background: var(--neo-celadon-soft);
  border-radius: 999px;
  text-decoration: none;
}
.share-caption-text {
  font-size: 0.85rem !important;
  line-height: 1.5;
  min-height: 76px;
  padding: 0.5rem 0.65rem !important;
  background: var(--neo-surface) !important;
}
@media (max-width: 680px) {
  .share-caption-text { font-size: 1rem !important; }
}

/* Admin suggestion cards */
.admin-suggest-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.85rem;
}
.admin-suggest-item {
  background: var(--neo-bg);
  border: 1px solid var(--neo-line);
  border-radius: 14px;
  padding: 0.9rem 1.1rem;
}
.admin-suggest-meta {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--neo-muted);
  margin-bottom: 0.35rem;
}
.admin-suggest-cat {
  font-weight: 650;
  color: var(--neo-celadon);
}
.admin-suggest-body {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.65;
  white-space: pre-wrap;
  color: var(--neo-ink);
}
