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;
    gap: 10px;           /* 输入框和按钮间距 */
    align-items: center;
    flex-wrap: wrap;     /* 手机小屏幕自动换行 */
    max-width: 100%;
}

/* 输入框 */
#promptInput {
     width: 400px;        /* 电脑端固定宽度 */
    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;
}
#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;
}

/* ---------------- 手机端优化 ---------------- */
@media (max-width: 768px) {
    /* 表单外层容器 */
    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;    /* 行间距缩小 */
}

    select, input[type="text"], input[type="radio"], input[type="checkbox"] {
        max-width: 100% !important;
    }
    #promptInput {
        width: 100% !important;
        max-width: none !important;
    }
    #sendButton {
        width: 100% !important;
        margin: 10px 0 0 0 !important;
    }
    #chatContainer { padding: 15px !important; }
    h1 { font-size: 1.5rem !important; }
}

@media (max-width: 768px) {
    #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;
  }
  .input-container {
        flex-direction: column;
        align-items: stretch;
    }
    #sendButton {
        width: 100%;
        margin-left: 0;
    }
  #promptInput {
        width: 100%;     /* 手机端全宽 */
    }
}

