:root {
  --void: #040505;
  --ink: #fff7dd;
  --muted: rgba(255, 247, 221, .74);
  --gold: #d4a84b;
  --gold-2: #fff0ad;
  --orange: #ff6b35;
  --danger: #ff2d00;
  --radius: 8px;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--void);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 68% 25%, rgba(72, 117, 179, .14), transparent 32%),
    linear-gradient(135deg, #020407, #07101a 55%, #020304);
  font-family: "Noto Sans SC", system-ui, -apple-system, BlinkMacSystemFont, "Microsoft YaHei", sans-serif;
  overflow-x: hidden;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: .08;
  mix-blend-mode: soft-light;
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 5px 5px;
}

button, input, select, textarea { font: inherit; }

button {
  border: 0;
  cursor: pointer;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease, background .22s ease;
}

button:active { transform: translateY(1px) scale(.99); }
button:disabled { opacity: .62; cursor: wait; }

.view {
  position: relative;
  z-index: 2;
  display: none;
  min-height: 100dvh;
  overflow: hidden;
}

.view.active { display: block; }

.gold-text {
  color: var(--gold-2);
  background: linear-gradient(115deg, #fff7c9 0%, #d6a241 34%, #fff3b1 56%, #8d6421 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 32px rgba(247, 214, 122, .18);
}

.primary-btn,
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  border-radius: 999px;
  padding: 0 30px;
  font-weight: 900;
  font-size: 18px;
  white-space: nowrap;
}

.primary-btn {
  color: #1b1305;
  background:
    linear-gradient(180deg, rgba(255,255,255,.34), transparent 42%),
    linear-gradient(135deg, #fff8b7, #d9a13a 48%, #fff0a8);
  box-shadow: 0 16px 42px rgba(221, 166, 60, .24), inset 0 1px 0 rgba(255,255,255,.62);
}

.primary-btn:hover { box-shadow: 0 18px 52px rgba(255,217,124,.34), inset 0 1px 0 rgba(255,255,255,.72); }

.secondary-btn {
  color: var(--ink);
  background: rgba(2,4,4,.26);
  border: 1px solid rgba(255,236,179,.45);
  box-shadow: inset 0 0 24px rgba(255,236,179,.04);
}

.secondary-btn:hover { border-color: rgba(255,236,179,.78); background: rgba(255,236,179,.08); }

/* 唯一首页定稿 */
.home {
  position: relative;
  width: 100%;
  height: 100svh;
  min-height: 650px;
  padding: 0;
  overflow: hidden;
  isolation: isolate;
  background: #02050b;
}

.generated-hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: url("assets/guanyu-nebula-vortex.png") center / cover no-repeat;
  filter: saturate(1) brightness(.96) contrast(1.03);
  transform: scale(1.015);
  transform-origin: center;
  animation: none;
}

.generated-hero-bg::after {
  content: "";
  position: absolute;
  inset: -8%;
  pointer-events: none;
  mix-blend-mode: screen;
  background:
    radial-gradient(ellipse at 68% 46%, rgba(167,211,255,.16), transparent 32%),
    radial-gradient(ellipse at 25% 72%, rgba(195,164,255,.1), transparent 34%);
  animation: nebulaShimmer 16s ease-in-out infinite;
}

.home::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(1,3,8,.46) 0%, rgba(1,3,8,.24) 28%, rgba(1,3,8,.04) 49%, transparent 62%),
    radial-gradient(circle at 75% 50%, rgba(137,193,255,.08), transparent 35%);
}

.taiji-subject-wrap {
  position: absolute;
  z-index: 2;
  left: 73.5%;
  top: 51%;
  width: min(34vw, 680px);
  aspect-ratio: 1;
  opacity: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
  filter: drop-shadow(0 0 20px rgba(141,196,255,.22)) drop-shadow(0 0 42px rgba(225,239,255,.16));
}

.taiji-subject {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: 50% 50%;
  animation: taijiSpin 120s linear infinite;
  will-change: transform;
}

.taiji-subject-wrap::before,
.taiji-subject-wrap::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
}

.taiji-subject-wrap::before {
  z-index: 1;
  inset: 5.5%;
  border: 1px solid rgba(255,248,220,.72);
  background: transparent;
  box-shadow:
    0 0 7px rgba(255,255,250,.82),
    0 0 20px rgba(255,231,168,.5),
    0 0 44px rgba(210,232,255,.3),
    0 0 78px rgba(151,203,255,.18),
    inset 0 0 18px rgba(255,245,211,.16);
  animation: platinumHalo 7s ease-in-out infinite;
}

.taiji-subject-wrap::after {
  display: none;
}

.brand-block {
  position: absolute;
  z-index: 4;
  inset: 0 auto 0 clamp(28px, 6vw, 110px);
  display: flex;
  width: min(42vw, 680px);
  padding: 5vh 0;
  flex-direction: column;
  justify-content: center;
  text-shadow: 0 8px 34px rgba(0,0,0,.78);
}

.brand-lockup { display: flex; align-items: flex-end; gap: 18px; margin-bottom: clamp(36px, 6vh, 64px); }
.brand-name { font-family: "Noto Serif SC", "Songti SC", serif; font-size: clamp(58px, 7.8vw, 108px); line-height: .9; font-weight: 900; }
.brand-en { margin-bottom: .34em; color: rgba(255,240,179,.92); font-size: clamp(12px, 1vw, 16px); font-weight: 900; line-height: 1.12; letter-spacing: .08em; }
.hero-title { margin: 0; font-family: "Noto Serif SC", "Songti SC", serif; font-size: clamp(44px, 4.7vw, 80px); line-height: 1.05; font-weight: 900; letter-spacing: .03em; }
.hero-copy { margin: clamp(18px, 3vh, 32px) 0 0; max-width: 620px; color: rgba(255,252,234,.96); font-family: "Noto Serif SC", "Songti SC", serif; font-size: clamp(16px, 1.28vw, 20px); line-height: 1.65; font-weight: 800; }
.hero-copy span { display: block; }
.hero-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: clamp(24px, 4vh, 42px); }

@keyframes taijiSpin { to { transform: rotate(360deg); } }
@keyframes platinumHalo { 0%,100% { opacity:.62; transform:scale(.992); } 50% { opacity:1; transform:scale(1.018); } }
@keyframes nebulaShimmer { 0%,100% { opacity:.34; } 50% { opacity:.58; } }
@keyframes blink { 50% { opacity:.35; } }

/* 表单与结果页 */
.shell { position: relative; z-index: 2; min-height: 100dvh; padding: clamp(18px,4vw,46px); display: grid; place-items: center; }
.glass { width: min(100%,680px); border: 1px solid rgba(255,229,151,.22); border-radius: var(--radius); background: linear-gradient(145deg,rgba(255,255,255,.055),transparent 36%), rgba(7,9,9,.78); backdrop-filter: blur(16px); box-shadow: 0 28px 90px rgba(0,0,0,.58), inset 0 1px 0 rgba(255,255,255,.08); }
.panel { padding: clamp(22px,4vw,34px); }
.panel-title { margin: 0; font-family: "Noto Serif SC","Songti SC",serif; font-size: clamp(28px,5vw,42px); line-height: 1.16; font-weight: 900; }
.panel-sub { margin: 12px 0 22px; color: var(--muted); line-height: 1.8; font-size: 15px; }
form { display: grid; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
label { display: grid; gap: 8px; color: rgba(255,246,220,.88); font-size: 13px; }
input, select { width: 100%; min-height: 48px; border: 1px solid rgba(255,229,151,.26); border-radius: var(--radius); padding: 10px 12px; color: var(--ink); background: rgba(0,0,0,.38); outline: none; }
input:focus, select:focus { border-color: rgba(255,238,178,.8); box-shadow: 0 0 0 3px rgba(212,168,75,.14); }
select option { color: var(--ink); background: #10100d; }
.consent { display: flex; align-items: flex-start; gap: 10px; color: rgba(255,246,220,.62); font-size: 12px; line-height: 1.55; }
.consent input { width: 17px; height: 17px; min-height: 17px; margin-top: 2px; accent-color: var(--gold); }
.error { min-height: 20px; color: #ffb199; font-size: 13px; line-height: 1.5; }
.result-head { text-align: center; }
.code-card { margin: 18px 0; padding: 18px; border: 1px solid rgba(255,238,178,.35); border-radius: var(--radius); text-align: center; background: radial-gradient(circle at 50% 0%,rgba(255,229,151,.16),transparent 58%), rgba(255,229,151,.055); }
.code-label { margin: 0 0 8px; color: rgba(255,246,220,.72); font-size: 13px; }
.pickup-code { margin: 0; color: var(--gold-2); font-size: clamp(34px,11vw,58px); font-weight: 900; line-height: 1; word-break: break-word; font-variant-numeric: tabular-nums; }
.timer { margin: 12px 0 0; font-size: 15px; color: var(--gold-2); }
.timer.orange { color: var(--orange); }
.timer.red { color: var(--danger); animation: blink .72s step-end infinite; }
.preview { margin: 16px 0 0; padding: 16px; border: 1px solid rgba(255,246,220,.13); border-radius: var(--radius); color: rgba(255,246,220,.88); background: rgba(0,0,0,.24); line-height: 1.9; font-size: 15px; white-space: pre-wrap; }
.qr-wrap { margin-top: 18px; padding: 16px; text-align: center; border: 1px solid rgba(255,229,151,.2); border-radius: var(--radius); background: rgba(255,255,255,.045); }
.qr-copy { margin: 0 0 12px; color: var(--gold-2); font-size: 16px; font-weight: 800; line-height: 1.5; }
.qr-box { width: 174px; height: 174px; margin: 0 auto; border-radius: var(--radius); border: 1px solid rgba(255,238,178,.36); background: rgba(0,0,0,.28); display: grid; place-items: center; overflow: hidden; color: rgba(255,246,220,.56); font-size: 13px; line-height: 1.6; padding: 16px; }
.qr-box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.qr-box[role="button"] { cursor: zoom-in; touch-action: manipulation; }
.qr-box[role="button"]:focus-visible { outline: 3px solid var(--gold-2); outline-offset: 4px; }
.qr-zoom-hint { margin: 12px 0 0; color: rgba(255,246,220,.72); font-size: 13px; line-height: 1.6; }
.qr-dialog { width: min(calc(100% - 24px), 560px); max-height: calc(100dvh - 24px); border: 1px solid rgba(255,229,151,.5); border-radius: 24px; padding: 0; color: #fff6dc; background: #090d15; box-shadow: 0 28px 100px rgba(0,0,0,.82); }
.qr-dialog::backdrop { background: rgba(0,0,0,.88); backdrop-filter: blur(8px); }
.qr-dialog-inner { position: relative; display: grid; justify-items: center; gap: 14px; padding: 26px 20px 22px; text-align: center; }
.qr-dialog h2 { margin: 0; color: var(--gold-2); font-size: 26px; }
.qr-dialog p { margin: 0; color: rgba(255,246,220,.78); font-size: 16px; line-height: 1.65; }
.qr-dialog img { display: block; width: min(82vw, 460px); height: min(82vw, 460px); max-width: 100%; object-fit: contain; padding: 10px; border-radius: 18px; background: #fff; }
.qr-dialog .secondary-btn { width: min(100%, 320px); min-height: 54px; }
.qr-dialog-close { position: absolute; top: 9px; right: 11px; width: 44px; height: 44px; border: 0; border-radius: 50%; color: #fff6dc; background: rgba(255,255,255,.1); font-size: 30px; line-height: 1; cursor: pointer; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.footnote { margin: 15px 0 0; color: rgba(255,246,220,.52); font-size: 12px; line-height: 1.65; text-align: center; }
.loading-dot { display: inline-block; width: 1.5em; text-align: left; }

/* 体系说明弹窗 */
.system-dialog { width: min(calc(100% - 32px),620px); max-height: min(82vh,720px); border: 1px solid rgba(224,189,105,.42); border-radius: 18px; padding: 0; color: #fff6dc; background: rgba(13,10,9,.98); box-shadow: 0 30px 100px rgba(0,0,0,.72); }
.system-dialog::backdrop { background: rgba(0,0,0,.76); backdrop-filter: blur(7px); }
.system-dialog-inner { padding: 26px; }
.system-dialog h2 { margin: 0; font-size: 26px; }
.system-dialog p { color: rgba(255,246,220,.72); line-height: 1.8; }
.system-dialog ol { margin: 18px 0; padding-left: 22px; color: rgba(255,246,220,.82); line-height: 1.9; }
.system-dialog .dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }

@media (max-width: 720px) {
  .home { min-height: 640px; }
  .generated-hero-bg {
    background-image: url("assets/guanyu-nebula-mobile-stage.png");
    background-position: center center;
    background-size: cover;
    filter: none;
    transform: none;
  }
  .generated-hero-bg::after,
  .home::before { display: none; }
  .taiji-subject-wrap { left: 65.5%; top: 47.5%; width: min(55vw,260px); }
  .brand-block { display: none; }
  .brand-block { inset: auto 20px max(22px,env(safe-area-inset-bottom)) 20px; width: auto; padding: 0; justify-content: flex-end; }
  .brand-lockup { margin-bottom: 10px; gap: 10px; }
  .brand-name { font-size: clamp(36px,11vw,48px); }
  .brand-en { font-size: 10px; }
  .hero-title { font-size: clamp(32px,10vw,43px); }
  .hero-copy { margin-top: 10px; font-size: clamp(13px,3.8vw,16px); line-height: 1.48; }
  .hero-actions { gap: 10px; margin-top: 16px; }
  .hero-actions button { min-height: 46px; padding: 0 10px; font-size: 14px; }

  .shell {
    min-height: 100dvh;
    display: block;
    padding: max(24px, calc(env(safe-area-inset-top) + 18px)) 14px max(52px, calc(env(safe-area-inset-bottom) + 36px));
  }
  .glass { width: 100%; border-radius: 20px; }
  .panel { padding: 26px 18px 30px; }
  .panel-title { font-size: clamp(34px, 10vw, 44px); line-height: 1.15; }
  .panel-sub { margin: 14px 0 24px; font-size: 16px; line-height: 1.65; }
  form { gap: 18px; }
  .grid-3 { grid-template-columns: 1fr; gap: 16px; }
  label { gap: 10px; font-size: 16px; line-height: 1.45; }
  input,
  select {
    min-height: 60px;
    border-radius: 16px;
    padding: 14px 16px;
    font-size: 18px;
  }
  .consent { gap: 13px; font-size: 15px; line-height: 1.62; }
  .consent input { flex: 0 0 26px; width: 26px; height: 26px; min-height: 26px; margin-top: 0; }
  .error { min-height: 24px; font-size: 15px; }
  .panel .primary-btn,
  .panel .secondary-btn {
    width: 100%;
    min-height: 62px;
    border-radius: 999px;
    padding: 0 18px;
    font-size: 18px;
  }
  .code-card { margin: 20px 0; padding: 22px 16px; border-radius: 18px; }
  .code-label { font-size: 15px; }
  .pickup-code { font-size: clamp(39px, 12vw, 54px); }
  .timer { font-size: 16px; line-height: 1.5; }
  .preview { padding: 18px; border-radius: 18px; font-size: 17px; line-height: 1.85; }
  .qr-wrap { padding: 20px 14px; border-radius: 18px; }
  .qr-copy { font-size: 18px; line-height: 1.55; }
  .qr-box { width: min(68vw, 250px); height: min(68vw, 250px); border-radius: 16px; }
  .actions { grid-template-columns: 1fr; gap: 14px; }
  .footnote { font-size: 14px; line-height: 1.65; }
  .system-dialog { width: calc(100% - 24px); max-height: calc(100dvh - 24px); }
  .system-dialog-inner { padding: 24px 18px; }
  .system-dialog h2 { font-size: 28px; }
  .system-dialog p,
  .system-dialog ol { font-size: 16px; line-height: 1.7; }
  .system-dialog .dialog-actions { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .grid-3, .actions { grid-template-columns: 1fr; }
}

@media (max-width: 370px), (max-height: 700px) {
  .brand-lockup { margin-bottom: 6px; }
  .brand-name { font-size: 32px; }
  .hero-title { font-size: 30px; }
  .hero-copy { font-size: 12px; }
  .hero-actions { margin-top: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* 从独立手机版入口进入时强制启用全屏手机表单，不依赖浏览器断点。 */
.mobile-entry,
.mobile-entry body {
  width: 100%;
  min-height: 100%;
  background: #050b14;
}

.mobile-entry .view {
  min-height: 100dvh;
  overflow: visible;
}

.mobile-entry .shell {
  display: block;
  width: 100%;
  min-height: 100dvh;
  padding: 0;
}

.mobile-entry .glass {
  width: 100%;
  max-width: none;
  min-height: 100dvh;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 86% 8%, rgba(59,112,178,.16), transparent 31%),
    linear-gradient(180deg, #07111d 0%, #04080e 48%, #05090f 100%);
  box-shadow: none;
  backdrop-filter: none;
}

.mobile-entry .panel {
  padding: max(38px, calc(env(safe-area-inset-top) + 28px)) 18px max(64px, calc(env(safe-area-inset-bottom) + 46px));
}

.mobile-entry .panel-title {
  font-size: clamp(44px, 12vw, 58px);
  line-height: 1.12;
  text-align: center;
}

.mobile-entry .panel-sub {
  width: min(88vw, 520px);
  margin: 18px auto 34px;
  font-size: 20px;
  line-height: 1.7;
  text-align: center;
}

.mobile-entry form {
  align-items: center;
  gap: 26px;
}

.mobile-entry .grid-3,
.mobile-entry .actions {
  width: min(88vw, 520px);
  grid-template-columns: 1fr;
  gap: 24px;
  margin-inline: auto;
}

.mobile-entry label {
  width: min(88vw, 520px);
  margin-inline: auto;
  gap: 12px;
  font-size: 20px;
  line-height: 1.45;
}

.mobile-entry input,
.mobile-entry select {
  min-height: 76px;
  border-radius: 22px;
  padding: 17px 21px;
  font-size: 22px;
  border-width: 1px;
}

.mobile-entry .consent {
  gap: 15px;
  font-size: 18px;
  line-height: 1.65;
}

.mobile-entry .consent input {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  min-height: 30px;
  margin: 0;
}

.mobile-entry .error {
  width: min(88vw, 520px);
  min-height: 26px;
  margin-inline: auto;
  font-size: 18px;
}

.mobile-entry .panel .primary-btn,
.mobile-entry .panel .secondary-btn {
  width: min(88vw, 520px);
  min-height: 74px;
  margin-inline: auto;
  border-radius: 999px;
  padding: 0 22px;
  font-size: 21px;
}

.mobile-entry .code-card {
  margin: 24px 0;
  padding: 25px 18px;
  border-radius: 20px;
}

.mobile-entry .code-label { font-size: 17px; }
.mobile-entry .pickup-code { font-size: clamp(42px, 12vw, 58px); }
.mobile-entry .timer { font-size: 17px; }

.mobile-entry .preview {
  padding: 21px;
  border-radius: 20px;
  font-size: 18px;
  line-height: 1.9;
}

.mobile-entry .qr-wrap {
  padding: 22px 16px;
  border-radius: 20px;
}

.mobile-entry .qr-copy {
  font-size: 19px;
  line-height: 1.6;
}

.mobile-entry .qr-zoom-hint {
  font-size: 17px;
}

.mobile-entry .qr-box {
  width: min(76vw, 280px);
  height: min(76vw, 280px);
  border-radius: 17px;
}

.mobile-entry .footnote {
  font-size: 15px;
  line-height: 1.7;
}

.mobile-entry .system-dialog {
  width: calc(100% - 20px);
  max-height: calc(100dvh - 20px);
}
