.bazi-page {
    background: #f4eddf;
}

.bazi-hero {
    position: relative;
    min-height: 720px;
    overflow: hidden;
    color: var(--white);
    background: var(--night);
}

.bazi-hero-bg {
    position: absolute;
    inset: 0;
    background-image: linear-gradient(90deg, rgba(5, 12, 24, 0.92), rgba(5, 12, 24, 0.72) 46%, rgba(5, 12, 24, 0.28)), url("assets/fatespark-hero.png");
    background-size: cover;
    background-position: center;
}

.bazi-hero::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 150px;
    background: linear-gradient(0deg, #f4eddf, rgba(244, 237, 223, 0));
}

.bazi-shell {
    position: relative;
    z-index: 1;
    width: min(1180px, calc(100% - 32px));
    min-height: 720px;
    margin: 0 auto;
    padding: 116px 0 86px;
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(360px, 0.68fr);
    gap: 34px;
    align-items: center;
}

.bazi-copy h1 {
    margin-bottom: 18px;
    font-size: clamp(48px, 8vw, 98px);
    line-height: 0.96;
}

.bazi-copy p:not(.eyebrow) {
    max-width: 700px;
    color: rgba(255, 255, 255, 0.84);
    font-size: clamp(17px, 2vw, 22px);
}

.bazi-panel,
.bazi-result,
.bazi-cards article,
.pillar-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 251, 242, 0.94);
    box-shadow: var(--shadow);
}

.bazi-panel {
    padding: 24px;
    color: var(--ink);
}

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

.bazi-form label {
    display: grid;
    gap: 7px;
    min-width: 0;
}

.bazi-form label span {
    color: #4c5362;
    font-size: 13px;
    font-weight: 750;
}

.bazi-form input,
.bazi-form select {
    width: 100%;
    min-height: 44px;
    border: 1px solid #d8c8a8;
    border-radius: 8px;
    background: #fffdf7;
    color: var(--ink);
    padding: 10px 12px;
    outline: none;
}

.bazi-form input:focus,
.bazi-form select:focus {
    border-color: var(--jade);
    box-shadow: 0 0 0 3px rgba(42, 168, 137, 0.18);
}

.bazi-form button {
    grid-column: 1 / -1;
    min-height: 46px;
    border: 0;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--gold), #f1ce79 45%, var(--jade));
    color: #06101d;
    font-weight: 850;
    cursor: pointer;
}

.bazi-result-section {
    position: relative;
    z-index: 2;
    margin-top: -52px;
    padding: 0 16px 36px;
}

.bazi-result {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: 24px;
    padding: 24px;
    background: var(--paper-soft);
}

.result-intro h2 {
    margin-bottom: 8px;
    font-size: clamp(28px, 4vw, 42px);
}

.result-intro p {
    color: var(--muted);
}

.luopan {
    position: relative;
    width: min(100%, 360px);
    aspect-ratio: 1;
    justify-self: center;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: radial-gradient(circle, #fffdf7 0 20%, #f3dfb7 20% 22%, #fff8e8 22% 44%, #eadab7 44% 46%, #fffdf7 46% 69%, #d9ad59 69% 71%, #101a2d 71% 100%);
    box-shadow: inset 0 0 0 1px #d8c8a8, 0 24px 70px rgba(20, 24, 35, 0.18);
}

.luopan-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(23, 32, 51, 0.18);
}

.ring-outer {
    inset: 8%;
}

.ring-mid {
    inset: 24%;
}

.ring-inner {
    inset: 39%;
}

.luopan-center {
    position: relative;
    z-index: 2;
    width: 96px;
    height: 96px;
    border: 1px solid #d8c8a8;
    border-radius: 50%;
    background: #fffdf7;
    color: var(--ink);
    display: grid;
    place-items: center;
    align-content: center;
    box-shadow: 0 12px 30px rgba(20, 24, 35, 0.16);
}

.luopan-center span {
    font-size: 36px;
    font-weight: 900;
    line-height: 1;
}

.luopan-center small {
    color: var(--muted);
    font-weight: 800;
}

.branch-mark {
    position: absolute;
    z-index: 1;
    left: 50%;
    top: 50%;
    width: 42px;
    height: 42px;
    margin: -21px 0 0 -21px;
    transform: rotate(var(--angle)) translate(142px) rotate(calc(-1 * var(--angle)));
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 253, 247, 0.94);
    color: #172033;
    font-weight: 900;
    border: 1px solid rgba(23, 32, 51, 0.16);
}

.branch-mark.active {
    background: var(--night);
    color: var(--gold-soft);
}

.stem-mark {
    position: absolute;
    z-index: 1;
    left: 50%;
    top: 50%;
    width: 34px;
    height: 34px;
    margin: -17px 0 0 -17px;
    transform: rotate(var(--angle)) translate(92px) rotate(calc(-1 * var(--angle)));
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(217, 173, 89, 0.92);
    color: #07101d;
    font-weight: 900;
}

.pillar-grid,
.bazi-cards {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.bazi-table-wrap {
    grid-column: 1 / -1;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf7;
}

.bazi-table {
    width: 100%;
    min-width: 460px;
    border-collapse: collapse;
    color: var(--ink);
}

.bazi-table th,
.bazi-table td {
    border: 1px solid #ece0c6;
    padding: 9px 8px;
    text-align: center;
    vertical-align: middle;
}

.bazi-table thead th {
    background: #f1e6cf;
    color: #5a4a28;
    font-size: 14px;
    font-weight: 850;
}

.bazi-table tbody th {
    width: 54px;
    background: #f8f1e0;
    color: #7c6a44;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.bazi-table .gz {
    font-size: 24px;
    font-weight: 900;
    line-height: 1.1;
}

.bazi-table .row-gan td {
    padding: 6px 8px;
}

.bazi-table .hidden-stem {
    font-size: 15px;
    font-weight: 750;
}

.bazi-table .row-hidden td {
    font-size: 13px;
    line-height: 1.5;
    color: var(--muted);
}

.bazi-table .day-star {
    color: #b0472f;
    font-weight: 900;
}

.bazi-table .row-shensha td {
    padding: 8px 6px;
}

.bazi-table .sha-tag {
    display: inline-block;
    margin: 2px;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(184, 141, 74, 0.14);
    color: #8a5a24;
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
}

.pillar-card,
.bazi-cards article {
    min-width: 0;
    padding: 16px;
}

.pillar-card span,
.bazi-cards article > span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.pillar-card strong {
    display: block;
    margin: 6px 0 2px;
    font-size: 34px;
    line-height: 1.1;
}

.pillar-card p,
.bazi-cards p {
    margin: 8px 0 0;
    color: var(--ink);
    font-size: 15px;
}

.bazi-cards article {
    background: #fffdf7;
    box-shadow: none;
}

.bazi-cards article:first-child,
.bazi-cards article:last-child {
    grid-column: span 2;
}

.bazi-bars,
.ten-god-list {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.bazi-bar {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    gap: 10px;
    align-items: center;
    color: var(--ink);
    font-size: 14px;
    font-weight: 800;
}

.bazi-track {
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #eadfca;
}

.bazi-fill {
    height: 100%;
    border-radius: inherit;
}

.ten-god-item {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffaf0;
    color: var(--ink);
    font-size: 14px;
}

.bazi-reading {
    grid-column: 1 / -1;
    margin-top: 4px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.bazi-read-head h3 {
    margin: 4px 0 6px;
    font-size: clamp(19px, 2.4vw, 24px);
}

.bazi-read-note {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 13px;
}

.bazi-daymaster {
    margin-bottom: 14px;
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-top: 3px solid var(--gold);
    border-radius: 8px;
    background: linear-gradient(180deg, #fffaf0, #fffdf7);
}

.bazi-daymaster .bazi-read-ico {
    font-size: 22px;
    line-height: 1;
}

.bazi-daymaster h4 {
    margin: 8px 0 10px;
    font-size: 18px;
    color: var(--ink);
}

.bazi-daymaster p {
    margin: 0 0 8px;
    color: var(--ink);
    font-size: 14px;
    line-height: 1.78;
}

.bazi-daymaster p:last-child {
    margin-bottom: 0;
}

.bazi-daymaster strong {
    color: #8a5a24;
}

.bazi-read-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(248px, 1fr));
    gap: 12px;
}

.bazi-read-card {
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf7;
    border-top: 3px solid var(--gold);
}

.bazi-read-card .bazi-read-ico {
    font-size: 22px;
    line-height: 1;
}

.bazi-read-card h4 {
    margin: 8px 0 8px;
    font-size: 16px;
    color: var(--ink);
}

.bazi-read-card p {
    margin: 0;
    color: var(--ink);
    font-size: 14px;
    line-height: 1.75;
}

.bazi-peach {
    grid-column: 1 / -1;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-top: 3px solid #d98aa0;
    border-radius: 8px;
    background: #fff8f6;
}

.bazi-peach .bazi-read-ico {
    font-size: 22px;
    line-height: 1;
}

.bazi-peach h4 {
    margin: 8px 0;
    font-size: 16px;
    color: var(--ink);
}

.bazi-peach p {
    margin: 0;
    color: var(--ink);
    font-size: 14px;
    line-height: 1.75;
}

.bazi-liunian {
    margin-top: 18px;
}

.bazi-liunian h4 {
    margin: 0 0 4px;
    font-size: 17px;
    color: var(--ink);
}

.liunian-table {
    min-width: 660px;
    font-size: 13px;
}

.liunian-table td {
    text-align: center;
    padding: 8px 7px;
    line-height: 1.55;
}

.liunian-table tbody td:first-child {
    font-weight: 800;
}

.liunian-table tbody td:nth-child(2) {
    white-space: nowrap;
    font-weight: 700;
}

.bazi-annual-love p {
    margin: 0 0 8px;
}

.bazi-annual-love p:last-child {
    margin-bottom: 0;
}

.bazi-annual-love strong {
    color: #b0472f;
}

.bazi-annual-fortune {
    border-top-color: var(--jade);
    background: #f4faf7;
}

.bazi-annual-fortune p {
    margin: 0 0 8px;
}

.bazi-annual-fortune p:last-child {
    margin-bottom: 0;
}

.bazi-annual-fortune strong {
    color: #0f5f4e;
}

.bazi-affinity {
    margin-top: 18px;
}

.bazi-affinity h4 {
    margin: 0 0 4px;
    font-size: 17px;
    color: var(--ink);
}

.affinity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.affinity-card {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf7;
}

.affinity-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.affinity-stem {
    font-size: 20px;
    font-weight: 900;
    line-height: 1.1;
}

.affinity-rel {
    display: block;
    margin: 8px 0 6px;
    font-size: 12px;
    font-weight: 800;
    color: #8a5a24;
}

.affinity-card p {
    margin: 0;
    color: var(--ink);
    font-size: 13.5px;
    line-height: 1.7;
}

.bazi-dayun {
    margin-top: 18px;
}

.bazi-dayun h4 {
    margin: 0 0 4px;
    font-size: 17px;
    color: var(--ink);
}

.bazi-dayun-card {
    margin: 8px 0 12px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--jade);
    border-radius: 8px;
    background: #f4faf7;
    color: var(--ink);
    font-size: 14px;
    line-height: 1.75;
}

.dayun-table {
    min-width: 460px;
    font-size: 13px;
}

.dayun-table td {
    text-align: center;
    padding: 8px 7px;
}

.dayun-table tbody td:nth-child(3) {
    font-weight: 800;
}

.dayun-table tbody tr.dayun-current {
    background: rgba(42, 168, 137, 0.14);
}

.dayun-table tbody tr.dayun-current td {
    font-weight: 800;
    color: #0f5f4e;
}

.hehun-head {
    max-width: 760px;
    margin-bottom: 22px;
}

.hehun-head h2 {
    margin: 6px 0 10px;
}

.hehun-head p {
    color: var(--muted);
}

.hehun-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    max-width: 860px;
}

.hehun-person {
    display: grid;
    gap: 12px;
    align-content: start;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf7;
}

.hehun-person h3 {
    margin: 0;
    font-size: 16px;
    color: var(--ink);
}

.hehun-person label {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.hehun-person span {
    font-size: 13px;
    font-weight: 750;
    color: #4c5362;
}

.hehun-person input {
    width: 100%;
    min-height: 44px;
    border: 1px solid #d8c8a8;
    border-radius: 8px;
    background: #fffdf7;
    color: var(--ink);
    padding: 10px 12px;
    outline: none;
}

.hehun-person input:focus {
    border-color: var(--jade);
    box-shadow: 0 0 0 3px rgba(42, 168, 137, 0.18);
}

.hehun-form button {
    grid-column: 1 / -1;
    max-width: 860px;
    min-height: 46px;
    border: 0;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--gold), #f1ce79 45%, var(--jade));
    color: #06101d;
    font-weight: 850;
    cursor: pointer;
}

.hehun-result {
    max-width: 900px;
    margin-top: 22px;
}

.hehun-empty {
    color: var(--muted);
}

.hehun-summary {
    display: flex;
    gap: 20px;
    align-items: center;
    padding: 20px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--jade);
    border-radius: 10px;
    background: #fffdf7;
}

.hehun-summary.hehun-care {
    border-left-color: #c56b4a;
}

.hehun-summary.hehun-mid {
    border-left-color: var(--gold);
}

.hehun-index {
    flex: 0 0 auto;
    width: 104px;
    text-align: center;
    line-height: 1.1;
}

.hehun-index strong {
    font-size: 42px;
    font-weight: 900;
    color: #0f5f4e;
}

.hehun-care .hehun-index strong {
    color: #b0472f;
}

.hehun-mid .hehun-index strong {
    color: #a9791f;
}

.hehun-index span {
    color: var(--muted);
    font-weight: 800;
}

.hehun-index small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.hehun-summary-text h3 {
    margin: 0 0 8px;
    font-size: 20px;
}

.hehun-summary-text p {
    margin: 0 0 8px;
    color: var(--ink);
    font-size: 14px;
    line-height: 1.7;
}

.hehun-summary-text p:last-child {
    margin-bottom: 0;
}

.hehun-pillars {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 18px;
    color: var(--muted) !important;
}

.hehun-diagrams {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 14px;
}

.hehun-diagram {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf7;
    text-align: center;
}

.hehun-diagram h4 {
    margin: 0 0 8px;
    font-size: 15px;
    color: var(--ink);
}

.hehun-svg {
    width: 100%;
    max-width: 300px;
    height: auto;
}

.hehun-diagram-note {
    margin: 8px 0 0;
    color: var(--ink);
    font-size: 13px;
    line-height: 1.65;
    text-align: left;
}

.wx-legend {
    display: inline-flex;
    gap: 14px;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.wx-legend i {
    display: inline-block;
    width: 14px;
    height: 3px;
    border-radius: 2px;
    vertical-align: middle;
    margin-right: 4px;
}

.wx-relations {
    margin-top: 10px;
    text-align: left;
}

.wx-relations p {
    margin: 0 0 6px;
    color: var(--ink);
    font-size: 13px;
    line-height: 1.75;
}

.wx-relations p:last-child {
    margin-bottom: 0;
}

.wx-relations b {
    font-weight: 800;
}

.wx-tag {
    display: inline-block;
    margin-right: 6px;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
}

.wx-tag-sheng {
    background: rgba(42, 168, 137, 0.16);
    color: #0f5f4e;
}

.wx-tag-ke {
    background: rgba(197, 107, 74, 0.16);
    color: #b0472f;
}

.hehun-wuxing {
    margin-top: 12px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf7;
}

.hehun-wuxing h4 {
    margin: 0 0 12px;
    font-size: 15px;
    color: var(--ink);
}

.hehun-wuxing-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 24px;
}

.hehun-wx-name {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 800;
    color: #7c6a44;
}

.hehun-wuxing .hehun-diagram-note {
    margin-top: 12px;
}

@media (max-width: 680px) {
    .hehun-wuxing-cols {
        grid-template-columns: 1fr;
    }
}

.hehun-dims {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

@media (max-width: 680px) {
    .hehun-diagrams {
        grid-template-columns: 1fr;
    }
}

.hehun-dim {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf7;
}

.hehun-dim-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.hehun-dim-head h4 {
    margin: 0;
    font-size: 16px;
    color: var(--ink);
}

.hehun-dim p {
    margin: 0;
    color: var(--ink);
    font-size: 14px;
    line-height: 1.72;
}

.hehun-chip {
    flex: 0 0 auto;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.hehun-chip.is-good {
    background: rgba(42, 168, 137, 0.16);
    color: #0f5f4e;
}

.hehun-chip.is-mid {
    background: rgba(184, 141, 74, 0.16);
    color: #8a5a24;
}

.hehun-chip.is-warn {
    background: rgba(197, 107, 74, 0.16);
    color: #b0472f;
}

.hehun-note {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 8px;
    background: var(--paper-soft);
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
}

@media (max-width: 680px) {
    .hehun-form {
        grid-template-columns: 1fr;
    }

    .hehun-summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

@media (max-width: 980px) {
    .bazi-shell,
    .bazi-result {
        grid-template-columns: 1fr;
    }

    .bazi-shell {
        min-height: auto;
        padding-top: 112px;
    }

    .bazi-panel {
        max-width: 680px;
    }
}

@media (max-width: 680px) {
    .bazi-hero {
        min-height: auto;
    }

    .bazi-shell {
        padding: 152px 0 84px;
    }

    .bazi-form,
    .pillar-grid,
    .bazi-cards {
        grid-template-columns: 1fr;
    }

    .bazi-cards article:first-child,
    .bazi-cards article:last-child {
        grid-column: auto;
    }

    .branch-mark {
        transform: rotate(var(--angle)) translate(118px) rotate(calc(-1 * var(--angle)));
    }

    .stem-mark {
        transform: rotate(var(--angle)) translate(78px) rotate(calc(-1 * var(--angle)));
    }
}
