* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Serif SC', serif;
    background: linear-gradient(135deg, #fdf5e6 0%, #f0e6d2 100%);
    min-height: 100vh;
}

header {
    background: linear-gradient(135deg, #8b4513 0%, #a0522d 50%, #cd853f 100%);
    color: #fff;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(139, 69, 19, 0.3);
}

.header-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 400;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.search-section {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
    padding: 2rem 2.5rem;
    background: linear-gradient(145deg, #faf5ed 0%, #f5efe6 30%, #ede5d8 70%, #f0e9dd 100%);
    border-radius: 20px;
    box-shadow: 
        0 10px 40px rgba(101, 67, 33, 0.12),
        0 1px 3px rgba(101, 67, 33, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(139, 90, 43, 0.15);
    position: relative;
}

.search-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(139, 90, 43, 0.3) 50%, transparent 100%);
}

.search-box-wrapper {
    display: flex;
    gap: 0;
    flex: 1;
    min-width: 280px;
    max-width: 520px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 35px;
    box-shadow: 
        0 4px 15px rgba(139, 90, 43, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border: 2px solid rgba(139, 90, 43, 0.1);
    overflow: hidden;
}

.search-input {
    flex: 1;
    padding: 1.1rem 1.5rem;
    border: none;
    font-size: 1rem;
    font-family: 'Noto Serif SC', serif;
    outline: none;
    background: transparent;
    transition: all 0.3s ease;
}

.search-input:focus {
    background: rgba(255, 255, 255, 0.9);
}

.search-input::placeholder {
    color: #b5a08a;
    font-style: italic;
}

.search-btn {
    padding: 1.1rem 2rem;
    background: linear-gradient(135deg, #654321 0%, #8b5a2b 50%, #654321 100%);
    color: #fff;
    border: none;
    border-radius: 0 35px 35px 0;
    font-size: 1rem;
    font-family: 'Noto Serif SC', serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 2px 8px rgba(101, 67, 33, 0.3);
    position: relative;
}

.search-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 1px;
    height: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%);
}

.search-btn:hover {
    background: linear-gradient(135deg, #8b5a2b 0%, #a06b3d 50%, #8b5a2b 100%);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 4px 15px rgba(101, 67, 33, 0.4);
    transform: translateY(-1px);
}

.search-btn:active {
    transform: translateY(0);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    margin-top: 0.5rem;
    padding-top: 1.5rem;
    border-top: 1px dashed rgba(139, 90, 43, 0.15);
    width: 100%;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.8) 0%, rgba(255, 253, 248, 0.6) 100%);
    border-radius: 12px;
    box-shadow: 
        0 2px 10px rgba(139, 90, 43, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(139, 90, 43, 0.1);
    transition: all 0.3s ease;
}

.filter-group:hover {
    box-shadow: 
        0 4px 15px rgba(139, 90, 43, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
}

.filter-label {
    font-size: 0.85rem;
    color: #fff;
    font-weight: 500;
    padding: 0.4rem 0.8rem;
    background: linear-gradient(135deg, #c9a06b 0%, #b8864e 50%, #a67c44 100%);
    border-radius: 8px;
    box-shadow: 
        0 2px 6px rgba(139, 90, 43, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.5px;
}

.custom-select {
    position: relative;
    display: inline-block;
    min-width: 100px;
    font-family: 'Noto Serif SC', serif;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    background: linear-gradient(145deg, #fffdf9 0%, #fefbf5 50%, #faf6ed 100%);
    border: 2px solid #d4c4a8;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        inset 0 1px 3px rgba(139, 90, 43, 0.06),
        0 2px 4px rgba(139, 90, 43, 0.05);
}

.custom-select-trigger:hover {
    border-color: #c9b59a;
    box-shadow: 
        inset 0 1px 3px rgba(139, 90, 43, 0.08),
        0 4px 12px rgba(139, 90, 43, 0.1);
    background: linear-gradient(145deg, #fff 0%, #fffdf9 100%);
    transform: translateY(-1px);
}

.custom-select.open .custom-select-trigger {
    border-color: #c9a06b;
    box-shadow: 
        inset 0 1px 3px rgba(139, 90, 43, 0.08),
        0 0 0 4px rgba(201, 160, 107, 0.12),
        0 4px 14px rgba(139, 90, 43, 0.15);
    border-radius: 10px 10px 0 0;
}

.custom-select-value {
    font-size: 0.85rem;
    color: #5c4033;
    flex: 1;
    text-align: left;
}

.custom-select-arrow {
    font-size: 0.6rem;
    color: #a67c44;
    margin-left: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

.custom-select.open .custom-select-arrow {
    color: #c9a06b;
    transform: rotate(180deg);
}

.custom-select-options {
    position: absolute;
    top: calc(100% + 2px);
    left: -2px;
    right: -2px;
    background: linear-gradient(145deg, #fffdf9 0%, #faf6ed 100%);
    border: 2px solid #d4c4a8;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 6px 20px rgba(139, 90, 43, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 6px;
    box-sizing: border-box;
}

.custom-select-options::-webkit-scrollbar {
    width: 5px;
}

.custom-select-options::-webkit-scrollbar-track {
    background: rgba(139, 90, 43, 0.05);
    border-radius: 3px;
}

.custom-select-options::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #d4c4a8 0%, #c9b59a 100%);
    border-radius: 3px;
}

.custom-select-options::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #c9b59a 0%, #b8a58a 100%);
}

.custom-select.open .custom-select-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-select-option {
    padding: 0.55rem 0.9rem;
    font-size: 0.82rem;
    color: #5c4033;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(139, 90, 43, 0.04);
}

.custom-select-option:last-child {
    border-bottom: none;
    border-radius: 0 0 8px 8px;
}

.custom-select-option:hover {
    background: linear-gradient(145deg, #f2ebe0 0%, #e8dfcf 100%);
    padding-left: 1.2rem;
    color: #6b4423;
}

.custom-select-option.selected {
    background: linear-gradient(135deg, #d4a574 0%, #c99a6b 50%, #b8864e 100%);
    color: #fff;
    font-weight: 500;
}

.poem-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.poem-card {
    background: #fff;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 4px solid #8b4513;
    overflow: hidden;
}

.poem-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.poem-image-container {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: linear-gradient(135deg, #f5deb3 0%, #e8d5b7 100%);
}

.poem-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.poem-card:hover .poem-image {
    transform: scale(1.05);
}

.poem-card .card-content {
    padding: 1.5rem;
}

.poem-card .title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.poem-card .author {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 1rem;
}

.poem-card .content {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.8;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.poem-card .tags {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.poem-card .category {
    padding: 0.3rem 0.8rem;
    background: #f5deb3;
    color: #8b4513;
    border-radius: 15px;
    font-size: 0.8rem;
}

.poem-card .theme {
    padding: 0.3rem 0.8rem;
    background: #e8f5e9;
    color: #2e7d32;
    border-radius: 15px;
    font-size: 0.8rem;
}

.no-results {
    text-align: center;
    color: #888;
    font-size: 1.2rem;
    padding: 2rem;
}

.poem-detail {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.detail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
}

.detail-content {
    position: relative;
    background: linear-gradient(135deg, #fffbf7 0%, #fdf5e6 100%);
    border-radius: 16px;
    padding: 2.5rem;
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(139, 69, 19, 0.1);
    border-radius: 50%;
    font-size: 1.5rem;
    color: #8b4513;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(139, 69, 19, 0.2);
    transform: rotate(90deg);
}

.poem-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c1810;
    text-align: center;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #d4a574;
}

.poem-author {
    font-size: 1.1rem;
    color: #666;
    text-align: center;
    margin-bottom: 0.3rem;
}

.poem-dynasty {
    font-size: 0.9rem;
    color: #999;
    text-align: center;
    margin-bottom: 1rem;
}

.detail-image-container {
    margin-bottom: 1.5rem;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.detail-image {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
}

.poem-body {
    font-size: 1.15rem;
    line-height: 2;
    color: #333;
    text-align: center;
    white-space: pre-line;
    margin-bottom: 2rem;
    padding: 1rem;
    background: rgba(139, 69, 19, 0.05);
    border-radius: 8px;
}

.poem-appreciation {
    border-top: 1px solid #d4a574;
    padding-top: 1.5rem;
}

.poem-appreciation h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #8b4513;
    margin-bottom: 1rem;
}

.poem-appreciation p {
    font-size: 1rem;
    line-height: 1.9;
    color: #555;
    text-align: justify;
}

footer {
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, #2c1810 0%, #3d2317 100%);
    color: #d4a574;
    margin-top: 3rem;
}

footer p {
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    header {
        padding: 2rem 1rem;
    }

    .header-content h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    main {
        padding: 1rem;
    }

    .search-section {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input {
        max-width: 100%;
    }

    .category-filter {
        justify-content: center;
    }

    .poem-grid {
        grid-template-columns: 1fr;
    }

    .detail-content {
        padding: 1.5rem;
    }

    .poem-title {
        font-size: 1.4rem;
    }
}