:root {
  color-scheme: dark;
  --ink: #17140f;
  --ink-soft: #252119;
  --paper: #f1eadb;
  --paper-soft: #ddd2bf;
  --clay: #c96f3c;
  --clay-deep: #934824;
  --moss: #98a581;
  --line: rgba(241, 234, 219, 0.22);
  --line-strong: rgba(241, 234, 219, 0.42);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  --radius: 22px;
  --safe-bottom: max(14px, env(safe-area-inset-bottom));
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--ink);
}

body {
  min-width: 320px;
  color: var(--paper);
  overflow-x: hidden;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid #ffd49c;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 12px 16px;
  color: var(--ink);
  background: var(--paper);
  border-radius: 10px;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  position: relative;
  min-height: 100svh;
  background: var(--ink);
}

.topbar {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: clamp(16px, 3vw, 44px);
  right: clamp(16px, 3vw, 44px);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  pointer-events: none;
}

.brand,
.topbar-actions {
  pointer-events: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--paper);
  text-decoration: none;
}

.brand-seal {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 14px 4px 14px 4px;
  background: rgba(23, 20, 15, 0.68);
  box-shadow: inset 0 0 0 4px rgba(201, 111, 60, 0.12);
  font-family: "Songti SC", "STSong", serif;
  font-size: 23px;
  backdrop-filter: blur(18px);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: "Songti SC", "STSong", serif;
  font-size: 22px;
  letter-spacing: 0.18em;
}

.brand small {
  margin-top: 3px;
  color: rgba(241, 234, 219, 0.68);
  font-size: 9px;
  letter-spacing: 0.16em;
}

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

.prototype-badge {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: rgba(241, 234, 219, 0.76);
  background: rgba(23, 20, 15, 0.56);
  font-size: 11px;
  letter-spacing: 0.08em;
  backdrop-filter: blur(18px);
}

.progress-button {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--paper);
  background: rgba(23, 20, 15, 0.62);
  cursor: pointer;
  backdrop-filter: blur(18px);
}

.progress-ring {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 2px solid var(--clay);
  border-radius: 50%;
  font-size: 12px;
}

.progress-copy {
  font-size: 12px;
}

.site-stage {
  position: relative;
  min-height: 100svh;
  isolation: isolate;
  overflow: hidden;
  background-image: linear-gradient(90deg, rgba(18, 16, 12, 0.9) 0%, rgba(18, 16, 12, 0.48) 38%, rgba(18, 16, 12, 0.08) 70%),
    linear-gradient(0deg, rgba(18, 16, 12, 0.84) 0%, transparent 48%),
    url("assets/xiacaopu-aerial.jpg");
  background-position: center;
  background-size: cover;
}

.map-wash {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at 68% 42%, transparent 0 18%, rgba(20, 18, 13, 0.14) 44%, rgba(20, 18, 13, 0.3) 100%);
}

.map-grid {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.2;
  background-image: linear-gradient(rgba(255, 255, 255, 0.15) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.15) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(90deg, transparent 38%, black 62%, transparent 100%);
}

.site-intro {
  position: absolute;
  top: clamp(122px, 18vh, 190px);
  left: clamp(22px, 5vw, 76px);
  z-index: 4;
  width: min(440px, 42vw);
}

.eyebrow {
  margin: 0 0 12px;
  color: #e8b382;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.site-intro h1 {
  margin: 0;
  max-width: 720px;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(42px, 5.2vw, 78px);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.04em;
  text-shadow: 0 12px 34px rgba(0, 0, 0, 0.32);
}

.site-lead {
  max-width: 390px;
  margin: 24px 0 0;
  color: rgba(241, 234, 219, 0.78);
  font-size: 15px;
  line-height: 1.8;
}

.site-index {
  position: absolute;
  top: 20%;
  right: clamp(24px, 3vw, 44px);
  z-index: 6;
  width: 144px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(23, 20, 15, 0.5);
  backdrop-filter: blur(16px);
}

.site-index > p {
  margin: 0 0 10px;
  color: rgba(241, 234, 219, 0.56);
  font-size: 10px;
  letter-spacing: 0.16em;
}

.site-index ol {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-index button {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  border: 0;
  color: var(--paper);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.site-index button span:first-child {
  color: rgba(241, 234, 219, 0.48);
  font-variant-numeric: tabular-nums;
}

.site-index button:hover span:last-child,
.site-index button:focus-visible span:last-child {
  color: #ffd49c;
}

.hotspot-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
}

.hotspot {
  position: absolute;
  display: grid;
  min-width: 52px;
  min-height: 52px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--paper);
  background: transparent;
  cursor: pointer;
  transform: translate(-50%, -50%);
}

.hotspot::before,
.hotspot::after {
  position: absolute;
  content: "";
  border-radius: 50%;
}

.hotspot::before {
  width: 14px;
  height: 14px;
  border: 3px solid rgba(255, 244, 223, 0.9);
  background: var(--clay);
  box-shadow: 0 0 0 7px rgba(201, 111, 60, 0.22), 0 4px 14px rgba(0, 0, 0, 0.34);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.hotspot::after {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 244, 223, 0.48);
  animation: hotspot-pulse 2.8s ease-out infinite;
}

.hotspot span {
  position: absolute;
  top: 42px;
  left: 50%;
  min-width: max-content;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 20, 15, 0.72);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.2);
  font-size: 11px;
  letter-spacing: 0.08em;
  transform: translateX(-50%);
  backdrop-filter: blur(8px);
}

.hotspot:hover::before,
.hotspot:focus-visible::before {
  box-shadow: 0 0 0 11px rgba(201, 111, 60, 0.3), 0 5px 18px rgba(0, 0, 0, 0.4);
  transform: scale(1.15);
}

.hotspot.is-complete::before {
  background: var(--moss);
}

@keyframes hotspot-pulse {
  0% { transform: scale(0.7); opacity: 0.8; }
  70%, 100% { transform: scale(1.35); opacity: 0; }
}

.field-card {
  position: absolute;
  right: clamp(20px, 3vw, 44px);
  bottom: clamp(100px, 12vh, 126px);
  z-index: 8;
  width: min(650px, 58vw);
  padding: 18px 22px 20px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(28, 24, 18, 0.77);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(0.88);
}

.field-card-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  color: rgba(241, 234, 219, 0.6);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.field-number {
  color: #f2bb88;
  font-weight: 700;
}

.meta-divider {
  width: 24px;
  height: 1px;
  background: var(--line-strong);
}

.field-card-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
  margin-top: 17px;
}

.field-card h2 {
  margin: 0;
  max-width: 370px;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(24px, 2.5vw, 36px);
  font-weight: 600;
  line-height: 1.3;
}

.field-card-actions {
  display: grid;
  gap: 9px;
}

.button {
  min-height: 48px;
  padding: 0 20px;
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.button-primary {
  border: 1px solid #df8a55;
  color: #fff9ef;
  background: var(--clay-deep);
}

.button-primary:hover {
  background: #ae572c;
}

.button-quiet {
  border: 1px solid var(--line);
  color: var(--paper);
  background: rgba(255, 255, 255, 0.04);
}

.button-quiet:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.08);
}

.map-caption {
  position: absolute;
  bottom: 28px;
  left: clamp(22px, 3vw, 44px);
  z-index: 4;
  max-width: 360px;
  margin: 0;
  color: rgba(241, 234, 219, 0.4);
  font-size: 9px;
  line-height: 1.5;
}

.dock {
  position: fixed;
  left: 50%;
  bottom: var(--safe-bottom);
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, minmax(68px, 88px));
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(23, 20, 15, 0.82);
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.34);
  transform: translateX(-50%);
  backdrop-filter: blur(22px);
}

.dock-item {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 15px;
  color: rgba(241, 234, 219, 0.62);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  transition: color 180ms ease, background 180ms ease;
}

.dock-item:hover,
.dock-item.is-active {
  color: var(--paper);
  background: rgba(255, 255, 255, 0.08);
}

.dock-mark {
  position: relative;
  display: block;
  width: 16px;
  height: 16px;
  border: 1.5px solid currentColor;
}

.dock-mark-site { border-radius: 50%; }
.dock-mark-collection { border-radius: 3px 8px 3px 3px; }
.dock-mark-quest { transform: rotate(45deg) scale(0.74); }
.dock-mark-profile { border-radius: 50% 50% 4px 4px; }

.view-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(9, 8, 6, 0.58);
  backdrop-filter: blur(5px);
}

.view-sheet {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100svh - 32px);
  overflow: auto;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 26px;
  color: #262019;
  background: #f2ebdd;
  box-shadow: 0 30px 110px rgba(0, 0, 0, 0.52);
  animation: sheet-in 260ms ease-out;
}

@keyframes sheet-in {
  from { transform: translateY(24px); opacity: 0; }
}

.sheet-handle {
  display: none;
  width: 44px;
  height: 4px;
  margin: -12px auto 18px;
  border-radius: 999px;
  background: #c8bdab;
}

.sheet-close {
  position: sticky;
  top: 0;
  z-index: 2;
  float: right;
  min-width: 52px;
  min-height: 44px;
  margin: -8px -8px 0 16px;
  border: 1px solid rgba(38, 32, 25, 0.14);
  border-radius: 999px;
  color: #51483d;
  background: rgba(242, 235, 221, 0.92);
  cursor: pointer;
}

.view-content {
  padding-top: 12px;
}

.view-kicker {
  margin: 0 0 12px;
  color: #a04b26;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.view-content h2 {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(32px, 5vw, 54px);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.03em;
}

.view-lead {
  margin: 18px 0 0;
  color: #5b5145;
  font-size: 16px;
  line-height: 1.8;
}

.evidence-box {
  margin: 24px 0;
  padding: 18px 20px;
  border-left: 4px solid #b75b32;
  border-radius: 0 14px 14px 0;
  background: #e6dccb;
}

.evidence-box strong {
  display: block;
  margin-bottom: 6px;
  color: #8c3f20;
  font-size: 11px;
  letter-spacing: 0.12em;
}

.evidence-box p {
  margin: 0;
  line-height: 1.7;
}

.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.sheet-actions .button-quiet {
  border-color: rgba(38, 32, 25, 0.2);
  color: #393027;
  background: rgba(255, 255, 255, 0.42);
}

.collection-grid {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.collection-card {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 16px;
  min-height: 126px;
  padding: 14px;
  border: 1px solid rgba(38, 32, 25, 0.13);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.34);
}

.collection-image,
.collection-placeholder {
  width: 108px;
  height: 96px;
  border-radius: 12px;
  object-fit: cover;
}

.collection-placeholder {
  display: grid;
  place-items: center;
  color: #8d7d6b;
  background: repeating-linear-gradient(45deg, #ddd1bf, #ddd1bf 8px, #e8dece 8px, #e8dece 16px);
  font-family: "Songti SC", serif;
  font-size: 30px;
}

.collection-card small {
  color: #a04b26;
  letter-spacing: 0.1em;
}

.collection-card h3 {
  margin: 6px 0 8px;
  font-size: 19px;
}

.collection-card p {
  margin: 0;
  color: #61574b;
  line-height: 1.6;
}

.quiz-form {
  display: grid;
  gap: 22px;
  margin-top: 28px;
}

.quiz-question {
  padding: 0;
  border: 0;
}

.quiz-question legend {
  margin-bottom: 12px;
  font-weight: 700;
  line-height: 1.6;
}

.quiz-option {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
  padding: 10px 14px;
  border: 1px solid rgba(38, 32, 25, 0.14);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.34);
  cursor: pointer;
}

.quiz-option:hover {
  border-color: rgba(147, 72, 36, 0.55);
}

.quiz-option input {
  width: 20px;
  height: 20px;
  accent-color: var(--clay-deep);
}

.quiz-result {
  margin-top: 22px;
  padding: 18px;
  border-radius: 15px;
  color: #34412f;
  background: #dce6d3;
  line-height: 1.7;
}

.progress-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 24px;
}

.progress-card {
  padding: 18px;
  border: 1px solid rgba(38, 32, 25, 0.13);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.34);
}

.progress-card strong,
.progress-card span {
  display: block;
}

.progress-card strong {
  font-family: "Songti SC", serif;
  font-size: 30px;
}

.progress-card span {
  margin-top: 6px;
  color: #6b5f51;
  font-size: 12px;
}

.source-note {
  margin-top: 24px;
  color: #746859;
  font-size: 12px;
  line-height: 1.7;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + var(--safe-bottom));
  z-index: 80;
  padding: 12px 17px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--paper);
  background: rgba(23, 20, 15, 0.9);
  box-shadow: var(--shadow);
  font-size: 13px;
  transform: translateX(-50%);
}

[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .site-intro {
    top: 128px;
    width: min(520px, 78vw);
  }

  .site-index {
    display: none;
  }

  .hotspot:nth-child(1) { left: 50% !important; top: 39% !important; }
  .hotspot:nth-child(2) { left: 65% !important; top: 47% !important; }
  .hotspot:nth-child(3) { left: 76% !important; top: 36% !important; }
  .hotspot:nth-child(4) { left: 87% !important; top: 48% !important; }

  .field-card {
    left: 18px;
    right: 18px;
    bottom: 88px;
    width: auto;
  }

  .field-card-body {
    grid-template-columns: 1fr;
  }

  .field-card-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .map-caption {
    display: none;
  }
}

@media (max-width: 640px) {
  .prototype-badge,
  .progress-copy,
  .site-lead {
    display: none;
  }

  .topbar {
    top: max(10px, env(safe-area-inset-top));
    left: 14px;
    right: 14px;
  }

  .brand-seal {
    width: 42px;
    height: 42px;
  }

  .site-stage {
    min-height: 760px;
    background-image: linear-gradient(180deg, rgba(18, 16, 12, 0.7) 0%, rgba(18, 16, 12, 0.06) 36%, rgba(18, 16, 12, 0.88) 76%),
      url("assets/xiacaopu-aerial.jpg");
    background-position: 58% center;
  }

  .site-intro {
    top: 108px;
    left: 20px;
    width: calc(100% - 40px);
  }

  .site-intro h1 {
    font-size: clamp(37px, 12vw, 52px);
  }

  .hotspot span {
    display: none;
  }

  .field-card {
    padding: 16px;
  }

  .field-card h2 {
    font-size: 24px;
  }

  .field-card-actions {
    grid-template-columns: 1fr;
  }

  .button {
    min-height: 50px;
  }

  .dock {
    width: calc(100% - 24px);
    grid-template-columns: repeat(4, 1fr);
  }

  .dock-item {
    flex-direction: column;
    gap: 4px;
    min-height: 58px;
    font-size: 10px;
  }

  .view-sheet {
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 88svh;
    padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
  }

  .sheet-handle {
    display: block;
  }

  .collection-card {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .collection-image,
  .collection-placeholder {
    width: 82px;
    height: 82px;
  }

  .progress-list {
    grid-template-columns: 1fr;
  }
}

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