:root {
  --ink: #07090b;
  --chat: #111213;
  --bar: #1c1c1e;
  --wx: #07c160;
  --wx-dim: #2ba471;
  --me: #3eb575;
  --her: #2c2c2e;
  --gold: #e3c57a;
  --rose: #e3a3a8;
  --paper: #efe6d2;
  --mute: #8e8e93;
  --line: rgba(255, 255, 255, 0.06);
  --text: #f4f4f5;
  --soft: rgba(244, 244, 245, 0.62);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei",
    system-ui, sans-serif;
  --display: "ZCOOL XiaoWei", "Songti SC", "STSong", serif;
  --brush: "Ma Shan Zheng", "ZCOOL XiaoWei", "KaiTi", serif;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
html, body { min-height: 100%; }
body {
  font-family: var(--sans);
  color: var(--text);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }

.sky {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(7, 9, 11, 0.2), rgba(7, 9, 11, 0.72)),
    url("../assets/sky.jpg") center 40% / cover no-repeat;
  z-index: 0;
}
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  opacity: 0.08;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- gate ---------- */
.gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: end center;
  padding: 0 20px 11vh;
  background:
    linear-gradient(180deg, rgba(7, 9, 11, 0.15) 0%, rgba(7, 9, 11, 0.72) 70%),
    url("../assets/sky.jpg") center 38% / cover no-repeat;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}
.gate.is-gone {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.gate-time {
  position: absolute;
  top: 11vh;
  left: 0;
  right: 0;
  text-align: center;
}
.gate-time .hm {
  font-family: var(--display);
  font-size: clamp(56px, 12vw, 84px);
  letter-spacing: 0.08em;
  line-height: 1;
  color: var(--paper);
  text-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
}
.gate-time .date {
  margin-top: 8px;
  font-size: 13px;
  letter-spacing: 0.28em;
  color: var(--gold);
  text-transform: none;
}
.notice {
  width: min(420px, 100%);
  background: rgba(28, 28, 30, 0.72);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  padding: 16px 16px 14px;
  box-shadow: var(--shadow);
  animation: rise 1s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.notice-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.wx-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--wx);
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 4px rgba(7, 193, 96, 0.12);
}
.wx-mark svg { width: 18px; height: 18px; fill: #fff; }
.notice-app {
  flex: 1;
  font-size: 13px;
  color: var(--mute);
  letter-spacing: 0.04em;
}
.notice-now { font-size: 12px; color: var(--mute); }
.notice h1 {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.notice p {
  font-size: 14px;
  line-height: 1.55;
  color: var(--soft);
}
.notice-cta {
  margin-top: 16px;
  width: 100%;
  height: 44px;
  border-radius: 12px;
  background: var(--wx);
  color: #fff;
  font-size: 15px;
  letter-spacing: 0.12em;
  box-shadow: 0 8px 24px rgba(7, 193, 96, 0.28);
}
.notice-cta:hover { filter: brightness(1.05); }
.notice-hint {
  display: block;
  margin-top: 10px;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--mute);
}

@keyframes rise {
  from { transform: translateY(28px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* ---------- stage / phone ---------- */
.stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}
.phone {
  width: min(430px, 100%);
  margin: 0 auto;
  background: var(--chat);
  min-height: 100vh;
  position: relative;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
}
@media (min-width: 760px) {
  .stage { padding: 36px 0 64px; }
  .phone {
    min-height: calc(100vh - 72px);
    border-radius: 34px;
    border: 10px solid #141416;
    box-shadow: var(--shadow), 0 0 0 1px #2a2a2c;
  }
  .wx-head { top: 36px; border-radius: 24px 24px 0 0; }
}

/* ---------- wechat header ---------- */
.wx-head {
  position: sticky;
  top: 0;
  z-index: 8;
  height: 56px;
  background: rgba(28, 28, 30, 0.92);
  backdrop-filter: blur(16px);
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 0 8px;
}
.wx-head .back {
  font-size: 28px;
  line-height: 1;
  color: var(--text);
  padding-left: 6px;
}
.wx-head .who {
  text-align: center;
}
.wx-head .who b {
  display: block;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.wx-head .who small {
  display: block;
  margin-top: 1px;
  font-size: 10px;
  color: var(--mute);
  letter-spacing: 0.16em;
}
.wx-head .more {
  text-align: center;
  letter-spacing: 2px;
  color: var(--mute);
}

/* ---------- chat stream ---------- */
.stream {
  padding: 18px 12px 40px;
}
.stamp {
  text-align: center;
  font-size: 11px;
  color: var(--mute);
  letter-spacing: 0.08em;
  margin: 18px 0 14px;
}
.sys {
  text-align: center;
  font-size: 12px;
  color: #9a9aa0;
  background: rgba(255, 255, 255, 0.04);
  display: table;
  margin: 10px auto 16px;
  padding: 5px 10px;
  border-radius: 4px;
  line-height: 1.45;
  max-width: 86%;
}

.row {
  display: flex;
  gap: 8px;
  margin: 10px 0;
  align-items: flex-start;
  opacity: 0;
  transform: translateY(10px);
  animation: pop 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.row.me { flex-direction: row-reverse; }
.row.inview { }

@keyframes pop {
  to { opacity: 1; transform: none; }
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  background: #3a3a3c;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar.her img { object-position: 50% 42%; transform: scale(1.72); }
.avatar.me img { object-position: 50% 46%; transform: scale(1.62); }

.bubble {
  max-width: 74%;
  padding: 9px 11px;
  font-size: 16px;
  line-height: 1.45;
  position: relative;
  word-break: break-word;
}
.bubble.her {
  background: var(--her);
  color: #fff;
  border-radius: 4px 10px 10px 10px;
}
.bubble.me {
  background: var(--me);
  color: #fff;
  border-radius: 10px 4px 10px 10px;
}
.bubble.soft { font-size: 15px; color: #f7f7f8; }

/* ---------- chapter cards ---------- */
.chapter {
  margin: 28px 6px 18px;
  padding: 22px 18px 20px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(227, 197, 122, 0.08), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(227, 197, 122, 0.18);
}
.chapter .eyebrow {
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--gold);
  margin-bottom: 8px;
}
.chapter h2 {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1.35;
  word-break: keep-all;
}
.chapter p {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--soft);
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0 6px;
}
.stat {
  background: #1a1a1c;
  border-radius: 12px;
  padding: 14px 12px 12px;
  border: 1px solid var(--line);
}
.stat .n {
  font-family: var(--display);
  font-size: 30px;
  letter-spacing: 0.02em;
  color: var(--paper);
  line-height: 1;
}
.stat .n em {
  font-style: normal;
  color: var(--wx);
}
.stat .l {
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--mute);
}
.stat.wide { grid-column: 1 / -1; }
.stat.love .n { color: var(--rose); }
.stat.gold .n { color: var(--gold); }

.split {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--soft);
}
.split b { color: var(--paper); font-weight: 600; }

.phrase-list {
  display: grid;
  gap: 7px;
  margin: 8px 0 4px;
}
.phrase {
  display: grid;
  grid-template-columns: 72px 1fr 52px;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.phrase .k { color: var(--paper); letter-spacing: 0.06em; }
.bar {
  height: 7px;
  background: #2a2a2c;
  border-radius: 99px;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  width: 0;
  min-width: 4px;
  background: linear-gradient(90deg, var(--wx-dim), var(--gold));
  border-radius: inherit;
  transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.phrase.is-on .bar > i { width: var(--w); }
.phrase .v { text-align: right; color: var(--gold); font-variant-numeric: tabular-nums; }

.year {
  margin: 10px 0;
}
.year-row {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
  font-size: 12px;
}
.year-row .y { color: var(--mute); }
.voice {
  height: 22px;
  background: var(--me);
  border-radius: 4px;
  position: relative;
  min-width: 48px;
}
.voice::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 5px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 6px 0 6px 8px;
  border-color: transparent transparent transparent #fff;
}
.voice span {
  position: absolute;
  right: 8px;
  top: 3px;
  font-size: 11px;
  color: #fff;
}

.hours {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 2px;
  margin-top: 8px;
}
.hours i {
  display: block;
  height: 52px;
  background: #2a2a2c;
  border-radius: 2px 2px 1px 1px;
  position: relative;
  overflow: hidden;
}
.hours i::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--h, 10%);
  background: var(--wx);
  opacity: 0.85;
}
.hours-cap {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 10px;
  color: var(--mute);
  letter-spacing: 0.08em;
}

.quote {
  margin: 16px 8px;
  padding-left: 12px;
  border-left: 2px solid var(--gold);
}
.quote p {
  font-family: var(--display);
  font-size: 20px;
  line-height: 1.5;
  color: var(--paper);
}
.quote small {
  display: block;
  margin-top: 8px;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--mute);
}

.museum {
  margin-top: 8px;
}

.void {
  margin: 28px 6px;
  padding: 28px 18px;
  border-radius: 16px;
  background: #0c0c0e;
  border: 1px dashed rgba(227, 197, 122, 0.28);
  text-align: center;
}
.void .dates {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 0.12em;
  color: var(--gold);
  line-height: 1.6;
}
.void p {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.75;
  color: var(--soft);
}
.void .dash {
  display: block;
  width: 48px;
  height: 1px;
  margin: 14px auto;
  background: rgba(227, 197, 122, 0.35);
}

.river { margin-top: 12px; }
.river-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  align-items: center;
  margin: 5px 0;
  font-size: 11px;
  color: var(--mute);
}
.river-track {
  height: 10px;
  background: #222226;
  border-radius: 99px;
  position: relative;
  overflow: hidden;
}
.river-track .xu,
.river-track .bao {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 99px;
}
.river-track .xu {
  left: 0;
  width: var(--xu);
  background: rgba(227, 197, 122, 0.55);
}
.river-track .bao {
  left: 0;
  width: var(--bao);
  background: var(--wx-dim);
  opacity: 0.9;
}
.legend {
  display: flex;
  gap: 14px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--mute);
}
.legend b { font-weight: 500; }
.legend .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}
.legend .dot.xu { background: var(--gold); }
.legend .dot.bao { background: var(--wx); }

.tl { margin: 8px 4px 0; padding-left: 12px; border-left: 1px solid rgba(227, 197, 122, 0.25); }
.tl-item { margin: 0 0 14px; position: relative; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(227, 197, 122, 0.15);
}
.tl-item .when {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--gold);
}
.tl-item p {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--paper);
}

.duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.duo article {
  background: #1a1a1c;
  border-radius: 12px;
  padding: 14px 12px;
  border: 1px solid var(--line);
}
.duo .n {
  font-family: var(--display);
  font-size: 28px;
  color: var(--paper);
}
.duo small {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--mute);
}

.clock {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 2px;
  align-items: end;
  height: 56px;
  margin-top: 10px;
}
.clock i {
  display: block;
  height: var(--h, 8%);
  min-height: 2px;
  background: #3a3a3c;
  border-radius: 2px 2px 0 0;
}
.clock i.hot { background: var(--gold); }

.book {
  margin-top: 10px;
  padding: 16px 14px;
  border-radius: 10px;
  background: linear-gradient(180deg, #efe6d2, #e4d4b4);
  color: #3a2a18;
}
.book .pg {
  font-family: var(--display);
  font-size: 36px;
  line-height: 1;
}
.book p {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.65;
  color: #5a4630;
}

.callbar {
  margin-top: 10px;
  height: 36px;
  background: var(--me);
  border-radius: 6px;
  position: relative;
}
.callbar::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 11px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 7px 0 7px 10px;
  border-color: transparent transparent transparent #fff;
}
.callbar span {
  position: absolute;
  right: 12px;
  top: 8px;
  font-size: 14px;
  color: #fff;
  letter-spacing: 0.06em;
}

.heart {
  margin-top: 12px;
}
.heart svg { width: 100%; height: 64px; display: block; }
.heart-cap {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--mute);
  letter-spacing: 0.08em;
}

.draw {
  margin-top: 12px;
}
.draw-btn {
  width: 100%;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(180deg, #3eb575, #2ba471);
  color: #fff;
  letter-spacing: 0.16em;
  font-size: 14px;
}
.draw-btn:hover { filter: brightness(1.05); }
.draw-btn:active { filter: brightness(0.95); }
.draw-stage { min-height: 8px; margin-top: 8px; }

.anni {
  margin-top: 8px;
}
.anni-card {
  margin: 8px 0;
  padding: 12px 12px 10px;
  border-radius: 10px;
  background: #1a1a1c;
  border: 1px solid var(--line);
}
.anni-card .y {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--gold);
}
.anni-card p {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--paper);
}

.closing {
  margin: 36px 8px 20px;
  text-align: center;
}
.closing .brush {
  font-family: var(--brush);
  font-size: clamp(34px, 10vw, 48px);
  color: var(--paper);
  letter-spacing: 0.12em;
}
.closing p {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--soft);
}
.closing .to {
  margin-top: 18px;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--gold);
}

.composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  background: #1c1c1e;
  border-top: 1px solid var(--line);
  border-radius: 0 0 24px 24px;
}
.composer .plus {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid #8e8e93;
  display: grid;
  place-items: center;
  color: #c7c7cc;
  font-size: 20px;
  line-height: 1;
}
.composer .input {
  flex: 1;
  background: #2c2c2e;
  border-radius: 6px;
  min-height: 36px;
  padding: 8px 10px;
  font-size: 15px;
  color: var(--paper);
  display: flex;
  align-items: center;
}
.composer .input .caret {
  width: 1px;
  height: 16px;
  background: var(--wx);
  margin-left: 1px;
  animation: blink 1s steps(2) infinite;
}
.composer .send {
  background: var(--wx);
  color: #fff;
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 14px;
}
@keyframes blink { 50% { opacity: 0; } }

.foot {
  text-align: center;
  padding: 18px 16px 28px;
  font-size: 11px;
  color: #636366;
  letter-spacing: 0.12em;
}

@media (prefers-reduced-motion: reduce) {
  .row, .notice, .composer .input .caret { animation: none; opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
