:root {
  --night: #070c22;
  --gold: #f2cf8b;
  --gold-2: #ffe9b8;
  --red: #c43530;
  --cream: #fdf7e9;
  --cream-2: #f5ead3;
  --ink: #32261a;
  --ink-soft: #7a6a54;
  --green: #1c4733;
  --hand: "Hannotate SC", "Xingkai SC", "HanziPen SC", "Songti SC", "STSong", serif;
  --serif: "Songti SC", "Noto Serif SC", "STSong", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--sans);
  color: var(--cream);
  background:
    radial-gradient(110% 70% at 50% -10%, #1d3f70 0%, transparent 58%),
    radial-gradient(54% 40% at 8% 92%, rgba(26, 90, 60, 0.5) 0%, transparent 68%),
    radial-gradient(52% 36% at 94% 2%, rgba(140, 42, 48, 0.3) 0%, transparent 64%),
    linear-gradient(180deg, var(--night) 0%, #0a1430 46%, #051012 100%);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(120% 100% at 50% 0%, transparent 45%, rgba(3, 6, 18, 0.7) 100%);
  z-index: 1;
}

/* 星空 */
.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.sky::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.6px 1.6px at 12% 8%, rgba(255,255,255,0.85), transparent),
    radial-gradient(1.2px 1.2px at 28% 18%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1.8px 1.8px at 46% 6%, rgba(255,255,255,0.8), transparent),
    radial-gradient(1.2px 1.2px at 62% 14%, rgba(255,255,255,0.55), transparent),
    radial-gradient(1.6px 1.6px at 78% 4%, rgba(255,255,255,0.75), transparent),
    radial-gradient(1.2px 1.2px at 90% 20%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1.4px 1.4px at 38% 28%, rgba(255,255,255,0.45), transparent),
    radial-gradient(1.4px 1.4px at 70% 30%, rgba(255,255,255,0.4), transparent);
  animation: shimmer 6s ease-in-out infinite alternate;
}
@keyframes shimmer { from { opacity: 0.5; } to { opacity: 1; } }

.sky i {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  mix-blend-mode: screen;
}
.sky i:nth-child(1) {
  width: 55vw; height: 34vh; left: -6%; top: 4%;
  background: radial-gradient(circle, rgba(88, 214, 184, 0.4), transparent 70%);
}
.sky i:nth-child(2) {
  width: 50vw; height: 30vh; right: -8%; top: 0;
  background: radial-gradient(circle, rgba(122, 152, 255, 0.42), transparent 70%);
}

.ground { position: fixed; left: 0; right: 0; bottom: 0; height: 210px; z-index: 0; pointer-events: none; opacity: 0.95; }
.trees { position: absolute; left: 0; right: 0; bottom: 0; height: 200px; }
/* 树本身是共用 SVG（/scenery.js），样式在 festive.css 的 .fir */

/* ---------- 布局 ---------- */
.wrap {
  position: relative;
  z-index: 2;
  width: min(620px, 100%);
  margin: 0 auto;
  padding: max(34px, env(safe-area-inset-top)) 20px 150px;
}

.head { text-align: center; margin-bottom: 26px; }
.eyebrow {
  display: inline-block;
  margin: 0 0 16px;
  padding: 6px 14px;
  border: 1px solid rgba(242, 207, 139, 0.32);
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--gold);
  background: rgba(242, 207, 139, 0.05);
}
.head h1 {
  margin: 0 0 14px;
  font-family: var(--hand);
  font-size: clamp(30px, 7vw, 42px);
  font-weight: 500;
  line-height: 1.35;
  color: var(--gold-2);
  text-shadow: 0 0 26px rgba(242, 207, 139, 0.3);
}
.head h1 em {
  font-style: normal;
  position: relative;
  color: #fff;
}
.head h1 em::after {
  content: "";
  position: absolute;
  left: -3px; right: -3px; bottom: -1px;
  height: 8px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(196,53,48,0), #c43530 14%, #e2604f 86%, rgba(196,53,48,0));
  opacity: 0.85;
  z-index: -1;
}
.head h1 { position: relative; z-index: 0; }
.lead {
  margin: 0 auto;
  max-width: 470px;
  font-size: 13.5px;
  line-height: 1.9;
  color: rgba(253, 247, 233, 0.62);
}

/* ---------- 卡片 ---------- */
.card {
  position: relative;
  margin-bottom: 18px;
  padding: 28px 26px 22px;
  border: 1px solid rgba(196, 53, 48, 0.13);
  border-radius: 18px;
  color: var(--ink);
  background:
    repeating-linear-gradient(180deg, transparent 0 33px, rgba(50, 38, 26, 0.055) 33px 34px),
    radial-gradient(140% 120% at 20% 0%, #fffdf6 0%, var(--cream) 45%, var(--cream-2) 100%);
  box-shadow:
    0 26px 50px -26px rgba(0, 0, 0, 0.8),
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 0 90px -34px rgba(242, 207, 139, 0.4);
  animation: cardIn 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
.card::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px dashed rgba(196, 53, 48, 0.18);
  border-radius: 12px;
  pointer-events: none;
}

.card__title {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #5c2a22;
}

.label {
  display: block;
  margin: 18px 0 8px;
  font-family: var(--hand);
  font-size: 15px;
  color: #6d4a33;
}

#familyName, #recoverInput {
  width: 100%;
  padding: 13px 15px;
  border: 1.5px dashed rgba(109, 74, 51, 0.32);
  border-radius: 10px;
  font-family: var(--hand);
  font-size: 18px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
  -webkit-appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
#recoverInput {
  font-family: var(--sans);
  font-size: 17px;
  letter-spacing: 0.18em;
  text-align: center;
  text-transform: uppercase;
}
#familyName:focus, #recoverInput:focus {
  outline: none;
  border-color: rgba(196, 53, 48, 0.55);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 8px 20px -14px rgba(196, 53, 48, 0.6);
}
#familyName::placeholder, #recoverInput::placeholder { color: rgba(122, 106, 84, 0.5); font-size: 15px; }

.tip { margin: 9px 0 0; font-size: 11.5px; line-height: 1.7; color: var(--ink-soft); }

.btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 20px;
  padding: 15px 18px;
  border: 1px solid rgba(255, 224, 168, 0.55);
  border-radius: 999px;
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: 0.12em;
  color: #fff6e4;
  background: linear-gradient(180deg, #d95040 0%, #bd342b 48%, #94211c 100%);
  box-shadow:
    0 14px 24px -14px rgba(110, 18, 14, 0.85),
    0 1px 0 rgba(255, 255, 255, 0.24) inset,
    0 0 0 4px rgba(196, 53, 48, 0.07);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.18s, box-shadow 0.25s, filter 0.2s;
}
.btn::before {
  content: "";
  position: absolute;
  top: -40%;
  left: -60%;
  width: 38%;
  height: 180%;
  background: linear-gradient(90deg, transparent, rgba(255, 246, 225, 0.32), transparent);
  transform: rotate(18deg);
  transition: left 0.7s ease;
}
.btn:hover::before { left: 122%; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 18px 28px -16px rgba(110, 18, 14, 0.95), 0 0 0 5px rgba(242, 207, 139, 0.1); }
.btn:active { transform: translateY(0); }
.btn[disabled] { filter: saturate(0.6) brightness(0.9); cursor: progress; transform: none; }

.btn--ghost {
  margin-top: 0;
  color: #5c2a22;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(109, 74, 51, 0.28);
  box-shadow: none;
  font-family: var(--hand);
  font-size: 15px;
}
.btn--ghost::before { display: none; }

.error { min-height: 18px; margin: 10px 0 0; font-size: 12.5px; color: #a8402f; text-align: center; }

.mini {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed rgba(109, 74, 51, 0.2);
  font-size: 12px;
  color: var(--ink-soft);
}
.mini a { color: #a8402f; text-decoration: none; border-bottom: 1px dashed rgba(168, 64, 47, 0.4); }
.mini a:hover { border-bottom-style: solid; }

/* ---------- 结果 ---------- */
.result__head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.result__seal {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border-radius: 50%;
  font-size: 24px;
  border: 1px solid rgba(255, 236, 196, 0.55);
  background: radial-gradient(circle at 35% 28%, #e2604f, var(--red) 62%, #8f1a17);
  box-shadow: 0 10px 20px -12px rgba(150, 30, 25, 0.9), 0 0 0 4px rgba(196, 53, 48, 0.08);
}
.result__family { margin: 2px 0 0; font-family: var(--hand); font-size: 14px; color: var(--ink-soft); }
.result__lead { margin: 14px 0 16px; font-family: var(--hand); font-size: 15.5px; color: #5d4b38; }

.links { display: flex; flex-direction: column; gap: 10px; }
.link {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  padding: 11px 12px;
  border: 1px solid rgba(109, 74, 51, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
}
.link__label { grid-column: 1 / -1; font-size: 10.5px; letter-spacing: 0.12em; color: var(--ink-soft); }
.link__url {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  color: #42301f;
  word-break: break-all;
  user-select: all;
  -webkit-user-select: all;
  align-self: center;
}
.link--code .link__url {
  font-size: 16px;
  letter-spacing: 0.16em;
  font-weight: 600;
  color: #8f1a17;
}

.copy {
  align-self: center;
  padding: 7px 13px;
  border: 1px solid rgba(196, 53, 48, 0.32);
  border-radius: 999px;
  font-size: 11.5px;
  color: #a8402f;
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.copy:hover { background: rgba(196, 53, 48, 0.1); }
.copy.is-done { color: #1c4733; border-color: rgba(28, 71, 51, 0.4); }

.result__actions { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.result__actions .btn { margin-top: 0; flex: 1 1 auto; }
.plain {
  flex: 0 0 auto;
  font-size: 12.5px;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px dashed rgba(122, 106, 84, 0.5);
}
.plain:hover { color: #a8402f; border-color: rgba(168, 64, 47, 0.6); }

.notice {
  margin: 18px 0 0;
  padding: 14px 16px 14px 30px;
  border-radius: 10px;
  background: rgba(196, 53, 48, 0.06);
  font-size: 11.5px;
  line-height: 1.9;
  color: #7a5a45;
}
.notice li::marker { color: rgba(196, 53, 48, 0.6); }

/* ---------- 步骤 & 页脚 ---------- */
.steps {
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  display: grid;
  gap: 10px;
}
.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 30px;
  font-size: 12.5px;
  line-height: 1.7;
  color: rgba(253, 247, 233, 0.55);
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 1px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 10.5px;
  font-weight: 600;
  color: #4a2418;
  background: radial-gradient(circle at 34% 28%, #ffeec4, #f2cf8b 55%, #cf9b52);
  border: 1px solid rgba(255, 240, 205, 0.55);
  box-shadow: 0 4px 10px -6px rgba(0, 0, 0, 0.8), 0 0 12px -3px rgba(242, 207, 139, 0.45);
}
.steps b { color: rgba(253, 247, 233, 0.85); font-weight: 600; }

.foot {
  margin: 30px 0 0;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: rgba(253, 247, 233, 0.35);
}
.foot a { color: rgba(242, 207, 139, 0.6); text-decoration: none; }
.foot a:hover { text-decoration: underline; }

@media (max-width: 480px) {
  .wrap { padding-left: 14px; padding-right: 14px; }
  .card { padding: 22px 18px 18px; border-radius: 16px; }
  .link { grid-template-columns: 1fr auto; }
  .result__actions { flex-direction: column; align-items: stretch; gap: 12px; }
  .plain { text-align: center; border-bottom: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
