/* 手机端底部 Tab 导航（命盘分析 / 问AI / 取名测名） */
:root {
    --app-tab-bar-height: 56px;
}

.app-bottom-tab-bar {
    display: none;
}

@media (max-width: 768px) {
    body.app-tab-layout {
        padding-bottom: calc(var(--app-tab-bar-height) + env(safe-area-inset-bottom, 0px));
        min-height: 100dvh;
    }

    body.app-tab-layout .site-nav {
        display: none;
    }

    .app-bottom-tab-bar {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1200;
        height: var(--app-tab-bar-height);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        box-sizing: content-box;
        background: linear-gradient(180deg, rgba(11, 44, 60, 0.97), rgba(7, 28, 38, 0.99));
        border-top: 1px solid rgba(167, 142, 111, 0.45);
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.35);
    }

    .app-bottom-tab-bar .tab-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 6px 4px 4px;
        border: none;
        background: transparent;
        color: var(--text-light-color, #b0c4de);
        font-family: inherit;
        font-size: 0.72rem;
        text-decoration: none;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .app-bottom-tab-bar .tab-item .tab-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 24px;
        height: 24px;
        min-width: 24px;
        min-height: 24px;
        flex-shrink: 0;
        line-height: 0;
        overflow: hidden;
    }

    .app-bottom-tab-bar .tab-item .tab-icon-svg {
        display: block;
        width: 24px;
        height: 24px;
        min-width: 24px;
        min-height: 24px;
        flex-shrink: 0;
    }

    .app-bottom-tab-bar .tab-item .tab-icon-emoji {
        width: 24px;
        height: 24px;
        font-size: 24px;
        line-height: 24px;
        text-align: center;
    }

    .app-bottom-tab-bar .tab-item.active {
        color: var(--accent-color, #a78e6f);
        font-weight: 600;
    }

    .app-bottom-tab-bar .tab-item.active .tab-icon-svg {
        filter: drop-shadow(0 2px 3px rgba(167, 142, 111, 0.45));
    }

    .app-tab-panel {
        display: none;
    }

    .app-tab-panel.active {
        display: block;
    }

    /* 主站：问 AI 全屏对话 */
    body.app-tab-layout[data-active-tab="chat"] {
        padding: 0;
        padding-bottom: calc(var(--app-tab-bar-height) + env(safe-area-inset-bottom, 0px));
        overflow: hidden;
        display: flex;
        flex-direction: column;
        height: 100dvh;
        max-height: 100dvh;
        box-sizing: border-box;
    }

    body.app-tab-layout[data-active-tab="chat"] .container {
        max-width: 100%;
        width: 100%;
        padding: 0;
        margin: 0;
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        text-align: left;
        overflow: hidden;
    }

    body.app-tab-layout[data-active-tab="chat"] .app-page-header,
    body.app-tab-layout[data-active-tab="chat"] #tab-panel-chart {
        display: none !important;
    }

    body.app-tab-layout[data-active-tab="chat"] #tab-panel-chat {
        display: flex !important;
        flex: 1;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
    }

    body.app-tab-layout[data-active-tab="chat"] #chat-section {
        display: flex !important;
        flex-direction: column;
        flex: 1 1 0;
        min-height: 0;
        height: 0;
        margin: 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
        padding: 10px 12px 8px;
        overflow: hidden;
    }

    body.app-tab-layout[data-active-tab="chat"] #chat-section h3 {
        flex-shrink: 0;
        margin: 0 0 8px;
        font-size: 1rem;
        text-align: center;
    }

    body.app-tab-layout[data-active-tab="chat"] .chat-messages-panel {
        flex: 1 1 0;
        min-height: 0;
        height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    body.app-tab-layout[data-active-tab="chat"] .chat-history {
        flex: 1 1 0;
        height: 0 !important;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        touch-action: pan-y;
        margin-bottom: 0;
        border: none;
        border-radius: 0;
        background: transparent;
    }

    body.app-tab-layout[data-active-tab="chat"] .chat-composer {
        flex: 0 0 auto;
        flex-shrink: 0;
        flex-grow: 0;
        margin: 8px 2px 4px;
        padding: 14px 16px 12px;
        border-radius: 20px;
    }

    body.app-tab-layout[data-active-tab="chat"] .chat-composer textarea {
        min-height: 56px;
        font-size: 1.05rem;
        padding-bottom: 12px;
    }

    body.app-tab-layout[data-active-tab="chat"] .chat-empty-hint {
        flex-shrink: 0;
        color: var(--text-light-color, #b0c4de);
        font-size: 0.9rem;
        text-align: center;
        padding: 16px 12px 8px;
        line-height: 1.6;
    }

    /* 主站命盘 Tab：紧凑页头 */
    body.app-tab-layout[data-active-tab="chart"] .app-page-header {
        margin-bottom: 16px;
    }

    body.app-tab-layout[data-active-tab="chart"] header h1 {
        font-size: 1.85rem;
        margin-bottom: 4px;
    }

    body.app-tab-layout[data-active-tab="chart"] header p {
        font-size: 0.9rem;
        margin-bottom: 12px;
    }

    body.app-tab-layout .container {
        padding-left: 10px;
        padding-right: 10px;
        padding-top: 12px;
    }
}

/* 桌面端：保留传统单页滚动，隐藏底部 Tab */
@media (min-width: 769px) {
    .app-tab-panel {
        display: block !important;
    }

    #tab-panel-chat .chat-empty-hint {
        display: none;
    }
}
