:root {
  /* 深色宇宙（流程前 3 幕） */
  --night: #0B0820;
  --night-2: #1A0B3D;
  --night-3: #2A0F5C;
  /* 证书（浅色） */
  --bg-cream: #FAF7F2;
  --bg-glow: #F0EAFB;
  --bg-warm: #FFF4D6;
  --ink: #1A1A2E;
  --ink-soft: #4A4A6A;
  --grape: #7C3AED;
  --violet: #A855F7;
  --gold: #D4AF37;
  --gold-deep: #B8902A;
  --gold-light: #F4E4BC;
  --paper: #FFFFFF;
  --line: rgba(26, 26, 46, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { overflow-x: hidden; }

body {
  font-family: 'Inter', 'Noto Serif SC', system-ui, sans-serif;
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, var(--night-3) 0%, transparent 60%),
    radial-gradient(ellipse 80% 60% at 100% 100%, var(--night-2) 0%, transparent 55%),
    var(--night);
  background-attachment: fixed;
  color: #fff;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ============ Canvas 层 ============ */
.bg-canvas, .fx-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.bg-canvas { z-index: 1; }
.fx-canvas { z-index: 50; }

/* ============ 场景 ============ */
.flow { position: relative; z-index: 2; }

.scene {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.7s ease, visibility 0.7s ease;
  overflow-y: auto;
}
.scene.active { opacity: 1; visibility: visible; }
.scene-cert {
  /* 修复：内容超出视口时顶部被裁切且无法滚动的问题
     flexbox 居中 + overflow:auto 会导致顶部溢出不可达，改用 flex-start */
  align-items: flex-start;
  background:
    radial-gradient(ellipse 60% 40% at 20% 10%, rgba(212, 175, 55, 0.18) 0%, transparent 60%),
    radial-gradient(ellipse 55% 45% at 85% 90%, rgba(124, 58, 237, 0.16) 0%, transparent 60%),
    radial-gradient(ellipse 80% 50% at 50% 50%, rgba(244, 228, 188, 0.25) 0%, transparent 70%),
    var(--bg-cream);
}

/* 幕一/二/三：透明，让 body 深色 + 粒子透出 */
.scene-welcome, .scene-input, .scene-envelope { background: transparent; }

.eyebrow {
  font-size: clamp(11px, 1.4vw, 14px);
  letter-spacing: 0.4em;
  color: var(--gold);
  text-transform: uppercase;
  font-weight: 600;
  text-align: center;
  padding-left: 0.4em;
}
.eyebrow.glow { text-shadow: 0 0 14px rgba(212, 175, 55, 0.55); }

/* ============ 幕一：欢迎 ============ */
.welcome {
  text-align: center;
  max-width: 760px;
  animation: rise 1s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.welcome-title {
  font-family: 'Noto Serif SC', serif;
  font-weight: 900;
  font-size: clamp(36px, 7vw, 84px);
  line-height: 1.15;
  letter-spacing: 0.04em;
  margin: 18px 0 14px;
  text-shadow:
    0 0 24px rgba(212, 175, 55, 0.35),
    0 0 48px rgba(168, 85, 247, 0.25),
    0 6px 30px rgba(0, 0, 0, 0.5);
  animation: titleGlow 3.5s ease-in-out infinite alternate;
}
@keyframes titleGlow {
  from { text-shadow: 0 0 24px rgba(212, 175, 55, 0.35), 0 0 48px rgba(168, 85, 247, 0.25), 0 6px 30px rgba(0, 0, 0, 0.5); }
  to   { text-shadow: 0 0 36px rgba(212, 175, 55, 0.55), 0 0 72px rgba(168, 85, 247, 0.4),  0 6px 30px rgba(0, 0, 0, 0.5); }
}
.grad {
  background: linear-gradient(100deg, var(--gold) 0%, #F4E4BC 35%, var(--violet) 75%, var(--grape) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 18px rgba(168, 85, 247, 0.5));
}
.welcome-sub {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: clamp(16px, 2.2vw, 24px);
  color: rgba(255, 255, 255, 0.78);
  letter-spacing: 0.1em;
  margin-bottom: 38px;
}

/* ============ 主按钮 ============ */
.btn-cta {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.18em;
  padding-left: calc(28px + 0.18em);
  padding: 15px 28px;
  color: var(--ink);
  background: linear-gradient(135deg, var(--gold) 0%, #F0D060 50%, var(--gold-deep) 100%);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow:
    0 10px 30px -8px rgba(212, 175, 55, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.2s ease, box-shadow 0.3s ease;
}
.btn-cta:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 16px 40px -10px rgba(212, 175, 55, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.btn-cta:active { transform: translateY(0) scale(1); }

/* ============ 幕二：昵称 ============ */
.nick {
  text-align: center;
  max-width: 520px;
  width: 100%;
  animation: rise 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.nick-title {
  font-family: 'Noto Serif SC', serif;
  font-weight: 700;
  font-size: clamp(26px, 4.5vw, 42px);
  margin: 16px 0 8px;
  color: #fff;
}
.nick-sub {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: clamp(14px, 1.8vw, 18px);
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 28px;
}

/* 阶段切换 */
.nick-step {
  animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.nick-step[hidden] { display: none; }

/* 显眼警告提示 */
.nick-warn {
  font-family: 'Noto Serif SC', sans-serif;
  font-size: clamp(12px, 1.5vw, 15px);
  font-weight: 600;
  line-height: 1.7;
  color: #1A1A2E;
  background: linear-gradient(100deg, #F4E4BC, #FFD86B);
  border: 1.5px solid var(--gold);
  border-radius: 10px;
  padding: 10px 16px;
  margin: 0 0 22px;
  text-align: center;
  box-shadow: 0 0 18px rgba(212, 175, 55, 0.3);
}

/* 验证结果消息 */
.nick-msg {
  font-size: 13px;
  font-weight: 500;
  min-height: 20px;
  margin: -10px 0 16px;
  text-align: center;
  letter-spacing: 0.02em;
  transition: color 0.2s ease;
}
.nick-msg.ok    { color: #4ADE80; }
.nick-msg.err   { color: #F87171; }
.nick-msg.check { color: rgba(255, 255, 255, 0.7); }

/* 返回按钮 */
.btn-back {
  display: block;
  margin: 14px auto 0;
  font-family: inherit;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
}
.btn-back:hover { color: var(--gold); }

/* 验证中状态 */
.btn-cta.verifying { opacity: 0.6; pointer-events: none; }

/* 其他验证方式 */
.alt-verify {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px dashed rgba(255, 255, 255, 0.18);
  text-align: center;
}
.alt-toggle {
  font-family: 'Noto Serif SC', sans-serif;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  background: none;
  border: none;
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: color 0.2s ease;
}
.alt-toggle::before { content: '◇  '; opacity: 0.6; }
.alt-toggle:hover { color: var(--gold); }

.alt-panel {
  margin-top: 16px;
  animation: rise 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.alt-panel[hidden] { display: none; }
.alt-hint {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 14px;
  line-height: 1.6;
}
.btn-alt { margin-top: 4px; }
.nick-field { margin-bottom: 26px; }
.nick-field input {
  font-family: inherit;
  font-size: 17px;
  width: 100%;
  padding: 15px 18px;
  text-align: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(212, 175, 55, 0.4);
  border-radius: 12px;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.nick-field input::placeholder { color: rgba(255, 255, 255, 0.35); text-align: center; }
.nick-field input:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.18);
}

/* ============ 幕三：信封 ============ */
.envelope-wrap {
  text-align: center;
  animation: rise 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.env-hint {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: clamp(14px, 1.8vw, 18px);
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 44px;
  letter-spacing: 0.06em;
}

.envelope {
  position: relative;
  width: clamp(280px, 70vw, 400px);
  height: clamp(190px, 47vw, 270px);
  margin: 0 auto;
  perspective: 1200px;
  animation: envFloat 4s ease-in-out infinite;
}
@keyframes envFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}
.envelope::before {
  content: '';
  position: absolute;
  inset: -30px;
  background: radial-gradient(ellipse at center, rgba(212, 175, 55, 0.28) 0%, transparent 65%);
  z-index: -1;
  pointer-events: none;
  animation: envGlow 3s ease-in-out infinite alternate;
}
@keyframes envGlow {
  from { opacity: 0.6; }
  to   { opacity: 1; }
}

/* 信封主体 */
.env-body {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #E8D9A8 0%, #D4AF37 45%, #B8902A 100%);
  border-radius: 8px;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.env-body::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
}

/* 信纸（藏在信封里，开信封时上浮） */
.env-letter {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 12%;
  bottom: 12%;
  background: linear-gradient(180deg, #FFFBF2, #FFFFFF);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transform: translateY(0);
  opacity: 0;
  transition: transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 0.2s, opacity 0.5s ease 0.3s;
}
.env-letter::after {
  content: 'TRAE · TOP 2000';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: clamp(14px, 2.4vw, 20px);
  letter-spacing: 0.25em;
  color: var(--gold-deep);
  padding-left: 0.25em;
}
.envelope.opened .env-letter {
  transform: translateY(-70%);
  opacity: 1;
}

/* 信封翻盖（顶部三角，开信时向上翻开） */
.env-flap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 52%;
  background: linear-gradient(160deg, #F0E0B0 0%, #D4AF37 60%, #B8902A 100%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transform: rotateX(0deg);
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 3;
}
.envelope.opened .env-flap { transform: rotateX(180deg); }

/* 火漆印章 */
.env-seal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(72px, 19vw, 96px);
  height: clamp(72px, 19vw, 96px);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: radial-gradient(circle at 32% 30%, var(--violet) 0%, var(--grape) 65%, #5B21B6 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 4;
  box-shadow:
    0 0 0 3px var(--gold),
    0 0 0 5px rgba(212, 175, 55, 0.3),
    0 12px 28px rgba(124, 58, 237, 0.6);
  animation: sealPulse 2.4s ease-in-out infinite;
  transition: transform 0.4s ease, opacity 0.4s ease;
}
.env-seal:hover { transform: translate(-50%, -50%) scale(1.08); }
.env-seal:active { transform: translate(-50%, -50%) scale(0.96); }
.envelope.opened .env-seal {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.4) rotate(45deg);
  pointer-events: none;
}

.env-seal .seal-ring {
  position: absolute;
  inset: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.6);
  border-radius: 50%;
}
.env-seal .seal-text {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: clamp(15px, 4vw, 20px);
  letter-spacing: 0.18em;
  padding-left: 0.18em;
}

@keyframes sealPulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--gold), 0 0 0 5px rgba(212,175,55,0.3), 0 12px 28px rgba(124,58,237,0.6); }
  50%      { box-shadow: 0 0 0 3px var(--gold), 0 0 0 10px rgba(212,175,55,0.12), 0 12px 28px rgba(124,58,237,0.6); }
}

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

/* ============ 幕四：证书 ============ */
.scene-cert { color: var(--ink); }

.stage {
  width: 100%;
  max-width: 1100px;
  /* 配合 .scene-cert 的 flex-start：有剩余空间时垂直居中，溢出时贴顶可滚动 */
  margin: auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding: 36px 0;
}

.certificate {
  position: relative;
  width: 100%;
  aspect-ratio: 1.414 / 1;
  background: radial-gradient(ellipse 90% 55% at 50% 0%, #FFFBF2 0%, #ffffff 70%);
  box-shadow: 0 30px 60px -20px rgba(124, 58, 237, 0.28), 0 18px 36px -18px rgba(26, 26, 46, 0.22);
  border-radius: 4px;
  overflow: hidden;
}

.cert-watermark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: clamp(120px, 24vw, 300px);
  color: rgba(124, 58, 237, 0.045);
  letter-spacing: 0.08em;
  padding-left: 0.08em;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.cert-border { position: absolute; inset: 18px; border: 2px solid var(--gold); border-radius: 2px; z-index: 1; }
.cert-inner {
  position: absolute; inset: 10px; border: 1px solid var(--gold-light);
  display: flex; flex-direction: column; padding: 3.2% 6%; text-align: center; z-index: 1;
}

.corner { position: absolute; width: 56px; height: 56px; border: 2px solid var(--grape); z-index: 3; }
.corner.tl { top: 18px; left: 18px; border-right: none; border-bottom: none; }
.corner.tr { top: 18px; right: 18px; border-left: none; border-bottom: none; }
.corner.bl { bottom: 18px; left: 18px; border-right: none; border-top: none; }
.corner.br { bottom: 18px; right: 18px; border-left: none; border-top: none; }

.cert-head { margin-top: 1.2%; }
.brand {
  font-family: 'Cormorant Garamond', serif; font-weight: 700;
  font-size: clamp(18px, 2.2vw, 28px); letter-spacing: 0.45em;
  color: var(--grape); padding-left: 0.45em;
}
.cert-eyebrow {
  font-size: clamp(10px, 1vw, 13px); letter-spacing: 0.3em;
  color: var(--ink-soft); margin-top: 8px; text-transform: uppercase;
}
.title-wrap { display: flex; align-items: center; justify-content: center; gap: clamp(10px, 1.6vw, 22px); margin-top: 12px; }
.flourish { position: relative; height: 1px; width: clamp(40px, 7vw, 90px); background: linear-gradient(90deg, transparent, var(--gold)); }
.flourish.right { background: linear-gradient(90deg, var(--gold), transparent); }
.flourish.left::after, .flourish.right::after {
  content: ''; position: absolute; top: 50%; width: 7px; height: 7px;
  background: var(--gold); transform: translateY(-50%) rotate(45deg);
}
.flourish.left::after { right: -2px; }
.flourish.right::after { left: -2px; }

.cert-title {
  font-family: 'Noto Serif SC', serif; font-weight: 900;
  font-size: clamp(32px, 4.8vw, 58px); letter-spacing: 0.3em;
  color: var(--ink); padding-left: 0.3em; line-height: 1.1;
}
.cert-sub {
  font-family: 'Cormorant Garamond', serif; font-style: italic;
  font-size: clamp(13px, 1.5vw, 18px); color: var(--gold-deep);
  margin-top: 6px; letter-spacing: 0.12em;
}

.cert-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; margin: 1.4% 0; }
.line { font-family: 'Noto Serif SC', serif; font-size: clamp(13px, 1.45vw, 17px); color: var(--ink); line-height: 1.8; }
.line strong { color: var(--grape); font-weight: 700; }

.name-row { position: relative; padding: 4px 24px; margin: 6px 0 2px; display: flex; flex-direction: column; align-items: center; }
.name {
  font-family: 'Great Vibes', 'Noto Serif SC', cursive;
  font-size: clamp(36px, 5.6vw, 66px); color: var(--grape);
  font-weight: 600; letter-spacing: 0.02em; line-height: 1.2;
  min-width: 180px; text-align: center; padding: 0 8px;
}
.name-underline { display: block; width: min(320px, 70%); height: 10px; margin-top: 2px; position: relative; }
.name-underline::before {
  content: ''; position: absolute; left: 0; right: 0; top: 5px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold) 18%, var(--gold) 82%, transparent);
}
.name-underline::after {
  content: ''; position: absolute; left: 50%; top: 1px; width: 8px; height: 8px;
  background: var(--gold); transform: translateX(-50%) rotate(45deg);
}

.rank-row { margin: 4px 0 2px; }
.rank {
  display: inline-block; font-family: 'Cormorant Garamond', serif; font-weight: 700;
  font-size: clamp(26px, 3.6vw, 46px); color: var(--ink);
  background: linear-gradient(135deg, var(--gold-deep) 0%, var(--gold) 45%, #F0D060 55%, var(--gold-deep) 100%);
  padding: 6px clamp(22px, 3vw, 34px); border-radius: 6px; letter-spacing: 0.18em;
  padding-left: calc(clamp(22px, 3vw, 34px) + 0.18em);
  box-shadow: 0 8px 18px -8px rgba(184,144,42,0.7), inset 0 1px 0 rgba(255,255,255,0.45), inset 0 -1px 0 rgba(0,0,0,0.08);
  text-shadow: 0 1px 0 rgba(255,255,255,0.3);
}

.cert-foot { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 24px; margin-top: 1.2%; }
.sign-block { display: flex; flex-direction: column; gap: 8px; }
.sign-block:first-child { align-items: flex-start; }
.sign-block:last-child { align-items: flex-end; }
.sign-line { width: 150px; height: 1px; background: var(--ink); }
.sign-block span { font-family: 'Cormorant Garamond', serif; font-size: clamp(11px, 1.1vw, 14px); color: var(--ink-soft); letter-spacing: 0.1em; }

.seal-static {
  width: 88px; height: 88px; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, var(--violet) 0%, var(--grape) 72%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; position: relative;
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px var(--gold), 0 8px 22px rgba(124,58,237,0.45);
}
.seal-static .seal-ring { position: absolute; inset: 8px; border: 1px dashed rgba(255,255,255,0.55); border-radius: 50%; }
.seal-static .seal-mono { font-family: 'Cormorant Garamond', serif; font-weight: 700; font-size: 17px; letter-spacing: 0.18em; padding-left: 0.18em; }
.seal-static .seal-text { font-size: 6.5px; letter-spacing: 0.22em; margin-top: 2px; opacity: 0.9; padding-left: 0.22em; }

.cert-no {
  font-family: 'Cormorant Garamond', serif; font-size: clamp(10px, 1vw, 12px);
  color: var(--ink-soft); letter-spacing: 0.18em; text-align: center;
  padding-left: 0.18em; margin-top: 10px; opacity: 0.75;
}

/* 证书揭晓动画 */
.scene-cert.active .certificate {
  animation: certReveal 1s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes certReveal {
  from { opacity: 0; transform: translateY(40px) scale(0.92); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============ 控制面板 ============ */
.controls {
  width: 100%; max-width: 640px; background: var(--paper);
  border-radius: 16px; padding: 26px 28px;
  box-shadow: 0 12px 32px -12px rgba(26, 26, 46, 0.16);
  border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 16px;
}
.owner-line {
  text-align: center; font-size: 14px; color: var(--ink-soft);
  font-family: 'Noto Serif SC', serif;
}
.owner-line strong { color: var(--grape); font-weight: 700; }

.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.btn {
  font-family: inherit; font-size: 14px; font-weight: 600;
  padding: 13px 14px; border: none; border-radius: 10px;
  cursor: pointer; color: #fff; letter-spacing: 0.04em;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-png { background: var(--grape); }
.btn-png:hover { box-shadow: 0 8px 18px -6px rgba(124, 58, 237, 0.6); }
.btn-jpg { background: var(--gold-deep); }
.btn-jpg:hover { box-shadow: 0 8px 18px -6px rgba(184, 144, 42, 0.6); }
.btn-pdf { background: var(--ink); }
.btn-pdf:hover { box-shadow: 0 8px 18px -6px rgba(26, 26, 46, 0.6); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-restart {
  font-family: inherit; font-size: 13px; color: var(--ink-soft);
  background: transparent; border: none; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
  align-self: center; padding: 4px 8px;
}
.btn-restart:hover { color: var(--grape); }

.hint { font-size: 13px; color: var(--grape); text-align: center; min-height: 18px; font-weight: 500; }
.hint.error { color: #dc2626; }

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  .certificate { aspect-ratio: 1.3 / 1; }
}

@media (max-width: 640px) {
  .scene { padding: 24px 16px; }
  .welcome-title { letter-spacing: 0.02em; }
  .certificate { aspect-ratio: auto; min-height: 540px; }
  .cert-border { inset: 12px; }
  .cert-inner { inset: 8px; padding: 26px 18px; }
  .corner { width: 34px; height: 34px; }
  .corner.tl, .corner.tr { top: 12px; }
  .corner.bl, .corner.br { bottom: 12px; }
  .corner.tl, .corner.bl { left: 12px; }
  .corner.tr, .corner.br { right: 12px; }
  .cert-watermark { font-size: 120px; }
  .cert-title { font-size: 30px; letter-spacing: 0.24em; padding-left: 0.24em; }
  .name { font-size: 44px; min-width: 0; }
  .rank { font-size: 30px; padding: 6px 22px; padding-left: calc(22px + 0.18em); }
  .line { font-size: 15px; }
  .cert-foot { grid-template-columns: 1fr; gap: 16px; margin-top: 18px; }
  .sign-block:first-child, .sign-block:last-child { align-items: center; }
  .sign-line { width: 70%; max-width: 220px; }
  .actions { grid-template-columns: 1fr; gap: 8px; }
  .btn { padding: 14px; font-size: 15px; }
  .controls { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .welcome, .nick, .envelope-wrap, .envelope, .welcome-title { animation: none; }
  .envelope::before { animation: none; }
  .scene-cert.active .certificate { animation: none; }
  .env-seal { animation: none; }
  .btn-cta, .btn { transition: none; }
}

/* ============ 免责声明 ============ */
.disclaimer {
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
  letter-spacing: 0.02em;
  max-width: 640px;
  margin: 0 auto;
}
/* 前 3 幕深色背景：浅色文字 */
.disclaimer-light {
  position: absolute;
  bottom: 20px;
  left: 0;
  right: 0;
  padding: 0 20px;
  color: rgba(255, 255, 255, 0.55);
}
/* 第 4 幕浅色背景：深色文字，跟在面板里 */
.disclaimer-dark {
  color: var(--ink-soft);
  margin-top: 4px;
  padding: 8px 4px 0;
  border-top: 1px solid var(--line);
}
.disclaimer .agree-link {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.disclaimer-dark .agree-link { color: var(--grape); }
.disclaimer .agree-link:hover { filter: brightness(1.15); }

@media (max-width: 640px) {
  .disclaimer { font-size: 10px; }
  .disclaimer-light { bottom: 12px; }
}

/* ============ 用户协议弹窗 ============ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.open { display: flex; }

.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(11, 8, 32, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.25s ease;
}

.modal-box {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  background: var(--paper);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.5);
  animation: modalIn 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.modal-head h3 {
  font-family: 'Noto Serif SC', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.06em;
}
.modal-close {
  font-size: 26px;
  line-height: 1;
  color: var(--ink-soft);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.2s ease, transform 0.2s ease;
}
.modal-close:hover { color: var(--grape); transform: rotate(90deg); }

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  font-family: 'Noto Serif SC', serif;
  font-size: 13.5px;
  line-height: 1.85;
  color: var(--ink-soft);
}
.modal-body h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin: 16px 0 6px;
}
.modal-body h4:first-of-type { margin-top: 8px; }
.modal-body p { margin-bottom: 6px; }
.modal-body strong { color: var(--grape); font-weight: 700; }
.modal-updated {
  font-size: 12px;
  color: #9a9ab0;
  margin-bottom: 4px;
}
.modal-contact {
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--bg-glow);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  text-align: center;
}
.modal-ok {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.1em;
  padding: 11px 32px;
  color: #fff;
  background: var(--grape);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.modal-ok:hover { transform: translateY(-2px); box-shadow: 0 8px 18px -6px rgba(124, 58, 237, 0.6); }

@media (max-width: 640px) {
  .modal-box { max-height: 88vh; border-radius: 14px; }
  .modal-body { font-size: 13px; padding: 16px 18px; }
  .modal-head, .modal-foot { padding: 14px 18px; }
}
