:root {
  --gold: #e9c98d;
  --gold-hi: #f8ecd2;
  --gold-deep: #b98a44;
  --cream: #f4e8d0;
  --ink: #08050f;
  --muted: rgba(244, 232, 208, .52);
  --line: rgba(233, 201, 141, .22);
  --sans: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "SimSun", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #08050f;
  color: var(--cream);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

body {
  background:
    radial-gradient(58% 48% at 50% 36%, rgba(104, 63, 158, .40), transparent 72%),
    radial-gradient(36% 34% at 84% 14%, rgba(233, 201, 141, .09), transparent 70%),
    radial-gradient(46% 42% at 14% 86%, rgba(66, 36, 112, .38), transparent 72%),
    linear-gradient(180deg, #0e0719 0%, #160b27 46%, #090511 100%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 30;
  opacity: .035;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

#stage { position: fixed; inset: 0; overflow: hidden; }

#fx {
  position: absolute;
  inset: 0;
  display: block;
  z-index: 1;
}

/* ---------------------------------------------------------------- 顶栏 */

.hud {
  position: absolute;
  top: 46px;
  left: 64px;
  right: 64px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 8;
  pointer-events: none;
}

.brand { display: flex; gap: 18px; align-items: center; }

.brand-mark {
  width: 58px;
  height: auto;
  opacity: .92;
  filter: drop-shadow(0 0 14px rgba(233, 201, 141, .28));
}

.brand-cn {
  font-size: 23px;
  font-weight: 600;
  letter-spacing: .30em;
  color: var(--gold-hi);
}

.brand-en {
  margin-top: 7px;
  font-size: 10.5px;
  letter-spacing: .40em;
  color: var(--muted);
}

.counter { display: flex; align-items: center; gap: 12px; padding-top: 6px; }

.hud-right { display: flex; flex-direction: column; align-items: flex-end; }

.hud-date {
  margin-top: 12px;
  font-size: 10.5px;
  letter-spacing: .34em;
  color: rgba(244, 232, 208, .28);
}

.counter-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 0 rgba(233, 201, 141, .5);
  animation: pulse 2.4s infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(233, 201, 141, .45); }
  70%  { box-shadow: 0 0 0 12px rgba(233, 201, 141, 0); }
  100% { box-shadow: 0 0 0 0 rgba(233, 201, 141, 0); }
}

.counter-num {
  font-size: 46px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--gold-hi);
  text-shadow: 0 0 26px rgba(233, 201, 141, .35);
  transition: transform .18s;
  display: inline-block;
}

.counter-num.pop { transform: scale(1.18); }

.counter-label {
  font-size: 12px;
  line-height: 1.45;
  letter-spacing: .12em;
  color: var(--muted);
}

/* ---------------------------------------------------------------- 纸条 */

.card-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 6;
  pointer-events: none;
  perspective: 1400px;
}

.paper-card {
  position: relative;
  width: min(880px, 58vw);
  min-height: 260px;
  padding: 54px 68px 44px;
  border-radius: 4px;
  background:
    repeating-linear-gradient(0deg, rgba(120, 90, 40, .028) 0 1px, transparent 1px 4px),
    linear-gradient(155deg, #fcf5e6 0%, #f3e5c9 58%, #e9d6b3 100%);
  box-shadow:
    0 46px 90px rgba(0, 0, 0, .58),
    0 2px 0 rgba(255, 255, 255, .45) inset,
    0 0 0 1px rgba(120, 84, 34, .18);
  transform: translateY(-5vh) rotate(var(--rot, -1.4deg)) scale(.92);
  opacity: 0;
  transition: opacity .38s ease, transform .5s cubic-bezier(.2, 1.2, .3, 1);
  will-change: transform, opacity;
}

.paper-card.show {
  opacity: 1;
  transform: translateY(-5vh) rotate(var(--rot, -1.4deg)) scale(1);
}

.paper-card.fold {
  opacity: 0;
  transform: translateY(-5vh) rotate(var(--rot, -1.4deg)) scaleY(.03) scaleX(1.06);
  transition: opacity .3s ease .12s, transform .46s cubic-bezier(.6, 0, .8, .4);
}

.card-fold {
  position: absolute;
  top: 0;
  right: 0;
  width: 54px;
  height: 54px;
  background: linear-gradient(225deg, #d8c19a 0%, #efe0c2 48%, #fbf4e4 50%);
  box-shadow: -2px 2px 5px rgba(90, 62, 22, .22);
  border-bottom-left-radius: 4px;
  clip-path: polygon(100% 0, 0 0, 100% 100%);
}

.card-quote {
  position: absolute;
  top: 12px;
  left: 30px;
  font-family: var(--serif);
  font-size: 96px;
  line-height: 1;
  color: rgba(150, 106, 40, .16);
  pointer-events: none;
}

.card-text {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(30px, 2.35vw, 46px);
  font-weight: 600;
  line-height: 1.56;
  letter-spacing: .015em;
  color: #3d2b13;
  word-break: break-word;
  white-space: pre-wrap;
  position: relative;
  z-index: 1;
}

.card-meta {
  margin-top: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 18px;
  color: #8d6a35;
  position: relative;
  z-index: 1;
}

.card-name { letter-spacing: .16em; font-weight: 600; }
.card-name::before {
  content: "";
  display: inline-block;
  width: 26px;
  height: 1px;
  margin-right: 12px;
  vertical-align: middle;
  background: rgba(141, 106, 53, .5);
}

.card-index { letter-spacing: .14em; opacity: .72; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- 开场提示 */

.hint {
  position: absolute;
  left: 0;
  right: 0;
  top: 38%;
  z-index: 5;
  text-align: center;
  pointer-events: none;
  transition: opacity .6s ease;
}

.hint.gone { opacity: 0; }

.hint-line {
  width: 1px;
  height: 58px;
  margin: 0 auto 30px;
  background: linear-gradient(180deg, transparent, rgba(233, 201, 141, .55), transparent);
}

.hint-main {
  font-family: var(--serif);
  font-size: clamp(32px, 3.1vw, 58px);
  letter-spacing: .14em;
  color: var(--gold-hi);
  text-shadow: 0 0 40px rgba(233, 201, 141, .22);
}

.hint-sub {
  margin-top: 18px;
  font-size: 16px;
  letter-spacing: .30em;
  color: var(--muted);
}

/* ---------------------------------------------------------------- 底部快讯 */

.ticker {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 52px;
  height: 46px;
  overflow: hidden;
  z-index: 4;
  opacity: .82;
  transition: opacity .9s ease;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}

.ticker.off { opacity: 0; }

.ticker-track {
  position: absolute;
  left: 0;
  top: 0;
  height: 46px;
  display: flex;
  align-items: center;
  gap: 60px;
  white-space: nowrap;
  will-change: transform;
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-size: 19px;
  letter-spacing: .04em;
  color: rgba(244, 232, 208, .62);
}

.ticker-item b { color: rgba(233, 201, 141, .92); font-weight: 600; letter-spacing: .08em; }

.ticker-item i {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(233, 201, 141, .55);
  margin: 0 2px;
}

/* ---------------------------------------------------------------- 汇聚 LOGO */

.logo-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.1s ease;
}

.logo-layer.on { opacity: 1; }

#logoImg {
  position: absolute;
  left: 50%;
  top: 46%;
  height: min(56vh, 620px);
  width: auto;
  transform: translate(-50%, -50%) scale(1.06);
  transition: transform 2.2s cubic-bezier(.2, .7, .2, 1);
  filter: drop-shadow(0 0 46px rgba(233, 201, 141, .38)) drop-shadow(0 0 120px rgba(233, 201, 141, .16));
}

.logo-layer.on #logoImg { transform: translate(-50%, -50%) scale(1); }

.finale-text {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(46% + min(28vh, 310px) + 22px);
  text-align: center;
  z-index: 7;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 1.1s ease, transform 1.4s cubic-bezier(.2, .8, .2, 1);
  pointer-events: none;
}

.finale-text.on { opacity: 1; transform: none; }

.ft-en { font-size: 11px; letter-spacing: .52em; color: rgba(233, 201, 141, .62); }

.ft-main {
  margin-top: 14px;
  font-family: var(--serif);
  font-size: clamp(34px, 3.1vw, 56px);
  letter-spacing: .16em;
  color: var(--gold-hi);
  text-shadow: 0 0 50px rgba(233, 201, 141, .30);
}

.ft-sub { margin-top: 14px; font-size: 14px; letter-spacing: .28em; color: var(--muted); }

/* ---------------------------------------------------------------- 二维码 */

.qrbox {
  position: absolute;
  right: 64px;
  bottom: 116px;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px 14px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(10, 6, 18, .55);
  backdrop-filter: blur(10px);
  transition: all .6s cubic-bezier(.2, .8, .2, 1);
  pointer-events: none;
}

.qr-code {
  width: clamp(132px, 8vw, 210px);
  height: clamp(132px, 8vw, 210px);
  padding: 8px;
  background: #fff;
  border-radius: 8px;
  transition: all .6s cubic-bezier(.2, .8, .2, 1);
}

.qr-canvas, .qr-canvas img, .qr-canvas svg { display: block; width: 100%; height: 100%; }

.qr-t1 { font-size: 17px; letter-spacing: .14em; color: var(--gold-hi); }
.qr-t2 {
  margin-top: 8px;
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--muted);
  max-width: 180px;
  word-break: break-all;
  line-height: 1.5;
}

.qrbox.compact {
  padding: 8px;
  gap: 0;
  border-color: rgba(233, 201, 141, .14);
  background: rgba(10, 6, 18, .38);
  opacity: .72;
}

.qrbox.compact .qr-code { width: clamp(84px, 5vw, 120px); height: clamp(84px, 5vw, 120px); padding: 6px; }
.qrbox.compact .qr-txt { display: none; }

.foot {
  position: absolute;
  left: 64px;
  bottom: 58px;
  z-index: 8;
  font-size: 11px;
  letter-spacing: .30em;
  color: rgba(244, 232, 208, .34);
  pointer-events: none;
}

.foot-dot { margin: 0 12px; }

/* ---------------------------------------------------------------- 管理面板 */

.admin {
  position: absolute;
  top: 0;
  right: 0;
  width: 400px;
  height: 100%;
  z-index: 40;
  padding: 26px 24px 20px;
  background: rgba(9, 5, 16, .96);
  border-left: 1px solid var(--line);
  box-shadow: -30px 0 80px rgba(0, 0, 0, .5);
  transform: translateX(102%);
  transition: transform .32s cubic-bezier(.3, .8, .2, 1);
  overflow-y: auto;
  font-size: 14px;
}

.admin.open { transform: none; }

.admin-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.admin-head strong { font-size: 16px; letter-spacing: .16em; color: var(--gold-hi); font-weight: 600; }

.admin .x {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  border-radius: 8px;
  cursor: pointer;
}

.admin-stat {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 14px 0 18px;
  border-bottom: 1px solid rgba(233, 201, 141, .12);
}

.admin-stat div { text-align: center; }
.admin-stat b { display: block; font-size: 22px; color: var(--gold-hi); font-variant-numeric: tabular-nums; }
.admin-stat #aLink { font-size: 13px; line-height: 30px; color: rgba(233, 201, 141, .8); }
.admin-stat span { font-size: 11px; color: var(--muted); letter-spacing: .1em; }

.admin-sec { padding: 16px 0 4px; border-bottom: 1px solid rgba(233, 201, 141, .08); }

.admin-label {
  font-size: 11px;
  letter-spacing: .24em;
  color: rgba(233, 201, 141, .55);
  margin-bottom: 12px;
}

.admin-tip { color: rgba(244, 232, 208, .3); letter-spacing: .06em; }

.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }

.admin button {
  font-family: inherit;
  font-size: 13px;
  padding: 11px 10px;
  border-radius: 9px;
  border: 1px solid rgba(233, 201, 141, .22);
  background: rgba(233, 201, 141, .06);
  color: var(--cream);
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .1s;
  letter-spacing: .04em;
}

.admin button:hover { background: rgba(233, 201, 141, .13); border-color: rgba(233, 201, 141, .4); }
.admin button:active { transform: scale(.98); }

.admin button.gold { background: rgba(233, 201, 141, .2); color: #fff6e3; border-color: rgba(233, 201, 141, .55); }
.admin button.danger { color: #f0a9a9; border-color: rgba(240, 120, 120, .3); background: rgba(240, 120, 120, .06); }
.admin button.on { background: rgba(233, 201, 141, .3); }

.admin-test { display: grid; grid-template-columns: 84px 1fr; gap: 8px; margin-bottom: 12px; }

.admin-key { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 12px; }

.admin-test input,
.admin-key input {
  font-family: inherit;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid rgba(233, 201, 141, .18);
  background: rgba(255, 255, 255, .04);
  color: var(--cream);
  outline: none;
  min-width: 0;
}

.admin-test input:focus,
.admin-key input:focus { border-color: rgba(233, 201, 141, .5); }
.admin-test button { grid-column: 1 / -1; }
.admin-key button { white-space: nowrap; }

.admin-export { width: 100%; margin-top: 4px; }

.admin-list { max-height: 220px; overflow-y: auto; margin-bottom: 10px; }

.admin-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dashed rgba(233, 201, 141, .08);
  font-size: 12.5px;
  color: rgba(244, 232, 208, .74);
}

.admin-row b { color: var(--gold); font-weight: 600; flex: none; max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-row span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.admin-row button {
  flex: none;
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  border-radius: 6px;
  color: rgba(244, 232, 208, .5);
}

.admin-links { padding-bottom: 12px; }
.admin-links a {
  display: block;
  padding: 7px 0;
  color: rgba(233, 201, 141, .8);
  font-size: 12.5px;
  text-decoration: none;
  word-break: break-all;
}
.admin-links a:hover { color: var(--gold-hi); }

.admin-foot { padding-top: 14px; font-size: 11px; line-height: 1.8; color: rgba(244, 232, 208, .28); }

/* ---------------------------------------------------------------- toast */

.toast {
  position: absolute;
  left: 50%;
  bottom: 120px;
  transform: translate(-50%, 16px);
  z-index: 50;
  padding: 11px 20px;
  border-radius: 999px;
  background: rgba(10, 6, 18, .9);
  border: 1px solid var(--line);
  font-size: 13px;
  letter-spacing: .06em;
  color: var(--gold-hi);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}

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

@media (max-height: 720px) {
  .hud { top: 28px; left: 40px; right: 40px; }
  .brand-cn { font-size: 19px; }
  .brand-mark { width: 46px; }
  .counter-num { font-size: 36px; }
  .qrbox { right: 40px; bottom: 92px; }
  .foot { left: 40px; bottom: 40px; }
  .paper-card { padding: 38px 48px 32px; }
  .card-meta { margin-top: 20px; font-size: 15px; }
}
