/* 共用左侧导航抽屉（首页 / 排盘 / 档案 / 报告） */
.hd-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 2.35rem;
    height: 2.35rem;
    padding: 0;
    border-radius: 10px;
    border: 1px solid rgba(120, 108, 92, 0.18);
    background: rgba(255, 255, 255, 0.65);
    color: #4a4034;
    cursor: pointer;
}

.hd-menu-toggle:hover {
    background: rgba(255, 252, 247, 0.95);
    border-color: rgba(196, 146, 62, 0.4);
}

.hd-menu-toggle__bars {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 1.05rem;
}

.hd-menu-toggle__bars span {
    display: block;
    height: 2px;
    width: 100%;
    border-radius: 999px;
    background: #4a4034;
}

body.hd-side-drawer-open .hd-menu-toggle {
    background: rgba(232, 184, 106, 0.22);
    border-color: rgba(196, 146, 62, 0.5);
}

/* 排盘页：标题旁 / 表单顶栏左侧的「三」——靠最左 */
.hd-menu-toggle--inline {
    width: 2.1rem;
    height: 2.1rem;
    flex: 0 0 auto;
    margin-left: 0;
}

/* 个人中心 / 题库顶栏汉堡：仅手机端显示（见 mobile-responsive） */
.hd-menu-toggle--me,
.hd-menu-toggle--exam {
    display: none;
}

.hd-menu-toggle--form {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
}

/* 电脑端：术数盘面 / 录入顶栏不需要「三」（左侧栏已有导航）；手机端保留 */
@media (min-width: 992px) {
    .hd-menu-toggle--inline,
    .hd-menu-toggle--form {
        display: none !important;
    }
}

.paipan-result-title-block,
.qimen-result-shell__title-block,
.liuren-result-shell__title-block,
.qizheng-result-shell__title-block {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.4rem;
    min-width: 0;
    width: 100%;
}

/* 手机端：顶栏「三」贴齐结果区左缘 */
@media (max-width: 719px) {
    .qimen-result-shell__head,
    .liuren-result-shell__head,
    .qizheng-result-shell__head,
    #caseDetailArea.result-mode--ziwei .result-shell-head,
    .result-shell-head--bazi-extra {
        padding-left: 0;
    }

    .qimen-result-shell__head .hd-menu-toggle--inline,
    .liuren-result-shell__head .hd-menu-toggle--inline,
    .qizheng-result-shell__head .hd-menu-toggle--inline,
    .paipan-result-title-block .hd-menu-toggle--inline {
        margin-left: -0.15rem;
    }
}

.hd-side-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(42, 36, 24, 0.38);
    backdrop-filter: none;
}

.hd-side-drawer-backdrop[hidden] {
    display: none !important;
}

.hd-side-drawer {
    --hd-drawer-cream: #f8f2e6;
    --hd-drawer-cream-deep: #f0e6d4;
    --hd-drawer-ink: #3d3428;
    --hd-drawer-muted: #7a6d5a;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 45;
    width: min(18.5rem, 82vw);
    height: 100%;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(120% 60% at 0% 0%, rgba(248, 220, 170, 0.35), transparent 55%),
        linear-gradient(180deg, #fbf6ec 0%, var(--hd-drawer-cream) 42%, var(--hd-drawer-cream-deep) 100%);
    border-right: 1px solid rgba(180, 150, 100, 0.22);
    box-shadow: 10px 0 32px rgba(60, 42, 20, 0.14);
    padding: calc(0.75rem + env(safe-area-inset-top)) 0 calc(1rem + env(safe-area-inset-bottom));
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    pointer-events: none;
}

.hd-side-drawer[hidden] {
    display: flex !important;
}

.hd-side-drawer.is-open {
    transform: translateX(0);
    pointer-events: auto;
}

.hd-side-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.45rem 1rem 0.65rem;
    border-bottom: 1px solid rgba(180, 150, 100, 0.2);
}

/* 手机端：缩小版「我的」资料卡 + 档案出生 */
.hd-side-drawer__profile {
    display: none;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.65rem 0.85rem 0.35rem;
}

.hd-side-drawer__profile-card {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.65rem;
    border-radius: 12px;
    border: 1px solid rgba(180, 150, 100, 0.28);
    background: linear-gradient(180deg, #fffdf8 0%, #f7efe2 100%);
    box-shadow: 0 2px 8px rgba(70, 50, 24, 0.04);
}

.hd-side-drawer__profile-avatar {
    position: relative;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 50%;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: linear-gradient(160deg, #f3e6d0, #e8d4b8);
    border: 1px solid rgba(196, 146, 62, 0.4);
    color: #6b5340;
}

.hd-side-drawer__profile-avatar-svg {
    display: block;
    opacity: 0.88;
}

.hd-side-drawer__profile-avatar-fallback {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 0.95rem;
    font-weight: 700;
    color: #4a3b28;
    background: inherit;
}

.hd-side-drawer__profile-avatar-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hd-side-drawer__profile-meta {
    flex: 1 1 auto;
    min-width: 0;
}

.hd-side-drawer__profile-nick {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--hd-drawer-ink);
    line-height: 1.25;
    word-break: break-all;
}

.hd-side-drawer__profile-sub {
    margin: 0.18rem 0 0;
    font-size: 0.68rem;
    color: var(--hd-drawer-muted);
    line-height: 1.3;
}

.hd-side-drawer__profile-edit {
    flex-shrink: 0;
    margin-left: auto;
    padding: 0.28rem 0.45rem;
    font-size: 0.66rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--hd-drawer-ink);
    background: rgba(255, 252, 246, 0.92);
    border: 1px solid rgba(196, 146, 62, 0.5);
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
}

.hd-side-drawer__birth {
    margin: 0;
    padding: 0 0.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}

.hd-side-drawer__birth-main {
    margin: 0;
    font-size: 0.72rem;
    line-height: 1.35;
    font-weight: 600;
    color: var(--hd-drawer-ink);
}

.hd-side-drawer__birth-bazi {
    margin: 0;
    font-size: 0.62rem;
    line-height: 1.35;
    letter-spacing: 0.04em;
    color: var(--hd-drawer-muted);
}

.hd-side-drawer__foot {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.55rem;
    margin-top: auto;
    padding: 0.75rem 1rem 0.15rem;
}

.hd-side-drawer__foot-link {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--hd-drawer-muted);
    letter-spacing: 0.02em;
    cursor: pointer;
    text-align: left;
}

.hd-side-drawer__foot-link:hover,
.hd-side-drawer__foot-link:active {
    color: var(--hd-drawer-ink);
    text-decoration: underline;
}

.hd-side-drawer__title {
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    color: var(--hd-drawer-ink);
}

.hd-side-drawer__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid rgba(180, 150, 100, 0.28);
    border-radius: 999px;
    background: rgba(255, 252, 246, 0.85);
    color: var(--hd-drawer-muted);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.hd-side-drawer__close:hover {
    background: rgba(232, 184, 106, 0.22);
    color: var(--hd-drawer-ink);
}

.hd-side-drawer__nav {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 0.85rem 0.85rem 0.5rem;
}

.hd-side-drawer__item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    text-align: left;
    padding: 0.82rem 0.9rem;
    border-radius: 14px;
    border: 1px solid rgba(180, 150, 100, 0.22);
    background: linear-gradient(180deg, #fffdf8 0%, #f7efe2 100%);
    color: var(--hd-drawer-ink);
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(70, 50, 24, 0.04);
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.hd-side-drawer__item:hover,
.hd-side-drawer__item:active {
    background: linear-gradient(180deg, #fff8ea 0%, #f3e4cc 100%);
    border-color: rgba(196, 146, 62, 0.45);
    transform: translateX(2px);
}

.hd-side-drawer__ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 11px;
    border: 1px solid rgba(180, 150, 100, 0.24);
    background: rgba(255, 250, 240, 0.95);
    color: #8a6a3a;
}

.hd-side-drawer__ico svg,
.hd-side-drawer__ico img {
    display: block;
    width: 1.15rem;
    height: 1.15rem;
}

.hd-side-drawer__ico--archive {
    color: #6b4e2d;
    background: rgba(232, 184, 106, 0.18);
}

.hd-side-drawer__ico--fortune {
    background: rgba(232, 184, 106, 0.2);
}

.hd-side-drawer__ico--exam {
    color: #7a5a8a;
    background: rgba(196, 170, 210, 0.22);
}

.hd-side-drawer__ico--exam-fav {
    color: #9a6a28;
    background: rgba(232, 184, 106, 0.22);
}

.hd-side-drawer__ico--ask {
    color: #6b4a1e;
    background: rgba(255, 248, 230, 0.92);
    border-color: rgba(180, 120, 40, 0.35);
}

/* 追问真人老师：金底高亮 CTA（可验前事） */
.hd-side-drawer__item--ask {
    border-color: rgba(180, 120, 40, 0.55);
    background: linear-gradient(165deg, #f3d7a0 0%, #e8b86a 55%, #dfaa58 100%);
    color: #2a2018;
    box-shadow: 0 4px 16px rgba(180, 120, 40, 0.22);
}

.hd-side-drawer__item--ask:hover,
.hd-side-drawer__item--ask:active {
    background: linear-gradient(165deg, #f6dfb0 0%, #ecbf78 55%, #e3b060 100%);
    border-color: rgba(160, 100, 30, 0.65);
    transform: translateX(2px);
}

.hd-side-drawer__item--ask .hd-side-drawer__label-main {
    font-weight: 800;
}

.hd-side-drawer__item--ask .hd-side-drawer__label-sub {
    display: block;
    margin-top: 0.12rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: rgba(58, 40, 18, 0.72);
}

.hd-side-drawer__item--me {
    display: none;
}

.hd-side-drawer__ico--me-security {
    color: #5a6a8a;
    background: rgba(140, 160, 200, 0.22);
}

/* 手机端 + 电脑端首页：显示「我的」资料卡 */
@media (max-width: 991px) {
    .hd-side-drawer__profile:not([hidden]) {
        display: flex;
    }

    .hd-side-drawer__item--me {
        display: flex;
    }
}

body.hd-home-page .hd-side-drawer__profile:not([hidden]) {
    display: flex;
}

.hd-side-drawer__label {
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.25;
}

.hd-side-drawer__label-main {
    display: block;
}

.hd-side-drawer__label-sub {
    display: none;
}

body.hd-side-drawer-open {
    overflow: hidden;
}

body.hd-side-drawer-open .hd-mobile-bottom-nav {
    display: none !important;
}

/* 题库全屏层 z-index 较高：打开侧栏时抬到其上方 */
body.exam-bank-modal-open .hd-side-drawer-backdrop,
body:has(#examBankModalBackdrop:not([hidden])) .hd-side-drawer-backdrop {
    z-index: 1250;
}

body.exam-bank-modal-open .hd-side-drawer,
body:has(#examBankModalBackdrop:not([hidden])) .hd-side-drawer {
    z-index: 1260;
}
