/* ==========================================================================
   1. LAYOUT & RESPONSIVE CONTAINERS (布局与响应式容器)
   ========================================================================== */
@media (min-width: 768px) {
    .tool-container-standard {
        max-width: 900px !important;
    }
}

body {
    justify-content: flex-start !important;
    padding-bottom: 40px;
    height: auto !important;
    overflow-y: auto !important;
}

.form-section {
    background: var(--glass-bg) !important;
    border: none !important;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 600;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 12px var(--mystic-shadow);
    margin-top: 10px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
    box-shadow: 0 6px 16px var(--mystic-glow);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.tool-switch-btn {
    text-decoration: none;
    font-size: 22px;
    margin-left: 12px;
    opacity: 0.7;
    transition: all 0.3s;
    display: flex;
    align-items: center;
}

.tool-switch-btn:hover {
    opacity: 1;
    transform: scale(1.2);
}

/* ==========================================================================
   2. RESULT DISPLAY & SAN FANG SI ZHENG TABLE (三方四正摘要表)
   ========================================================================== */
#result-area {
    border-top: 2px solid var(--primary-color);
    margin-top: 30px;
    padding: 30px 0;
    display: none;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-header {
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 20px;
    color: var(--primary-color);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--glass-border);
}

.ziwei-table-wrapper {
    overflow-x: auto;
    margin: 20px 0 30px 0;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.02);
}

.ziwei-table {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    min-width: 500px;
    text-align: center;
}

.ziwei-cell {
    padding: 14px 10px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.ziwei-table .ziwei-cell:not(:last-child) {
    border-right: 1px solid var(--glass-border);
}

.ziwei-cell.header {
    background: rgba(8, 145, 178, 0.15);
    font-weight: 700;
    color: var(--primary-color);
    font-size: 14px;
    border-bottom: 2px solid var(--glass-border);
}

.ziwei-cell .palace-name {
    font-size: 15px;
    font-weight: bold;
    color: var(--text-primary);
}

.ziwei-cell .branch-name {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.ziwei-cell .stars-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.ziwei-cell .star-item {
    font-size: 14px;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ziwei-cell .star-item.major {
    color: #ef4444; /* 红色主星 */
}

.ziwei-cell .star-item.minor {
    color: var(--secondary-color);
}

.night-theme .ziwei-cell .star-item.minor {
    color: #2dd4bf;
}

.ziwei-cell .star-mutagen {
    font-size: 10px;
    padding: 1px 3px;
    background: #ef4444;
    color: #fff;
    border-radius: 3px;
    font-weight: bold;
    line-height: 1;
}

.ziwei-cell .star-brightness {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: normal;
}

/* ==========================================================================
   3. GEJU TAGS (格局标签与动画)
   ========================================================================== */
.geju-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin: 24px 0;
}

.geju-tag {
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: help;
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    overflow: hidden;
}

/* 吉格样式 */
.geju-tag.tag-ji {
    background: rgba(8, 145, 178, 0.12);
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(8, 145, 178, 0.15);
}

.geju-tag.tag-ji:hover {
    background: rgba(8, 145, 178, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(8, 145, 178, 0.3);
}

/* 凶格样式 */
.geju-tag.tag-xiong {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid #f59e0b;
    color: #d97706;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.15);
}

.night-theme .geju-tag.tag-xiong {
    color: #fbbf24;
}

.geju-tag.tag-xiong:hover {
    background: rgba(245, 158, 11, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.3);
}

/* ==========================================================================
   4. AI INTERPRETATION BOX (AI 深度解析面板)
   ========================================================================== */
.ai-analysis-box {
    margin-top: 30px;
    padding: 24px;
    background: rgba(13, 148, 136, 0.04);
    border: 1px solid rgba(13, 148, 136, 0.15);
    border-radius: 16px;
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 15px;
}

.ai-analysis-box h3,
.ai-analysis-box h4 {
    color: var(--primary-color);
    margin-top: 1.6em;
    margin-bottom: 0.8em;
    font-weight: 600;
}

.ai-analysis-box h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.25em;
    border-bottom: 1px dashed rgba(8, 145, 178, 0.25);
    padding-bottom: 8px;
}

.ai-analysis-box p {
    margin-bottom: 1.2em;
    line-height: 1.8;
}

.ai-analysis-box strong {
    color: var(--primary-color);
    font-weight: 600;
    background: rgba(8, 145, 178, 0.08);
    padding: 0 4px;
    border-radius: 4px;
}

.typing-indicator {
    display: inline-flex;
    align-items: center;
    color: var(--text-secondary);
}

.typing-indicator span {
    animation: blink 1.4s infinite both;
    margin: 0 2px;
    font-weight: bold;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
    0% { opacity: 0.2; }
    20% { opacity: 1; }
    100% { opacity: 0.2; }
}

.ai-analysis-box think, 
.ai-analysis-box .think-box {
    display: block;
    margin: 12px 0;
    padding: 12px 18px;
    background: rgba(13, 148, 136, 0.08);
    border-left: 3px solid var(--secondary-color);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.9em;
}

.ai-analysis-box think::before, 
.ai-analysis-box .think-box::before {
    content: '💭 思考过程：';
    display: block;
    font-weight: bold;
    margin-bottom: 6px;
    color: var(--secondary-color);
}

.ai-trigger-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}
