/* ===================== Hexagram Divination Page ===================== */
.hexagram-page {
    min-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1.5rem;
}

.hexagram-header {
    text-align: center;
    margin-bottom: 2rem;
}

.hexagram-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.hexagram-header p {
    max-width: 500px;
    margin: 0 auto;
}

/* Coin Animation Area */
.coin-area {
    display: flex;
    gap: 0.3rem;
    justify-content: center;
    flex-wrap: wrap;
    margin: 0.3rem 0;
    min-height: 90px;
    align-items: flex-end;
}

.coin-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
}

.coin {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    font-family: 'Noto Serif SC', serif;
    transition: all 0.3s ease;
    position: relative;
}

.coin.heads {
    background: linear-gradient(145deg, #D4A853, #8B6914);
    color: var(--bg-deep);
    box-shadow: 0 4px 15px rgba(212, 168, 83, 0.4), inset 0 1px 0 rgba(255,255,255,0.3);
}

.coin.tails {
    background: linear-gradient(145deg, #4a4a4a, #2a2a2a);
    color: var(--text-muted);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255,255,255,0.1);
    border: 2px solid #555;
}

.coin.flipping {
    animation: coin-flip 0.6s ease-in-out;
}

@keyframes coin-flip {
    0% { transform: rotateY(0deg) scale(1); }
    25% { transform: rotateY(180deg) scale(1.2) translateY(-20px); }
    50% { transform: rotateY(360deg) scale(1) translateY(0); }
    75% { transform: rotateY(540deg) scale(1.1) translateY(-10px); }
    100% { transform: rotateY(720deg) scale(1) translateY(0); }
}

.coin.waiting {
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(212, 168, 83, 0.3);
    color: var(--text-muted);
    font-size: 0.8rem;
}

.coin-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Line indicators (from bottom to top) */
.lines-display {
    display: flex;
    flex-direction: column-reverse; /* 从下到上排列，初爻在最下面 */
    gap: 0.12rem;
    margin: 0.3rem 0;
    align-items: center;
}

.line-indicator {
    width: 35px;
    height: 3px;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.line-indicator.yang {
    background: var(--primary-gold);
    width: 35px;
}

.line-indicator.yin {
    background: none;
    width: 35px;
    position: relative;
    display: flex;
    justify-content: space-between;
}

.line-indicator.yin::before,
.line-indicator.yin::after {
    content: '';
    width: 15px;
    height: 3px;
    background: var(--primary-gold);
    border-radius: 2px;
}

.line-indicator.waiting {
    background: rgba(255, 255, 255, 0.1);
}

.line-indicator.moving {
    box-shadow: 0 0 8px var(--warning);
}

/* Divine Button */
.divine-btn {
    padding: 1rem 3rem;
    font-size: 1.1rem;
    border-radius: 14px;
    font-family: 'Noto Serif SC', serif;
    letter-spacing: 0.1em;
    margin: 1rem 0;
}

.divine-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Result Display */
.hexagram-result {
    width: 100%;
    max-width: 700px;
    margin-top: 1.5rem;
    display: none;
}

.hexagram-result.show { display: block; }

.result-card {
    text-align: center;
    padding: 2rem 1.5rem;
}

.result-symbol {
    font-size: 4rem;
    margin-bottom: 0.5rem;
    display: block;
}

.result-name {
    font-family: 'Noto Serif SC', serif;
    font-size: 2rem;
    color: var(--primary-gold);
    margin-bottom: 0.3rem;
}

.result-fullname {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.result-description {
    font-size: 1rem;
    color: var(--text-light);
    line-height: 2;
    padding: 1rem;
    border-left: 2px solid var(--primary-gold);
    text-align: left;
    margin: 1rem 0;
}

.result-lines {
    text-align: left;
    margin-top: 1.5rem;
}

.result-line-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.85rem;
    line-height: 1.6;
}

.result-line-item.moving {
    background: rgba(245, 158, 11, 0.08);
    border-radius: 8px;
    padding: 0.5rem 0.8rem;
    margin: 0.2rem 0;
    border-left: 3px solid var(--warning);
    border-bottom: none;
}

.result-line-pos {
    width: 50px;
    color: var(--primary-gold);
    font-weight: 600;
    font-size: 0.8rem;
    flex-shrink: 0;
    text-align: left;
}

.result-line-text {
    flex: 1;
    color: var(--text-light);
    font-size: 0.85rem;
    text-align: left;
}

.moving-label {
    font-size: 0.7rem;
    color: var(--warning);
    background: rgba(245, 158, 11, 0.15);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    margin-left: 0.5rem;
    flex-shrink: 0;
}

/* Progress */
.divine-progress {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.progress-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s;
}

.progress-dot.active {
    background: var(--primary-gold);
    box-shadow: 0 0 8px rgba(212, 168, 83, 0.5);
}

.progress-dot.done {
    background: var(--primary-gold);
}

/* Animation for progress dot reset */
@keyframes dot-reset {
    0% { transform: scale(0.8); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

.progress-dot.resetting {
    animation: dot-reset 0.4s ease-out;
}

@media (max-width: 768px) {
    .coin { width: 55px; height: 55px; font-size: 1.2rem; }
    .hexagram-header h1 { font-size: 1.5rem; }
    .result-symbol { font-size: 3rem; }
    .result-name { font-size: 1.5rem; }
    .coin-area { gap: 0.5rem; }
}

/* ===================== 变卦展示样式 ===================== */
.result-main {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.result-original {
    flex: 1;
}

/* ===================== 新增：并排卦象图示样式 ===================== */

/* 卦象显示区域（位于硬币下方） */
.hexagram-display-area {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* 卦象对（主卦+变卦） */
.hexagram-pair {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: nowrap;
}

.hexagram-pair.single {
    justify-content: center;
}

.hexagram-card {
    padding: 0.5rem 1rem;
    border-radius: 12px;
    text-align: center;
    min-width: 160px;
    max-width: 200px;
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    box-sizing: border-box;
}

.hexagram-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: rgba(212, 168, 83, 0.1);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    margin-bottom: 0;
}

.hexagram-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.hexagram-fullname {
    font-family: 'Noto Serif SC', serif;
    font-size: 1rem;
    color: var(--primary-gold);
    font-weight: 600;
    margin-top: 0.3rem;
}

/* 卦象符号图示 */
.hexagram-symbol {
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: center;
    justify-content: center;
    margin-top: 0.2rem;
}

.hex-line {
    width: 55px;
    height: 5px;
    border-radius: 3px;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.hex-line.yang {
    background: var(--primary-gold);
}

.hex-line.yin {
    background: transparent;
    display: flex;
    justify-content: center;
}

.hex-line.yin::before,
.hex-line.yin::after {
    content: '';
    width: 23px;
    height: 5px;
    background: var(--primary-gold);
    border-radius: 3px;
}

.hex-line.yin::after {
    margin-left: 4px;
}

.hex-line.moving {
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.6);
    animation: pulse-glow 1.5s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 8px rgba(245, 158, 11, 0.4); }
    50% { box-shadow: 0 0 15px rgba(245, 158, 11, 0.8); }
}

.moving-dot {
    position: absolute;
    top: 50%;
    right: -12px;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: #f59e0b;
    border-radius: 50%;
    animation: pulse-glow 1.5s ease-in-out infinite;
}

/* 箭头分隔符 */
.hexagram-divider {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}

.hexagram-divider .arrow {
    font-size: 2rem;
    color: var(--primary-gold);
    opacity: 0.7;
}

/* 变卦折叠开关 */
.changed-toggle-btn {
    background: rgba(212, 168, 83, 0.1);
    border: 1px solid rgba(212, 168, 83, 0.3);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    margin-top: 0.3rem;
}

.changed-toggle-btn:hover {
    background: rgba(212, 168, 83, 0.2);
    border-color: rgba(212, 168, 83, 0.5);
    transform: scale(1.1);
}

.changed-toggle-btn .toggle-icon {
    font-size: 0.9rem;
    color: var(--primary-gold);
    transition: transform 0.3s ease;
    display: inline-block;
    transform: rotate(0deg);
}

.changed-toggle-btn.expanded .toggle-icon {
    transform: rotate(90deg);
}

/* 变卦详情卡片折叠状态 */
.changed-detail-card {
    transition: all 0.3s ease;
}

/* 详情区域 */
.hexagram-details {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.hexagram-detail-card {
    flex: 1;
    min-width: 260px;
    max-width: 380px;
    text-align: center;
    padding: 0 0.5rem;
}

.hexagram-detail-card.single {
    max-width: 500px;
}

/* 隐藏不需要的元素 */
.detail-header,
.detail-description {
    display: none;
}

.detail-lines {
    display: none; /* 隐藏爻辞 */
}

/* 无动爻提示 */
.no-moving-notice {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* 动爻高亮样式 */
.progress-dot.moving {
    background: #f59e0b !important;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .coin-area {
        gap: 0.2rem;
        margin: 0.2rem 0;
        min-height: 80px;
    }

    .coin-slot {
        gap: 0.08rem;
    }

    .coin {
        width: 50px;
        height: 50px;
        font-size: 1.1rem;
    }

    .coin-label {
        font-size: 0.65rem;
    }

    .lines-display {
        gap: 0.1rem;
        margin: 0.2rem 0;
    }

    .line-indicator {
        width: 30px;
        height: 2px;
    }

    .line-indicator.yang {
        width: 30px;
    }

    .line-indicator.yin {
        width: 30px;
    }

    .line-indicator.yin::before,
    .line-indicator.yin::after {
        width: 13px;
        height: 2px;
    }

    .hexagram-display-area {
        margin-bottom: 1rem;
        padding-bottom: 0.8rem;
    }

    .hexagram-pair {
        gap: 0.8rem;
        flex-wrap: nowrap;
    }

    .hexagram-card {
        padding: 0.5rem 0.6rem;
        min-width: 120px;
        max-width: 140px;
        box-sizing: border-box;
        gap: 0.3rem;
    }

    .hexagram-info {
        flex-direction: column;
        gap: 0.15rem;
    }

    .hexagram-fullname {
        font-size: 0.9rem;
    }

    .hexagram-label {
        font-size: 0.65rem;
        padding: 0.15rem 0.5rem;
        margin-bottom: 0.1rem;
    }

    .hexagram-symbol {
        min-height: 100px;
    }

    .hex-line {
        width: 45px;
        height: 4px;
    }

    .hex-line.yin::before,
    .hex-line.yin::after {
        width: 19px;
        height: 4px;
    }

    .hex-line.yin::after {
        margin-left: 3px;
    }

    .hexagram-divider .arrow {
        font-size: 1.2rem;
    }

    .changed-toggle-btn {
        width: 24px;
        height: 24px;
    }

    .changed-toggle-btn .toggle-icon {
        font-size: 0.8rem;
    }

    .hexagram-details {
        flex-direction: row;
        gap: 0.8rem;
    }

    .hexagram-detail-card {
        min-width: calc(50% - 0.4rem);
        padding: 0;
    }

    .result-line-item {
        font-size: 0.8rem;
        padding: 0.4rem 0.5rem;
    }

    .result-line-pos {
        width: 45px;
        font-size: 0.75rem;
    }

    .result-line-text {
        font-size: 0.8rem;
    }

    .liuyao-content {
        font-size: 0.8rem;
    }

    .liuyao-category {
        gap: 0.4rem;
    }

    .liuyao-category .category-name {
        font-size: 0.75rem;
        min-width: 32px;
    }

    .liuyao-category .category-result {
        font-size: 0.75rem;
    }
}

/* ===================== 六爻详细解读样式 ===================== */
.liuyao-detail {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    text-align: left;
}

.liuyao-detail.main {
    border-top-color: rgba(212, 168, 83, 0.3);
}

.liuyao-detail.changed {
    border-top-color: rgba(139, 69, 19, 0.3);
}

.liuyao-section {
    margin-bottom: 0.8rem;
}

.liuyao-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.liuyao-content {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.7;
    padding: 0.6rem 0.8rem;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    border-left: 2px solid rgba(212, 168, 83, 0.5);
}

.liuyao-detail.changed .liuyao-content {
    border-left-color: rgba(139, 69, 19, 0.5);
}

.liuyao-guaci {
    font-size: 0.9rem;
    line-height: 1.8;
    background: rgba(212, 168, 83, 0.05);
}

.liuyao-detail.changed .liuyao-guaci {
    background: rgba(139, 69, 19, 0.05);
}

/* 卦辞详解样式 */
.liuyao-guaci-detail {
    margin-top: 0.5rem;
}

.liuyao-guaci-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* 分类解读（事业/财运/感情/健康） */
.liuyao-category {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.3rem 0;
    margin-bottom: 0.2rem;
}

.liuyao-category .category-icon {
    font-size: 0.9rem;
}

.liuyao-category .category-name {
    font-size: 0.8rem;
    color: var(--text-secondary);
    min-width: 36px;
}

.liuyao-category .category-result {
    font-size: 0.8rem;
    padding: 0.15rem 0.6rem;
    border-radius: 4px;
    font-weight: 600;
}

.liuyao-category .category-result.result-great {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.liuyao-category .category-result.result-good {
    background: rgba(16, 185, 129, 0.15);
    color: #10B981;
}

.liuyao-category .category-result.result-not-good {
    background: rgba(156, 163, 175, 0.2);
    color: #9ca3af;
}

.liuyao-category .category-result.result-neutral {
    background: rgba(156, 163, 175, 0.2);
    color: #9ca3af;
}

.liuyao-category .category-result.result-bad {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* ===================== 象图样式 ===================== */
.hexagram-xiang-img {
    width: 100%;
    max-width: 220px;
    height: auto;
    margin: 0.8rem auto 1.2rem;
    display: block;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(212, 168, 83, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hexagram-xiang-img:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(212, 168, 83, 0.25);
}

/* 移动端象图适配 */
@media (max-width: 768px) {
    .hexagram-xiang-img {
        max-width: 160px;
        margin: 0.6rem auto 1rem;
    }
}
