/* ==========================================================================
   name48 — public design system
   Modern almanac: celadon paper, ink, cinnabar, brass. One bold element: the
   five-grid board. Everything else stays quiet.
   ========================================================================== */

:root {
    --ink: #13211e;
    --ink-2: #1d302a;
    --ink-3: #2c443b;
    --paper: #eef1e9;
    --paper-2: #f5f4ec;
    --panel: #fbfaf4;
    --panel-2: #f2f1e7;
    --line: rgba(19, 33, 30, .14);
    --line-2: rgba(19, 33, 30, .27);
    --muted: #5f6f67;
    --muted-2: #89958e;
    --cinnabar: #b23a2b;
    --cinnabar-2: #922e22;
    --cinnabar-soft: #f6e6df;
    --brass: #a5813f;
    --jade: #50776a;
    --blue: #3d6680;
    --radius: 5px;
    --radius-lg: 8px;
    --shadow: 0 24px 60px rgba(19, 33, 30, .13);
    --shadow-soft: 0 10px 30px rgba(19, 33, 30, .07);
    --serif: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
    --sans: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --max: 1180px;
    --header-h: 78px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.75;
    color: var(--ink);
    background-color: var(--paper);
    background-image:
        linear-gradient(rgba(19, 33, 30, .026) 1px, transparent 1px),
        linear-gradient(90deg, rgba(19, 33, 30, .026) 1px, transparent 1px);
    background-size: 64px 64px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background:
        radial-gradient(ellipse 70% 45% at 12% 0%, rgba(80, 119, 106, .10), transparent 60%),
        radial-gradient(ellipse 55% 40% at 100% 8%, rgba(165, 129, 63, .07), transparent 65%);
}

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 .6em;
    font-family: var(--serif);
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: .015em;
    color: var(--ink);
}

p {
    margin: 0 0 1em;
}

a {
    color: var(--ink);
    text-decoration: none;
    text-underline-offset: .18em;
    transition: color .18s ease, border-color .18s ease, background-color .18s ease, opacity .18s ease;
}

a:hover {
    color: var(--cinnabar);
}

img {
    max-width: 100%;
    height: auto;
}

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

::selection {
    background: var(--cinnabar);
    color: #fff;
}

:focus-visible {
    outline: 2px solid var(--cinnabar);
    outline-offset: 3px;
}

.container-site {
    width: 100%;
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 28px;
}

.skip-link {
    position: absolute;
    left: 16px;
    top: -80px;
    z-index: 200;
    padding: 10px 16px;
    background: var(--ink);
    color: var(--paper);
    border-radius: 3px;
    transition: top .18s ease;
}

.skip-link:focus {
    top: 16px;
    color: var(--paper);
}

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

.visually-hidden-file {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   Type & shared elements
   -------------------------------------------------------------------------- */

.section-kicker {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 18px;
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: .12em;
    color: var(--muted);
}

.section-kicker::before {
    content: "";
    width: 24px;
    height: 1px;
    background: var(--cinnabar);
}

.section-lede {
    color: var(--muted);
    font-size: 15px;
    line-height: 1.8;
    max-width: 36em;
}

.text-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0;
    border: 0;
    background: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--cinnabar);
    cursor: pointer;
    border-bottom: 1px solid transparent;
}

.text-link:hover {
    color: var(--cinnabar-2);
    border-bottom-color: currentColor;
}

.text-link i {
    font-size: 12px;
    transition: transform .18s ease;
}

.text-link:hover i {
    transform: translateX(3px);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 3px;
    border: 1px solid transparent;
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: .035em;
    line-height: 1.4;
    cursor: pointer;
    text-align: center;
    transition: background-color .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn-cinnabar {
    background: var(--cinnabar);
    border-color: var(--cinnabar);
    color: #fff;
}

.btn-cinnabar:hover,
.btn-cinnabar:focus {
    background: var(--cinnabar-2);
    border-color: var(--cinnabar-2);
    color: #fff;
}

.btn-line {
    background: transparent;
    border-color: var(--line-2);
    color: var(--ink);
}

.btn-line:hover,
.btn-line:focus {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--paper);
}

.btn-paper {
    background: var(--paper);
    border-color: var(--paper);
    color: var(--ink);
}

.btn-paper:hover {
    background: #fff;
    border-color: #fff;
    color: var(--ink);
}

.btn-lg {
    padding: 15px 27px;
    font-size: 15px;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
}

.btn[disabled],
.btn.is-disabled,
a.btn.is-disabled {
    opacity: .45;
    pointer-events: none;
}

.btn-submit {
    position: relative;
    min-width: 132px;
}

.btn-loading {
    display: none;
}

.btn.is-loading .btn-label {
    visibility: hidden;
}

.btn.is-loading .btn-loading {
    display: inline-flex;
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    display: inline-block;
    animation: spin .7s linear infinite;
}

.spinner--dark {
    border-color: rgba(19, 33, 30, .18);
    border-top-color: var(--ink);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.req {
    color: var(--cinnabar);
}

.wx-jin { --wx: #a5813f; --wx-soft: #f5eddd; --wx-strong: #785a26; }
.wx-mu { --wx: #4d7a5c; --wx-soft: #e7f0e7; --wx-strong: #335a41; }
.wx-shui { --wx: #3d6680; --wx-soft: #e5eef3; --wx-strong: #274b63; }
.wx-huo { --wx: #b4462f; --wx-soft: #f8e8e2; --wx-strong: #872d1c; }
.wx-tu { --wx: #8a6a45; --wx-soft: #f2ece1; --wx-strong: #654a2c; }
.wx-neutral { --wx: var(--muted); --wx-soft: var(--panel-2); --wx-strong: var(--ink); }

.wx-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--wx);
    flex: 0 0 auto;
}

.wx-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border: 1px solid color-mix(in srgb, var(--wx) 34%, transparent);
    border-radius: 3px;
    background: var(--wx-soft);
    color: var(--wx-strong);
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

.rating-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
}

.rating-badge.is-ji { background: #e6f1e8; color: #2f6b50; }
.rating-badge.is-ji-xiong { background: #f7edda; color: #8b641d; }
.rating-badge.is-xiong-ji { background: #f3e7dc; color: #89572f; }
.rating-badge.is-xiong { background: #f8e4df; color: #a03a2b; }
.rating-badge.is-neutral { background: var(--panel-2); color: var(--muted); }

.notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    font-size: 14px;
    line-height: 1.7;
    color: var(--ink-2);
    margin: 20px 0;
}

.notice i {
    color: var(--cinnabar);
    font-size: 16px;
    margin-top: 2px;
}

.notice--warn {
    border-color: rgba(178, 58, 43, .28);
    background: #fbf0ec;
}

.notice--info {
    border-color: rgba(61, 102, 128, .25);
    background: #eef4f7;
}

.notice--info i {
    color: var(--blue);
}

.pre-line {
    white-space: pre-line;
}

/* --------------------------------------------------------------------------
   Header / navigation
   -------------------------------------------------------------------------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 80;
    background: rgba(238, 241, 233, .9);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.header-inner {
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.header-rule {
    display: block;
    height: 1px;
    background: var(--line);
    position: relative;
}

.header-rule::before {
    content: "";
    position: absolute;
    left: max(28px, calc((100vw - var(--max)) / 2 + 28px));
    top: 0;
    width: 64px;
    height: 1px;
    background: var(--cinnabar);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--ink);
}

.brand:hover {
    color: var(--ink);
}

.brand-seal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--ink);
    color: var(--paper);
    font-family: var(--serif);
    font-size: 17px;
    font-weight: 600;
    letter-spacing: .02em;
    box-shadow: inset 0 0 0 2px var(--cinnabar);
    border-radius: 2px;
    flex: 0 0 auto;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-name {
    font-family: var(--serif);
    font-size: 20px;
    font-weight: 600;
    letter-spacing: .02em;
}

.brand-sub {
    margin-top: 3px;
    font-size: 10px;
    letter-spacing: .2em;
    color: var(--muted);
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 30px;
}

.site-nav > a {
    position: relative;
    padding: 6px 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink-2);
}

.site-nav > a:not(.nav-cta)::after {
    content: "";
    position: absolute;
    left: 0;
    right: 100%;
    bottom: 0;
    height: 1px;
    background: var(--cinnabar);
    transition: right .2s ease;
}

.site-nav > a:not(.nav-cta):hover::after,
.site-nav > a.ia-active::after,
.site-nav > a.is-active::after {
    right: 0;
}

.site-nav > a:hover {
    color: var(--ink);
}

.nav-cta {
    padding: 10px 18px !important;
    border: 1px solid var(--ink);
    border-radius: 3px;
    background: var(--ink);
    color: var(--paper) !important;
    font-size: 13px !important;
}

.nav-cta:hover {
    background: var(--cinnabar);
    border-color: var(--cinnabar);
}

.nav-toggle {
    display: none;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line-2);
    border-radius: 3px;
    background: transparent;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.nav-toggle-lines,
.nav-toggle-lines::before,
.nav-toggle-lines::after {
    display: block;
    width: 18px;
    height: 1px;
    background: var(--ink);
    transition: transform .2s ease, opacity .2s ease;
    position: relative;
}

.nav-toggle-lines::before,
.nav-toggle-lines::after {
    content: "";
    position: absolute;
    left: 0;
}

.nav-toggle-lines::before { top: -6px; }
.nav-toggle-lines::after { top: 6px; }

.nav-toggle[aria-expanded="true"] .nav-toggle-lines {
    background: transparent;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-lines::before {
    top: 0;
    transform: rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-lines::after {
    top: 0;
    transform: rotate(-45deg);
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
    position: relative;
    padding: 76px 0 58px;
    overflow: hidden;
}

.hero-wash {
    position: absolute;
    top: -180px;
    right: -120px;
    width: 720px;
    height: 720px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(80, 119, 106, .12), rgba(80, 119, 106, 0) 65%);
    pointer-events: none;
}

.hero-grid {
    position: relative;
    display: grid;
    grid-template-columns: 1.02fr .98fr;
    gap: 62px;
    align-items: center;
}

.hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 24px;
    padding: 7px 12px 7px 10px;
    border: 1px solid var(--line-2);
    border-radius: 2px;
    font-size: 12px;
    letter-spacing: .12em;
    color: var(--ink-2);
    background: rgba(251, 250, 244, .55);
}

.kicker-dot {
    width: 6px;
    height: 6px;
    background: var(--cinnabar);
    border-radius: 50%;
}

.hero h1 {
    margin: 0 0 24px;
    font-size: clamp(3rem, 6.2vw, 5.15rem);
    font-weight: 600;
    line-height: 1.14;
    letter-spacing: .01em;
}

.hero-h1-tail {
    position: relative;
    isolation: isolate;
    white-space: nowrap;
}

.hero-h1-tail::after {
    content: "";
    position: absolute;
    left: .04em;
    right: .02em;
    bottom: .09em;
    height: .11em;
    background: rgba(178, 58, 43, .22);
    z-index: -1;
}

.hero-sub {
    max-width: 33em;
    font-size: 17px;
    line-height: 1.85;
    color: var(--muted);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 30px 0 26px;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin: 0;
    padding: 14px 0 0;
    border-top: 1px solid var(--line);
    list-style: none;
    font-size: 13px;
    color: var(--ink-2);
}

.hero-meta li {
    padding: 0 18px;
    border-left: 1px solid var(--line);
}

.hero-meta li:first-child {
    padding-left: 0;
    border-left: 0;
}

.hero-fineprint {
    margin: 16px 0 0;
    font-size: 12px;
    color: var(--muted-2);
    letter-spacing: .02em;
}

.hero-card-wrap {
    position: relative;
}

.hero-card {
    position: relative;
    isolation: isolate;
    padding: 28px 28px 24px;
    border-radius: var(--radius-lg);
    background:
        radial-gradient(ellipse 85% 70% at 90% 0%, rgba(165, 129, 63, .16), transparent 55%),
        radial-gradient(ellipse 70% 60% at 0% 100%, rgba(80, 119, 106, .18), transparent 60%),
        linear-gradient(152deg, #1a2d27 0%, #0d1a17 72%);
    color: var(--paper);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.hero-card::after {
    content: "";
    position: absolute;
    inset: 10px;
    border: 1px solid rgba(238, 241, 233, .12);
    border-radius: 4px;
    pointer-events: none;
}

.hero-watermark {
    position: absolute;
    z-index: -1;
    top: -62px;
    right: -18px;
    font-family: var(--serif);
    font-size: 240px;
    line-height: 1;
    color: rgba(238, 241, 233, .035);
    pointer-events: none;
    user-select: none;
}

.hero-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.hero-card-label {
    font-family: var(--serif);
    font-size: 14px;
    letter-spacing: .16em;
    color: rgba(238, 241, 233, .68);
}

.hero-card-badge {
    padding: 3px 8px;
    border: 1px solid rgba(238, 241, 233, .2);
    border-radius: 2px;
    font-size: 10px;
    letter-spacing: .12em;
    color: rgba(238, 241, 233, .62);
}

.hero-card-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 14px;
    padding: 0 4px;
    font-size: 11px;
    color: var(--muted);
}

.hero-card-foot i {
    margin-right: 4px;
    color: var(--brass);
}

.mini-empty {
    padding: 32px 0;
    text-align: center;
    color: rgba(238, 241, 233, .7);
    font-size: 14px;
}

.mini-result-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(238, 241, 233, .14);
}

.mini-name-wrap {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.mini-label {
    font-size: 11px;
    letter-spacing: .12em;
    color: rgba(238, 241, 233, .5);
}

.mini-name {
    font-family: var(--serif);
    font-size: 34px;
    font-weight: 600;
    letter-spacing: .08em;
    color: var(--paper);
}

.mini-strokes {
    font-size: 11px;
    color: rgba(238, 241, 233, .5);
    letter-spacing: .04em;
}

.mini-grids {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 7px;
}

.mini-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 4px 9px;
    border: 1px solid rgba(238, 241, 233, .13);
    border-radius: 3px;
    background: rgba(238, 241, 233, .035);
    text-align: center;
}

.mini-grid.is-primary {
    border-color: rgba(238, 241, 233, .35);
    background: rgba(238, 241, 233, .09);
}

.mini-grid-label {
    font-size: 10px;
    color: rgba(238, 241, 233, .52);
    letter-spacing: .08em;
}

.mini-grid b {
    font-family: var(--serif);
    font-size: 23px;
    font-weight: 600;
    line-height: 1.15;
    color: var(--paper);
}

.mini-grid b.wx-jin { color: #d6b776; }
.mini-grid b.wx-mu { color: #9dc7a8; }
.mini-grid b.wx-shui { color: #96c0d8; }
.mini-grid b.wx-huo { color: #e7a28f; }
.mini-grid b.wx-tu { color: #cbb08a; }

.mini-grid em {
    font-style: normal;
    font-size: 10px;
    color: rgba(238, 241, 233, .62);
}

.mini-grid.is-ji em { color: #9ed2ae; }
.mini-grid.is-ji-xiong em { color: #e6c37e; }
.mini-grid.is-xiong-ji em { color: #ddb08b; }
.mini-grid.is-xiong em { color: #e89b8b; }

.mini-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    padding-top: 13px;
    border-top: 1px solid rgba(238, 241, 233, .14);
    font-size: 12px;
}

.mini-summary-state {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: rgba(238, 241, 233, .78);
}

.mini-summary-state.is-perfect {
    color: #a9d8b7;
}

.mini-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.mini-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: rgba(238, 241, 233, .8);
    border-bottom: 1px solid rgba(238, 241, 233, .25);
    padding-bottom: 1px;
}

.mini-link:hover {
    color: #fff;
    border-color: #fff;
}

.hero-mini-form {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid rgba(238, 241, 233, .14);
}

.hero-mini-row {
    display: flex;
    gap: 8px;
}

.hero-mini-row .form-control {
    flex: 1;
    background: rgba(238, 241, 233, .07);
    border-color: rgba(238, 241, 233, .22);
    color: var(--paper);
    height: 44px;
    padding: 10px 13px;
}

.hero-mini-row .form-control::placeholder {
    color: rgba(238, 241, 233, .4);
}

.hero-mini-row .form-control:focus {
    background: rgba(238, 241, 233, .1);
    border-color: rgba(238, 241, 233, .5);
    box-shadow: 0 0 0 3px rgba(238, 241, 233, .1);
}

.hero-mini-row .btn {
    white-space: nowrap;
    height: 44px;
    padding: 0 18px;
}

.hero-mini-help {
    margin: 8px 0 0;
    font-size: 10px;
    color: rgba(238, 241, 233, .42);
}

/* --------------------------------------------------------------------------
   Ads
   -------------------------------------------------------------------------- */

.ad-wrap {
    margin-top: 26px;
    margin-bottom: 10px;
}

.ad-wrap--bottom {
    margin-top: 0;
    margin-bottom: 40px;
}

.ad-slot {
    padding: 18px 0 16px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.ad-slot-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 9px;
}

.ad-label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .16em;
    color: var(--muted-2);
}

.ad-slot-note {
    font-size: 10px;
    color: var(--muted-2);
    letter-spacing: .06em;
}

.ad-grid {
    display: grid;
    gap: 12px;
}

.ad-grid:has(> :nth-child(2)) {
    grid-template-columns: 1fr 1fr;
}

.ad-card {
    display: block;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--panel);
    color: var(--ink);
}

.ad-card:hover {
    border-color: var(--line-2);
    color: var(--ink);
}

.ad-card img {
    display: block;
    width: 100%;
    max-height: 190px;
    object-fit: cover;
    background: var(--panel-2);
}

.ad-slot--tool-sidebar .ad-card img {
    max-height: none;
    object-fit: contain;
}

.ad-caption {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 11px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    color: var(--ink-2);
}

.ad-caption em {
    font-style: normal;
    font-size: 10px;
    color: var(--muted-2);
    white-space: nowrap;
}

.ad-slot--empty {
    border-style: dashed;
    background: rgba(251, 250, 244, .5);
}

.ad-placeholder {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 22px;
    padding: 4px 0;
}

.ad-placeholder p {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.ad-placeholder a {
    font-size: 13px;
    color: var(--cinnabar);
    border-bottom: 1px solid rgba(178, 58, 43, .3);
}

.ad-placeholder-note {
    font-size: 12px;
    color: var(--muted-2);
}

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

.section {
    padding: 86px 0;
}

.section--tight {
    padding: 56px 0;
}

.section--process {
    padding-top: 72px;
    border-top: 1px solid var(--line);
}

.section-head {
    margin-bottom: 42px;
}

.section-head h2 {
    margin: 0;
    font-size: clamp(2rem, 3.7vw, 3rem);
    line-height: 1.22;
}

.section-head--split {
    display: grid;
    grid-template-columns: 1.25fr .75fr;
    gap: 50px;
    align-items: end;
}

.section-head--split .section-lede {
    margin: 0 0 4px;
}

.process-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 38px;
}

.process-step {
    position: relative;
    padding-top: 26px;
    border-top: 1px solid var(--line-2);
}

.process-num {
    position: absolute;
    top: -23px;
    left: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line-2);
    background: var(--paper);
    border-radius: 2px;
    font-family: var(--serif);
    font-size: 18px;
    color: var(--cinnabar);
}

.process-step h3 {
    margin: 18px 0 10px;
    font-size: 1.55rem;
}

.process-step p {
    margin-bottom: 18px;
    color: var(--muted);
    font-size: 14.5px;
    line-height: 1.85;
}

.process-note {
    margin-top: 38px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    font-size: 13px;
    color: var(--muted);
}

.process-note a {
    color: var(--cinnabar);
    border-bottom: 1px solid rgba(178, 58, 43, .3);
}

/* Tools */

.section--tools {
    border-top: 1px solid var(--line);
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    border-top: 1px solid var(--line-2);
}

.tool-block {
    position: relative;
    padding: 38px 30px 36px;
    border-right: 1px solid var(--line);
    overflow: hidden;
}

.tool-block:first-child {
    padding-left: 0;
}

.tool-block:last-child {
    padding-right: 0;
    border-right: 0;
}

.tool-mark {
    position: absolute;
    top: 4px;
    right: 12px;
    font-family: var(--serif);
    font-size: 96px;
    line-height: 1;
    color: rgba(19, 33, 30, .035);
    user-select: none;
    pointer-events: none;
}

.tool-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line-2);
    border-radius: 50%;
    color: var(--cinnabar);
    font-size: 16px;
    margin-bottom: 18px;
    background: var(--paper);
}

.tool-block h3 {
    font-size: 1.6rem;
    margin-bottom: 12px;
}

.tool-block p {
    min-height: 5.4em;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.85;
}

.tool-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding-bottom: 2px;
    font-size: 14px;
    font-weight: 500;
    color: var(--cinnabar);
    border-bottom: 1px solid rgba(178, 58, 43, .35);
}

.tool-link::after {
    content: "→";
    font-size: 14px;
    transition: transform .18s ease;
}

.tool-link:hover::after {
    transform: translateX(3px);
}

/* Five-grid explainer */

.section--grid-explainer {
    border-top: 1px solid var(--line);
    background: rgba(251, 250, 244, .45);
}

.grid-explainer {
    display: grid;
    grid-template-columns: .8fr 1.2fr;
    gap: 56px;
    align-items: center;
}

.grid-explainer-copy h2 {
    font-size: clamp(2rem, 3.4vw, 2.7rem);
    margin-bottom: 18px;
}

.grid-explainer-copy > p {
    color: var(--muted);
    font-size: 15px;
    line-height: 1.9;
}

.grid-roles {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    margin: 26px 0 30px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.grid-roles > div {
    padding: 11px 10px;
    border-left: 1px solid var(--line);
}

.grid-roles > div:first-child {
    border-left: 0;
    padding-left: 0;
}

.grid-roles dt {
    font-family: var(--serif);
    font-size: 16px;
    font-weight: 600;
}

.grid-roles dd {
    margin: 2px 0 0;
    font-size: 10px;
    color: var(--muted-2);
    letter-spacing: .04em;
}

.example-board {
    padding: 24px;
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow-soft);
}

.example-board-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.example-label {
    display: block;
    font-size: 10px;
    letter-spacing: .16em;
    color: var(--muted-2);
    margin-bottom: 3px;
}

.example-name {
    font-family: var(--serif);
    font-size: 26px;
    font-weight: 600;
    letter-spacing: .06em;
}

.example-strokes {
    font-size: 11px;
    color: var(--muted-2);
}

.example-grids {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
}

.example-grids .grid-card {
    padding: 13px 11px;
    border-radius: 3px;
    background: var(--paper-2);
}

.example-grids .grid-card-head {
    display: block;
}

.example-grids .grid-role {
    display: block;
    margin-top: 2px;
    font-size: 9px;
}

.example-grids .grid-number-line {
    margin-top: 10px;
}

.example-grids .grid-number {
    font-size: 28px;
}

.example-grids .grid-rating-line {
    margin-top: 6px;
}

.example-grids .rating-badge {
    font-size: 10px;
    padding: 2px 6px;
}

.example-grids .grid-desc {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 8px;
    font-size: 11px;
    line-height: 1.6;
}

.example-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: 12px;
}

.example-summary-badge {
    padding: 4px 9px;
    border-radius: 3px;
    background: var(--panel-2);
    color: var(--ink-2);
    font-weight: 500;
}

.example-summary-badge.is-perfect {
    background: #e6f1e8;
    color: #2f6b50;
}

.example-sancai {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--muted);
}

.example-summary .text-link {
    margin-left: auto;
}

.grid-card {
    display: flex;
    flex-direction: column;
    padding: 19px 18px 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    min-width: 0;
    position: relative;
}

.grid-card.is-primary {
    border-color: rgba(178, 58, 43, .35);
    box-shadow: inset 0 2px 0 var(--cinnabar);
}

.grid-card.is-primary::after {
    content: "主";
    position: absolute;
    top: 12px;
    right: 12px;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(178, 58, 43, .35);
    border-radius: 2px;
    color: var(--cinnabar);
    font-family: var(--serif);
    font-size: 10px;
}

.grid-card-head {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding-right: 22px;
}

.grid-label {
    font-family: var(--serif);
    font-size: 17px;
    font-weight: 600;
    white-space: nowrap;
}

.grid-role {
    font-size: 10px;
    color: var(--muted-2);
    letter-spacing: .02em;
    white-space: nowrap;
    margin-top: 1px;
}

.grid-number-line {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 16px;
}

.grid-number {
    font-family: var(--serif);
    font-size: 42px;
    font-weight: 600;
    line-height: 1;
    color: var(--wx, var(--ink));
}

.grid-rating-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin-top: 9px;
}

.grid-norm {
    font-size: 10px;
    color: var(--muted-2);
}

.grid-desc {
    margin: 11px 0 0;
    font-family: var(--serif);
    font-size: 13px;
    line-height: 1.7;
    color: var(--ink-2);
}

/* Story */

.section--story {
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background:
        linear-gradient(90deg, rgba(165, 129, 63, .06), transparent 35%),
        rgba(251, 250, 244, .5);
}

.story-grid {
    display: grid;
    grid-template-columns: .9fr 1.1fr;
    gap: 64px;
    align-items: center;
}

.story-copy h2 {
    font-size: clamp(2.2rem, 4vw, 3.3rem);
    margin-bottom: 22px;
}

.story-copy p {
    max-width: 34em;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.9;
}

.story-timeline {
    border-top: 1px solid var(--line-2);
}

.story-row {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 8px 22px;
    padding: 20px 0;
    border-bottom: 1px solid var(--line);
    align-items: baseline;
}

.story-row.is-now {
    position: relative;
    padding-left: 18px;
    border-left: 2px solid var(--cinnabar);
    background: linear-gradient(90deg, rgba(178, 58, 43, .055), transparent 80%);
}

.story-method {
    font-size: 11px;
    letter-spacing: .1em;
    color: var(--muted-2);
}

.story-row strong {
    font-family: var(--serif);
    font-size: 27px;
    font-weight: 600;
    letter-spacing: .02em;
}

.story-row.is-now strong {
    color: var(--cinnabar);
}

.story-detail {
    grid-column: 2;
    font-size: 12px;
    color: var(--muted);
}

.story-note {
    margin: 16px 0 0;
    font-size: 11px;
    color: var(--muted-2);
}

/* Bazi sample */

.section--bazi-sample {
    padding-top: 78px;
    padding-bottom: 78px;
}

.bazi-sample-grid {
    display: grid;
    grid-template-columns: .8fr 1.2fr;
    gap: 56px;
    align-items: center;
}

.bazi-sample-copy h2 {
    font-size: clamp(2rem, 3.4vw, 2.7rem);
    margin-bottom: 18px;
}

.bazi-sample-copy > p {
    color: var(--muted);
    font-size: 15px;
    line-height: 1.9;
}

.fav-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin: 22px 0 26px;
    font-size: 12px;
}

.fav-label {
    font-size: 10px;
    letter-spacing: .12em;
    color: var(--muted-2);
    margin-right: 2px;
}

.fav-role {
    font-size: 11px;
    color: var(--muted);
    margin-right: 8px;
}

.bazi-sample-board {
    padding: 24px;
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow-soft);
}

.bazi-sample-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.bazi-sample-meta {
    font-size: 11px;
    color: var(--muted-2);
}

.sample-read {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.sample-read-main {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 12px;
    align-items: baseline;
}

.sample-read-label {
    grid-column: 1 / -1;
    font-size: 10px;
    letter-spacing: .12em;
    color: var(--muted-2);
}

.sample-read-dm {
    font-family: var(--serif);
    font-size: 30px;
    font-weight: 600;
    color: var(--cinnabar);
}

.sample-read-image {
    font-size: 12px;
    color: var(--muted);
}

.sample-strength {
    align-self: center;
}

.strength-bar {
    display: flex;
    width: 100%;
    height: 8px;
    border-radius: 2px;
    overflow: hidden;
    background: var(--panel-2);
    gap: 2px;
}

.strength-support {
    display: block;
    background: var(--jade);
    border-radius: 2px 0 0 2px;
}

.strength-oppose {
    display: block;
    background: #c8b18a;
    border-radius: 0 2px 2px 0;
}

.sample-strength p {
    margin: 7px 0 0;
    font-size: 11px;
    color: var(--muted);
}

.sample-note {
    margin: 14px 0 0;
    font-size: 10px;
    color: var(--muted-2);
}

/* FAQ */

.section--faq {
    border-top: 1px solid var(--line);
}

.faq-wrap {
    display: grid;
    grid-template-columns: .65fr 1.35fr;
    gap: 60px;
    align-items: start;
}

.faq-list {
    border-top: 1px solid var(--line-2);
}

.faq-item {
    border-bottom: 1px solid var(--line);
}

.faq-item summary {
    position: relative;
    padding: 20px 42px 20px 0;
    font-family: var(--serif);
    font-size: 17px;
    font-weight: 500;
    cursor: pointer;
    list-style: none;
    color: var(--ink);
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: "+";
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--sans);
    font-size: 20px;
    font-weight: 400;
    color: var(--cinnabar);
    transition: transform .2s ease;
}

.faq-item[open] summary::after {
    content: "−";
}

.faq-answer {
    padding: 0 42px 20px 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.9;
}

.faq-answer p {
    margin-bottom: 0;
}

.faq-answer a {
    color: var(--cinnabar);
    border-bottom: 1px solid rgba(178, 58, 43, .3);
}

/* Closing */

.closing {
    position: relative;
    padding: 96px 0 82px;
    border-top: 1px solid var(--line);
    overflow: hidden;
}

.closing-inner {
    position: relative;
    text-align: center;
}

.closing-seal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -54%);
    font-family: var(--serif);
    font-size: clamp(220px, 28vw, 380px);
    line-height: 1;
    color: rgba(19, 33, 30, .045);
    z-index: 0;
    pointer-events: none;
    user-select: none;
}

.closing-inner .section-kicker {
    justify-content: center;
    position: relative;
    z-index: 1;
}

.closing h2 {
    position: relative;
    z-index: 1;
    margin: 0 0 30px;
    font-size: clamp(2.4rem, 5vw, 4rem);
    line-height: 1.2;
}

.closing-actions {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.closing-note {
    position: relative;
    z-index: 1;
    margin: 22px 0 0;
    font-size: 12px;
    color: var(--muted-2);
    letter-spacing: .04em;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
    background: var(--ink);
    color: rgba(238, 241, 233, .72);
    padding: 64px 0 0;
    margin-top: 0;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.4fr .7fr .7fr .9fr;
    gap: 46px;
    padding-bottom: 46px;
}

.brand--footer .brand-seal {
    background: transparent;
    color: var(--paper);
    box-shadow: inset 0 0 0 1px rgba(238, 241, 233, .45);
}

.brand--footer .brand-name {
    color: var(--paper);
}

.brand--footer .brand-sub {
    color: rgba(238, 241, 233, .45);
}

.footer-brand p {
    max-width: 28em;
    margin: 18px 0 0;
    font-size: 13px;
    line-height: 1.85;
    color: rgba(238, 241, 233, .55);
}

.footer-col h2 {
    margin: 2px 0 16px;
    font-family: var(--sans);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .16em;
    color: rgba(238, 241, 233, .42);
}

.footer-col a {
    display: block;
    padding: 5px 0;
    font-size: 13px;
    color: rgba(238, 241, 233, .72);
}

.footer-col a:hover {
    color: #fff;
}

.footer-note p {
    margin: 0;
    font-size: 12px;
    line-height: 1.8;
    color: rgba(238, 241, 233, .5);
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding-top: 18px;
    padding-bottom: 22px;
    border-top: 1px solid rgba(238, 241, 233, .12);
}

.footer-bottom p {
    margin: 0;
    font-size: 10px;
    color: rgba(238, 241, 233, .4);
    line-height: 1.7;
}

.footer-mark {
    font-family: var(--serif);
    letter-spacing: .35em;
    color: rgba(238, 241, 233, .25) !important;
}

/* --------------------------------------------------------------------------
   Forms (shared)
   -------------------------------------------------------------------------- */

.form-label,
.field > label,
.field > legend {
    display: block;
    margin-bottom: 7px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: .03em;
    color: var(--ink-2);
}

.form-control,
.form-select {
    width: 100%;
    height: 46px;
    padding: 10px 13px;
    border: 1px solid var(--line-2);
    border-radius: 3px;
    background: #fffdf8;
    color: var(--ink);
    font-size: 15px;
    line-height: 1.4;
    transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
    appearance: none;
}

.form-control-lg {
    height: 54px;
    padding: 12px 16px;
    font-size: 18px;
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2313211e' stroke-width='1.4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
    padding-right: 36px;
}

.form-control::placeholder {
    color: #9aa49e;
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--jade);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(80, 119, 106, .12);
}

textarea.form-control {
    height: auto;
    min-height: 110px;
    resize: vertical;
}

.field {
    margin-bottom: 18px;
    min-width: 0;
}

.field-help {
    margin: 6px 0 0;
    font-size: 11px;
    line-height: 1.65;
    color: var(--muted-2);
}

.field-error {
    margin: 5px 0 0;
    font-size: 11px;
    color: var(--cinnabar);
}

.field-error:empty {
    display: none;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
}

.form-alert {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-top: 16px;
    padding: 11px 13px;
    border: 1px solid rgba(178, 58, 43, .28);
    border-radius: 3px;
    background: #fbf0ec;
    color: #8e2f23;
    font-size: 13px;
    line-height: 1.6;
}

.form-alert[hidden] {
    display: none;
}

.form-alert i {
    margin-top: 2px;
}

.name-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px auto;
    gap: 12px;
    align-items: end;
}

.name-input-row .form-select {
    height: 54px;
}

.name-input-submit .btn {
    height: 54px;
    white-space: nowrap;
}

.form-submit-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 6px;
}

.form-submit-note {
    font-size: 11px;
    color: var(--muted-2);
}

.check-line {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 13px;
    color: var(--ink-2);
    cursor: pointer;
    line-height: 1.6;
}

.check-line input {
    width: 16px;
    height: 16px;
    margin-top: 3px;
    accent-color: var(--cinnabar);
    flex: 0 0 auto;
}

.check-line--boxed {
    padding: 13px 15px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--paper-2);
}

.birth-fields {
    display: block;
}

.birth-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0 18px;
}

.gender-field {
    border: 0;
    padding: 0;
    margin: 0 0 18px;
}

.gender-options {
    display: flex;
    gap: 8px;
}

.gender-option {
    flex: 1;
    cursor: pointer;
}

.gender-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.gender-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 46px;
    border: 1px solid var(--line-2);
    border-radius: 3px;
    background: #fffdf8;
    font-family: var(--serif);
    font-size: 16px;
    color: var(--ink-2);
    transition: border-color .16s ease, background-color .16s ease, color .16s ease;
}

.gender-option input:checked + .gender-mark {
    border-color: var(--cinnabar);
    background: var(--cinnabar-soft);
    color: var(--cinnabar-2);
}

.gender-option input:focus-visible + .gender-mark {
    outline: 2px solid var(--cinnabar);
    outline-offset: 2px;
}

.birth-grid .is-muted {
    opacity: .5;
}

.segmented {
    display: flex;
    border: 1px solid var(--line-2);
    border-radius: 3px;
    overflow: hidden;
    background: #fffdf8;
}

.segmented label {
    flex: 1;
    cursor: pointer;
}

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

.segmented span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--ink-2);
    border-left: 1px solid var(--line);
    transition: background-color .16s ease, color .16s ease;
}

.segmented label:first-child span {
    border-left: 0;
}

.segmented input:checked + span {
    background: var(--ink);
    color: var(--paper);
}

.segmented input:focus-visible + span {
    outline: 2px solid var(--cinnabar);
    outline-offset: -3px;
}

.switch-field {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    color: var(--ink-2);
}

.switch-field input[type="checkbox"] {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 22px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}

.switch-track {
    position: relative;
    flex: 0 0 auto;
    display: inline-block;
    width: 38px;
    height: 22px;
    border-radius: 20px;
    background: #d8d8cf;
    transition: background-color .18s ease;
}

.switch-track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform .18s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
}

.switch-field input:checked + .switch-track {
    background: var(--jade);
}

.switch-field input:checked + .switch-track::after {
    transform: translateX(16px);
}

.switch-field input:focus-visible + .switch-track {
    outline: 2px solid var(--cinnabar);
    outline-offset: 3px;
}

.password-field {
    position: relative;
}

.password-input {
    position: relative;
}

.password-input .form-control {
    padding-right: 46px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 3px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.password-toggle:hover {
    color: var(--ink);
    background: var(--paper-2);
}

/* --------------------------------------------------------------------------
   Tool pages
   -------------------------------------------------------------------------- */

.tool-hero {
    padding: 64px 0 38px;
    border-bottom: 1px solid var(--line);
}

.tool-hero-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 50px;
    align-items: end;
}

.tool-hero h1 {
    font-size: clamp(2.4rem, 4.8vw, 3.9rem);
    line-height: 1.18;
    margin-bottom: 16px;
}

.tool-lede {
    max-width: 38em;
    margin: 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.9;
}

.tool-hero-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 7px;
    padding-bottom: 6px;
    font-size: 11px;
    color: var(--muted-2);
    letter-spacing: .06em;
    text-align: right;
}

.tool-hero-meta span {
    padding-right: 12px;
    border-right: 1px solid var(--line);
}

.tool-section {
    padding: 40px 0 80px;
}

.tool-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 318px;
    gap: 46px;
    align-items: start;
}

.tool-main {
    min-width: 0;
}

.tool-sidebar {
    position: sticky;
    top: calc(var(--header-h) + 22px);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.form-panel {
    padding: 28px;
    background: var(--panel);
    box-shadow: var(--shadow-soft);
}

.form-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.form-panel-head h2 {
    margin: 0;
    font-size: 1.35rem;
}

.sidebar-panel {
    padding: 22px;
}

.sidebar-panel h2 {
    margin: 0 0 14px;
    font-size: 1.15rem;
}

.sidebar-defs {
    margin: 0;
}

.sidebar-defs > div {
    padding: 10px 0;
    border-top: 1px solid var(--line);
}

.sidebar-defs > div:first-child {
    border-top: 0;
    padding-top: 0;
}

.sidebar-defs dt {
    font-family: var(--serif);
    font-size: 14px;
    font-weight: 600;
}

.sidebar-defs dd {
    margin: 2px 0 0;
    font-size: 12px;
    line-height: 1.7;
    color: var(--muted);
}

.sidebar-note p {
    margin-bottom: 10px;
    font-size: 12px;
    line-height: 1.8;
    color: var(--muted);
}

.sidebar-note p:last-child {
    margin-bottom: 0;
}

.sidebar-steps {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: sidebar-step;
}

.sidebar-steps li {
    position: relative;
    padding: 0 0 16px 30px;
    counter-increment: sidebar-step;
}

.sidebar-steps li::before {
    content: counter(sidebar-step, cjk-ideographic);
    position: absolute;
    left: 0;
    top: 1px;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line-2);
    border-radius: 2px;
    font-family: var(--serif);
    font-size: 10px;
    color: var(--cinnabar);
}

.sidebar-steps b {
    display: block;
    font-size: 13px;
    font-weight: 500;
}

.sidebar-steps span {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    line-height: 1.7;
    color: var(--muted);
}

.result-region {
    margin-top: 26px;
}

.result-empty {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    padding: 48px 30px;
    border: 1px dashed var(--line-2);
    border-radius: var(--radius);
    text-align: center;
    overflow: hidden;
    background: rgba(251, 250, 244, .4);
}

.result-empty-mark {
    position: absolute;
    font-family: var(--serif);
    font-size: 230px;
    line-height: 1;
    color: rgba(19, 33, 30, .045);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -52%);
    pointer-events: none;
    user-select: none;
}

.result-empty h2 {
    position: relative;
    margin: 0 0 8px;
    font-size: 1.35rem;
}

.result-empty p {
    position: relative;
    max-width: 30em;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.8;
}

.empty-example,
.empty-pillars {
    position: relative;
    display: flex;
    gap: 8px;
    margin-top: 22px;
}

.empty-example span,
.empty-pillars span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 2px;
    background: var(--panel);
    font-family: var(--serif);
    font-size: 13px;
    color: var(--muted-2);
}

.empty-pillars span {
    width: 44px;
    height: 54px;
    font-size: 15px;
}

/* --------------------------------------------------------------------------
   Name result
   -------------------------------------------------------------------------- */

.report-panel {
    padding: 30px;
    box-shadow: var(--shadow-soft);
}

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

.report-kicker {
    display: block;
    font-size: 10px;
    letter-spacing: .16em;
    color: var(--muted-2);
    margin-bottom: 6px;
}

.report-name {
    margin: 0 0 6px;
    font-size: clamp(2rem, 4vw, 2.9rem);
    letter-spacing: .06em;
    line-height: 1.2;
}

.report-time {
    font-size: .5em;
    letter-spacing: .02em;
    color: var(--muted);
    font-weight: 500;
}

.report-sub {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.7;
}

.report-sep {
    margin: 0 7px;
    color: var(--line-2);
}

.report-verdict {
    flex: 0 0 auto;
    min-width: 138px;
    padding: 12px 15px;
    border: 1px solid var(--line-2);
    border-radius: 3px;
    background: var(--paper-2);
    text-align: center;
}

.report-verdict.is-perfect {
    border-color: rgba(47, 107, 80, .4);
    background: #eaf3eb;
}

.report-verdict.is-good {
    border-color: rgba(165, 129, 63, .4);
    background: #f8f1e2;
}

.report-verdict.is-mixed {
    border-color: rgba(178, 58, 43, .3);
    background: #fbf0ec;
}

.verdict-label {
    display: block;
    font-family: var(--serif);
    font-size: 17px;
    font-weight: 600;
    line-height: 1.3;
}

.verdict-count {
    display: block;
    margin-top: 4px;
    font-size: 10px;
    color: var(--muted);
}

.char-strokes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 18px 0;
    border-bottom: 1px solid var(--line);
}

.char-stroke {
    display: inline-flex;
    align-items: baseline;
    gap: 7px;
    padding: 7px 11px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--paper-2);
}

.char-stroke b {
    font-family: var(--serif);
    font-size: 22px;
    font-weight: 600;
    color: var(--wx, var(--ink));
}

.char-stroke em {
    font-style: normal;
    font-size: 10px;
    color: var(--muted);
}

.char-stroke small {
    font-size: 10px;
    color: var(--muted-2);
    padding-left: 6px;
    border-left: 1px solid var(--line);
}

.grid-cards {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    padding: 22px 0;
    border-bottom: 1px solid var(--line);
}

.report-lower {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    padding-top: 22px;
}

.report-summary h3,
.report-sancai h3,
.naming-notes h3,
.bazi-notes h3,
.form-section-title {
    margin: 0 0 12px;
    font-size: 1.05rem;
}

.rating-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.count-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
}

.count-chip b {
    font-size: 13px;
}

.count-chip.is-ji { background: #e6f1e8; color: #2f6b50; }
.count-chip.is-ji-xiong { background: #f7edda; color: #8b641d; }
.count-chip.is-xiong-ji { background: #f3e7dc; color: #89572f; }
.count-chip.is-xiong { background: #f8e4df; color: #a03a2b; }
.count-chip.is-zero { opacity: .4; }

.report-note {
    margin: 0;
    font-size: 11.5px;
    line-height: 1.8;
    color: var(--muted);
}

.sancai-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.sancai-cell {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--paper-2);
}

.sancai-cell small {
    font-size: 9px;
    color: var(--muted-2);
}

.sancai-arrow {
    font-family: var(--serif);
    font-size: 11px;
    color: var(--muted);
    padding: 0 2px;
}

.report-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

/* Missing characters */

.missing-panel {
    padding: 26px;
}

.missing-head {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.missing-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--cinnabar-soft);
    color: var(--cinnabar);
    flex: 0 0 auto;
}

.missing-head h2 {
    margin: 0 0 3px;
    font-size: 1.2rem;
}

.missing-head p {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.missing-chars {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.missing-char {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--paper-2);
    min-width: 110px;
}

.missing-glyph {
    font-family: var(--serif);
    font-size: 32px;
    line-height: 1.2;
    text-align: center;
}

.missing-char label {
    font-size: 10px;
    color: var(--muted-2);
}

.missing-char .form-control {
    height: 38px;
    font-size: 14px;
    padding: 6px 9px;
}

/* --------------------------------------------------------------------------
   Bazi result
   -------------------------------------------------------------------------- */

.bazi-report {
    --pillar-gap: 10px;
}

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

.pillar-card {
    padding: 16px 14px 14px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--paper-2);
    min-width: 0;
    position: relative;
}

.pillar-card.is-day-master {
    border-color: rgba(178, 58, 43, .35);
    background: #fbf0ec;
    box-shadow: inset 0 2px 0 var(--cinnabar);
}

.pillar-card.is-unknown {
    border-style: dashed;
    opacity: .7;
}

.pillar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 11px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.pillar-label {
    font-size: 10px;
    letter-spacing: .1em;
    color: var(--muted-2);
}

.pillar-god {
    font-size: 10px;
    color: var(--cinnabar);
    background: rgba(178, 58, 43, .08);
    padding: 1px 5px;
    border-radius: 2px;
    white-space: nowrap;
}

.pillar-glyphs {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.pillar-glyph {
    font-family: var(--serif);
    font-size: 40px;
    font-weight: 600;
    line-height: 1.15;
    color: var(--wx, var(--ink));
}

.pillar-glyphs.is-unknown-glyphs .pillar-glyph {
    color: var(--muted-2);
}

.pillar-meta {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 5px;
    font-size: 9px;
    color: var(--muted-2);
}

.pillar-hidden {
    margin-top: 11px;
    padding-top: 9px;
    border-top: 1px solid var(--line);
}

.hidden-label {
    display: block;
    font-size: 9px;
    color: var(--muted-2);
    margin-bottom: 5px;
}

.hidden-stems {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.hidden-stem {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
    font-family: var(--serif);
    font-size: 13px;
    color: var(--wx, var(--ink));
}

.hidden-stem em {
    font-family: var(--sans);
    font-style: normal;
    font-size: 8px;
    color: var(--muted-2);
}

.pillar-row.is-compact .pillar-card {
    padding: 12px 10px;
}

.pillar-row.is-compact .pillar-glyph {
    font-size: 28px;
}

.pillar-row.is-compact .pillar-head {
    margin-bottom: 7px;
    padding-bottom: 6px;
}

.daymaster-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin: 6px 0 24px;
    padding: 18px 22px;
    border-radius: 3px;
    background:
        radial-gradient(ellipse 70% 100% at 100% 0%, rgba(165, 129, 63, .18), transparent 60%),
        var(--ink);
    color: var(--paper);
}

.daymaster-main {
    display: flex;
    align-items: center;
    gap: 14px;
}

.daymaster-label {
    font-size: 10px;
    letter-spacing: .14em;
    color: rgba(238, 241, 233, .45);
    writing-mode: vertical-rl;
}

.daymaster-glyph {
    font-family: var(--serif);
    font-size: 54px;
    font-weight: 600;
    line-height: 1;
    color: var(--wx, var(--paper));
    text-shadow: 0 0 24px rgba(238, 241, 233, .06);
}

.daymaster-text strong {
    display: block;
    font-family: var(--serif);
    font-size: 19px;
    font-weight: 600;
}

.daymaster-text span {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: rgba(238, 241, 233, .58);
}

.daymaster-season {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 45%;
}

.season-phase {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(238, 241, 233, .25);
    border-radius: 50%;
    font-family: var(--serif);
    font-size: 18px;
    color: #e6c37e;
    flex: 0 0 auto;
}

.daymaster-season strong {
    display: block;
    font-size: 12px;
    font-weight: 500;
}

.daymaster-season div span {
    display: block;
    margin-top: 2px;
    font-size: 10px;
    line-height: 1.6;
    color: rgba(238, 241, 233, .55);
}

.bazi-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    padding: 22px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.bazi-block-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.bazi-block-head h3 {
    margin: 0;
    font-size: 1.05rem;
}

.bazi-block-meta {
    font-size: 10px;
    color: var(--muted-2);
    white-space: nowrap;
}

.element-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.element-bar-row {
    display: grid;
    grid-template-columns: 20px 1fr 24px;
    align-items: center;
    gap: 9px;
}

.element-bar-name {
    font-family: var(--serif);
    font-size: 13px;
    font-weight: 600;
    color: var(--wx, var(--ink));
}

.element-bar-track {
    height: 7px;
    border-radius: 2px;
    background: var(--panel-2);
    overflow: hidden;
}

.element-bar-fill {
    display: block;
    height: 100%;
    min-width: 2px;
    border-radius: 2px;
    background: var(--wx, var(--ink));
    transition: width .4s ease;
}

.element-bar-count {
    font-size: 12px;
    color: var(--muted);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.bazi-note {
    margin: 12px 0 0;
    font-size: 11px;
    line-height: 1.7;
    color: var(--muted);
}

.strength-meter-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 11px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.strength-bar--large {
    height: 13px;
}

.strength-summary {
    margin: 11px 0 0;
    font-size: 12px;
    line-height: 1.75;
    color: var(--ink-2);
}

.method-details {
    margin-top: 12px;
    border-top: 1px solid var(--line);
    padding-top: 10px;
}

.method-details summary {
    font-size: 11px;
    color: var(--muted);
    cursor: pointer;
}

.method-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 9px 0;
}

.method-grid span {
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 2px;
    background: var(--paper-2);
    font-size: 10px;
    color: var(--muted);
}

.method-grid b {
    color: var(--ink);
    font-weight: 500;
    margin-left: 3px;
    font-variant-numeric: tabular-nums;
}

.favorable-block {
    padding: 26px 0;
    border-bottom: 1px solid var(--line);
}

.fav-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 16px;
}

.fav-head h3 {
    margin: 0;
    font-size: 1.35rem;
}

.fav-head p {
    margin: 0;
    max-width: 34em;
    font-size: 12px;
    line-height: 1.7;
    color: var(--muted);
    text-align: right;
}

.fav-tiles {
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    gap: 12px;
}

.fav-tile {
    position: relative;
    padding: 20px 22px;
    border: 1px solid color-mix(in srgb, var(--wx) 25%, var(--line));
    border-radius: 3px;
    background: var(--wx-soft);
    overflow: hidden;
}

.fav-tile--primary {
    border-color: color-mix(in srgb, var(--wx) 45%, transparent);
    box-shadow: inset 0 2px 0 var(--wx);
}

.fav-tile-label {
    display: block;
    font-size: 10px;
    letter-spacing: .12em;
    color: var(--muted);
}

.fav-tile-element {
    display: block;
    margin: 4px 0 0;
    font-family: var(--serif);
    font-size: 34px;
    font-weight: 600;
    line-height: 1.15;
    color: var(--wx-strong, var(--wx));
}

.fav-tile-role {
    display: inline-block;
    margin-top: 3px;
    padding: 2px 6px;
    border: 1px solid color-mix(in srgb, var(--wx) 25%, transparent);
    border-radius: 2px;
    font-size: 10px;
    color: var(--wx-strong, var(--wx));
}

.fav-tile p {
    margin: 10px 0 0;
    font-size: 12px;
    line-height: 1.75;
    color: var(--ink-2);
    max-width: 34em;
}

.fav-avoid {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    font-size: 11px;
    color: var(--muted);
}

.fav-avoid > span:first-child {
    font-size: 10px;
    letter-spacing: .08em;
    color: var(--muted-2);
}

.avoid-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 7px;
    border: 1px solid var(--line);
    border-radius: 2px;
    background: var(--paper-2);
    color: var(--wx, var(--ink));
    font-size: 11px;
}

.avoid-chip em {
    font-style: normal;
    font-size: 9px;
    color: var(--muted-2);
}

.fav-avoid-note {
    font-size: 10px;
    color: var(--muted-2);
}

.fav-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.dayun-block {
    padding: 24px 0;
    border-bottom: 1px solid var(--line);
}

.dayun-scroll {
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
}

.dayun-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(92px, 1fr));
    gap: 8px;
    min-width: 760px;
}

.dayun-card {
    padding: 11px 9px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--paper-2);
    text-align: center;
}

.dayun-age {
    display: block;
    font-size: 9px;
    color: var(--muted-2);
    margin-bottom: 5px;
    white-space: nowrap;
}

.dayun-glyphs {
    display: flex;
    justify-content: center;
    gap: 4px;
    font-family: var(--serif);
    font-size: 17px;
    font-weight: 600;
}

.dayun-god {
    display: block;
    margin-top: 4px;
    font-size: 9px;
    color: var(--cinnabar);
}

.dayun-year {
    display: block;
    margin-top: 2px;
    font-size: 8px;
    color: var(--muted-2);
}

.bazi-notes {
    padding-top: 22px;
}

.bazi-notes ul {
    margin: 0 0 12px;
    padding-left: 18px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.85;
}

.bazi-notes li {
    margin-bottom: 3px;
}

/* --------------------------------------------------------------------------
   Naming form & result
   -------------------------------------------------------------------------- */

.naming-form-panel {
    padding: 0;
    overflow: visible;
}

.naming-form-panel > form {
    padding: 30px;
}

.form-step {
    padding: 24px 0;
    border-top: 1px solid var(--line);
}

.form-step:first-of-type {
    padding-top: 0;
    border-top: 0;
}

.form-step-head {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.form-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line-2);
    border-radius: 2px;
    font-family: var(--serif);
    font-size: 14px;
    color: var(--cinnabar);
    flex: 0 0 auto;
}

.form-step-head h2 {
    margin: 0 0 2px;
    font-size: 1.3rem;
}

.form-step-head p {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
}

.surname-field {
    position: relative;
}

.autocomplete-wrap {
    position: relative;
}

.autocomplete-list {
    position: absolute;
    z-index: 30;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--line-2);
    border-radius: 3px;
    background: var(--panel);
    box-shadow: var(--shadow-soft);
}

.autocomplete-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    border-top: 1px solid var(--line);
    background: transparent;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    color: var(--ink);
}

.autocomplete-item:first-child {
    border-top: 0;
}

.autocomplete-item:hover,
.autocomplete-item.is-active {
    background: var(--paper-2);
}

.autocomplete-item b {
    font-family: var(--serif);
    font-size: 16px;
    font-weight: 600;
}

.autocomplete-item span {
    font-size: 11px;
    color: var(--muted);
}

.autocomplete-empty {
    padding: 12px;
    font-size: 12px;
    color: var(--muted);
}

.surname-hint {
    margin: 7px 0 0;
    font-size: 11px;
    color: var(--muted);
}

.surname-hint.is-found {
    color: var(--jade);
}

.manual-surname {
    margin-top: 12px;
    border-top: 1px solid var(--line);
    padding-top: 10px;
}

.manual-surname summary {
    font-size: 11px;
    color: var(--muted);
    cursor: pointer;
}

.manual-surname-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 14px;
    margin-top: 12px;
}

.pref-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    align-items: start;
}

.tier-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    margin: 22px 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.tier-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
}

.tier-tab {
    position: relative;
    padding: 9px 14px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    font-family: var(--sans);
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
    transition: color .16s ease, border-color .16s ease;
}

.tier-tab:hover:not(:disabled) {
    color: var(--ink);
}

.tier-tab.is-active {
    color: var(--ink);
    border-bottom-color: var(--cinnabar);
}

.tier-tab:disabled {
    opacity: .35;
    cursor: not-allowed;
}

.tier-count {
    margin-left: 5px;
    font-size: 10px;
    color: var(--muted-2);
    font-variant-numeric: tabular-nums;
}

.tier-tab.is-active .tier-count {
    color: var(--cinnabar);
}

.tier-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 10px;
    color: var(--muted-2);
}

.naming-bazi-strip {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 20px;
    align-items: center;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--paper-2);
    margin-bottom: 20px;
}

.naming-bazi-strip .pillar-row {
    margin: 0;
}

.naming-bazi-read {
    padding-left: 20px;
    border-left: 1px solid var(--line);
}

.naming-dm {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 7px;
    font-size: 11px;
    color: var(--muted);
}

.naming-dm-label {
    font-size: 10px;
    letter-spacing: .1em;
    color: var(--muted-2);
}

.naming-dm strong {
    font-family: var(--serif);
    font-size: 21px;
    font-weight: 600;
}

.naming-dm span:last-child {
    font-size: 10px;
}

.naming-fav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
    font-size: 10px;
    color: var(--muted);
}

.naming-fav em {
    font-style: normal;
    margin-right: 6px;
}

.naming-missing {
    margin: 8px 0 0;
    font-size: 10px;
    color: var(--muted-2);
}

.combo-list {
    border-top: 1px solid var(--line);
}

.combo-row {
    display: grid;
    grid-template-columns: 150px minmax(0, 1.45fr) minmax(140px, .8fr) auto;
    gap: 18px;
    align-items: center;
    padding: 15px 4px;
    border-bottom: 1px solid var(--line);
    transition: background-color .16s ease;
}

.combo-row:hover {
    background: rgba(251, 250, 244, .65);
}

.combo-strokes {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.combo-strokes-label {
    font-size: 9px;
    letter-spacing: .1em;
    color: var(--muted-2);
}

.combo-strokes strong {
    font-family: var(--serif);
    font-size: 25px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: .02em;
}

.combo-strokes strong span {
    margin: 0 3px;
    font-size: 14px;
    color: var(--muted-2);
}

.combo-tier {
    font-size: 9px;
    color: var(--muted);
    margin-top: 1px;
}

.combo-row.is-all-ji .combo-tier {
    color: #2f6b50;
}

.combo-row.is-near .combo-tier {
    color: #9a6b1f;
}

.combo-grids {
    display: flex;
    gap: 5px;
    min-width: 0;
}

.combo-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    min-width: 0;
    flex: 1;
    padding: 5px 3px 4px;
    border: 1px solid var(--line);
    border-radius: 2px;
    background: var(--paper-2);
    text-align: center;
}

.combo-grid small {
    font-size: 8px;
    line-height: 1.3;
    color: var(--muted-2);
}

.combo-grid b {
    font-family: var(--serif);
    font-size: 17px;
    font-weight: 600;
    line-height: 1.25;
    color: var(--wx, var(--ink));
    font-variant-numeric: tabular-nums;
}

.combo-grid em {
    font-style: normal;
    font-size: 8px;
    line-height: 1.3;
    color: var(--muted);
    white-space: nowrap;
}

.combo-grid.is-ji { background: #eef6ef; border-color: #cfe3d3; }
.combo-grid.is-ji em { color: #2f6b50; }
.combo-grid.is-ji-xiong { background: #fbf3e4; border-color: #ead9b7; }
.combo-grid.is-ji-xiong em { color: #8b641d; }
.combo-grid.is-xiong-ji { background: #f7eee6; border-color: #e5d2c0; }
.combo-grid.is-xiong-ji em { color: #89572f; }
.combo-grid.is-xiong { background: #fbece8; border-color: #eccdc5; }
.combo-grid.is-xiong em { color: #a03a2b; }

.combo-fit {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    min-width: 0;
    font-size: 10px;
    color: var(--muted);
}

.fit-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 2px;
    background: #e6f1e8;
    color: #2f6b50;
    font-size: 9px;
    font-weight: 500;
    margin-bottom: 2px;
}

.fit-badge.is-primary {
    background: #dcebdd;
    color: #235a40;
}

.fit-line {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

.fit-line .wx-chip {
    min-width: 17px;
    height: 16px;
    padding: 0 3px;
    font-size: 9px;
    border-radius: 2px;
}

.combo-action {
    justify-self: end;
}

.combo-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding-top: 18px;
    font-size: 11px;
    color: var(--muted);
}

.combo-pagination .btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.naming-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 42px 20px;
    text-align: center;
    border-bottom: 1px solid var(--line);
}

.naming-empty-mark {
    font-family: var(--serif);
    font-size: 54px;
    color: rgba(19, 33, 30, .1);
    line-height: 1;
}

.naming-empty h3 {
    margin: 10px 0 4px;
    font-size: 1.2rem;
}

.naming-empty p {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
}

.naming-notes {
    padding-top: 22px;
}

.naming-notes ul {
    margin: 0 0 12px;
    padding-left: 18px;
    font-size: 11px;
    line-height: 1.8;
    color: var(--muted);
}

.naming-notes li {
    margin-bottom: 3px;
}

/* --------------------------------------------------------------------------
   Character modal
   -------------------------------------------------------------------------- */

.char-modal .modal-content {
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    background: var(--panel);
    color: var(--ink);
    box-shadow: var(--shadow);
}

.char-modal .modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--line);
    align-items: flex-start;
}

.modal-kicker {
    margin: 0 0 3px;
    font-size: 10px;
    letter-spacing: .14em;
    color: var(--muted-2);
}

.char-modal .modal-title {
    margin: 0;
    font-size: 1.4rem;
}

.modal-sub {
    margin: 3px 0 0;
    font-size: 11px;
    color: var(--muted);
}

.char-modal .btn-close {
    font-size: 10px;
    opacity: .6;
}

.char-modal .modal-body {
    padding: 20px 24px;
}

.char-modal .modal-footer {
    border-top: 1px solid var(--line);
    padding: 14px 24px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.char-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px 0;
    color: var(--muted);
    font-size: 12px;
}

.char-loading .spinner {
    border-color: rgba(19, 33, 30, .15);
    border-top-color: var(--cinnabar);
}

.char-position {
    padding: 18px 0;
    border-top: 1px solid var(--line);
}

.char-position:first-child {
    border-top: 0;
    padding-top: 0;
}

.char-position-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.char-position-head h3 {
    margin: 0;
    font-size: 1.05rem;
}

.char-position-head span {
    font-size: 11px;
    color: var(--muted);
}

.char-groups {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.char-group {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--paper-2);
}

.char-group-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 9px;
    font-size: 11px;
    color: var(--muted);
}

.char-group-head b {
    font-family: var(--serif);
    font-size: 13px;
    color: var(--ink);
    font-weight: 600;
}

.char-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.char-chip {
    position: relative;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 2px;
    background: #fffdf8;
    font-family: var(--serif);
    font-size: 21px;
    line-height: 1;
    color: var(--ink);
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}

.char-chip:hover {
    border-color: var(--cinnabar);
    background: var(--cinnabar-soft);
}

.char-chip.is-selected {
    border-color: var(--ink);
    background: var(--ink);
    color: var(--paper);
}

.char-chip.is-common::after {
    content: "";
    position: absolute;
    top: 4px;
    right: 4px;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--brass);
}

.char-chip.is-selected.is-common::after {
    background: #e6c37e;
}

.char-more {
    margin: 8px 0 0;
    font-size: 10px;
    color: var(--muted-2);
}

.char-empty {
    padding: 12px;
    font-size: 11px;
    color: var(--muted-2);
}

.char-error {
    padding: 24px;
    text-align: center;
    font-size: 12px;
    color: var(--cinnabar);
}

.char-selection {
    display: flex;
    align-items: baseline;
    gap: 7px;
    min-width: 0;
}

.char-selection-label {
    font-size: 9px;
    letter-spacing: .12em;
    color: var(--muted-2);
}

.char-selection-name {
    font-family: var(--serif);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: .06em;
    color: var(--ink);
}

.char-selection-name.is-empty {
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--muted-2);
}

.char-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.char-actions .btn.is-disabled {
    opacity: .4;
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   Static pages
   -------------------------------------------------------------------------- */

.static-hero {
    padding: 66px 0 40px;
    border-bottom: 1px solid var(--line);
}

.static-hero-inner h1 {
    max-width: 18em;
    margin: 0 0 18px;
    font-size: clamp(2.2rem, 4.6vw, 3.6rem);
    line-height: 1.25;
}

.static-lede {
    max-width: 40em;
    margin: 0;
    font-size: 15px;
    line-height: 1.9;
    color: var(--muted);
}

.static-layout {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 60px;
    align-items: start;
}

.static-aside {
    position: sticky;
    top: calc(var(--header-h) + 24px);
}

.static-aside-label {
    margin: 0 0 10px;
    font-size: 10px;
    letter-spacing: .14em;
    color: var(--muted-2);
}

.static-aside nav {
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--line);
}

.static-aside a {
    padding: 7px 0 7px 14px;
    margin-left: -1px;
    border-left: 1px solid transparent;
    font-size: 12px;
    color: var(--muted);
}

.static-aside a:hover {
    color: var(--ink);
    border-left-color: var(--cinnabar);
}

.static-body {
    max-width: 760px;
}

.static-section {
    padding: 0 0 36px;
    margin-bottom: 36px;
    border-bottom: 1px solid var(--line);
}

.static-section:last-of-type {
    border-bottom: 0;
}

.static-section h2 {
    font-size: 1.8rem;
    margin-bottom: 14px;
}

.static-section h3 {
    margin-top: 22px;
    margin-bottom: 8px;
    font-size: 1.2rem;
}

.static-section p,
.static-section li {
    font-size: 14px;
    line-height: 1.95;
    color: var(--ink-2);
}

.static-section a {
    color: var(--cinnabar);
    border-bottom: 1px solid rgba(178, 58, 43, .3);
}

.static-list {
    padding-left: 18px;
    margin: 12px 0;
}

.static-list li {
    margin-bottom: 5px;
}

.static-note {
    margin-top: 16px;
    padding: 12px 14px;
    border-left: 2px solid var(--brass);
    background: var(--paper-2);
    font-size: 12px !important;
    color: var(--muted) !important;
}

.static-tools {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 18px;
    margin-top: 16px;
}

.static-tools > div {
    padding-top: 14px;
    border-top: 1px solid var(--line-2);
}

.static-tools h3 {
    margin-top: 0;
    font-size: 1.05rem;
}

.static-tools p {
    margin: 0;
    font-size: 12px;
    line-height: 1.8;
    color: var(--muted);
}

.static-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

/* --------------------------------------------------------------------------
   Error & minimal layouts
   -------------------------------------------------------------------------- */

.page-minimal {
    background-image: none;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.minimal-shell {
    width: 100%;
    max-width: 760px;
}

.minimal-header {
    display: flex;
    justify-content: center;
    margin-bottom: 28px;
}

.minimal-main {
    width: 100%;
}

.error-wrap {
    display: flex;
    justify-content: center;
}

.error-card {
    width: 100%;
    padding: 48px;
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow-soft);
    text-align: center;
}

.error-status {
    font-family: var(--serif);
    font-size: clamp(4rem, 10vw, 7rem);
    line-height: 1;
    color: rgba(178, 58, 43, .22);
    letter-spacing: .04em;
    margin-bottom: 10px;
}

.error-card h1 {
    font-size: 1.8rem;
    margin-bottom: 12px;
}

.error-message {
    margin: 0 0 8px;
    font-size: 15px;
    color: var(--ink-2);
}

.error-copy {
    max-width: 32em;
    margin: 0 auto 22px;
    font-size: 13px;
    line-height: 1.8;
    color: var(--muted);
}

.error-detail {
    margin: 0 auto 22px;
    text-align: left;
    border-top: 1px solid var(--line);
    padding-top: 14px;
}

.error-detail summary {
    font-size: 11px;
    color: var(--muted);
    cursor: pointer;
}

.error-detail pre {
    margin: 10px 0 0;
    padding: 12px;
    background: var(--paper-2);
    border-radius: 3px;
    font-size: 10px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 280px;
    overflow: auto;
}

.error-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

/* --------------------------------------------------------------------------
   Toasts & confirm dialog
   -------------------------------------------------------------------------- */

.toast-stack {
    position: fixed;
    z-index: 300;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(380px, calc(100vw - 32px));
    pointer-events: none;
}

.toast-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 13px;
    border: 1px solid rgba(238, 241, 233, .12);
    border-radius: 4px;
    background: var(--ink);
    color: var(--paper);
    box-shadow: 0 12px 34px rgba(19, 33, 30, .24);
    font-size: 13px;
    line-height: 1.6;
    pointer-events: auto;
    animation: toast-in .24s ease both;
}

.toast-item.is-leaving {
    animation: toast-out .2s ease both;
}

.toast-dot {
    width: 7px;
    height: 7px;
    margin-top: 7px;
    border-radius: 50%;
    background: var(--brass);
    flex: 0 0 auto;
}

.toast-success .toast-dot { background: #8fd0a8; }
.toast-error .toast-dot { background: #e89b8b; }
.toast-warning .toast-dot { background: #e6c37e; }
.toast-info .toast-dot { background: #96c0d8; }

.toast-message {
    flex: 1;
    min-width: 0;
}

.toast-close {
    border: 0;
    background: transparent;
    color: rgba(238, 241, 233, .5);
    font-size: 18px;
    line-height: 1;
    padding: 0 2px;
    cursor: pointer;
}

.toast-close:hover {
    color: #fff;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
    to { opacity: 0; transform: translateY(-6px); }
}

.confirm-modal .modal-content {
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    background: var(--panel);
    color: var(--ink);
    box-shadow: var(--shadow);
}

.confirm-modal .modal-body {
    padding: 24px 24px 12px;
}

.confirm-modal .modal-title {
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.confirm-modal .confirm-message {
    margin: 0;
    font-size: 13px;
    line-height: 1.8;
    color: var(--muted);
}

.confirm-modal .modal-footer {
    border-top: 1px solid var(--line);
    padding: 14px 24px 20px;
    gap: 8px;
}

/* --------------------------------------------------------------------------
   Auth (login)
   -------------------------------------------------------------------------- */

.page-auth {
    background-image: none;
    background: var(--paper);
}

.auth-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}

.auth-aside {
    position: relative;
    background:
        radial-gradient(ellipse 80% 60% at 95% 5%, rgba(165, 129, 63, .2), transparent 55%),
        radial-gradient(ellipse 70% 60% at 0% 100%, rgba(80, 119, 106, .2), transparent 60%),
        linear-gradient(150deg, #1a2d27, #0b1815 78%);
    color: var(--paper);
    overflow: hidden;
}

.auth-aside::before {
    content: "名";
    position: absolute;
    right: -40px;
    bottom: -100px;
    font-family: var(--serif);
    font-size: 460px;
    line-height: 1;
    color: rgba(238, 241, 233, .03);
    pointer-events: none;
}

.auth-aside-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100vh;
    padding: 48px 54px;
}

.brand--auth .brand-seal {
    background: transparent;
    color: var(--paper);
    box-shadow: inset 0 0 0 1px rgba(238, 241, 233, .5);
}

.brand--auth .brand-name { color: var(--paper); }
.brand--auth .brand-sub { color: rgba(238, 241, 233, .45); }

.auth-statement {
    margin: 60px 0 auto;
    max-width: 100%;
}

.auth-kicker {
    margin: 0 0 16px;
    font-size: 11px;
    letter-spacing: .18em;
    color: rgba(238, 241, 233, .45);
}

.auth-statement h1 {
    margin: 0 0 22px;
    font-size: clamp(2.5rem, 4.2vw, 4rem);
    line-height: 1.2;
    color: var(--paper);
}

.auth-statement p {
    max-width: 28em;
    color: rgba(238, 241, 233, .6);
    font-size: 13px;
    line-height: 1.9;
}

.auth-points {
    list-style: none;
    margin: 30px 0 0;
    padding: 0;
    border-top: 1px solid rgba(238, 241, 233, .14);
}

.auth-points li {
    display: flex;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(238, 241, 233, .1);
    font-size: 12px;
    color: rgba(238, 241, 233, .62);
}

.auth-points span {
    font-family: var(--serif);
    font-size: 11px;
    color: rgba(238, 241, 233, .35);
}

.auth-elements {
    display: flex;
    gap: 18px;
    margin-top: 34px;
    font-family: var(--serif);
    font-size: 13px;
}

.auth-elements span { color: var(--wx); opacity: .8; }

.auth-main {
    display: flex;
    flex-direction: column;
    padding: 34px 54px 28px;
    background: var(--paper);
}

.auth-topline {
    display: flex;
    justify-content: flex-end;
}

.auth-topline a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--muted);
}

.auth-content {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
}

.auth-form-card {
    width: 100%;
    max-width: 390px;
}

.auth-form-kicker {
    margin: 0 0 8px;
    font-size: 10px;
    letter-spacing: .18em;
    color: var(--muted-2);
}

.auth-form-card h1 {
    margin: 0 0 10px;
    font-size: 2.3rem;
    line-height: 1.2;
}

.auth-form-lede {
    margin: 0 0 28px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.85;
}

.auth-form .field {
    margin-bottom: 16px;
}

.auth-form .btn-block {
    margin-top: 6px;
    padding: 13px 18px;
}

.auth-form-foot {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.auth-form-foot p {
    margin: 0 0 4px;
    font-size: 10px;
    line-height: 1.7;
    color: var(--muted-2);
}

.auth-foot {
    margin: 18px 0 0;
    text-align: center;
    font-size: 9px;
    letter-spacing: .08em;
    color: var(--muted-2);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1080px) {
    .hero-grid { gap: 40px; }
    .hero h1 { font-size: clamp(2.8rem, 6vw, 4.2rem); }
    .tools-grid { grid-template-columns: 1fr; border-top: 1px solid var(--line-2); }
    .tool-block { padding: 28px 0; border-right: 0; border-bottom: 1px solid var(--line); }
    .tool-block:last-child { border-bottom: 0; }
    .tool-block p { min-height: 0; }
    .tool-mark { font-size: 78px; top: 6px; }
    .grid-explainer { grid-template-columns: 1fr; gap: 34px; }
    .story-grid { grid-template-columns: 1fr; gap: 34px; }
    .bazi-sample-grid { grid-template-columns: 1fr; gap: 34px; }
    .faq-wrap { grid-template-columns: 1fr; gap: 24px; }
    .footer-grid { grid-template-columns: 1.2fr .8fr .8fr; }
    .footer-note { grid-column: 1 / -1; }
    .tool-layout { grid-template-columns: minmax(0, 1fr) 280px; gap: 30px; }
    .grid-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .grid-cards .grid-card:nth-child(1),
    .grid-cards .grid-card:nth-child(2) { grid-column: span 1; }
    .combo-row { grid-template-columns: 130px minmax(0, 1.4fr) auto; }
    .combo-fit { grid-column: 2 / 3; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
    .combo-action { grid-column: 3 / 4; grid-row: 1 / 3; align-self: center; }
}

@media (max-width: 900px) {
    :root { --header-h: 68px; }
    .container-site { padding: 0 20px; }
    .header-rule::before { left: 20px; }
    .site-nav {
        position: absolute;
        top: var(--header-h);
        left: 0;
        right: 0;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 10px 20px 18px;
        background: var(--paper);
        border-bottom: 1px solid var(--line);
        box-shadow: 0 18px 30px rgba(19, 33, 30, .08);
    }
    .site-nav.is-open { display: flex; }
    .site-nav > a { padding: 12px 0; border-bottom: 1px solid var(--line); }
    .site-nav > a:not(.nav-cta)::after { display: none; }
    .nav-cta { margin-top: 10px; text-align: center; border-bottom: 1px solid var(--ink) !important; }
    .nav-toggle { display: inline-flex; }
    .hero { padding: 46px 0 42px; }
    .hero-grid { grid-template-columns: 1fr; gap: 36px; }
    .hero-card { max-width: 560px; margin: 0 auto; }
    .section { padding: 62px 0; }
    .section-head--split { grid-template-columns: 1fr; gap: 18px; }
    .process-grid { grid-template-columns: 1fr; gap: 26px; }
    .process-step { border-top: 1px solid var(--line); }
    .process-num { position: static; margin-bottom: 14px; }
    .process-step h3 { margin-top: 0; }
    .grid-roles { grid-template-columns: repeat(3, 1fr); }
    .grid-roles > div:nth-child(4) { border-left: 0; padding-left: 0; }
    .grid-roles > div:nth-child(n+4) { border-top: 1px solid var(--line); }
    .example-grids { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .example-grids .grid-card:last-child { grid-column: 1 / -1; }
    .example-grids .grid-desc { -webkit-line-clamp: 2; }
    .story-row { grid-template-columns: 72px 1fr; }
    .story-row strong { font-size: 23px; }
    .sample-read { grid-template-columns: 1fr; gap: 16px; }
    .tool-hero { padding: 44px 0 30px; }
    .tool-hero-inner { grid-template-columns: 1fr; gap: 20px; }
    .tool-hero-meta { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 12px; text-align: left; }
    .tool-hero-meta span { padding-right: 12px; }
    .tool-layout { grid-template-columns: 1fr; }
    .tool-sidebar { position: static; }
    .report-head { flex-direction: column; gap: 16px; }
    .report-verdict { min-width: 0; width: 100%; text-align: left; }
    .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-cards .grid-card.is-primary { grid-column: 1 / -1; }
    .report-lower { grid-template-columns: 1fr; }
    .bazi-two-col { grid-template-columns: 1fr; }
    .fav-tiles { grid-template-columns: 1fr; }
    .fav-head { flex-direction: column; align-items: flex-start; gap: 8px; }
    .fav-head p { text-align: left; }
    .naming-bazi-strip { grid-template-columns: 1fr; }
    .naming-bazi-read { padding-left: 0; padding-top: 14px; border-left: 0; border-top: 1px solid var(--line); }
    .combo-row { grid-template-columns: 110px minmax(0, 1fr); gap: 10px 14px; padding: 16px 0; }
    .combo-grids { grid-column: 1 / -1; grid-row: 2; }
    .combo-fit { grid-column: 1 / -1; grid-row: 3; }
    .combo-action { grid-column: 2 / 3; grid-row: 1; }
    .static-layout { grid-template-columns: 1fr; gap: 26px; }
    .static-aside { position: static; }
    .static-aside nav { flex-direction: row; flex-wrap: wrap; gap: 4px 16px; border-left: 0; }
    .static-aside a { border-left: 0; padding-left: 0; }
    .static-tools { grid-template-columns: 1fr; }
    .auth-layout { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
    .auth-main { min-height: 100vh; padding: 24px 24px 20px; }
    .auth-topline a { font-size: 12px; }
    .auth-content { padding: 28px 0; }
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 30px; }
    .footer-brand { grid-column: 1 / -1; }
    .footer-note { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
    body { font-size: 15px; }
    .container-site { padding: 0 16px; }
    .hero { padding-top: 34px; }
    .hero h1 { font-size: 2.75rem; }
    .hero-sub { font-size: 15px; }
    .hero-actions .btn { flex: 1; }
    .hero-meta { gap: 0; }
    .hero-meta li { padding: 0 10px; font-size: 11px; }
    .hero-card { padding: 20px 18px 18px; }
    .hero-card-head { margin-bottom: 14px; }
    .mini-name { font-size: 28px; }
    .mini-strokes { font-size: 9px; }
    .mini-grids { gap: 4px; }
    .mini-grid { padding: 8px 2px; }
    .mini-grid-label { font-size: 8px; }
    .mini-grid b { font-size: 19px; }
    .mini-grid em { font-size: 8px; }
    .mini-summary { flex-direction: column; align-items: flex-start; gap: 6px; }
    .hero-mini-row { flex-direction: column; }
    .hero-mini-row .btn { width: 100%; }
    .section { padding: 52px 0; }
    .section-head { margin-bottom: 28px; }
    .section-head h2 { font-size: 1.85rem; }
    .grid-roles { grid-template-columns: 1fr 1fr; }
    .grid-roles > div:nth-child(3),
    .grid-roles > div:nth-child(5) { border-left: 0; padding-left: 0; }
    .grid-roles > div:nth-child(4) { border-left: 1px solid var(--line); padding-left: 10px; }
    .grid-roles > div:nth-child(n+3) { border-top: 1px solid var(--line); }
    .ad-grid:has(> :nth-child(2)) { grid-template-columns: 1fr; }
    .story-row { grid-template-columns: 1fr; gap: 2px; }
    .story-detail { grid-column: 1; }
    .pillar-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pillar-glyph { font-size: 34px; }
    .daymaster-strip { flex-direction: column; align-items: flex-start; gap: 14px; }
    .daymaster-season { max-width: 100%; }
    .fav-head p { font-size: 11px; }
    .grid-cards { grid-template-columns: 1fr; }
    .grid-cards .grid-card.is-primary { grid-column: auto; }
    .tool-section { padding: 26px 0 58px; }
    .form-panel, .report-panel { padding: 20px 16px; }
    .naming-form-panel { padding: 0; }
    .naming-form-panel > form { padding: 22px 16px; }
    .name-input-row { grid-template-columns: 1fr; gap: 12px; }
    .name-input-select, .name-input-submit { width: 100%; }
    .name-input-submit .btn { width: 100%; margin-top: 0; }
    .birth-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .manual-surname-grid { grid-template-columns: 1fr; }
    .pref-grid { grid-template-columns: 1fr; }
    .combo-row { grid-template-columns: 1fr auto; }
    .combo-grids { overflow-x: auto; padding-bottom: 2px; }
    .combo-grid { min-width: 46px; }
    .tier-bar { flex-direction: column; align-items: flex-start; }
    .tier-tabs { width: 100%; overflow-x: auto; }
    .tier-tab { flex: 0 0 auto; padding: 8px 10px; font-size: 12px; }
    .char-chip { width: 38px; height: 38px; font-size: 19px; }
    .char-modal .modal-header, .char-modal .modal-body, .char-modal .modal-footer { padding-left: 16px; padding-right: 16px; }
    .char-modal-footer { flex-direction: column; align-items: stretch; }
    .char-actions { justify-content: flex-end; }
    .error-card { padding: 30px 20px; }
    .footer-bottom { flex-direction: column; align-items: flex-start; gap: 8px; }
    .footer-grid { grid-template-columns: 1fr; gap: 26px; }
    .footer-brand, .footer-note { grid-column: auto; }
    .toast-stack { top: 12px; right: 12px; width: calc(100vw - 24px); }
    .auth-form-card h1 { font-size: 2rem; }
}

@media (max-width: 400px) {
    .hero h1 { font-size: 2.4rem; }
    .mini-grids { grid-template-columns: repeat(3, 1fr); }
    .mini-grid:nth-child(4), .mini-grid:nth-child(5) { grid-column: span 1; }
    .example-grids { grid-template-columns: 1fr; }
    .example-grids .grid-card:last-child { grid-column: auto; }
}

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

/* Ajax result refreshing */
.result-region.is-updating {
    opacity: .55;
    pointer-events: none;
    transition: opacity .15s ease;
}

/* Recommended characters in the picker */
.char-chip.is-recommended {
    border-color: rgba(165, 129, 63, .55);
}

.char-chip.is-recommended::before {
    content: "";
    position: absolute;
    left: 7px;
    right: 7px;
    bottom: 3px;
    height: 2px;
    border-radius: 1px;
    background: var(--brass);
    opacity: .8;
}

.char-chip.is-selected::before {
    background: #e6c37e;
    opacity: 1;
}

.char-more-btn {
    margin-left: 4px;
    padding: 0;
    border: 0;
    border-bottom: 1px solid rgba(178, 58, 43, .3);
    background: none;
    color: var(--cinnabar);
    font-size: 9px;
    cursor: pointer;
}
