/* 全局样式 - 传统纸钱黄和喜字红配色方案 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Serif SC', 'Microsoft YaHei', serif;
    background: linear-gradient(135deg, #f4e4bc 0%, #e8d4a1 50%, #f4e4bc 100%);
    min-height: 100vh;
    color: #8B4513;
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
}

/* 背景八卦装饰 */
.bg-decoration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    opacity: 0.1;
}

.bagua-bg {
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 50% 50%, #c41e3a 10%, transparent 10%),
        linear-gradient(45deg, #c41e3a 25%, transparent 25%),
        linear-gradient(-45deg, #c41e3a 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #c41e3a 75%),
        linear-gradient(-45deg, transparent 75%, #c41e3a 75%);
    background-size: 400px 400px, 200px 200px, 200px 200px, 200px 200px, 200px 200px;
    background-position: center top, center center, center center, center center, center center;
}

@keyframes baguaRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.main-container {
    position: relative;
    min-height: 100vh;
}

/* 主页样式 */
.homepage {
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header {
    text-align: center;
    margin-bottom: 40px;
    color: #8B4513;
}

.main-title {
    font-size: 3.5rem;
    font-weight: 700;
    color: #c41e3a;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 10px;
    background: linear-gradient(135deg, #c41e3a, #e74c3c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.4rem;
    color: #8B4513;
    font-weight: 400;
    opacity: 0.8;
}

/* 八卦导航 */
.bagua-navigation {
    margin: 60px 0;
}

.bagua-circle {
    position: relative;
    width: 500px;
    height: 500px;
    margin: 0 auto;
}

/* 中心太极 */
.taiji-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    cursor: pointer;
    z-index: 10;
    animation: taijiRotate 8s linear infinite reverse;
}

@keyframes taijiRotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.taiji {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, #000000 50%, #ffffff 50%);
    box-shadow: 0 0 20px rgba(196, 30, 58, 0.3);
}

.taiji-yin {
    position: absolute;
    top: 0;
    left: 25%;
    width: 50%;
    height: 50%;
    background: #ffffff;
    border-radius: 50%;
}

.taiji-yang {
    position: absolute;
    bottom: 0;
    right: 25%;
    width: 50%;
    height: 50%;
    background: #000000;
    border-radius: 50%;
}

.taiji-yin::after {
    content: '';
    position: absolute;
    top: 25%;
    left: 25%;
    width: 50%;
    height: 50%;
    background: #000000;
    border-radius: 50%;
}

.taiji-yang::after {
    content: '';
    position: absolute;
    top: 25%;
    left: 25%;
    width: 50%;
    height: 50%;
    background: #ffffff;
    border-radius: 50%;
}

.home-text {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: #c41e3a;
    color: #fff;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(196, 30, 58, 0.4);
}

/* 服务项 */
.service-item {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #f4e4bc, #e8d4a1);
    border: 3px solid #c41e3a;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(196, 30, 58, 0.3);
}

/* 七项服务均匀分布 - 360度/7 ≈ 51.43度间隔，半径220px */
/* 使用数学计算：x = r * cos(θ), y = r * sin(θ)，其中r=220px */
.service-n {           /* 0度 - 正北 - 八字算命 */
    margin-top: -220px;
    margin-left: -35px;
}

.service-ne {          /* 51.43度 - 事业运势 */
    margin-top: -172px;
    margin-left: -177px;
}

.service-e {           /* 102.86度 - 面相分析 */
    margin-top: -48px;
    margin-left: -215px;
}

.service-se {          /* 154.29度 - 情侣配对 */
    margin-top: 98px;
    margin-left: -196px;
}

.service-s {           /* 205.71度 - 卦象分析 */
    margin-top: 182px;
    margin-left: -91px;
}

.service-sw {          /* 257.14度 - 八字合婚 */
    margin-top: 137px;
    margin-left: 76px;
}

.service-w {           /* 308.57度 - 起名建议 */
    margin-top: -27px;
    margin-left: 158px;
}

.service-item:hover {
    transform: scale(1.2);
    background: linear-gradient(135deg, #fff, #f4e4bc);
    box-shadow: 0 6px 25px rgba(196, 30, 58, 0.5);
    z-index: 20;
}

.service-icon {
    font-size: 20px;
    font-weight: bold;
    color: #c41e3a;
    line-height: 1;
}

.service-name {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    background: #c41e3a;
    color: #fff;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 2px 6px rgba(196, 30, 58, 0.4);
}

.service-item:hover .service-name {
    opacity: 1;
}

/* 服务介绍 */
.service-intro {
    max-width: 1200px;
    width: 100%;
    margin: 80px auto 40px;
    padding: 0 20px;
}

.intro-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.intro-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 25px rgba(139, 69, 19, 0.15);
    border: 2px solid rgba(196, 30, 58, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/*.intro-card::before {*/
/*    content: '';*/
/*    position: absolute;*/
/*    top: 0;*/
/*    left: 0;*/
/*    width: 100%;*/
/*    height: 4px;*/
/*    background: linear-gradient(90deg, #c41e3a, #e74c3c, #c41e3a);*/
/*    background-size: 200% 100%;*/
/*    animation: shimmer 3s linear infinite;*/
/*}*/

@keyframes shimmer {
    from { background-position: -200% 0; }
    to { background-position: 200% 0; }
}

.intro-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(139, 69, 19, 0.25);
    background: rgba(255, 255, 255, 1);
}

.intro-card h3 {
    color: #c41e3a;
    font-size: 1.6rem;
    margin-bottom: 15px;
    text-align: center;
    position: relative;
}

.intro-card h3::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 2px;
    background: #c41e3a;
}

.intro-card p {
    color: #5d4e37;
    line-height: 1.7;
    margin-bottom: 20px;
    font-size: 15px;
}

.intro-card .price {
    text-align: center;
    font-size: 1.3rem;
    font-weight: bold;
    color: #c41e3a;
    background: rgba(196, 30, 58, 0.1);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(196, 30, 58, 0.2);
}

/* 服务页面 */
.service-pages {
    display: none;
    min-height: 100vh;
    background: rgba(244, 228, 188, 0.95);
    padding: 20px;
    animation: fadeIn 0.5s ease;
}

.service-pages.active {
    display: block;
}

.service-section {
    max-width: 900px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 15px 40px rgba(139, 69, 19, 0.2);
    border: 3px solid rgba(196, 30, 58, 0.3);
}

.service-section h2 {
    color: #c41e3a;
    font-size: 2.2rem;
    margin-bottom: 20px;
    text-align: center;
    position: relative;
    padding-bottom: 15px;
}

.service-section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, #c41e3a, #e74c3c);
    border-radius: 2px;
}

.service-desc {
    text-align: center;
    color: #5d4e37;
    font-size: 1.1rem;
    margin-bottom: 30px;
    line-height: 1.6;
}

/* 表单样式 */
.analysis-form {
    margin-bottom: 30px;
}

.analysis-form h3 {
    color: #8B4513;
    font-size: 1.3rem;
    margin-bottom: 20px;
    text-align: center;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.form-group {
    flex: 1;
    min-width: 200px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #8B4513;
    font-weight: 500;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #d4a574;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s ease;
    font-family: 'Noto Serif SC', serif;
    background: rgba(255, 255, 255, 0.8);
    color: #3a2a1a;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #c41e3a;
    box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.1);
    background: white;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* 按钮样式 */
.analyze-btn {
    background: linear-gradient(135deg, #c41e3a, #e74c3c);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 30px auto 0;
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.3);
}

.analyze-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(118, 75, 162, 0.4);
}

.analyze-btn:active {
    transform: translateY(0);
}

.analyze-btn i {
    font-size: 16px;
}

/* 上传区域 */
.upload-section {
    text-align: center;
    margin-bottom: 30px;
}

.upload-box {
    border: 3px dashed #c41e3a;
    border-radius: 15px;
    padding: 40px;
    background: rgba(196, 30, 58, 0.05);
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.upload-box:hover {
    background: rgba(196, 30, 58, 0.1);
    border-color: #8B4513;
}

.upload-box i {
    font-size: 3rem;
    color: #c41e3a;
}

.upload-box p {
    color: #5d4e37;
    font-size: 16px;
    margin: 0;
    font-weight: 600;
}

.image-preview {
    position: relative;
    display: inline-flex;        /* inline-flex 与 inline-block 行内特性相同但可用 flex 居中 */
    align-items: center;         /* 垂直居中 img */
    justify-content: center;     /* 水平居中 img */
    width: 220px;                /* 可按需改大小或用 % */
    height: 220px;               /* 保持为正方形头像框 */
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(139, 69, 19, 0.2);
    border: 3px solid #c41e3a;
    background: #fff;            /* 当图片较小或加载慢时的背景色 */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInScale 0.5s ease-out;
}

.image-preview:hover {
    transform: scale(1.03);
    box-shadow: 0 12px 35px rgba(139, 69, 19, 0.3);
    border-color: #e74c3c;
}

.image-preview img {
    width: 100%;                 /* 占满容器 */
    height: 100%;
    object-fit: cover;           /* 保持比例并裁剪以填满框 */
    object-position: center;     /* 保证裁剪以图片中心为准 */
    display: block;
    transition: transform 0.3s ease;
}

.image-preview:hover img {
    transform: scale(1.05);
}

/* 图片加载状态 */
.image-preview.loading {
    background: linear-gradient(45deg, #f8f8f8 25%, #e8e8e8 25%, #e8e8e8 50%, #f8f8f8 50%, #f8f8f8 75%, #e8e8e8 75%, #e8e8e8);
    background-size: 20px 20px;
    animation: loadingShimmer 1.5s infinite linear;
}

.image-preview.loading::before {
    content: "";
    position: absolute;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(196, 30, 58, 0.1);
    border-top: 3px solid #c41e3a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(196, 30, 58, 0.9);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    transition: all 0.3s ease;
}

.remove-btn:hover {
    background: #8B4513;
    transform: scale(1.1);
}

/* 情侣配对上传 */
.couple-upload {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

/* 卦象选择 */
.hexagram-input {
    margin: 20px 0;
    padding: 25px;
    background: rgba(196, 30, 58, 0.05);
    border-radius: 15px;
    border: 2px solid rgba(196, 30, 58, 0.2);
}

.hexagram-input h4 {
    color: #8B4513;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.2rem;
}

.hexagram-row {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 15px 0;
}

.hexagram-select {
    background: white;
    border: 2px solid #d4a574;
    color: #3a2a1a;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    min-width: 120px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    position: relative;
    font-family: 'Noto Serif SC', serif;
}

.hexagram-select:hover {
    border-color: #c41e3a;
    background: #fff5f5;
    transform: translateY(-2px);
}

.hexagram-select:focus {
    outline: none;
    border-color: #c41e3a;
    box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.1);
}

.random-hexagram-btn {
    background: linear-gradient(135deg, #f4e4bc, #d4a574);
    color: #8B4513;
    border: 2px solid #c41e3a;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    margin: 25px auto;
    display: block;
    transition: all 0.3s ease;
    font-weight: 700;
    font-family: 'Noto Serif SC', serif;
}

.random-hexagram-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(196, 30, 58, 0.3);
    background: linear-gradient(135deg, #c41e3a, #f4e4bc);
    color: white;
}

/* 结果区域 */
.result-section {
    display: none;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    margin-top: 30px;
    box-shadow: 0 15px 40px rgba(139, 69, 19, 0.2);
    overflow: hidden;
    animation: slideIn 0.5s ease-out;
    border: 3px solid rgba(196, 30, 58, 0.3);
}

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

.result-header {
    background: linear-gradient(135deg, #c41e3a, #e74c3c);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.result-header h2 {
    margin: 0;
    color: white;
    font-size: 1.5rem;
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 20px;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.result-content {
    padding: 30px;
    max-height: 70vh;
    overflow-y: auto;
    line-height: 1.8;
    font-size: 15px;
    color: #3a2a1a;
}

.result-content h3 {
    color: #c41e3a;
    font-size: 1.3rem;
    margin: 25px 0 15px 0;
    border-bottom: 2px solid #c41e3a;
    padding-bottom: 8px;
}

.result-content h4 {
    color: #8B4513;
    font-size: 1.1rem;
    margin: 20px 0 10px 0;
}

/* 历法选择 */
.calendar-type {
    border: 2px solid #d4a574;
    border-radius: 10px;
    padding: 20px;
    background: rgba(244, 228, 188, 0.3);
    margin-bottom: 20px;
}

.radio-group {
    display: flex;
    gap: 30px;
    margin-top: 10px;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
    color: #5d4e37;
    transition: color 0.3s ease;
    font-size: 15px;
}

.radio-label input[type="radio"] {
    margin-right: 10px;
    accent-color: #c41e3a;
    transform: scale(1.3);
}

.radio-label:hover {
    color: #c41e3a;
}

.radio-label input[type="radio"]:checked + .radio-text {
    color: #c41e3a;
    font-weight: 700;
}

/* 加载动画 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(139, 69, 19, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-spinner {
    background: white;
    border-radius: 20px;
    padding: 50px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    border: 3px solid #c41e3a;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f4e4bc;
    border-top: 4px solid #c41e3a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-spinner p {
    color: #8B4513;
    font-size: 16px;
    font-weight: 600;
}

/* 返回主页按钮 */
.back-home-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    background: linear-gradient(135deg, #c41e3a, #e74c3c);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 100;
    box-shadow: 0 4px 15px rgba(196, 30, 58, 0.3);
    font-family: 'Noto Serif SC', serif;
}

.back-home-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(196, 30, 58, 0.4);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-title {
        font-size: 2.5rem;
    }

    .subtitle {
        font-size: 1.1rem;
    }

    .bagua-circle {
        width: 250px;
        height: 250px;
    }

    .service-item {
        width: 50px;
        height: 50px;
    }

    .service-icon {
        font-size: 16px;
    }

    .service-name {
        font-size: 8px;
        bottom: -18px;
    }

    .intro-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .service-section {
        padding: 25px;
    }

    .form-row {
        flex-direction: column;
        gap: 15px;
    }

    .couple-upload {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .hexagram-row {
        flex-wrap: wrap;
        gap: 10px;
    }

    .hexagram-select {
        min-width: 100px;
        padding: 10px 12px;
        font-size: 12px;
    }

    .radio-group {
        flex-direction: column;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .main-title {
        font-size: 2rem;
    }

    .bagua-circle {
        width: 200px;
        height: 200px;
    }

    .taiji-center {
        width: 60px;
        height: 60px;
    }

    .service-item {
        width: 40px;
        height: 40px;
        transform: rotate(var(--rotation)) translateY(-80px) rotate(calc(var(--rotation) * -1)) !important;
    }

    .service-icon {
        font-size: 14px;
    }

    .service-section {
        padding: 20px;
        margin: 10px;
    }
}

/* 滚动条样式 */
.result-content::-webkit-scrollbar {
    width: 10px;
}

.result-content::-webkit-scrollbar-track {
    background: #f4e4bc;
    border-radius: 10px;
}

.result-content::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #c41e3a, #e74c3c);
    border-radius: 10px;
}

.result-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #8B4513, #c41e3a);
}

/* 起卦方法页面特殊样式 */
.hexagram-methods {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    margin: 20px 0;
    border: 2px solid rgba(196, 30, 58, 0.2);
}

.hexagram-methods h2 {
    color: #c41e3a;
    font-size: 1.8rem;
    margin-bottom: 25px;
    text-align: center;
    border-bottom: 2px solid #c41e3a;
    padding-bottom: 10px;
}

.hexagram-methods h3 {
    color: #8B4513;
    font-size: 1.3rem;
    margin: 25px 0 15px 0;
}

.hexagram-methods p,
.hexagram-methods li {
    color: #3a2a1a;
    line-height: 1.7;
    margin-bottom: 10px;
    font-size: 15px;
}

.hexagram-methods ul,
.hexagram-methods ol {
    margin: 15px 0;
    padding-left: 25px;
}

.hexagram-methods section {
    margin: 30px 0;
    padding: 20px;
    background: rgba(244, 228, 188, 0.3);
    border-radius: 10px;
    border-left: 4px solid #c41e3a;
}

.hexagram-methods pre {
    background: rgba(139, 69, 19, 0.1);
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    color: #3a2a1a;
    border: 1px solid #d4a574;
}

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

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes spin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes loadingShimmer {
    0% { background-position: -40px 0; }
    100% { background-position: 40px 0; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .bagua-circle {
        width: 400px;
        height: 400px;
    }

    .service-card {
        width: calc(50% - 40px);
    }
}

@media (max-width: 768px) {
    .main-title {
        font-size: 2.5rem;
    }

    .subtitle {
        font-size: 1.2rem;
    }

    .bagua-circle {
        width: 320px;
        height: 320px;
    }

    .service-card {
        width: calc(100% - 40px);
        margin: 15px 20px;
    }

    .image-preview {
        width: 180px;
        height: 180px;
    }

    .analysis-form {
        padding: 20px;
    }

    .form-row {
        flex-direction: column;
        gap: 15px;
    }

    .hexagram-row {
        flex-wrap: wrap;
        gap: 10px;
    }

    .hexagram-select {
        min-width: 100px;
        flex: 1 1 calc(50% - 10px);
    }
}

@media (max-width: 480px) {
    .main-title {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .bagua-circle {
        width: 280px;
        height: 280px;
    }

    .image-preview {
        width: 150px;
        height: 150px;
    }

    .analysis-form {
        padding: 15px;
    }

    .service-section {
        margin: 15px;
        padding: 20px;
    }

    .header {
        margin-bottom: 30px;
    }

    .homepage {
        padding: 15px;
    }

    .hexagram-select {
        flex: 1 1 100%;
    }

    .couple-upload {
        flex-direction: column;
        gap: 20px;
    }
}

/* 增强的上传框样式 */
.upload-box {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.upload-box::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(196, 30, 58, 0.1), transparent);
    transition: left 0.5s ease;
}

.upload-box:hover::before {
    left: 100%;
}

.upload-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(139, 69, 19, 0.25);
    border-color: #e74c3c;
    background: linear-gradient(135deg, #fff5f5, #fff);
}

.upload-box:active {
    transform: translateY(-1px);
}

/* 增强的按钮效果 */
.analyze-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.analyze-btn::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.analyze-btn:hover::before {
    width: 300px;
    height: 300px;
}

.analyze-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(196, 30, 58, 0.3);
}

.analyze-btn:active {
    transform: translateY(0);
}

/* 增强的表单输入样式 */
input[type="text"],
input[type="number"],
select,
textarea {
    transition: all 0.3s ease;
    position: relative;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    transform: translateY(-1px);
    box-shadow: 0 5px 20px rgba(196, 30, 58, 0.1);
}

/* 增强的结果展示样式 */
.result-section {
    animation: slideInFromUp 0.5s ease-out;
}

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

.result-content {
    animation: fadeIn 0.8s ease-out;
}

.result-item {
    animation: slideInFromLeft 0.6s ease-out;
    animation-fill-mode: both;
}

.result-item:nth-child(1) { animation-delay: 0.1s; }
.result-item:nth-child(2) { animation-delay: 0.2s; }
.result-item:nth-child(3) { animation-delay: 0.3s; }
.result-item:nth-child(4) { animation-delay: 0.4s; }

/* 增强的八卦导航动画 */
.bagua-item {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInScale 0.8s ease-out;
    animation-fill-mode: both;
}

.bagua-item:nth-child(1) { animation-delay: 0.1s; }
.bagua-item:nth-child(2) { animation-delay: 0.2s; }
.bagua-item:nth-child(3) { animation-delay: 0.3s; }
.bagua-item:nth-child(4) { animation-delay: 0.4s; }
.bagua-item:nth-child(5) { animation-delay: 0.5s; }
.bagua-item:nth-child(6) { animation-delay: 0.6s; }
.bagua-item:nth-child(7) { animation-delay: 0.7s; }
.bagua-item:nth-child(8) { animation-delay: 0.8s; }

.bagua-item:hover {
    transform: scale(1.1) rotate(5deg);
    z-index: 10;
}

/* 滚动条样式优化 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f4e4bc;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c41e3a;
    border-radius: 4px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: #e74c3c;
}

/* 选择文本样式 */
::selection {
    background: rgba(196, 30, 58, 0.2);
    color: #8B4513;
}

::-moz-selection {
    background: rgba(196, 30, 58, 0.2);
    color: #8B4513;
}

/* 增强的加载动画 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(139, 69, 19, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease-out;
}

.loading-spinner {
    background: white;
    border-radius: 20px;
    padding: 50px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    border: 3px solid #c41e3a;
    animation: bounceIn 0.6s ease-out;
    position: relative;
    overflow: hidden;
}

.loading-spinner::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(196, 30, 58, 0.05), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(196, 30, 58, 0.1);
    border-top: 4px solid #c41e3a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px auto;
    position: relative;
}

.spinner::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(196, 30, 58, 0.2);
    border-top: 3px solid #e74c3c;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: spin 0.6s linear infinite reverse;
}

.loading-spinner p {
    color: #8B4513;
    font-size: 16px;
    font-weight: 600;
    position: relative;
    z-index: 1;
    animation: pulse 1.5s ease-in-out infinite;
}

/* 增强的通知提示样式 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 12px;
    color: white;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 400px;
    word-wrap: break-word;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
    animation: slideInFromRight 0.4s ease-out;
}

.notification.notification-success {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    border-left: 4px solid #229954;
}

.notification.notification-error {
    background: linear-gradient(135deg, #c41e3a, #e74c3c);
    border-left: 4px solid #a93226;
}

.notification.notification-info {
    background: linear-gradient(135deg, #3498db, #5dade2);
    border-left: 4px solid #2874a6;
}

.notification.notification-warning {
    background: linear-gradient(135deg, #f39c12, #f1c40f);
    border-left: 4px solid #d68910;
    color: #2c3e50;
}

.notification::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: inherit;
    filter: blur(10px);
    opacity: 0.3;
    z-index: -1;
}

.notification span {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
}

.notification span::before {
    font-size: 20px;
    font-weight: bold;
}

.notification.notification-success span::before {
    content: "✓";
}

.notification.notification-error span::before {
    content: "✕";
}

.notification.notification-info span::before {
    content: "ℹ";
}

.notification.notification-warning span::before {
    content: "⚠";
}

/* 进度条样式 */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #c41e3a, #e74c3c);
    z-index: 10001;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(196, 30, 58, 0.5);
}

.progress-bar.active {
    animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* 工具提示样式 */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(139, 69, 19, 0.95);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10002;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tooltip::after {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(139, 69, 19, 0.95);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.tooltip:hover::before,
.tooltip:hover::after {
    opacity: 1;
}

/* 徽章样式 */
.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: bold;
    border-radius: 12px;
    background: linear-gradient(135deg, #c41e3a, #e74c3c);
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: pulse 2s ease-in-out infinite;
}

.badge.badge-success {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

.badge.badge-warning {
    background: linear-gradient(135deg, #f39c12, #f1c40f);
}

.badge.badge-info {
    background: linear-gradient(135deg, #3498db, #5dade2);
}

/* 标签样式 */
.tag {
    display: inline-block;
    padding: 6px 12px;
    margin: 4px;
    background: rgba(244, 228, 188, 0.8);
    color: #8B4513;
    border-radius: 20px;
    font-size: 14px;
    border: 1px solid #d4a574;
    transition: all 0.3s ease;
    cursor: default;
}

.tag:hover {
    background: rgba(196, 30, 58, 0.1);
    border-color: #c41e3a;
    transform: scale(1.05);
}

/* 分割线样式 */
.divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, #c41e3a, transparent);
    margin: 30px 0;
    position: relative;
    overflow: hidden;
}

.divider::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    animation: shimmerDivider 3s infinite;
}

@keyframes shimmerDivider {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* 增强的返回按钮 */
.back-home-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    background: linear-gradient(135deg, #c41e3a, #e74c3c);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 5px 20px rgba(196, 30, 58, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideInFromLeft 0.6s ease-out;
}

.back-home-btn:hover {
    transform: translateX(5px) scale(1.05);
    box-shadow: 0 8px 25px rgba(196, 30, 58, 0.4);
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.back-home-btn:active {
    transform: translateX(3px) scale(1.02);
}

/* 打印样式 */
@media print {
    .loading-overlay,
    .notification,
    .back-home-btn,
    .analyze-btn,
    .upload-box {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    .service-section {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    body {
        background: white;
        color: black;
    }

    .service-section {
        border: 2px solid black;
    }

    .analyze-btn {
        border: 2px solid black;
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}