@font-face {
  font-family: "Zhi Mang Xing";
  src: url("./assets/fonts/ZhiMangXing-Brand.woff2?v=font3") format("woff2");
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #080808;
  --panel: rgba(20, 19, 17, 0.88);
  --panel-soft: rgba(32, 29, 24, 0.72);
  --gold: #c9a96e;
  --gold-bright: #ead4a7;
  --ink: #f4efe5;
  --muted: #aaa399;
  --line: rgba(201, 169, 110, 0.24);
  --danger: #d28d7c;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(201, 169, 110, 0.09), transparent 28rem),
    radial-gradient(circle at 100% 38%, rgba(76, 100, 91, 0.1), transparent 30rem),
    linear-gradient(180deg, #090909, #050505 65%, #0b0907);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.16'/%3E%3C/svg%3E");
}

a { color: inherit; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.is-hidden { display: none !important; }

.energy-shell {
  position: relative;
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 22px 0 48px;
}

.energy-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 56px;
}

.back-link {
  justify-self: start;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  transition: color 160ms ease;
}

.back-link:hover { color: var(--gold-bright); }

.brand-lockup {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand-cn {
  color: var(--gold-bright);
  font-family: "Zhi Mang Xing", cursive;
  font-size: 31px;
  letter-spacing: 0.08em;
}

.brand-en {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.34em;
}

.points-badge {
  justify-self: end;
  padding: 8px 13px;
  color: var(--gold-bright);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(201, 169, 110, 0.06);
  font-size: 12px;
}

.hero-copy {
  width: min(760px, 100%);
  margin: 74px auto 46px;
  text-align: center;
}

.eyebrow, .step-label {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.hero-copy h1 {
  margin: 0;
  font-family: "Zhi Mang Xing", cursive;
  font-size: clamp(50px, 7vw, 78px);
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--gold-bright);
}

.hero-copy > p:not(.eyebrow) {
  margin: 21px auto 0;
  max-width: 690px;
  color: #d2ccc1;
  font-size: 16px;
  line-height: 1.9;
}

.hero-copy .hero-note {
  margin-top: 8px !important;
  color: var(--muted) !important;
  font-size: 13px !important;
}

.energy-workspace { display: grid; gap: 26px; }

.form-card, .result-card, .history-card, .login-gate {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(25, 23, 20, 0.94), rgba(13, 13, 13, 0.93));
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.form-card, .result-card, .history-card { padding: clamp(24px, 4vw, 42px); }

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 30px;
}

.section-heading h2 {
  margin: 0;
  color: #f0e8d8;
  font-family: Georgia, "Songti SC", serif;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 500;
}

.saved-hint, .provider-note, .submit-row p {
  color: var(--muted);
  font-size: 12px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.field { display: grid; gap: 9px; }
.field-wide { grid-column: 1 / -1; }

.field > span, .choice-group legend {
  color: #d9d1c4;
  font-size: 13px;
}

.field em {
  color: #716d66;
  font-style: normal;
}

.field small {
  color: #78736b;
  font-size: 11px;
}

input, select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  color: var(--ink);
  border: 1px solid rgba(201, 169, 110, 0.2);
  border-radius: 12px;
  outline: none;
  background: rgba(4, 4, 4, 0.62);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus, select:focus {
  border-color: rgba(201, 169, 110, 0.7);
  box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.08);
}

input::placeholder { color: #625e57; }

.choice-group {
  margin: 34px 0 0;
  padding: 0;
  border: 0;
}

.choice-group legend { margin-bottom: 13px; }

.choice-group legend span {
  color: var(--gold);
  font-size: 10px;
  letter-spacing: 0.16em;
}

.segmented-grid {
  display: grid;
  gap: 10px;
}

.focus-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.type-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.segmented-grid label { cursor: pointer; }
.segmented-grid input { position: absolute; opacity: 0; pointer-events: none; }

.segmented-grid label > span {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 11px 13px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  color: #aaa399;
  background: rgba(255, 255, 255, 0.025);
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.type-grid label > span {
  min-height: 74px;
  align-items: flex-start;
  flex-direction: column;
}

.type-grid strong { color: inherit; font-size: 14px; }
.type-grid small { color: #777169; font-size: 11px; margin-top: 5px; }

.segmented-grid input:checked + span {
  color: var(--gold-bright);
  border-color: rgba(201, 169, 110, 0.64);
  background: rgba(201, 169, 110, 0.1);
}

.submit-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 34px;
}

.primary-action, .secondary-action {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 0 22px;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
}

.primary-action {
  border: 1px solid #d8ba7d;
  color: #18130b;
  background: linear-gradient(135deg, #ead5a4, #b88f4c);
  box-shadow: 0 12px 28px rgba(180, 133, 65, 0.18);
  font-weight: 650;
}

button.primary-action { appearance: none; }

.secondary-action {
  border: 1px solid var(--line);
  color: var(--gold-bright);
  background: rgba(201, 169, 110, 0.05);
}

.primary-action:hover, .secondary-action:hover { transform: translateY(-1px); }
.primary-action:disabled, .is-disabled { pointer-events: none; opacity: 0.45; }

.form-status {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--gold-bright);
  font-size: 13px;
}

.form-status.is-error { color: var(--danger); }

.login-gate {
  padding: 52px 24px;
  text-align: center;
}

.gate-mark {
  display: grid;
  width: 74px;
  height: 74px;
  place-items: center;
  margin: 0 auto 20px;
  color: var(--gold-bright);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-family: "Zhi Mang Xing", cursive;
  font-size: 42px;
}

.login-gate h2 { font-family: Georgia, "Songti SC", serif; font-weight: 500; }
.login-gate p { color: var(--muted); line-height: 1.8; }
.login-gate .primary-action { margin-top: 12px; }

.status-pill {
  padding: 7px 11px;
  border: 1px solid rgba(201, 169, 110, 0.32);
  border-radius: 999px;
  color: var(--gold-bright);
  font-size: 11px;
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  align-items: center;
  gap: clamp(30px, 6vw, 72px);
}

.image-stage {
  position: relative;
  width: 100%;
  max-width: 460px;
  justify-self: center;
  overflow: hidden;
  border: 1px solid rgba(201, 169, 110, 0.28);
  border-radius: 22px;
  background: #090909;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45);
}

.image-stage.avatar { aspect-ratio: 1 / 1; }
.image-stage.wallpaper { width: min(100%, 340px); aspect-ratio: 9 / 16; }

.image-stage img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.plan-preview {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 56%, var(--preview-a, rgba(201, 169, 110, 0.72)), transparent 22%),
    radial-gradient(circle at 42% 42%, var(--preview-b, rgba(80, 112, 98, 0.44)), transparent 38%),
    linear-gradient(150deg, #16130e, #080808 70%);
}

.plan-preview::before {
  content: "";
  position: absolute;
  width: 54%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(245, 229, 198, 0.14);
  filter: blur(22px);
}

.preview-orbit {
  position: absolute;
  width: 56%;
  aspect-ratio: 1;
  border: 1px solid rgba(245, 229, 198, 0.36);
  border-radius: 50%;
}

.orbit-two { width: 74%; opacity: 0.45; transform: rotate(24deg) scaleY(0.72); }

.preview-core {
  width: 18%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 237, 199, 0.75);
  box-shadow: 0 0 55px rgba(235, 190, 109, 0.52);
}

.plan-preview small {
  position: absolute;
  bottom: 18px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.result-explanation {
  margin: 0;
  color: #d9d1c4;
  font-size: 16px;
  line-height: 1.9;
}

.bazi-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0;
}

.bazi-strip span {
  padding: 8px 10px;
  border: 1px solid rgba(201, 169, 110, 0.18);
  border-radius: 9px;
  color: #cfc4b2;
  background: rgba(201, 169, 110, 0.04);
  font-size: 12px;
}

.plan-meta {
  display: grid;
  gap: 13px;
  padding: 20px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.plan-meta > div { display: grid; grid-template-columns: 88px 1fr; gap: 12px; }
.plan-meta span { color: #777169; font-size: 12px; }
.plan-meta p { margin: 0; color: #cfc8bc; font-size: 13px; line-height: 1.7; }

.provider-note { min-height: 18px; line-height: 1.6; }
.result-actions { display: flex; gap: 12px; margin-top: 24px; }

.history-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.history-item {
  position: relative;
  overflow: hidden;
  min-height: 180px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 15px;
  color: var(--ink);
  background: linear-gradient(145deg, rgba(201, 169, 110, 0.12), rgba(9, 9, 9, 0.9));
  cursor: pointer;
  text-align: left;
}

.history-item img { width: 100%; aspect-ratio: 1; display: block; object-fit: cover; }
.history-item.is-wallpaper img { aspect-ratio: 9 / 12; }

.history-copy {
  display: grid;
  gap: 5px;
  padding: 13px;
}

.history-copy strong { font-size: 13px; font-weight: 550; }
.history-copy span { color: var(--muted); font-size: 10px; }

footer {
  padding: 34px 18px 0;
  color: #666159;
  text-align: center;
  font-size: 11px;
  line-height: 1.8;
}

@media (max-width: 800px) {
  .energy-shell { width: min(100% - 24px, 680px); padding-top: 12px; }
  .energy-header { grid-template-columns: 1fr auto; }
  .brand-lockup { display: none; }
  .hero-copy { margin: 46px auto 30px; }
  .hero-copy > p:not(.eyebrow) { font-size: 14px; }
  .field-grid, .result-layout { grid-template-columns: 1fr; }
  .focus-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .history-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .result-layout { gap: 30px; }
  .result-heading { align-items: center; }
}

@media (max-width: 520px) {
  .form-card, .result-card, .history-card { padding: 22px 17px; border-radius: 18px; }
  .section-heading { margin-bottom: 23px; }
  .field-grid { gap: 16px; }
  .focus-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .type-grid { grid-template-columns: 1fr; }
  .submit-row { align-items: stretch; flex-direction: column; }
  .submit-row .primary-action { width: 100%; }
  .submit-row p { margin: -5px 0 0; text-align: center; }
  .result-actions { flex-direction: column; }
  .result-actions > * { width: 100%; }
  .plan-meta > div { grid-template-columns: 72px 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
