:root {
    --primary-color: #d4524f;
    --secondary-color: #f4a261;
    --accent-color: #e76f51;
    --bg-primary: #faf8f3;
    --bg-secondary: #fff;
    --text-primary: #2d3436;
    --text-secondary: #636e72;
    --border-color: #e8dcc4;
    --shadow-sm: 0 2px 8px rgba(212, 82, 79, 0.08);
    --shadow-md: 0 4px 16px rgba(212, 82, 79, 0.12);
    --shadow-lg: 0 8px 32px rgba(212, 82, 79, 0.16);
}

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

body {
    font-family: 'Noto Serif SC', serif;
    background: linear-gradient(135deg, #faf8f3 0%, #f5ebe0 100%);
    color: var(--text-primary);
    line-height: 1.8;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
.header {
    text-align: center;
    padding: 60px 20px 40px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    border-radius: 24px;
    margin-bottom: 40px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    animation: fadeInDown 0.8s ease-out;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

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

.header-content {
    position: relative;
    z-index: 1;
}

/* 语言切换 */
.lang-switcher {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    z-index: 2;
}

.lang-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Noto Serif SC', serif;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

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

.title {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 3.5rem;
    color: white;
    margin-bottom: 10px;
    text-shadow: 2px 4px 8px rgba(0,0,0,0.2);
    letter-spacing: 4px;
}

.title-icon {
    display: inline-block;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.subtitle {
    font-size: 1.2rem;
    color: rgba(255,255,255,0.95);
    font-weight: 400;
    letter-spacing: 2px;
}

.stats-bar {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 30px;
    padding: 20px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    position: relative;
    z-index: 1;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.8);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 900;
    color: white;
    text-shadow: 1px 2px 4px rgba(0,0,0,0.2);
}

/* 主要内容区 */
.main-content {
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

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

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

/* 输入区域 */
.input-section {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 40px;
    box-shadow: var(--shadow-md);
    border: 2px solid var(--border-color);
}

.section-header {
    text-align: center;
    margin-bottom: 30px;
}

.section-header h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-weight: 900;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.input-area {
    max-width: 700px;
    margin: 0 auto;
}

.book-input-wrapper {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.book-input {
    flex: 1;
    padding: 16px 20px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-family: 'Noto Serif SC', serif;
    transition: all 0.3s ease;
    background: var(--bg-primary);
}

.book-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(212, 82, 79, 0.1);
    background: white;
}

.add-btn {
    padding: 16px 32px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Noto Serif SC', serif;
}

.add-btn:hover {
    background: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

/* 搜索建议 */
.search-suggestions {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 20px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    box-shadow: var(--shadow-sm);
}

.search-suggestions.show {
    display: block;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.suggestion-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

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

.suggestion-item:hover {
    background: var(--bg-primary);
    padding-left: 24px;
}

.suggestion-name {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.suggestion-rating {
    font-size: 0.85rem;
    color: var(--secondary-color);
}

/* 喜欢的书籍列表 */
.favorite-books {
    min-height: 120px;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--bg-primary);
    border-radius: 12px;
    border: 2px dashed var(--border-color);
}

.empty-state {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 10px;
    opacity: 0.5;
}

.book-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: 24px;
    margin: 6px;
    font-size: 0.95rem;
    animation: popIn 0.3s ease-out;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.book-tag-name {
    color: var(--text-primary);
    font-weight: 700;
}

.remove-book {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.remove-book:hover {
    background: var(--primary-color);
    color: white;
    transform: rotate(90deg);
}

/* 按钮 */
.action-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn {
    padding: 16px 40px;
    font-size: 1.1rem;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Noto Serif SC', serif;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

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

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

.btn-icon {
    font-size: 1.2rem;
}

/* 推荐结果区域 */
.results-section {
    animation: fadeInUp 0.6s ease-out;
}

.loading {
    text-align: center;
    padding: 60px 20px;
}

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

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

.loading p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* 推荐卡片 */
.recommendations {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.recommendation-card {
    background: white;
    border-radius: 16px;
    padding: 28px;
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
    animation: fadeInUp 0.5s ease-out both;
}

.recommendation-card:nth-child(1) { animation-delay: 0.1s; }
.recommendation-card:nth-child(2) { animation-delay: 0.2s; }
.recommendation-card:nth-child(3) { animation-delay: 0.3s; }
.recommendation-card:nth-child(4) { animation-delay: 0.4s; }
.recommendation-card:nth-child(5) { animation-delay: 0.5s; }
.recommendation-card:nth-child(6) { animation-delay: 0.6s; }

.recommendation-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.card-rank {
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary-color);
    line-height: 1;
}

.card-score {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--accent-color) 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 700;
}

.card-title {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.4;
}

.card-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
    color: var(--secondary-color);
    font-size: 0.95rem;
}

.card-reasons {
    background: var(--bg-primary);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.reasons-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.reason-item {
    padding: 8px 0;
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.6;
    border-left: 3px solid var(--primary-color);
    padding-left: 12px;
    margin-bottom: 8px;
}

.reason-item:last-child {
    margin-bottom: 0;
}

.card-link {
    display: inline-block;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.card-link:hover {
    color: var(--accent-color);
    transform: translateX(4px);
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    margin-top: 60px;
}

.footer p {
    margin: 8px 0;
}

.footer-note {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .title {
        font-size: 2.5rem;
    }
    
    .stats-bar {
        flex-wrap: wrap;
        gap: 20px;
    }
    
    .input-section {
        padding: 24px;
    }
    
    .book-input-wrapper {
        flex-direction: column;
    }
    
    .recommendations {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

/* 关键词选择 */
.keywords-section {
    margin-bottom: 30px;
    padding: 24px;
    background: white;
    border-radius: 16px;
    border: 2px solid var(--border-color);
    animation: fadeIn 0.3s ease-out;
}

.keywords-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.keywords-title small {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 8px;
}

.keywords-icon {
    font-size: 1.3rem;
}

.keywords-container {
    min-height: 100px;
}

.loading-keywords {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
}

.loading-spinner-small {
    width: 30px;
    height: 30px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 10px;
    animation: spin 1s linear infinite;
}

.keywords-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.keyword-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    user-select: none;
}

.keyword-chip:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.keyword-chip.selected {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.keyword-chip-text {
    font-weight: 600;
}

.keyword-chip-weight {
    font-size: 0.75rem;
    opacity: 0.7;
}

.keyword-chip.selected .keyword-chip-weight {
    opacity: 0.9;
}

.keywords-actions {
    margin-top: 16px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Noto Serif SC', serif;
    font-weight: 600;
}

.btn-select-all {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-select-all:hover {
    border-color: var(--primary-color);
}

.btn-clear-selection {
    background: white;
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
}

.btn-clear-selection:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* 推荐策略选择 */
.strategy-section {
    margin-bottom: 30px;
    padding: 24px;
    background: white;
    border-radius: 16px;
    border: 2px solid var(--border-color);
}

.strategy-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.strategy-icon {
    font-size: 1.4rem;
}

.strategy-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.strategy-option {
    cursor: pointer;
    display: block;
}

.strategy-option input[type="radio"] {
    display: none;
}

.option-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.strategy-option input[type="radio"]:checked + .option-content {
    background: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(212, 82, 79, 0.1);
}

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

.option-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
}

.option-text {
    flex: 1;
}

.option-text strong {
    display: block;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 4px;
}

.option-text small {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
}

/* 关系选择 */
.relations-section {
    padding-top: 20px;
    border-top: 2px dashed var(--border-color);
    animation: fadeIn 0.3s ease-out;
}

.relations-section.hidden {
    display: none;
}

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

.relations-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.relations-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.relation-checkbox {
    cursor: pointer;
    display: block;
}

.relation-checkbox input[type="checkbox"] {
    display: none;
}

.checkbox-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    font-weight: 600;
}

.relation-checkbox input[type="checkbox"]:checked + .checkbox-label {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.checkbox-label:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.checkbox-icon {
    font-size: 1.2rem;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* GitHub 链接样式 */
.github-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.github-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
    text-decoration: none;
    border-radius: 30px;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.github-link:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.github-icon {
    font-size: 1.3rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

.github-text {
    letter-spacing: 0.5px;
}

