/* 基础样式 */
body {
    margin: 0;
    padding: 40px 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: linear-gradient(180deg, #f9f5ff, #e7dbff 60%, #d3c2f5);
    background-attachment: fixed;
    background-size: cover;
}

/* 主容器 */
#chatContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 800px;
    margin: auto;
    padding: 1px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 20px;
    box-shadow: 0 0 30px rgba(160, 120, 255, 0.3);
}

/* 标题 */
h1 {
    font-size: 40px;
    color: #663399;
    text-shadow: 2px 2px 8px #bbb;
    margin-bottom: 5px;
}

/* 输入区域 - 修改为垂直布局 */
.input-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
}

/* 数字输入框容器 */
.shuzi-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

/* 数字输入框样式 */
#shuzi {
    width: 280px;
    max-width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #999;
    border-radius: 12px;
    background-color: #fffefc;
    box-shadow: 0 0 10px #c5a3ff;
    transition: 0.3s;
    box-sizing: border-box;
}

#shuzi:focus {
    outline: none;
    box-shadow: 0 0 20px #d3aaff;
}

#phone {
    width: 280px;
    max-width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #999;
    border-radius: 12px;
    background-color: #fffefc;
    box-shadow: 0 0 10px #c5a3ff;
    transition: 0.3s;
    box-sizing: border-box;
}

#phone:focus {
    outline: none;
    box-shadow: 0 0 20px #d3aaff;
}

#weixin {
    width: 280px;
    max-width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #999;
    border-radius: 12px;
    background-color: #fffefc;
    box-shadow: 0 0 10px #c5a3ff;
    transition: 0.3s;
    box-sizing: border-box;
}

#weixin:focus {
    outline: none;
    box-shadow: 0 0 20px #d3aaff;
}

/* 文本和按钮容器 */
.text-button-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    width: 100%;
}

#promptInput {
    width: 420px;
    max-width: 100%;
    min-height: 100px;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #999;
    border-radius: 12px;
    background-color: #fffefc;
    box-shadow: 0 0 10px #c5a3ff;
    transition: 0.3s;
    box-sizing: border-box;
    resize: vertical;
}

#promptInput:focus {
    outline: none;
    box-shadow: 0 0 20px #d3aaff;
}

/* 按钮 */
#sendButton {
    padding: 12px 24px;
    font-size: 16px;
    background: linear-gradient(135deg, #a678f0, #7f00ff);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 0 15px #d6bbff;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#sendButton:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px #d6bbff;
}

/* 响应框 */
#responseBox {
    margin-top: 30px;
    width: 90%;
    max-width: 700px;
    padding: 24px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 18px;
    box-shadow: 0 0 25px #e0cfff;
    font-size: 18px;
    white-space: pre-wrap;
    color: #333;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s ease, transform 1s ease;
}

.fade-in {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* 干支区域 */
.ganzhi-section {
    text-align: center;
    margin-top: 1px;
}

.year-btn {
    padding: 0.5em 1.2em;
    border: 1px solid #cdddcf;
    border-radius: 10px;
    cursor: pointer;
    background-color: #eef6ec;
    color: #2d3c2a;
    font-size: 1em;
    transition: all 0.2s ease;
}

.year-btn:hover {
    background-color: #d8efdb;
    border-color: #a6cfa2;
}

.year-btn.selected {
    background-color: #b8e0b0;
    border-color: #74b275;
    color: #264926;
    box-shadow: 0 0 6px rgba(116, 178, 117, 0.5);
    font-weight: bold;
}

/* 容器 */
.container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    margin: 0 auto;
}

.container.hidden {
    display: none;
}

/* 八字容器 */
.bazi-container, .explanation {
    background: rgba(30, 30, 50, 0.7);
    border-radius: 15px;
    padding: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.bazi-container {
    padding-bottom: 1px;
}

.bazi-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.bazi-title {
    font-size: 1.8rem;
    color: #f9d342;
    margin-bottom: 5px;
}

.bazi-subtitle {
    font-size: 1.1rem;
    opacity: 0.8;
}

/* 八字网格 */
#baziGrid {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 15px;
}

.pillar {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
}

.pillar-label {
    position: absolute;
    top: -30px;
    font-size: 1.1rem;
    color: #f9d342;
    opacity: 0.9;
}

.tian-gan-container, .di-zhi-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tian-gan-container { 
    margin-bottom: 2px; 
}

.shi-shen {
    font-size: 1rem;
    color: #a8e6cf;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.gan-shi-shen { 
    margin-bottom: 2px; 
}

.zhi-shi-shen { 
    margin-top: 2px; 
}

.tian-gan, .di-zhi {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: bold;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    background: linear-gradient(145deg, #3a3a5c, #2a2a4c);
}

.tian-gan {
    color: #f9d342;
    background: linear-gradient(145deg, #4a4a7c, #3a3a6c);
}

.di-zhi { 
    color: #a8e6cf; 
}

.day-pillar .tian-gan {
    background: linear-gradient(145deg, #d35400, #e67e22);
    color: white;
    box-shadow: 0 0 15px rgba(230, 126, 34, 0.5);
}

/* 解释区域 */
.explanation h2 {
    color: #f9d342;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.8rem;
}

.explanation-content { 
    line-height: 1.7; 
}

.explanation-content p {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.highlight {
    color: #f9d342;
    font-weight: bold;
}

/* 五行元素 */
.element {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 5px;
}

.element-metal { background-color: #a8e6cf; }
.element-water { background-color: #85c1e9; }
.element-wood { background-color: #82e0aa; }
.element-fire { background-color: #f9d342; }
.element-earth { background-color: #d7bde2; }

/* 页脚 */
footer {
    margin-top: 40px;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    padding: 20px;
    font-size: 0.9rem;
}

/* 悬浮框 */
#inviteBox {
    position: fixed;
    top: 100px;
    left: 100px;
    background: rgba(90, 60, 200, 0.9);
    color: white;
    padding: 10px 15px;
    border-radius: 10px;
    cursor: move;
    user-select: none;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 9999;
}

/* 导航相关 */
.page-title {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
}

.page-description {
    font-size: 1.2rem;
    line-height: 1.6;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
}

.card h3 {
    margin-top: 0;
}

.private-nav-container {
    position: relative;
    width: 100%;
    min-height: 0vh;
    isolation: isolate;
}

.floating-nav {
    position: fixed;
    z-index: 1000;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(15px);
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.18);
    padding: 6px;
    transition: box-shadow .2s ease, transform 0.3s ease;
    cursor: grab;
    user-select: none;
    touch-action: none;
    overflow: hidden;
}

.floating-nav:active {
    cursor: grabbing;
    box-shadow: 0 12px 36px rgba(0,0,0,0.3);
}

.desktop-nav {
    left: 24px;
    width: min(150px, calc(100vw - 48px));
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(5, minmax(0, 1fr));
    grid-auto-flow: column;
    gap: 0;
    align-items: stretch;
}

.mobile-nav {
    left: 50%;
    bottom: 0;
    width: min(96vw, 520px);
    max-width: 520px;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    grid-auto-flow: row;
    gap: 0;
    align-items: stretch;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #35373b;
    text-decoration: none;
    padding: 14px 8px;
    min-height: 78px;
    margin: 0 !important;
    border-radius: 0;
    border: 1px solid rgba(255,255,255,0.16);
    transition: background .3s, transform .3s;
    box-sizing: border-box;
}

.desktop-nav .nav-item {
    margin: 0 !important;
    padding: 12px 4px;
    min-height: 76px;
}

.mobile-nav .nav-item {
    margin: 0 !important;
}

.nav-item:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

.nav-item.active {
    background: rgba(255,255,255,0.28);
}

.nav-item.nav-item-disabled {
    color: #35373b;
    background: transparent;
    cursor: grab;
}

.nav-item.nav-item-disabled:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

.nav-item i {
    font-size: 22px;
    margin-bottom: 6px;
}

.desktop-nav .nav-item i {
    font-size: 20px;
    margin-bottom: 6px;
}

.nav-text {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
}

.desktop-nav .nav-text {
    font-size: 13px;
}

/* 响应式设计 */
@media (min-width: 769px) {
    .mobile-nav { display: none !important; }
    .desktop-nav { display: grid !important; }
}

@media (max-width: 768px) {
    .desktop-nav { display: none !important; }
    .mobile-nav { 
        display: grid !important;
        align-items: stretch;
    }

    .nav-item {
        min-height: 48px;
        padding: 8px 6px;
    }
    
    .text-button-container {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    /* 表单布局 */
    form.ganzhi-section > div {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 0.5em !important;
        align-items: flex-start !important;
    }
    
    .ganzhi-section .topic-section {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 0.05em 0.1em !important;
        justify-content: flex-start !important;
        align-items: center !important;
        text-align: left !important;
        margin-top: 0.2em !important;
        margin-bottom: 0.2em !important;
    }
    
    .ganzhi-section .topic-section label {
        flex: 0 0 auto;
        white-space: nowrap;
        margin-bottom: 0.2em;
    }
    
    /* 输入区域 */
    .input-container {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    #promptInput {
        width: 100% !important;
        max-width: none !important;
    }
    
    #sendButton {
        width: 100% !important;
        margin: 10px 0 0 0 !important;
    }
    
    /* 数字输入框 */
    #shuzi {
        width: 100% !important;
    }
    
    /* 干支年份选项 */
    #ganZhiYearOptions {
        align-items: center;
    }
    
    #ganZhiYearOptions > div {
        display: flex;
        flex-wrap: wrap;
        gap: 0.3em;
        justify-content: center;
        margin-bottom: 0.3em;
    }
    
    #ganZhiYearOptions .year-btn {
        font-size: 0.85em;
        padding: 0.35em 0.8em;
    }
    
    /* 容器调整 */
    .container {
        zoom: 0.8;
        margin-bottom: 20px;
    }
    
    #chatContainer { 
        padding: 15px !important; 
    }
    
    h1 { 
        font-size: 1.5rem !important; 
    }
    
    select, input[type="text"], input[type="radio"], input[type="checkbox"] {
        max-width: 100% !important;
    }
}
