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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f8f9fa;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

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

header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 1.5rem;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
}

.search-box {
    flex: 1;
    min-width: 250px;
    max-width: 400px;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: #4a6fa5;
}

.view-toggles {
    display: flex;
    gap: 0.5rem;
}

.view-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.view-btn:hover {
    border-color: #4a6fa5;
}

.view-btn.active {
    background: #4a6fa5;
    border-color: #4a6fa5;
    color: white;
}

.reverse-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.reverse-btn:hover {
    border-color: #4a6fa5;
}

.book-count {
    color: #666;
    font-size: 0.875rem;
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.book-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.book-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.book-card .title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 0.5rem;
}

.book-card .author {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.book-card .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 1rem;
}

.book-card .tag {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #e8f4f8;
    color: #2c5f8d;
    font-size: 0.75rem;
    border-radius: 4px;
    font-weight: 500;
}

.book-card .link {
    display: inline-block;
    color: #4a6fa5;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
}

.book-card .link:hover {
    text-decoration: underline;
}

.books-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.books-list .book-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
}

.books-list .book-info {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
}

.books-list .title {
    margin-bottom: 0;
}

.books-list .author {
    margin-bottom: 0;
}

.books-list .tags {
    margin-bottom: 0;
}

.books-compact {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.books-compact .book-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
}

.books-compact .title {
    font-size: 1rem;
    margin-bottom: 0;
}

.books-compact .author {
    font-size: 0.85rem;
    margin-bottom: 0;
    white-space: nowrap;
}

.books-compact .tags {
    margin-bottom: 0;
}

.books-compact .link {
    margin-left: auto;
    white-space: nowrap;
}

.hidden {
    display: none !important;
}

.no-results {
    text-align: center;
    padding: 3rem;
    color: #666;
}

@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    .controls {
        flex-direction: column;
    }

    .search-box {
        width: 100%;
        max-width: none;
    }

    .books-list .book-card,
    .books-compact .book-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .books-list .book-info {
        flex-direction: column;
        gap: 0.25rem;
    }

    .books-compact .link {
        margin-left: 0;
    }
}
