:root {
  color-scheme: light;
  --paper: #d8d8d2;
  --paper-deep: #cfcfc8;
  --graphite: #181a1b;
  --fog: #b9bcb8;
  --silver: #eeefea;
  --blue-grey: #8f9a9d;
  --page-gutter: clamp(1.5rem, 8.3vw, 7.5rem);
  --line-width: 1.5px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--graphite);
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-width: 320px;
  overflow-x: hidden;
}

/* 纸张颗粒 */
.grain {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.14'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

/* 整体布局 */
.museum {
  position: relative;
  z-index: 1;
}

.hall {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 6rem var(--page-gutter);
  position: relative;
  opacity: 0;
  transform: translateY(2rem);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

.hall.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* 站点标记 */
.site-mark {
  position: absolute;
  top: clamp(1.5rem, 4.5vw, 3.8rem);
  right: var(--page-gutter);
  margin: 0;
  color: rgba(24, 26, 27, 0.42);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: clamp(0.68rem, 0.82vw, 0.8rem);
  font-weight: 400;
  letter-spacing: 0.035em;
  text-transform: lowercase;
}

/* 标题与文案 */
.title {
  margin: 2.5rem 0 1rem;
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: 0.075em;
  text-align: center;
}

.title-line {
  display: block;
}

.subtitle {
  margin: 0 0 3rem;
  font-size: clamp(0.95rem, 1.1vw, 1.1rem);
  color: rgba(24, 26, 27, 0.65);
  letter-spacing: 0.1em;
}

.hint {
  position: absolute;
  bottom: 2rem;
  font-size: 0.85rem;
  color: rgba(24, 26, 27, 0.45);
  letter-spacing: 0.1em;
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.9; }
}

/* 展厅头部 */
.hall-header {
  text-align: center;
  margin-bottom: 2rem;
}

.hall-number {
  display: block;
  font-size: 0.8rem;
  color: rgba(24, 26, 27, 0.5);
  letter-spacing: 0.25em;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}

.hall-header h2 {
  margin: 0;
  font-size: clamp(1.6rem, 2.8vw, 2.4rem);
  font-weight: 400;
  letter-spacing: 0.12em;
}

/* 画框/展品区域 */
.art-frame {
  position: relative;
  width: min(90vw, 420px);
  aspect-ratio: 400 / 320;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 1rem 0;
}

/* 线条画 */
.line-art {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.line-art path,
.line-art circle {
  fill: none;
  stroke: var(--graphite);
  stroke-width: var(--line-width);
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 自绘动画基础 */
.draw {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
}

.hall.in-view .draw {
  animation: draw-line 1.8s ease forwards;
}

.hall.in-view .draw:nth-of-type(1) { animation-delay: 0.1s; }
.hall.in-view .draw:nth-of-type(2) { animation-delay: 0.25s; }
.hall.in-view .draw:nth-of-type(3) { animation-delay: 0.4s; }
.hall.in-view .draw:nth-of-type(4) { animation-delay: 0.55s; }
.hall.in-view .draw:nth-of-type(5) { animation-delay: 0.7s; }
.hall.in-view .draw:nth-of-type(6) { animation-delay: 0.85s; }
.hall.in-view .draw:nth-of-type(7) { animation-delay: 1s; }
.hall.in-view .draw:nth-of-type(8) { animation-delay: 1.15s; }

/* 秘密角落的线条画 */
.secret-corner.revealed .draw {
  animation: draw-line 1.2s ease forwards;
}

@keyframes draw-line {
  to { stroke-dashoffset: 0; }
}

/* 说明牌 */
.caption {
  margin: 1.5rem 0 0;
  font-size: clamp(1rem, 1.3vw, 1.2rem);
  letter-spacing: 0.15em;
  color: rgba(24, 26, 27, 0.75);
  text-align: center;
}

.exhibit-label {
  margin-top: 2rem;
  padding: 1rem 1.5rem;
  border: 1px solid rgba(24, 26, 27, 0.15);
  font-size: 0.85rem;
  color: rgba(24, 26, 27, 0.55);
  line-height: 1.8;
  letter-spacing: 0.08em;
  text-align: left;
  background: rgba(238, 239, 234, 0.3);
}

.exhibit-label p {
  margin: 0.25rem 0;
}

/* 隐藏按钮 */
.door-handle-btn,
.pedestal-btn,
.book-btn,
.window-btn,
.bulletin-btn,
.exit-btn {
  position: absolute;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  z-index: 10;
}

.door-handle-btn {
  width: 30px;
  height: 30px;
  top: 58%;
  right: 28%;
}

.pedestal-btn {
  width: 120px;
  height: 60px;
  bottom: 15%;
  left: 50%;
  transform: translateX(-50%);
}

.book-btn {
  width: 50px;
  height: 70px;
  bottom: 20%;
  left: 50%;
  transform: translateX(-50%);
}

.window-btn {
  width: 100%;
  height: 100%;
  inset: 0;
}

.bulletin-btn {
  width: 70%;
  height: 60%;
  top: 20%;
  left: 15%;
}

.exit-btn {
  width: 140px;
  height: 200px;
  top: 25%;
  left: 50%;
  transform: translateX(-50%);
}

/* 交互反馈文字 */
.walker-message,
.news-message,
.exit-message {
  position: absolute;
  bottom: 20%;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-size: 0.95rem;
  color: rgba(24, 26, 27, 0.6);
  letter-spacing: 0.1em;
  white-space: nowrap;
  animation: fade-in 0.5s ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* 空画框中的「无」字 */
.void-character {
  position: absolute;
  top: 35%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.5rem;
  color: rgba(24, 26, 27, 0);
  letter-spacing: 0.3em;
  pointer-events: none;
  transition: color 0.6s ease;
}

.art-frame[data-art="pedestal"]:hover .void-character {
  color: rgba(24, 26, 27, 0.18);
}

/* 书本查看器 */
.book-viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(216, 216, 210, 0.98);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.book-viewer[hidden] {
  display: none;
}

.book-page {
  font-size: 1.1rem;
  letter-spacing: 0.15em;
  margin-bottom: 2rem;
}

.book-blank {
  font-size: 0.95rem;
  color: rgba(24, 26, 27, 0.45);
  letter-spacing: 0.1em;
  margin-bottom: 3rem;
}

.next-page {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.75rem 2rem;
  border: 1px solid rgba(24, 26, 27, 0.3);
  background: transparent;
  color: var(--graphite);
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.3s ease;
}

.next-page:hover {
  background: var(--graphite);
  color: var(--paper);
}

/* 出口区域 */
.exit {
  min-height: 120vh;
}

.restart-btn {
  margin-top: 3rem;
  font-family: inherit;
  font-size: 1rem;
  padding: 0.9rem 2.5rem;
  border: 1px solid rgba(24, 26, 27, 0.4);
  background: transparent;
  color: var(--graphite);
  letter-spacing: 0.15em;
  cursor: pointer;
  transition: all 0.3s ease;
}

.restart-btn:hover {
  background: var(--graphite);
  color: var(--paper);
}

.restart-btn[hidden] {
  display: none;
}

/* 秘密角落 */
.secret-corner {
  position: absolute;
  bottom: 0;
  right: var(--page-gutter);
  width: 120px;
  height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.secret-corner.revealed {
  opacity: 1;
  transform: translateY(0);
}

.tiny-jeremy {
  width: 80px;
  height: 80px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.secret-message,
.secret-message-2 {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: rgba(24, 26, 27, 0.6);
  letter-spacing: 0.08em;
  white-space: nowrap;
  animation: fade-in 0.5s ease;
}

.secret-message-2 {
  bottom: calc(100% + 2rem);
}

/* 静坐模式 */
body.meditation-mode .hall > *:not(.art-frame) {
  opacity: 0;
  transition: opacity 1.5s ease;
}

body.meditation-mode .line-art path,
body.meditation-mode .line-art circle {
  animation: breathe 4s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { stroke-width: var(--line-width); opacity: 1; }
  50% { stroke-width: calc(var(--line-width) * 0.7); opacity: 0.7; }
}

/* 无脚本提示 */
.no-script {
  position: fixed;
  z-index: 1000;
  right: 1rem;
  bottom: 1rem;
  max-width: 20rem;
  padding: 0.7rem 0.85rem;
  background: var(--graphite);
  color: var(--silver);
  font-size: 0.75rem;
}

/* 响应式 */
@media (max-width: 680px) {
  .hall {
    padding: 4rem 1.5rem;
  }

  .title {
    font-size: clamp(1.75rem, 8vw, 2.5rem);
  }

  .hall-header h2 {
    font-size: clamp(1.4rem, 6vw, 1.8rem);
  }

  .art-frame {
    width: min(95vw, 360px);
  }

  .exhibit-label {
    margin-top: 1.5rem;
    padding: 0.85rem 1.2rem;
    font-size: 0.8rem;
  }

  .secret-corner {
    width: 90px;
    height: 140px;
    right: 1rem;
  }

  .tiny-jeremy {
    width: 60px;
    height: 60px;
  }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .hall,
  .draw,
  .hall.in-view .draw,
  .hint,
  .walker-message,
  .news-message,
  .exit-message,
  .secret-message,
  .secret-message-2 {
    animation: none !important;
    transition: none !important;
  }

  .draw {
    stroke-dashoffset: 0;
  }

  .hall {
    opacity: 1;
    transform: none;
  }
}
