:root {
  color-scheme: dark;
  --video-black: #02060a;
  --ink: var(--video-black);
  --gold: #d2b978;
  --gold-bright: #f1dca4;
  --gold-dim: rgba(210, 185, 120, 0.48);
  --line: rgba(199, 173, 120, 0.28);
}

@font-face {
  font-family: "Source Han Serif Taichu";
  src: url("./assets/fonts/SourceHanSerifSC-VF.woff2") format("woff2-variations");
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; background: var(--video-black); }

body {
  margin: 0;
  overflow: hidden;
  color: var(--gold);
  font-family: "Songti SC", "STSong", "SimSun", serif;
}

button, select, input { font: inherit; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.experience, .scene { position: relative; width: 100%; height: 100vh; min-height: 640px; background: var(--video-black); }

.scene { position: fixed; inset: 0; overflow: hidden; isolation: isolate; background: var(--video-black); container-type: size; }

.scene__ambient-base, .scene__video, .scene__shade, .scene__grain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.scene__ambient-base {
  object-fit: cover;
  object-position: 50% 50%;
  transform: scale(1.015);
  transform-origin: 50% 50%;
}

.scene__video {
  background: var(--video-black);
  object-fit: cover;
  object-position: 50% 50%;
  transform: scale(1.015);
}

.scene__video--ambient {
  inset: auto;
  opacity: 1;
  object-fit: fill;
  object-position: initial;
  transform-origin: 50% 50%;
  -webkit-mask-image: radial-gradient(ellipse 72% 78% at 50% 50%, #000 0%, #000 68%, rgba(0, 0, 0, 0.94) 78%, transparent 100%);
  mask-image: radial-gradient(ellipse 72% 78% at 50% 50%, #000 0%, #000 68%, rgba(0, 0, 0, 0.94) 78%, transparent 100%);
}
.scene__video--transition, .scene__video--second { opacity: 0; visibility: hidden; will-change: opacity; }
.scene__video--second { mix-blend-mode: plus-lighter; }

/*
 * Align the 1168x768 standby source to the 1280x720 transition coordinate
 * system. Values are normalized from the two source frames, so alignment
 * remains stable when object-cover changes crop direction.
 */
@media (max-aspect-ratio: 16 / 9) {
  .scene__video--ambient {
    width: 140.5914vh;
    height: 92.4437vh;
    left: calc(50vw - 77.3614vh);
    top: 4.2062vh;
  }
}

@media (min-aspect-ratio: 16 / 9) {
  .scene__video--ambient {
    width: 79.0827vw;
    height: 51.9996vw;
    left: 6.4842vw;
    top: calc(50vh - 25.759vw);
  }
}

@supports (width: 1cqw) {
  .hero { padding-top: 4cqh; }
  .hero__trigger { width: min(560px, 86cqw); min-height: min(500px, 64cqh); }
  .hero-title-group { --title-offset-y: clamp(-22px, -1.2cqh, -10px); max-width: 82cqw; }
  .hero-title { gap: clamp(36px, 2.8cqw, 108px); font-size: clamp(76px, 4.95cqw, 190px); }
  .hero-subtitle { gap: clamp(8px, 0.7cqw, 22px); margin-top: clamp(21px, 1.55cqw, 56px); font-size: clamp(13px, 0.94cqw, 36px); }
  .mystic-field { width: clamp(210px, 13.5cqw, 270px); }
  .birth-form, .bazi-result { width: min(390px, 31cqw); }
  .birth-form { left: clamp(82px, 11.8cqw, 190px); width: min(470px, 36.8cqw); }
  .bazi-result { right: clamp(82px, 11.8cqw, 190px); }
  .pillar strong { font-size: clamp(34px, 3cqw, 46px); }
}

html.is-touch-landscape .scene__video--ambient {
  width: 79.0827cqw;
  height: 51.9996cqw;
  left: 6.4842cqw;
  top: calc(50cqh - 25.759cqw);
}

.scene__shade {
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0, 4, 8, 0.68) 0%, rgba(0, 4, 8, 0.4) 23%, rgba(0, 4, 8, 0.06) 39%, transparent 46%, transparent 54%, rgba(0, 4, 8, 0.06) 61%, rgba(0, 4, 8, 0.4) 77%, rgba(0, 4, 8, 0.68) 100%),
    linear-gradient(180deg, rgba(0, 4, 8, 0.18) 0%, transparent 45%, rgba(0, 4, 8, 0.25) 100%);
}

.scene__grain {
  z-index: 3;
  pointer-events: none;
  opacity: 0.09;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.45'/%3E%3C/svg%3E");
}

.side-rail {
  position: absolute;
  z-index: 8;
  top: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: rgba(211, 187, 136, 0.7);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  pointer-events: none;
}

.side-rail--left { left: 38px; }
.side-rail--right { right: 38px; }
.side-rail__menu { font-size: 12px; transform: scaleX(1.3); opacity: 0.62; }
.side-rail i { width: 1px; height: 72px; margin: 4px 0 18px; background: linear-gradient(var(--gold), transparent); }
.side-rail__nine { margin-bottom: 18px; }
.side-rail__words { line-height: 2.2; text-align: center; }

.hero {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  place-items: center;
  padding-top: 4vh;
}

.hero__trigger {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(560px, 86vw);
  min-height: min(500px, 64vh);
  border: 0;
  padding: 24px 42px;
  color: var(--gold);
  background: transparent;
  cursor: pointer;
  text-shadow: 0 0 24px rgba(228, 196, 126, 0.24);
  will-change: transform;
}

.hero__trigger::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 9%;
  border-radius: 50%;
  opacity: 0;
  background: radial-gradient(circle, rgba(66, 156, 158, 0.12), rgba(9, 39, 47, 0.08) 42%, transparent 70%);
  filter: blur(15px);
  transition: opacity 900ms ease, transform 1100ms cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-title-group {
  --title-offset-y: clamp(-22px, -1.2vh, -10px);
  position: relative;
  z-index: 2;
  display: flex;
  width: max-content;
  max-width: 82vw;
  flex-direction: column;
  align-items: center;
  isolation: isolate;
  transform: translate3d(0, var(--title-offset-y), 0);
}

.hero-title-group::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 47%;
  width: 160%;
  height: 150%;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(31, 91, 91, 0.055), rgba(3, 12, 16, 0) 68%);
  filter: blur(10px);
  transform: translate(-50%, -50%);
}

.hero-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(36px, 2.8vw, 108px);
  margin: 0;
  font-family: "Source Han Serif Taichu", "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif;
  font-size: clamp(76px, 4.95vw, 190px);
  font-weight: 250;
  font-variation-settings: "wght" 250;
  line-height: 1;
  letter-spacing: 0;
  transform: scaleX(0.94);
  transform-origin: center;
}

.hero-title__glyph {
  display: block;
  color: rgba(199, 181, 139, 0.9);
  background: linear-gradient(180deg, rgba(218, 207, 177, 0.96) 0%, rgba(199, 181, 139, 0.93) 48%, rgba(168, 146, 101, 0.88) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 11px rgba(0, 0, 0, 0.55));
  opacity: 0.94;
}

.hero__trigger:hover::before, .hero__trigger:focus-visible::before { opacity: 0.14; transform: scale(1.03); }
.hero__trigger:focus-visible { outline: 1px solid rgba(241, 220, 164, 0.58); outline-offset: -12px; }

.hero-subtitle {
  display: grid;
  gap: clamp(8px, 0.7vw, 22px);
  margin-top: clamp(21px, 1.55vw, 56px);
  color: rgba(184, 164, 120, 0.8);
  font-family: "Source Han Serif Taichu", "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif;
  font-size: clamp(13px, 0.94vw, 36px);
  font-weight: 240;
  font-variation-settings: "wght" 240;
  line-height: 1;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.52);
  opacity: 0.9;
}

.hero-subtitle span {
  display: block;
  letter-spacing: 0.58em;
  text-indent: 0.58em;
  white-space: nowrap;
}

@media (prefers-reduced-motion: no-preference) {
  .hero-title-group {
    animation: void-title-reveal 1.7s cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .hero-subtitle {
    animation: void-subtitle-reveal 1.35s 0.38s cubic-bezier(0.16, 1, 0.3, 1) both;
  }
}

@keyframes void-title-reveal {
  from {
    opacity: 0;
    filter: blur(7px);
    transform: translate3d(0, calc(var(--title-offset-y) + 12px), 0) scale(0.985);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: translate3d(0, var(--title-offset-y), 0) scale(1);
  }
}

@keyframes void-subtitle-reveal {
  from { opacity: 0; transform: translate3d(0, 8px, 0); }
  to { opacity: 0.84; transform: translate3d(0, 0, 0); }
}

.mystic-field {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  width: clamp(210px, 13.5vw, 270px);
  aspect-ratio: 1;
  opacity: 0.72;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: opacity 700ms ease;
  will-change: transform, opacity;
}

.mystic-field::before {
  content: "";
  position: absolute;
  inset: 27%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(87, 191, 187, 0.11), rgba(25, 99, 104, 0.04) 45%, transparent 72%);
  filter: blur(7px);
}

.mystic-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  opacity: 0.88;
  background: conic-gradient(from 208deg, rgba(77, 186, 184, 0.86) 0 17%, transparent 18% 58%, rgba(204, 184, 135, 0.5) 59% 65%, transparent 66% 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 1.5px), #000 calc(100% - 1.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 1.5px), #000 calc(100% - 1.5px));
  transition: opacity 850ms ease;
  will-change: transform, opacity;
}

.mystic-ring--middle {
  inset: 18%;
  opacity: 0.72;
  background: conic-gradient(from 26deg, rgba(81, 193, 190, 0.72) 0 13%, transparent 14% 52%, rgba(218, 196, 143, 0.38) 53% 59%, transparent 60% 100%);
}

.mystic-ring--inner {
  inset: 33%;
  opacity: 0.62;
  background: conic-gradient(from 164deg, rgba(105, 210, 202, 0.78) 0 20%, transparent 21% 72%, rgba(210, 188, 134, 0.36) 73% 80%, transparent 81% 100%);
}

.mystic-beacon {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(181, 229, 219, 0.92);
  box-shadow: 0 0 9px rgba(98, 213, 207, 0.74), 0 0 24px rgba(59, 164, 164, 0.38);
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
}

.mystic-beacon::before {
  content: "";
  position: absolute;
  inset: -7px;
  border: 1px solid rgba(105, 205, 199, 0.22);
  border-radius: 50%;
}

.hero__trigger:hover .mystic-field, .hero__trigger:focus-visible .mystic-field { opacity: 0.94; }
.hero__trigger:hover .mystic-ring, .hero__trigger:focus-visible .mystic-ring { opacity: 1; }
@keyframes title-breathe { 0%, 100% { opacity: 0.88; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }
@keyframes verse-veil { 0%, 100% { opacity: 0.76; } 50% { opacity: 1; } }

.axis-mark {
  position: absolute;
  z-index: 7;
  left: 50%;
  bottom: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateX(-50%);
  color: rgba(212, 190, 145, 0.64);
  pointer-events: none;
}

.axis-mark span { display: grid; width: 23px; height: 23px; place-items: center; border: 1px solid var(--gold-dim); border-radius: 50%; font-size: 8px; }
.axis-mark i { width: 1px; height: 30px; margin: 5px 0 7px; background: repeating-linear-gradient(to bottom, var(--gold-dim) 0 3px, transparent 3px 7px); }
.axis-mark b { width: 15px; height: 15px; border-right: 1px solid var(--gold); border-bottom: 1px solid var(--gold); transform: rotate(45deg); }

.bazi-panel {
  position: absolute;
  z-index: 6;
  inset: 0;
  opacity: 0;
  visibility: hidden;
}

.birth-form, .bazi-result {
  position: absolute;
  top: 50%;
  width: min(390px, 31vw);
  transform: translateY(-43%);
}

.birth-form { left: clamp(82px, 11.8vw, 190px); width: min(470px, 36.8vw); }
.bazi-result { right: clamp(82px, 11.8vw, 190px); }

.panel-heading {
  display: grid;
  grid-template-columns: 34px auto 1fr;
  gap: 13px;
  align-items: center;
  margin-bottom: 22px;
}

.panel-heading span { height: 1px; background: linear-gradient(90deg, transparent, var(--gold-dim)); }
.panel-heading span:last-child { background: linear-gradient(90deg, var(--gold-dim), transparent); }
.panel-heading h2 { margin: 0; font-size: 18px; font-weight: 400; letter-spacing: 0.17em; white-space: nowrap; }
.birth-form .panel-heading h2 { font-weight: 650; }

.form-options-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 0 12px 24px; }
.calendar-type { display: flex; gap: 24px; margin: 0; padding: 0; border: 0; }
.calendar-type label { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; font-weight: 650; color: rgba(218, 196, 151, 0.58); }
.calendar-type input { position: absolute; opacity: 0; }
.calendar-type label > span { width: 16px; height: 16px; border: 1px solid var(--gold-dim); border-radius: 50%; }
.calendar-type input:checked + span { border-color: var(--gold-bright); box-shadow: inset 0 0 0 4px #071016; background: var(--gold-bright); }
.calendar-type label:has(input:checked) { color: var(--gold-bright); }
.gender-type { display: flex; align-items: center; gap: 12px; color: rgba(218, 196, 151, 0.58); font-size: 14px; font-weight: 650; white-space: nowrap; }
.gender-type > span { color: rgba(218, 196, 151, 0.72); }
.gender-type label { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.gender-type input { position: absolute; opacity: 0; }
.gender-type label > i { width: 14px; height: 14px; border: 1px solid var(--gold-dim); border-radius: 50%; }
.gender-type input:checked + i { border-color: var(--gold-bright); box-shadow: inset 0 0 0 3px #071016; background: var(--gold-bright); }
.gender-type label:has(input:checked) { color: var(--gold-bright); }

.birth-fields { display: grid; grid-template-columns: 1.02fr 0.94fr 0.94fr 1.5fr; gap: 12px; }
.birth-fields label { display: grid; min-width: 0; gap: 10px; text-align: center; font-size: 14px; font-weight: 650; }
.birth-fields select {
  width: 100%;
  min-width: 0;
  height: 50px;
  border: 1px solid rgba(199, 173, 120, 0.26);
  border-radius: 4px;
  padding: 0 26px;
  color: #d8c49a;
  font-size: 14px;
  font-weight: 650;
  background: rgba(3, 9, 14, 0.72);
  outline: none;
  cursor: pointer;
  text-align: center;
  text-align-last: center;
}
.birth-fields select:focus { border-color: rgba(234, 212, 160, 0.7); box-shadow: 0 0 18px rgba(199, 173, 120, 0.08); }
.birth-fields option { color: #d8c49a; font-size: 14px; font-weight: 650; text-align: center; }
.field-select-shell, .hour-select-shell { position: relative; display: block; min-width: 0; }
.field-select-shell select, #birth-hour { appearance: none; padding-right: 28px; color: transparent; }
.field-select-shell::after, .hour-select-shell::after {
  content: "";
  position: absolute;
  z-index: 2;
  top: 50%;
  right: 13px;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid #d8c49a;
  border-bottom: 1.5px solid #d8c49a;
  pointer-events: none;
  transform: translateY(-70%) rotate(45deg);
}
.field-selection {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: visible;
  color: #d8c49a;
  font-size: 15px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  padding: 0;
  pointer-events: none;
  text-align: center;
  transform: translateX(-1em);
}
.hour-selection {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  overflow: hidden;
  pointer-events: none;
  text-align: center;
  white-space: nowrap;
}
.hour-selection strong { flex: 0 0 auto; color: #d8c49a; font-size: 14px; font-weight: 650; }
.hour-selection small { overflow: hidden; color: rgba(216, 196, 154, 0.72); font-size: 10px; font-weight: 600; letter-spacing: 0.015em; text-overflow: clip; }

.calculate-button {
  position: relative;
  display: block;
  width: 168px;
  height: 50px;
  margin: 38px auto 0;
  border: 1px solid rgba(199, 173, 120, 0.48);
  color: var(--gold-bright);
  background: rgba(6, 13, 17, 0.72);
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
  cursor: pointer;
  font-weight: 650;
  letter-spacing: 0.3em;
}
.calculate-button::before { content: ""; position: absolute; inset: 4px; border: 1px solid rgba(199, 173, 120, 0.22); pointer-events: none; }
.calculate-button i { position: absolute; top: 50%; right: 6px; width: 6px; height: 6px; border: 1px solid var(--gold); border-radius: 50%; transform: translateY(-50%); }
.calculate-button:hover { background: rgba(52, 43, 27, 0.34); box-shadow: 0 0 24px rgba(199, 173, 120, 0.09); }
.form-status { min-height: 18px; margin: 13px 0 0; color: rgba(218, 196, 151, 0.58); font-size: 11px; font-weight: 650; text-align: center; letter-spacing: 0.08em; }

.pillars { display: grid; grid-template-columns: 1fr 1px 1fr 1px 1fr 1px 1fr; align-items: end; margin-top: 28px; }
.pillars > i { width: 1px; height: 88px; margin-bottom: 9px; background: radial-gradient(circle at center, #eacb82 0 2px, rgba(199, 173, 120, 0.2) 4px, transparent 72%); }
.pillar { text-align: center; }
.pillar > span { display: block; margin-bottom: 14px; color: rgba(211, 188, 143, 0.55); font-size: 13px; }
.pillar strong { display: flex; flex-direction: column; gap: 5px; color: #e0c995; font-size: clamp(34px, 3vw, 46px); font-weight: 300; line-height: 1; text-shadow: 0 0 15px rgba(228, 198, 133, 0.13); }
.pillar b { font-weight: inherit; }

.day-master { margin-top: 25px; padding-top: 18px; border-top: 1px solid var(--line); text-align: center; }
.day-master p { margin: 0 0 12px; font-size: 15px; letter-spacing: 0.22em; }
.day-master span { font-size: 14px; letter-spacing: 0.15em; }

@media (max-width: 900px) {
  body { overflow-y: auto; }
  .experience, .scene { min-height: 820px; }
  .side-rail { display: none; }
  .hero__trigger { transform: translateY(-4vh); }
  .mystic-field { width: min(240px, 66vw); }
  .bazi-panel { overflow-y: auto; padding: 80px 24px 100px; }
  .birth-form, .bazi-result { position: relative; top: auto; left: auto; right: auto; width: min(440px, 100%); margin: 0 auto; transform: none; }
  .bazi-result { margin-top: 70px; }
  .scene__shade { background: rgba(0, 5, 9, 0.38); }
}

@media (max-width: 520px) {
  .experience, .scene { min-height: 900px; }
  .hero__trigger { width: 94vw; min-height: 500px; padding: 18px; }
  .hero-title-group { --title-offset-y: 8px; }
  .hero-title { font-size: clamp(58px, 16vw, 72px); gap: clamp(28px, 10vw, 40px); }
  .hero-subtitle { margin-top: 18px; font-size: 13px; }
  .mystic-field { width: min(220px, 64vw); }
  .form-options-row { justify-content: center; margin-inline: 0; flex-wrap: wrap; }
  .birth-fields { grid-template-columns: repeat(2, 1fr); }
  .pillars { margin-inline: -10px; }
  .pillar strong { font-size: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; }
  .hero-title-group, .hero-subtitle, .mystic-ring, .mystic-beacon { animation: none !important; }
}
