:root {
  --xuan: #102925;
  --xuan-card: #173530;
  --xuan-surface: #21433d;
  --gold: #d2b675;
  --gold-light: #f4e7c7;
  --paper: #f1eadb;
  --paper-muted: #b8c5bd;
  --vermillion: #bd4b43;
  --vermillion-light: #d05c53;
  --line: rgba(210, 182, 117, 0.2);
  --shadow: 0 18px 50px rgba(4, 17, 15, 0.3);
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; scroll-padding-top: 72px; }
body { min-height: 100%; margin: 0; color: var(--paper); background: var(--xuan); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.page-bg, .pattern-bg, .vignette, .fireflies {
  position: fixed; inset: 0; pointer-events: none;
}
.page-bg { z-index: 0; background: linear-gradient(155deg, #0d2421 0%, #173530 48%, #0b211e 100%); }
.pattern-bg {
  z-index: 0;
  opacity: .34;
  background:
    radial-gradient(circle at 50% 18%, rgba(210,182,117,.16) 0 1px, transparent 2px),
    radial-gradient(circle at 20% 62%, rgba(210,182,117,.1) 0 1px, transparent 2px),
    linear-gradient(120deg, transparent 48%, rgba(210,182,117,.045) 49%, rgba(210,182,117,.045) 51%, transparent 52%);
  background-size: 140px 140px, 190px 190px, 260px 260px;
}
.pattern-bg::before,
.pattern-bg::after {
  position: absolute;
  left: 50%;
  content: "";
  border: 1px solid rgba(210,182,117,.12);
  border-radius: 50%;
  transform: translateX(-50%);
}
.pattern-bg::before { top: 11vh; width: min(72vw, 720px); aspect-ratio: 1; }
.pattern-bg::after { top: calc(11vh + 70px); width: min(58vw, 580px); aspect-ratio: 1; }
.vignette { z-index: 0; background: radial-gradient(ellipse at 50% 32%, rgba(244,231,199,.05), transparent 42%, rgba(3,15,13,.68) 100%); }
.fireflies { z-index: 0; }
.fireflies span { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: rgba(202,166,101,.45); animation: glow-rise 5s ease-in-out infinite both; }

.site-header { position: fixed; inset: 0 0 auto; z-index: 50; height: 60px; transition: background .2s ease; }
.site-header.is-scrolled { background: rgba(16,41,37,.92); backdrop-filter: blur(14px); }
.header-inner { display: flex; width: min(1160px, 100%); height: 100%; align-items: center; justify-content: space-between; gap: 20px; margin: auto; padding: 0 18px; }
.brand, .desktop-nav { display: flex; align-items: center; }
.brand { gap: 10px; }
.lamp-logo { color: var(--gold); filter: drop-shadow(0 0 8px rgba(210,182,117,.28)); }
.lamp-logo .logo-flame { fill: var(--gold); stroke: var(--gold-light); stroke-width: 1.2; }
.lamp-logo .logo-bowl { fill: none; }
.lamp-logo.small { width: 34px; height: 34px; }
.brand-text, .hero h1 { font-family: "STKaiti", "KaiTi", "华文楷体", serif; color: var(--gold-light); }
.brand-text { font-size: 23px; letter-spacing: .12em; }
.desktop-nav { gap: 28px; }
.desktop-nav a { color: var(--paper-muted); font-size: 14px; }
.desktop-nav a:hover { color: var(--gold-light); }
.record-button, .text-button { border: 1px solid var(--line); color: var(--gold); background: transparent; }
.record-button { border-radius: 999px; padding: 7px 13px; }
.record-button span { display: inline-grid; min-width: 20px; height: 20px; place-items: center; margin-left: 4px; border-radius: 50%; background: rgba(202,166,101,.14); font-size: 12px; }
.gold-divider { height: 1px; background: linear-gradient(90deg, transparent, rgba(202,166,101,.55), transparent); opacity: 0; transition: opacity .2s; }
.site-header.is-scrolled .gold-divider { opacity: 1; }

.page { position: relative; z-index: 10; padding: 60px 20px 90px; }
.hero { display: flex; min-height: calc(100svh - 60px); flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.hero-symbol { position: relative; width: 92px; height: 92px; margin-bottom: 20px; border: 1px solid rgba(202,166,101,.3); border-radius: 50%; background: rgba(202,166,101,.06); box-shadow: 0 0 50px rgba(202,166,101,.16); }
.hero-symbol > span { position: absolute; inset: 0; border: 1px solid rgba(202,166,101,.55); border-radius: inherit; animation: ring-expand 3s ease-out infinite; }
.hero-symbol > span:last-child { animation-delay: 1.5s; }
.lamp-flame { position: absolute; top: 19px; left: 37px; width: 18px; height: 30px; border-radius: 60% 40% 60% 40%; background: linear-gradient(#fff1b3, #e8a32d 65%, #b83b36); transform: rotate(45deg); box-shadow: 0 0 18px #e8a32d; animation: flame 1.8s ease-in-out infinite alternate; }
.lamp-base { position: absolute; left: 27px; bottom: 20px; width: 38px; height: 13px; border: 2px solid var(--gold); border-radius: 3px 3px 13px 13px; }
.eyebrow { margin: 0 0 12px; color: var(--gold); font-size: 12px; font-weight: 700; letter-spacing: .22em; }
.hero h1 { margin: 0; font-size: clamp(54px, 9vw, 78px); font-weight: 500; letter-spacing: .16em; text-shadow: 0 2px 16px rgba(210,182,117,.18); }
.hero-copy { margin: 18px 0 0; color: rgba(227,214,189,.86); font-family: "STKaiti", serif; font-size: clamp(18px, 3vw, 23px); line-height: 1.9; }
.hero-actions { display: flex; gap: 12px; margin-top: 30px; }
.btn { display: inline-flex; min-width: 176px; min-height: 48px; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 8px; padding: 0 24px; color: #fff; font-weight: 700; transition: transform .18s, background .18s, border-color .18s; }
.btn:hover { transform: translateY(-2px); }
.btn.red { background: var(--vermillion); box-shadow: 0 10px 28px rgba(184,59,54,.22); }
.btn.red:hover { background: var(--vermillion-light); }
.btn.gold { background: var(--gold); color: #21180d; }
.btn.outline { border-color: rgba(202,166,101,.48); color: var(--gold-light); background: rgba(24,19,15,.35); }
.btn.full { width: 100%; }
.trust-row { display: flex; gap: 20px; margin-top: 28px; color: rgba(185,170,143,.72); font-size: 13px; }
.trust-row span::before { content: "·"; margin-right: 7px; color: var(--gold); }

.section { width: min(1120px, 100%); margin: auto; padding: 82px 0; }
.intro { padding-top: 55px; }
.section-heading { max-width: 650px; margin: 0 auto 34px; text-align: center; }
.section h2 { margin: 0; font-family: "STKaiti", "KaiTi", serif; font-size: clamp(30px, 4vw, 44px); font-weight: 400; letter-spacing: .04em; color: var(--gold-light); }
.section-heading > p:last-child, .tool-copy > p { color: var(--paper-muted); line-height: 1.85; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.feature-card { display: flex; align-items: center; gap: 16px; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: rgba(23,53,48,.82); box-shadow: var(--shadow); }
.feature-card:hover { border-color: rgba(202,166,101,.46); }
.feature-icon { display: grid; width: 48px; height: 48px; flex: 0 0 auto; place-items: center; border: 1px solid rgba(202,166,101,.3); border-radius: 50%; color: var(--gold); font-family: "STKaiti", serif; font-size: 22px; }
.feature-card strong, .feature-card small { display: block; }
.feature-card strong { margin-bottom: 5px; font-size: 18px; }
.feature-card small { color: var(--paper-muted); line-height: 1.5; }

.tool-section { display: grid; grid-template-columns: .85fr 1.15fr; gap: clamp(36px, 7vw, 90px); align-items: center; border-top: 1px solid rgba(202,166,101,.12); }
.tool-section.reverse { grid-template-columns: 1.15fr .85fr; }
.tool-section.reverse .tool-copy { order: 2; }
.tool-copy h2 { margin-bottom: 20px; }
.tool-copy > p { margin: 0; }
.ritual-note { margin-top: 24px; padding: 14px 16px; border-left: 2px solid var(--gold); color: rgba(227,214,189,.8); background: rgba(202,166,101,.06); font-family: "STKaiti", serif; font-size: 17px; }
.tool-panel { min-width: 0; padding: clamp(24px, 4vw, 38px); border: 1px solid var(--line); border-radius: 8px; background: rgba(23,53,48,.94); box-shadow: var(--shadow); backdrop-filter: blur(10px); }
form { display: grid; gap: 18px; }
label { display: grid; gap: 8px; color: rgba(227,214,189,.88); font-size: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
input, select, textarea { width: 100%; border: 1px solid rgba(210,182,117,.22); border-radius: 6px; outline: 0; padding: 12px 13px; color: var(--paper); background: rgba(9,32,28,.78); }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(202,166,101,.09); }
textarea { resize: vertical; }
.choice-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.choice { display: block; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span { display: grid; min-height: 42px; place-items: center; border: 1px solid rgba(210,182,117,.2); border-radius: 6px; color: var(--paper-muted); background: rgba(9,32,28,.55); cursor: pointer; }
.choice input:checked + span { border-color: var(--gold); color: var(--gold-light); background: rgba(202,166,101,.12); }
.form-error { min-height: 18px; margin: -5px 0 0; color: #e9877f; font-size: 13px; }

.result-card { border: 1px solid rgba(210,182,117,.35); border-radius: 8px; padding: 28px; background: linear-gradient(145deg, rgba(210,182,117,.1), rgba(9,32,28,.82)); animation: result-in .45s ease-out both; }
.result-card h3 { margin: 0 0 10px; color: var(--gold-light); font-family: "STKaiti", serif; font-size: 30px; font-weight: 400; }
.result-card p { color: var(--paper-muted); line-height: 1.8; }
.result-actions { display: flex; gap: 10px; margin-top: 22px; }
.small-button { min-height: 40px; border: 1px solid rgba(202,166,101,.35); border-radius: 6px; padding: 0 15px; color: var(--gold-light); background: transparent; }
.small-button.primary { border-color: var(--vermillion); background: var(--vermillion); color: #fff; }
.lamp-visual { position: relative; width: 90px; height: 112px; margin: 0 auto 18px; }
.lamp-visual .flame { position: absolute; top: 2px; left: 34px; width: 22px; height: 36px; border-radius: 60% 40% 60% 40%; background: linear-gradient(#fff4be, #e4a12f, #b83b36); transform: rotate(45deg); box-shadow: 0 0 24px #e4a12f; }
.lamp-visual .body { position: absolute; inset: 38px 10px 0; border: 1px solid var(--gold); border-radius: 8px 8px 22px 22px; background: rgba(184,59,54,.22); }
.lamp-card { text-align: center; }
.lamp-card blockquote { margin: 16px 0; color: var(--paper); font-family: "STKaiti", serif; font-size: 21px; line-height: 1.7; }

.lottery-idle { display: grid; gap: 22px; }
.fortune-object {
  position: relative;
  width: min(310px, 82vw);
  aspect-ratio: 1;
  margin: -8px auto 0;
  overflow: hidden;
  border: 1px solid rgba(210,182,117,.12);
  border-radius: 10px;
  background: #102925;
}
.object-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(210,182,117,.09), transparent 42%),
    radial-gradient(circle at 24% 22%, rgba(210,182,117,.11) 0 1px, transparent 2px),
    linear-gradient(145deg, #173a34, #0b211e);
  background-size: auto, 90px 90px, auto;
}
.fortune-object img {
  position: absolute;
  inset: 3% 8% 1%;
  z-index: 2;
  display: block;
  width: 84%;
  height: 96%;
  object-fit: contain;
  border-radius: 0;
  filter: drop-shadow(0 18px 22px rgba(0,0,0,.3));
  transform-origin: 50% 78%;
}
.object-shadow {
  position: absolute;
  right: 20%;
  bottom: 4%;
  left: 20%;
  height: 10%;
  z-index: 1;
  border-radius: 50%;
  background: rgba(0,0,0,.35);
  filter: blur(12px);
}
.lottery-panel.is-drawing .fortune-object img {
  animation: human-shake 3s cubic-bezier(.42, 0, .32, 1) both;
}
.lottery-panel.is-drawing .object-shadow {
  animation: shadow-breathe 3s ease-in-out both;
}
.lottery-panel.is-drawing #draw-lottery {
  cursor: wait;
  opacity: .82;
}
.fortune-number { color: var(--gold); font-size: 13px; letter-spacing: .18em; }
.fortune-grade { display: inline-flex; margin-bottom: 13px; border: 1px solid rgba(202,166,101,.35); border-radius: 999px; padding: 4px 10px; color: var(--gold); font-size: 12px; }
.fortune-verse { margin: 18px 0; padding: 18px; border-block: 1px solid rgba(202,166,101,.18); color: var(--paper); font-family: "STKaiti", serif; font-size: 21px; line-height: 1.9; white-space: pre-line; text-align: center; }
.question-label { color: var(--paper-muted); font-size: 13px; }

.element-badge { display: inline-grid; width: 66px; height: 66px; place-items: center; margin-bottom: 14px; border: 1px solid rgba(202,166,101,.42); border-radius: 50%; color: var(--gold-light); font-family: "STKaiti", serif; font-size: 30px; box-shadow: 0 0 25px rgba(202,166,101,.12); }
.keyword-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.keyword-list span { border-radius: 999px; padding: 5px 10px; color: var(--gold-light); background: rgba(202,166,101,.11); font-size: 13px; }
.disclaimer { margin-top: 18px; color: rgba(185,170,143,.65) !important; font-size: 12px; }

.records-section { border-top: 1px solid rgba(202,166,101,.12); }
.records-toolbar { display: flex; justify-content: space-between; align-items: center; max-width: 820px; margin: 0 auto 14px; color: var(--paper-muted); font-size: 13px; }
.text-button { border: 0; padding: 6px; }
.records-list { display: grid; max-width: 820px; gap: 10px; margin: auto; }
.record-item { display: grid; grid-template-columns: 52px 1fr auto; gap: 14px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: rgba(23,53,48,.78); }
.record-type { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 50%; color: var(--gold); background: rgba(202,166,101,.1); font-family: "STKaiti", serif; font-size: 18px; }
.record-item strong, .record-item small { display: block; }
.record-item small { margin-top: 4px; color: var(--paper-muted); }
.record-date { color: rgba(185,170,143,.55); font-size: 12px; white-space: nowrap; }
.empty-state { padding: 38px 20px; border: 1px dashed rgba(202,166,101,.2); border-radius: 8px; color: var(--paper-muted); text-align: center; }

.site-footer { padding: 50px 0 10px; border-top: 1px solid rgba(202,166,101,.12); color: rgba(185,170,143,.62); text-align: center; }
.site-footer strong { color: var(--gold-light); font-family: "STKaiti", "KaiTi", serif; font-size: 26px; letter-spacing: .12em; }
.site-footer p { margin: 10px 0; font-size: 13px; }
.bottom-nav { display: none; }
.toast { position: fixed; right: 20px; bottom: 24px; z-index: 100; max-width: 320px; border: 1px solid rgba(210,182,117,.35); border-radius: 8px; padding: 12px 16px; color: var(--paper); background: rgba(9,32,28,.96); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(12px); transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }

@keyframes glow-rise { 0% { opacity: 0; transform: translateY(20px); } 35% { opacity: 1; } 100% { opacity: 0; transform: translateY(-45px); } }
@keyframes ring-expand { from { opacity: .7; transform: scale(1); } to { opacity: 0; transform: scale(1.75); } }
@keyframes flame { from { transform: rotate(42deg) scale(.96); } to { transform: rotate(48deg) scale(1.06); } }
@keyframes result-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shake { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-3deg); } 75% { transform: rotate(3deg); } }
@keyframes human-shake {
  0% { transform: translate(0, 0) rotate(0deg); }
  6% { transform: translate(-4px, -13px) rotate(-3deg) scale(1.015); }
  12% { transform: translate(5px, -25px) rotate(5deg) scale(1.035); }
  20% { transform: translate(-15px, -32px) rotate(-10deg) scale(1.055); }
  29% { transform: translate(17px, -36px) rotate(11deg) scale(1.065); }
  38% { transform: translate(-18px, -34px) rotate(-12deg) scale(1.06); }
  47% { transform: translate(19px, -38px) rotate(12deg) scale(1.07); }
  56% { transform: translate(-17px, -33px) rotate(-11deg) scale(1.06); }
  65% { transform: translate(15px, -30px) rotate(9deg) scale(1.05); }
  74% { transform: translate(-11px, -24px) rotate(-7deg) scale(1.04); }
  82% { transform: translate(8px, -17px) rotate(5deg) scale(1.025); }
  89% { transform: translate(-5px, -10px) rotate(-3deg) scale(1.015); }
  95% { transform: translate(2px, -4px) rotate(1.5deg) scale(1.005); }
  100% { transform: translate(0, 0) rotate(0deg); }
}
@keyframes shadow-breathe {
  0%,100% { opacity: 1; transform: scaleX(1); filter: blur(12px); }
  18% { opacity: .55; transform: scaleX(.78); filter: blur(15px); }
  50% { opacity: .42; transform: scaleX(.68); filter: blur(17px); }
  82% { opacity: .62; transform: scaleX(.82); filter: blur(14px); }
}

@media (max-width: 900px) {
  .desktop-nav { display: none; }
  .feature-grid { grid-template-columns: 1fr; }
  .tool-section, .tool-section.reverse { grid-template-columns: 1fr; }
  .tool-section.reverse .tool-copy { order: 0; }
}

@media (max-width: 640px) {
  html { scroll-padding-top: 62px; }
  .page { padding-inline: 14px; padding-bottom: 94px; }
  .site-header { height: 56px; }
  .brand-text { font-size: 22px; }
  .record-button { display: none; }
  .hero { min-height: calc(100svh - 56px); }
  .hero-actions { width: 100%; flex-direction: column; padding-inline: 8px; }
  .btn { width: 100%; }
  .trust-row { gap: 10px; font-size: 11px; }
  .section { padding: 62px 0; }
  .field-row { grid-template-columns: 1fr; }
  .choice-grid { grid-template-columns: 1fr 1fr; }
  .tool-panel { padding: 22px 16px; }
  .result-actions { flex-direction: column; }
  .record-item { grid-template-columns: 46px 1fr; }
  .record-date { grid-column: 2; }
  .bottom-nav { position: fixed; inset: auto 0 0; z-index: 60; display: grid; grid-template-columns: repeat(5, 1fr); padding: 7px 3px calc(env(safe-area-inset-bottom) + 6px); border-top: 1px solid rgba(210,182,117,.16); background: rgba(16,41,37,.96); backdrop-filter: blur(14px); }
  .bottom-nav a { display: grid; gap: 3px; place-items: center; color: var(--paper-muted); font-size: 11px; }
  .bottom-nav span { color: var(--gold); font-family: "STKaiti", serif; font-size: 17px; }
  .toast { right: 14px; bottom: 78px; left: 14px; max-width: none; }
}
