:root {
  --cream: #f8f2e8;
  --cream-soft: rgba(250, 245, 237, 0.86);
  --ink: #231d19;
  --ink-soft: rgba(35, 29, 25, 0.62);
  --coral: #d97d74;
  --coral-deep: #c9695f;
  --line: rgba(35, 29, 25, 0.12);
  --shadow: 0 18px 40px rgba(24, 32, 42, 0.18);
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "SimSun", Georgia, serif;
  --sans: ui-sans-serif, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #9dc6e2;
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
}

.stage-wrap {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

#stage {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
#stage.grabbing { cursor: grabbing; }

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 85% at 50% 40%, rgba(255, 255, 255, 0) 52%, rgba(30, 40, 52, 0.16) 100%),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0) 26%);
}

/* ---------- 标题 ---------- */
.masthead {
  position: fixed;
  top: max(22px, env(safe-area-inset-top));
  left: clamp(16px, 3.4vw, 44px);
  max-width: min(420px, 62vw);
  pointer-events: none;
  z-index: 4;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(24, 34, 44, 0.72);
  font-weight: 600;
}
.eyebrow .rule {
  width: 26px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(25px, 3.6vw, 42px);
  line-height: 1.12;
  letter-spacing: 0.015em;
  color: #1d2733;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}
h1 span {
  display: block;
  margin-top: 4px;
  font-size: 0.52em;
  letter-spacing: 0.14em;
  font-weight: 500;
  color: rgba(29, 39, 51, 0.72);
}

.lede {
  margin: 12px 0 0;
  max-width: 30ch;
  font-size: 12.5px;
  line-height: 1.72;
  color: rgba(24, 34, 44, 0.74);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* ---------- 开关 ---------- */
.legend {
  position: fixed;
  top: max(22px, env(safe-area-inset-top));
  right: clamp(16px, 3.4vw, 44px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  z-index: 5;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 12px;
  min-height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(250, 246, 239, 0.6);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  color: rgba(35, 29, 25, 0.62);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.22s ease, color 0.22s ease, box-shadow 0.22s ease;
}
.toggle .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
  transition: opacity 0.2s ease, background 0.2s ease;
}
.toggle.is-on {
  color: #2a211c;
  box-shadow: 0 6px 16px rgba(24, 32, 42, 0.12);
}
.toggle.is-on .dot { background: var(--coral); opacity: 1; }
.toggle:hover { background: rgba(255, 252, 246, 0.86); }

/* ---------- 标注点 ---------- */
.hotspots {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.spot {
  position: absolute;
  width: 30px;
  height: 30px;
  margin: 0;
  padding: 0;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 250, 243, 0.82);
  box-shadow: 0 2px 10px rgba(30, 24, 20, 0.18);
  pointer-events: auto;
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.3s ease, box-shadow 0.2s ease;
}
.spot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--coral);
}
.spot::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid rgba(217, 125, 116, 0.55);
  animation: ping 2.8s cubic-bezier(0.2, 0.7, 0.3, 1) infinite;
}
.spot:hover, .spot:focus-visible {
  box-shadow: 0 4px 16px rgba(30, 24, 20, 0.26);
  outline: none;
}
.spot:focus-visible { border-color: var(--coral-deep); }
.spot .label {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 9px);
  transform: translateX(-50%) translateY(4px);
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(28, 24, 21, 0.9);
  color: #fbf5ec;
  font-size: 11px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.spot:hover .label, .spot:focus-visible .label {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.spot.is-active { background: var(--coral); border-color: #fff; }
.spot.is-active::before { background: #fff; }

@keyframes ping {
  0% { transform: scale(0.72); opacity: 0.9; }
  70% { transform: scale(1.28); opacity: 0; }
  100% { transform: scale(1.28); opacity: 0; }
}

/* ---------- 提示 ---------- */
.hint {
  position: fixed;
  left: 50%;
  bottom: calc(var(--dock-h, 118px) + 26px);
  transform: translateX(-50%);
  margin: 0;
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: rgba(26, 34, 42, 0.6);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
  pointer-events: none;
  z-index: 4;
  transition: opacity 0.4s ease;
  white-space: nowrap;
}

/* ---------- 底部控制 ---------- */
.dock {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  align-items: flex-end;
  padding: 12px 10px;
  border-radius: 22px;
  background: var(--cream-soft);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px) saturate(1.25);
  -webkit-backdrop-filter: blur(20px) saturate(1.25);
  z-index: 6;
  max-width: calc(100vw - 24px);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s ease;
}

.group {
  padding: 0 10px;
  min-width: 0;
}
.group + .group { border-left: 1px solid var(--line); }

.group h2 {
  margin: 0 0 7px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--ink-soft);
  text-transform: uppercase;
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
}

.chip {
  appearance: none;
  border: 1px solid rgba(35, 29, 25, 0.12);
  background: rgba(255, 255, 255, 0.55);
  color: #2c241f;
  font: inherit;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  padding: 7px 13px;
  min-height: 34px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
.chip:hover { background: rgba(255, 255, 255, 0.92); }
.chip:active { transform: scale(0.97); }
.chip.is-active {
  background: var(--coral);
  border-color: transparent;
  color: #fffaf4;
  box-shadow: 0 4px 12px rgba(201, 105, 95, 0.35);
}

.chip:focus-visible, .toggle:focus-visible {
  outline: 2px solid var(--coral-deep);
  outline-offset: 2px;
}

/* ---------- 细节卡 ---------- */
.card {
  position: fixed;
  right: clamp(16px, 3.4vw, 44px);
  top: 50%;
  transform: translateY(-50%);
  width: min(310px, calc(100vw - 32px));
  padding: 20px 20px 18px;
  border-radius: 20px;
  background: rgba(250, 245, 237, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  z-index: 7;
  animation: cardIn 0.34s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.card[hidden] { display: none; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(calc(-50% + 10px)); }
  to { opacity: 1; transform: translateY(-50%); }
}

.card .num {
  margin: 0 0 8px;
  font-size: 10.5px;
  letter-spacing: 0.24em;
  color: var(--coral-deep);
  font-weight: 600;
}
.card h3 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.card p.body {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.78;
  color: rgba(35, 29, 25, 0.78);
}
.card dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.card dt {
  font-size: 9.5px;
  letter-spacing: 0.18em;
  color: var(--ink-soft);
  margin-bottom: 3px;
}
.card dd {
  margin: 0;
  font-size: 12.5px;
  color: #2a211c;
}
.card .actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.card .actions button {
  flex: 1;
  font: inherit;
  font-size: 12px;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  color: #2a211c;
  cursor: pointer;
  transition: background 0.2s ease;
}
.card .actions button:hover { background: #fff; }
.card .actions .primary {
  background: #2a211c;
  border-color: #2a211c;
  color: #fbf6ee;
}
.card .actions .primary:hover { background: #3a2e27; }

.card .close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  color: #2a211c;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.card .close:hover { background: #fff; }

/* ---------- 加载 ---------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  background: #eae2d6;
  color: rgba(35, 29, 25, 0.7);
  font-size: 12px;
  letter-spacing: 0.2em;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
.loader.is-done { opacity: 0; visibility: hidden; }
.loader-mark {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid rgba(35, 29, 25, 0.15);
  border-top-color: var(--coral);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.noscript {
  position: fixed;
  inset: auto 0 40% 0;
  text-align: center;
  font-size: 14px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .lede { display: none; }
  .masthead { max-width: 56vw; }
  .legend { gap: 6px; }
  .toggle { padding: 7px 11px; font-size: 11px; min-height: 32px; }
}

@media (max-width: 780px) {
  .dock {
    left: 10px;
    right: 10px;
    transform: none;
    max-width: none;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px 12px 10px;
    border-radius: 18px;
  }
  .group { padding: 0; }
  .group + .group { border-left: 0; border-top: 1px solid var(--line); padding-top: 8px; }
  .group h2 { margin-bottom: 5px; font-size: 9px; }
  .chips {
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 1px;
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip { font-size: 12px; padding: 6px 11px; min-height: 32px; }

  .hint { display: none; }

  .masthead { max-width: 66vw; }
  h1 { font-size: clamp(22px, 6.4vw, 30px); }
  .eyebrow { font-size: 9.5px; letter-spacing: 0.2em; margin-bottom: 7px; }

  .card {
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    top: auto;
    width: auto;
    transform: none;
    max-height: 52dvh;
    overflow-y: auto;
    animation: cardInMobile 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  @keyframes cardInMobile {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
  }
  body.card-open .dock { transform: translateY(120%); opacity: 0; pointer-events: none; }
}

@media (max-width: 420px) {
  .legend { flex-direction: row; }
  .toggle .dot { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .spot::after { animation: none; }
  .loader-mark { animation: none; }
  * { scroll-behavior: auto; }
}
