:root {
  --paper: #f6f3eb;
  --paper-soft: #efe9dc;
  --card: #fbf9f4;
  --ink: #27241e;
  --ink-muted: #655e52;
  --ink-light: #8c8374;
  --bronze: #2e5248;
  --bronze-deep: #213c35;
  --bronze-soft: rgba(46, 82, 72, 0.1);
  --ochre: #9c7a46;
  --cinnabar: #9e4738;
  --line: rgba(116, 98, 72, 0.18);
  --line-strong: rgba(116, 98, 72, 0.34);
  --shadow: 0 14px 36px -18px rgba(45, 36, 22, 0.22);
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --radius-lg: 18px;
  --radius-md: 12px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.75;
  background:
    radial-gradient(circle at 12% 0%, rgba(156, 122, 70, 0.08), transparent 42%),
    radial-gradient(circle at 92% 18%, rgba(46, 82, 72, 0.07), transparent 40%),
    linear-gradient(180deg, #f8f5ee 0%, var(--paper) 45%, #f1ece0 100%);
  min-height: 100vh;
}

body.no-scroll {
  overflow: hidden;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.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;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(246, 243, 235, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  max-width: 1060px;
  margin: 0 auto;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.seal-mark {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: var(--cinnabar);
  color: var(--card);
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text strong {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.brand-text small {
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--ink-light);
  margin-top: 2px;
}

.hall-badge {
  font-size: 12px;
  color: var(--bronze);
  background: var(--bronze-soft);
  border: 1px solid rgba(46, 82, 72, 0.2);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Main Layout */
.page-main {
  max-width: 1060px;
  margin: 0 auto;
  padding: 20px 16px 36px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Hero & 3D Viewer */
.hero-section {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: center;
}

.hero-intro {
  padding: 4px 2px;
}

.meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.pill {
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--ink-muted);
  background: rgba(251, 249, 244, 0.8);
}

.pill-accent {
  color: var(--cinnabar);
  border-color: rgba(158, 71, 56, 0.32);
  background: rgba(158, 71, 56, 0.06);
  font-weight: 500;
}

.hero-intro h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(28px, 6.8vw, 40px);
  font-weight: 600;
  line-height: 1.24;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.english-sub {
  margin: 6px 0 0;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--ochre);
}

.ornament-rule {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0;
  max-width: 220px;
}

.ornament-rule span {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(156, 122, 70, 0.45), rgba(156, 122, 70, 0.1));
}

.ornament-rule span:first-child {
  max-width: 36px;
  background: rgba(156, 122, 70, 0.55);
}

.ornament-rule i {
  width: 6px;
  height: 6px;
  transform: rotate(45deg);
  border: 1px solid var(--ochre);
}

.lead-text {
  margin: 0;
  font-size: 15px;
  color: var(--ink-muted);
  line-height: 1.75;
}

/* 3D Viewer Stage */
.viewer-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.viewer {
  position: relative;
  width: 100%;
  height: clamp(340px, 56vh, 470px);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background:
    radial-gradient(circle at 50% 42%, #ffffff 0%, #f5f1e6 60%, #e9e2d2 100%);
  box-shadow: var(--shadow);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.viewer.expanded {
  position: fixed;
  inset: 0;
  z-index: 100;
  width: 100vw;
  height: 100dvh;
  border-radius: 0;
  border: 0;
}

.corner-frame {
  position: absolute;
  width: 16px;
  height: 16px;
  pointer-events: none;
  z-index: 3;
  border-color: rgba(156, 122, 70, 0.48);
  border-style: solid;
}

.corner-frame.tl { top: 10px; left: 10px; border-width: 1.5px 0 0 1.5px; }
.corner-frame.tr { top: 10px; right: 10px; border-width: 1.5px 1.5px 0 0; }
.corner-frame.bl { bottom: 10px; left: 10px; border-width: 0 0 1.5px 1.5px; }
.corner-frame.br { bottom: 10px; right: 10px; border-width: 0 1.5px 1.5px 0; }

#viewport {
  width: 100%;
  height: 100%;
  display: block;
}

#viewport canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

.viewer-top,
.viewer-bottom {
  position: absolute;
  left: 14px;
  right: 14px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.viewer-top {
  top: 14px;
}

.viewer-bottom {
  bottom: 14px;
}

.viewer-top > *,
.viewer-bottom > * {
  pointer-events: auto;
}

.view-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(251, 249, 244, 0.88);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-muted);
  backdrop-filter: blur(8px);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bronze);
  box-shadow: 0 0 0 3px rgba(46, 82, 72, 0.16);
}

.pill-btn,
.icon-btn,
.controls button {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(251, 249, 244, 0.9);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  backdrop-filter: blur(8px);
}

.pill-btn {
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
}

.pill-btn[aria-pressed="true"] {
  background: var(--bronze);
  border-color: var(--bronze);
  color: #fff;
}

.pill-btn svg,
.icon-btn svg,
.controls svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.axis-tag {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(251, 249, 244, 0.85);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  color: var(--bronze);
}

.axis-tag small {
  font-weight: 400;
  color: var(--ink-light);
  font-size: 11px;
}

.controls {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 999px;
  background: rgba(251, 249, 244, 0.9);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.controls button {
  border: 0;
  background: transparent;
  width: 34px;
  height: 32px;
  border-radius: 999px;
}

.controls button:hover,
.icon-btn:hover,
.pill-btn:hover {
  background: rgba(46, 82, 72, 0.08);
}

.pill-btn[aria-pressed="true"]:hover {
  background: var(--bronze-deep);
}

.control-divider {
  width: 1px;
  height: 16px;
  background: var(--line);
  margin: 0 2px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
}

/* Loading Overlay */
.loading {
  position: absolute;
  inset: 0;
  z-index: 6;
  background: rgba(246, 243, 235, 0.9);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  text-align: center;
  transition: opacity 0.3s ease;
}

.loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-ring {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2.5px solid rgba(46, 82, 72, 0.16);
  border-top-color: var(--bronze);
  animation: spin 0.9s linear infinite;
}

.loading.error .loading-ring {
  display: none;
}

.loading strong {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink);
}

.loading span {
  font-size: 12px;
  color: var(--ink-muted);
}

.progress-track {
  width: 160px;
  height: 4px;
  border-radius: 999px;
  background: rgba(46, 82, 72, 0.12);
  overflow: hidden;
  margin-top: 2px;
}

#progress {
  width: 0%;
  height: 100%;
  background: var(--bronze);
  transition: width 0.15s ease;
}

.retry-btn {
  margin-top: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--bronze);
  background: var(--bronze);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Viewer Footer Bar */
.viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.gesture-hint {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-muted);
}

.gesture-hint svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--ochre);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gesture-hint i {
  font-style: normal;
  opacity: 0.55;
}

.quality-switch {
  display: inline-flex;
  padding: 2px;
  border-radius: 999px;
  background: var(--paper-soft);
  border: 1px solid var(--line);
}

.quality-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-muted);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.quality-switch button.selected {
  background: var(--card);
  color: var(--bronze);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.quality-switch button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.model-stats {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-light);
  padding: 0 2px;
}

/* Content Cards */
.content-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  box-shadow: 0 8px 24px -18px rgba(45, 36, 22, 0.18);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.section-kicker {
  display: block;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--ochre);
  margin-bottom: 2px;
}

.section-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.04em;
}

.section-tag {
  font-size: 11px;
  color: var(--bronze);
  background: var(--bronze-soft);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.section-intro {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--ink-muted);
}

/* Video */
.video-frame {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: #1c1a16;
  aspect-ratio: 16 / 9;
}

.video-frame video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

/* Archive Grid */
.archive-grid {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.archive-item {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 11px 12px;
}

.archive-item dt {
  font-size: 11px;
  color: var(--ochre);
  letter-spacing: 0.1em;
  margin-bottom: 3px;
}

.archive-item dd {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.5;
}

/* Photo Gallery Card */
.photo-figure {
  margin: 0;
}

.photo-trigger {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #171715;
  cursor: zoom-in;
}

.photo-trigger img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.photo-trigger:hover img {
  transform: scale(1.02);
}

.photo-zoom-tip {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(251, 249, 244, 0.9);
  color: var(--ink);
  font-size: 12px;
  border: 1px solid var(--line);
}

.photo-zoom-tip svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--bronze);
  stroke-width: 1.8;
}

.photo-figure figcaption {
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink-light);
  text-align: center;
}

/* Essay & Quote */
.classic-quote {
  margin: 0 0 18px;
  padding: 14px 16px;
  background: linear-gradient(90deg, rgba(156, 122, 70, 0.09), rgba(246, 243, 235, 0.5));
  border-left: 3px solid var(--ochre);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.classic-quote p {
  margin: 0;
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink);
  letter-spacing: 0.04em;
}

.classic-quote footer {
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-muted);
  text-align: right;
}

.essay-sections {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.essay-block h3 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 17px;
  color: var(--bronze-deep);
  display: flex;
  align-items: center;
  gap: 8px;
}

.essay-block h3::before {
  content: "";
  width: 4px;
  height: 15px;
  border-radius: 2px;
  background: var(--bronze);
}

.essay-block p {
  margin: 0 0 10px;
  font-size: 15px;
  color: #363129;
  line-height: 1.85;
  text-align: justify;
}

.essay-block p:last-child {
  margin-bottom: 0;
}

/* Footer */
.site-footer {
  max-width: 1060px;
  margin: 0 auto;
  padding: 8px 18px 34px;
  text-align: center;
  color: var(--ink-light);
  font-size: 12px;
}

.footer-seal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}

.footer-seal span {
  width: 48px;
  height: 1px;
  background: var(--line-strong);
}

.footer-seal i {
  width: 6px;
  height: 6px;
  border: 1px solid var(--ochre);
  transform: rotate(45deg);
}

.site-footer p {
  margin: 0;
  letter-spacing: 0.06em;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(24, 22, 18, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lightbox[hidden] {
  display: none;
}

.lightbox img {
  max-width: 100%;
  max-height: 88dvh;
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.lightbox-close svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
}

/* Desktop Responsive */
@media (min-width: 840px) {
  .page-main {
    padding: 28px 24px 48px;
    gap: 24px;
  }

  .hero-section {
    grid-template-columns: 0.92fr 1.18fr;
    gap: 32px;
  }

  .content-card {
    padding: 26px 28px;
  }

  .archive-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .photo-trigger img {
    max-height: 440px;
  }
}
