* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Microsoft Yahei', Arial, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* 头部样式 */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 0;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

header h1 {
    font-size: 1.9rem;
    margin-bottom: 10px;
}

header p.notice {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* 主容器样式 */
.container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 10px;
}

/* 运势类型标题 */
.fortune-type {
    text-align: center;
    margin-bottom: 30px;
}

.fortune-type h2 {
    color: #4a5568;
    display: block;
    padding: 10px 20px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    width: 50%;
    max-width: 480px;
    margin: 0 auto;
    box-sizing: border-box;
}

/* 卡片通用样式 */
.card {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    padding: 25px;
    margin-bottom: 30px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.card-header {
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.card-header h3 {
    font-size: 1.5rem;
    color: #667eea;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header h3 i {
    font-size: 1.2rem;
}

/* 运势基础信息样式 */
.fortune-basics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.basic-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.basic-item label {
    font-size: 0.9rem;
    color: #718096;
    margin-bottom: 8px;
}

.basic-item value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
}

/* 分数展示样式 */
.score-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.score-item {
    text-align: center;
    padding: 12px 10px;
    background-color: #f5f7ff; /* 分数卡片背景色 */
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.score-item .label {
    font-size: 0.85rem;
    color: #718096;
    margin-bottom: 5px;
}

.score-item .value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #667eea;
}

/* AI 智能解读区块 */
.ai-card {
    margin-top: 10px;
}

.ai-header h3 {
    font-size: 1.2rem;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.ai-header h3 i {
    color: #667eea;
}

.ai-subtitle {
    font-size: 0.9rem;
    color: #718096;
    margin-bottom: 12px;
}

.ai-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.ai-suggestions {
    margin: 8px 0 4px;
    display: flex;
    flex-direction: column; /* 竖排布局 */
    gap: 6px;
}

.ai-suggest-btn {
    padding: 4px 10px;
    border-radius: 8px; /* 与 ai-input / ai-msg / ai-btn 保持一致 */
    border: none; /* 去掉边线 */
    background-color: #eef2ff;
    font-size: 0.85rem;
    color: #4a5568;
    cursor: pointer;
    align-self: flex-start; /* 靠左对齐 */
    text-align: left;
}

.ai-input {
    display: flex;
    gap: 8px;
    margin: 20px 0; /* 上下边距 20px */
}

.ai-input input[type="text"] {
    flex: 1;
    padding: 8px 10px;
    border-radius: 8px; /* 圆角缩小 */
    border: 1px solid #e0e0e0;
    font-size: 0.9rem;
    outline: none;
}

.ai-input input[type="text"]:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 1px rgba(102, 126, 234, 0.3);
}

.ai-input button {
    padding: 8px 14px;
    border-radius: 8px; /* 圆角缩小 */
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
}

.ai-btn {
    padding: 6px 14px;
    border-radius: 8px; /* 与 ai-input / ai-msg 保持一致 */
    border: 1px solid #e0e0e0;
    background: #ffffff;
    cursor: pointer;
    font-size: 0.9rem;
    color: #4a5568;
}

.ai-btn.active {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
}

.ai-output {
    font-size: 0.95rem;
    color: #4a5568;
    line-height: 1.7;
    background-color: #f8fafc;
    border-radius: 12px;
    padding: 10px 12px;
    min-height: 120px;
    max-height: 320px; /* 初始高度限制，收到 AI 内容后在 JS 中放大到 80vh */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-msg {
    padding: 8px 12px;
    border-radius: 8px; /* 与 ai-input 一致的圆角 */
    max-width: 80%;
    word-break: break-word;
}

.ai-msg.user {
    background-color: #4c6fff;
    color: #ffffff;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.ai-msg.ai {
    background-color: #ffffff;
    color: #1f2933;
    margin-right: auto;
    border-bottom-left-radius: 8px;
}

/* AI 消息内 Markdown 渲染后的 HTML 样式 */
.ai-msg.ai p {
    margin: 0 0 0.5em;
}
.ai-msg.ai p:last-child {
    margin-bottom: 0;
}
.ai-msg.ai ul, .ai-msg.ai ol {
    margin: 0.5em 0;
    padding-left: 1.2em;
}
.ai-msg.ai li {
    margin-bottom: 0.25em;
}
.ai-msg.ai strong {
    font-weight: 600;
}
.ai-msg.ai h1, .ai-msg.ai h2, .ai-msg.ai h3 {
    font-size: 0.95em;
    margin: 0.6em 0 0.3em;
    font-weight: 600;
}

.ai-msg.loading {
    background-color: transparent;
    box-shadow: none;
    padding: 4px 0;
}

.ai-dots {
    display: inline-flex;
    gap: 4px;
}

.ai-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #a3b6ff;
    animation: ai-bounce 1s infinite ease-in-out;
}

.ai-dot:nth-child(2) {
    animation-delay: 0.15s;
}

.ai-dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes ai-bounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 运势详情样式 */
.fortune-details {
    margin-top: 20px;
}

.detail-item {
    margin-bottom: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.detail-item h4 {
    font-size: 1.1rem;
    color: #2d3748;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-item p {
    font-size: 1rem;
    color: #4a5568;
    line-height: 1.7;
}

/* 底部样式 */
footer {
    background-color: #2d3748;
    color: white;
    padding: 30px 0;
    margin-top: 50px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
}

footer p {
    margin-bottom: 10px;
    font-size: 0.9rem;
    opacity: 0.9;
}

footer .copyright {
    font-size: 0.85rem;
    opacity: 0.7;
}

/* 响应式调整 */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }

    .fortune-type {
        margin-bottom: 20px;
    }

    .fortune-type h2 {
        font-size: 1.4rem;
        padding: 8px 12px;
        width: 100%;
        box-sizing: border-box;
        border-radius: 12px;
        box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    }
    
    .card {
        padding: 20px;
    }
    
    .card-header h3 {
        font-size: 1.3rem;
    }
    
    .fortune-basics {
        /* 移动端当前运势卡片：3 列布局 */
        grid-template-columns: repeat(3, 1fr);
    }

    .score-container {
        /* 移动端当前运势卡片：3 列布局 */
        grid-template-columns: repeat(3, 1fr);
    }

    /* 移动端 AI 对话消息通宽显示 */
    .ai-msg {
        max-width: 100%;
    }
    .ai-msg.user,
    .ai-msg.ai {
        margin-left: 0;
        margin-right: 0;
    }
}

@media (max-width: 480px) {
    .fortune-basics {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .score-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 星座/生肖选择与周期标签 */
.selector-bar {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    padding: 20px;
    margin-bottom: 24px;
}
@media (max-width: 768px) {
    .container.selector-bar {
        margin-left: 10px;
        margin-right: 10px;
    }
}
.type-switch {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.type-switch button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    background: #f0f0f0;
    color: #555;
}
.type-switch button.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}
/* 星座/生肖：PC 端 2 行×6 列，移动端 6 行×2 列 */
.zodiac-items {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}
.zodiac-items button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 8px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    background: #fff;
    color: #333;
}
.zodiac-items button img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}
.zodiac-items button:hover, .zodiac-items button.active {
    border-color: #667eea;
    background: #f0ebff;
    color: #667eea;
}
@media (max-width: 768px) {
    .zodiac-items {
        grid-template-columns: repeat(2, 1fr);
    }
    /* 移动端星座/生肖：各 50% 通长居中 */
    .type-switch {
        width: 100%;
        justify-content: center;
    }
    .type-switch button {
        flex: 1;
        max-width: 50%;
        text-align: center;
    }
}
.period-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.period-tabs .tab-btn {
    flex: 1;
    min-width: 0;
    text-align: center;
    padding: 12px 18px; /* 增加高度 */
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem; /* 字号放大 */
    font-weight: 600; /* 文字加粗 */
    cursor: pointer;
    background: #fff;
    color: #555;
}
.period-tabs .tab-btn.active {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}
/* 移动端周期：今日/明日一行，本周/本月一行，本年运势通长一行（写在基础样式后才会覆盖） */
@media (max-width: 768px) {
    .period-tabs {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .period-tabs .tab-btn:nth-child(5) {
        grid-column: 1 / -1;
    }
}
#loading-msg {
    text-align: center;
    padding: 60px 20px;
    color: #718096;
    font-size: 1.1rem;
}
#loading-msg.loading {
    color: #667eea;
}
#loading-msg.error {
    color: #e53e3e;
}
#fortune-cards {
    display: none;
}
#fortune-cards.visible {
    display: block;
}
