:root {
  color-scheme: light;
  --ink: #24211c;
  --ink-soft: #615a4f;
  --paper: #f3eddf;
  --paper-deep: #e2d7c3;
  --line: rgba(64, 53, 38, 0.18);
  --line-dark: rgba(64, 53, 38, 0.38);
  --seal: #7f2d24;
  --gold: #9f7a42;
  --shadow: rgba(35, 29, 20, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family:
    "Songti SC", "Noto Serif CJK SC", "STSong", "PingFang SC", serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--seal);
  outline-offset: 3px;
}

.app-shell {
  min-height: 100dvh;
}

.landing {
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
  background: #eee5d4;
}

.intro-video,
.final-painting,
.auth-art img,
.cosmos-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.intro-video,
.final-painting {
  position: absolute;
  inset: 0;
}

.intro-video {
  z-index: 2;
  transition: opacity 3000ms ease;
}

.final-painting {
  z-index: 1;
  opacity: 1;
}

.landing.painting-visible .intro-video,
.landing.intro-done .intro-video {
  opacity: 0;
}

.landing.intro-done .intro-video {
  pointer-events: none;
}

.landing-scrim {
  position: absolute;
  inset: 0;
  z-index: 3;
  background:
    linear-gradient(90deg, rgba(244, 238, 225, 0.36), transparent 36%),
    linear-gradient(0deg, rgba(38, 32, 23, 0.14), transparent 42%);
  opacity: 0;
  transition: opacity 1200ms ease;
}

.landing.intro-done .landing-scrim {
  opacity: 1;
}

.brand-mark {
  position: absolute;
  z-index: 4;
  left: calc(clamp(46px, 11vw, 176px) + 3em);
  top: clamp(160px, 34vh, 380px);
  border: 0;
  background: transparent;
  color: #11100e;
  font-size: clamp(64px, 9vw, 148px);
  letter-spacing: 0.12em;
  writing-mode: vertical-rl;
  text-shadow: 0 8px 30px rgba(33, 28, 20, 0.12);
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 1200ms ease 480ms,
    transform 1200ms ease 480ms;
}

.landing.intro-done .brand-mark {
  opacity: 1;
  transform: translateY(0);
}

.hut-hotspot {
  position: absolute;
  z-index: 5;
  right: 31.5%;
  bottom: 15%;
  width: clamp(56px, 7vw, 116px);
  aspect-ratio: 1.45;
  border: none;
  background: transparent;
  cursor: pointer;
}

.auth-page {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  min-height: 100dvh;
  background: var(--paper);
}

.auth-art {
  position: relative;
  overflow: hidden;
  min-height: 100dvh;
}

.auth-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 62%, rgba(243, 237, 223, 0.92));
}

.auth-seal {
  position: absolute;
  left: 9%;
  top: 27%;
  color: rgba(88, 62, 38, 0.7);
  font-size: clamp(52px, 7vw, 112px);
  letter-spacing: 0.12em;
  writing-mode: vertical-rl;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: clamp(28px, 6vw, 80px);
}

.eyeline {
  margin: 0;
  color: var(--gold);
  font-size: 13px;
  letter-spacing: 0.18em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(42px, 7vw, 82px);
  font-weight: 500;
  line-height: 1.05;
}

.auth-copy,
.section-page p,
.hall-desc,
.qr-shell p,
.form-hint {
  color: var(--ink-soft);
  line-height: 1.8;
}

.primary-action,
.secondary-action {
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
  color: var(--ink);
  min-height: 42px;
  padding: 0 18px;
}

.primary-action {
  background: var(--ink);
  color: var(--paper);
}

.login-body {
  min-height: 40px;
}

.slider-captcha {
  width: 100%;
  max-width: 420px;
  margin: 8px 0 4px;
}

.slider-track {
  position: relative;
  height: 52px;
  border: 1px solid var(--line-dark);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.42);
  overflow: hidden;
  user-select: none;
}

.slider-tip {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  font-size: 14px;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.slider-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: rgba(68, 109, 74, 0.18);
}

.slider-handle {
  position: absolute;
  left: 0;
  top: 0;
  height: 52px;
  width: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-dark);
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper);
  font-size: 22px;
  line-height: 1;
  cursor: grab;
  touch-action: none;
}

.slider-handle:active {
  cursor: grabbing;
}

.slider-captcha.passed .slider-track {
  border-color: rgba(68, 109, 74, 0.5);
}

.slider-captcha.passed .slider-fill {
  background: rgba(68, 109, 74, 0.28);
}

.slider-captcha.passed .slider-handle {
  background: rgb(68, 109, 74);
}


.notice {
  padding: 10px 12px;
  border: 1px solid rgba(68, 109, 74, 0.38);
  border-radius: 8px;
  background: rgba(68, 109, 74, 0.08);
}

.notice.danger {
  border-color: rgba(127, 45, 36, 0.42);
  background: rgba(127, 45, 36, 0.08);
}

.portal {
  min-height: 100dvh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), transparent 42%),
    var(--paper);
}

.portal-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  min-height: 64px;
  padding: 0 clamp(18px, 4vw, 64px);
  border-bottom: 1px solid rgba(159, 122, 66, 0.12);
  background: rgba(243, 237, 223, 0.52);
  backdrop-filter: blur(18px);
}

.wordmark {
  border: 0 !important;
  background: transparent !important;
  font-size: 22px;
  letter-spacing: 0.12em;
  color: var(--ink);
}

.portal-header nav {
  display: flex;
  justify-content: center;
  gap: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 玻璃光导航按钮 */
.nav-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 15px;
  letter-spacing: 0.08em;
  overflow: hidden;
  transition: color 280ms ease, background 280ms ease;
  cursor: pointer;
}

.nav-btn::after {
  content: "";
  position: absolute;
  left: -120%;
  top: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.5) 40%,
    rgba(255, 255, 255, 0.6) 50%,
    rgba(255, 255, 255, 0.5) 60%,
    transparent
  );
  transform: skewX(-15deg);
  transition: left 520ms cubic-bezier(0.25, 0.8, 0.25, 1);
  pointer-events: none;
}

.nav-btn:hover::after {
  left: 120%;
}

.nav-btn:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.34);
}

.nav-btn.active {
  color: var(--ink);
  background: rgba(159, 122, 66, 0.14);
}

.nav-btn.logout {
  color: var(--ink-soft);
  font-size: 14px;
}

.nav-btn.admin-link {
  font-size: 14px;
}

.home-portal {
  --hall-line: rgba(159, 122, 66, 0.32);
}

/* 宇宙山水 · 首页天幕 */
.home-cosmos {
  position: relative;
  display: grid;
  align-items: center;
  min-height: 66dvh;
  overflow: hidden;
  isolation: isolate;
}

.cosmos-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  filter: saturate(0.92) contrast(1.02);
}

.cosmos-stars {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  mix-blend-mode: multiply;
}

.cosmos-veil {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    radial-gradient(120% 92% at 80% 26%, transparent 38%, rgba(243, 237, 223, 0.5)),
    linear-gradient(90deg, rgba(243, 237, 223, 0.92) 4%, rgba(243, 237, 223, 0.36) 34%, transparent 64%),
    linear-gradient(0deg, rgba(243, 237, 223, 0.74), transparent 46%);
}

.cosmos-inner {
  position: relative;
  z-index: 3;
  max-width: 560px;
  padding: clamp(32px, 6vw, 96px);
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 1100ms ease, transform 1100ms ease;
}

.home-portal.ready .cosmos-inner {
  opacity: 1;
  transform: translateY(0);
}

.cosmos-eyeline {
  margin: 0 0 10px;
  color: var(--gold);
  letter-spacing: 0.2em;
  font-size: clamp(13px, 1.4vw, 15px);
}

.cosmos-title {
  margin: 0 0 18px;
  font-size: clamp(72px, 13vw, 168px);
  font-weight: 500;
  line-height: 0.94;
  letter-spacing: 0.08em;
  color: var(--ink);
  text-shadow: 0 10px 40px rgba(35, 29, 20, 0.14);
}

.cosmos-lead {
  margin: 0 0 6px;
  max-width: 40ch;
  color: var(--ink-soft);
  font-size: clamp(15px, 1.7vw, 18px);
  letter-spacing: 0.08em;
  line-height: 1.9;
}

.cosmos-subline {
  margin: 6px 0 0;
  color: var(--ink);
  font-size: clamp(17px, 2vw, 22px);
  letter-spacing: 0.12em;
  line-height: 1.6;
}

/* 三阁 · 分隔式三联屏，非卡片 */
.halls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--hall-line);
  background: linear-gradient(180deg, rgba(243, 237, 223, 0.6), var(--paper) 60%);
}

.hall {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  min-height: 340px;
  padding: clamp(40px, 4vw, 64px) clamp(24px, 3vw, 48px);
  border-left: 1px solid var(--hall-line);
  cursor: pointer;
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 900ms ease,
    transform 900ms ease,
    background 400ms ease;
  transition-delay: calc(var(--i) * 130ms);
}

.hall:first-child {
  border-left: 0;
}

.home-portal.ready .hall {
  opacity: 1;
  transform: translateY(0);
}

.hall::before {
  content: "";
  position: absolute;
  left: clamp(24px, 3vw, 48px);
  bottom: 0;
  width: 0;
  height: 2px;
  background: var(--gold);
  transition: width 520ms cubic-bezier(0.16, 1, 0.3, 1);
}

.hall:hover {
  background: rgba(255, 255, 255, 0.42);
}

.hall:hover::before {
  width: 56px;
}

.hall-name {
  margin: 0;
  font-size: clamp(28px, 3.4vw, 40px);
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--ink);
}

.hall-desc {
  margin: 0;
  flex: 1;
  max-width: 32ch;
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.8;
  white-space: nowrap;
}

.hall:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -6px;
  border-radius: 4px;
}

.section-page {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.28);
  box-shadow: 0 20px 70px var(--shadow);
}

.section-page {
  max-width: 880px;
  margin: clamp(28px, 7vw, 96px) auto;
  padding: clamp(28px, 5vw, 64px);
}

.yicang-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100dvh;
}

.yicang-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--paper);
}

/* 观星楼 · 星庐著述阅读器 */
.guanxing-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100dvh;
}

.guanxing-body {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  min-height: 0;
}

.guanxing-list {
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.28);
  padding: 20px 14px;
  overflow-y: auto;
}

.gx-list-title {
  margin: 0 0 12px;
  padding: 0 8px;
  color: var(--gold);
  font-size: 13px;
  letter-spacing: 0.18em;
}

.gx-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gx-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}

.gx-item:hover {
  background: rgba(159, 122, 66, 0.1);
}

.gx-item.active {
  border-color: var(--line-dark);
  background: var(--ink);
  color: var(--paper);
}

.gx-item.missing {
  color: var(--ink-soft);
  cursor: not-allowed;
  opacity: 0.7;
}

.gx-flag {
  flex: none;
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  color: var(--ink-soft);
}

.guanxing-reader {
  overflow-y: auto;
  padding: clamp(24px, 5vw, 64px);
}

.gx-placeholder {
  color: var(--ink-soft);
  padding-top: 40px;
  text-align: center;
}

.gx-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 24px;
}

.gx-head h1 {
  margin: 0 0 8px;
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.2;
}

.gx-source {
  color: var(--gold);
  font-size: 14px;
  text-decoration: none;
}

.gx-content {
  max-width: 820px;
  line-height: 1.95;
  font-size: 17px;
}

.gx-content h2,
.gx-content h3 {
  margin: 32px 0 12px;
  line-height: 1.35;
}

.gx-content p {
  margin: 0 0 18px;
  text-align: justify;
}

.gx-content blockquote {
  margin: 18px 0;
  padding: 8px 18px;
  border-left: 3px solid var(--gold);
  color: var(--ink-soft);
  background: rgba(159, 122, 66, 0.07);
}

.gx-content a {
  color: var(--gold);
}

.gx-figure {
  margin: 20px 0;
  text-align: center;
}

.gx-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 6px 20px var(--shadow);
}

@media (max-width: 860px) {
  .auth-page {
    grid-template-columns: 1fr;
  }

  .auth-art {
    min-height: 34dvh;
  }

  .auth-panel {
    padding: 24px;
  }

  .portal-header {
    grid-template-columns: 1fr auto;
    gap: 12px;
  }

  .portal-header nav {
    grid-column: 1 / -1;
    justify-content: start;
    overflow-x: auto;
    padding-bottom: 12px;
  }

  .halls {
    grid-template-columns: 1fr;
  }

  .hall {
    min-height: auto;
    border-left: 0;
    border-top: 1px solid var(--hall-line);
  }

  .hall:first-child {
    border-top: 0;
  }

  .home-cosmos {
    min-height: 52dvh;
  }

  .brand-mark {
    left: calc(28px + 2em);
    top: 28vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ── 注册/登录表单 ── */
.auth-tabs { display: flex; gap: 8px; margin-bottom: 4px; }
.auth-tab {
  flex: 1; min-height: 40px; border: 1px solid var(--line-dark);
  border-radius: 999px; background: transparent; color: var(--ink-soft);
  font-family: inherit; font-size: 15px; cursor: pointer; transition: all .18s ease;
}
.auth-tab.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13px; color: var(--ink-soft); letter-spacing: .08em; }
.field input {
  height: 46px; padding: 0 14px; border: 1px solid var(--line-dark);
  border-radius: 8px; background: rgba(255,255,255,.5); color: var(--ink);
  font-family: inherit; font-size: 16px; outline: none; transition: border-color .18s;
}
.field input:focus { border-color: var(--gold); }
.field[hidden] { display: none; }
.auth-submit {
  margin-top: 6px; height: 48px; border: none; border-radius: 999px;
  background: var(--gold); color: #fff; font-family: inherit; font-size: 17px;
  letter-spacing: .3em; cursor: pointer; transition: opacity .18s;
}
.auth-submit:disabled { opacity: .6; cursor: default; }
.notice { margin: 4px 0 0; font-size: 14px; color: var(--ink-soft); }
.notice.danger { color: #a4442f; }

/* ── 后台统计 ── */
.admin-link { color: var(--gold) !important; }
.admin-page { max-width: 1180px; }
.admin-head { display: flex; align-items: baseline; gap: 20px; flex-wrap: wrap; }
.admin-stat { color: var(--ink-soft); font-size: 15px; }
.admin-total { font-size: 26px; color: var(--gold); font-weight: 600; margin-right: 4px; }
.admin-note { margin: 10px 0 20px; font-size: 13px; color: var(--ink-soft); }
.admin-table-wrap { overflow-x: auto; border: 1px solid var(--line-dark); border-radius: 10px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { padding: 11px 14px; text-align: left; white-space: nowrap; }
.admin-table thead th {
  background: var(--paper-deep); color: var(--ink); font-weight: 600;
  letter-spacing: .05em; border-bottom: 1px solid var(--line-dark);
}
.admin-table tbody tr { border-bottom: 1px solid rgba(0,0,0,.06); }
.admin-table tbody tr:hover { background: rgba(159,122,66,.07); }
.admin-loading { text-align: center; color: var(--ink-soft); padding: 24px; }

/* ── 后台密码验证 ── */
.admin-shell .section-page {
  max-width: none;
  margin: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
.admin-lock {
  text-align: center;
  padding: 20px 0;
}
.admin-lock h1 {
  margin-bottom: 8px;
  font-size: 28px;
}
.admin-lock-desc {
  color: var(--ink-soft);
  font-size: 14px;
  margin: 0 0 24px;
}
.admin-lock-form {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.admin-lock-input {
  height: 44px;
  width: 220px;
  padding: 0 14px;
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  background: rgba(255,255,255,.5);
  font-family: inherit;
  font-size: 15px;
  outline: none;
}
.admin-lock-input:focus {
  border-color: var(--gold);
}
.admin-lock-btn {
  height: 44px;
  padding: 0 24px;
  border: none;
  border-radius: 8px;
  background: var(--gold);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  letter-spacing: .1em;
  cursor: pointer;
}
.admin-lock-err {
  margin-top: 14px;
  color: #a4442f;
  font-size: 14px;
}

/* ── 序号列 ── */
.admin-seq {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
}

/* ── 权限开关 ── */
.perm-toggle {
  display: inline-block;
  min-width: 64px;
  padding: 4px 12px;
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: all 200ms ease;
}
.perm-toggle.on {
  background: rgba(68, 109, 74, 0.14);
  border-color: rgba(68, 109, 74, 0.32);
  color: #3d5e42;
}
.perm-toggle.off {
  background: transparent;
  color: var(--ink-soft);
}
.perm-toggle:hover {
  border-color: var(--gold);
}
.perm-toggle:disabled {
  opacity: .5;
  cursor: default;
}
