/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "KaiTi", "楷体", "STKaiti", "Microsoft YaHei", serif;
    background: linear-gradient(135deg, #f5f5dc 0%, #e8dcc8 50%, #d4c5b0 100%);
    min-height: 100vh;
    color: #3d2914;
    position: relative;
    overflow-x: hidden;
}

/* 背景纹理 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    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='%238b7355' fill-opacity='0.05'%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");
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.main-title {
    font-size: 42px;
    color: #8b0000;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
    letter-spacing: 8px;
}

.title-icon {
    font-size: 36px;
    margin: 0 10px;
}

.subtitle {
    font-size: 16px;
    color: #6b4423;
    letter-spacing: 4px;
}

/* 控制区 */
.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: 2px solid #8b4513;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #fff8dc 0%, #f5deb3 100%);
    color: #8b4513;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, #8b0000 0%, #a52a2a 100%);
    color: white;
    border-color: #8b0000;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #a52a2a 0%, #cd5c5c 100%);
}

.btn-secondary {
    background: linear-gradient(135deg, #2f4f4f 0%, #556b2f 100%);
    color: white;
    border-color: #2f4f4f;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #556b2f 0%, #6b8e23 100%);
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-outline {
    background: transparent;
    color: #8b4513;
}

.btn-icon {
    margin-right: 5px;
}

.filter-select {
    padding: 12px;
    border: 2px solid #8b4513;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    background: white;
    color: #8b4513;
    cursor: pointer;
}

/* 筛选面板 */
.filter-panel {
    background: rgba(255, 255, 255, 0.5);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.filter-input {
    padding: 10px 15px;
    border: 2px solid #8b4513;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    flex: 1;
    max-width: 300px;
}

/* 卡片容器 */
.card-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
}

/* 宋词卡片 - 古风设计 */
.songci-card {
    background: linear-gradient(135deg, #fffef8 0%, #faf5e8 100%);
    border: 3px solid #8b4513;
    border-radius: 15px;
    padding: 40px;
    max-width: 700px;
    width: 100%;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.2),
        inset 0 0 100px rgba(139, 69, 19, 0.05);
    position: relative;
    animation: fadeIn 0.6s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 卡片装饰边框 */
.songci-card::before,
.songci-card::after {
    content: '❖';
    position: absolute;
    font-size: 24px;
    color: #8b4513;
    opacity: 0.3;
}

.songci-card::before {
    top: 15px;
    left: 15px;
}

.songci-card::after {
    bottom: 15px;
    right: 15px;
}

.card-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #d4c5b0;
}

.cipai-name {
    font-size: 36px;
    color: #8b0000;
    font-weight: bold;
    margin-bottom: 15px;
    letter-spacing: 6px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.author-info {
    font-size: 18px;
    color: #6b4423;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.dynasty {
    background: #8b0000;
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 14px;
}

.author-name {
    font-weight: bold;
    font-size: 20px;
}

.card-body {
    margin-bottom: 20px;
}

.song-title {
    font-size: 24px;
    color: #2f4f4f;
    text-align: center;
    margin-bottom: 25px;
    font-weight: normal;
    letter-spacing: 3px;
}

.song-content {
    line-height: 2.2;
    font-size: 20px;
    color: #3d2914;
}

.content-line {
    text-align: center;
    margin: 12px 0;
    padding: 5px 0;
    transition: all 0.3s ease;
}

.content-line:hover {
    background: rgba(139, 69, 19, 0.05);
    border-radius: 5px;
}

.card-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 2px solid #d4c5b0;
}

.decorative-line {
    font-size: 18px;
    color: #8b4513;
    letter-spacing: 10px;
    opacity: 0.6;
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 40px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #d4c5b0;
    border-top: 4px solid #8b0000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    font-size: 18px;
    color: #6b4423;
}

/* 信息栏 */
.info-bar {
    text-align: center;
    padding: 15px;
    font-size: 16px;
    color: #6b4423;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    margin-bottom: 20px;
}

.info-bar span {
    margin: 0 10px;
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 20px;
    color: #6b4423;
    font-size: 14px;
}

.footer p {
    margin: 5px 0;
}

.api-info a {
    color: #8b0000;
    text-decoration: none;
}

.api-info a:hover {
    text-decoration: underline;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-title {
        font-size: 32px;
        letter-spacing: 4px;
    }
    
    .songci-card {
        padding: 25px;
    }
    
    .cipai-name {
        font-size: 28px;
    }
    
    .song-content {
        font-size: 18px;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

/* 打印样式 */
@media print {
    body {
        background: white;
    }
    
    .controls,
    .filter-panel,
    .footer {
        display: none;
    }
    
    .songci-card {
        box-shadow: none;
        border: 2px solid #000;
    }
}
