/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* iOS点击高亮透明 */
}

:root {
    --primary-color: #d4af37;
    --primary-gradient: linear-gradient(135deg, #d4af37 0%, #c9a961 100%);
    --secondary-color: #6b7280;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #f5f5f5;
    --bg-card: #ffffff;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 8px 16px rgba(0, 0, 0, 0.12);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
}

body {
    font-family: 'Inter', 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    background-image: none;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* iOS Safari视口高度修复 */
html {
    height: -webkit-fill-available;
}

/* noscript警告样式 */
.noscript-warning {
    background-color: #ffeb3b;
    border-bottom: 2px solid #ff9800;
    padding: 15px 0;
    text-align: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.noscript-warning h3 {
    margin: 0 0 10px 0;
    color: #d32f2f;
    font-size: 18px;
}

.noscript-warning p {
    margin: 5px 0;
    color: #333;
}

.noscript-warning ul {
    margin: 10px 0;
    padding-left: 20px;
    text-align: left;
    display: inline-block;
}

.noscript-warning li {
    margin-bottom: 5px;
    color: #555;
}

/* 当有noscript警告时，调整页面内容位置 */
body.has-noscript {
    padding-top: 200px; /* 根据警告框高度调整 */
}

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

/* 导航栏样式 */
.navbar {
    background: #2c2c2c;
    color: white;
    padding: 0.75rem 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid #d4af37;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #d4af37;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.logo:hover {
    color: #e5c158;
    text-decoration: none;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

.nav-menu li {
    margin: 0;
}

.nav-menu a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
}

.nav-menu a::before {
    display: none;
}

.nav-menu a:hover {
    color: #d4af37;
    background: transparent;
    transform: none;
    box-shadow: none;
}

.nav-menu a.active {
    background: transparent;
    color: #d4af37;
    box-shadow: none;
    border-bottom: 2px solid #d4af37;
}

.menu-toggle {
    display: none;
    cursor: pointer;
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

.menu-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* 主内容区域 */
main {
    flex: 1;
    padding: 2rem 0;
}

/* 页头样式 */
.page-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem 1.5rem;
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid #e5e7eb;
    position: relative;
    overflow: hidden;
    animation: none;
}

.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #d4af37;
    border-radius: 0;
}

.page-header h1 {
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 2rem;
    font-weight: 700;
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: unset;
    background-clip: unset;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 1rem;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}

/* 首页样式 */
.hero {
    text-align: center;
    padding: 2.5rem 1.5rem;
    margin-bottom: 2rem;
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid #e5e7eb;
    position: relative;
    overflow: hidden;
}

.hero::before {
    display: none;
}

.hero h1 {
    color: var(--text-primary);
    font-size: 2.2rem;
    margin-bottom: 1rem;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.hero p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.feature-card {
    background: var(--bg-card);
    padding: 1.75rem 1.5rem;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #d4af37;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: #d4af37;
}

.feature-card:hover::before {
    transform: scaleX(1);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #d4af37;
    display: inline-block;
    transition: transform 0.3s ease;
}

.feature-card:hover .feature-icon {
    transform: scale(1.05);
}

.feature-card h3 {
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 1.3rem;
    font-weight: 600;
}

.feature-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
    flex-grow: 1;
    font-size: 0.95rem;
}

.instructions {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.instructions h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.instructions ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.instructions li {
    margin-bottom: 0.5rem;
    color: #7f8c8d;
}

.note {
    background: #fff8e1;
    border-left: 4px solid #f1c40f;
    padding: 1rem;
    border-radius: 5px;
    font-style: italic;
}

/* 表单样式 */
.calculation-form {
    display: grid;
    gap: 2.5rem;
    width: 100%;
    overflow-x: hidden;
}

.form-card, .result-card {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
    border: 1px solid var(--border-color);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.form-card:hover, .result-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}

.form-card::before, .result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.form-card h2, .result-card h2 {
    color: var(--text-primary);
    margin-bottom: 1.75rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid;
    border-image: var(--primary-gradient) 1;
    font-size: 1.75rem;
    font-weight: 700;
}

.explanation, .current-time {
    color: var(--text-secondary);
    margin-bottom: 1.75rem;
    line-height: 1.8;
    font-size: 1.1rem;
}

.form-group {
    margin-bottom: 1.75rem;
}

.form-group label {
    display: block;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 1.05rem;
    font-family: inherit;
    background-color: var(--bg-card);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15), var(--shadow-md);
    transform: translateY(-2px);
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: var(--shadow-md);
}

.form-group textarea {
    min-height: 180px;
    resize: vertical;
    line-height: 1.6;
}

.hint {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 0.75rem;
    padding-left: 0.5rem;
    border-left: 3px solid var(--secondary-color);
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.75rem;
    background: #2c2c2c;
    color: #d4af37;
    text-decoration: none;
    border-radius: var(--radius-md);
    border: 2px solid #d4af37;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease;
    gap: 0.5rem;
    box-shadow: none;
    position: relative;
    overflow: hidden;
}

.btn::after {
    display: none;
}

.btn:hover {
    background: #d4af37;
    color: #2c2c2c;
    transform: none;
    box-shadow: var(--shadow-md);
    text-decoration: none;
}

.btn-primary {
    background: #2c2c2c;
    color: #d4af37;
    border-color: #d4af37;
}

.btn-primary:hover {
    background: #d4af37;
    color: #2c2c2c;
}

.btn-secondary {
    background: transparent;
    color: #6b7280;
    border-color: #6b7280;
}

.btn-secondary:hover {
    background: #6b7280;
    color: white;
}

.form-group .btn {
    margin-right: 1rem;
    margin-top: 0.5rem;
}

/* 结果区域样式 */
.result-meta {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1.5rem;
}

.result-meta p {
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.result-meta strong {
    color: #2c3e50;
}

.result-content {
    min-height: 200px;
}

.loading {
    text-align: center;
    padding: 4rem 2rem;
    color: #4a5568;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #e2e8f0;
    border-top-color: #4299e1;
    border-radius: 50%;
    animation: spin 1.2s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
}

.loading-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

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

.loading-dots span {
    width: 6px;
    height: 6px;
    background-color: #4299e1;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

.fa-spin {
    margin-right: 0.5rem;
}

.ai-response {
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 8px;
    border-top: 3px solid #d4af37;
    white-space: pre-line;
    line-height: 1.7;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    opacity: 0;
    transform: translateY(20px);
}

.ai-response::before {
    display: none;
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 说明区域 */
.explanation {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin-top: 2rem;
}

.explanation h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.explanation ul {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.explanation li {
    margin-bottom: 0.5rem;
    color: #7f8c8d;
}

/* 页脚样式 */
footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: auto;
}

footer p {
    margin-bottom: 0.5rem;
}

.disclaimer {
    font-size: 0.9rem;
    color: #bdc3c7;
    font-style: italic;
}

/* 移动端触控优化 */
.btn, button, input[type="button"], input[type="submit"] {
    min-height: 48px;
    min-width: 48px;
    touch-action: manipulation;
}

.form-group input,
.form-group select,
.form-group textarea {
    font-size: 16px; /* 防止iOS浏览器自动缩放 */
}

/* 手机号码输入框优化 */
input[type="tel"] {
    inputmode: numeric;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 0 20px;
    }

    .navbar {
        padding: 0.75rem 0;
    }

    .navbar .container {
        padding: 0 20px;
    }

    .logo {
        font-size: 1.5rem;
    }

    .nav-menu {
        display: none;
        flex-direction: column;
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background: linear-gradient(180deg, #1e1b4b 0%, #312e81 100%);
        padding: 1.5rem;
        box-shadow: var(--shadow-xl);
        border-radius: 0 0 var(--radius-xl) var(--radius-xl);
        max-height: 70vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        gap: 0.75rem;
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-menu li {
        margin: 0;
        width: 100%;
    }

    .nav-menu a {
        padding: 18px 20px;
        min-height: 58px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: var(--radius-lg);
        transition: all 0.3s ease;
        font-size: 1.1rem;
        font-weight: 500;
        background: rgba(255, 255, 255, 0.05);
        color: rgba(255, 255, 255, 0.9);
    }

    .nav-menu a:hover {
        background: rgba(255, 255, 255, 0.1);
        transform: translateX(8px);
        color: white;
    }

    .menu-toggle {
        display: flex;
        min-height: 48px;
        min-width: 48px;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.1);
        border-radius: var(--radius-md);
        padding: 12px;
        transition: all 0.3s ease;
    }

    .menu-toggle:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: rotate(90deg);
    }

    main {
        padding: 1.5rem 0;
    }

    .hero {
        padding: 3rem 1.5rem;
        margin: 1rem 0;
        border-radius: var(--radius-xl);
    }

    .hero h1 {
        font-size: 2.2rem;
        line-height: 1.3;
    }

    .hero p {
        font-size: 1.1rem;
        padding: 0;
    }

    .page-header {
        padding: 2.5rem 1.5rem;
        margin: 1.5rem 0;
        border-radius: var(--radius-xl);
    }

    .page-header h1 {
        font-size: 2rem;
    }

    .page-header p {
        font-size: 1.1rem;
    }

    .features {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin: 2.5rem 0;
    }

    .feature-card {
        padding: 2rem 1.5rem;
        border-radius: var(--radius-lg);
        margin: 0;
    }

    .feature-card:hover {
        transform: translateY(-6px);
    }

    .feature-icon {
        font-size: 2.5rem;
    }

    .form-card, .result-card {
        padding: 1.75rem;
        border-radius: var(--radius-lg);
    }

    .form-card h2, .result-card h2 {
        font-size: 1.5rem;
    }

    /* 移动端按钮优化 */
    .btn {
        min-height: 52px;
        padding: 16px 28px;
        font-size: 1.1rem;
        width: 100%;
        margin-bottom: 1rem;
        border-radius: var(--radius-lg);
    }

    .form-group .btn {
        margin-right: 0;
        margin-bottom: 1rem;
    }

    /* 表单元素触控优化 */
    .form-group input,
    .form-group select,
    .form-group textarea {
        min-height: 52px;
        font-size: 16px;
        padding: 15px 16px;
        border-radius: var(--radius-md);
        border-width: 2px;
    }

    .form-group label {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }

    /* 八星分析表格优化 */
    .analysis-table-container {
        margin: 1rem -20px;
        padding: 0 20px;
        border-radius: var(--radius-md);
    }

    .eight-star-table {
        font-size: 0.85rem;
        min-width: 700px;
    }

    .eight-star-table th,
    .eight-star-table td {
        padding: 12px 8px;
        white-space: nowrap;
    }

    .eight-star-table th:first-child,
    .eight-star-table td:first-child {
        position: sticky;
        left: 0;
        background: #2c3e50;
        color: white;
        z-index: 1;
    }

    .eight-star-table th:first-child {
        background: #1a202c;
    }

    .summary-stats {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: space-between;
    }

    .stat-item {
        padding: 0.5rem 0.75rem;
        border-radius: var(--radius-md);
        flex-direction: row;
        align-items: center;
        gap: 0.25rem;
        flex: 1;
        min-width: 100px;
        background: transparent;
        border: none;
        box-shadow: none;
    }

    .stat-label {
        font-size: 0.75rem;
        color: #9ca3af;
    }

    .stat-value {
        font-size: 0.9rem;
        font-weight: 700;
    }

    /* 防止页面缩放 */
    body {
        -webkit-text-size-adjust: 100%;
        touch-action: pan-y;
        overscroll-behavior-y: contain;
        -webkit-user-select: none;
        user-select: none;
    }
    
    /* 允许输入框文本选择 */
    .form-group input,
    .form-group select,
    .form-group textarea {
        -webkit-user-select: text;
        user-select: text;
    }

    /* 优化加载提示 */
    .loading {
        padding: 3rem 1.5rem;
        font-size: 1.1rem;
    }

    .ai-response {
        padding: 1.5rem;
        border-radius: var(--radius-lg);
        font-size: 1.05rem;
        line-height: 1.8;
    }

    /* 页脚优化 */
    footer {
        padding: 2rem 1rem;
        font-size: 0.95rem;
    }

    footer p {
        margin-bottom: 0.75rem;
        line-height: 1.6;
    }

    /* 说明区域优化 */
    .explanation {
        padding: 1.5rem;
        border-radius: var(--radius-lg);
        margin: 1.5rem 0;
    }

    .explanation h3 {
        font-size: 1.4rem;
    }

    .explanation ul {
        margin-left: 1.5rem;
    }

    .explanation li {
        margin-bottom: 0.75rem;
        font-size: 1.05rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .hero {
        padding: 2.5rem 1rem;
        border-radius: var(--radius-lg);
    }

    .hero h1 {
        font-size: 1.9rem;
    }

    .hero p {
        font-size: 1.05rem;
        padding: 0;
    }

    .features {
        gap: 1.25rem;
    }

    .feature-card {
        padding: 1.75rem 1.25rem;
        border-radius: var(--radius-lg);
    }

    .feature-icon {
        font-size: 2.2rem;
    }

    .page-header {
        padding: 2rem 1.25rem;
        border-radius: var(--radius-lg);
    }

    .page-header h1 {
        font-size: 1.7rem;
    }

    .form-card, .result-card {
        padding: 1.5rem;
        border-radius: var(--radius-lg);
    }

    .btn {
        min-height: 50px;
        padding: 14px 24px;
        font-size: 1.05rem;
        border-radius: var(--radius-md);
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        min-height: 50px;
        padding: 14px;
        border-radius: var(--radius-md);
    }

    .summary-stats {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .stat-item {
        padding: 0.5rem 0.75rem;
        border-radius: var(--radius-md);
        flex-direction: row;
        align-items: center;
        gap: 0.25rem;
        flex: 1;
        min-width: 90px;
        background: transparent;
        border: none;
        box-shadow: none;
    }

    .stat-label {
        font-size: 0.7rem;
        color: #9ca3af;
    }

    .stat-value {
        font-size: 0.85rem;
        font-weight: 700;
    }

    .eight-star-table {
        font-size: 0.8rem;
        min-width: 650px;
    }

    .eight-star-table th,
    .eight-star-table td {
        padding: 10px 6px;
    }

    .analysis-table-container {
        margin: 1rem -16px;
        padding: 0 16px;
    }

    footer {
        padding: 1.75rem 1rem;
        font-size: 0.9rem;
    }

    footer p {
        margin-bottom: 0.5rem;
    }

    .nav-menu a {
        padding: 16px 18px;
        min-height: 52px;
        font-size: 1.05rem;
    }
}

/* 八星学术分析样式 */
.eight-star-analysis {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.analysis-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f1c40f;
}

.analysis-header h3 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.analysis-header .explanation {
    color: #7f8c8d;
    font-size: 0.95rem;
    margin-bottom: 0;
}

.phone-segments {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1.5rem;
    border-left: 4px solid #3498db;
}

.phone-segments p {
    margin: 0;
    color: #2c3e50;
}

.phone-segments strong {
    color: #2c3e50;
}

.analysis-table-container {
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.eight-star-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.eight-star-table th {
    background: #2c3e50;
    color: white;
    padding: 0.75rem;
    text-align: left;
    font-weight: bold;
    position: sticky;
    top: 0;
}

.eight-star-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #e9ecef;
    color: #495057;
}

.eight-star-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.eight-star-table tr:hover {
    background-color: #e9ecef;
}

.eight-star-table .auspicious {
    color: #27ae60;
    font-weight: bold;
}

.eight-star-table .inauspicious {
    color: #e74c3c;
    font-weight: bold;
}

.analysis-summary {
    background: #ffffff;
    padding: 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid #e5e7eb;
    border-top: 3px solid #d4af37;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.analysis-summary::before {
    display: none;
}

.analysis-summary h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
}

.stat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    box-shadow: none;
    transition: all 0.2s ease;
    border: 1px solid #e5e7eb;
}

.stat-item:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
    border-color: #d4af37;
}

.stat-label {
    color: #6b7280;
    font-weight: 500;
    font-size: 0.85rem;
}

.stat-value {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95rem;
}

.stat-value.auspicious {
    color: #27ae60;
}

.stat-value.inauspicious {
    color: #e74c3c;
}

.analysis-notes {
    background: #fff8e1;
    padding: 1rem;
    border-radius: 5px;
    border-left: 4px solid #f1c40f;
    font-size: 0.9rem;
    color: #7f8c8d;
}

.analysis-notes p {
    margin: 0;
}

.analysis-notes strong {
    color: #2c3e50;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .eight-star-analysis {
        padding: 1.5rem;
    }
    
    .eight-star-table {
        font-size: 0.85rem;
    }
    
    .eight-star-table th,
    .eight-star-table td {
        padding: 0.5rem;
    }
    
    .summary-stats {
        grid-template-columns: 1fr;
    }
}

/* 八字排盘显示样式 */
.bazi-display {
    background: #ffffff;
    padding: 2rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.bazi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.bazi-item {
    text-align: center;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.bazi-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.bazi-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.bazi-ganzhi {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: 0.1em;
}

.bazi-wuxing {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    background: rgba(212, 175, 55, 0.1);
    border-radius: var(--radius-sm);
    display: inline-block;
}

.bazi-summary {
    background: #f8f9fa;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-color);
}

.bazi-summary p {
    margin: 0.5rem 0;
    color: var(--text-primary);
    line-height: 1.8;
}

.bazi-summary strong {
    color: var(--text-primary);
    margin-right: 0.5rem;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .bazi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .bazi-item {
        padding: 1.25rem;
    }
    
    .bazi-ganzhi {
        font-size: 1.75rem;
    }
    
    .bazi-display {
        padding: 1.5rem;
    }
    
    /* 大运H5模式：取消滑动，缩小尺寸全部显示 */
    .bazi-dayun-container {
        overflow-x: visible !important;
        gap: 0.1rem !important;
        -webkit-overflow-scrolling: auto;
        scrollbar-width: none;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0.3rem 0 !important;
    }
    
    .bazi-dayun-container::-webkit-scrollbar {
        display: none !important;
    }
    
    .bazi-dayun-item {
        min-width: 0 !important;
        flex: 1 1 0 !important;
        padding: 0.3rem 0.2rem !important;
        flex-shrink: 1 !important;
        max-width: 100%;
        border-radius: 4px !important;
    }
    
    .bazi-dayun-year {
        font-size: 0.6rem !important;
        margin-bottom: 0.2rem !important;
        line-height: 1.2;
    }
    
    .bazi-dayun-ganzhi {
        gap: 0.1rem !important;
    }
    
    .bazi-dayun-gan, .bazi-dayun-zhi {
        font-size: 0.75rem !important;
        padding: 0.1rem 0.2rem !important;
        min-width: 0 !important;
        line-height: 1.2;
        border-radius: 2px !important;
    }
}

@media (max-width: 480px) {
    .bazi-grid {
        grid-template-columns: 1fr;
    }
    
    .bazi-ganzhi {
        font-size: 1.5rem;
    }
    
    /* 大运H5模式：取消滑动，缩小尺寸全部显示 */
    .bazi-dayun-container {
        overflow-x: visible !important;
        gap: 0.08rem !important;
        -webkit-overflow-scrolling: auto;
        scrollbar-width: none;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0.25rem 0 !important;
    }
    
    .bazi-dayun-container::-webkit-scrollbar {
        display: none !important;
    }
    
    .bazi-dayun-item {
        min-width: 0 !important;
        flex: 1 1 0 !important;
        padding: 0.25rem 0.15rem !important;
        flex-shrink: 1 !important;
        max-width: 100%;
        border-radius: 4px !important;
    }
    
    .bazi-dayun-year {
        font-size: 0.55rem !important;
        margin-bottom: 0.15rem !important;
        line-height: 1.2;
    }
    
    .bazi-dayun-ganzhi {
        gap: 0.08rem !important;
    }
    
    .bazi-dayun-gan, .bazi-dayun-zhi {
        font-size: 0.7rem !important;
        padding: 0.08rem 0.15rem !important;
        min-width: 0 !important;
        line-height: 1.2;
        border-radius: 2px !important;
    }
}

/* 日期时间选择器样式 */
.bazi-datetime-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
}

.bazi-datetime-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.bazi-datetime-picker {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.bazi-datetime-header {
    padding: 1rem;
    text-align: center;
    font-size: 1.1rem;
    color: #1f2937;
    border-bottom: 1px solid #e5e7eb;
}

.bazi-datetime-tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
}

.bazi-datetime-tab {
    flex: 1;
    padding: 1rem;
    text-align: center;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    cursor: pointer;
}

.bazi-datetime-tab.active {
    color: #d32f2f;
    border-bottom-color: #d32f2f;
}

.bazi-datetime-wheels {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    height: 200px;
}

.bazi-datetime-wheel {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: y mandatory;
}

.bazi-datetime-wheel-item {
    padding: 1rem;
    text-align: center;
    scroll-snap-align: center;
    color: #9ca3af;
    font-size: 1.1rem;
}

.bazi-datetime-wheel-item.selected {
    color: #1f2937;
    font-weight: 600;
    font-size: 1.2rem;
}

.bazi-datetime-actions {
    display: flex;
    padding: 1rem;
    gap: 1rem;
    border-top: 1px solid #e5e7eb;
}

.bazi-datetime-btn {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
}

.bazi-datetime-btn.cancel {
    background: #f3f4f6;
    color: #1f2937;
}

.bazi-datetime-btn.confirm {
    background: #d32f2f;
    color: white;
}

/* 结果展示样式 */
.bazi-result-container {
    background: white;
    margin-top: 1rem;
    padding: 1.5rem;
}

.bazi-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.bazi-result-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1f2937;
}

.bazi-result-gender {
    color: #6b7280;
}

.bazi-result-solar-time {
    color: #6b7280;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.bazi-sizhu-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.bazi-sizhu-item {
    text-align: center;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
}

.bazi-sizhu-label {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.bazi-sizhu-ganzhi {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.bazi-gan, .bazi-zhi {
    font-size: 1.5rem;
    font-weight: 700;
    padding: 0.5rem;
    border-radius: 4px;
}

/* 五行颜色 */
.wuxing-jin { color: #f97316; } /* 金 - 橙色 */
.wuxing-mu { color: #22c55e; } /* 木 - 绿色 */
.wuxing-shui { color: #3b82f6; } /* 水 - 蓝色 */
.wuxing-huo { color: #ef4444; } /* 火 - 红色 */
.wuxing-tu { color: #a16207; } /* 土 - 棕色 */

.bazi-dayun-list {
    margin-top: 2rem;
}

.bazi-dayun-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #1f2937;
}

.bazi-dayun-container {
    display: flex;
    overflow-x: auto;
    gap: 1rem;
    padding: 0.5rem 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.bazi-dayun-container::-webkit-scrollbar {
    height: 6px;
}

.bazi-dayun-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.bazi-dayun-container::-webkit-scrollbar-thumb {
    background: #d32f2f;
    border-radius: 3px;
}

.bazi-dayun-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    min-width: 100px;
    flex-shrink: 0;
}

.bazi-dayun-year {
    color: #6b7280;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.bazi-dayun-ganzhi {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.bazi-dayun-gan, .bazi-dayun-zhi {
    font-size: 1.1rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    min-width: 40px;
    text-align: center;
}

/* 持续问话框样式 */
.bazi-chat-container {
    margin-top: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
}

.bazi-chat-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #1f2937;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e5e7eb;
}

.bazi-chat-history {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
    min-height: 200px;
}

.bazi-chat-message {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border-radius: 8px;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.bazi-chat-message-user {
    background: #eff6ff;
    border-left: 3px solid #3b82f6;
}

.bazi-chat-message-assistant {
    background: #f0fdf4;
    border-left: 3px solid #22c55e;
}

.bazi-chat-message-header {
    font-size: 0.85rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.bazi-chat-message-content {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #1f2937;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.bazi-chat-input-area {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.bazi-chat-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    max-height: 150px;
    outline: none;
    transition: border-color 0.2s;
}

.bazi-chat-input:focus {
    border-color: #d32f2f;
}

.bazi-chat-input:disabled {
    background: #f3f4f6;
    cursor: not-allowed;
}

.bazi-chat-send-btn {
    padding: 0.75rem 1.5rem;
    background: #d32f2f;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    min-width: 80px;
    height: fit-content;
}

.bazi-chat-send-btn:hover:not(:disabled) {
    background: #b71c1c;
}

.bazi-chat-send-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.bazi-chat-loading {
    text-align: center;
    padding: 1rem;
    color: #6b7280;
    font-size: 0.9rem;
}

.bazi-chat-loading i {
    margin-right: 0.5rem;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .bazi-chat-container {
        padding: 1rem;
        margin-top: 1.5rem;
    }
    
    .bazi-chat-history {
        max-height: 300px;
        min-height: 150px;
        padding: 0.75rem;
    }
    
    .bazi-chat-message {
        padding: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .bazi-chat-message-content {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    .bazi-chat-input-area {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .bazi-chat-send-btn {
        width: 100%;
        padding: 0.875rem;
    }
}

@media (max-width: 480px) {
    .bazi-chat-container {
        padding: 0.75rem;
        margin-top: 1rem;
    }
    
    .bazi-chat-history {
        max-height: 250px;
        min-height: 120px;
        padding: 0.5rem;
    }
    
    .bazi-chat-message {
        padding: 0.5rem;
        margin-bottom: 0.75rem;
    }
    
    .bazi-chat-message-content {
        font-size: 0.85rem;
    }
    
    .bazi-chat-input {
        font-size: 0.9rem;
        padding: 0.625rem;
    }
}