:root {
    color-scheme: dark;
    font-family: ui-rounded, "Segoe UI", sans-serif;
    font-synthesis: none;
    --ink: rgb(255, 249, 233);
    --ink-soft: rgb(226, 224, 232);
    --night: rgb(5, 12, 35);
    --night-deep: rgb(2, 6, 22);
    --night-glass: rgba(9, 18, 51, 0.78);
    --line: rgba(255, 255, 255, 0.18);
    --gold: rgb(255, 211, 107);
    --gold-bright: rgb(255, 232, 161);
    --coral: rgb(255, 133, 116);
    --lavender: rgb(193, 176, 255);
    --mint: rgb(158, 231, 210);
    --wood: rgb(99, 53, 50);
    background: var(--night);
    color: var(--ink);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    min-height: 100%;
    background: var(--night-deep);
    scroll-behavior: smooth;
}

body {
    min-width: 320px;
    min-height: 100%;
    margin: 0;
    background:
        radial-gradient(circle at 12% 0%, rgba(87, 68, 171, 0.34), transparent 32rem),
        radial-gradient(circle at 86% 18%, rgba(34, 114, 145, 0.28), transparent 34rem),
        linear-gradient(155deg, rgb(5, 12, 35), rgb(3, 8, 26) 68%);
    color: var(--ink);
}

body.is-reading {
    overflow: hidden;
}

body.is-moving-copy {
    cursor: grabbing;
    user-select: none;
}

button {
    color: inherit;
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
select:focus-visible {
    outline: 3px solid var(--gold-bright);
    outline-offset: 4px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

[hidden] {
    display: none !important;
}

.library-view {
    position: relative;
    min-height: 100dvh;
    overflow: hidden;
    background:
        radial-gradient(circle at 7% 16%, rgba(255, 210, 102, 0.11), transparent 15rem),
        radial-gradient(circle at 88% 12%, rgba(183, 160, 255, 0.16), transparent 22rem),
        linear-gradient(145deg, rgba(8, 19, 54, 0.22), rgba(2, 6, 22, 0.86));
}

.library-stars,
.library-stars::before,
.library-stars::after {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.library-stars {
    opacity: 0.78;
    background-image:
        radial-gradient(circle, rgba(255, 255, 255, 0.9) 0 1px, transparent 1.5px),
        radial-gradient(circle, rgba(255, 221, 144, 0.75) 0 1px, transparent 1.6px);
    background-position: 0 0, 37px 52px;
    background-size: 96px 96px, 137px 137px;
    mask-image: linear-gradient(to bottom, black, rgba(0, 0, 0, 0.35) 72%, transparent);
}

.library-stars::before {
    content: "";
    background:
        radial-gradient(circle at 15% 27%, rgba(255, 255, 255, 0.9) 0 2px, transparent 3px),
        radial-gradient(circle at 76% 14%, rgba(255, 219, 129, 0.85) 0 2px, transparent 3px),
        radial-gradient(circle at 91% 54%, rgba(192, 224, 255, 0.8) 0 2px, transparent 3px),
        radial-gradient(circle at 44% 9%, rgba(255, 255, 255, 0.7) 0 1.5px, transparent 2.5px);
}

.library-stars::after {
    content: "";
    inset: auto -8vw -22vw;
    aspect-ratio: 2 / 1;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(108, 73, 166, 0.28), transparent 64%);
    filter: blur(18px);
}

.library-shell {
    position: relative;
    z-index: 1;
    width: min(1500px, 100%);
    min-height: 100dvh;
    margin: 0 auto;
    padding: clamp(2rem, 4vw, 4.5rem) clamp(1.1rem, 4.7vw, 5rem) 2rem;
}

.library-masthead {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 390px);
    align-items: center;
    gap: clamp(2rem, 5vw, 6rem);
    margin: 0 auto clamp(2.7rem, 5vw, 5.6rem);
}

.meet-characters-link {
    display: inline-flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
    padding: 0.85rem 1.25rem;
    border: 1px solid var(--gold);
    border-radius: 999px;
    color: var(--gold-bright);
    font-weight: 750;
    text-decoration: none;
    background: var(--night-glass);
}

body.is-characters {
    overflow: hidden;
}

.character-view {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100dvh;
    overflow: hidden;
    background: var(--background);
    color: var(--text-color);
}

.character-view a {
    color: inherit;
}

.character-view :is(a, input, select, button, summary):focus-visible {
    outline: 3px solid var(--focus-color);
    outline-offset: 4px;
}

.character-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.15rem clamp(1rem, 4vw, 4rem);
    border-bottom: 1px solid var(--border-color);
    background: var(--modal-background);
}

.character-bar a {
    text-decoration: none;
    font-weight: 750;
}

.character-brand span {
    margin-left: 0.8rem;
    color: var(--focus-color);
}

.character-scroll {
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-color: var(--focus-color) var(--background);
}

.character-directory,
.character-profile {
    width: min(1320px, 100%);
    margin: 0 auto;
    padding: clamp(1.4rem, 4vw, 4rem);
}

.character-hero {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    align-items: center;
    gap: clamp(1.5rem, 4vw, 4rem);
    margin-bottom: 3rem;
}

.character-eyebrow {
    margin: 0 0 0.9rem;
    color: var(--muted-text-color);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    line-height: 1.6;
    text-transform: uppercase;
}

.character-hero h1,
.character-profile h1 {
    margin: 0 0 1.4rem;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.7rem, 4.7vw, 4.9rem);
    font-weight: 500;
    letter-spacing: -0.055em;
    line-height: 1.05;
    text-wrap: balance;
}

.character-hero h1 em {
    color: var(--focus-color);
    font-weight: 400;
}

.character-hero-copy > p:not(.character-eyebrow),
.character-profile-dek {
    max-width: 48ch;
    font-size: 1.12rem;
    line-height: 1.7;
}

.character-text-link {
    display: inline-block;
    margin: 0.65rem 0;
    font-weight: 750;
    text-underline-offset: 0.25rem;
}

.character-hero-art {
    margin: 0;
    transform: rotate(2deg);
}

.character-hero-art img {
    display: block;
    width: 100%;
    aspect-ratio: 1.08;
    object-fit: cover;
    object-position: 22% center;
    border-radius: 44% 44% 1.5rem 1.5rem;
    box-shadow: 0 20px 50px var(--shadow-color);
}

.character-view figcaption {
    margin-top: 0.85rem;
    color: var(--muted-text-color);
    font-size: 0.78rem;
    line-height: 1.5;
}

.character-filters {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto;
    align-items: end;
    gap: 1rem;
    padding: 1.3rem;
    border: 1px solid var(--border-color);
    border-radius: 1.1rem;
    background: var(--modal-background);
}

.character-filters label {
    display: grid;
    gap: 0.5rem;
    min-width: 0;
    font-size: 0.82rem;
    font-weight: 750;
}

.character-filters :is(input, select, button),
.character-retry {
    width: 100%;
    min-height: 46px;
    padding: 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--background);
    color: var(--text-color);
    font: inherit;
}

.character-filters button,
.character-retry {
    width: auto;
    cursor: pointer;
}

.character-count {
    margin: 1.6rem 0 1rem;
    color: var(--muted-text-color);
    font-size: 0.88rem;
}

.character-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.3rem;
}

.character-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    background: var(--modal-background);
    text-decoration: none;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.character-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 32px var(--shadow-color);
}

.character-card-image {
    display: block;
    width: 100%;
    aspect-ratio: 1.5;
    object-fit: cover;
}

.character-symbol {
    display: grid;
    place-items: center;
    color: var(--focus-color);
    background: var(--secondary-color);
    font-size: 5rem;
}

.character-card-copy {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: start;
    padding: 1.45rem;
}

.character-card h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.65rem;
    font-weight: 500;
    line-height: 1.2;
}

.character-card-copy > p:not(.character-eyebrow) {
    margin: 0.9rem 0 1.4rem;
    line-height: 1.6;
}

.character-card-cta {
    margin-top: auto;
    font-size: 0.8rem;
    font-weight: 750;
}

.character-reading-note {
    max-width: 75ch;
    margin: 4rem auto 1rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--muted-text-color);
    line-height: 1.7;
}

.character-reading-note h2 {
    color: var(--text-color);
    font-size: 1.2rem;
}

.character-profile-heading {
    max-width: 920px;
    margin: 2.5rem 0 3rem;
}

.character-profile-dek {
    max-width: 62ch;
}

.character-profile-columns {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(240px, 0.9fr);
    align-items: start;
    gap: clamp(2rem, 6vw, 5rem);
}

.character-prose section,
.character-profile-aside section {
    margin-bottom: 2.6rem;
}

.character-prose h2,
.character-profile-aside h2 {
    margin: 0 0 1.1rem;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.65rem;
    font-weight: 500;
}

.character-prose p {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.13rem;
    line-height: 1.85;
}

.character-prose .character-eyebrow {
    font-family: inherit;
    font-size: 0.7rem;
}

.character-backstory {
    padding: 1.6rem;
    border-left: 3px solid var(--focus-color);
    border-radius: 0 1rem 1rem 0;
    background: var(--modal-background);
}

.character-profile-aside figure {
    margin: 0 0 2rem;
}

.character-profile-image {
    display: block;
    width: 100%;
    aspect-ratio: 1.1;
    object-fit: cover;
    border-radius: 1rem;
}

.character-profile-aside p,
.character-profile-aside dd {
    color: var(--muted-text-color);
    font-size: 0.95rem;
    line-height: 1.7;
}

.character-profile-aside dt {
    margin-top: 1rem;
    font-weight: 750;
}

.character-profile-aside dd {
    margin: 0.3rem 0 1.1rem;
}

.character-story-links a {
    display: block;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border-color);
    line-height: 1.5;
    text-decoration: none;
}

.character-references {
    margin: 2rem 0 3rem;
    padding: 1.2rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
}

.character-references summary {
    cursor: pointer;
    font-weight: 750;
}

.character-references li {
    margin: 0.8rem 0;
    line-height: 1.6;
}

.character-references p {
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.7;
}

@media (max-width: 900px) {
    .character-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .character-hero { gap: 1.4rem; }
    .character-hero h1 { font-size: clamp(2.2rem, 5.2vw, 3.5rem); }
    .character-profile-columns { grid-template-columns: minmax(0, 1.25fr) minmax(220px, 0.9fr); gap: 2rem; }
    .character-filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .character-filters button { justify-self: start; }
}

@media (max-width: 620px) {
    .character-bar { align-items: start; padding: 1rem; font-size: 0.8rem; }
    .character-brand { text-align: right; }
    .character-brand span { display: none; }
    .character-hero { grid-template-columns: 1fr; }
    .character-hero h1 { font-size: clamp(2.6rem, 9vw, 3.5rem); }
    .character-hero-art { max-width: 400px; width: 100%; justify-self: center; margin: 1rem 0; transform: none; }
    .character-hero-art img { aspect-ratio: 1.55; border-radius: 1rem; }
    .character-filters, .character-grid, .character-profile-columns { grid-template-columns: 1fr; }
    .character-profile-heading { margin: 1.7rem 0; }
    .character-profile-aside { grid-row: 1; }
    .character-profile-image { aspect-ratio: 1.5; }
    .character-prose p { font-size: 1.05rem; }
    .character-backstory { padding: 1.1rem; }
}

.library-heading {
    max-width: 850px;
}

.library-kicker,
.shelf-kicker,
.eyebrow,
.page-kicker,
.planet-badge,
.pirate-badge,
.book-volume,
.book-tag {
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.library-kicker {
    margin: 0 0 0.85rem;
    color: var(--gold-bright);
    font-size: clamp(0.75rem, 1vw, 0.92rem);
    font-weight: 800;
}

.library-heading h1 {
    max-width: 13ch;
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(3.35rem, 7.7vw, 8rem);
    font-weight: 500;
    letter-spacing: -0.055em;
    line-height: 0.79;
    text-wrap: balance;
    text-shadow: 0 10px 44px rgba(1, 4, 19, 0.7);
}

.library-intro {
    max-width: 660px;
    margin: 1.55rem 0 0;
    color: var(--ink-soft);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1rem, 1.7vw, 1.36rem);
    line-height: 1.58;
}

.library-music-slot {
    display: flex;
    min-height: 42px;
    margin-top: 1.2rem;
}

.library-orbit {
    position: relative;
    justify-self: center;
    width: min(28vw, 350px);
    min-width: 220px;
    aspect-ratio: 1;
    border-radius: 50%;
    background:
        radial-gradient(circle at 48% 48%, rgba(245, 205, 126, 0.24) 0 3%, transparent 4%),
        radial-gradient(circle at 50% 50%, rgba(94, 72, 179, 0.3), rgba(8, 15, 46, 0.12) 55%, transparent 70%);
    filter: drop-shadow(0 18px 44px rgba(1, 5, 22, 0.55));
}

.orbit-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    display: block;
    width: 76%;
    height: 35%;
    border: 1px solid rgba(255, 228, 166, 0.55);
    border-radius: 50%;
    transform: translate(-50%, -50%) rotate(-20deg);
}

.orbit-ring-two {
    width: 48%;
    height: 68%;
    border-color: rgba(193, 176, 255, 0.58);
    transform: translate(-50%, -50%) rotate(42deg);
}

.orbit-star,
.orbit-moon {
    position: absolute;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 50%;
    box-shadow: 0 10px 34px rgba(1, 4, 19, 0.5);
}

.orbit-star {
    top: 11%;
    right: 10%;
    width: 34%;
    aspect-ratio: 1;
    color: rgb(89, 52, 43);
    font-size: clamp(2.2rem, 4.2vw, 4.7rem);
    background: radial-gradient(circle at 35% 29%, rgb(255, 248, 196), rgb(255, 181, 89));
    transform: rotate(9deg);
}

.orbit-moon {
    bottom: 8%;
    left: 11%;
    width: 24%;
    aspect-ratio: 1;
    color: rgb(238, 226, 255);
    font-size: clamp(1.5rem, 3vw, 3.2rem);
    background: linear-gradient(145deg, rgb(105, 83, 179), rgb(35, 44, 105));
    transform: rotate(-16deg);
}

.library-collections {
    display: grid;
    gap: clamp(2.8rem, 6vw, 6rem);
}

.bookshelf {
    --shelf-accent: var(--mint);
    position: relative;
    padding: clamp(1.1rem, 2.2vw, 2rem) clamp(0.9rem, 2vw, 1.7rem) 0;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-bottom: 0;
    border-radius: 32px 32px 0 0;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025)),
        rgba(7, 14, 39, 0.67);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px);
}

.library-collection-starbeard {
    --shelf-accent: var(--gold-bright);
}

.library-collection-other {
    --shelf-accent: var(--lavender);
}

.shelf-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 2rem;
    padding: 0 clamp(0.25rem, 1vw, 0.8rem) clamp(1.35rem, 2.4vw, 2.2rem);
}

.shelf-kicker {
    margin: 0 0 0.35rem;
    color: var(--shelf-accent);
    font-size: 0.68rem;
    font-weight: 800;
}

.shelf-heading h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.65rem, 3vw, 2.7rem);
    font-weight: 500;
    letter-spacing: -0.035em;
}

.shelf-hint {
    max-width: 350px;
    margin: 0 0 0.25rem;
    color: rgba(226, 224, 232, 0.75);
    font-size: 0.85rem;
    line-height: 1.5;
    text-align: right;
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: clamp(1rem, 2.5vw, 2.4rem);
}

.shelf-empty {
    display: grid;
    grid-template-columns: auto minmax(0, 42rem);
    min-height: 11rem;
    align-content: center;
    justify-content: center;
    align-items: center;
    gap: 1.15rem;
    padding: clamp(1.4rem, 4vw, 3rem);
    border: 1px dashed rgba(193, 176, 255, 0.4);
    border-radius: 22px 22px 8px 8px;
    background: rgba(193, 176, 255, 0.055);
    text-align: left;
}

.shelf-empty-star {
    display: grid;
    width: 3.6rem;
    aspect-ratio: 1;
    place-items: center;
    border: 1px solid rgba(193, 176, 255, 0.35);
    border-radius: 50%;
    color: var(--lavender);
    background: rgba(8, 16, 43, 0.72);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
    font-size: 1.5rem;
}

.shelf-empty p {
    margin: 0;
    color: rgba(226, 224, 232, 0.76);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(0.95rem, 1.5vw, 1.15rem);
    line-height: 1.55;
}

.shelf-empty strong {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--ink);
    font-weight: 500;
}

.book-card {
    min-width: 0;
    padding: clamp(0.75rem, 1.4vw, 1.2rem);
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 24px 24px 9px 9px;
    background: rgba(255, 255, 255, 0.045);
    box-shadow: 0 22px 50px rgba(0, 0, 0, 0.28);
}

.book-card-planets {
    transform: rotate(-0.45deg);
}

.book-card-doughnut {
    transform: rotate(0.55deg);
}

.book-card-moonlit {
    transform: rotate(-0.25deg);
}

.book-card-sock-caper {
    transform: rotate(0.2deg);
}

.book-card-pluto {
    transform: rotate(0.35deg);
}

.book-jacket {
    position: relative;
    isolation: isolate;
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 14px 20px 20px 14px;
    background: rgb(20, 29, 63);
    box-shadow:
        -7px 8px 0 rgba(243, 217, 158, 0.88),
        -11px 13px 0 rgba(80, 47, 52, 0.78),
        0 28px 46px rgba(0, 0, 0, 0.38);
    cursor: pointer;
    text-align: left;
    transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.book-jacket::before {
    content: "";
    position: absolute;
    z-index: 3;
    inset: 0 auto 0 0;
    width: 3.2%;
    min-width: 12px;
    border-right: 1px solid rgba(255, 255, 255, 0.18);
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.55), rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.28));
}

.book-jacket::after {
    content: "";
    position: absolute;
    z-index: 3;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), inset 0 -38px 55px rgba(0, 0, 0, 0.14);
    pointer-events: none;
}

.book-jacket:hover,
.book-jacket:focus-visible {
    z-index: 2;
    border-color: rgba(255, 232, 161, 0.74);
    box-shadow:
        -7px 8px 0 rgba(249, 229, 181, 0.94),
        -11px 13px 0 rgba(91, 53, 55, 0.82),
        0 36px 68px rgba(0, 0, 0, 0.48);
    transform: translateY(-9px) rotate(-0.25deg);
}

.book-jacket img {
    position: absolute;
    z-index: -3;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 63% center;
    transition: transform 700ms cubic-bezier(0.2, 0.72, 0.22, 1);
}

.book-card-doughnut .book-jacket img {
    object-position: 58% center;
}

.book-card-moonlit .book-jacket img,
.book-card-sock-caper .book-jacket img {
    object-position: 62% center;
}

.book-card-pluto .book-jacket img {
    object-position: 60% center;
}

.book-jacket:hover img,
.book-jacket:focus-visible img {
    transform: scale(1.035);
}

.book-jacket-shade {
    position: absolute;
    z-index: -2;
    inset: 0;
    background: linear-gradient(90deg, rgba(2, 6, 22, 0.92) 0%, rgba(3, 9, 30, 0.67) 38%, rgba(3, 9, 30, 0.03) 78%);
}

.book-volume,
.book-jacket-title,
.book-open-prompt {
    position: absolute;
    z-index: 1;
    left: clamp(1.55rem, 4vw, 3.4rem);
}

.book-volume {
    top: clamp(1.3rem, 3.2vw, 2.6rem);
    color: var(--gold-bright);
    font-size: clamp(0.55rem, 0.85vw, 0.75rem);
    font-weight: 900;
}

.book-jacket-title {
    top: 31%;
    width: min(56%, 11ch);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.75rem, 3.6vw, 4.25rem);
    font-weight: 500;
    letter-spacing: -0.05em;
    line-height: 0.87;
    text-shadow: 0 4px 20px rgba(1, 5, 21, 0.72);
}

.book-jacket-title-long {
    top: 28%;
    width: min(61%, 15ch);
    font-size: clamp(1.3rem, 2.8vw, 3.2rem);
    line-height: 0.92;
}

.book-open-prompt {
    bottom: clamp(1.15rem, 2.8vw, 2.2rem);
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: rgba(255, 249, 233, 0.86);
    font-size: clamp(0.68rem, 1vw, 0.86rem);
    font-weight: 800;
}

.book-open-prompt span {
    color: var(--gold);
    font-size: 1.25em;
    transition: transform 180ms ease;
}

.book-jacket:hover .book-open-prompt span,
.book-jacket:focus-visible .book-open-prompt span {
    transform: translateX(5px);
}

.book-details {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1.2rem;
    min-height: 176px;
    padding: 1.45rem 0.25rem 0.5rem;
}

.book-tag {
    margin: 0 0 0.4rem;
    color: var(--lavender);
    font-size: 0.61rem;
    font-weight: 900;
}

.book-tag-new {
    color: var(--mint);
}

.book-details h3 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.25rem, 1.85vw, 1.85rem);
    font-weight: 500;
    letter-spacing: -0.025em;
    line-height: 1.08;
}

.book-details p:last-child {
    max-width: 520px;
    margin: 0.7rem 0 0;
    color: rgba(226, 224, 232, 0.76);
    font-size: clamp(0.78rem, 1vw, 0.9rem);
    line-height: 1.48;
}

.shelf-read-button,
.begin-button,
.again-button,
.library-button,
.read-button,
.music-button,
.round-button,
.reader-brand {
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(8, 16, 43, 0.72);
    cursor: pointer;
    transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.shelf-read-button {
    flex: 0 0 auto;
    padding: 0.74rem 1rem;
    border-color: rgba(255, 222, 146, 0.45);
    border-radius: 999px;
    color: rgb(36, 23, 35);
    background: linear-gradient(135deg, var(--gold-bright), rgb(255, 177, 110));
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    font-size: 0.76rem;
    font-weight: 900;
    white-space: nowrap;
}

.shelf-read-button:hover,
.shelf-read-button:focus-visible,
.begin-button:hover,
.begin-button:focus-visible,
.again-button:hover,
.again-button:focus-visible {
    transform: translateY(-2px);
}

.shelf-plank {
    position: relative;
    height: clamp(24px, 3vw, 39px);
    margin: clamp(1.1rem, 2vw, 1.8rem) clamp(-0.9rem, -2vw, -1.7rem) 0;
    border-top: 1px solid rgba(255, 232, 180, 0.46);
    border-bottom: 5px solid rgba(37, 18, 30, 0.85);
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.07), transparent 32%, rgba(255, 255, 255, 0.05) 64%, transparent),
        linear-gradient(180deg, rgb(125, 75, 67), rgb(72, 39, 48));
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.46);
}

.library-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2.2rem 1rem 0;
    color: rgba(226, 224, 232, 0.62);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 0.84rem;
    text-align: center;
}

.library-footer span {
    color: var(--gold);
}

.library-footer p {
    margin: 0;
}

.storybook {
    position: fixed;
    z-index: 20;
    inset: 0;
    overflow: hidden;
    background: var(--night-deep);
}

.reader-bar,
.reader-controls {
    position: fixed;
    z-index: 50;
    left: 0;
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-right: max(1rem, env(safe-area-inset-right));
    padding-left: max(1rem, env(safe-area-inset-left));
    background: linear-gradient(180deg, rgba(3, 7, 25, 0.93), rgba(3, 7, 25, 0.65) 72%, transparent);
    pointer-events: none;
}

.reader-bar {
    top: 0;
    min-height: 78px;
    padding-top: max(0.8rem, env(safe-area-inset-top));
    padding-bottom: 1.4rem;
}

.reader-controls {
    bottom: 0;
    min-height: 92px;
    padding-top: 1.6rem;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
    background: linear-gradient(0deg, rgba(3, 7, 25, 0.94), rgba(3, 7, 25, 0.68) 72%, transparent);
}

.reader-bar button,
.reader-bar select,
.reader-controls button {
    pointer-events: auto;
}

.reader-identity,
.reader-actions {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 0.8rem;
}

.library-button,
.read-button,
.music-button,
.reader-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.48rem;
    min-height: 40px;
    padding: 0.6rem 0.9rem;
    border-radius: 999px;
    color: var(--ink);
    backdrop-filter: blur(10px);
}

.library-button,
.read-button,
.music-button {
    font-size: 0.75rem;
    font-weight: 800;
}

.music-button {
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
    white-space: nowrap;
}

.music-button[aria-pressed="true"] {
    border-color: rgba(158, 231, 210, 0.62);
    background-color: rgba(23, 71, 76, 0.88);
}

.music-button[aria-busy="true"] {
    cursor: wait;
    opacity: 0.72;
}

.reader-brand {
    min-width: 0;
    max-width: 280px;
    border-color: transparent;
    background: transparent;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(0.84rem, 1.4vw, 1rem);
    line-height: 1.2;
    overflow-wrap: anywhere;
    text-align: center;
    white-space: normal;
}

.library-button:hover,
.read-button:hover,
.music-button:hover,
.reader-brand:hover,
.round-button:hover:not(:disabled) {
    border-color: rgba(255, 232, 161, 0.62);
    background-color: rgba(36, 43, 78, 0.9);
    transform: translateY(-1px);
}

.brand-star,
.read-icon,
.music-button-icon {
    color: var(--gold);
}

.music-button[aria-pressed="true"] .music-button-icon {
    color: var(--mint);
}

.reader-music-slot {
    display: flex;
    flex: 0 0 auto;
    pointer-events: auto;
}

.reader-actions {
    justify-content: flex-end;
}

.voice-control {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    gap: 0.42rem;
    padding: 0.42rem 0.68rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(14, 23, 57, 0.78);
    color: var(--ink);
    backdrop-filter: blur(10px);
    pointer-events: auto;
}

.voice-control label {
    color: rgba(255, 249, 233, 0.66);
    font-size: 0.58rem;
    font-weight: 900;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.voice-select {
    min-width: 7.5rem;
    padding: 0.18rem 0.1rem;
    border: 0;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    font: inherit;
    font-size: 0.7rem;
    font-weight: 800;
}

.voice-select:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.voice-select option {
    background: var(--night);
    color: var(--ink);
}

.chapter-label {
    max-width: min(34vw, 380px);
    margin: 0;
    color: rgba(255, 249, 233, 0.72);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 1.25;
    overflow-wrap: anywhere;
    text-align: center;
    text-transform: uppercase;
    white-space: normal;
}

.story-track {
    display: flex;
    width: 100%;
    height: 100dvh;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    touch-action: pan-x;
}

.story-track::-webkit-scrollbar {
    display: none;
}

.story-page {
    position: relative;
    isolation: isolate;
    flex: 0 0 100%;
    width: 100%;
    height: 100dvh;
    min-height: 460px;
    overflow: hidden;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    background: rgb(8, 14, 35);
}

.page-art {
    position: absolute;
    z-index: -4;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transform: scale(1.015);
    transition: transform 1.25s cubic-bezier(0.18, 0.72, 0.22, 1);
}

.story-page.is-current .page-art {
    transform: scale(1);
}

.prism-page-art,
.admiral-page-art {
    object-fit: cover;
}

.page-art-doughnut-arrival {
    object-position: 52% center;
}

.page-art-moonlit-compass-close {
    object-position: 30% center;
}

.page-art-moonlit-meadow-close,
.page-art-moonlit-forest-close,
.page-art-moonlit-first-flower-close,
.page-art-moonlit-home-close {
    object-position: 74% center;
}

.page-art-moonlit-melodians-close,
.page-art-moonlit-lullaby-close {
    object-position: 28% center;
}

.art-shade {
    position: absolute;
    z-index: -3;
    inset: 0;
    pointer-events: none;
}

.art-shade-left {
    background: linear-gradient(90deg, rgba(3, 7, 25, 0.95) 0%, rgba(3, 7, 25, 0.77) 31%, rgba(3, 7, 25, 0.2) 63%, transparent 83%);
}

.art-shade-right {
    background: linear-gradient(270deg, rgba(3, 7, 25, 0.95) 0%, rgba(3, 7, 25, 0.76) 31%, rgba(3, 7, 25, 0.18) 62%, transparent 83%);
}

.art-shade-bottom {
    background:
        linear-gradient(0deg, rgba(3, 7, 25, 0.94), rgba(3, 7, 25, 0.58) 36%, transparent 68%),
        linear-gradient(90deg, rgba(3, 7, 25, 0.18), transparent 50%, rgba(3, 7, 25, 0.12));
}

.page-copy {
    --copy-drag-x: 0px;
    --copy-drag-y: 0px;
    position: absolute;
    z-index: 2;
    color: var(--ink);
    text-shadow: 0 3px 25px rgba(1, 4, 17, 0.72);
}

.cover-copy {
    top: 50%;
    left: clamp(1.4rem, 7vw, 8rem);
    width: min(48rem, 55vw);
    padding-top: 2.2rem;
    transform: translate(
        var(--copy-drag-x),
        calc(-48% + var(--copy-drag-y))
    );
}

.eyebrow {
    margin: 0 0 1rem;
    color: var(--gold-bright);
    font-size: clamp(0.65rem, 1vw, 0.9rem);
    font-weight: 900;
}

.cover-title {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(3.4rem, 7.6vw, 8.2rem);
    font-weight: 500;
    letter-spacing: -0.06em;
    line-height: 0.8;
}

.doughnut-cover-copy {
    width: min(53rem, 59vw);
}

.doughnut-cover-copy .cover-title {
    font-size: clamp(2.7rem, 5.8vw, 6.3rem);
    line-height: 0.88;
}

.moonlit-cover-copy,
.sock-caper-cover-copy {
    width: min(58rem, 61vw);
}

.moonlit-cover-copy .cover-title,
.sock-caper-cover-copy .cover-title {
    font-size: clamp(2.35rem, 5.15vw, 5.75rem);
    line-height: 0.9;
}

.pluto-cover-copy,
.prism-cover-copy,
.admiral-cover-copy {
    width: min(60rem, 62vw);
}

.pluto-cover-copy .cover-title,
.prism-cover-copy .cover-title,
.admiral-cover-copy .cover-title {
    font-size: clamp(2.2rem, 4.8vw, 5.4rem);
    line-height: 0.9;
}

.dek {
    max-width: 50ch;
    margin: clamp(1rem, 2vw, 1.75rem) 0 0;
    color: rgba(255, 249, 233, 0.88);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(0.95rem, 1.5vw, 1.3rem);
    line-height: 1.52;
}

.begin-button,
.again-button {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    margin-top: clamp(1.1rem, 2.3vw, 2rem);
    padding: 0.78rem 1.12rem;
    border-color: rgba(255, 231, 170, 0.65);
    border-radius: 999px;
    color: rgb(35, 24, 38);
    background: linear-gradient(135deg, rgb(255, 239, 183), rgb(255, 178, 111));
    box-shadow: 0 12px 28px rgba(2, 4, 16, 0.34);
    font-size: clamp(0.78rem, 1.1vw, 0.95rem);
    font-weight: 900;
}

.story-copy {
    top: 50%;
    width: min(38rem, 44vw);
    padding: clamp(1.2rem, 2.5vw, 2.4rem);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 26px;
    background: linear-gradient(145deg, rgba(8, 15, 42, 0.8), rgba(5, 10, 30, 0.58));
    box-shadow: 0 24px 65px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    transform: translate(
        var(--copy-drag-x),
        calc(-48% + var(--copy-drag-y))
    );
}

.story-copy-left {
    left: clamp(1.2rem, 5.5vw, 6.5rem);
}

.story-copy-right {
    right: clamp(1.2rem, 5.5vw, 6.5rem);
}

.story-copy-compact {
    width: min(34rem, 40vw);
}

.moonlit-story-copy,
.sock-caper-story-copy,
.pluto-story-copy,
.prism-story-copy {
    width: min(43rem, 48vw);
    max-height: 66vh;
    overflow-y: auto;
    padding-top: 3.6rem;
    scrollbar-color: rgba(255, 226, 150, 0.7) rgba(8, 15, 42, 0.45);
    scrollbar-width: thin;
}

.moonlit-story-copy .copy-move-tools,
.sock-caper-story-copy .copy-move-tools,
.pluto-story-copy .copy-move-tools,
.prism-story-copy .copy-move-tools {
    top: 0.65rem;
}

.prism-cover-copy,
.prism-story-copy,
.admiral-cover-copy,
.admiral-story-copy {
    top: auto;
    bottom: max(6.6rem, 12vh);
    transform: translate(
        var(--copy-drag-x),
        var(--copy-drag-y)
    );
}

.storybook[data-book^="admiralPigeon"] .story-track {
    touch-action: pan-x pan-y pinch-zoom;
}

.storybook[data-book^="admiralPigeon"] .story-page {
    min-height: 0;
}

.story-copy.admiral-story-copy {
    width: min(43rem, 48vw);
    max-height: none;
    overflow: visible;
    padding-top: 3.6rem;
}

.admiral-story-copy .copy-move-tools {
    top: 0.65rem;
}

.admiral-chapter-text {
    max-height: min(54dvh, calc(100dvh - 16rem));
    overflow-y: auto;
    overscroll-behavior-y: contain;
    touch-action: pan-y pinch-zoom;
    scrollbar-color: rgba(255, 226, 150, 0.7) rgba(8, 15, 42, 0.45);
    scrollbar-width: thin;
}

.admiral-chapter-text:focus-visible {
    outline: 2px solid var(--gold-bright);
    outline-offset: 0.35rem;
}

.story-copy.admiral-story-copy h2 {
    font-size: clamp(1.7rem, 3vw, 3.35rem);
    line-height: 1;
}

@media (min-width: 1101px) {
    .prism-story-copy.prism-compact-copy {
        width: min(30rem, 34vw);
        max-height: 50vh;
    }
}

.copy-move-tools {
    position: absolute;
    z-index: 4;
    top: -1.15rem;
    right: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
    max-width: calc(100% - 1.7rem);
    text-shadow: none;
    user-select: none;
}

.copy-drag-handle,
.copy-size-button,
.copy-reset-button {
    min-height: 36px;
    padding: 0.5rem 0.72rem;
    border: 1px solid rgba(255, 232, 161, 0.44);
    border-radius: 999px;
    color: var(--ink);
    background: rgba(6, 14, 43, 0.92);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(12px);
    font-size: 0.68rem;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.copy-drag-handle {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    cursor: grab;
    touch-action: none;
}

.copy-move-grip {
    color: var(--gold-bright);
    font-size: 0.96rem;
    line-height: 0;
}

.copy-drag-handle:hover,
.copy-drag-handle:focus-visible,
.copy-size-button:hover,
.copy-size-button:focus-visible,
.copy-reset-button:hover,
.copy-reset-button:focus-visible {
    border-color: rgba(255, 232, 161, 0.82);
    background: rgba(35, 45, 82, 0.96);
    transform: translateY(-1px);
}

.copy-drag-handle:active,
.page-copy.is-dragging .copy-drag-handle {
    cursor: grabbing;
    transform: translateY(0) scale(0.98);
}

.copy-size-button {
    color: rgb(255, 232, 173);
}

.copy-reset-button {
    color: rgb(191, 234, 220);
}

.page-copy.is-dragging {
    z-index: 6;
    will-change: transform;
}

.page-copy.is-collapsed {
    width: max-content;
    max-width: calc(100vw - 2rem);
    min-height: 0;
    padding: 0.45rem;
    overflow: visible;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    text-shadow: none;
}

.page-copy.is-collapsed > :not(.copy-move-tools) {
    display: none;
}

.page-copy.is-collapsed .copy-move-tools {
    position: static;
    max-width: none;
}

.story-copy h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 4vw, 4.45rem);
    font-weight: 500;
    letter-spacing: -0.05em;
    line-height: 0.95;
    text-wrap: balance;
}

.story-copy p:not(.page-kicker, .planet-badge, .pirate-badge) {
    margin: 1rem 0 0;
    color: rgba(255, 249, 233, 0.9);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(0.96rem, 1.45vw, 1.24rem);
    line-height: 1.55;
}

.page-kicker,
.planet-badge,
.pirate-badge {
    display: inline-flex;
    align-items: center;
    margin: 0 0 0.9rem;
    color: var(--gold-bright);
    font-size: clamp(0.58rem, 0.84vw, 0.74rem);
    font-weight: 900;
}

.planet-badge,
.pirate-badge {
    padding: 0.5rem 0.72rem;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    background: rgba(15, 27, 64, 0.68);
}

.pirate-badge {
    color: rgb(255, 226, 150);
    border-color: rgba(255, 211, 107, 0.42);
    background: rgba(79, 43, 58, 0.72);
}

.story-copy .spoken-line {
    padding-top: 0.88rem;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    color: rgb(255, 232, 173);
    font-style: italic;
}

.story-copy .story-lesson {
    color: rgb(191, 234, 220);
    font-style: italic;
}

.moonlit-story-copy h2,
.sock-caper-story-copy h2,
.pluto-story-copy h2,
.prism-story-copy h2 {
    font-size: clamp(1.7rem, 3vw, 3.35rem);
    line-height: 1;
}

.moonlit-story-copy p:not(.page-kicker, .planet-badge, .pirate-badge),
.sock-caper-story-copy p:not(.page-kicker, .planet-badge, .pirate-badge),
.pluto-story-copy p:not(.page-kicker, .planet-badge, .pirate-badge),
.prism-story-copy p:not(.page-kicker, .planet-badge, .pirate-badge) {
    margin-top: 0.68rem;
    font-size: clamp(0.84rem, 1.12vw, 1.02rem);
    line-height: 1.42;
}

.moonlit-story-copy .spoken-line,
.sock-caper-story-copy .spoken-line,
.pluto-story-copy .spoken-line,
.prism-story-copy .spoken-line {
    padding-top: 0.62rem;
}

.story-copy .story-sound {
    color: rgb(255, 226, 150);
    font-weight: 900;
    letter-spacing: 0.035em;
}

.story-copy .story-lullaby {
    color: rgb(222, 213, 255);
    font-style: italic;
}

.story-copy p.story-ending {
    color: var(--gold-bright);
    font-size: 0.82em;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.ending-copy {
    border-color: rgba(255, 219, 139, 0.32);
}

.round-button {
    display: grid;
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 50%;
    font-size: 1.15rem;
    backdrop-filter: blur(10px);
}

.round-button:disabled {
    cursor: default;
    opacity: 0.28;
}

.page-status {
    display: grid;
    justify-items: center;
    gap: 0.45rem;
    min-width: 0;
    color: rgba(255, 249, 233, 0.7);
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.progress-dots {
    display: flex;
    max-width: min(64vw, 34rem);
    align-items: center;
    justify-content: flex-start;
    gap: 0.45rem;
    overflow-x: auto;
    padding: 0.25rem;
    scrollbar-width: none;
}

.progress-dots::-webkit-scrollbar {
    display: none;
}

.progress-dots button {
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.36);
    cursor: pointer;
    transition: width 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.progress-dots button[aria-current="page"] {
    width: 26px;
    border-radius: 999px;
    background: var(--gold);
}

.progress-dots button:hover,
.progress-dots button:focus-visible {
    background: var(--gold-bright);
    transform: scale(1.15);
}

.noscript-message {
    position: fixed;
    z-index: 100;
    inset: 1rem;
    display: grid;
    place-items: center;
    margin: 0;
    padding: 2rem;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--night);
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    text-align: center;
}

@media (max-width: 980px) {
    .library-masthead {
        grid-template-columns: minmax(0, 1fr) minmax(180px, 260px);
    }

    .library-heading h1 {
        font-size: clamp(3.25rem, 9vw, 6.4rem);
    }

    .book-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .book-details {
        display: block;
        min-height: 210px;
    }

    .shelf-read-button {
        margin-top: 1rem;
    }

    .story-copy {
        width: min(42rem, 53vw);
    }

    .story-copy-compact {
        width: min(38rem, 49vw);
    }

    .moonlit-story-copy,
    .sock-caper-story-copy,
    .pluto-story-copy,
    .prism-story-copy {
        width: min(42rem, 53vw);
    }

    .reader-music-slot .music-button {
        width: 40px;
        padding-right: 0;
        padding-left: 0;
    }

    .reader-music-slot .music-button-label {
        display: none;
    }
}

@media (max-width: 760px) {
    .library-shell {
        padding-top: 2rem;
    }

    .library-masthead {
        grid-template-columns: 1fr;
        gap: 1.8rem;
    }

    .library-heading h1 {
        font-size: clamp(3.1rem, 15vw, 6rem);
    }

    .library-orbit {
        position: absolute;
        top: 0.65rem;
        right: -4.5rem;
        z-index: -1;
        width: 210px;
        min-width: 0;
        opacity: 0.56;
    }

    .shelf-heading {
        display: block;
    }

    .shelf-hint {
        margin-top: 0.75rem;
        text-align: left;
    }

    .library-collections {
        gap: 2.8rem;
    }

    .book-grid {
        grid-template-columns: 1fr;
        gap: 2.2rem;
    }

    .shelf-empty {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    .book-card-planets,
    .book-card-doughnut,
    .book-card-moonlit,
    .book-card-sock-caper,
    .book-card-pluto {
        transform: none;
    }

    .book-details {
        display: flex;
        min-height: 0;
    }

    .shelf-read-button {
        margin-top: 0;
    }

    .voice-control label {
        display: none;
    }

    .voice-select {
        min-width: 6.8rem;
    }

    .cover-copy,
    .doughnut-cover-copy {
        top: auto;
        bottom: max(6.6rem, 13vh);
        left: 1rem;
        width: calc(100% - 2rem);
        padding: 3.7rem 1.2rem 1.2rem;
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: 22px;
        background: rgba(4, 9, 29, 0.69);
        backdrop-filter: blur(8px);
        transform: translate(
            var(--copy-drag-x),
            var(--copy-drag-y)
        );
    }

    .cover-title,
    .doughnut-cover-copy .cover-title {
        font-size: clamp(2.55rem, 12vw, 5rem);
        line-height: 0.86;
    }

    .moonlit-cover-copy .cover-title,
    .sock-caper-cover-copy .cover-title {
        font-size: clamp(2.05rem, 9.6vw, 4.25rem);
        line-height: 0.92;
    }

    .pluto-cover-copy .cover-title,
    .prism-cover-copy .cover-title,
    .admiral-cover-copy .cover-title {
        font-size: clamp(1.95rem, 9vw, 4rem);
        line-height: 0.92;
    }

    .story-copy,
    .story-copy-compact,
    .story-copy-left,
    .story-copy-right {
        top: auto;
        right: 1rem;
        bottom: max(6.6rem, 12vh);
        left: 1rem;
        width: auto;
        max-height: 60vh;
        overflow-y: auto;
        padding: 3.7rem 1.15rem 1.15rem;
        border-radius: 20px;
        transform: translate(
            var(--copy-drag-x),
            var(--copy-drag-y)
        );
    }

    .story-copy.admiral-story-copy:not(.is-collapsed) {
        width: auto;
    }

    .admiral-chapter-text {
        max-height: min(48dvh, calc(100dvh - 17rem));
    }

    .copy-move-tools {
        top: 0.65rem;
        right: 0.65rem;
    }

    .story-copy h2 {
        font-size: clamp(1.85rem, 8.5vw, 3.5rem);
    }

    .story-copy p:not(.page-kicker, .planet-badge, .pirate-badge) {
        font-size: clamp(0.88rem, 3.6vw, 1.05rem);
        line-height: 1.42;
    }

    .moonlit-story-copy h2,
    .sock-caper-story-copy h2,
    .pluto-story-copy h2,
    .prism-story-copy h2 {
        font-size: clamp(1.65rem, 7.5vw, 3rem);
    }

    .moonlit-story-copy p:not(.page-kicker, .planet-badge, .pirate-badge),
    .sock-caper-story-copy p:not(.page-kicker, .planet-badge, .pirate-badge),
    .pluto-story-copy p:not(.page-kicker, .planet-badge, .pirate-badge),
    .prism-story-copy p:not(.page-kicker, .planet-badge, .pirate-badge) {
        font-size: clamp(0.82rem, 3.3vw, 0.98rem);
        line-height: 1.38;
    }

    .art-shade-left,
    .art-shade-right {
        background: linear-gradient(0deg, rgba(3, 7, 25, 0.94), rgba(3, 7, 25, 0.35) 58%, transparent 88%);
    }

}

@media (max-width: 520px) {
    .library-shell {
        padding-right: 0.8rem;
        padding-left: 0.8rem;
    }

    .library-intro {
        font-size: 1rem;
    }

    .bookshelf {
        border-radius: 24px 24px 0 0;
    }

    .book-card {
        padding: 0.65rem;
    }

    .book-jacket {
        border-radius: 11px 16px 16px 11px;
        box-shadow:
            -5px 6px 0 rgba(243, 217, 158, 0.88),
            -8px 10px 0 rgba(80, 47, 52, 0.78),
            0 20px 36px rgba(0, 0, 0, 0.35);
    }

    .book-jacket-title {
        font-size: clamp(1.55rem, 9vw, 2.55rem);
    }

    .book-jacket-title-long {
        font-size: clamp(1.15rem, 6.9vw, 2rem);
    }

    .book-card-moonlit .book-jacket-title-long {
        font-size: clamp(1rem, 5.8vw, 1.75rem);
    }

    .book-details {
        display: block;
    }

    .shelf-read-button {
        width: 100%;
        margin-top: 1rem;
    }

    .reader-bar {
        gap: 0.45rem;
        padding-right: 0.7rem;
        padding-left: 0.7rem;
    }

    .library-button,
    .read-button {
        padding: 0.56rem 0.72rem;
        font-size: 0.69rem;
    }

    .reader-actions,
    .reader-identity {
        gap: 0.35rem;
    }

    .voice-control {
        padding: 0.38rem 0.5rem;
    }

    .voice-select {
        width: 5.9rem;
        min-width: 0;
        font-size: 0.66rem;
    }

    .round-button {
        width: 44px;
        height: 44px;
    }

    .progress-dots {
        gap: 0.32rem;
    }

    .progress-dots button {
        width: 7px;
        height: 7px;
    }

    .progress-dots button[aria-current="page"] {
        width: 20px;
    }

    .page-status {
        font-size: 0.56rem;
    }

    .copy-move-label {
        display: none;
    }

    .cover-copy,
    .doughnut-cover-copy,
    .story-copy,
    .story-copy-compact,
    .story-copy-left,
    .story-copy-right {
        right: 0.65rem;
        bottom: max(6.25rem, 11.5vh);
        left: 0.65rem;
        width: auto;
    }

    .dek {
        font-size: 0.88rem;
        line-height: 1.38;
    }

    .moonlit-cover-copy .cover-title,
    .sock-caper-cover-copy .cover-title {
        font-size: clamp(1.8rem, 8.6vw, 3.5rem);
    }

    .pluto-cover-copy .cover-title,
    .prism-cover-copy .cover-title,
    .admiral-cover-copy .cover-title {
        font-size: clamp(1.65rem, 8vw, 3.3rem);
    }

    .begin-button,
    .again-button {
        margin-top: 0.8rem;
        padding: 0.67rem 0.9rem;
    }
}

@media (max-width: 400px) {
    .library-button span:last-child,
    .read-icon {
        display: none;
    }

    .library-button {
        width: 40px;
        padding-right: 0;
        padding-left: 0;
    }

    .voice-control {
        max-width: 5.2rem;
        padding-right: 0.38rem;
        padding-left: 0.38rem;
    }

    .voice-select {
        width: 4.4rem;
    }
}

@media (max-height: 650px) and (orientation: landscape) {
    .reader-bar {
        min-height: 58px;
        padding-top: 0.45rem;
        padding-bottom: 0.75rem;
    }

    .reader-controls {
        min-height: 64px;
        padding-top: 0.8rem;
        padding-bottom: 0.55rem;
    }

    .cover-copy {
        width: min(50rem, 59vw);
    }

    .cover-title {
        font-size: clamp(2.8rem, 7vw, 5.4rem);
    }

    .doughnut-cover-copy .cover-title {
        font-size: clamp(2.4rem, 5.5vw, 4.7rem);
    }

    .moonlit-cover-copy .cover-title,
    .sock-caper-cover-copy .cover-title {
        font-size: clamp(2rem, 4.5vw, 3.85rem);
    }

    .pluto-cover-copy .cover-title,
    .prism-cover-copy .cover-title,
    .admiral-cover-copy .cover-title {
        font-size: clamp(1.9rem, 4.2vw, 3.65rem);
    }

    .dek {
        margin-top: 0.7rem;
        font-size: 0.92rem;
    }

    .begin-button,
    .again-button {
        margin-top: 0.75rem;
        padding: 0.58rem 0.86rem;
    }

    .story-copy {
        padding: 3.2rem 1.3rem 1rem;
    }

    .story-copy h2 {
        font-size: clamp(1.8rem, 3.6vw, 3rem);
    }

    .story-copy p:not(.page-kicker, .planet-badge, .pirate-badge) {
        margin-top: 0.6rem;
        font-size: 0.9rem;
        line-height: 1.35;
    }

    .moonlit-story-copy p:not(.page-kicker, .planet-badge, .pirate-badge),
    .sock-caper-story-copy p:not(.page-kicker, .planet-badge, .pirate-badge),
    .pluto-story-copy p:not(.page-kicker, .planet-badge, .pirate-badge),
    .prism-story-copy p:not(.page-kicker, .planet-badge, .pirate-badge) {
        margin-top: 0.48rem;
        font-size: 0.78rem;
        line-height: 1.3;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
