:root {
  color-scheme: dark;
  --paper-ratio: .75;
  --gold: #e5c575;
  --ink: #101113;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; }

.share-probe {
  position: fixed;
  left: -9999px;
  top: -9999px;
  width: 600px;
  height: 600px;
}

.loader {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  background: radial-gradient(circle at 50% 38%, #203245, #0b0c0f 67%);
  transition: opacity .55s ease, visibility .55s ease;
}

.loader.is-hidden { opacity: 0; visibility: hidden; }

.loader__mark {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(229,197,117,.8);
  border-radius: 50%;
  color: var(--gold);
  font-family: STXingkai, KaiTi, serif;
  font-size: 24px;
  letter-spacing: 2px;
}

.loader__line {
  width: 132px;
  height: 2px;
  overflow: hidden;
  background: rgba(255,255,255,.14);
}

.loader__line span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--gold);
  transition: width .18s ease;
}

.loader p { margin: 0; color: rgba(255,255,255,.62); font-size: 12px; letter-spacing: 2px; }

.invitation {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-y: contain;
  background: #111;
  -webkit-overflow-scrolling: touch;
}

.page {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  overflow: hidden;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.page::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 0;
  background: radial-gradient(circle at 50% 42%, #28303a 0, #14171b 55%, #090a0c 100%);
}

.page::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.22), transparent 12%, transparent 86%, rgba(0,0,0,.3));
  pointer-events: none;
}

.page__image {
  display: block;
  width: 100vw;
  max-width: 75vh;
  height: auto;
  max-height: 100vh;
  max-height: 100dvh;
  object-fit: contain;
  box-shadow: 0 0 20px rgba(0,0,0,.3);
  user-select: none;
  -webkit-user-drag: none;
}

.swipe-hint {
  position: absolute;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  display: grid;
  justify-items: center;
  gap: 7px;
  color: rgba(255,255,255,.88);
  font-size: 11px;
  letter-spacing: 2px;
  transform: translateX(-50%);
  text-shadow: 0 1px 8px rgba(0,0,0,.8);
  animation: hint 1.8s ease-in-out infinite;
  transition: opacity .25s ease;
}

.page:not(.is-active) .swipe-hint { opacity: 0; }
.swipe-hint span { width: 9px; height: 9px; border-left: 1px solid; border-top: 1px solid; transform: rotate(45deg); }
.swipe-hint em { font-style: normal; }

@keyframes hint {
  0%,100% { transform: translate(-50%, 4px); opacity: .5; }
  50% { transform: translate(-50%, -5px); opacity: 1; }
}

.progress {
  position: fixed;
  z-index: 12;
  left: max(14px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,.78);
  font: 10px/1 Georgia, serif;
  letter-spacing: 1px;
  text-shadow: 0 1px 6px rgba(0,0,0,.8);
}

.progress i { display: block; width: 22px; height: 1px; background: rgba(255,255,255,.48); }

.share-button {
  position: fixed;
  z-index: 12;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(13px, env(safe-area-inset-bottom));
  width: 38px;
  height: 38px;
  padding: 9px;
  border: 1px solid rgba(255,255,255,.42);
  border-radius: 50%;
  color: white;
  background: rgba(8,10,13,.76);
}

.share-button svg { width: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.share-final {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  padding: 11px 22px;
  border: 1px solid rgba(23,43,67,.54);
  border-radius: 999px;
  color: #172b43;
  background: rgba(245,240,228,.82);
  box-shadow: 0 8px 28px rgba(0,0,0,.18);
  font-size: 12px;
  letter-spacing: 2px;
}

.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: calc(max(70px, env(safe-area-inset-bottom)) + 10px);
  max-width: 80vw;
  padding: 10px 16px;
  border-radius: 999px;
  color: white;
  background: rgba(0,0,0,.76);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: .25s ease;
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.share-guide {
  position: fixed;
  z-index: 70;
  inset: 0;
  display: none;
  background: rgba(3,4,5,.75);
}

.share-guide.is-visible { display: block; }
.share-guide__arrow { position: absolute; right: 18px; top: 6px; color: white; font-size: 48px; transform: rotate(-8deg); }

.share-guide__card {
  position: absolute;
  left: 50%;
  top: 26%;
  width: min(82vw, 330px);
  padding: 25px 22px 20px;
  border: 1px solid rgba(229,197,117,.48);
  border-radius: 16px;
  color: white;
  text-align: center;
  background: #17202b;
  transform: translateX(-50%);
}

.share-guide__card strong { color: var(--gold); font-family: STZhongsong, SimSun, serif; font-size: 20px; letter-spacing: 2px; }
.share-guide__card p { margin: 16px 0 20px; color: rgba(255,255,255,.76); font-size: 13px; line-height: 1.8; }
.share-guide__card button { border: 0; padding: 8px 28px; border-radius: 999px; color: #17202b; background: var(--gold); }

@media (min-width: 760px) {
  .page__image { max-width: 540px; }
}

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