/* ==================== 基础重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2C5F4E;
    --primary-light: #4A7C6F;
    --primary-dark: #1E4236;
    --accent-color: #C4A35A;
    --accent-light: #D4B76A;
    --bg-color: #F5F0E8;
    --card-bg: #FFFBF5;
    --text-primary: #2C3E50;
    --text-secondary: #5D6D7E;
    --text-light: #8A9A95;
    --border-color: #E0D5C5;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-hover: 0 8px 30px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Serif SC', 'Microsoft YaHei', 'SimSun', serif;
    background-color: var(--bg-color);
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d4c4a8' fill-opacity='0.15'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==================== 布局容器 ==================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* ==================== 头部 ==================== */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 25px 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(196,163,90,0.15) 0%, transparent 70%);
    border-radius: 50%;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-icon {
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(196,163,90,0.3);
    animation: rotate 20s linear infinite;
}

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

.logo-text h1 {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 4px;
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.logo-text p {
    font-size: 14px;
    opacity: 0.9;
    letter-spacing: 2px;
}

.header-quote {
    font-style: italic;
    font-size: 16px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-quote i {
    color: var(--accent-color);
    font-size: 12px;
}

/* ==================== 占卜类型区域 ==================== */
.types-section {
    background: var(--bg-color);
    padding: 25px 0;
    border-bottom: 1px solid var(--border-color);
}

.types-section .container {
    max-width: 1400px;
}

.types-section .card {
    margin-bottom: 0;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* ==================== 卡片组件 ==================== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    margin-bottom: 25px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title i {
    color: var(--accent-color);
    font-size: 20px;
}

/* ==================== 占卜类型选项 ==================== */
.divination-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.option {
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 18px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    user-select: none;
}

.option::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, transparent 0%, rgba(196,163,90,0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.option:hover {
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.option:hover::before {
    opacity: 1;
}

.option.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.option-icon {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--accent-color);
    transition: color 0.3s ease;
}

.option.active .option-icon {
    color: var(--accent-light);
}

.option-name {
    font-size: 14px;
    font-weight: 500;
}

/* ==================== 主内容区 ==================== */
.main-content {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 30px;
    padding: 30px 0;
    flex: 1;
}

/* ==================== 侧边栏 ==================== */
.sidebar {
    position: sticky;
    top: 30px;
    height: fit-content;
}

/* ==================== 历史记录 ==================== */
.history-container {
    max-height: 400px;
    overflow-y: auto;
}

.empty-history {
    text-align: center;
    color: var(--text-light);
    padding: 30px 20px;
    font-style: italic;
}

.history-item {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.3s ease;
    border-radius: var(--radius-sm);
}

.history-item:hover {
    background: var(--bg-color);
}

.history-item:last-child {
    border-bottom: none;
}

.history-time {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 5px;
}

.history-type {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-right: 8px;
}

.history-gua {
    font-weight: 600;
    color: var(--primary-color);
}

/* ==================== 输入区域 ==================== */
.input-section {
    margin-bottom: 25px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title i {
    color: var(--accent-color);
}

.number-input-row,
.seeker-info-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group.compact {
    align-items: center;
}

.input-group label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.number-input,
.select-input,
.textarea-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 15px;
    background: white;
    transition: all 0.3s ease;
    color: var(--text-primary);
}

.number-input:focus,
.select-input:focus,
.textarea-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(196,163,90,0.1);
}

.number-input.compact-input {
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    width: 80px;
    padding: 15px;
}

.select-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235D6D7E' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
}

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

.hint {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: var(--text-light);
    margin-top: 8px;
}

.hint i {
    color: var(--accent-color);
    margin-top: 2px;
    flex-shrink: 0;
}

.hint-inline {
    background: rgba(196,163,90,0.08);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-color);
}

/* ==================== 按钮 ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(44,95,78,0.3);
    margin-bottom: 15px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44,95,78,0.4);
}

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

.btn-secondary {
    background: var(--bg-color);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    flex: 1;
}

.btn-secondary:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:active {
    background: var(--text-light);
    color: white;
}

.action-buttons-row {
    display: flex;
    gap: 12px;
}

/* ==================== 加载动画 ==================== */
.loader {
    text-align: center;
    padding: 40px;
    background: rgba(255,251,245,0.95);
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.loader.hidden,
.gua-container.hidden,
.center-toast.hidden {
    display: none !important;
}

.yin-yang {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(to bottom, white 50%, black 50%);
    position: relative;
    margin: 0 auto 20px;
    animation: rotate 2s linear infinite;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

.yin-yang::before,
.yin-yang::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    left: 50%;
    transform: translateX(-50%);
}

.yin-yang::before {
    top: 0;
    background: white;
    border: 8px solid black;
}

.yin-yang::after {
    bottom: 0;
    background: black;
    border: 8px solid white;
}

.loader p {
    color: var(--primary-color);
    font-size: 15px;
    font-weight: 500;
}

/* ==================== 卦象结果 ==================== */
.gua-container {
    animation: fadeIn 0.5s ease;
}

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

.gua-result {
    padding: 20px 0;
}

.gua-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px dashed var(--border-color);
}

.gua-name-main {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
    letter-spacing: 4px;
}

.gua-name-sub {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.gua-meta {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.gua-meta-item {
    background: var(--bg-color);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.gua-meta-item i {
    color: var(--accent-color);
    margin-right: 6px;
}

.gua-graphics {
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 30px;
}

.gua-box {
    text-align: center;
    flex: 1;
    min-width: 200px;
    background: var(--bg-color);
    padding: 25px;
    border-radius: var(--radius);
    border: 2px solid var(--border-color);
}

.gua-box-title {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 15px;
    font-weight: 600;
}

.gua-lines {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
    align-items: center;
}

.gua-line {
    width: 120px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 4px;
    position: relative;
    transition: all 0.3s ease;
}

.gua-line.yang {
    background: var(--primary-color);
}

.gua-line.yin {
    background: transparent;
    border: 3px solid var(--primary-color);
    height: 14px;
}

.gua-line.dong {
    animation: pulse 2s infinite;
}

.gua-line.dong::after {
    content: '动';
    position: absolute;
    right: -35px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--accent-color);
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 5px rgba(196,163,90,0.5); }
    50% { opacity: 0.7; box-shadow: 0 0 15px rgba(196,163,90,0.8); }
}

.gua-explanation {
    background: var(--bg-color);
    border-radius: var(--radius);
    padding: 25px;
    border-left: 4px solid var(--accent-color);
    margin-top: 20px;
}

.explanation-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.explanation-title i {
    color: var(--accent-color);
}

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

.explanation-content p {
    margin-bottom: 12px;
    text-align: justify;
}

.explanation-content p:last-child {
    margin-bottom: 0;
}

.ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    margin-left: 10px;
    font-weight: 500;
}

.local-badge {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
}

/* ==================== 页脚 ==================== */
footer {
    background: var(--primary-dark);
    color: rgba(255,255,255,0.8);
    padding: 30px 0;
    margin-top: auto;
}

.footer-content {
    text-align: center;
}

.footer-row {
    margin-bottom: 15px;
}

.footer-row.first-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
}

.footer-row.last-row {
    margin-bottom: 0;
}

.copyright {
    font-size: 14px;
}

.contact-link {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.contact-link:hover {
    color: var(--accent-light);
}

.motto {
    font-style: italic;
    font-size: 16px;
    color: var(--accent-color);
    letter-spacing: 2px;
}

/* ==================== 提示框 ==================== */
.center-toast {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.center-toast-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px 40px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease;
    position: relative;
}

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

.center-toast-icon {
    font-size: 48px;
    color: var(--accent-color);
    margin-bottom: 15px;
}

.center-toast-message {
    font-size: 16px;
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 20px;
}

.center-toast-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-light);
    cursor: pointer;
    transition: color 0.3s ease;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.center-toast-close:hover {
    color: var(--text-primary);
    background: var(--bg-color);
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 260px 1fr;
        gap: 20px;
    }
    
    .types-section .card {
        max-width: 100%;
    }
    
    .divination-options {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .types-section {
        padding: 15px 0;
    }
    
    .types-section .card {
        padding: 15px;
    }
    
    .types-section .card-title {
        font-size: 16px;
        margin-bottom: 12px;
        padding-bottom: 8px;
    }
    
    .divination-options {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }
    
    .option {
        padding: 12px 4px;
        border-width: 1.5px;
    }
    
    .option-icon {
        font-size: 20px;
        margin-bottom: 5px;
    }
    
    .option-name {
        font-size: 12px;
    }
    
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px 0;
    }
    
    .sidebar {
        position: static;
        order: 2;
    }
    
    .divination-area {
        order: 1;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .logo-text h1 {
        font-size: 24px;
    }
    
    .header-quote {
        font-size: 14px;
    }
    
    .number-input-row,
    .seeker-info-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .number-input.compact-input {
        width: 100%;
        font-size: 18px;
        padding: 12px;
    }
    
    .input-group.compact {
        align-items: stretch;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 15px;
    }
    
    .action-buttons-row {
        gap: 10px;
    }
    
    .gua-graphics {
        flex-direction: column;
        gap: 20px;
    }
    
    .gua-box {
        min-width: auto;
        padding: 20px;
    }
    
    .gua-name-main {
        font-size: 24px;
    }
    
    .footer-row.first-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .motto {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .card {
        padding: 20px 15px;
    }
    
    .divination-options {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
    
    .option {
        padding: 10px 2px;
        border-radius: 6px;
    }
    
    .option-icon {
        font-size: 18px;
        margin-bottom: 3px;
    }
    
    .option-name {
        font-size: 11px;
    }
    
    .section-title {
        font-size: 15px;
    }
    
    .hint-inline {
        font-size: 12px;
        padding: 8px 10px;
    }
}

/* ==================== 滚动条美化 ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-color);
}

::selection {
    background: rgba(196,163,90,0.3);
    color: var(--primary-dark);
}

::placeholder {
    color: var(--text-light);
    opacity: 0.7;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}