@import url('https://fonts.googleapis.com/css2?family=Ma+Shan+Zheng&display=swap');

:root {
    --primary: #ffd700; /* 金色 */
    --accent: #ff4d4d;  /* 亮红 */
    --gold: #ffd700;    /* 金色 */
    --bg-color: #0a0e17; /* 深色底 */
    --card-bg: rgba(20, 25, 40, 0.6); /* 玻璃拟态背景 */
    --text-main: #e0e0e0; /* 浅灰白 */
    --text-light: #aaaaaa; /* 灰色 */
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    --radius: 16px;
    --border-color: rgba(255, 215, 0, 0.3);
}

html {
    background-color: var(--bg-color); /* 确保 html 背景色一致，防止滚动露底 */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft YaHei", Tahoma, Simsun, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    padding: 15px;
    line-height: 1.6;
    /* background-image: url('home-bg.png');  移除全局背景图 */
    /* background-size: cover; */
    /* background-position: center; */
    /* background-attachment: fixed; */
}

/* 全局遮罩，确保文字清晰 */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5); /* 全局暗化 */
    z-index: -1;
    pointer-events: none;
    display: none; /* 默认隐藏遮罩，只在有背景图的页面显示 */
}

.container {
    max-width: 600px; /* 限制最大宽度，模拟手机 App 感觉 */
    margin: 0 auto;
}

/* 头部 */
.header {
    text-align: center;
    padding: 30px 0;
}

.header h1 {
    font-size: 2.5rem; /* 加大标题 */
    color: var(--gold);
    font-weight: normal;
    letter-spacing: 4px;
    margin-bottom: 5px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.header .subtitle {
    font-size: 1rem;
    color: var(--text-main);
    font-family: sans-serif;
    opacity: 0.8;
}

/* 卡片通用样式 */
.card, .result-card {
    background: var(--card-bg) !important; /* 强制背景色 */
    border-radius: var(--radius);
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-main); /* 确保文字颜色继承 */
}

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

label {
    display: block;
    font-size: 1.1rem; /* 稍微加大 */
    color: var(--gold); /* 标签用金色 */
    margin-bottom: 8px;
    font-weight: 500;
    letter-spacing: 1px;
}

input[type="text"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
select {
    width: 100%;
    height: 50px; /* 统一高度 */
    padding: 0 15px; /* 配合高度垂直居中 */
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    font-size: 1rem;
    background-color: rgba(0, 0, 0, 0.3); /* 明确背景色 */
    color: #fff;
    transition: all 0.3s;
    font-family: sans-serif;
    -webkit-appearance: none; /* 移除 iOS 默认样式 */
    appearance: none;
    box-sizing: border-box;
    text-align: left; /* 确保文字左对齐 */
}

/* 修复 iOS 上日期时间输入框文字居中的问题 */
input[type="date"]::-webkit-date-and-time-value,
input[type="datetime-local"]::-webkit-date-and-time-value {
    text-align: left;
}

/* 自定义 Select 箭头 */
select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;
    padding-right: 40px;
}

/* 自定义日期选择器图标 - 已移除，使用系统默认但反色 */
input[type="datetime-local"] {
    /* background-image: ...; 移除自定义背景图 */
    padding-right: 15px; /* 恢复默认内边距 */
}

/* 系统默认日历图标样式调整 */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(1); /* 反转颜色使其变白，适应深色背景 */
    cursor: pointer;
    opacity: 1; /* 确保可见 */
    position: static; /* 恢复默认定位 */
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    background: transparent; /* 确保没有额外背景 */
}

/* 确保父元素相对定位，以便绝对定位的图标正确显示 */
input[type="date"],
input[type="datetime-local"] {
    position: relative;
}

input:focus, select:focus {
    border-color: var(--gold);
    background: rgba(0, 0, 0, 0.5);
    outline: none;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}

/* 修复浏览器自动填充导致的背景变白问题 */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
    -webkit-transition: "color 9999s ease-out, background-color 9999s ease-out";
    -webkit-transition-delay: 9999s;
    -webkit-text-fill-color: #fff !important;
    transition: background-color 5000s ease-in-out 0s;
    box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.3) inset !important; /* 备用方案：使用半透明黑覆盖 */
    background-color: transparent !important;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-main) !important; /* 强制颜色，防止被污染 */
    cursor: pointer;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* 按钮 */
.btn-primary {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%); /* 金色渐变 */
    color: #000; /* 深色文字 */
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.5);
}

.btn-secondary {
    background: transparent;
    color: var(--text-main) !important; /* 强制颜色 */
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}

.form-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

/* 结果区域样式优化 */
.card-title {
    font-size: 1.5rem; /* 加大标题字号 */
    font-weight: 600;  /* 加粗 */
    color: var(--gold);
    border-left: 4px solid var(--gold);
    padding-left: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.2);
}

/* 四柱八字 Grid */
.bazi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.pillar-item {
    background: rgba(255, 255, 255, 0.05); /* 微透明背景 */
    border-radius: 10px;
    padding: 15px 5px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.pillar-label {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 10px;
    font-family: sans-serif;
}

.gan-zhi {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-family: 'Kaiti SC', 'STKaiti', 'KaiTi', serif; /* 楷体更有韵味 */
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-main);
}

.gan {
    color: var(--accent); /* 天干用朱红 */
}

.zhi {
    color: var(--primary); /* 地支用墨蓝 */
}

/* 五行方位布局 - 五行生克五角星布局 */
.wuxing-grid {
    display: block;
    width: 320px;
    height: 320px;
    position: relative;
    margin: 30px auto;
    /* 背景绘制五角星连线（相克）和外圈连线（相生） */
    background-image: url("data:image/svg+xml,%3Csvg width='320' height='320' viewBox='0 0 320 320' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cmarker id='arrow' markerWidth='10' markerHeight='10' refX='9' refY='3' orient='auto' markerUnits='strokeWidth'%3E%3Cpath d='M0,0 L0,6 L9,3 z' fill='%23ddd' /%3E%3C/marker%3E%3C/defs%3E%3C!-- 外圈圆形 (相生) --%3E%3Ccircle cx='160' cy='160' r='120' fill='none' stroke='%23eee' stroke-width='1' stroke-dasharray='5,5' /%3E%3C!-- 内部五角星 (相克) --%3E%3Cpath d='M160,40 L274,123 L230,255 L90,255 L46,123 Z' fill='none' stroke='%23eee' stroke-width='1' /%3E%3Cpath d='M160,40 L230,255 L46,123 L274,123 L90,255 Z' fill='none' stroke='%23e0e0e0' stroke-width='1' /%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

.wuxing-item {
    position: absolute;
    width: 60px;
    height: 80px;
    /* 居中定位修正 */
    left: 50%;
    top: 50%;
    margin-left: -30px;
    margin-top: -40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    z-index: 2;
}

/* 
   五行位置计算 (半径 R=120px)
   中心点 (0,0)
   火 (Top): 0度 -> (0, -120)
   土 (Right): 72度 -> (114, -37)
   金 (Bottom Right): 144度 -> (70, 97)
   水 (Bottom Left): 216度 -> (-70, 97)
   木 (Left): 288度 -> (-114, -37)
*/

/* 火 - 上 */
.wuxing-item.fire { 
    transform: translate(0px, -120px);
}

/* 土 - 右上 */
.wuxing-item.earth { 
    transform: translate(114px, -37px);
}

/* 金 - 右下 */
.wuxing-item.metal { 
    transform: translate(70px, 97px);
}

/* 水 - 左下 */
.wuxing-item.water { 
    transform: translate(-70px, 97px);
}

/* 木 - 左上 */
.wuxing-item.wood { 
    transform: translate(-114px, -37px);
}

.element-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 1.4rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: 4px solid #fff;
    font-family: 'Kaiti SC', 'STKaiti', serif;
    position: relative;
    box-sizing: border-box;
    flex-shrink: 0;
}

.element-count {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 700;
    background: rgba(255,255,255,0.9);
    padding: 2px 8px;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    white-space: nowrap;
}

/* 颜色定义 - 线性渐变 (符合截图的扁平圆形风格) */
.wuxing-item.metal .element-icon { 
    /* 金 - 黄色 */
    background: linear-gradient(180deg, #FDD835 0%, #F9A825 100%); 
    color: #fff; 
    border-color: #fff; 
}
.wuxing-item.wood .element-icon { 
    /* 木 - 绿色 */
    background: linear-gradient(180deg, #81C784 0%, #388E3C 100%); 
}
.wuxing-item.water .element-icon { 
    /* 水 - 蓝色 */
    background: linear-gradient(180deg, #64B5F6 0%, #1976D2 100%); 
}
.wuxing-item.fire .element-icon { 
    /* 火 - 红色 */
    background: linear-gradient(180deg, #E57373 0%, #D32F2F 100%); 
}
.wuxing-item.earth .element-icon { 
    /* 土 - 棕色 */
    background: linear-gradient(180deg, #8D6E63 0%, #4E342E 100%); 
    color: #fff; 
}


/* 十神分析列表 */
.shishen-list {
    list-style: none;
}

.shishen-list li {
    position: relative;
    padding: 10px 0 10px 20px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.2);
    font-size: 0.95rem;
    color: #fff;
}

.shishen-list li::before {
    content: "•";
    color: var(--accent);
    font-size: 1.5rem;
    position: absolute;
    left: 0;
    top: 5px;
    line-height: 1;
}

.shishen-list li:last-child {
    border-bottom: none;
}

/* 加载动画优化 */
.loading {
    text-align: center;
    padding: 50px 30px;
    background: var(--card-bg); /* 适配暗色背景 */
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    backdrop-filter: blur(10px);
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* 太极动画 - SVG 矢量版 */
.spinner {
    width: 80px;
    height: 80px;
    margin: 0 auto 30px;
    animation: spin 2s linear infinite;
    /* 使用 box-shadow 代替 filter，避免旋转时的边缘锯齿 */
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    border-radius: 50%; /* 确保阴影是圆形的 */
    
    /* 移除旧的 CSS 绘图属性 */
    background: none;
    border: none;
    
    /* 硬件加速 */
    will-change: transform;
}

/* 移除旧的伪元素绘图，防止干扰 */
.spinner::before,
.spinner::after,
.spinner .dot {
    display: none;
}

/* ... existing code ... */

.step.active::before {
    border-color: var(--primary);
    background: var(--primary);
    box-shadow: 0 0 0 4px rgba(44, 62, 80, 0.1);
}

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

/* 进度文字 */
.loading p {
    font-size: 1.1rem;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.loading .wait-time {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 400;
    margin-bottom: 30px;
}

/* 进度步骤条 */
.progress-steps {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 280px;
    position: relative;
}

.progress-steps::before {
    content: '';
    position: absolute;
    top: 9px;
    left: 10px;
    right: 10px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    z-index: 0;
}

.step {
    position: relative;
    z-index: 1;
    background: transparent;
    padding: 0;
    color: var(--text-light);
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border: none;
    border-radius: 0;
    width: 60px;
}

.step::before {
    content: '';
    width: 16px;
    height: 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transition: all 0.3s;
    margin-bottom: 5px;
}

.step.active {
    color: var(--primary);
    font-weight: bold;
    border: none;
}

.step.active::before {
    border-color: var(--primary);
    background: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 215, 0, 0.2);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 隐藏元素 */
.hidden {
    display: none !important;
}

/* 错误提示 */
.error {
    background: #fff2f0;
    border: 1px solid #ffccc7;
    color: #ff4d4f;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

/* 五行分析内容样式 */
.analysis-content {
    font-size: 1rem;
    color: var(--text-main);
    line-height: 1.8;
    text-align: justify;
}

.analysis-content p {
    margin-bottom: 10px;
}


/* 首页菜单样式 */
.home-container {
    max-width: 800px;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.menu-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px 20px;
    text-align: center;
    text-decoration: none;
    color: var(--text-main);
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.02);
}

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

.menu-card .icon-wrapper {
    width: 60px;
    height: 60px;
    background: var(--bg-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 1.5rem;
    color: var(--primary);
    transition: background 0.3s ease, color 0.3s ease;
}

.menu-card:hover .icon-wrapper {
    background: var(--primary);
    color: #fff;
}

.menu-card h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: var(--primary);
}

.menu-card p {
    font-size: 0.9rem;
    color: var(--text-light);
}

/* 禁用状态 */
.menu-card.disabled {
    opacity: 0.8;
    cursor: not-allowed;
    background: #f9f9f9;
}

.menu-card.disabled:hover {
    transform: none;
    box-shadow: var(--shadow);
}

.menu-card.disabled .icon-wrapper {
    background: #eee;
    color: #aaa;
}

.tag {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #eee;
    color: #999;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
}

/* =========================================
   移动端适配与布局优化
   ========================================= */

/* 布局容器优化 */
.main-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 表单网格布局 */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.full-width {
    grid-column: 1 / -1;
}

/* 移动端响应式样式 */
@media (max-width: 768px) {
    body {
        padding: 10px;
        background-size: 10px 10px; /* 减小背景点阵尺寸 */
    }

    .container {
        width: 100%;
        padding: 0;
    }

    .header {
        padding: 20px 0;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .card {
        padding: 20px 15px; /* 减小卡片内边距 */
        border-radius: 12px;
        margin-bottom: 15px;
    }

    /* 首页菜单移动端优化 - 改为列表式卡片 */
    .menu-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .menu-card {
        display: flex;
        align-items: center;
        text-align: left;
        padding: 15px;
        min-height: 80px;
    }
    
    .menu-card .icon-wrapper {
        margin: 0 15px 0 0;
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
        flex-shrink: 0;
    }
    
    .menu-card h3 {
        margin-bottom: 4px;
        font-size: 1.1rem;
    }
    
    .menu-card p {
        font-size: 0.85rem;
        margin: 0;
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .tag {
        top: 50%;
        transform: translateY(-50%);
        right: 15px;
        font-size: 0.65rem;
        padding: 2px 6px;
    }

    /* 八字排盘结果适配 */
    .bazi-grid {
        gap: 5px;
    }
    
    .pillar-item {
        padding: 10px 2px;
    }
    
    .pillar-label {
        font-size: 0.75rem;
        margin-bottom: 5px;
    }
    
    .gan-zhi {
        font-size: 1.3rem;
    }

    /* 五行图适配 - 缩小以适应窄屏 */
    .wuxing-grid {
        transform: scale(0.85);
        margin: 40px auto 20px !important;
        transform-origin: center top;
        /* 修正高度占用，因为 scale 不会改变布局占据的空间 */
        height: 280px; 
        width: 100%;
        max-width: 320px;
        background-position: center top;
    }
    
    /* 按钮优化 */
    .btn-primary {
        padding: 12px;
        font-size: 1rem;
    }
}

/* 超小屏幕适配 (如 iPhone SE) */
@media (max-width: 375px) {
    .wuxing-grid {
        transform: scale(0.75);
        height: 250px;
    }
    
    .gan-zhi {
        font-size: 1.1rem;
    }
    
    .pillar-item {
        padding: 8px 0;
    }
}

/* =========================================
   面相分析页面样式
   ========================================= */

.upload-area {
    width: 100%;
    min-height: 300px;
    border: 2px dashed #e0e0e0;
    border-radius: var(--radius);
    background: #fcfcfc;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.upload-area:hover {
    border-color: var(--primary);
    background: #f8f9fa;
}

.upload-placeholder {
    text-align: center;
    color: var(--text-light);
}

.plus-icon {
    width: 80px;
    height: 80px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--primary);
    margin: 0 auto 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: transform 0.3s ease;
}

.upload-area:hover .plus-icon {
    transform: scale(1.1);
    color: var(--accent);
}

.upload-placeholder p {
    font-size: 1.1rem;
    margin-bottom: 5px;
    font-weight: 500;
}

.upload-placeholder small {
    font-size: 0.85rem;
    color: #999;
}

.preview-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.btn-icon-overlay {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    border: none;
    color: var(--primary);
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-icon-overlay:hover {
    transform: scale(1.1);
    background: #fff;
}

/* 结果内容样式 */
.analysis-content h3 {
    color: var(--primary);
    margin: 20px 0 10px;
    font-size: 1.2rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.analysis-content p {
    margin-bottom: 15px;
    line-height: 1.8;
    color: #fff;
}

.analysis-content ul {
    padding-left: 20px;
    margin-bottom: 15px;
}

.analysis-content li {
    margin-bottom: 8px;
    color: #fff;
}

/* 紫微斗数样式 */
.ziwei-grid {
    display: grid;
    grid-template-columns: 1fr; /* 强制单列显示 */
    gap: 15px;
}

.palace-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.palace-item h4 {
    color: var(--primary);
    margin-bottom: 8px;
    font-size: 1rem;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.2);
    padding-bottom: 5px;
}

.palace-item p {
    font-size: 0.9rem;
    color: #fff;
    line-height: 1.5;
}

.ziwei-main-star {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-main);
}

.analysis-content {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-main);
}


/* =========================================
   进度条加载动画
   ========================================= */
.progress-container {
    width: 100%;
    max-width: 300px;
    height: 12px;
    background-color: #f0f0f0;
    border-radius: 6px;
    margin: 0 auto 20px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 6px;
    transition: width 0.3s ease;
    position: relative;
}

/* 进度条光效动画 */
.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.15) 75%,
        transparent 75%,
        transparent
    );
    background-size: 20px 20px;
    animation: progress-stripes 1s linear infinite;
}

@keyframes progress-stripes {
    0% { background-position: 0 0; }
    100% { background-position: 20px 20px; }
}

.loading-text {
    font-size: 1rem;
    color: var(--text-light);
    margin-top: 10px;
}


/* K线图专用样式 - 适配整体风格 */
.kline-card {
    /* 移除深色背景，使用默认卡片样式 */
    /* background: #1e222d; */
    /* color: #fff; */
    /* border: 1px solid #2a2e39; */
}

.kline-card .card-title {
    /* color: #fff; */
    border-left-color: #eb5454;
}

.kline-card .chart-legend {
    color: var(--text-light) !important;
}

/* 趋势标签 */
.trend-badge {
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* 玄幻/道家风格首页样式 */
@import url('https://fonts.googleapis.com/css2?family=Ma+Shan+Zheng&display=swap');

/* 首页专用样式 */
.ink-theme {
    background-color: transparent; /* 透明背景，让底层的 .ink-bg-layer 显示出来 */
    /* 背景图移至 .ink-bg-layer 处理 */
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft YaHei", Tahoma, Simsun, sans-serif;
    margin: 0;
    padding: 0; /* 覆盖 body 的 padding */
    height: 100vh; /* 强制全屏高度 */
    height: 100dvh; /* 适配移动端动态高度 */
    width: 100vw;
    display: flex;
    justify-content: center; /* 垂直居中 */
    align-items: center; /* 水平居中 */
    overflow: hidden; /* 禁止页面级滚动，实现 App 般的全屏体验 */
    position: relative;
}

/* 独立背景层样式 */
.ink-bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('home-bg.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    z-index: -1; /* 位于最底层 */
    /* 移除 background-attachment: fixed，避免移动端兼容性问题 */
}

/* 首页遮罩 */
.ink-theme::before {
    content: '';
    position: fixed; /* 改为 fixed，确保覆盖全屏，避免滚动色差 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3); /* 轻微暗化背景 */
    z-index: 0;
    display: block; /* 强制显示 */
    pointer-events: none;
}

/* 动态荧光效果 */
.ink-theme::after {
    content: '';
    position: fixed; /* 改为 fixed，确保覆盖全屏 */
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(255, 215, 0, 0.03) 0%, transparent 60%),
                radial-gradient(circle at 20% 30%, rgba(64, 224, 208, 0.03) 0%, transparent 50%),
                radial-gradient(circle at 80% 70%, rgba(147, 112, 219, 0.03) 0%, transparent 50%);
    animation: mystic-flow 20s linear infinite;
    z-index: 0;
    pointer-events: none;
    mix-blend-mode: screen;
}

@keyframes mystic-flow {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1); }
}

.ink-container {
    width: 100%;
    max-width: 600px;
    max-height: 100%; /* 限制最大高度 */
    overflow-y: auto; /* 内容过多时内部滚动，保持全屏感 */
    padding: 20px;
    text-align: center;
    position: relative;
    z-index: 1;
    /* margin: auto; 由父级 flex 控制居中 */
    scrollbar-width: none; /* 隐藏滚动条 Firefox */
}
.ink-container::-webkit-scrollbar {
    display: none; /* 隐藏滚动条 Chrome/Safari */
}

.ink-header {
    margin-bottom: 30px;
    /* padding-top: 200px;  移除下移 */
    text-align: center; /* 恢复居中 */
    /* padding-left: 10px; 移除左对齐修正 */
}

.ink-logo {
    font-size: 4rem;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.6), 0 0 20px rgba(255, 215, 0, 0.3);
    margin-bottom: 10px;
    background: linear-gradient(to bottom, #fff, #ffd700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: logo-pulse 4s ease-in-out infinite;
}

@keyframes logo-pulse {
    0%, 100% { filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.3)); }
    50% { filter: drop-shadow(0 0 25px rgba(255, 215, 0, 0.6)); }
}

.ink-subtitle {
    font-size: 1.4rem;
    color: #e0e0e0;
    letter-spacing: 6px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.ink-menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 改为3列，更适合竖长卡片 */
    gap: 20px;
    padding: 10px;
    justify-content: center; /* 确保内容居中 */
}

.ink-item {
    position: relative;
    aspect-ratio: 3/6.5; /* 竖长比例，类似符咒/卡牌 */
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.4s ease;
    border-radius: 8px;
    
    /* 玻璃拟态 + 金色边框 */
    background: rgba(20, 25, 40, 0.6);
    border: 1px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: border-pulse 4s ease-in-out infinite;
}

@keyframes border-pulse {
    0%, 100% { border-color: rgba(255, 215, 0, 0.3); box-shadow: 0 4px 15px rgba(0,0,0,0.4); }
    50% { border-color: rgba(255, 215, 0, 0.8); box-shadow: 0 4px 20px rgba(255, 215, 0, 0.5); }
}

.ink-item:hover {
    transform: translateY(-5px) scale(1.05);
    border-color: rgba(255, 215, 0, 0.8);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.4), inset 0 0 10px rgba(255, 215, 0, 0.1);
    background: rgba(20, 25, 40, 0.8);
    animation: none; /* 悬停时暂停呼吸动画，使用 hover 样式 */
}

.ink-char {
    font-size: 2rem;
    line-height: 1.3;
    color: #ffd700; /* 金色文字 */
    z-index: 2;
    writing-mode: vertical-rl; /* 竖排文字 */
    text-orientation: upright;
    text-shadow: 0 0 5px rgba(0,0,0,0.8), 0 0 10px rgba(255, 215, 0, 0.3);
    animation: logo-pulse 4s ease-in-out infinite; /* 同步 Logo 的荧光效果 */
}

/* 按钮背景装饰（可选：符咒纹理） */
.ink-bg {
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 1px solid rgba(255, 215, 0, 0.1);
    border-radius: 4px;
    pointer-events: none;
    display: block;
}

/* 水波纹动画 - 金色 */
#ripple-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    overflow: hidden;
}

.ink-ripple {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.8) 0%, rgba(255, 165, 0, 0.4) 60%, transparent 100%); /* 金色光波 */
    transform: translate(-50%, -50%) scale(0);
    animation: ripple-effect 1s ease-out forwards;
    width: 20px;
    height: 20px;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

@keyframes ripple-effect {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(150); /* 扩散覆盖全屏 */
        opacity: 0;
    }
}

.ink-footer {
    margin-top: 40px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

/* 表格样式适配 */
table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-main);
}

th, td {
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

th {
    background-color: rgba(255, 215, 0, 0.1); /* 金色微透 */
    color: var(--gold);
}



/* 移动端适配：改为2列，更适合手机操作 */
@media (max-width: 768px) {
    .ink-container {
        padding: 10px; /* 减小内边距，给 Grid 更多空间 */
        max-width: 100%; /* 占满宽度 */
        width: 100%;
        margin: 0 auto;
    }

    .ink-menu-grid {
        grid-template-columns: repeat(3, 1fr); /* 保持3列 */
        gap: 8px; /* 减小间距 */
        padding: 0;
        justify-content: center;
        width: 60%; /* 缩小按钮区域宽度至 60% (即缩小 40%) */
        margin: 0 auto; /* 居中 */
    }

    .ink-header {
        padding-left: 0;
        margin-bottom: 15px; /* 减小标题间距 */
    }

    .ink-item {
        aspect-ratio: 3/5.85; /* 稍微调高比例，防止文字溢出 */
        border-radius: 10px;
    }

    .ink-char {
        font-size: 1.2rem; /* 稍微缩小文字，防止换行或溢出 */
    }
    
    .ink-logo {
        font-size: 2.8rem; /* 适配小屏幕 */
    }
    
    .ink-subtitle {
        font-size: 0.9rem;
        letter-spacing: 2px;
    }
}


/* 八字排盘详细表格样式 */
.bazi-chart-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.bazi-chart-table th, 
.bazi-chart-table td {
    padding: 12px 5px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    vertical-align: middle;
}

.bazi-chart-table th {
    color: var(--text-light);
    font-weight: normal;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.bazi-chart-table .row-label {
    color: var(--text-light);
    font-size: 0.9rem;
    text-align: left;
    padding-left: 10px;
    width: 60px;
    white-space: nowrap;
}

/* 元素颜色 */
.c-wood { color: #4caf50; } /* 木 - 绿色 */
.c-fire { color: #ff5252; } /* 火 - 红色 */
.c-earth { color: #a1887f; } /* 土 - 褐色 */
.c-metal { color: #ffd700; } /* 金 - 金色 */
.c-water { color: #40c4ff; } /* 水 - 蓝色 */

/* 天干地支大字 */
.gan-zhi-font {
    font-family: 'Ma Shan Zheng', 'Kaiti SC', serif;
    font-size: 1.4rem;
    font-weight: bold;
}

/* 藏干、副星等小字列表 */
.sub-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.sub-list span {
    display: block;
}

/* 偶数行背景微调 */
.bazi-chart-table tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

/* 紫微斗数 12宫排盘 Grid 布局 */
.ziwei-chart-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, minmax(140px, auto));
    gap: 4px;
    margin-top: 20px;
    border: 1px solid rgba(255, 215, 0, 0.2);
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: 8px;
}

.ziwei-cell {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 8px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 0.8rem;
}

/* 宫位定位 */
.cell-si { grid-area: 1 / 1 / 2 / 2; }   /* 巳 */
.cell-wu { grid-area: 1 / 2 / 2 / 3; }   /* 午 */
.cell-wei { grid-area: 1 / 3 / 2 / 4; }  /* 未 */
.cell-shen { grid-area: 1 / 4 / 2 / 5; } /* 申 */

.cell-chen { grid-area: 2 / 1 / 3 / 2; } /* 辰 */
.cell-you { grid-area: 2 / 4 / 3 / 5; }  /* 酉 */

.cell-mao { grid-area: 3 / 1 / 4 / 2; }  /* 卯 */
.cell-xu { grid-area: 3 / 4 / 4 / 5; }   /* 戌 */

.cell-yin { grid-area: 4 / 1 / 5 / 2; }  /* 寅 */
.cell-chou { grid-area: 4 / 2 / 5 / 3; } /* 丑 */
.cell-zi { grid-area: 4 / 3 / 5 / 4; }   /* 子 */
.cell-hai { grid-area: 4 / 4 / 5 / 5; }  /* 亥 */

.ziwei-center-info {
    grid-area: 2 / 2 / 4 / 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 1px dashed rgba(255, 215, 0, 0.3);
    background: rgba(0, 0, 0, 0.1);
    padding: 10px;
}

/* 宫内元素样式 */
.stars-main {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
}

.star-major {
    color: #ff4d4f; /* 主星红 */
    font-weight: bold;
    font-size: 1rem;
}

.star-brightness {
    font-size: 0.7rem;
    color: #aaa;
    margin-left: 1px;
    vertical-align: super;
}

.stars-minor {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 0.85rem;
    color: #a0cfff; /* 副星蓝 */
    margin-bottom: auto; /* 推到底部 */
}

.cell-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 4px;
}

.palace-name {
    background: var(--primary);
    color: #000;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

.gan-zhi-label {
    font-size: 1.1rem;
    font-family: 'Ma Shan Zheng', serif;
    color: var(--gold);
}

.decade-luck {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* 移动端适配：紫微盘转为单列或简化 Grid */
@media (max-width: 768px) {
    .ziwei-chart-grid {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .ziwei-center-info {
        order: -1; /* 放在最前 */
        margin-bottom: 10px;
    }
    
    .ziwei-cell {
        min-height: auto;
    }
}

/* 果老星宗星盘样式 */
.guolao-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    table-layout: fixed;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.guolao-table td {
    border: 1px solid #eee;
    padding: 8px 4px;
    vertical-align: top;
    height: 110px;
    position: relative;
}

.guolao-cell {
    background: #fff;
    transition: all 0.3s ease;
}

.guolao-cell:hover {
    background: #fcfcfc;
}

.center-cell {
    background: #fdfbf7 !important;
    border: none !important;
}

.guolao-palace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px dashed #eee;
    font-size: 0.9rem;
}

.guolao-dizhi {
    font-weight: bold;
    color: var(--primary-dark);
    font-size: 1.1rem;
}

.guolao-gongming {
    font-size: 0.8rem;
    color: #666;
    background: #f0f0f0;
    padding: 1px 4px;
    border-radius: 4px;
}

.guolao-gongming.ming-gong {
    background: var(--primary);
    color: #fff;
}

.guolao-stars {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    font-size: 0.8rem;
    justify-content: center;
}

.star-item {
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 500;
}

.star-7 { color: #d32f2f; background: #ffebee; } /* 七政 */
.star-4 { color: #1976d2; background: #e3f2fd; } /* 四余 */
.star-28 { color: #388e3c; font-size: 0.75rem; } /* 二十八宿 */
.star-shen { color: #f57c00; font-size: 0.75rem; } /* 神煞 */

/* 移动端适配 */
@media (max-width: 600px) {
    .guolao-table td {
        height: 90px;
        padding: 4px 2px;
    }
    .guolao-dizhi { font-size: 0.9rem; }
    .guolao-gongming { font-size: 0.7rem; transform: scale(0.9); }
    .guolao-stars { font-size: 0.7rem; }
}


/* 果老星宗星盘样式 - 深色模式适配修复 */
.guolao-table {
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid rgba(255, 215, 0, 0.2) !important;
    color: var(--text-main) !important;
    box-shadow: none !important;
}

.guolao-table td {
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.guolao-cell {
    background: transparent !important;
}

.guolao-cell:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

.center-cell {
    background: transparent !important;
    border: none !important;
}

.guolao-palace-header {
    border-bottom: 1px dashed rgba(255, 255, 255, 0.2) !important;
}

.guolao-dizhi {
    color: var(--gold) !important;
}

.guolao-gongming {
    color: #eee !important;
    background: rgba(255, 255, 255, 0.15) !important;
}

.guolao-gongming.ming-gong {
    background: var(--primary) !important;
    color: #000 !important;
}

/* 星体标签适配深色背景 */
.star-7 { color: #ff8a80 !important; background: rgba(211, 47, 47, 0.3) !important; }
.star-4 { color: #82b1ff !important; background: rgba(25, 118, 210, 0.3) !important; }
.star-28 { color: #a5d6a7 !important; }
.star-shen { color: #ffcc80 !important; }

/* 强制分析列表为单列 */
.ziwei-grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
}

.palace-item {
    grid-column: auto !important; /* 覆盖可能的 span 2 */
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 215, 0, 0.1) !important;
}


/* 五行能量柱状图样式 */
.wuxing-chart {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.wuxing-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wuxing-label {
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: bold;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.label-metal { background: #FDD835; color: #fff; }
.label-wood { background: #2E7D32; }
.label-water { background: #1E88E5; }
.label-fire { background: #E53935; }
.label-earth { background: #795548; color: #fff; }

.wuxing-progress {
    flex-grow: 1;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.wuxing-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.8s ease-out;
}

.fill-metal { background: linear-gradient(90deg, #FDD835, #FBC02D); }
.fill-wood { background: linear-gradient(90deg, #66BB6A, #2E7D32); }
.fill-water { background: linear-gradient(90deg, #42A5F5, #1565C0); }
.fill-fire { background: linear-gradient(90deg, #EF5350, #C62828); }
.fill-earth { background: linear-gradient(90deg, #8D6E63, #4E342E); }

.wuxing-value {
    width: 45px;
    text-align: right;
    font-size: 0.95rem;
    font-weight: bold;
    color: var(--text-main);
    font-family: 'Roboto Mono', monospace;
}

