:root {
    --ink: #18251f;
    --pine: #12372a;
    --pine-2: #1d4b3a;
    --pine-3: #2d604b;
    --paper: #f4f0e6;
    --paper-2: #e9e2d2;
    --warm-white: #fbfaf6;
    --cinnabar: #b6402b;
    --gold: #c9a35b;
    --muted: #6e766f;
    --line: rgba(24, 37, 31, .14);
    --serif: "Noto Serif SC", "Songti SC", SimSun, serif;
    --display: "ZCOOL XiaoWei", "Noto Serif SC", serif;
    --sans: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--ink);
    background: #e7e3d9;
    font-family: var(--sans);
    letter-spacing: 0;
    -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
svg { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.app-shell { max-width: 1440px; margin: 0 auto; background: var(--warm-white); box-shadow: 0 0 60px rgba(19, 35, 28, .08); overflow: hidden; }

.site-header {
    height: 80px;
    padding: 0 clamp(24px, 5vw, 78px);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    position: relative;
    z-index: 20;
    background: rgba(251, 250, 246, .94);
    border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; width: max-content; }
.brand-seal {
    display: grid; place-items: center; width: 42px; height: 42px;
    background: var(--cinnabar); color: #fff; font: 24px var(--display);
    border-radius: 2px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.23);
}
.brand strong { display: block; font: 700 19px var(--serif); }
.brand small { display: block; color: var(--muted); font-size: 8px; letter-spacing: 2px; margin-top: 2px; }
.desktop-nav { height: 100%; display: flex; align-items: center; gap: 42px; }
.desktop-nav a { position: relative; height: 100%; display: grid; place-items: center; color: #59615c; font-size: 14px; }
.desktop-nav a::after { content: ""; position: absolute; bottom: 0; left: 50%; width: 0; height: 2px; background: var(--cinnabar); transition: .25s; }
.desktop-nav a:hover::after, .desktop-nav a.active::after { left: 0; width: 100%; }
.desktop-nav a.active { color: var(--ink); font-weight: 600; }
.icon-button { justify-self: end; width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: transparent; cursor: pointer; }
.icon-button:hover { color: var(--cinnabar); }

.hero { min-height: 660px; position: relative; isolation: isolate; display: flex; align-items: center; padding: 70px clamp(30px, 8.5vw, 130px) 100px; overflow: hidden; background: #d9d2c1; }
.hero::before {
    content: ""; position: absolute; inset: 0; z-index: -3;
    background-image: linear-gradient(90deg, rgba(230,225,211,.99) 0%, rgba(230,225,211,.88) 38%, rgba(230,225,211,.2) 70%, rgba(230,225,211,.05)), url("../images/hero-landscape-v2.jpg");
    background-size: cover; background-position: center 55%; filter: saturate(.55) contrast(.9);
}
.hero::after { content: ""; position: absolute; inset: 0; z-index: -2; opacity: .17; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.25'/%3E%3C/svg%3E"); mix-blend-mode: multiply; }
.hero-art { position: absolute; inset: 0; pointer-events: none; z-index: -1; }
.sun { position: absolute; width: 84px; height: 84px; border-radius: 50%; background: rgba(182,64,43,.68); right: 23%; top: 22%; mix-blend-mode: multiply; }
.mountain { position: absolute; right: -3%; bottom: 0; width: 68%; height: 58%; opacity: .18; background: var(--pine); clip-path: polygon(0 100%, 16% 64%, 29% 76%, 44% 22%, 57% 56%, 72% 13%, 100% 75%, 100% 100%); }
.mountain-back { right: 20%; width: 56%; height: 42%; opacity: .09; }
.water-line { position: absolute; height: 1px; background: var(--pine); opacity: .14; right: 4%; width: 44%; bottom: 16%; }
.line-two { bottom: 13%; right: 10%; width: 34%; }
.line-three { bottom: 10%; right: 2%; width: 48%; }
.trigram { position: absolute; font: 25px var(--serif); opacity: .2; }
.trigram-one { top: 18%; right: 8%; transform: rotate(16deg); }
.trigram-two { bottom: 25%; right: 44%; transform: rotate(-12deg); }
.hero-copy { width: min(560px, 55%); }
.eyebrow { margin: 0 0 16px; text-transform: uppercase; color: var(--cinnabar); font-size: 12px; font-weight: 700; letter-spacing: 2px; }
.eyebrow span { display: inline-block; width: 28px; height: 1px; background: currentColor; vertical-align: middle; margin-right: 8px; }
.hero h1 { margin: 0; font: 400 clamp(58px, 7vw, 94px)/1.08 var(--display); letter-spacing: 0; }
.hero h1 em { color: var(--cinnabar); font-style: normal; }
.hero-copy > p:not(.eyebrow) { margin: 26px 0 0; width: 470px; max-width: 100%; color: #4d5751; font: 15px/2 var(--serif); }
.hero-actions { display: flex; align-items: center; gap: 34px; margin-top: 36px; }
.button { min-height: 46px; padding: 0 22px; border: 1px solid transparent; border-radius: 3px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-size: 13px; font-weight: 600; cursor: pointer; transition: transform .2s, box-shadow .2s, background .2s; }
.button:hover { transform: translateY(-2px); }
.button-primary { color: #fff; background: var(--cinnabar); box-shadow: 0 10px 24px rgba(182,64,43,.2); }
.button-primary:hover { box-shadow: 0 14px 28px rgba(182,64,43,.27); }
.text-link { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; }
.play { width: 36px; height: 36px; border: 1px solid rgba(24,37,31,.3); border-radius: 50%; display: grid; place-items: center; }
.play svg { width: 14px; }
.hero-note { position: absolute; right: clamp(24px, 6vw, 92px); bottom: 36px; width: 300px; padding-left: 20px; border-left: 2px solid var(--cinnabar); font-family: var(--serif); }
.hero-note span, .hero-note small { display: block; color: var(--muted); font-size: 10px; }
.hero-note q { display: block; margin: 8px 0; font-size: 14px; quotes: none; }

.section { padding: 100px clamp(30px, 7.5vw, 112px); }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 40px; margin-bottom: 48px; }
.section-heading h2, .ai-intro h2, .modal-heading h2 { margin: 0; font: 400 clamp(34px, 4vw, 52px)/1.25 var(--display); }
.section-heading > p { max-width: 410px; margin: 0 0 4px; color: var(--muted); font-size: 13px; line-height: 1.9; }
.tool-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.tool-card { position: relative; min-height: 260px; padding: 32px; border: 0; background: var(--warm-white); text-align: left; cursor: pointer; overflow: hidden; transition: background .25s, color .25s; }
.tool-card:hover { background: var(--pine); color: #fff; }
.tool-card-large { grid-row: span 2; min-height: 521px; padding: 42px; display: flex; flex-direction: column; }
.tool-number { position: absolute; top: 18px; right: 20px; font: 12px var(--serif); color: var(--muted); opacity: .65; }
.tool-icon { width: 62px; height: 62px; display: grid; place-items: center; color: var(--cinnabar); border: 1px solid rgba(182,64,43,.4); border-radius: 50%; font: 27px var(--display); margin-bottom: 28px; }
.tool-card-large .tool-icon { width: 118px; height: 118px; margin: 58px auto 54px; font-size: 62px; border-color: rgba(182,64,43,.6); }
.tool-card:hover .tool-icon { color: #e5b59d; border-color: rgba(255,255,255,.3); }
.tool-copy { display: block; }
.tool-copy small { display: block; color: var(--cinnabar); font-size: 10px; letter-spacing: 1.5px; margin-bottom: 10px; }
.tool-card:hover .tool-copy small { color: #d8b58b; }
.tool-copy strong { display: block; font: 400 26px var(--display); margin-bottom: 12px; }
.tool-card-large .tool-copy strong { font-size: 38px; text-align: center; }
.tool-copy em { color: var(--muted); font-size: 12px; line-height: 1.8; font-style: normal; }
.tool-card-large .tool-copy em { display: block; max-width: 270px; margin: 0 auto; text-align: center; }
.tool-card:hover .tool-copy em { color: rgba(255,255,255,.65); }
.tool-action { margin-top: auto; padding-top: 34px; display: flex; justify-content: center; align-items: center; gap: 10px; font-size: 12px; }
.corner-arrow { position: absolute; right: 28px; bottom: 28px; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; }

.academy-section { background: var(--pine); color: #fff; }
.light { color: #d0ae6c; }
.academy-heading { align-items: center; }
.section-stats { display: flex; gap: 30px; }
.section-stats span { color: rgba(255,255,255,.62); font-size: 11px; }
.section-stats strong { display: block; color: #fff; font: 30px var(--display); }
.academy-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 24px; border-bottom: 1px solid rgba(255,255,255,.15); margin-bottom: 34px; }
.tabs { display: flex; gap: 32px; overflow-x: auto; scrollbar-width: none; }
.tabs button { position: relative; min-height: 54px; white-space: nowrap; border: 0; background: transparent; color: rgba(255,255,255,.55); cursor: pointer; font-size: 12px; }
.tabs button::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: transparent; }
.tabs button.active { color: #fff; }
.tabs button.active::after { background: #d0ae6c; }
.button-outline { min-height: 40px; border-color: rgba(255,255,255,.35); color: #fff; background: transparent; }
.resource-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.resource-card { min-width: 0; color: var(--ink); background: #f8f5ec; border-radius: 4px; overflow: hidden; transition: transform .25s, box-shadow .25s; }
.resource-card:hover { transform: translateY(-5px); box-shadow: 0 18px 40px rgba(0,0,0,.2); }
.resource-card[hidden] { display: none; }
.resource-cover { aspect-ratio: 1.45; position: relative; display: grid; place-items: center; overflow: hidden; background: #d2c6a9; }
.resource-cover::before, .resource-cover::after { content: ""; position: absolute; width: 120%; height: 70%; border-radius: 50%; background: rgba(255,255,255,.18); left: -36%; bottom: -34%; transform: rotate(9deg); }
.resource-cover::after { width: 80%; height: 55%; left: auto; right: -25%; bottom: -26%; background: rgba(15,52,40,.2); transform: rotate(-8deg); }
.cover-2 { background: #9fac94; }
.cover-3 { background: #c4a391; }
.cover-4 { background: #d1b86f; }
.cover-5 { background: #a0b9b0; }
.resource-glyph { z-index: 1; font: 64px var(--display); color: rgba(26,50,40,.5); }
.resource-type { position: absolute; z-index: 2; top: 12px; left: 12px; padding: 5px 8px; border-radius: 2px; background: rgba(19,55,42,.86); color: #fff; font-size: 9px; }
.video-play { position: absolute; z-index: 3; width: 48px; height: 48px; display: grid; place-items: center; color: #fff; background: rgba(182,64,43,.88); border-radius: 50%; }
.video-play svg { width: 17px; }
.resource-body { padding: 20px; }
.resource-body > p { margin: 0 0 8px; color: var(--cinnabar); font-size: 9px; letter-spacing: 1px; }
.resource-body h3 { margin: 0 0 9px; font: 600 17px/1.5 var(--serif); }
.resource-body > span { color: var(--muted); font-size: 11px; line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 37px; }
.resource-body footer { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 13px; margin-top: 15px; }
.resource-body footer small { color: var(--muted); }
.bookmark { width: 32px; height: 32px; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; color: #778078; }
.bookmark.saved { color: var(--cinnabar); }
.bookmark.saved svg { fill: currentColor; }
.load-more { min-height: 48px; border: 0; border-bottom: 1px solid rgba(255,255,255,.32); color: #fff; background: transparent; display: flex; align-items: center; gap: 10px; margin: 40px auto 0; cursor: pointer; }

.ai-section { display: grid; grid-template-columns: .86fr 1.14fr; min-width: 0; min-height: 650px; background: var(--paper); }
.ai-intro { min-width: 0; padding: 100px clamp(30px, 7.5vw, 112px); display: flex; flex-direction: column; justify-content: center; }
.ai-intro > p:not(.eyebrow) { color: var(--muted); max-width: 410px; font: 13px/2 var(--serif); }
.ai-suggestions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 25px; }
.ai-suggestions button { min-height: 38px; border: 1px solid var(--line); border-radius: 2px; background: transparent; color: #59655f; font-size: 10px; cursor: pointer; }
.ai-suggestions button:hover { border-color: var(--cinnabar); color: var(--cinnabar); }
.chat-panel { margin: 68px clamp(30px, 7vw, 100px) 68px 0; min-width: 0; min-height: 520px; display: grid; grid-template-rows: auto 1fr auto auto; background: var(--warm-white); border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(29,50,41,.1); overflow: hidden; }
.chat-panel header { height: 72px; padding: 0 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.ai-avatar, .avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; color: #fff; background: var(--pine); font: 18px var(--display); }
.chat-panel header div { margin-left: 11px; }
.chat-panel header strong { display: block; font: 600 14px var(--serif); }
.chat-panel header small { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 9px; margin-top: 3px; }
.chat-panel header small i { width: 6px; height: 6px; border-radius: 50%; background: #5ca378; }
.chat-panel header button { margin-left: auto; width: 40px; height: 40px; border: 0; background: transparent; cursor: pointer; }
.chat-messages { max-height: 370px; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.message { display: flex; align-items: end; gap: 10px; max-width: 86%; }
.message > .message-content { min-width: 0; padding: 13px 15px; border-radius: 3px 3px 3px 0; background: var(--paper); font: 12px/1.8 var(--serif); overflow-wrap: anywhere; }
.message small { display: block; margin-top: 5px; color: #8a918c; font: 8px var(--sans); }
.message.user { align-self: flex-end; }
.message.user > .message-content { background: var(--pine); color: #fff; border-radius: 3px 3px 0 3px; }
.message.typing > .message-content::after { content: "…"; animation: blink 1s infinite; }
.plain-text { white-space: pre-wrap; }
.markdown-body { min-width: 0; white-space: normal; }
.markdown-body > :first-child { margin-top: 0; }
.markdown-body > :last-child { margin-bottom: 0; }
.markdown-body p { margin: 0 0 .8em; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 { margin: 1.15em 0 .5em; font-family: var(--serif); line-height: 1.45; }
.markdown-body h1 { font-size: 1.45em; }
.markdown-body h2 { font-size: 1.3em; }
.markdown-body h3, .markdown-body h4 { font-size: 1.15em; }
.markdown-body ul, .markdown-body ol { margin: .65em 0 .9em; padding-left: 1.7em; }
.markdown-body li { margin: .25em 0; }
.markdown-body blockquote { margin: .9em 0; padding: .2em 0 .2em 1em; border-left: 2px solid var(--cinnabar); color: var(--muted); }
.markdown-body code { padding: .15em .38em; border-radius: 2px; background: rgba(18, 55, 42, .09); font: .92em/1.55 Consolas, "SFMono-Regular", monospace; }
.markdown-body pre { max-width: 100%; margin: .9em 0; padding: 12px 14px; overflow-x: auto; border-radius: 3px; background: #102a20; color: #eef5ef; white-space: pre; }
.markdown-body pre code { padding: 0; background: transparent; color: inherit; }
.markdown-body a { color: var(--cinnabar); text-decoration: underline; text-underline-offset: 3px; }
.markdown-body hr { height: 1px; margin: 1em 0; border: 0; background: var(--line); }
.markdown-body table { width: 100%; margin: .9em 0; border-collapse: collapse; font-size: .92em; }
.markdown-body th, .markdown-body td { padding: 7px 8px; border: 1px solid var(--line); text-align: left; }
.markdown-body th { background: rgba(18, 55, 42, .07); font-weight: 700; }
@keyframes blink { 50% { opacity: .3; } }
.ai-mode-switch { display: inline-flex; width: max-content; margin: 0; padding: 2px; border: 1px solid var(--line); border-radius: 2px; background: var(--paper); }
.ai-mode-switch legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.ai-mode-switch label { cursor: pointer; }
.ai-mode-switch input { position: absolute; opacity: 0; }
.ai-mode-switch span { min-width: 76px; min-height: 30px; padding: 0 10px; display: grid; place-items: center; color: var(--muted); font-size: 9px; }
.ai-mode-switch input:checked + span { color: #fff; background: var(--pine); }
.chat-mode-switch { margin: 0 20px 8px; }
.chat-form { margin: 0 20px; display: flex; align-items: end; border: 1px solid var(--line); background: #fff; padding: 8px; }
.chat-form textarea { flex: 1; max-height: 110px; min-height: 34px; resize: none; border: 0; outline: 0; padding: 8px; background: transparent; font-size: 12px; line-height: 1.5; }
.chat-form button { width: 38px; height: 38px; border: 0; border-radius: 2px; display: grid; place-items: center; background: var(--cinnabar); color: #fff; cursor: pointer; }
.chat-form button:disabled { opacity: .5; cursor: wait; }
.chat-disclaimer { margin: 8px 0 12px; text-align: center; color: #949a96; font-size: 8px; }

.site-footer { min-height: 190px; padding: 45px clamp(30px, 7.5vw, 112px); background: #0d281f; color: #fff; display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 38px; }
.footer-brand { display: flex; gap: 16px; }
.footer-brand strong { font: 20px var(--serif); }
.footer-brand p { color: rgba(255,255,255,.5); font-size: 11px; }
.footer-links { display: flex; align-items: center; gap: 26px; }
.footer-links a, .footer-links button { min-height: 40px; border: 0; padding: 0; background: none; color: rgba(255,255,255,.65); font-size: 11px; cursor: pointer; }
.footer-links a:hover, .footer-links button:hover { color: #fff; }
.site-footer > small { grid-column: 1 / -1; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.1); color: rgba(255,255,255,.35); font-size: 9px; }
.mobile-nav { display: none; }

.modal { width: min(620px, calc(100% - 32px)); max-height: min(780px, calc(100vh - 32px)); padding: 38px; border: 0; border-radius: 4px; color: var(--ink); background: var(--warm-white); box-shadow: 0 30px 90px rgba(0,0,0,.25); overflow-y: auto; }
.modal::backdrop { background: rgba(9,26,20,.72); backdrop-filter: blur(4px); }
.modal-close { position: absolute; top: 14px; right: 14px; width: 42px; height: 42px; border: 0; background: transparent; cursor: pointer; }
.modal-heading { margin-bottom: 28px; }
.modal-heading h2 { font-size: 34px; }
.modal-heading > p:last-child { color: var(--muted); font-size: 11px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.upload-modal form > label, .form-grid label { display: block; margin-bottom: 16px; }
.upload-modal label > span { display: block; font-size: 11px; font-weight: 600; margin-bottom: 8px; }
.upload-modal input, .upload-modal select, .upload-modal textarea { width: 100%; min-height: 44px; padding: 10px 12px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 2px; outline: 0; }
.upload-modal input:focus, .upload-modal select:focus, .upload-modal textarea:focus { border-color: var(--pine-3); }
.file-drop { min-height: 150px; padding: 24px; display: grid !important; place-items: center; align-content: center; border: 1px dashed rgba(24,37,31,.35); background: var(--paper); cursor: pointer; text-align: center; }
.file-drop.dragging { border-color: var(--cinnabar); background: #f5e9e3; }
.file-drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.file-drop svg { color: var(--cinnabar); width: 28px; height: 28px; }
.file-drop strong { font-size: 12px; margin: 8px 0 3px; }
.file-drop small { color: var(--muted); font-size: 9px; }
.button-block { width: 100%; }
.form-status { min-height: 20px; font-size: 11px; color: var(--cinnabar); }
.search-modal { height: min(650px, calc(100vh - 32px)); }
.search-box { height: 54px; padding: 0 18px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--ink); }
.search-box input { flex: 1; border: 0; outline: 0; background: transparent; font: 17px var(--serif); }
.search-results { padding-top: 24px; }
.search-results > p { color: var(--muted); text-align: center; font-size: 11px; }
.search-item { display: block; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.search-item small { color: var(--cinnabar); font-size: 9px; }
.search-item strong { display: block; margin: 5px 0; font: 15px var(--serif); }
.search-item span { color: var(--muted); font-size: 10px; }
.tool-result { text-align: center; padding: 16px 0; }
.tool-result .tool-icon { margin: 0 auto 16px; }
.tool-result h2 { font: 34px var(--display); }
.tool-result p { color: var(--muted); font: 13px/1.9 var(--serif); }
.coins { display: flex; justify-content: center; gap: 16px; margin: 30px 0; }
.coin { width: 62px; height: 62px; border: 4px double #a78037; border-radius: 50%; display: grid; place-items: center; background: #d7b767; color: #6d511c; font: 22px var(--serif); transition: transform .5s; }
.coin.tossing { animation: toss .7s ease-in-out; }
@keyframes toss { 50% { transform: translateY(-24px) rotateY(540deg); } }
.hexagram { width: 140px; display: flex; flex-direction: column-reverse; gap: 8px; margin: 28px auto; }
.yao { display: flex; height: 9px; gap: 12px; }
.yao::before, .yao::after { content: ""; flex: 1; background: var(--ink); }
.yao.yang::after { display: none; }
.calendar-day { font: 88px var(--display); color: var(--cinnabar); line-height: 1; }
.search-inline { display: flex; gap: 8px; margin-top: 25px; }
.search-inline input { flex: 1; min-height: 44px; padding: 10px; border: 1px solid var(--line); }

.modal.bazi-modal { width: min(1040px, calc(100% - 32px)); max-height: calc(100vh - 32px); padding: 0; overflow-y: auto; }
.bazi-modal .modal-close { z-index: 3; position: sticky; top: 12px; float: right; margin: 0 12px -54px 0; border-radius: 50%; background: rgba(251,250,246,.92); box-shadow: 0 2px 10px rgba(24,37,31,.08); }
.bazi-tool { min-width: 0; padding-bottom: 42px; }
.bazi-heading { padding: 48px 52px 31px; background: var(--paper); border-bottom: 1px solid var(--line); }
.bazi-heading h2 { margin: 0; font: 400 42px/1.25 var(--display); }
.bazi-heading > p:last-child { max-width: 650px; margin: 10px 0 0; color: var(--muted); font: 12px/1.8 var(--serif); }
.bazi-form { padding: 30px 52px 34px; border-bottom: 1px solid var(--line); }
.bazi-calendar-switch { display: inline-flex; margin: 0 0 22px; padding: 3px; border: 1px solid var(--line); background: var(--paper); }
.bazi-calendar-switch legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.bazi-calendar-switch label { cursor: pointer; }
.bazi-calendar-switch input { position: absolute; opacity: 0; }
.bazi-calendar-switch span { width: 88px; min-height: 38px; display: grid; place-items: center; font-size: 12px; }
.bazi-calendar-switch input:checked + span { color: #fff; background: var(--pine); }
.bazi-fields { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.bazi-fields label > span:first-child { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 700; }
.bazi-fields input, .bazi-fields select { width: 100%; min-width: 0; height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: 2px; color: var(--ink); background: #fff; outline: 0; }
.bazi-fields input:focus, .bazi-fields select:focus, .bazi-ai-form textarea:focus { border-color: var(--pine-3); }
.bazi-leap .check-row { height: 44px; padding: 0 10px; display: flex !important; align-items: center; gap: 7px; border: 1px solid var(--line); background: #fff; font-size: 10px; }
.bazi-leap .check-row input { width: 16px; height: 16px; }
.bazi-leap .leap-hint { display: block; margin-top: 5px; color: var(--muted); font-size: 8px; }
.bazi-sect { margin: 18px 0 0; display: flex; align-items: center; gap: 8px; color: #4e5a53; font-size: 10px; }
.bazi-sect input { width: 16px; height: 16px; }
.bazi-time-note { margin: 8px 0 16px; color: var(--muted); font-size: 9px; }
.bazi-form-error { min-height: 18px; margin: 0 0 8px; color: var(--cinnabar); font-size: 11px; }
.bazi-output { padding: 36px 52px 0; scroll-margin-top: 20px; }
.bazi-result-head { display: grid; grid-template-columns: 1.1fr 1.4fr .8fr; border: 1px solid var(--line); }
.bazi-result-head > div { min-width: 0; padding: 16px 18px; border-right: 1px solid var(--line); }
.bazi-result-head > div:last-child { border-right: 0; }
.bazi-result-head p { margin: 0 0 6px; color: var(--muted); font-size: 9px; }
.bazi-result-head strong { display: block; font: 600 13px/1.7 var(--serif); overflow-wrap: anywhere; }
.bazi-chart-wrap { margin-top: 22px; max-width: 100%; overflow-x: auto; border: 1px solid var(--line); }
.bazi-chart { width: 100%; min-width: 620px; table-layout: fixed; border-collapse: collapse; text-align: center; font-family: var(--serif); }
.bazi-chart th, .bazi-chart td { padding: 10px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.bazi-chart th:last-child, .bazi-chart td:last-child { border-right: 0; }
.bazi-chart tr:last-child th, .bazi-chart tr:last-child td { border-bottom: 0; }
.bazi-chart thead th { color: #fff; background: var(--pine); font-size: 12px; }
.bazi-chart thead th:first-child, .bazi-chart tbody th { width: 105px; }
.bazi-chart tbody th { color: var(--muted); background: var(--paper); font: 600 10px var(--sans); }
.bazi-chart td { font-size: 12px; }
.bazi-chart td > span { display: block; line-height: 1.75; }
.bazi-main-row td { padding: 11px 8px; background: rgba(201,163,91,.07); }
.bazi-main-row .bazi-char { display: block; color: var(--cinnabar); font: 36px/1.1 var(--display); }
.bazi-main-row small { color: var(--muted); font-size: 9px; }
.bazi-details { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 22px; border: 1px solid var(--line); }
.bazi-details > div { min-width: 0; padding: 16px; border-right: 1px solid var(--line); text-align: center; }
.bazi-details > div:last-child { border-right: 0; }
.bazi-details small, .bazi-details span { display: block; color: var(--muted); font-size: 9px; }
.bazi-details strong { display: block; margin: 6px 0; font: 22px var(--display); }
.bazi-dayun { margin-top: 30px; }
.bazi-dayun header { display: flex; align-items: end; justify-content: space-between; margin-bottom: 14px; }
.bazi-dayun .eyebrow { margin: 0; }
.bazi-dayun h3 { margin: 0; font: 28px var(--display); }
.dayun-grid { display: grid; grid-template-columns: repeat(8, minmax(78px, 1fr)); border: 1px solid var(--line); overflow-x: auto; }
.dayun-item { min-width: 78px; padding: 14px 7px; border-right: 1px solid var(--line); text-align: center; }
.dayun-item:last-child { border-right: 0; }
.dayun-item small, .dayun-item span { display: block; color: var(--muted); font-size: 8px; white-space: nowrap; }
.dayun-item strong { display: block; margin: 9px 0; color: var(--cinnabar); font: 22px var(--display); }
.bazi-cultural-note { margin: 12px 0 0; color: var(--muted); font: 9px/1.7 var(--serif); }
.bazi-ai { margin-top: 34px; padding: 28px; color: #fff; background: var(--pine); }
.bazi-ai > header { display: flex; align-items: center; gap: 13px; }
.bazi-ai > header .ai-avatar { color: var(--pine); background: #fff; }
.bazi-ai .eyebrow { margin: 0 0 3px; color: #d8b36b; font-size: 9px; }
.bazi-ai h3 { margin: 0; font: 30px var(--display); }
.bazi-ai > p { margin: 16px 0; max-width: 680px; color: rgba(255,255,255,.7); font: 11px/1.8 var(--serif); }
.bazi-ai-prompts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.bazi-ai-prompts button { min-height: 34px; padding: 0 11px; border: 1px solid rgba(255,255,255,.25); border-radius: 2px; color: rgba(255,255,255,.82); background: transparent; font-size: 9px; cursor: pointer; }
.bazi-ai-prompts button:hover { border-color: #d8b36b; color: #fff; }
.bazi-ai-form textarea { width: 100%; min-height: 86px; padding: 12px; resize: vertical; border: 1px solid rgba(255,255,255,.28); border-radius: 2px; color: var(--ink); background: #fff; outline: 0; }
.bazi-mode-switch { margin-top: 10px; border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.08); }
.bazi-mode-switch span { color: rgba(255,255,255,.68); }
.bazi-mode-switch input:checked + span { color: var(--pine); background: #fff; }
.bazi-consent { margin: 12px 0 6px; display: flex; align-items: flex-start; gap: 8px; color: rgba(255,255,255,.82); font-size: 10px; line-height: 1.6; }
.bazi-consent input { flex: 0 0 auto; width: 16px; height: 16px; margin-top: 1px; }
.bazi-ai-status { min-height: 17px; margin: 0 0 8px; color: #e6c783; font-size: 9px; }
.bazi-ai .button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.bazi-ai-answer { margin-top: 18px; color: var(--ink); background: var(--warm-white); }
.bazi-ai-answer:not(:empty) { padding: 18px; }
.bazi-ai > small { display: block; margin-top: 12px; color: rgba(255,255,255,.5); font-size: 8px; line-height: 1.6; }

@media (max-width: 900px) {
    .site-header { grid-template-columns: 1fr auto; height: 68px; padding: 0 24px; }
    .desktop-nav { display: none; }
    .hero { min-height: 600px; }
    .hero-copy { width: 65%; }
    .tool-grid { grid-template-columns: 1fr 1fr; }
    .tool-card-large { grid-row: span 2; }
    .resource-grid { grid-template-columns: repeat(2, 1fr); }
    .ai-section { grid-template-columns: minmax(0, 1fr); overflow: hidden; }
    .ai-intro { padding-bottom: 40px; }
    .chat-panel { margin: 0 30px 70px; }
    .bazi-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .bazi-details { grid-template-columns: repeat(2, 1fr); }
    .bazi-details > div:nth-child(2) { border-right: 0; }
    .bazi-details > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 640px) {
    body { background: var(--warm-white); }
    .app-shell { max-width: none; box-shadow: none; padding-bottom: 66px; }
    .site-header { position: sticky; top: 0; height: 60px; padding: 0 16px; }
    .brand { gap: 9px; }
    .brand-seal { width: 34px; height: 34px; font-size: 20px; }
    .brand strong { font-size: 16px; }
    .brand small { display: none; }
    .icon-button { width: 42px; height: 42px; }
    .hero { min-height: calc(100svh - 110px); max-height: 720px; align-items: start; padding: 72px 22px 105px; }
    .hero::before { background-image: linear-gradient(180deg, rgba(229,224,210,.88) 0%, rgba(229,224,210,.7) 50%, rgba(229,224,210,.4)), url("../images/hero-landscape-v2.jpg"); background-position: 56% center; }
    .hero-copy { width: 100%; }
    .hero h1 { font-size: clamp(54px, 17vw, 72px); line-height: 1.12; }
    .hero-copy > p:not(.eyebrow) { width: 88%; font-size: 13px; line-height: 1.85; }
    .hero-actions { gap: 22px; margin-top: 28px; }
    .hero-note { right: 20px; bottom: 25px; width: calc(100% - 40px); background: rgba(242,238,226,.65); padding: 10px 10px 10px 16px; }
    .hero-note span { display: none; }
    .hero-note q { margin-top: 0; }
    .sun { right: 8%; top: 28%; width: 65px; height: 65px; }
    .section { padding: 70px 18px; }
    .section-heading { display: block; margin-bottom: 30px; }
    .section-heading h2, .ai-intro h2 { font-size: 36px; }
    .section-heading > p { margin-top: 16px; font-size: 12px; }
    .tool-grid { grid-template-columns: 1fr 1fr; }
    .tool-card { min-height: 218px; padding: 22px 18px; }
    .tool-card-large { grid-column: 1 / -1; grid-row: auto; min-height: 390px; padding: 30px; }
    .tool-card-large .tool-icon { margin: 35px auto 30px; width: 96px; height: 96px; font-size: 50px; }
    .tool-card-large .tool-copy strong { font-size: 34px; }
    .tool-icon { width: 52px; height: 52px; font-size: 23px; margin-bottom: 22px; }
    .tool-copy strong { font-size: 22px; }
    .tool-copy em { font-size: 10px; }
    .corner-arrow { right: 15px; bottom: 15px; width: 34px; height: 34px; }
    .academy-section { padding-left: 16px; padding-right: 16px; }
    .academy-heading { display: flex; align-items: end; }
    .section-stats { gap: 14px; }
    .section-stats span { font-size: 8px; }
    .section-stats strong { font-size: 24px; }
    .academy-toolbar { align-items: end; }
    .tabs { gap: 23px; }
    .academy-toolbar .button { width: 44px; padding: 0; flex: 0 0 auto; font-size: 0; }
    .academy-toolbar .button svg { width: 18px; height: 18px; }
    .resource-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .resource-cover { aspect-ratio: 1.15; }
    .resource-glyph { font-size: 48px; }
    .resource-body { padding: 14px; }
    .resource-body h3 { font-size: 14px; }
    .resource-body > span { font-size: 9px; min-height: 32px; }
    .resource-body footer { margin-top: 10px; padding-top: 8px; }
    .resource-body footer small { max-width: 85px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
    .ai-intro { padding: 70px 20px 30px; }
    .ai-suggestions { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; }
    .ai-suggestions button { white-space: nowrap; padding: 0 12px; }
    .chat-panel { width: auto; max-width: calc(100vw - 32px); margin: 0 16px 70px; min-height: 510px; }
    .chat-messages { max-height: 350px; padding: 18px; }
    .site-footer { padding: 38px 20px; grid-template-columns: 1fr; }
    .footer-links { flex-wrap: wrap; gap: 16px 24px; }
    .site-footer > small { grid-column: 1; }
    .mobile-nav { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: calc(64px + env(safe-area-inset-bottom)); padding: 5px max(10px, env(safe-area-inset-left)) env(safe-area-inset-bottom) max(10px, env(safe-area-inset-right)); display: grid; grid-template-columns: repeat(4, 1fr); background: rgba(251,250,246,.96); border-top: 1px solid var(--line); backdrop-filter: blur(12px); }
    .mobile-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #79817c; font-size: 9px; }
    .mobile-nav a svg { width: 20px; height: 20px; }
    .mobile-nav a.active { color: var(--cinnabar); }
    .modal { padding: 28px 20px; }
    .form-grid { grid-template-columns: 1fr; gap: 0; }
    .modal.bazi-modal { width: calc(100% - 12px); max-height: calc(100svh - 12px); }
    .bazi-tool { padding-bottom: 20px; }
    .bazi-heading { padding: 36px 18px 24px; }
    .bazi-heading h2 { font-size: 34px; }
    .bazi-form { padding: 24px 18px 28px; }
    .bazi-calendar-switch { display: flex; }
    .bazi-calendar-switch label { flex: 1; }
    .bazi-calendar-switch span { width: 100%; }
    .bazi-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 9px; }
    .bazi-output { padding: 26px 12px 0; }
    .bazi-result-head { grid-template-columns: 1fr; }
    .bazi-result-head > div { padding: 12px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
    .bazi-result-head > div:last-child { border-bottom: 0; }
    .bazi-chart-wrap { margin-top: 14px; }
    .bazi-chart { min-width: 545px; }
    .bazi-chart thead th:first-child, .bazi-chart tbody th { width: 85px; }
    .bazi-main-row .bazi-char { font-size: 31px; }
    .bazi-details { margin-top: 14px; }
    .bazi-details > div { padding: 13px 6px; }
    .bazi-details strong { font-size: 19px; }
    .bazi-dayun { margin-top: 24px; }
    .dayun-grid { grid-template-columns: repeat(8, 78px); }
    .bazi-ai { margin-top: 28px; padding: 22px 16px; }
    .bazi-ai h3 { font-size: 26px; }
    .bazi-ai-prompts { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 5px; }
    .bazi-ai-prompts button { white-space: nowrap; }
}

@media (max-width: 360px) {
    .hero-actions { gap: 12px; }
    .button { padding: 0 16px; }
    .text-link { font-size: 11px; }
    .tool-card { padding: 18px 14px; }
    .tool-copy strong { font-size: 20px; }
    .resource-grid { grid-template-columns: 1fr; }
}

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