/**
 * 范老师 | 子平法手工起名 v2.0.9
 * 专项优化：生辰卡片内部垂直居中 + 首页内容彻底隐藏
 */

:root {
    --ios-bg: #FBFBFD;
    --ios-text-main: #1D1D1F;
    --ios-text-secondary: #86868B;
    --ios-text-tertiary: rgba(60, 60, 67, 0.25);
    --c-mu: #EEF5ED; --c-huo: #FFF0F0; --c-shui: #F0F7FF; --c-jin: #F8F8F8; --c-tian: #F5F3FF;
}

* { 
    box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent; 
    letter-spacing: -0.01em;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

html, body {
    margin: 0; padding: 0; width: 100%; height: 100%;
    overflow: hidden; 
    background-color: var(--ios-bg);
    font-family: -apple-system, "SF Pro Display", "PingFang SC", sans-serif;
    -webkit-font-smoothing: antialiased; 
    color: var(--ios-text-main);
    -webkit-overflow-scrolling: touch;
}

body { 
    display: flex; 
    flex-direction: column;
    will-change: transform;
}

/* 背景极光效果 - 简化版 */
.aurora-canvas {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 1; background: #fff;
    pointer-events: none;
}
.aurora-blob {
    position: absolute; width: 100vmax; height: 100vmax; border-radius: 50%;
    opacity: 0.3; 
    mix-blend-mode: multiply;
}
.blob-1 { background: var(--c-mu); top: -30%; left: -20%; }
.blob-2 { background: var(--c-tian); top: 10%; right: -30%; }
.blob-3 { background: var(--c-shui); bottom: -20%; left: 0%; }
.blob-4 { background: var(--c-huo); top: 30%; left: 20%; opacity: 0.2; }

/* 顶部标题栏 */
header { 
    position: relative; z-index: 10; text-align: center; 
    padding: 6vh 20px 3vh; flex-shrink: 0; 
}
header h1 { font-size: 24px; font-weight: 200; letter-spacing: 4px; margin: 0; opacity: 0.85; }

/* 适配iPhone小屏幕 */
@media (max-width: 375px) {
    header h1 {
        font-size: 20px;
        letter-spacing: 2px;
    }
}
header p { font-size: 10px; letter-spacing: 4px; color: var(--ios-text-secondary); margin-top: 10px; font-weight: 300; text-transform: uppercase; }

/* 容器 */
.container {
    position: relative; z-index: 10; flex: 1; 
    display: flex; flex-direction: column; gap: 15px; 
    padding: 0 25px 15px; max-width: 460px; margin: 0 auto; width: 100%;
    transition: transform 0.5s cubic-bezier(0.2, 0, 0.2, 1), opacity 0.5s cubic-bezier(0.2, 0, 0.2, 1); 
    overflow: hidden; 
    will-change: transform;
}

/* 卡片基础样式 */
.nav-card {
    text-decoration: none; color: inherit; flex: 1; 
    background: rgba(255, 255, 255, 0.3); backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.5); border-radius: 28px;
    display: flex; flex-direction: column; justify-content: center; align-items: center;   
    transition: transform 0.5s cubic-bezier(0.2, 0, 0.2, 1), opacity 0.5s cubic-bezier(0.2, 0, 0.2, 1); 
    cursor: pointer; 
    overflow: hidden;
    will-change: transform;
}
.nav-card:active:not(.expanded) { transform: translateZ(0) scale(0.96) translateY(2px); }
.nav-card h2 { font-size: 18px; margin: 0 0 6px 0; font-weight: 300; letter-spacing: 4px; }
.nav-card span { font-size: 11px; color: var(--ios-text-secondary); font-weight: 300; letter-spacing: 1px; opacity: 0.6; }

.nav-card.hidden { display: none !important; }

/* --- 🌟 生辰展开核心逻辑 --- */

/* 1. 展开后的容器：强制内容垂直居中 */
.nav-card.expanded {
    flex: 1; width: 100%; height: 100%; cursor: default;
    background: rgba(255, 255, 255, 0.9);
    display: flex !important; 
    flex-direction: column !important;
    justify-content: center !important; /* 垂直居中 */
    align-items: center !important;    /* 水平居中 */
    padding: 30px 20px !important;
}

/* 展开时隐藏原本的“生辰”小标题 */
.nav-card.expanded > h2, 
.nav-card.expanded > span { 
    display: none !important; 
}

/* 2. 生辰内部内容：平时彻底隐藏，展开后激活 */
.birth-content, .xiyong-content {
    display: none; /* 首页不显示 */
    width: 100%; 
    max-width: 320px; 
    flex-direction: column; 
    align-items: center;
    opacity: 0;
}

/* 喜用板块样式 */
.xiyong-question {
    text-align: center;
    margin-bottom: 30px;
}

.xiyong-question h3 {
    font-size: 20px;
    font-weight: 300;
    letter-spacing: 2px;
    margin: 0;
}

.xiyong-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 280px;
}

.xiyong-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.xiyong-btn.left-btn {
    background: var(--ios-text-main);
    color: #fff;
}

.xiyong-btn.right-btn {
    background: rgba(0,0,0,0.05);
    color: var(--ios-text-main);
    border: 1px solid rgba(0,0,0,0.1);
}

.xiyong-btn:active {
    transform: scale(0.96);
}

.xiyong-input-section {
    width: 100%;
    max-width: 280px;
    margin-bottom: 20px;
}

/* 喜用结果区域样式 */
.xiyong-content {
    max-height: 80vh;
    overflow-y: auto;
    padding-right: 10px;
}

/* 自定义滚动条样式 */
.xiyong-content::-webkit-scrollbar {
    width: 6px;
}

.xiyong-content::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.05);
    border-radius: 3px;
}

.xiyong-content::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
}

.xiyong-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.3);
}

.xiyong-result-section {
    width: 100%;
    max-width: 300px;
    margin-top: 20px;
}

.result-part {
    background: rgba(0,0,0,0.03);
    border-radius: 16px;
    padding: 15px;
    margin-bottom: 15px;
}

.result-part h4 {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1px;
    margin: 0 0 15px 0;
    color: var(--ios-text-main);
    text-align: center;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.result-part div {
    font-size: 13px;
    line-height: 1.6;
    text-align: left;
}

.result-part.locked {
    background: rgba(0,0,0,0.02);
    border: 1px dashed rgba(0,0,0,0.1);
}

.locked-content {
    color: var(--ios-text-tertiary);
    text-align: center;
    padding: 20px 0;
    font-style: italic;
}

/* 展开后显示内容 */
.nav-card.expanded .birth-content,
.nav-card.expanded .xiyong-content {
    display: flex; /* 变为 flex 布局以便内部居中 */
    opacity: 1;
    transition: opacity 0.4s ease;
}



/* 输入组件样式 */
.calendar-tabs { display: flex; background: rgba(0,0,0,0.04); border-radius: 12px; padding: 3px; margin-bottom: 20px; width: 100%; max-width: 180px; }
.tab-item { flex: 1; padding: 6px; font-size: 12px; text-align: center; color: var(--ios-text-secondary); border-radius: 9px; cursor: pointer; }
.tab-item.active { background: #fff; color: var(--ios-text-main); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }

.input-group { margin-bottom: 12px; width: 100%; max-width: 280px; }
.input-group label { display: block; font-size: 11px; color: var(--ios-text-secondary); margin-bottom: 4px; text-align: center; }
.input-group input { width: 100%; background: rgba(0,0,0,0.05); border: none; border-radius: 12px; padding: 12px; font-size: 15px; text-align: center; outline: none; }

.action-btn { background: var(--ios-text-main); color: #fff; border: none; border-radius: 20px; padding: 12px 40px; font-size: 14px; margin: 20px auto 10px; display: block; letter-spacing: 2px; cursor: pointer; }

.result-view { margin-top: 15px; padding: 15px; border-radius: 18px; background: rgba(0,0,0,0.03); font-size: 13px; line-height: 1.6; text-align: center; width: 100%; min-height: 80px; max-height: 35vh; overflow-y: auto; border: 1px dashed rgba(0,0,0,0.05); }

.back-link {
    font-size: 12px;
    color: var(--ios-text-tertiary);
    margin-top: 15px;
    text-align: center;
    text-decoration: underline;
    cursor: pointer;
}

/* 喜用操作按钮 */
.xiyong-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
    width: 100%;
    max-width: 280px;
}

.result-actions {
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.result-actions .action-btn {
    flex: 1;
    margin: 0;
    padding: 10px 20px;
    font-size: 12px;
    letter-spacing: 1px;
}

.action-btn.secondary-btn {
    background: rgba(0,0,0,0.05);
    color: var(--ios-text-main);
    border: 1px solid rgba(0,0,0,0.1);
}

.action-btn.primary-btn {
    background: var(--ios-text-main);
    color: #fff;
    transition: all 0.3s ease;
}

.action-btn.primary-btn.success {
    background: #34c759;
    color: #fff;
    transform: scale(1.05);
    transition: all 0.3s ease;
}

/* 生辰操作按钮 */
.birth-actions {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-top: 20px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 280px;
}

.action-btn.small-btn {
    flex: 1;
    margin: 0;
    padding: 10px 20px;
    font-size: 12px;
    letter-spacing: 1px;
}

/* 底部与面板 */
footer { position: relative; z-index: 10; padding: 5px 20px calc(10px + env(safe-area-inset-bottom)); text-align: center; margin-top: auto; }
footer p { font-size: 9px; color: var(--ios-text-tertiary); margin: 2px 0; }

@media (max-width: 768px) {
    .container.expanded-mode { height: 75vh; }
    .nav-card.expanded { padding: 20px 15px !important; }
}

@media (min-width: 769px) { 
    .container:not(.expanded-mode) { display: grid; grid-template-columns: 1fr 1fr; max-width: 800px; } 
    .nav-card.expanded { max-height: 600px; }
}

#char-panel { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    z-index: 2000; 
    background: #fff; 
    transform: translate3d(0, 100%, 0); 
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1); 
    display: flex; 
    flex-direction: column;
    will-change: transform;
}
#char-panel.active { transform: translate3d(0, 0, 0); }
#char-frame { 
    flex: 1; 
    border: none; 
    width: 100%; 
    height: 100%;
    -webkit-overflow-scrolling: touch;
}

/* 信息圆圈样式 */
.info-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: #e6f2ff;
    color: #007AFF;
    font-size: 12px;
    cursor: pointer;
    margin-left: 4px;
    position: relative;
    vertical-align: top;
    margin-top: -4px;
    opacity: 0.8;
}

/* 信息框样式 */
.info-box {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    padding: 12px;
    background-color: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: 220px;
    z-index: 1000;
    display: none;
    font-size: 12px;
    line-height: 1.5;
    text-align: left;
    font-weight: 400;
}

.info-box p {
    margin-bottom: 8px;
    margin-top: 0;
    padding: 0;
}

.info-box p:last-child {
    margin-bottom: 0;
}

.info-box strong {
    font-weight: 600;
}

/* VIP 按钮 */
.action-btn.vip-btn {
    background: linear-gradient(135deg, #ffd700, #ffb800);
    color: #8b4513;
    font-weight: 700;
    padding: 8px 14px;
    flex-shrink: 0;
    font-size: 11px;
    border-radius: 16px;
    box-shadow: 0 2px 6px rgba(255, 215, 0, 0.3);
    letter-spacing: 1px;
}

.action-btn.vip-btn:active {
    transform: scale(0.96);
}

/* VIP 面板 */
#vip-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    background: #fff;
    transform: translate3d(0, 100%, 0);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    will-change: transform;
}

#vip-panel.active {
    transform: translate3d(0, 0, 0);
}

.vip-header {
    position: relative;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

.vip-close {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    color: var(--ios-text-secondary);
    cursor: pointer;
}

.vip-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    letter-spacing: 2px;
}

.vip-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
}

/* VIP 排盘样式 - 表格布局 */
.vip-section {
    margin-bottom: 25px;
}

.vip-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--ios-text-main);
    margin: 0 0 12px 0;
    text-align: center;
    letter-spacing: 2px;
}

/* 四柱表格 */
.vip-bazi-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.vip-bazi-table th,
.vip-bazi-table td {
    padding: 8px 4px;
    text-align: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.vip-bazi-table th {
    font-weight: 500;
    color: #999;
    font-size: 11px;
    background: rgba(0, 0, 0, 0.02);
}

.vip-bazi-table td {
    font-weight: 600;
}

.vip-bazi-table .label-col {
    width: 60px;
    color: #666;
    font-size: 11px;
    background: rgba(0, 0, 0, 0.02);
}

.vip-bazi-table .ganzhi-cell {
    font-size: 18px;
    font-weight: 900;
}

.vip-bazi-table .canggan-cell {
    font-size: 11px;
    line-height: 1.6;
}

.vip-bazi-table .canggan-cell .main {
    color: #d97706;
    font-weight: 700;
}

.vip-bazi-table .canggan-cell .other {
    color: #999;
}

.vip-bazi-table .shishen-cell {
    font-size: 11px;
    color: #666;
}

.vip-bazi-table .xingyun-cell {
    font-size: 11px;
    color: #888;
}

.vip-bazi-table .zizuo-cell {
    font-size: 11px;
    color: #666;
}

/* 大运样式 */
.vip-dayun-section {
    margin-top: 25px;
}

.vip-dayun-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 4px;
}

.vip-dayun-header h3 {
    margin: 0;
}

/* 性别切换按钮 */
.vip-gender-switch {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.05);
    padding: 3px;
    border-radius: 20px;
}

.vip-gender-btn {
    padding: 5px 14px;
    border: none;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: #666;
    transition: all 0.2s ease;
}

.vip-gender-btn.active {
    background: #fff;
    color: var(--ios-text-main);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.vip-gender-btn:active {
    transform: scale(0.95);
}

.vip-dayun-container {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 10px;
    -webkit-overflow-scrolling: touch;
}

.vip-dayun-item {
    min-width: 70px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 10px;
    padding: 8px 4px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.vip-dayun-item:hover {
    background: rgba(0, 0, 0, 0.06);
}

.vip-dayun-item.active {
    background: rgba(255, 215, 0, 0.15);
    border-color: #ffd700;
}

.vip-dayun-age {
    font-size: 10px;
    color: #999;
    margin-bottom: 2px;
}

.vip-dayun-ganzhi {
    font-size: 16px;
    font-weight: 700;
    margin: 4px 0;
}

.vip-dayun-shishen {
    font-size: 9px;
    color: #888;
    line-height: 1.3;
}

.vip-dayun-year {
    font-size: 9px;
    color: #aaa;
    margin-top: 2px;
}

/* 流年样式 */
.vip-liunian-section {
    margin-top: 20px;
}

.vip-liunian-header {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
    text-align: center;
}

.vip-liunian-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

.vip-liunian-item {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 8px;
    padding: 6px 2px;
    text-align: center;
}

.vip-liunian-year {
    font-size: 9px;
    color: #999;
}

.vip-liunian-ganzhi {
    font-size: 13px;
    font-weight: 700;
    margin: 2px 0;
}

.vip-liunian-shishen {
    font-size: 8px;
    color: #888;
}

/* 生克制化提醒 */
.vip-relation-section {
    margin-top: 25px;
}

.vip-relation-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.vip-relation-item {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 10px;
    padding: 10px;
    border-left: 3px solid #d97706;
}

.vip-relation-item.chong {
    border-left-color: #ef4444;
}

.vip-relation-item.xing {
    border-left-color: #8b5cf6;
}

.vip-relation-item.he {
    border-left-color: #22c55e;
}

.vip-relation-type {
    font-size: 11px;
    font-weight: 700;
    color: #d97706;
    margin-bottom: 4px;
}

.vip-relation-item.chong .vip-relation-type {
    color: #ef4444;
}

.vip-relation-item.xing .vip-relation-type {
    color: #8b5cf6;
}

.vip-relation-item.he .vip-relation-type {
    color: #22c55e;
}

.vip-relation-content {
    font-size: 10px;
    color: #666;
    line-height: 1.4;
}