:root {
    --primary-color: #ff007f;
    --bg-color: #0a0a0a;
    --text-color: #ffffff;
    --text-secondary: #888888;
    --border-color: #333333;

    --font-sans: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-mono: 'Courier New', Courier, monospace;
}

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

::selection {
    background: rgba(255, 105, 180, 0.3);
    /* Soft pink, slightly transparent */
    color: inherit;
}

.highlight {
    background-color: rgba(255, 105, 180, 0.5);
    /* Slightly stronger for search matches */
    border-radius: 2px;
    color: inherit;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.4;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Grid Layout Wrapper */
#app {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
}

/* Header */
header {
    padding: 4rem 2rem 2rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

header h1 {
    font-size: 4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    line-height: 0.9;
}

header p {
    font-family: var(--font-mono);
    color: var(--primary-color);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.header-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 1rem;
}

#search-input {
    flex-grow: 1;
    max-width: 400px;
    padding: 1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-family: var(--font-mono);
    font-size: 1rem;
    text-transform: uppercase;
    outline: none;
    transition: border-color 0.2s ease;
}

#search-input:focus {
    border-color: var(--primary-color);
}

/* #language-filter {
    padding: 1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-family: var(--font-mono);
    font-size: 1rem;
    text-transform: uppercase;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

#language-filter:focus,
#language-filter:hover {
    border-color: var(--primary-color);
}

#language-filter option {
    background-color: var(--bg-color);
    color: var(--text-color);
} */

#view-toggle {
    padding: 1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-family: var(--font-mono);
    font-size: 1rem;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
}

#view-toggle:hover {
    background: var(--primary-color);
    color: #000;
}

/* Main Content */
main {
    width: 100%;
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    width: 100%;
}

/* Book Card - "Archive Entry" Style */
.book-card {
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    transition: background-color 0.2s ease;
    position: relative;
}

.book-card:hover {
    background-color: #111;
}

.book-card:hover .book-cover {
    filter: grayscale(0%);
}

.book-meta {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.book-cover {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    margin-bottom: 1.5rem;
    filter: grayscale(100%);
    transition: filter 0.3s ease;
    border: 1px solid var(--border-color);
}

.book-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.book-content h2 {
    font-size: 1.5rem;
    font-weight: 400;
    margin: 0 0 0.5rem 0;
    line-height: 1.2;
}

.book-credits {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.book-author {
    font-family: var(--font-mono);
    color: var(--primary-color);
    font-size: 0.9rem;
    text-transform: uppercase;
}

.book-translator {
    font-family: var(--font-mono);
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.translator-link {
    color: inherit;
    text-decoration: none;
}

.translator-link:hover {
    text-decoration: underline;
}

.book-description {
    font-size: 1rem;
    color: #ccc;
    margin-bottom: 2rem;
    flex-grow: 1;
}

/* Download Buttons */
.download-options {
    display: flex;
    gap: 1px;
    background: var(--border-color);
    border: 1px solid var(--border-color);
    margin-top: auto;
    /* Push to bottom in grid view */
}

.btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem;
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--bg-color);
    color: var(--text-color);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn:hover {
    background: var(--primary-color);
    color: #000;
}

/* Footer */
footer {
    padding: 2rem;
    border-top: 1px solid var(--border-color);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    display: flex;
    display: flex;
    justify-content: space-between;
}

footer a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

footer a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* LIST VIEW STYLES */
.view-list {
    display: flex;
    flex-direction: column;
}

.view-list .book-card {
    flex-direction: row;
    align-items: center;
    padding: 1.5rem 2rem;
    gap: 2rem;
    border-right: none;
}

.view-list .book-meta {
    display: none;
}

.book-inline-meta {
    display: none;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.view-list .book-inline-meta {
    display: inline;
}

.view-list .book-cover {
    display: block;
    width: 80px;
    height: 120px;
    margin-bottom: 0;
    flex-shrink: 0;
    object-fit: cover;
}

.view-list .book-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0;
}

.view-list .book-content h2 {
    font-size: 1.5rem;
    margin: 0;
}

.view-list .book-credits {
    margin: 0;
    display: flex;
    flex-direction: row;
    gap: 1rem;
    align-items: baseline;
}

.view-list .book-description {
    margin: 0;
    font-size: 0.9rem;
    white-space: normal;
    color: var(--text-secondary);
    max-width: 800px;
}

.view-list .download-options {
    margin-top: 0;
    margin-left: auto;
    /* Push to far right */
    min-width: 200px;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .view-list .book-content {
        grid-template-columns: 1fr 1fr;
        /* Title | Credits */
    }

    .view-list .book-description {
        display: block;
        font-size: 0.8rem;
        margin-top: 0.5rem;
        /* Hide desc on smaller screens */
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2.5rem;
    }

    .header-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .book-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1px;
        /* Use gap for borders if needed, or just rely on container */
    }

    .book-card {
        border-right: none;
        padding: 0.5rem;
        /* Reduced padding for mobile grid */
    }

    .book-content h2 {
        font-size: 0.9rem;
        /* Smaller title for mobile grid */
    }

    .book-meta {
        font-size: 0.7rem;
    }

    /* List view on mobile behaves like grid or simplified list */
    .view-list .book-card {
        display: grid;
        grid-template-columns: 80px 1fr;
        grid-template-areas:
            "cover content"
            "downloads downloads";
        gap: 1rem;
        padding: 1rem;
        align-items: start;
    }

    .view-list .book-cover {
        grid-area: cover;
        width: 100%;
        height: auto;
        aspect-ratio: 2/3;
    }

    .view-list .book-content {
        grid-area: content;
        display: flex;
        flex-direction: column;
        gap: 0.2rem;
    }

    .view-list .book-content h2 {
        font-size: 1.1rem;
        line-height: 1.2;
    }

    .view-list .book-credits {
        flex-direction: column;
        gap: 0;
        font-size: 0.8rem;
    }

    .view-list .download-options {
        grid-area: downloads;
        margin-left: 0;
        width: 100%;
        margin-top: 0.5rem;
    }
}