/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1E3A5F;
    --secondary-color: #3D5A80;
    --accent-color: #98C1D9;
    --bg-color: #FFFFFF;
    --text-color: #293241;
    --light-text: #6C757D;
    --border-color: #E9ECEF;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

/* 容器 */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

.header h1 {
    color: var(--primary-color);
    font-size: 28px;
    margin-bottom: 8px;
}

.header p {
    color: var(--light-text);
    font-size: 14px;
}

/* 主要内容 */
.main {
    flex: 1;
    padding: 20px 0;
}

/* 方向选择 */
.direction-select {
    margin-bottom: 30px;
}

.direction-select h2 {
    font-size: 18px;
    color: var(--primary-color);
    margin-bottom: 16px;
    text-align: center;
}

.direction-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.direction-card {
    padding: 20px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-color);
}

.direction-card:hover {
    border-color: var(--accent-color);
    background: #F8F9FA;
}

.direction-card.selected {
    border-color: var(--primary-color);
    background: var(--accent-color);
}

.direction-card .icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.direction-card .label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
}

/* 按钮 */
.btn {
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 12px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--secondary-color);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--accent-color);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto;
    padding: 12px 20px;
}

.btn-group {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn-group .btn {
    flex: 1;
    margin-bottom: 0;
}

/* 抽签动画 */
.draw-animation {
    text-align: center;
    padding: 40px 20px;
}

.draw-animation .spinner {
    width: 80px;
    height: 80px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.draw-animation p {
    font-size: 16px;
    color: var(--primary-color);
}

/* 结果展示 */
.result-display {
    text-align: center;
}

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

.hexagram-name {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.hexagram-nickname {
    font-size: 16px;
    color: var(--light-text);
    margin-bottom: 24px;
}

.result-detail {
    text-align: left;
    background: #F8F9FA;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.result-detail .label {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 12px;
    display: block;
}

.result-detail .summary {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--accent-color);
}

.result-detail .detail-content {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-color);
}

/* 收藏列表 */
.favorites-list {
    padding: 10px 0;
}

.favorite-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #F8F9FA;
    border-radius: 12px;
    margin-bottom: 12px;
}

.favorite-item .thumbnail {
    flex-shrink: 0;
}

.favorite-item .info {
    flex: 1;
    text-align: left;
}

.favorite-item .info .name {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.favorite-item .info .meta {
    font-size: 13px;
    color: var(--light-text);
}

.favorite-item .delete-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--light-text);
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.favorite-item .delete-btn:hover {
    background: #E9ECEF;
    color: #DC3545;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--light-text);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
}

/* 提示消息 */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-color);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 1000;
    animation: fadeInOut 2s ease;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    15% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    85% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
}

/* 底部免责声明 */
.footer {
    padding: 30px 0 20px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.disclaimer {
    font-size: 12px;
    color: var(--light-text);
    line-height: 1.6;
}

.disclaimer strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text-color);
}

/* 剩余次数提示 */
.remaining-count {
    text-align: center;
    font-size: 14px;
    color: var(--light-text);
    margin-bottom: 20px;
}

.remaining-count span {
    color: var(--primary-color);
    font-weight: 600;
}

/* 响应式适配 */
@media (max-width: 480px) {
    .container {
        padding: 16px;
    }
    
    .header h1 {
        font-size: 24px;
    }
    
    .direction-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .direction-card {
        padding: 16px 12px;
    }
    
    .direction-card .icon {
        font-size: 20px;
    }
    
    .hexagram-name {
        font-size: 20px;
    }
    
    .btn-group {
        flex-direction: column;
    }
}
