:root {
  --ink: #18231e;
  --surface: #f6f8f3;
  --panel: #ffffff;
  --panel-soft: #edf4ed;
  --line: #d7ded5;
  --muted: #657168;
  --red: #a93428;
  --red-dark: #7d241c;
  --jade: #1f6f61;
  --gold: #bd8d2b;
  --shadow: 0 22px 54px rgba(24, 35, 30, 0.16);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(31, 111, 97, 0.10), transparent 36%),
    linear-gradient(315deg, rgba(169, 52, 40, 0.08), transparent 34%),
    var(--surface);
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.page-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  min-height: 86svh;
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(320px, 0.78fr);
  align-items: center;
  gap: 34px;
  padding: 34px 0 52px;
}

.hero-copy {
  min-height: 420px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 36px;
  color: #f5f7ef;
  background:
    linear-gradient(140deg, rgba(24, 35, 30, 0.96), rgba(24, 51, 40, 0.86)),
    url("assets/bagua-mark.svg") right 28px center / min(46vw, 430px) no-repeat;
  border-radius: 8px;
  overflow: hidden;
}

.language-switch {
  align-self: flex-start;
  display: inline-flex;
  gap: 6px;
  margin-bottom: 24px;
  padding: 5px;
  border: 1px solid rgba(245, 247, 239, 0.28);
  border-radius: 999px;
  background: rgba(245, 247, 239, 0.08);
}

.lang-btn {
  min-width: 44px;
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  color: rgba(245, 247, 239, 0.82);
  background: transparent;
  cursor: pointer;
  font-weight: 500;
}

.lang-btn.is-active {
  color: var(--ink);
  background: #f8f4df;
}

.eyebrow {
  margin: 0 0 16px;
  color: #e1bd62;
  font-weight: 500;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  max-width: 9em;
  font-size: clamp(2.5rem, 7vw, 5.4rem);
  line-height: 1.05;
  letter-spacing: 0;
  font-weight: 500;
}

.hero-text {
  max-width: 29em;
  margin: 22px 0 0;
  color: rgba(245, 247, 239, 0.86);
  font-size: 1.05rem;
  line-height: 1.8;
}

.calculator,
.result-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.calculator {
  position: relative;
  padding: 28px;
}

.brand-mark {
  width: 74px;
  height: 74px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--panel-soft);
}

.brand-mark img {
  width: 58px;
  height: 58px;
  display: block;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.field input,
.field select {
  min-height: 48px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

.field input:focus,
.field select:focus,
.primary-action:focus,
.secondary-action:focus,
.ghost-action:focus {
  outline: 3px solid rgba(31, 111, 97, 0.28);
  outline-offset: 2px;
}

.form-note {
  margin: 14px 0 18px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.primary-action,
.secondary-action,
.ghost-action {
  min-height: 48px;
  border-radius: 8px;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  font-weight: 500;
}

.primary-action {
  width: 100%;
  color: #fff;
  background: var(--red);
}

.primary-action:hover {
  background: var(--red-dark);
}

.result-section {
  margin: -18px 0 42px;
}

.empty-state {
  display: grid;
  gap: 8px;
  padding: 32px 0 48px;
}

.empty-state h2,
.empty-state p {
  margin: 0;
}

.empty-state h2 {
  font-size: 1.4rem;
  font-weight: 500;
}

.empty-state p {
  color: var(--muted);
  line-height: 1.7;
}

.result-card {
  padding: 28px;
}

.is-hidden {
  display: none;
}

.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.result-kicker {
  margin: 0 0 8px;
  color: var(--jade);
  font-weight: 500;
}

.result-head h2 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  line-height: 1.15;
  font-weight: 500;
}

.magnetic-code {
  flex: 0 0 auto;
  min-width: 72px;
  min-height: 72px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(189, 141, 43, 0.42);
  border-radius: 50%;
  color: var(--red-dark);
  background: #fff9e7;
  font-size: 1.6rem;
  font-weight: 500;
}

.gua-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0;
}

.gua-row div,
.bazi-block div,
.month-block,
.lead-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.gua-row div {
  padding: 16px;
  display: grid;
  gap: 6px;
}

.bazi-block {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}

.bazi-block div {
  min-height: 78px;
  padding: 13px;
  display: grid;
  gap: 7px;
  align-content: center;
}

.gua-row span,
.bazi-block span,
.month-block p {
  color: var(--muted);
  font-size: 0.92rem;
}

.gua-row strong {
  font-size: 1.25rem;
  font-weight: 500;
}

.bazi-block strong {
  font-size: 1.15rem;
  font-weight: 500;
}

.lunar-date-line {
  margin: -8px 0 20px;
  color: var(--muted);
  line-height: 1.7;
}

.month-block {
  padding: 16px;
}

.month-block p {
  margin: 0 0 12px;
}

.month-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.month-tags span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 14px;
  color: #fff;
  background: var(--jade);
  font-weight: 500;
}

.reading-block {
  margin-top: 22px;
}

.reading-block h3 {
  margin: 0 0 8px;
  font-size: 1.08rem;
  font-weight: 500;
}

.reading-block p {
  margin: 0;
  color: #38453d;
  line-height: 1.85;
}

.tips-list {
  margin: 0;
  padding-left: 20px;
  color: #38453d;
  line-height: 1.8;
}

.tips-list li + li {
  margin-top: 7px;
}

.lead-box {
  margin-top: 24px;
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.lead-contact {
  min-width: 0;
}

.lead-box h3,
.lead-box p {
  margin: 0;
}

.lead-box h3 {
  font-size: 1.12rem;
  font-weight: 500;
}

.lead-box p {
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.7;
}

.lead-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.secondary-action {
  color: #fff;
  background: var(--jade);
}

.ghost-action {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.line-qr {
  flex: 0 0 144px;
  margin: 0;
  display: grid;
  justify-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.line-qr img {
  width: 136px;
  height: 136px;
  border: 8px solid #fff;
  border-radius: 8px;
  display: block;
}

.line-qr img:not(.line-qr-working) {
  display: none;
}

.line-qr .line-qr-working ~ .line-qr-working {
  display: none;
}

.oracle-section {
  margin: 10px 0 52px;
}

.section-head {
  max-width: 760px;
  margin-bottom: 18px;
}

.section-head h2,
.section-head p {
  margin: 0;
}

.section-head h2 {
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 1.18;
  font-weight: 500;
}

.section-head p:last-child {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.75;
}

.eyebrow.dark {
  color: var(--gold);
}

.oracle-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.oracle-card {
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  color: var(--ink);
  background: var(--panel);
  cursor: pointer;
  text-align: left;
  box-shadow: 0 12px 28px rgba(24, 35, 30, 0.08);
}

.oracle-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.05rem;
  font-weight: 600;
}

.oracle-card span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.oracle-card.is-active {
  border-color: rgba(31, 111, 97, 0.72);
  background: #edf4ed;
}

.oracle-panel,
.oracle-result {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.oracle-panel {
  padding: 24px;
}

.oracle-ritual {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.oracle-ritual h3,
.oracle-ritual p {
  margin: 0;
}

.oracle-ritual p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.65;
}

.ritual-mark {
  flex: 0 0 58px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--red);
  font-size: 1.35rem;
  font-weight: 600;
}

.cup-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.cup-row span {
  min-height: 46px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--panel-soft);
}

.cup-row span.is-sheng {
  border-style: solid;
  color: #fff;
  background: var(--jade);
}

.cup-row span.is-xiao {
  border-style: solid;
  color: #fff;
  background: var(--red);
}

.oracle-draw {
  margin-bottom: 12px;
}

.oracle-status {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.oracle-result {
  margin-top: 20px;
  padding: 22px;
}

.oracle-poem {
  margin: 14px 0;
  padding-left: 14px;
  border-left: 3px solid var(--gold);
  color: var(--red-dark);
  font-size: 1.05rem;
  line-height: 1.8;
}

.site-footer {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 28px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.7;
}

.site-footer p {
  margin: 0;
}

@media (max-width: 820px) {
  .page-shell {
    width: min(100% - 24px, 680px);
  }

  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 16px;
    padding-top: 16px;
  }

  .hero-copy {
    min-height: 310px;
    padding: 28px;
    background-size: 320px;
    background-position: right -48px center;
  }

  .result-section {
    margin-top: 0;
  }

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

@media (max-width: 560px) {
  .page-shell,
  .site-footer {
    width: min(100% - 20px, 440px);
  }

  .hero {
    padding-bottom: 30px;
  }

  .hero-copy,
  .calculator,
  .result-card {
    padding: 20px;
  }

  .field-grid,
  .gua-row,
  .bazi-block,
  .oracle-grid,
  .cup-row {
    grid-template-columns: 1fr;
  }

  .result-head,
  .lead-box,
  .lead-actions,
  .oracle-ritual {
    flex-direction: column;
    align-items: stretch;
  }

  .oracle-panel,
  .oracle-result {
    padding: 20px;
  }

  .line-qr {
    justify-self: center;
    width: 100%;
  }

  .magnetic-code {
    width: 72px;
  }

  .secondary-action,
  .ghost-action {
    width: 100%;
  }
}
