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

body {
    font-family: Arial, sans-serif;
    background-color: #fff;
    color: #111;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

#quiz-section, #input-section {
    max-width: 800px;
    margin: 0 auto;
}

h1, h2 {
    text-align: center;
    margin-bottom: 20px;
}

.input-prompt {
    text-align: center;
    margin-bottom: 20px;
}

.instruction {
    font-size: 1.2em;
    font-weight: bold;
    margin: 20px 0;
}

.question {
    margin-bottom: 20px;
}

.question p {
    margin-bottom: 10px;
    font-weight: bold;
}

.question-number {
    display: inline;
    font-weight: bold;
    padding-right: 10px;
}

.option-a {
    padding-left: 0;
}

.option-b {
    padding-left: 25px;
}

.question label {
    display: block;
    margin: 5px 0;
}

#code-form {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
    margin-bottom: 30px;
}

.code-input {
    width: 100px;
    padding: 8px;
    font-size: 16px;
    text-align: center;
    text-transform: uppercase;
    border: 1px solid #ccc;
    border-radius: 4px;
}

button {
    padding: 10px 20px;
    background-color: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

button:hover {
    background-color: #555;
}

.error {
    color: red;
    text-align: center;
    margin-top: 10px;
}

.hidden {
    display: none;
}

#loading.hidden {
    display: none !important;
}

#loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.loader {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #333;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#books-table {
    width: 100%;
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #f9f9f9;
}

img {
    max-width: 50px;
    height: auto;
    display: block;
}

td[data-label="Cover"] a {
    display: block;
    text-decoration: none;
}

td[data-label="Cover"] img {
    transition: opacity 0.2s ease;
}

td[data-label="Cover"] img:hover {
    opacity: 0.8;
    cursor: pointer;
}

#pagination {
    text-align: center;
    margin-bottom: 20px;
}

#pagination button {
    margin: 0 5px;
}

#pagination button.active {
    background-color: #333;
    color: #fff;
}

.question.error {
    border-left: 3px solid red;
    padding-left: 10px;
}

.code {
    font-size: 1.5em;
    font-weight: bold;
    display: inline-block;
    margin: 0 5px;
}

@media (max-width: 600px) {
    #code-form {
        flex-direction: column;
        align-items: center;
        margin-bottom: 10px;
    }

    .code-input {
        width: 150px;
    }

    .instruction {
        font-size: 1.4em;
    }

    .question {
        margin-bottom: 30px;
    }

    .question-number {
        font-size: 1.2em;
        padding-right: 15px;
    }

    .option-a, .option-b {
        font-size: 1.2em;
    }

    .option-b {
        padding-left: 30px;
    }

    .radio-group {
        background: #f9f9f9;
        border-radius: 8px;
        padding: 10px;
        margin-top: 10px;
    }

    .question label {
        font-size: 1.2em;
        margin: 10px 0;
        display: flex;
        align-items: center;
    }

    .question input[type="radio"] {
        width: 20px;
        height: 20px;
        margin-right: 10px;
    }

    table, thead, tbody, th, td, tr {
        display: block;
    }

    thead {
        display: none;
    }

    .card {
        border-top: 1px solid #d9d9d9;
        border-bottom: 1px solid #d9d9d9;
        padding: 14px 16px;
        background: #fff;
        color: #111;
        line-height: 1.4;
    }

    .rank-score-row {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 12px;
        margin-bottom: 10px;
        font-size: 18px;
    }

    .rank-score-row .rank,
    .rank-score-row .score {
        white-space: nowrap;
        color: #222;
    }

    .rank-score-row .rank b,
    .rank-score-row .score b {
        font-weight: 700;
    }

    .content-row {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 14px;
    }

    .text-col {
        flex: 1 1 auto;
        min-width: 0;
    }

    .title-author-block {
        margin: 0;
    }

    .title-author-block .title {
        display: block;
        font-weight: 800;
        font-size: 22px;
        letter-spacing: 0.2px;
        margin: 0 0 2px 0;
    }

    .title-author-block .author {
        display: block;
        font-weight: 700;
        font-size: 20px;
        margin: 0 0 0.5em 0;
    }

    .description {
        margin: 0;
        font-size: 18px;
        color: #222;
    }

    .cover-col {
        flex: 0 0 auto;
    }

    .cover-col .book-cover {
        display: block;
        width: 120px;
        max-width: 40vw;
        height: auto;
        border: 0;
        object-fit: cover;
        object-position: center;
        margin-top: 0;
    }

    #pagination {
        display: flex;
        flex-direction: row;
        justify-content: center;
        gap: 10px;
    }

    #pagination button {
        width: 40px;
        height: 40px;
        font-size: 18px;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .container, #quiz-section, #input-section {
        padding: 10px;
        max-width: 100%;
    }

    .input-prompt {
        text-align: left;
    }
}

@media (max-width: 380px) {
    .cover-col .book-cover {
        width: 100px;
    }
    .title-author-block .title {
        font-size: 20px;
    }
    .title-author-block .author {
        font-size: 18px;
    }
    .rank-score-row {
        font-size: 16px;
    }
    .description {
        font-size: 16px;
    }
}
/* Shared curated-list presentation */
body { font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #172c46; background: #fbfcfe; line-height: 1.5; }
.container { max-width: 1000px; }
header { max-width: 800px; margin: 20px auto 36px; }
h1 { font-size: clamp(1.65rem, 4vw, 2.3rem); line-height: 1.2; }
#list-intro { font-size: 1.1rem; }
a { color: #235b97; text-underline-offset: 3px; }
button { background: #235b97; font: inherit; }
button:hover, #pagination button.active { background: #172c46; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #609ce0; outline-offset: 3px; }
.question { border-bottom: 1px solid #dce5ef; padding-bottom: 20px; }
input[type=radio] { accent-color: #235b97; }
.book-card { display: flex; gap: 24px; justify-content: space-between; padding: 26px 0; border-bottom: 1px solid #dce5ef; }
.book-copy { min-width: 0; }
.book-card h3 { font-weight: 750; font-size: 1.35rem; margin: 8px 0 2px; }
.book-author { color: #526278; margin-bottom: 12px; }
.book-links { margin-top: 12px; }
.rank-score-row { color: #235b97; font-size: .95rem; }
.book-cover { width: 100px; max-width: 25vw; height: auto; align-self: flex-start; }
#pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 24px 0; }
#pagination button { margin: 0; }
.error { color: #a12632; }
.hidden { display: none !important; }
@media(max-width:600px) { .book-card { gap: 16px; } .book-card h3 { font-size: 1.2rem; } .book-cover { width: 80px; } }
@media(prefers-reduced-motion:reduce) { .loader { animation: none; } }

/* Isolated Novels to Movies experiment. The original shared stylesheet is untouched. */
body { background: #fff; color: #242424; }
.container { max-width: 1120px; padding: 32px 28px 40px; }
header { margin: 12px auto 44px; text-align: center; }
h1 { color: #242424; font-size: clamp(1.65rem, 4vw, 2.5rem); font-weight: 600; letter-spacing: -.04em; }
#list-intro { color: #626262; font-size: 1rem; line-height: 1.65; }
a { color: inherit; }
button { background: #303030; }
button:hover { background: #555; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #537a9a; outline-offset: 5px; }
.question { border-color: #e5e5e5; }
input[type=radio] { accent-color: #333; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.showing-results header { margin-bottom: 12px; }
.showing-results #list-intro { display: none; }
.shelf-instruction { margin: 0 0 32px; text-align: center; color: #626262; font-size: .95rem; }
.cover-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 18px; align-items: start; }
.cover-tile { position: relative; min-width: 0; }
.cover-trigger { display: flex; width: 100%; aspect-ratio: 2 / 3; padding: 0; border: 0; border-radius: 0; background: transparent; align-items: end; justify-content: center; cursor: pointer; text-decoration: none; transition: opacity .15s ease; }
.cover-trigger:hover { background: transparent; opacity: .85; }
.shelf-cover { display: block; width: 100%; max-width: 100%; height: 100%; object-fit: contain; object-position: center bottom; }
.cover-trigger.cover-missing { background: #f2f0eb; border: 1px solid #dedbd4; align-items: center; }
.missing-mark { font-size: 2.5rem; font-weight: 300; color: #aaa497; }
.cover-options { position: absolute; z-index: 5; left: 8px; right: 8px; bottom: 12px; padding: 6px; background: #fff; border: 1px solid #d8d8d8; border-radius: 7px; box-shadow: 0 4px 24px #0003; }
.cover-options[hidden], .shelf-cover[hidden] { display: none; }
.cover-options a { display: block; padding: 11px 8px; text-align: center; text-decoration: none; font-size: .95rem; border-radius: 3px; }
.cover-options a + a { border-top: 1px solid #eee; }
.cover-options a:hover, .cover-options a:focus-visible { background: #f1f1ee; }
.shelf-footer { margin-top: 48px; padding-top: 24px; border-top: 1px solid #e8e8e8; text-align: center; font-size: .85rem; color: #666; }
.shelf-footer p { margin-top: 14px; }
.shelf-footer .code { font-size: inherit; margin: 0; }
.version-switch { display: flex; justify-content: center; gap: 20px; }
.version-switch a { padding: 5px 0; text-decoration: none; }
.version-switch a[aria-current=page] { color: #222; border-bottom: 1px solid currentColor; }
.affiliate { font-size: .75rem; }
.noscript { text-align: center; padding: 24px; }
@media(min-width: 540px) { .cover-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 30px 22px; } }
@media(min-width: 760px) { .cover-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px 24px; } }
@media(min-width: 1000px) { .cover-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 36px 26px; } }
@media(max-width: 600px) { .container { padding: 22px 18px 32px; } header { margin-top: 8px; } .showing-results header { margin-bottom: 12px; } .shelf-instruction { margin-bottom: 24px; font-size: .85rem; } }
@media(prefers-reduced-motion:reduce) { html { scroll-behavior: auto; } .cover-trigger { transition: none; } }
