@font-face {
    font-family: "Perfectly Nineties";
    src: url("/assets/fonts/perfectly-nineties/perfectlynineties-regular-webfont.woff2") format("woff2"),
         url("/assets/fonts/perfectly-nineties/perfectlynineties-regular-webfont.woff") format("woff");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-serif: "Perfectly Nineties", Georgia, serif;
    --font-display: var(--font-sans);
    --font-book: Georgia, 'Times New Roman', serif;

    --ink: #241f19;
    --black: #000;
    --muted: #71675a;
    --paper: #fffaf1;
    --warm: #efe3cf;
    --accent: #7b4f2c;
    --line: rgba(36,31,25,.1);
    --white-glass: rgba(255,255,255,.65);

    --success: #3d6f47;
    --danger: #9b2f2f;
    --book-paper: color-mix(in srgb, var(--paper) 82%, white);
    --muted-strong: color-mix(in srgb, var(--muted) 82%, var(--ink));
    --surface: var(--white-glass);
    --surface-soft: rgba(255, 255, 255, .42);
    --surface-strong: rgba(255, 255, 255, .82);
    --paper-soft: rgba(255, 250, 241, .58);
    --paper-strong: rgba(255, 250, 241, .94);
    --accent-soft: rgba(123, 79, 44, .08);
    --accent-line: rgba(123, 79, 44, .24);
    --danger-soft: rgba(155, 47, 47, .08);
    --danger-line: rgba(155, 47, 47, .18);
    --success-soft: rgba(61, 111, 71, .1);
    --success-line: rgba(61, 111, 71, .25);

    --colour-ink: var(--ink);
    --colour-black: var(--black);
    --colour-paper: var(--paper);
    --colour-bg: color-mix(in srgb, var(--paper) 76%, var(--warm));
    --colour-bg-warm: var(--warm);
    --colour-book-paper: var(--book-paper);
    --colour-muted: var(--muted);
    --colour-muted-strong: var(--muted-strong);
    --colour-accent: var(--accent);
    --colour-success: var(--success);
    --colour-danger: var(--danger);
    --colour-text: var(--colour-ink);

    --color-ink: var(--colour-ink);
    --color-black: var(--colour-black);
    --color-paper: var(--colour-paper);
    --color-bg: var(--colour-bg);
    --color-bg-warm: var(--colour-bg-warm);
    --color-book-paper: var(--colour-book-paper);
    --color-muted: var(--colour-muted);
    --color-muted-strong: var(--colour-muted-strong);
    --color-accent: var(--colour-accent);
    --color-success: var(--colour-success);
    --color-danger: var(--colour-danger);

    --ink-rgb: 36 31 25;
    --paper-rgb: 255 250 241;
    --accent-rgb: 123 79 44;
    --white-rgb: 255 255 255;

    --radius-sm: .85rem;
    --radius-md: 1rem;
    --radius-lg: 1.35rem;
    --radius-pill: 999px;

    --text-xs: .68rem;
    --text-sm: .76rem;
    --text-base: .95rem;
    --text-lg: 1.2rem;
    --text-xl: 1.5rem;
    --text-2xl: clamp(4rem, 9vw, 6rem);

    --weight-light: 300;
    --weight-regular: 400;
    --weight-semibold: 600;

    --topnav-height: 66px;
    --shadow-soft: 0 18px 44px rgb(var(--ink-rgb) / .06);
    --shadow-card: 0 20px 50px rgb(var(--ink-rgb) / .08);
    --scrollbar-track: rgb(var(--paper-rgb) / .52);
    --scrollbar-thumb: rgb(var(--ink-rgb) / .18);
    --scrollbar-thumb-hover: rgb(var(--accent-rgb) / .42);

    --bs-body-bg: transparent !important;
    --bs-focus-ring-color: rgb(var(--accent-rgb) / .16);
    --bs-focus-ring-opacity: 1;
    --bs-focus-ring-width: .22rem;
    --bs-border-color: rgb(var(--ink-rgb) / .13);
    --bs-primary: var(--colour-accent);
    --bs-primary-rgb: 123, 79, 44;
    --workspace-gap: 1rem;
    --bs-link-color: var(--colour-accent);
    --bs-link-hover-color: var(--colour-ink);
}

body {
    font-family: var(--font-sans);
    color: var(--colour-ink);
    background: linear-gradient(135deg, var(--colour-bg), var(--colour-bg-warm));
    min-height: 100vh;
}

.lead {
    color: var(--colour-muted);
    font-weight: var(--weight-light);
    letter-spacing: 0;
}

.small-caps {
    font-variant: small-caps;
    font-variant-caps: all-small-caps;
    font-feature-settings: "c2sc", "smcp";
    text-transform: uppercase;
    font-size: .82em;
    letter-spacing: .06em;
}

.form-control,
.form-select,
input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]),
textarea,
select {
    border: 1px solid rgb(var(--ink-rgb) / .13);
    background-color: rgb(var(--white-rgb) / .72);
    color: var(--colour-ink);
    caret-color: var(--colour-accent);
    color-scheme: light;
    transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.form-control:hover,
.form-select:hover,
input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]):hover,
textarea:hover,
select:hover {
    border-color: rgb(var(--ink-rgb) / .22);
    background-color: rgb(var(--white-rgb) / .82);
}

.form-control:focus,
.form-select:focus,
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus,
.form-check-input:focus-visible,
input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]):focus,
textarea:focus,
select:focus,
input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]):focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 0 !important;
    border-color: rgb(var(--accent-rgb) / .62) !important;
    background-color: var(--book-paper);
    box-shadow: 0 0 0 .22rem rgb(var(--accent-rgb) / .16) !important;
    color: var(--colour-ink);
}

.form-control[type="file"],
input[type="file"] {
    overflow: hidden;
    min-height: calc(1.5em + .75rem + 2px);
    padding: 0 .85rem 0 0;
    border-color: rgb(var(--ink-rgb) / .14);
    background: rgb(var(--white-rgb) / .74);
    cursor: pointer;
    font-size: var(--text-base);
    font-weight: var(--weight-regular);
}

.form-control[type="file"]::file-selector-button,
input[type="file"]::file-selector-button {
    min-height: calc(1.5em + .75rem + 2px);
    margin: 0 .75rem 0 0;
    border: 0;
    border-right: 1px solid rgb(var(--ink-rgb) / .12);
    background: rgb(var(--paper-rgb) / .68);
    color: var(--colour-accent);
    font: inherit;
    font-weight: var(--weight-semibold);
    padding: .375rem .85rem;
    transition: background .16s ease, color .16s ease, border-color .16s ease;
}

.form-control[type="file"]::-webkit-file-upload-button,
input[type="file"]::-webkit-file-upload-button {
    min-height: calc(1.5em + .75rem + 2px);
    margin: 0 .75rem 0 0;
    border: 0;
    border-right: 1px solid rgb(var(--ink-rgb) / .12);
    background: rgb(var(--paper-rgb) / .68);
    color: var(--colour-accent);
    font: inherit;
    font-weight: var(--weight-semibold);
    padding: .375rem .85rem;
    transition: background .16s ease, color .16s ease, border-color .16s ease;
}

.form-control[type="file"]:hover::file-selector-button,
.form-control[type="file"]:focus::file-selector-button,
.form-control[type="file"]:hover::-webkit-file-upload-button,
.form-control[type="file"]:focus::-webkit-file-upload-button,
input[type="file"]:hover::file-selector-button,
input[type="file"]:focus::file-selector-button,
input[type="file"]:hover::-webkit-file-upload-button,
input[type="file"]:focus::-webkit-file-upload-button {
    border-right-color: rgb(var(--accent-rgb) / .2);
    background: rgb(var(--accent-rgb) / .1);
    color: var(--colour-accent);
}

.form-control[type="file"]:focus,
.form-control[type="file"]:focus-visible,
input[type="file"]:focus,
input[type="file"]:focus-visible {
    border-color: rgb(var(--accent-rgb) / .62) !important;
    background: var(--book-paper);
    box-shadow: 0 0 0 .22rem rgb(var(--accent-rgb) / .16) !important;
}

.form-control[type="file"].form-control-lg::file-selector-button,
input[type="file"].form-control-lg::file-selector-button {
    min-height: calc(1.5em + 1rem + 2px);
    padding: .5rem 1rem;
}

.form-control[type="file"].form-control-lg::-webkit-file-upload-button,
input[type="file"].form-control-lg::-webkit-file-upload-button {
    min-height: calc(1.5em + 1rem + 2px);
    padding: .5rem 1rem;
}

.form-check-input {
    accent-color: var(--colour-accent);
    border-color: rgb(var(--ink-rgb) / .2);
    background-color: rgb(var(--white-rgb) / .72);
}

.form-check-input:checked {
    border-color: var(--colour-accent);
    background-color: var(--colour-accent);
}

.btn:focus,
.btn:focus-visible,
.btn:active:focus,
.btn.active:focus,
.btn.show:focus,
.accordion-button:focus,
.page-link:focus,
.nav-link:focus-visible,
.dropdown-item:focus {
    outline: 0 !important;
    box-shadow: 0 0 0 .22rem rgb(var(--accent-rgb) / .16) !important;
}

.btn-close:focus {
    outline: 0 !important;
    box-shadow: 0 0 0 .22rem rgb(var(--accent-rgb) / .16) !important;
    opacity: 1;
}

.nav-underline {
    --bs-nav-underline-link-active-color: var(--colour-ink);
    --bs-nav-underline-border-width: 2px;
    --bs-nav-underline-gap: .85rem;
}

.nav-underline .nav-link {
    color: var(--colour-ink);
    border-bottom-color: transparent;
}

.nav-underline .nav-link:hover,
.nav-underline .nav-link:focus-visible,
.nav-underline .nav-link.active {
    color: var(--colour-ink);
    border-bottom-color: var(--colour-accent) !important;
}

.nav-underline .show > .nav-link,
.nav-underline .nav-link.active {
    border-bottom-color: var(--colour-accent) !important;
}

::selection {
    background: rgb(var(--accent-rgb) / .24);
    color: var(--colour-ink);
}

.book-studio-outline,
.studio-block-editor,
.book-studio-proof-panel,
.book-studio-import-review-body,
.style-browser-list,
.modal-body,
.table-responsive {
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
    scrollbar-width: thin;
}

.book-studio-outline::-webkit-scrollbar,
.studio-block-editor::-webkit-scrollbar,
.book-studio-proof-panel::-webkit-scrollbar,
.book-studio-import-review-body::-webkit-scrollbar,
.style-browser-list::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.book-studio-outline::-webkit-scrollbar-track,
.studio-block-editor::-webkit-scrollbar-track,
.book-studio-proof-panel::-webkit-scrollbar-track,
.book-studio-import-review-body::-webkit-scrollbar-track,
.style-browser-list::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track,
.table-responsive::-webkit-scrollbar-track {
    border-radius: var(--radius-pill);
    background: var(--scrollbar-track);
}

.book-studio-outline::-webkit-scrollbar-thumb,
.studio-block-editor::-webkit-scrollbar-thumb,
.book-studio-proof-panel::-webkit-scrollbar-thumb,
.book-studio-import-review-body::-webkit-scrollbar-thumb,
.style-browser-list::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: var(--radius-pill);
    background: var(--scrollbar-thumb);
    background-clip: padding-box;
}

.book-studio-outline::-webkit-scrollbar-thumb:hover,
.studio-block-editor::-webkit-scrollbar-thumb:hover,
.book-studio-proof-panel::-webkit-scrollbar-thumb:hover,
.book-studio-import-review-body::-webkit-scrollbar-thumb:hover,
.style-browser-list::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover,
.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
    background-clip: padding-box;
}

/* Top bar */

.navbar {
    background: var(--colour-bg);
    border-bottom: 1px solid rgb(var(--ink-rgb) / .08);
}

.navbar .nav-link {
    color: var(--colour-muted-strong);
    font-weight: var(--weight-semibold);
}

.navbar .nav-link:hover,
.navbar .nav-link:focus-visible,
.navbar .nav-link.active {
    color: var(--colour-ink);
}

.deckle-brand {
    font-family: var(--font-serif);
    font-size: 2.3rem;
    font-weight: var(--weight-regular);
    letter-spacing: 0;
    text-decoration: none;
    color: var(--colour-ink);
}

/* Typography */

h1 {
    font-family: var(--font-serif);
    font-size: var(--text-2xl);
    font-weight: var(--weight-regular);
    color: var(--colour-ink);
    line-height: .95;
    letter-spacing: 0;
}

h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-sans);
    font-weight: var(--weight-semibold);
    color: var(--colour-ink);
    line-height: 1.15;
    letter-spacing: 0;
}

h2 {
    font-size: var(--text-xl);
}

h3 {
    font-size: var(--text-lg);
}

h4,
h5,
h6 {
    font-size: var(--text-base);
}

.text-xs { font-size: var(--text-xs) !important; }
.text-sm { font-size: var(--text-sm) !important; }
.text-base { font-size: var(--text-base) !important; }
.text-lg { font-size: var(--text-lg) !important; }
.text-xl { font-size: var(--text-xl) !important; }
.text-2xl { font-size: var(--text-2xl) !important; }

a { 
    color: var(--colour-ink);
    text-decoration: none;
}

.back-link { font-weight: var(--weight-semibold); }

.text-muted {
    color: var(--colour-muted) !important;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: .14em;
    font-size: var(--text-sm);
    color: var(--accent);
    font-weight: var(--weight-semibold);
}

/* App shell */

.deckle-flash-stack {
    position: fixed;
    top: calc(var(--topnav-height) + 1rem);
    right: 1rem;
    z-index: 1080;
    display: grid;
    gap: .65rem;
    width: min(420px, calc(100vw - 2rem));
    pointer-events: none;
}

.deckle-flash {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: .85rem;
    border: 1px solid rgb(var(--ink-rgb) / .1);
    border-left: 4px solid var(--colour-ink);
    border-radius: 10px;
    background: rgb(var(--paper-rgb) / .96);
    box-shadow: 0 18px 50px rgb(var(--ink-rgb) / .14);
    color: var(--colour-ink);
    padding: .95rem 1rem;
    pointer-events: auto;
    transform: translateY(0);
    transition: opacity .18s ease, transform .18s ease;
}

.deckle-flash.is-leaving {
    opacity: 0;
    transform: translateY(-6px);
}

.deckle-flash span {
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    line-height: 1.35;
}

.deckle-flash button {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--colour-muted);
    font-size: var(--text-lg);
    line-height: 1;
    padding: 0;
}

.deckle-flash button:hover {
    background: rgb(var(--ink-rgb) / .08);
    color: var(--colour-ink);
}

.deckle-flash-success {
    border-left-color: var(--colour-success);
}

.deckle-flash-warning {
    border-left-color: var(--accent);
}

.deckle-flash-danger {
    border-left-color: var(--colour-danger);
}

.app-card {
    color: var(--colour-text);
    text-decoration: none;
    box-shadow: var(--shadow-card);
    background: rgb(var(--white-rgb) / .65);
    backdrop-filter: blur(12px);
    border: 1px solid rgb(var(--ink-rgb) / .08);
}

a.app-card {
    transition: transform .18s ease,
        box-shadow .18s ease,
        border-color .18s ease,
        background-color .18s ease;
}

a.app-card:hover {
    transform: translateY(-2px);
    border-color: rgb(var(--accent-rgb) / .22);
    box-shadow: 0 1.25rem 2.5rem rgb(var(--ink-rgb) / .08);
}

.app-card .panel-link {
    font-weight: var(--weight-semibold);
}

.book-back-link {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: var(--ink);
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    line-height: 1.2;
    text-decoration: none;
}

.book-back-link:hover,
.book-back-link:focus-visible {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: .18em;
}


.help-resource-page {
    padding-bottom: 0;
}

.help-resource-hero {
    padding: 5.5rem 0 4.5rem;
}

.help-resource-title {
    max-width: 62rem;
    font-size: clamp(4rem, 9vw, 6rem);
    line-height: .95;
}

.help-resource-summary {
    max-width: 52rem;
    color: var(--colour-muted);
    font-size: var(--text-lg);
    font-weight: var(--weight-regular);
    line-height: 1.65;
}

.help-resource-section {
    border-top: 1px solid var(--line);
    padding: 4.5rem 0 3rem;
}

.help-resource-copy,
.help-resource-side-card {
    background: rgb(var(--white-rgb) / .62);
    border: 1px solid rgb(var(--ink-rgb) / .09);
    border-radius: 1.25rem;
    box-shadow: 0 18px 44px rgb(var(--ink-rgb) / .07);
}

.help-resource-copy {
    padding: clamp(1.5rem, 4vw, 3rem);
}

.help-resource-copy > :first-child {
    margin-top: 0;
}

.help-resource-copy p,
.help-resource-copy li {
    color: var(--colour-muted);
    font-size: var(--text-base);
    line-height: 1.65;
}

.help-resource-copy p,
.help-resource-copy ul,
.help-resource-copy ol {
    margin-bottom: 1.5rem;
}

.help-resource-copy h2,
.help-resource-copy h3,
.help-resource-copy h4 {
    font-family: var(--font-serif);
    font-weight: var(--weight-regular);
    line-height: 1;
}

.help-resource-copy h2 {
    font-size: clamp(2.2rem, 4vw, 3.5rem);
    margin: 2.5rem 0 1rem;
}

.help-resource-copy h3 {
    font-size: clamp(1.8rem, 3vw, 2.45rem);
    margin: 2rem 0 .85rem;
}

.help-resource-copy h4 {
    font-size: var(--text-xl);
    margin: 1.75rem 0 .75rem;
}

.help-resource-copy h2:first-child,
.help-resource-copy h3:first-child,
.help-resource-copy h4:first-child {
    margin-top: 0;
}

.help-resource-copy ul,
.help-resource-copy ol {
    padding-left: 1.2rem;
}

.help-resource-copy li + li {
    margin-top: .35rem;
}

.help-resource-copy a {
    color: var(--accent);
    font-weight: var(--weight-semibold);
    text-decoration: underline;
    text-underline-offset: .18em;
}

.help-resource-copy strong {
    color: var(--colour-ink);
    font-weight: var(--weight-semibold);
}

.help-resource-sidebar {
    position: sticky;
    top: 1.5rem;
    display: grid;
    gap: 1.25rem;
}

.help-resource-side-card {
    padding: 1.5rem;
}

.help-resource-side-card h2 {
    font-family: var(--font-serif);
    font-size: clamp(2.2rem, 4vw, 2.25rem);
    font-weight: var(--weight-regular);
    line-height: 1;
    margin-bottom: .5rem;
}

.help-resource-side-links {
    display: grid;
    gap: .65rem;
}

.help-resource-side-links a {
    border: 1px solid rgb(var(--ink-rgb) / .09);
    border-radius: var(--radius-pill);
    color: var(--colour-ink);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    padding: .65rem .85rem;
    text-align: center;
    text-decoration: none;
}

.help-resource-side-links a:hover,
.help-resource-side-links a:focus-visible {
    background: var(--colour-ink);
    color: var(--colour-paper);
}

@media (max-width: 900px) {
    .help-resource-hero {
        padding: 3rem 0 3.5rem;
    }

    .help-resource-section {
        padding: 3.5rem 0 2.5rem;
    }

    .help-resource-sidebar {
        position: static;
    }
}

.button-link {
    display: inline;
    border: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-weight: var(--weight-semibold);
    padding: 0;
    text-align: inherit;
    text-decoration: none;
}

.button-link:hover,
.button-link:focus-visible {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: .18em;
}

/* Custom ornament manager (style-presets modal) */
.uploaded-ornament-grid {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.uploaded-ornament-row {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .5rem .75rem;
    border: 1px solid rgb(var(--ink-rgb) / .12);
    border-radius: 8px;
}

.uploaded-ornament-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 3.75rem;
    height: 1.6rem;
    color: var(--ink);
}

.uploaded-ornament-preview svg {
    max-width: 100%;
    max-height: 100%;
}

.uploaded-ornament-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.form-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .45rem;
}

.form-label-row .panel-link {
    flex: 0 0 auto;
    font-size: var(--text-sm);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 1.45rem;
    border: 1px solid rgb(var(--accent-rgb) / .24);
    border-radius: var(--radius-pill);
    background: rgb(var(--accent-rgb) / .08);
    color: var(--accent);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: .07em;
    padding: .12rem .55rem;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-pill.muted {
    border-color: rgb(var(--ink-rgb) / .1);
    background: rgb(var(--paper-rgb) / .62);
    color: var(--muted);
}

.status-pill.success {
    border-color: var(--success-line);
    background: var(--success-soft);
    color: var(--success);
}

.status-pill.warning {
    border-color: var(--accent-line);
    background: var(--accent-soft);
    color: var(--accent);
}

.status-pill.manual {
    border-color: rgb(var(--accent-rgb) / .28);
    background: rgb(var(--accent-rgb) / .1);
    color: var(--accent);
}

.setting-label-with-hint {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.setting-hint {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    border: 1px solid rgb(var(--ink-rgb) / .16);
    border-radius: var(--radius-pill);
    background: var(--white-glass);
    color: var(--muted);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    line-height: 1;
    text-transform: none;
    cursor: help;
}

.setting-hint-warning {
    border-color: var(--accent-line);
    background: var(--accent-soft);
    color: var(--accent);
}

.setting-hint::after {
    position: absolute;
    bottom: calc(100% + .55rem);
    left: 50%;
    z-index: 30;
    width: min(17rem, 70vw);
    border: 1px solid rgb(var(--ink-rgb) / .1);
    border-radius: var(--radius-sm);
    background: rgb(var(--paper-rgb) / .98);
    box-shadow: var(--shadow-soft);
    color: var(--colour-text);
    content: attr(data-tooltip);
    font-size: var(--text-sm);
    font-weight: var(--weight-regular);
    letter-spacing: 0;
    line-height: 1.45;
    opacity: 0;
    padding: .65rem .75rem;
    pointer-events: none;
    text-transform: none;
    transform: translate(-50%, .2rem);
    transition: opacity .15s ease, transform .15s ease;
    visibility: hidden;
    white-space: normal;
}

.setting-hint:hover::after,
.setting-hint:focus-visible::after {
    opacity: 1;
    transform: translate(-50%, 0);
    visibility: visible;
}


.deckle-modal {
    border: 1px solid rgb(var(--ink-rgb) / .1);
    border-radius: 14px;
    background: var(--paper);
    color: var(--colour-text);
    box-shadow: 0 1.4rem 4rem rgb(var(--ink-rgb) / .18);
}

.deckle-modal .modal-header,
.deckle-modal .modal-footer {
    border-color: rgb(var(--ink-rgb) / .1);
}

.deckle-modal .modal-title {
    font-family: var(--font-sans);
    font-size: var(--text-xl) !important;
    font-weight: var(--weight-semibold);
    letter-spacing: 0;
}

/* Shared app page layout */

.app-page-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.app-page-header > :first-child {
    min-width: 0;
}

.app-page-header .lead {
    max-width: 46rem;
}

.app-page-actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

@media (min-width: 992px) {
    .app-page-header {
        flex-direction: row;
        align-items: flex-end;
    }

    .app-page-actions {
        justify-content: flex-end;
    }
}

.app-empty-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 24rem);
    gap: 1.25rem;
    align-items: stretch;
}

.app-empty-card {
    display: flex;
    min-height: 17rem;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

.app-empty-card h2 {
    margin-bottom: .75rem;
    line-height: .95;
}

.app-empty-card .eyebrow,
.app-note-card .eyebrow,
.series-card .eyebrow {
    color: var(--colour-accent);
}

.app-empty-card p {
    max-width: 36rem;
    color: var(--muted);
}

.app-note-card {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.app-note-card ul {
    display: grid;
    gap: .75rem;
    margin: 0;
    padding-left: 1.1rem;
    color: var(--muted);
}

/* Series catalogue */

.series-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
    gap: 1.25rem;
}

.series-card {
    display: flex;
    min-height: 20rem;
    flex-direction: column;
}

.series-card-covers {
    display: flex;
    align-items: flex-end;
    min-height: 7.25rem;
    margin-bottom: 1.1rem;
    padding: .25rem 0 .35rem;
}

.series-card-cover {
    display: grid;
    place-items: center;
    overflow: hidden;
    width: clamp(3.3rem, 6.2vw, 4.6rem);
    aspect-ratio: 2 / 3;
    border: 1px solid rgb(var(--ink-rgb) / .12);
    border-radius: 6px;
    background:
        linear-gradient(150deg, rgb(var(--white-rgb) / .64), rgb(var(--paper-rgb) / .86)),
        var(--warm);
    box-shadow:
        6px 12px 22px rgb(var(--ink-rgb) / .13),
        inset 8px 0 14px rgb(var(--ink-rgb) / .04);
    color: var(--accent);
    font-family: var(--font-sans);
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    transition: transform .18s ease;
}

.series-card-cover + .series-card-cover {
    margin-left: -1.2rem;
}

.series-card-cover:nth-child(2) {
    transform: translateY(.32rem);
}

.series-card-cover:nth-child(3) {
    transform: translateY(.65rem);
}

.series-card-cover:nth-child(4) {
    transform: translateY(.98rem);
}

.series-card:hover .series-card-cover:nth-child(2) {
    transform: translate(.18rem, .25rem);
}

.series-card:hover .series-card-cover:nth-child(3) {
    transform: translate(.36rem, .5rem);
}

.series-card:hover .series-card-cover:nth-child(4) {
    transform: translate(.54rem, .75rem);
}

.series-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.series-card-cover.is-empty {
    border-style: dashed;
    color: rgb(var(--ink-rgb) / .24);
}

.series-card h3 {
    margin-bottom: .75rem;
    line-height: 1;
}

.series-card .text-muted {
    color: var(--muted) !important;
}

.series-card-meta {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    align-items: center;
    margin-top: auto;
    color: var(--muted);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
}

.series-card-meta span {
    color: var(--accent);
}

.series-book-list {
    display: grid;
    gap: .65rem;
}

.series-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    justify-content: flex-end;
}

.series-box-set-create-form {
    margin: 0;
}

.series-detail-actions .series-box-set-create-form {
    display: contents;
}

.series-primary-panel,
.series-secondary-panel,
.series-secondary-stack {
    min-width: 0;
}

.series-secondary-stack {
    display: grid;
    gap: 1rem;
}

.series-section-head {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    justify-content: space-between;
}

.series-section-head h2 {
    font-family: var(--font-sans);
}

.series-readiness-card {
    border-color: rgb(var(--accent-rgb) / .18);
}

.series-readiness-card.is-ready {
    background: linear-gradient(135deg, rgb(var(--white-rgb) / .82), rgb(var(--accent-rgb) / .05));
}

.series-readiness-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .65rem;
}

.series-readiness-grid div {
    border: 1px solid rgb(var(--ink-rgb) / .08);
    border-radius: 8px;
    background: rgb(var(--white-rgb) / .52);
    padding: .7rem;
}

.series-readiness-grid span,
.series-readiness-grid strong {
    display: block;
}

.series-readiness-grid span {
    color: var(--colour-muted);
    font-size: var(--text-sm);
}

.series-readiness-grid strong {
    color: var(--colour-ink);
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
}

.series-guidance {
    color: var(--colour-muted);
    font-size: var(--text-sm);
}

.series-order-note {
    display: grid;
    gap: .35rem;
    border: 1px solid rgb(var(--accent-rgb) / .22);
    border-radius: 8px;
    background: rgb(var(--accent-rgb) / .06);
    padding: .75rem .85rem;
}

.series-order-note p {
    margin: 0;
    color: var(--colour-muted);
    font-size: var(--text-sm);
}

.series-order-note strong {
    color: var(--colour-ink);
    font-weight: var(--weight-semibold);
}

.series-order-form {
    display: grid;
    gap: .85rem;
}

.series-book-row {
    display: grid;
    grid-template-columns: 2rem 2.35rem 2.35rem minmax(0, 1fr) auto;
    gap: .75rem;
    align-items: center;
    border: 1px solid rgb(var(--ink-rgb) / .08);
    border-radius: 8px;
    background: rgb(var(--white-rgb) / .48);
    color: var(--colour-text);
    padding: .62rem .7rem;
    text-decoration: none;
    transition: border-color .18s ease, background-color .18s ease, transform .18s ease;
}

.series-book-row:hover {
    transform: translateY(-1px);
    border-color: rgb(var(--accent-rgb) / .22);
    background: rgb(var(--white-rgb) / .72);
}

.series-book-row.has-position-warning {
    border-color: rgb(var(--accent-rgb) / .28);
    background: rgb(var(--accent-rgb) / .04);
}

.series-book-row.is-dragging {
    opacity: .56;
}

.series-book-row.is-drop-target {
    border-color: rgb(var(--accent-rgb) / .42);
    background: rgb(var(--accent-rgb) / .08);
}

.series-order-drag-handle {
    width: 2rem;
    height: 2rem;
    touch-action: none;
}

.series-book-number {
    color: var(--accent);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    text-align: center;
}

.series-position-badge {
    display: grid;
    place-items: center;
    width: 2.35rem;
    aspect-ratio: 1;
    border: 1px solid rgb(var(--accent-rgb) / .22);
    border-radius: 999px;
    background: rgb(var(--white-rgb) / .62);
    color: var(--accent);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
}

.series-book-summary {
    min-width: 0;
    text-align: left;
}

.series-book-row .status-pill {
    justify-self: end;
}

.series-order-actions {
    display: flex;
    justify-content: flex-end;
}

.series-add-books-form {
    display: grid;
    gap: .75rem;
}

.series-add-books-list {
    display: grid;
    gap: .45rem;
    max-height: 18rem;
    overflow: auto;
    padding-right: .1rem;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
    scrollbar-width: thin;
}

.series-add-books-list label {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: .55rem;
    align-items: start;
    margin: 0;
    border: 1px solid rgb(var(--ink-rgb) / .08);
    border-radius: 8px;
    background: rgb(var(--white-rgb) / .5);
    padding: .58rem .65rem;
}

.series-add-books-list strong,
.series-add-books-list small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.series-add-books-list strong {
    color: var(--colour-ink);
    font-size: var(--text-base);
}

.series-add-books-list small {
    color: var(--colour-muted);
    font-size: var(--text-sm);
}

.series-derived-list {
    display: grid;
    gap: .55rem;
    margin-top: .9rem;
}

.series-derived-row {
    display: grid;
    grid-template-columns: 2.35rem minmax(0, 1fr) auto;
    gap: .65rem;
    align-items: center;
    border: 1px solid rgb(var(--ink-rgb) / .08);
    border-radius: 8px;
    background: rgb(var(--white-rgb) / .5);
    padding: .62rem .7rem;
}

.series-derived-row .status-pill {
    justify-self: end;
}

.series-book-cover {
    display: grid;
    place-items: center;
    overflow: hidden;
    width: 2.35rem;
    aspect-ratio: 2 / 3;
    border: 1px solid rgb(var(--ink-rgb) / .12);
    border-radius: 4px;
    background: linear-gradient(145deg, var(--paper), var(--warm));
    color: var(--accent);
    font-family: var(--font-sans);
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
}

.series-book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.series-book-row strong,
.series-book-row small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.series-modal-choice {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
}

.series-modal-choice h3 {
    margin-bottom: .25rem;
    font-family: var(--font-sans);
}

.series-book-row strong {
    color: var(--ink);
    font-size: var(--text-base);
}

.series-book-row small {
    color: var(--muted);
    font-size: var(--text-sm);
}

.box-set-book-list {
    display: grid;
    gap: .65rem;
}

.box-set-book-row {
    display: grid;
    grid-template-columns: auto 2rem 2.35rem minmax(0, 1fr);
    gap: .75rem;
    align-items: center;
    border: 1px solid rgb(var(--ink-rgb) / .08);
    border-radius: 8px;
    background: rgb(var(--white-rgb) / .48);
    padding: .62rem .7rem;
    cursor: pointer;
}

.box-set-book-row.is-disabled {
    cursor: not-allowed;
    opacity: .62;
}

.box-set-book-row input {
    margin: 0;
}

.box-set-book-row strong,
.box-set-book-row small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.box-set-book-row strong {
    color: var(--ink);
    font-size: var(--text-base);
}

.box-set-book-row small {
    color: var(--muted);
    font-size: var(--text-sm);
}

.box-set-book-row .box-set-book-meta {
    color: var(--muted);
}

.books-index .app-empty-grid {
    grid-template-columns: minmax(0, 1fr) minmax(18rem, .8fr);
    align-items: start;
}

.books-index .app-note-card {
    background: rgb(var(--paper-rgb) / .78);
}

.books-help-links {
    display: grid;
    gap: .65rem;
    margin-top: 1rem;
}

.books-help-links a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .72rem .82rem;
    border: 1px solid rgb(var(--ink-rgb) / .1);
    border-radius: var(--radius-sm);
    background: rgb(var(--white-rgb) / .58);
    color: var(--colour-text);
    font-weight: var(--weight-semibold);
    text-decoration: none;
}

.books-help-links a::after {
    content: "→";
    color: var(--colour-accent);
}

.books-help-links a:hover,
.books-help-links a:focus {
    border-color: rgb(var(--accent-rgb) / .34);
    background: rgb(var(--accent-rgb) / .08);
    color: var(--colour-accent);
}

.book-library-toolbar {
    border-bottom: 1px solid rgb(var(--ink-rgb) / .09);
    margin-bottom: 1.25rem;
    padding-bottom: 1.35rem;
}

.book-library-toolbar .form-label {
    color: var(--colour-muted-strong);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
}

.book-library-count-cell {
    display: flex;
    align-items: end;
    justify-content: flex-end;
    min-height: calc(1.5em + .75rem + 2px + 1.35rem);
}

.book-studio-manuscript-stats {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem .5rem;
    margin: .75rem 0 .7rem;
}

.book-studio-manuscript-stats span {
    display: inline-flex;
    align-items: baseline;
    gap: .22rem;
    min-width: 0;
    color: var(--muted);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    line-height: 1.2;
}

.book-studio-manuscript-stats strong {
    color: var(--ink);
    font-size: var(--text-sm);
    letter-spacing: 0;
    white-space: nowrap;
}

.book-studio-manuscript-stats em {
    font-style: normal;
    white-space: nowrap;
}

.publishing-progress-card,
.studio-progress-list {
    display: grid;
    gap: .55rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.publishing-progress-card {
    margin-bottom: .7rem;
    border-top: 1px solid rgb(var(--ink-rgb) / .08);
    border-bottom: 1px solid rgb(var(--ink-rgb) / .08);
    padding-block: .75rem;
}

.publishing-progress-card .eyebrow {
    margin: 0;
}

.publishing-progress-card li,
.studio-progress-list li {
    display: grid;
    grid-template-columns: 1rem minmax(0, 1fr);
    gap: .45rem;
    align-items: start;
    color: var(--colour-muted);
}

.publishing-progress-card li > span,
.studio-progress-list li > span {
    width: .78rem;
    height: .78rem;
    margin-top: .25rem;
    border: 1px solid rgb(var(--ink-rgb) / .16);
    border-radius: var(--radius-pill);
    background: rgb(var(--white-rgb) / .46);
}

.publishing-progress-card li.is-complete > span,
.studio-progress-list li.is-complete > span {
    border-color: rgb(var(--accent-rgb) / .34);
    background: var(--colour-accent);
    box-shadow: inset 0 0 0 3px var(--colour-paper);
}

.publishing-progress-card strong,
.publishing-progress-card small,
.publishing-progress-card .button-link,
.studio-progress-list strong,
.studio-progress-list small,
.studio-progress-list .button-link {
    display: block;
    font-size: var(--text-sm);
    line-height: 1.3;
}

.publishing-progress-card strong,
.studio-progress-list strong {
    color: var(--colour-ink);
    font-weight: var(--weight-semibold);
}

.publishing-progress-card small,
.publishing-progress-card .button-link,
.studio-progress-list small,
.studio-progress-list .button-link {
    color: var(--colour-muted);
}

.studio-progress-list {
    gap: .75rem;
}

.book-library-groups {
    display: grid;
    gap: 1.25rem;
}

.book-library-group-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .8rem;
}

.book-library-group:last-child {
    margin-bottom: 0;
}

.book-library-empty {
    border: 1px solid rgb(var(--ink-rgb) / .08);
    border-radius: 8px;
    background: rgb(var(--white-rgb) / .36);
    color: var(--colour-muted-strong);
    font-weight: var(--weight-semibold);
    margin: 0;
    padding: 1.25rem;
}

.book-library-group-head h2 {
    margin: 0;
}

.book-library-group-head > span {
    color: var(--colour-muted);
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    white-space: nowrap;
}

.book-catalogue-card {
    position: relative;
    display: grid;
    color: var(--colour-text);
    padding: 0;
    transition: transform .18s ease;
}

.book-catalogue-card:hover {
    transform: translateY(-3px);
}

.book-catalogue-main {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: .9rem;
    color: inherit;
    text-decoration: none;
}

.book-catalogue-meta {
    display: grid;
    align-content: start;
    gap: .28rem;
    min-height: 8rem;
    padding: 0 .15rem;
}

.book-catalogue-meta > span:not(.book-catalogue-kicker) {
    color: var(--colour-muted-strong);
    font-weight: var(--weight-semibold);
}

.book-catalogue-card small {
    align-self: end;
    color: var(--colour-muted);
    font-size: var(--text-sm);
}

.book-cover-status {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin-top: .25rem;
    border: 1px solid rgb(var(--accent-rgb) / .22);
    border-radius: var(--radius-pill);
    background: rgb(var(--accent-rgb) / .08);
    color: var(--accent) !important;
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: .08em;
    line-height: 1.1;
    padding: .26rem .55rem;
    text-transform: uppercase;
}

.book-catalogue-kicker {
    color: var(--colour-accent);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: .12em;
    text-transform: uppercase;
}

.book-catalogue-actions {
    position: absolute;
    top: .55rem;
    right: .55rem;
    z-index: 3;
}

.book-catalogue-action-button {
    display: inline-grid;
    place-items: center;
    width: 2.1rem;
    height: 2.1rem;
    border: 1px solid rgb(var(--ink-rgb) / .12);
    border-radius: 999px;
    background: var(--paper-strong);
    color: var(--colour-ink);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    letter-spacing: -.08em;
    line-height: 1;
    box-shadow: 0 .55rem 1.4rem rgb(var(--ink-rgb) / .12);
}

.book-catalogue-action-button:hover,
.book-catalogue-action-button:focus-visible,
.book-catalogue-action-button.show {
    border-color: rgb(var(--accent-rgb) / .34);
    background: var(--paper);
    color: var(--colour-accent);
}

.deckle-dropdown-menu {
    min-width: 12rem;
    border: 1px solid rgb(var(--ink-rgb) / .1);
    border-radius: 10px;
    background: var(--paper);
    box-shadow: 0 1rem 2.4rem rgb(var(--ink-rgb) / .16);
    padding: .35rem;
}

.deckle-dropdown-menu .dropdown-item {
    border-radius: 8px;
    color: var(--colour-text);
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    padding: .62rem .72rem;
}

.deckle-dropdown-menu .dropdown-item:hover,
.deckle-dropdown-menu .dropdown-item:focus {
    background: rgb(var(--accent-rgb) / .09);
    color: var(--colour-accent);
}

.deckle-dropdown-menu .dropdown-item.text-danger {
    color: var(--danger) !important;
}

.deckle-dropdown-menu .dropdown-item.text-danger:hover,
.deckle-dropdown-menu .dropdown-item.text-danger:focus {
    background: var(--danger-soft);
    color: var(--danger) !important;
}

.book-cover-frame {
    display: grid;
    place-items: center;
    aspect-ratio: 2 / 3;
    border: 1px solid rgb(var(--ink-rgb) / .09);
    border-radius: 8px;
    background:
        linear-gradient(150deg, rgb(var(--white-rgb) / .6), rgb(var(--paper-rgb) / .78)),
        var(--warm);
    box-shadow:
        inset 0 0 0 1px rgb(var(--white-rgb) / .44),
        8px 16px 28px rgb(var(--ink-rgb) / .13),
        inset 10px 0 16px rgb(var(--ink-rgb) / .03);
    overflow: hidden;
}

.book-cover-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-cover-placeholder {
    display: grid;
    place-items: center;
    width: 78%;
    height: 84%;
    border: 1px solid rgb(var(--accent-rgb) / .18);
    background:
        linear-gradient(180deg, rgb(var(--paper-rgb) / .96), rgb(var(--paper-rgb) / .78));
    color: var(--colour-accent);
    font-family: var(--font-sans);
    font-size: var(--text-2xl);
    font-weight: var(--weight-semibold);
}

.export-history-filters {
    display: flex;
    gap: 1rem;
    align-items: end;
    justify-content: space-between;
    border-bottom: 1px solid rgb(var(--ink-rgb) / .08);
    padding-bottom: 1rem;
}

.export-history-filters label {
    display: grid;
    gap: .35rem;
    width: min(100%, 28rem);
}

.export-history-filters label span {
    color: var(--colour-muted-strong);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
}

.export-history-filter-count {
    margin-left: auto;
}


.export-bulk-delete-form {
    margin: 0;
}

.export-bulk-toolbar {
    display: flex;
    gap: .75rem;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: .75rem;
    color: var(--colour-muted-strong);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
}

.export-history-select-col {
    width: 2.6rem;
    text-align: center;
}

.export-delete-modal .modal-body p:first-child {
    color: var(--colour-text);
    font-weight: var(--weight-semibold);
}

.export-history-table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--colour-text);
}

.export-history-table thead th {
    border-bottom: 1px solid rgb(var(--ink-rgb) / .1);
    color: var(--accent);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    letter-spacing: .08em;
    text-transform: uppercase;
}

.export-history-table tbody td {
    border-color: rgb(var(--ink-rgb) / .07);
    padding-block: .95rem;
    vertical-align: middle;
}

.export-history-actions {
    display: inline-flex;
    justify-content: flex-end;
    gap: .45rem;
    flex-wrap: wrap;
}

.export-history-actions form {
    margin: 0;
}

.empty-state-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin-top: 1rem;
}

@media (max-width: 760px) {
    .export-history-table,
    .export-history-table thead,
    .export-history-table tbody,
    .export-history-table th,
    .export-history-table td,
    .export-history-table tr {
        display: block;
    }

    .export-history-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }

    .export-history-table tbody tr {
        padding: .85rem 1rem;
        border-bottom: 1px solid rgb(var(--ink-rgb) / .08);
    }

    .export-history-table tbody tr:last-child {
        border-bottom: 0;
    }

    .export-history-table tbody td {
        display: grid;
        grid-template-columns: minmax(6.5rem, .38fr) minmax(0, 1fr);
        gap: .75rem;
        border: 0;
        padding: .38rem 0;
        text-align: left !important;
    }

    .export-history-table tbody td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: var(--text-xs);
        font-weight: var(--weight-semibold);
        letter-spacing: .08em;
        text-transform: uppercase;
    }

    .export-history-actions {
        justify-content: flex-start;
    }
}

.book-library-empty[hidden],
.book-library-group[hidden],
[data-book-item][hidden] {
    display: none !important;
}

/* Buttons */

.btn { 
    border-radius: 999px;
    padding: .75rem 1.2rem;
    font-weight: var(--weight-semibold);
}

.btn-dark {
    background: var(--colour-ink);
    border-color: var(--colour-ink);
    color: var(--colour-paper);
}

.btn-dark:hover,
.btn-dark:focus-visible {
    background: var(--colour-black);
    border-color: var(--colour-black);
    color: var(--colour-paper);
}

.btn-outline-dark {
    border-color: rgb(var(--ink-rgb) / .22);
    color: var(--colour-ink);
}

.btn-outline-dark:hover,
.btn-outline-dark:focus-visible {
    background: var(--colour-ink);
    border-color: var(--colour-ink);
    color: var(--colour-paper);
}

.min-w-0 {
    min-width: 0;
}

.app-body:has(.book-studio),
.app-main:has(.book-studio),
.app-main-inner:has(.book-studio) {
    overflow: hidden;
}

.app-body:has(.style-presets-index),
.app-main:has(.style-presets-index),
.app-main-inner:has(.style-presets-index) {
    overflow: visible;
}

/* Book Studio */

.book-studio-import-review {
    position: relative;
    z-index: 2;
    border: 1px solid rgb(var(--ink-rgb) / .1);
    border-radius: 12px;
    background: var(--colour-paper);
    box-shadow: none;
    margin-bottom: .75rem;
    padding: .82rem 1rem;
}

.book-studio-panel .book-studio-import-review {
    margin-top: .85rem;
    margin-bottom: 0;
    padding: .7rem;
}

.book-studio-import-review.needs-attention {
    border-color: rgb(var(--accent-rgb) / .25);
    background: var(--colour-paper);
}

.book-studio-import-review summary {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.book-studio-import-review summary span {
    display: grid;
    gap: .1rem;
}

.book-studio-import-review summary strong {
    color: var(--colour-ink);
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
}

.book-studio-import-review summary small,
.book-studio-import-review summary em {
    color: var(--colour-muted);
    font-size: var(--text-sm);
    font-style: normal;
    font-weight: var(--weight-semibold);
}

.book-studio-import-review summary em {
    border: 1px solid rgb(var(--ink-rgb) / .1);
    border-radius: var(--radius-pill);
    background: rgb(var(--white-rgb) / .58);
    color: var(--colour-accent);
    padding: .32rem .58rem;
    white-space: nowrap;
}

.book-studio-import-review-body {
    display: grid;
    gap: .75rem;
    max-height: min(34vh, 18rem);
    margin-top: .85rem;
    overflow: auto;
    padding-right: .2rem;
}

.book-studio-import-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
    gap: .55rem;
}

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

.book-studio-import-stats span {
    display: grid;
    gap: .1rem;
    border: 1px solid rgb(var(--ink-rgb) / .08);
    border-radius: 10px;
    background: rgb(var(--white-rgb) / .5);
    color: var(--colour-muted);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    padding: .58rem;
}

.book-studio-import-stats strong {
    color: var(--colour-ink);
    font-size: var(--text-base);
}

.book-studio-import-samples {
    display: grid;
    gap: .45rem;
}

.book-studio-import-samples span {
    display: grid;
    gap: .12rem;
    border-left: 3px solid rgb(var(--accent-rgb) / .42);
    background: rgb(var(--white-rgb) / .38);
    color: var(--colour-muted-strong);
    font-size: var(--text-sm);
    line-height: 1.38;
    padding: .5rem .65rem;
}

.book-studio-import-samples strong {
    color: var(--colour-ink);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    letter-spacing: .08em;
    text-transform: uppercase;
}

.book-studio-import-review ul,
.book-studio-import-review p {
    margin: 0;
    color: var(--colour-muted-strong);
    font-size: var(--text-base);
    line-height: 1.42;
}

.book-studio-import-review ul {
    display: grid;
    gap: .35rem;
    padding-left: 1rem;
}

.book-studio-sidebar-status {
    display: grid;
    gap: .45rem;
    margin: .7rem 0 .2rem;
    border-block: 1px solid rgb(var(--ink-rgb) / .08);
    padding-block: .55rem;
}

.studio-status-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .65rem;
    align-items: center;
    min-width: 0;
    border-radius: 8px;
    padding: .28rem 0;
}

.studio-status-row > div {
    display: grid;
    gap: .08rem;
    min-width: 0;
}

.studio-status-row strong {
    color: var(--colour-ink);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    line-height: 1.25;
}

.studio-status-row small {
    min-width: 0;
    overflow: hidden;
    color: var(--colour-muted);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.studio-status-row small span {
    overflow-wrap: anywhere;
}

.studio-status-row.needs-attention strong {
    color: var(--colour-accent);
}

.studio-status-row .button-link {
    align-self: center;
    color: var(--colour-accent);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    white-space: nowrap;
}

.studio-review-section {
    display: grid;
    gap: .65rem;
}

.studio-review-section + .studio-review-section {
    margin-top: 1.25rem;
    border-top: 1px solid rgb(var(--ink-rgb) / .08);
    padding-top: 1.25rem;
}

.studio-review-section h3 {
    margin: 0;
    color: var(--colour-ink);
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
}

.studio-review-section p {
    margin: 0;
    color: var(--colour-muted-strong);
    font-size: var(--text-base);
    line-height: 1.45;
}

.studio-review-warning-list {
    display: grid;
    gap: .45rem;
    margin: 0;
    padding-left: 1.1rem;
    color: var(--colour-muted-strong);
    font-size: var(--text-base);
    line-height: 1.45;
}

.studio-review-finding-list {
    display: grid;
    gap: .75rem;
}

.studio-review-finding {
    display: grid;
    gap: .45rem;
    border: 1px solid rgb(var(--ink-rgb) / .1);
    border-radius: 8px;
    background: rgb(var(--white-rgb) / .58);
    padding: .8rem .9rem;
}

.studio-review-finding.severity-important {
    border-color: rgb(var(--accent-rgb) / .28);
    background: rgb(var(--accent-rgb) / .07);
}

.studio-review-finding div {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem .65rem;
    align-items: center;
}

.studio-review-finding span {
    border: 1px solid rgb(var(--ink-rgb) / .12);
    border-radius: 999px;
    padding: .12rem .45rem;
    color: var(--colour-muted-strong);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: .08em;
    text-transform: uppercase;
}

.studio-review-finding.severity-important span {
    border-color: rgb(var(--accent-rgb) / .28);
    color: var(--colour-accent);
}

.studio-review-finding strong {
    color: var(--colour-ink);
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
}

.studio-review-finding p,
.studio-review-finding small {
    margin: 0;
    color: var(--colour-muted-strong);
    font-size: var(--text-sm);
    line-height: 1.45;
}

.studio-review-finding small strong {
    font-size: inherit;
}

.book-studio-import-next {
    display: grid;
    gap: .12rem;
    border: 1px solid rgb(var(--accent-rgb) / .16);
    border-radius: 8px;
    background: rgb(var(--accent-rgb) / .07);
    padding: .7rem .8rem;
}

.book-studio-import-next strong {
    color: var(--colour-ink);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    letter-spacing: .08em;
    text-transform: uppercase;
}

.book-studio-import-next span {
    color: var(--colour-muted-strong);
    font-size: var(--text-sm);
    line-height: 1.4;
}

.danger-zone {
    border: 1px solid var(--danger-line);
    border-radius: 10px;
    background: var(--surface-soft);
    padding: .9rem;
}

.danger-zone h3 {
    margin-bottom: .25rem;
    font-size: var(--text-base);
}

.import-prep-card {
    border: 1px solid rgb(var(--ink-rgb) / .09);
    border-radius: 8px;
    background: rgb(var(--white-rgb) / .46);
    padding: 1rem;
}

.import-prep-card ul {
    display: grid;
    gap: .35rem;
    margin: 0 0 .85rem;
    padding-left: 1.1rem;
    color: var(--muted-strong);
    font-size: var(--text-base);
    line-height: 1.45;
}

.book-studio {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--topnav-height) - var(--workspace-gap));
    background: var(--colour-bg);
    color: var(--colour-ink);
    overflow: hidden;
}

.studio-text-link {
    color: var(--muted);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    text-decoration: none;
}

.book-studio-panel-head p,
.book-studio-proof-head p {
    margin: 0;
}

.studio-text-button {
    border: 0;
    background: transparent;
    padding: 0;
}

.studio-icon-button {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgb(var(--ink-rgb) / .12);
    border-radius: var(--radius-pill);
    background: rgb(var(--white-rgb) / .5);
    color: var(--muted-strong);
    font-size: var(--text-base);
    line-height: 1;
}

.studio-icon-button:hover {
    background: var(--colour-ink);
    color: var(--colour-paper);
}

.studio-details-button {
    flex: 0 0 auto;
    min-height: 2.15rem;
    padding-inline: .8rem;
    white-space: nowrap;
}

.book-studio-shell {
    flex: 1 1 auto;
    min-height: 0;
    box-sizing: border-box;
    padding-block: 1rem;
    overflow: hidden;
    --book-studio-outline-width: clamp(18rem, 22vw, 24rem);
}

.book-studio-shell > .row {
    height: 100%;
    min-height: 0;
}

.book-studio-sidebar,
.book-studio-editor,
.book-studio-proof {
    height: 100%;
    min-height: 0;
}

.book-studio-outline-resizer {
    display: none;
}

@media (min-width: 1200px) {
    .book-studio-shell > .row[data-book-studio-workspace] {
        --bs-gutter-x: 0;
        --bs-gutter-y: 0;
        display: grid;
        grid-template-columns:
            minmax(14rem, var(--book-studio-outline-width))
            .75rem
            minmax(28rem, 1fr)
            minmax(26rem, clamp(28rem, 31vw, 34rem));
        gap: 1rem;
        margin: 0;
    }

    /* Preview collapsed: drop the 4th (proof) column so the editor expands. */
    .book-studio.is-preview-collapsed .book-studio-shell > .row[data-book-studio-workspace] {
        grid-template-columns:
            minmax(14rem, var(--book-studio-outline-width))
            .75rem
            minmax(28rem, 1fr);
    }

    .book-studio-shell > .row[data-book-studio-workspace] > .book-studio-sidebar,
    .book-studio-shell > .row[data-book-studio-workspace] > .book-studio-editor,
    .book-studio-shell > .row[data-book-studio-workspace] > .book-studio-proof {
        width: auto;
        max-width: none;
        padding: 0;
    }

    .book-studio-outline-resizer {
        position: relative;
        display: block;
        align-self: stretch;
        width: .75rem;
        min-width: .75rem;
        border: 0;
        border-radius: var(--radius-pill);
        background: transparent;
        cursor: col-resize;
        touch-action: none;
    }

    .book-studio-outline-resizer::before {
        content: "";
        position: absolute;
        top: 1rem;
        bottom: 1rem;
        left: 50%;
        width: 1px;
        transform: translateX(-50%);
        background: rgb(var(--ink-rgb) / .12);
    }

    .book-studio-outline-resizer:hover::before,
    .book-studio-outline-resizer:focus-visible::before,
    .book-studio.is-resizing-outline .book-studio-outline-resizer::before {
        width: 2px;
        background: var(--colour-accent);
    }

    .book-studio-outline-resizer:focus-visible {
        outline: 2px solid rgb(var(--accent-rgb) / .35);
        outline-offset: 2px;
    }

    .book-studio.is-resizing-outline,
    .book-studio.is-resizing-outline * {
        cursor: col-resize !important;
        user-select: none;
    }
}

/* Preview collapse (all breakpoints): hide the proof column and swap the
   in-panel "Hide preview" button for a floating "Preview" tab on the edge. */
.book-studio.is-preview-collapsed .book-studio-proof {
    display: none;
}

.book-studio-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    padding: 0;
    color: var(--ink);
    background: transparent;
    border: 1px solid rgb(var(--ink-rgb) / .2);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color .12s ease, border-color .12s ease;
}

.book-studio-icon-button:hover {
    background: rgb(var(--ink-rgb) / .06);
    border-color: rgb(var(--ink-rgb) / .32);
}

.book-studio-icon-button:focus-visible {
    outline: 2px solid rgb(var(--accent-rgb) / .45);
    outline-offset: 2px;
}

.book-studio-preview-expand {
    display: none;
}

.book-studio.is-preview-collapsed .book-studio-preview-expand {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    z-index: 1030;
    padding: .55rem .7rem;
    font-size: .8rem;
    font-weight: 600;
    line-height: 1;
    color: var(--paper);
    background: var(--ink);
    border: 0;
    border-radius: var(--radius-pill) 0 0 var(--radius-pill);
    box-shadow: 0 2px 10px rgb(var(--ink-rgb) / .25);
    cursor: pointer;
}

.book-studio.is-preview-collapsed .book-studio-preview-expand:hover {
    background: var(--colour-accent, var(--ink));
}

.book-studio.is-preview-collapsed .book-studio-preview-expand:focus-visible {
    outline: 2px solid rgb(var(--accent-rgb) / .45);
    outline-offset: 2px;
}

.book-studio-panel {
    min-width: 0;
    border: 1px solid rgb(var(--ink-rgb) / .1);
    border-radius: 10px;
    background: rgb(var(--paper-rgb) / .58);
    box-shadow: var(--shadow-soft);
    padding: 1rem;
}

.book-studio-panel-sticky,
.book-studio-proof-panel,
.book-studio-editor-form {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.book-studio-proof-panel {
    overflow-x: hidden;
    overflow-y: auto;
}

.book-studio-proof-panel.sticky-xl-top .book-studio-device-stage {
    place-items: center;
}

.book-studio-proof-panel.sticky-xl-top .book-studio-device-frame {
    transform-origin: center center;
    transition: none;
}

.book-studio-panel-head,
.book-studio-proof-head,
.book-studio-editor-head,
.book-studio-editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.book-studio-outline-select-bar {
    display: flex;
    justify-content: flex-start;
    margin: .82rem 0 -.58rem;
}


.book-studio-outline-select-bar .button-link,
.book-studio-outline-bulk-toolbar .button-link {
    align-self: center;
    color: var(--colour-accent);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    white-space: nowrap;
}

.book-studio-outline-bulk-toolbar .button-link:disabled {
    color: var(--muted);
    cursor: default;
    opacity: .72;
    text-decoration: none;
}

.book-studio-outline-bulk-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: .55rem;
    margin: .72rem 0 -.55rem;
    padding: 0;
}

.book-studio-outline-bulk-toolbar[hidden] {
    display: none;
}

.book-studio-outline-bulk-toolbar span {
    color: var(--muted);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
}

.book-studio-panel-head h2,
.book-studio-proof-head h2,
.book-studio-editor-head h2 {
    margin: 0;
    font-size: var(--text-base);
}

.book-studio-outline {
    display: grid;
    gap: .25rem;
    margin-top: 1rem;
    min-height: 0;
    overflow: auto;
    padding-right: .2rem;
}

.book-studio-outline-form {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}

.book-studio-group-label {
    margin: 1rem 0 .35rem;
    color: var(--muted);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: .11em;
    text-transform: uppercase;
}

.book-studio-group-empty {
    margin: .15rem 0 .35rem;
    padding: .5rem .65rem;
    border: 1px dashed var(--border, #d8d2c6);
    border-radius: 8px;
    color: var(--muted);
    font-size: var(--text-xs);
    font-style: italic;
    text-align: center;
}

.book-studio-outline-row {
    display: grid;
    grid-template-columns: 26px 0 minmax(0, 1fr);
    align-items: stretch;
    border-radius: 8px;
}

.book-studio-outline-select {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity .16s ease, width .16s ease;
}

.book-studio-panel.is-outline-selecting .book-studio-outline-row {
    grid-template-columns: 0 32px minmax(0, 1fr);
}

.book-studio-panel.is-outline-selecting .studio-drag-handle {
    opacity: 0;
    pointer-events: none;
}

.book-studio-panel.is-outline-selecting .book-studio-outline-select {
    width: 32px;
    opacity: 1;
    pointer-events: auto;
}

.book-studio-panel.is-outline-selecting .book-studio-outline-link {
    cursor: pointer;
}

.book-studio-outline-row.active {
    background: var(--colour-paper);
    box-shadow: inset 0 0 0 1px rgb(var(--ink-rgb) / .12), 0 10px 26px rgb(var(--ink-rgb) / .06);
}

.studio-drag-handle {
    border: 0;
    background: transparent;
    color: color-mix(in srgb, var(--muted) 72%, var(--paper));
    cursor: grab;
    font-size: var(--text-base);
}

.book-studio-outline-link {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    align-items: center;
    gap: .45rem;
    min-height: 46px;
    padding: .42rem .45rem;
    color: var(--ink);
    text-decoration: none;
}

.book-studio-outline-link strong,
.book-studio-outline-link small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.book-studio-outline-link strong {
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
}

.book-studio-outline-link > span:last-child {
    min-width: 0;
}

.book-studio-outline-link small,
.book-studio-save-status,
.autosave-status {
    color: var(--muted);
    font-size: var(--text-sm);
}

.book-studio-outline-meta {
    display: inline-flex;
    align-items: center;
    margin-left: .28rem;
    color: var(--accent);
    font-weight: var(--weight-semibold);
}

.book-studio-outline-meta.empty {
    color: color-mix(in srgb, var(--muted) 76%, var(--paper));
}

.book-studio-outline-meta.long {
    color: var(--accent);
}

.studio-section-index {
    color: color-mix(in srgb, var(--muted) 76%, var(--paper));
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
}

.book-studio-add {
    display: grid;
    gap: .5rem;
    flex: 0 0 auto;
    margin-top: 1rem;
    border-top: 1px solid rgb(var(--ink-rgb) / .1);
    padding-top: .8rem;
}

.book-studio-add summary {
    cursor: pointer;
    color: var(--muted-strong);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
}

.book-studio-add-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: .45rem;
}

.book-studio-add-accordion,
.book-details-accordion {
    display: grid;
    gap: .55rem;
}

.book-studio-add-accordion .accordion-item,
.book-details-accordion .accordion-item {
    overflow: hidden;
    border: 1px solid rgb(var(--ink-rgb) / .09);
    border-radius: 10px;
    background: rgb(var(--paper-rgb) / .42);
}

.book-studio-add-accordion .accordion-button,
.book-details-accordion .accordion-button {
    box-shadow: none;
    background: transparent;
    color: var(--colour-muted-strong);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    padding: .8rem .9rem;
}

.book-studio-add-accordion .accordion-button:not(.collapsed),
.book-details-accordion .accordion-button:not(.collapsed) {
    background: rgb(var(--white-rgb) / .42);
    color: var(--colour-ink);
}

.book-studio-add-accordion .accordion-button span,
.book-details-accordion .accordion-button span {
    flex: 1 1 auto;
}

.book-studio-add-accordion .accordion-button small,
.book-details-accordion .accordion-button small {
    margin-right: .75rem;
    color: var(--colour-muted);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    text-transform: none;
}

.book-studio-add-accordion .accordion-body,
.book-details-accordion .accordion-body {
    padding: .85rem;
}

.book-details-accordion .accordion-button {
    align-items: center;
    gap: .85rem;
    min-height: 4rem;
    background-color: rgb(var(--paper-rgb) / .3) !important;
    color: var(--colour-ink) !important;
}

.book-details-accordion .accordion-body {
    padding: 1rem;
}

.book-details-accordion .accordion-button:not(.collapsed) {
    background-color: rgb(var(--white-rgb) / .56) !important;
    border-bottom: 1px solid rgb(var(--ink-rgb) / .08);
}

.book-details-accordion .accordion-button::after {
    margin-left: .75rem;
}

.book-details-accordion-heading {
    min-width: 0;
}

.book-details-accordion-heading strong {
    color: var(--colour-ink);
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    line-height: 1.15;
}

.book-details-accordion-heading small {
    margin-right: 0;
    color: var(--colour-muted);
    font-size: var(--text-sm);
    font-weight: var(--weight-regular);
    line-height: 1.25;
}

#bookInfoModal .modal-dialog {
    max-height: calc(100vh - 1.5rem);
}

#bookInfoModal .modal-content {
    max-height: calc(100vh - 1.5rem);
}

#bookInfoModal .modal-content > form {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    max-height: 100%;
}

#bookInfoModal .modal-header,
#bookInfoModal .modal-footer {
    flex: 0 0 auto;
}

#bookInfoModal .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: 1.25rem;
    scroll-padding-block: 1rem 5rem;
}

.book-studio-add-grid button {
    width: 100%;
    min-height: 5.4rem;
    border: 1px solid rgb(var(--ink-rgb) / .12);
    border-radius: 7px;
    background: rgb(var(--white-rgb) / .58);
    color: var(--ink);
    text-align: left;
    padding: .65rem .75rem;
}

.book-studio-add-grid button:hover {
    border-color: rgb(var(--accent-rgb) / .28);
    background: var(--colour-paper);
}

.book-studio-add-grid button strong,
.book-studio-add-grid button small {
    display: block;
}

.book-studio-add-grid button strong {
    color: var(--colour-ink);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    line-height: 1.2;
}

.book-studio-add-grid button small {
    margin-top: .3rem;
    color: var(--muted);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    line-height: 1.3;
}

.book-studio-editor-head {
    margin-bottom: 1rem;
}

.studio-chapter-heading-fields {
    display: grid;
    grid-template-columns: minmax(18rem, 1.2fr) minmax(14rem, .9fr);
    gap: .75rem;
    width: min(100%, 54rem);
    max-width: 54rem;
}

.studio-title-input,
.studio-section-title-input,
.studio-subtitle-input {
    width: 100%;
    border: 1px solid rgb(var(--ink-rgb) / .11);
    border-radius: 7px;
    background: rgb(var(--white-rgb) / .44);
    color: var(--colour-ink);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: var(--weight-regular);
    line-height: 1.5;
    outline: 0;
    padding: .45rem .55rem;
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.studio-title-input::placeholder,
.studio-section-title-input::placeholder,
.studio-subtitle-input::placeholder {
    color: rgb(var(--ink-rgb) / .42);
    opacity: 1;
}

.studio-title-input:hover,
.studio-section-title-input:hover,
.studio-subtitle-input:hover {
    border-color: rgb(var(--accent-rgb) / .24);
    background: rgb(var(--white-rgb) / .58);
}

.studio-title-input:focus,
.studio-section-title-input:focus,
.studio-subtitle-input:focus {
    border-color: rgb(var(--accent-rgb) / .48);
    background: rgb(var(--white-rgb) / .72);
    box-shadow: 0 0 0 .2rem rgb(var(--accent-rgb) / .12);
}

@media (max-width: 575.98px) {
    .studio-chapter-heading-fields {
        grid-template-columns: 1fr;
        gap: .5rem;
    }

}

.studio-chapter-options {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin: -.35rem 0 .8rem;
}

.studio-chapter-options label,
.studio-chapter-options .book-studio-bulk-actions-button {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    border: 1px solid rgb(var(--ink-rgb) / .1);
    border-radius: var(--radius-pill);
    background: rgb(var(--white-rgb) / .38);
    color: var(--colour-muted-strong);
    cursor: pointer;
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    padding: .4rem .65rem;
}

.studio-chapter-options .book-studio-bulk-actions-button {
    appearance: none;
    font-family: inherit;
    line-height: normal;
    outline: 0;
}

.book-studio-bulk-actions-button:hover,
.book-studio-bulk-actions-button:focus-visible {
    border-color: rgb(var(--accent-rgb) / .28);
    background: rgb(var(--white-rgb) / .58);
    color: var(--colour-ink);
}

.book-studio-bulk-actions-button:focus-visible {
    box-shadow: 0 0 0 .2rem rgb(var(--accent-rgb) / .12);
}

.studio-chapter-options input[type="checkbox"] {
    width: .95rem;
    height: .95rem;
    accent-color: var(--colour-ink);
}

.studio-include-toggle {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    color: var(--muted-strong);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
}

.studio-export-toggles {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .7rem;
    flex-wrap: wrap;
}

.studio-include-toggle input {
    position: absolute;
    opacity: 0;
}

.studio-include-toggle span {
    position: relative;
    width: 42px;
    height: 24px;
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--muted) 44%, var(--warm));
}

.studio-include-toggle span:after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: var(--radius-pill);
    background: var(--colour-paper);
    transition: transform .16s ease;
}

.studio-include-toggle input:checked + span {
    background: var(--colour-success);
}

.studio-include-toggle input:checked + span:after {
    transform: translateX(18px);
}

.studio-editor-page {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    border: 1px solid rgb(var(--ink-rgb) / .1);
    border-radius: 8px;
    background: var(--colour-book-paper);
    overflow: hidden;
}

.studio-generated-section {
    align-items: center;
    justify-content: center;
    padding: clamp(1.5rem, 4vw, 3rem);
    text-align: center;
}

.studio-generated-section > div {
    max-width: 28rem;
}

.studio-generated-section h3 {
    margin-bottom: .65rem;
    line-height: 1;
}

.studio-generated-section p:not(.eyebrow) {
    margin: 0 auto;
    color: var(--colour-muted-strong);
}

.editor-toolbar {
    z-index: 5;
    display: flex;
    align-items: center;
    gap: .35rem;
    flex-wrap: wrap;
    margin-bottom: .55rem;
    padding: .45rem .55rem;
    border-bottom: 1px solid rgb(var(--ink-rgb) / .08);
    background: var(--paper);
}

.editor-toolbar button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgb(var(--ink-rgb) / .1);
    border-radius: var(--radius-pill);
    background: rgb(var(--white-rgb) / .55);
    color: var(--colour-ink);
    font: inherit;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    min-height: 2.1rem;
    padding: .36rem .62rem;
}

.editor-toolbar button:hover {
    background: var(--colour-ink);
    color: var(--colour-paper);
}

.editor-toolbar button.is-active {
    background: var(--colour-ink);
    color: var(--colour-paper);
    border-color: var(--colour-ink);
}

.editor-toolbar-menu {
    display: inline-flex;
}

.editor-toolbar-menu .dropdown-toggle::after {
    margin-left: .42rem;
}

.editor-toolbar .dropdown-menu {
    min-width: 11rem;
    padding: .35rem;
}

.editor-toolbar .dropdown-menu button {
    justify-content: flex-start;
    width: 100%;
    min-height: 0;
    padding: .45rem .55rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--colour-ink);
    text-align: left;
}

.editor-toolbar .dropdown-menu button:hover,
.editor-toolbar .dropdown-menu button:focus-visible {
    background: rgb(var(--accent-rgb) / .1);
    color: var(--colour-ink);
}


.book-block-content a,
.book-block-image-caption a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: .08em;
    text-underline-offset: .16em;
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    border-radius: .2rem;
    padding: 0 .06em;
}

.book-block-content a:hover,
.book-block-image-caption a:hover {
    background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.section-library-editor-page {
    border: 1px solid rgb(var(--ink-rgb) / .1);
    border-radius: 1rem;
    background: rgb(var(--white-rgb) / .45);
    overflow: hidden;
}

.section-library-editor-page .block-editor {
    min-height: 18rem;
    padding: 1rem;
}

.section-library-placeholders {
    margin-top: .85rem;
    padding: .9rem 1rem;
    border: 1px solid rgb(var(--ink-rgb) / .1);
    border-radius: .75rem;
    background: rgb(var(--white-rgb) / .4);
}

.section-library-placeholders-lead {
    margin: 0 0 .65rem;
    font-size: var(--text-sm);
    color: var(--ink);
}

.section-library-placeholder-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: .3rem .9rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.section-library-placeholder-list li {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    font-size: var(--text-sm);
}

.section-library-placeholder-list code {
    flex: none;
    padding: .1rem .4rem;
    border-radius: .35rem;
    background: rgb(var(--ink-rgb) / .07);
    color: var(--ink);
    font-size: .82em;
    white-space: nowrap;
}

.section-library-placeholder-list span {
    color: rgb(var(--ink-rgb) / .68);
}

[data-editor-link-url].is-invalid {
    border-color: #b02a37;
    box-shadow: 0 0 0 .2rem rgb(176 42 55 / .12);
}

.editor-toolbar-separator {
    width: 1px;
    height: 1.55rem;
    background: rgb(var(--ink-rgb) / .12);
    margin: 0 .15rem;
}

.editor-find-panel {
    display: grid;
    grid-template-columns: minmax(8rem, 1fr) minmax(8rem, 1fr) auto auto auto minmax(4rem, auto);
    gap: .55rem;
    align-items: end;
    border-bottom: 1px solid rgb(var(--ink-rgb) / .08);
    background: rgb(var(--white-rgb) / .7);
    padding: .65rem .85rem;
}

.editor-find-panel[hidden] {
    display: none;
}

.editor-find-panel label {
    display: grid;
    gap: .2rem;
    margin: 0;
}

.editor-find-panel label span {
    color: var(--accent);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: .08em;
    line-height: 1;
    text-transform: uppercase;
}

.editor-find-panel .editor-find-scope {
    align-self: end;
    display: inline-flex;
    grid-template-columns: none;
    flex-direction: row;
    align-items: center;
    gap: .4rem;
    min-height: 2rem;
}

.editor-find-panel .editor-find-scope input {
    margin: 0;
}

.editor-find-panel small {
    align-self: center;
    color: var(--colour-muted);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
}

.studio-block-editor {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: clamp(1.2rem, 3vw, 2.5rem);
}

.block-editor {
    background: linear-gradient(to bottom, rgb(var(--white-rgb) / .86), var(--surface-strong));
}

.book-block {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) 24px;
    column-gap: .42rem;
    row-gap: 0;
    align-items: start;
    border-radius: 6px;
    padding: .14rem .2rem;
    margin-block: .14rem;
    transition: background .15s ease, box-shadow .15s ease;
}

.book-block:hover,
.book-block:focus-within,
.book-block.is-active {
    background: rgb(var(--paper-rgb) / .34);
}

.book-block:focus-within .book-block-content,
.book-block.is-active .book-block-content {
    box-shadow: inset 2px 0 0 color-mix(in srgb, var(--accent) 16%, transparent);
}

.book-block.is-dragging {
    opacity: .45;
}

.book-block-handle {
    touch-action: none;
}

body.is-block-dragging {
    cursor: grabbing;
    user-select: none;
}

.book-block.is-drop-target {
    box-shadow: 0 -3px 0 var(--colour-accent), inset 0 0 0 1px rgb(var(--ink-rgb) / .08);
}

.book-block-rail {
    display: grid;
    justify-items: center;
    align-content: start;
    gap: .28rem;
    padding-top: .18rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease;
}

.book-block:hover .book-block-rail,
.book-block:focus-within .book-block-rail,
.book-block.is-active .book-block-rail,
.book-block-scene_break .book-block-rail,
.book-block-image .book-block-rail,
.book-block-social_links .book-block-rail,
.book-block-callout .book-block-rail,
.book-block-takeaway .book-block-rail,
.book-block-checklist .book-block-rail {
    opacity: 1;
    pointer-events: auto;
}

.book-block-paragraph:focus-within .book-block-rail,
.book-block-paragraph.is-active .book-block-rail {
    opacity: 0;
    pointer-events: none;
}

.book-block-paragraph:hover .book-block-rail {
    opacity: .55;
    pointer-events: auto;
}

.book-block-handle {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: var(--radius-pill);
    color: color-mix(in srgb, var(--muted) 34%, var(--paper));
    cursor: grab;
    font-size: var(--text-sm);
    line-height: 1;
    user-select: none;
}

.book-block-handle:active {
    cursor: grabbing;
}

.book-block-type {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border: 1px solid var(--accent-line);
    border-radius: var(--radius-pill);
    background: rgb(var(--paper-rgb) / .92);
    color: var(--accent);
    font: inherit;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    padding: 0;
}

.book-block-paragraph .book-block-type {
    opacity: .38;
}

.book-block-type:hover,
.book-block:focus-within .book-block-type {
    background: var(--colour-ink);
    color: var(--colour-paper);
    border-color: var(--colour-ink);
    opacity: 1;
}

.book-block-content {
    min-height: 1.65rem;
    padding: .02rem .18rem .06rem;
    outline: 0;
    color: var(--ink);
    font-family: var(--font-book);
    font-size: var(--text-lg);
    line-height: 1.58;
    white-space: pre-wrap;
}

.book-block-paragraph {
    padding-block: .06rem;
    position: relative;
}

.book-block-paragraph .book-block-rail,
.book-block-paragraph .book-block-delete {
    position: absolute;
    z-index: 2;
}

.book-block-paragraph .book-block-rail {
    inset-block-start: .08rem;
    inset-inline-start: .18rem;
}

.book-block-paragraph .book-block-delete {
    inset-block-start: .04rem;
    inset-inline-end: .18rem;
}

.book-block-content:empty:before {
    content: 'Start writing...';
    color: var(--muted);
}

.book-block-stack,
.book-block-content,
.book-block-scene,
.book-block-image,
.book-block-social-links {
    grid-column: 2 / 3;
}

.book-block-stack {
    min-width: 0;
}

.book-block-source {
    display: block;
    width: min(100%, 28rem);
    margin: .2rem 0 0;
    border: 0;
    border-top: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    line-height: 1.45;
    outline: 0;
    padding: .35rem .2rem 0;
}

.book-block-source::placeholder {
    color: color-mix(in srgb, var(--muted) 68%, var(--paper));
}

.book-block-source:focus {
    border-top-color: var(--accent-line);
    color: var(--ink);
}

.book-block-quote .book-block-content {
    padding-left: 1rem;
    border-left: 3px solid var(--accent-line);
    color: var(--muted-strong);
    font-style: italic;
}

.book-block-quote .book-block-source {
    margin-left: 1rem;
}

.book-block-pullquote .book-block-content {
    max-width: 34rem;
    margin-inline: auto;
    padding: .35rem 1rem;
    color: var(--colour-ink);
    font-family: var(--font-sans);
    font-size: var(--text-lg);
    font-style: normal;
    font-weight: var(--weight-regular);
    line-height: 1.18;
    text-align: center;
}

.book-block-pullquote .book-block-content:empty:before {
    content: 'Pull quote';
}

.book-block-pullquote .book-block-source {
    margin-inline: auto;
    text-align: center;
}

.book-block-callout .book-block-content {
    padding: .85rem 1rem .95rem;
    border: 1px solid var(--accent-line);
    border-left: 4px solid var(--accent);
    border-radius: 6px;
    background: var(--paper);
    color: var(--ink);
    font-size: var(--text-base);
    line-height: 1.65;
}

.book-block-callout .book-block-content:empty:before {
    content: 'Callout';
}

.book-block-takeaway .book-block-content {
    padding: .85rem 1rem .95rem;
    border: 1px solid var(--success-line);
    border-left: 4px solid var(--success);
    border-radius: 6px;
    background: var(--success-soft);
    color: var(--ink);
    font-size: var(--text-base);
    line-height: 1.65;
}

.book-block-checklist .book-block-content {
    padding: .64rem 1rem .68rem 1.72rem;
    border: 1px solid rgb(var(--ink-rgb) / .12);
    border-radius: 6px;
    background: rgb(var(--white-rgb) / .68);
    color: var(--ink);
    font-size: var(--text-base);
    line-height: 1.62;
}

.book-block-checklist-list {
    list-style: disc;
    margin: 0;
}

.book-block-checklist-list li {
    margin-block: .12rem;
    padding-inline-start: .12rem;
}

.book-block-takeaway .book-block-content:empty:before {
    content: 'Key takeaway';
}

.book-block-checklist .book-block-content:empty:before {
    content: 'Checklist item';
}

.book-block-heading {
    margin-block: .65rem .24rem;
    padding-block: .08rem .04rem;
}

.book-block-heading .book-block-content {
    min-height: 2.05rem;
    color: var(--colour-ink);
    font-family: var(--font-book);
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    line-height: 1.28;
}

.book-block-heading .book-block-content:empty:before {
    content: 'Heading';
}

.book-block-heading .book-block-type {
    background: var(--colour-ink);
    color: var(--colour-paper);
    border-color: var(--colour-ink);
}

.book-block-subheading {
    margin-block: .44rem .16rem;
    padding-block: .04rem 0;
}

.book-block-subheading .book-block-content {
    min-height: 1.85rem;
    color: var(--colour-ink);
    font-family: var(--font-book);
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    line-height: 1.36;
}

.book-block-subheading .book-block-content:empty:before {
    content: 'Subheading';
}

.book-block-centered .book-block-content {
    text-align: center;
}

.book-block-social-links {
    display: grid;
    gap: .7rem;
    width: min(100%, 36rem);
    margin: .35rem auto;
    padding: .9rem;
    border: 1px solid rgb(var(--ink-rgb) / .1);
    border-radius: 8px;
    background: rgb(var(--white-rgb) / .58);
}

.book-block-social-heading {
    color: var(--accent);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    letter-spacing: .08em;
    text-transform: uppercase;
}

.book-block-social-row {
    display: grid;
    grid-template-columns: minmax(8rem, .55fr) minmax(12rem, 1fr) auto;
    gap: .55rem;
    align-items: end;
}

.book-block-social-row label {
    display: grid;
    gap: .22rem;
    margin: 0;
    color: var(--colour-muted-strong);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
}

.book-block-social-row label span {
    line-height: 1;
}

.book-block-social-row select,
.book-block-social-row input {
    min-height: 2.35rem;
    border: 1px solid rgb(var(--ink-rgb) / .1);
    border-radius: 7px;
    background: rgb(var(--white-rgb) / .72);
    color: var(--colour-ink);
    font: inherit;
    font-family: var(--font-sans);
    font-size: var(--text-base);
    padding: .42rem .55rem;
}

.book-block-social-row select:focus,
.book-block-social-row input:focus {
    border-color: rgb(var(--accent-rgb) / .48);
    box-shadow: 0 0 0 .2rem rgb(var(--accent-rgb) / .12);
    outline: 0;
}

.book-block-social-row button,
.book-block-social-add {
    border: 1px solid rgb(var(--ink-rgb) / .1);
    border-radius: var(--radius-pill);
    background: var(--colour-paper);
    color: var(--colour-ink);
    font: inherit;
    font-family: var(--font-sans);
    font-weight: var(--weight-semibold);
}

.book-block-social-row button {
    width: 2.35rem;
    height: 2.35rem;
    padding: 0;
}

.book-block-social-add {
    justify-self: start;
    min-height: 2.25rem;
    padding: .38rem .75rem;
}

.book-block-social-row button:hover,
.book-block-social-add:hover {
    border-color: var(--colour-ink);
    background: var(--colour-ink);
    color: var(--colour-paper);
}

.book-block-social-note {
    margin: -.1rem 0 0;
    color: var(--colour-muted);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
}

@media (max-width: 575.98px) {
    .book-block-social-row {
        grid-template-columns: 1fr auto;
    }

    .book-block-social-row label:has(input) {
        grid-column: 1 / -1;
        grid-row: 2;
    }
}

.book-block-image {
    display: grid;
    justify-items: center;
    gap: .45rem;
    margin: .35rem auto;
    max-width: min(100%, 34rem);
}

.book-block-image img {
    display: block;
    max-width: 100%;
    max-height: 28rem;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 10px 28px rgb(var(--ink-rgb) / .1);
}

.book-block-image-caption {
    min-width: min(100%, 26rem);
    min-height: 1.4rem;
    padding: .1rem .2rem;
    outline: 0;
    color: var(--colour-muted);
    font-size: var(--text-base);
    line-height: 1.35;
    text-align: center;
}

.book-block-image-caption:empty:before {
    content: 'Caption';
    color: var(--muted);
}

.book-block-image-alt {
    display: grid;
    gap: .22rem;
    width: min(100%, 26rem);
    margin: .2rem auto 0;
    color: var(--colour-muted);
    font-size: var(--text-sm);
    font-family: var(--font-sans);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: .08em;
}

.book-block-image-alt input {
    width: 100%;
    border-radius: 6px;
    font-size: var(--text-base);
    font-weight: var(--weight-regular);
    letter-spacing: 0;
    text-transform: none;
}

.book-block-scene {
    display: grid;
    place-items: center;
    min-height: 2.1rem;
    color: var(--accent);
    font-weight: var(--weight-semibold);
    letter-spacing: .2em;
}

.book-block-delete {
    grid-column: 3 / 4;
    border: 0;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--muted);
    font-size: var(--text-base);
    line-height: 1.6rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease, background .15s ease, color .15s ease;
}

.book-block:hover .book-block-delete,
.book-block:focus-within .book-block-delete,
.book-block.is-active .book-block-delete {
    opacity: .72;
    pointer-events: auto;
}

.book-block-delete:hover {
    background: rgb(var(--ink-rgb) / .08);
    color: var(--colour-ink);
}

.book-studio-editor-footer {
    margin-top: auto;
    background: transparent;
    padding-top: .85rem;
}

.book-studio-editor-footer-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .5rem;
    flex-wrap: wrap;
}

.studio-editor-meta {
    display: flex;
    align-items: center;
    gap: .7rem;
    color: var(--muted);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
}

.book-studio-device-stage {
    display: grid;
    flex: 0 0 clamp(31rem, 62vh, 46rem);
    place-items: center;
    min-height: 31rem;
    height: clamp(31rem, 62vh, 46rem);
    margin-top: .7rem;
    margin-bottom: .8rem;
    border: 1px solid rgb(var(--ink-rgb) / .12);
    border-radius: 10px;
    background:
        radial-gradient(circle at 50% 0%, rgb(var(--white-rgb) / .62), transparent 40%),
        var(--warm);
    box-shadow: inset 0 0 0 1px rgb(var(--white-rgb) / .35), 0 22px 54px rgb(var(--ink-rgb) / .1);
    overflow: hidden;
    padding: .85rem;
}

.book-studio-device-frame {
    --device-width: 420px;
    --device-height: 610px;
    --device-bezel: #20201e;
    --device-screen: #f5f2ea;
    --device-radius: 28px;
    --device-padding: 16px;
    --device-scale: 1;
    --device-scale-offset-y: 0px;
    --device-content-top: 64px;
    --device-content-bottom: 58px;
    --device-content-side: 40px;
    display: block;
    width: max-content;
    height: max-content;
    transform: translateY(var(--device-scale-offset-y)) scale(var(--device-scale));
    justify-self: center;
    align-self: center;
    transform-origin: center center;
    transition: transform .18s ease;
}

.book-studio-device-bezel {
    display: flex;
    flex-direction: column;
    width: calc(var(--device-width) + (var(--device-padding) * 2));
    height: calc(var(--device-height) + 92px);
    border-radius: var(--device-radius);
    background: var(--device-bezel);
    box-shadow:
        0 28px 70px rgb(var(--ink-rgb) / .28),
        inset 0 0 0 1px rgb(var(--white-rgb) / .08);
    padding: var(--device-padding);
}

.book-studio-device-frame.is-reflowable-proof .book-studio-device-bezel {
    height: auto;
}

.book-studio-device-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: rgb(var(--paper-rgb) / .64);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    min-height: 30px;
}

.book-studio-device-screen {
    position: relative;
    width: var(--device-width);
    height: var(--device-height);
    border-radius: calc(var(--device-radius) - 14px);
    background: var(--device-screen);
    box-shadow: inset 0 0 0 1px rgb(var(--ink-rgb) / .14);
    overflow: hidden;
}

.book-studio-device-frame.is-proof-loading .book-studio-device-screen::after {
    position: absolute;
    inset: 0;
    z-index: 1;
    content: "";
    pointer-events: none;
    background: rgb(var(--white-rgb) / .96);
}

.book-studio-device-frame.is-proof-loading .book-studio-device-screen[data-preview-has-status="1"]::before {
    position: absolute;
    top: .7rem;
    left: 50%;
    z-index: 2;
    content: attr(data-preview-status);
    transform: translateX(-50%);
    border: 1px solid rgb(var(--ink-rgb) / .08);
    border-radius: 999px;
    background: rgb(var(--paper-rgb) / .9);
    box-shadow: 0 8px 22px rgb(var(--ink-rgb) / .12);
    color: var(--colour-ink);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    line-height: 1;
    padding: .4rem .65rem;
    pointer-events: none;
    white-space: nowrap;
}

.book-studio-device-frame.is-proof-error .book-studio-device-screen::after {
    position: absolute;
    inset: 0;
    z-index: 1;
    content: "";
    background: rgb(var(--white-rgb) / .96);
}

.book-studio-device-frame.is-proof-error .book-studio-device-screen[data-preview-has-status="1"]::before {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    width: min(18rem, calc(100% - 2rem));
    content: attr(data-preview-status);
    transform: translate(-50%, -62%);
    color: var(--colour-ink);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    line-height: 1.35;
    text-align: center;
}

.book-studio-preview-retry {
    position: absolute;
    top: calc(50% + 1.9rem);
    left: 50%;
    z-index: 3;
    transform: translateX(-50%);
    border: 1px solid rgb(var(--ink-rgb) / .14);
    border-radius: 999px;
    background: var(--colour-panel);
    box-shadow: 0 10px 24px rgb(var(--ink-rgb) / .12);
    color: var(--colour-ink);
    font: inherit;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    line-height: 1;
    padding: .55rem .9rem;
}

.book-studio-preview-retry[hidden] {
    display: none;
}

.book-studio-device-frame.is-proof-loading .book-studio-proof-frame {
    opacity: .62;
}

.book-studio-device-frame.device-iphone {
    --device-width: 255px;
    --device-height: 552px;
    --device-bezel: #101010;
    --device-screen: #ffffff;
    --device-radius: 36px;
    --device-padding: 10px;
    --device-content-top: 54px;
    --device-content-bottom: 44px;
    --device-content-side: 28px;
}

.book-studio-device-frame.device-ipad {
    --device-width: 460px;
    --device-height: 610px;
    --device-bezel: #171716;
    --device-screen: #ffffff;
    --device-radius: 30px;
    --device-padding: 14px;
    --device-content-top: 72px;
    --device-content-bottom: 64px;
    --device-content-side: 62px;
}

.book-studio-device-frame.device-kindle-paperwhite {
    --device-width: 350px;
    --device-height: 500px;
    --device-bezel: #242421;
    --device-screen: #f5f4ef;
    --device-radius: 24px;
    --device-padding: 18px;
    --device-content-top: 58px;
    --device-content-bottom: 76px;
    --device-content-side: 40px;
}

.book-studio-proof-frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: transparent;
    opacity: 1;
}

.book-studio-proof-frame[data-preview-ready="0"] {
    opacity: 0;
}

.book-studio-proof-frame[data-preview-ready="1"] {
    opacity: 1;
}

.book-studio-device-frame.is-proof-loading .book-studio-proof-frame[data-preview-ready="0"] {
    opacity: 0;
}

.book-studio-device-frame.device-kindle-paperwhite .book-studio-proof-frame {
    filter: grayscale(1) contrast(1.04) brightness(.98);
}

.book-studio-proof-actions {
    display: flex;
    align-items: end;
    gap: .45rem;
    width: 100%;
}

.book-studio-proof-actions > .studio-select-field,
.book-studio-proof-actions > form {
    flex: 1 1 0;
    min-width: 0;
}

.book-studio-proof-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: .5rem;
}

.book-studio-proof-actions form {
    display: block;
    margin: 0;
}

.book-studio-proof-actions form .studio-select-field {
    width: 100%;
}

.book-studio-icon-button.is-busy {
    opacity: .45;
    cursor: progress;
}

.book-studio-proof-note,
.book-studio-reading-note {
    margin: 0;
    color: var(--muted);
    font-size: var(--text-xs);
    line-height: 1.35;
}

.book-studio-reading-note {
    margin-top: .6rem;
}

.book-studio-loading {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 50% 38%, rgb(var(--white-rgb) / .7), transparent 55%),
        var(--warm);
    transition: opacity .4s ease;
}

.book-studio-loading.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.book-studio-loading-inner {
    display: grid;
    justify-items: center;
    gap: 1rem;
    color: var(--muted);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    transform: translateY(-6vh);
}

.book-studio-loading-spinner {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 3px solid rgb(var(--ink-rgb) / .14);
    border-top-color: var(--colour-ink);
    animation: book-studio-spin .8s linear infinite;
}

@keyframes book-studio-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .book-studio-loading-spinner { animation-duration: 1.8s; }
}

.book-studio-flip-controls {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin-top: .55rem;
}

.book-studio-flip-button {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 2.1rem;
    height: 2.1rem;
    border: 1px solid rgb(var(--ink-rgb) / .16);
    border-radius: 999px;
    background: var(--colour-panel);
    color: var(--colour-ink);
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    transition: background .12s ease, opacity .12s ease;
}

.book-studio-flip-button:hover:not(:disabled) {
    background: var(--warm);
}

.book-studio-flip-button:disabled {
    opacity: .38;
    cursor: default;
}

.book-studio-flip-slider {
    flex: 1 1 auto;
    min-width: 0;
    accent-color: var(--colour-ink);
    cursor: pointer;
}

.book-studio-flip-slider:disabled {
    opacity: .45;
    cursor: default;
}

.book-studio-flip-pagenum {
    flex: 0 0 auto;
    min-width: 6.4rem;
    text-align: right;
    color: var(--muted);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    white-space: nowrap;
}

.book-studio-proof-status {
    justify-self: end;
    margin-top: -.15rem;
    white-space: nowrap;
}

.print-proof-shell {
    display: grid;
    gap: .85rem;
    width: min(100%, 1180px);
    min-height: calc(100vh - 8rem);
    margin-inline: auto;
    padding: .25rem clamp(.25rem, 2vw, 1rem) 1.5rem;
}

.print-proof-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border: 1px solid rgb(var(--ink-rgb) / .08);
    border-radius: 8px;
    background: rgb(var(--paper-rgb) / .68);
    box-shadow: var(--shadow-soft);
    padding: .85rem 1rem;
}

.print-proof-header h1 {
    margin: 0;
    font-size: var(--text-lg);
    letter-spacing: 0;
    line-height: 1.15;
}

.print-proof-back {
    display: inline-block;
    margin-bottom: .35rem;
}

.print-proof-meta,
.print-proof-limitations {
    margin: .25rem 0 0;
    color: var(--muted);
    font-size: var(--text-sm);
}

.print-proof-actions {
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-end;
}

.print-proof-notice,
.print-proof-warning {
    display: grid;
    gap: .2rem;
    border: 1px solid rgb(var(--ink-rgb) / .08);
    border-radius: 8px;
    background: rgb(var(--paper-rgb) / .62);
    color: var(--colour-ink);
    padding: .8rem .9rem;
}

.print-proof-notice span,
.print-proof-warning li {
    color: var(--muted);
    font-size: var(--text-sm);
}

.print-proof-warning {
    border-color: rgba(146, 94, 37, .2);
    background: rgba(255, 246, 225, .48);
}

.print-proof-warning ul {
    margin: .25rem 0 0;
    padding-left: 1.1rem;
}

.print-proof-viewer {
    position: relative;
    min-height: clamp(32rem, 70vh, 54rem);
    border: 1px solid rgb(var(--ink-rgb) / .1);
    border-radius: 8px;
    background: rgb(var(--paper-rgb) / .54);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    padding: .75rem;
}

.print-proof-loading {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    place-content: center;
    gap: .25rem;
    background: var(--warm);
    color: var(--colour-ink);
    text-align: center;
}

.print-proof-loading span {
    color: var(--muted);
    font-size: var(--text-sm);
}

.print-proof-loading[hidden] {
    display: none !important;
}

.print-proof-frame {
    display: block;
    width: 100%;
    height: clamp(30rem, 68vh, 52rem);
    border: 0;
    background: var(--warm);
    border-radius: 6px;
}

.studio-select-field {
    display: grid;
    gap: .22rem;
    margin: 0;
}

.studio-select-field span {
    color: var(--accent);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: .1em;
    line-height: 1;
    text-transform: uppercase;
}

.studio-preset-select {
    min-height: 34px;
    width: 100%;
    border: 1px solid rgb(var(--ink-rgb) / .13);
    border-radius: 7px;
    background: var(--colour-book-paper);
    color: var(--ink);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    padding: .38rem 2rem .38rem .6rem;
}

.style-preset-select-fit {
    display: block;
    color: var(--colour-muted);
    font-size: var(--text-sm);
    line-height: 1.35;
}

.style-preset-select-fit.compact {
    max-width: 18rem;
    color: var(--muted);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: 0;
    text-transform: none;
}

.style-presets-index {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    max-width: none;
    min-height: calc(100vh - var(--topnav-height));
    min-height: calc(100dvh - var(--topnav-height));
    background: var(--colour-bg);
    overflow: visible;
    padding: 1rem !important;
}

.style-preset-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .9rem;
}

.style-preset-card {
    display: grid !important;
    grid-template-columns: 12.5rem minmax(0, 1fr);
    gap: 1rem;
    overflow: hidden;
    min-height: 13rem;
    border-radius: 8px !important;
    padding: 1rem !important;
}

.style-preset-card-body {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-width: 0;
}

.style-preset-card-copy {
    min-width: 0;
}

.style-preset-thumbnail {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 10.75rem;
    aspect-ratio: 7 / 5;
    object-fit: contain;
    object-position: center;
    border: 1px solid rgb(var(--ink-rgb) / .08);
    border-radius: 6px;
    background: var(--warm);
    box-shadow: inset 0 0 0 1px rgb(var(--white-rgb) / .35);
}

.style-preset-card-body .eyebrow {
    margin-bottom: .35rem;
}

.style-preset-card-body h3 {
    margin-bottom: .2rem;
}

.style-preset-card-body .text-muted {
    display: -webkit-box;
    margin-bottom: .65rem;
    overflow: hidden;
    color: var(--muted) !important;
    font-size: var(--text-base);
    line-height: 1.38;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.style-preset-card-body .panel-link {
    align-self: end;
    margin-top: .6rem;
}

.style-preset-feel {
    margin: 0 0 .55rem;
    color: var(--accent);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: .07em;
    line-height: 1.25;
    text-transform: uppercase;
}

.style-preset-fit {
    display: -webkit-box;
    margin: 0 0 .6rem;
    overflow: hidden;
    color: var(--muted-strong);
    font-size: var(--text-sm);
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.style-preset-fit span {
    display: block;
    margin-bottom: .18rem;
    color: var(--accent);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: .12em;
    line-height: 1;
    text-transform: uppercase;
}

.style-preset-tradeoff {
    margin: -.2rem 0 1.1rem;
    border-left: 2px solid rgb(var(--accent-rgb) / .28);
    color: var(--muted);
    font-size: var(--text-sm);
    line-height: 1.4;
    padding-left: .75rem;
}

.style-preset-tradeoff span {
    display: block;
    margin-bottom: .18rem;
    color: var(--accent);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: .11em;
    line-height: 1;
    text-transform: uppercase;
}

.style-preset-quick-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
    gap: .55rem;
    margin-top: .8rem;
}

.style-preset-quick-option {
    min-height: 5.85rem;
    border: 1px solid var(--deckle-border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--deckle-ink);
    padding: .75rem .85rem;
    text-align: left;
    transition: border-color .16s ease, background .16s ease, box-shadow .16s ease, transform .16s ease;
}

.style-preset-quick-option:hover,
.style-preset-quick-option:focus-visible,
.style-preset-quick-option.is-active {
    border-color: rgb(var(--accent-rgb) / .7);
    background: var(--paper);
    box-shadow: 0 10px 24px rgb(var(--ink-rgb) / .08);
}

.style-preset-quick-option:hover {
    transform: translateY(-1px);
}

.style-preset-quick-option span,
.style-preset-quick-option strong,
.style-preset-quick-option small,
.style-preset-quick-option em {
    display: block;
}

.style-preset-quick-option span {
    margin-bottom: .4rem;
    color: var(--accent);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: .1em;
    line-height: 1.1;
    text-transform: uppercase;
}

.style-preset-quick-option strong {
    font-family: var(--font-sans);
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    letter-spacing: 0;
    line-height: 1;
}

.style-preset-quick-option small {
    margin-top: .45rem;
    color: var(--deckle-muted);
    font-size: var(--text-sm);
    line-height: 1.25;
}

.style-preset-quick-option em {
    margin-top: .45rem;
    color: var(--accent);
    font-size: var(--text-xs);
    font-style: normal;
    line-height: 1.25;
}

.style-builder-page {
    max-width: 1680px;
    margin: 0 auto;
}

.style-builder-shell {
    --style-sample-preview-top: 1rem;
}

.style-builder-controls .app-card,
.style-sample-preview-column .app-card {
    border-radius: 8px !important;
}

.style-builder-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
}

.style-builder-actions .btn {
    min-width: 10rem;
}

.style-tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    border-bottom: 1px solid rgb(var(--ink-rgb) / .1);
    padding-bottom: 1rem;
}

.style-tab-btn {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    border: 1px solid rgb(var(--ink-rgb) / .1);
    border-radius: 999px;
    background: rgb(var(--white-rgb) / .42);
    color: var(--ink);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    padding: .35rem .78rem;
    text-decoration: none;
    cursor: pointer;
}

.style-tab-btn:hover {
    border-color: rgb(var(--ink-rgb) / .22);
    background: rgb(var(--white-rgb) / .72);
}

.style-tab-btn.active {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--paper);
}

/* In-studio Design panel (offcanvas hosting the preset controls for one book) */
.book-design-panel {
    /* Bootstrap sets width via .offcanvas.offcanvas-start (higher specificity),
       so the width must go through its custom property, not a width declaration. */
    --bs-offcanvas-width: min(1000px, 94vw);
    background: var(--colour-bg, #f6efe3);
}

.book-design-panel-head {
    align-items: flex-start;
    border-bottom: 1px solid rgb(var(--ink-rgb) / .1);
}

.book-design-preset-state {
    font-size: var(--text-sm);
    color: rgb(var(--ink-rgb) / .68);
}

.book-design-panel-hint {
    font-size: var(--text-sm);
    margin-bottom: 1rem;
}

.book-design-panel-body .style-control-section {
    box-shadow: none;
}

.book-design-panel-footer {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    padding: .9rem 1rem;
    border-top: 1px solid rgb(var(--ink-rgb) / .1);
    background: rgb(var(--white-rgb) / .55);
}

.book-design-panel-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}

.book-design-save-as {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}

.book-design-save-as input {
    flex: 1 1 12rem;
}

.book-design-action-status {
    font-size: var(--text-sm);
    color: rgb(var(--ink-rgb) / .68);
}

.book-design-action-status.is-error {
    color: #b02a37;
}

.style-sample-preview-column {
    position: sticky;
    top: var(--style-sample-preview-top);
}

.style-sample-preview-panel {
    max-height: calc(100vh - 1rem);
    overflow: hidden;
}

@media (max-width: 1199.98px) {
    .style-sample-preview-column {
        position: static;
        order: -1;
    }

    .style-sample-preview-panel {
        max-height: none;
    }
}


@media (max-width: 991.98px) {
    .app-empty-grid,
    .books-index .app-empty-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767.98px) {
    .style-builder-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .style-builder-actions .btn {
        width: 100%;
    }
}

.book-render.text-justified .book-content {
    text-align: justify;
}

.book-render.text-ragged .book-content {
    text-align: left;
}

.book-render.hyphenate-on .book-content {
    hyphens: auto;
}

.book-render.hyphenate-off .book-content {
    hyphens: manual;
}

.book-render.paragraph-indented .book-content p {
    margin: 0;
    text-indent: 1.18em;
}

.book-render.paragraph-indented .book-content p:first-child,
.book-render.paragraph-indented .scene-break + p {
    text-indent: 0;
}

.book-render.paragraph-spaced .book-content p {
    margin: 0 0 .82em;
    text-indent: 0;
}

.book-render.first-paragraph-no_indent .book-content p:first-child {
    text-indent: 0 !important;
}

.book-render.first-paragraph-indent .book-content p:first-child {
    text-indent: 1.18em !important;
}

.book-render.body-size-small .book-content {
    font-size: .97em;
}

.book-render.body-size-standard .book-content {
    font-size: 1em;
}

.book-render.body-size-large .book-content {
    font-size: 1.08em;
}

.book-render.line-spacing-tight .book-content {
    line-height: 1.48;
}

.book-render.line-spacing-balanced .book-content {
    line-height: 1.55;
}

.book-render.line-spacing-open .book-content {
    line-height: 1.62;
}

.book-render.chapter-spacing-compact .book-section-inner {
    padding-top: 2.2em;
}

.book-render.chapter-spacing-classic .book-section-inner {
    padding-top: 3.6em;
}

.book-render.chapter-spacing-spacious .book-section-inner {
    padding-top: 5.2em;
}

.style-sample-book-render .scene-break span {
    font-size: 0;
}

.style-sample-book-render .scene-break {
    margin: 1.15em auto !important;
}

.style-sample-book-render .scene-break span::before {
    content: var(--deckle-builder-scene-break, "* * *") !important;
    font-size: var(--text-sm) !important;
}

.style-sample-book-render.scene-break-rule .scene-break span::before,
.style-sample-book-render.scene-break-fine_rule .scene-break span::before,
.style-sample-book-render.scene-break-clean_rule .scene-break span::before,
.style-sample-book-render.scene-break-narrow_rule .scene-break span::before,
.style-sample-book-render.scene-break-hard_rule .scene-break span::before,
.style-sample-book-render.scene-break-split_rule .scene-break span::before,
.style-sample-book-render.scene-break-diamond_rule .scene-break span::before,
.style-sample-book-render.scene-break-leaf .scene-break span::before,
.style-sample-book-render.scene-break-double_fleuron .scene-break span::before,
.style-sample-book-render.scene-break-compass .scene-break span::before,
.style-sample-book-render.scene-break-dark_diamond .scene-break span::before {
    content: "" !important;
    display: inline-block !important;
    width: 3.2em !important;
    height: 1px !important;
    background: currentColor !important;
    vertical-align: middle !important;
}

.style-sample-book-render.scene-break-narrow_rule .scene-break span::before,
.style-sample-book-render.scene-break-dark_diamond .scene-break span::before {
    width: 2.2em !important;
}

.style-sample-book-render.scene-break-fine_rule .scene-break span::before,
.style-sample-book-render.scene-break-diamond_rule .scene-break span::before,
.style-sample-book-render.scene-break-leaf .scene-break span::before {
    width: 2.6em !important;
}

.style-sample-book-render.scene-break-split_rule .scene-break span::before,
.style-sample-book-render.scene-break-double_fleuron .scene-break span::before {
    background: linear-gradient(90deg, currentColor 0 40%, transparent 40% 60%, currentColor 60% 100%) !important;
}

.style-sample-book-render.scene-break-hard_rule .scene-break span::before {
    height: 2px !important;
}

.book-render.blockquote-style-indented blockquote {
    max-width: 76%;
    margin: 1.7em auto;
    padding-left: 1.4em;
    padding-right: 1.4em;
    font-style: italic;
}

.book-render.blockquote-style-bordered blockquote {
    max-width: 88%;
    margin: 1.7em auto;
    padding: .1em 0 .1em 1.05em;
    border-left: 2px solid var(--deckle-style-accent, var(--accent));
    font-style: normal;
}

.book-render.blockquote-style-centered blockquote {
    max-width: 72%;
    margin: 2em auto;
    font-style: italic;
    text-align: center;
}

.book-render.chapter-label-off .chapter-label {
    display: none !important;
}

.book-render.title-scale-small h1,
.book-render.title-scale-small h2,
.book-render.title-scale-small h3 {
    font-size: 1.48em;
}

.book-render.title-scale-classic h1,
.book-render.title-scale-classic h2,
.book-render.title-scale-classic h3 {
    font-size: 1.72em;
}

.book-render.title-scale-large h1,
.book-render.title-scale-large h2,
.book-render.title-scale-large h3 {
    font-size: 1.96em;
}

.book-render.title-weight-regular h1,
.book-render.title-weight-regular h2,
.book-render.title-weight-regular h3 {
    font-weight: var(--weight-regular);
}

.book-render.title-weight-medium h1,
.book-render.title-weight-medium h2,
.book-render.title-weight-medium h3 {
    font-weight: var(--weight-regular);
}

.book-render.title-weight-bold h1,
.book-render.title-weight-bold h2,
.book-render.title-weight-bold h3 {
    font-weight: var(--weight-semibold);
}

.book-render.chapter-rule-none .chapter-label::after {
    display: none;
}

.book-render.chapter-rule-short .chapter-label::after {
    width: 2.8em;
}

.book-render.chapter-rule-ornamental .chapter-label::after {
    content: "❦";
    height: auto;
    background: transparent;
    font-size: .9em;
    line-height: 1;
}

.book-render.subtitle-style-plain .chapter-subtitle {
    letter-spacing: 0;
    text-transform: none;
}

.book-studio-modal {
    border: 1px solid rgb(var(--ink-rgb) / .1);
    border-radius: 12px;
    background: var(--colour-paper);
    box-shadow: var(--shadow-card);
}

.book-studio-proof-actions .book-studio-save-status {
    grid-column: 1 / -1;
    justify-self: end;
    line-height: 1;
}

.book-studio-proof-export {
    display: grid;
    flex: 0 0 auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: center;
    column-gap: .45rem;
    row-gap: .35rem;
    margin-top: .7rem;
}

.book-studio-proof-export .btn,
.book-studio-proof-export-earc .btn {
    display: grid !important;
    place-items: center;
    min-height: 2.25rem;
    border-radius: 999px;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    line-height: 1.08 !important;
    padding: 0 .7rem !important;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}

.book-studio-export-divider {
    display: block;
    width: 1px;
    height: 1.55rem;
    background: rgb(var(--ink-rgb) / .16);
}

.book-studio-print-proof-modal {
    z-index: 1105;
    pointer-events: auto;
}

.book-studio-print-proof-modal .modal-dialog {
    max-width: min(1120px, calc(100vw - 1.25rem));
    pointer-events: auto;
}

.book-studio-print-proof-modal .modal-content {
    position: relative;
    height: min(86vh, 880px);
    overflow: hidden;
    padding: 0;
    pointer-events: auto;
}

.book-studio-print-proof-close {
    position: absolute;
    top: .7rem;
    right: .7rem;
    z-index: 2;
    border-radius: 999px;
    background-color: rgb(var(--paper-rgb) / .82);
    box-shadow: 0 4px 14px rgb(var(--ink-rgb) / .16);
    opacity: .9;
}

.book-studio-print-proof-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: var(--warm);
    pointer-events: auto;
}

.book-studio-proof-export form {
    display: block;
    margin: 0;
}

.book-studio-export-blockers {
    display: grid;
    gap: .45rem;
    margin-top: .65rem;
    border: 1px solid rgb(var(--accent-rgb) / .18);
    border-radius: 8px;
    background: rgb(var(--white-rgb) / .42);
    padding: .72rem .8rem;
}

.book-studio-export-blockers > strong {
    color: var(--colour-ink);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
}

.book-studio-export-blockers details {
    border-top: 1px solid rgb(var(--ink-rgb) / .07);
    padding-top: .4rem;
}

.book-studio-export-blockers details:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.book-studio-export-blockers summary {
    cursor: pointer;
    color: var(--colour-accent);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
}

.book-studio-export-blockers ul {
    display: grid;
    gap: .28rem;
    margin: .42rem 0 0;
    padding-left: 1rem;
    color: var(--colour-muted-strong);
    font-size: var(--text-sm);
    line-height: 1.35;
}

.book-studio-export-upgrade {
    display: grid;
    gap: .45rem;
    margin-top: .65rem;
    border: 1px solid rgb(var(--accent-rgb) / .2);
    border-radius: 8px;
    background: rgb(var(--accent-rgb) / .08);
    color: var(--colour-muted-strong);
    font-size: var(--text-sm);
    line-height: 1.35;
    padding: .8rem;
}

.book-studio-export-upgrade strong {
    color: var(--colour-ink);
    font-size: var(--text-base);
    line-height: 1.25;
}

.book-studio-export-upgrade p:not(.eyebrow) {
    margin: 0;
}

.book-studio-export-upgrade .btn {
    justify-self: start;
}

.book-studio-export-target {
    display: grid;
    align-content: start;
    gap: .18rem;
    margin: 0;
}

.book-studio-export-target span {
    color: var(--colour-muted);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: .08em;
    line-height: 1;
    text-transform: uppercase;
}

.book-studio-export-target select {
    min-height: 2.1rem;
    width: 100%;
    border-radius: 7px;
    font-size: var(--text-sm);
    padding: .34rem 1.65rem .34rem .58rem;
}

.export-check-warning-group > strong {
    color: var(--colour-ink);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    letter-spacing: .08em;
    text-transform: uppercase;
}

.book-studio-export-review-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .65rem;
    margin-top: .62rem;
    padding-top: .62rem;
    border-top: 1px solid rgb(var(--ink-rgb) / .1);
}

.book-studio-export-review-action span {
    min-width: 0;
    overflow: hidden;
    color: var(--colour-muted);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.export-readiness-modal .modal-body {
    display: grid;
    gap: 1rem;
}

.export-readiness-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .85rem;
    border: 1px solid rgb(var(--ink-rgb) / .09);
    border-radius: 10px;
    background: rgb(var(--white-rgb) / .46);
    padding: .9rem 1rem;
}

.export-readiness-summary strong {
    color: var(--colour-ink);
    font-size: var(--text-base);
}

.export-readiness-summary .export-readiness-link {
    border: 0;
    background: transparent;
    padding: 0;
    color: var(--colour-ink);
    font-weight: var(--weight-semibold);
    text-decoration: none;
}

.export-readiness-summary .export-readiness-link:hover {
    color: var(--colour-accent);
}

.export-check-groups {
    display: grid;
    gap: .85rem;
}

.export-check-group {
    display: grid;
    gap: .45rem;
    border: 1px solid rgb(var(--ink-rgb) / .08);
    border-radius: 10px;
    background: rgb(var(--white-rgb) / .4);
    padding: .9rem 1rem;
}

.export-check-group strong {
    color: var(--ink);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    letter-spacing: .08em;
    line-height: 1;
    text-transform: uppercase;
}

.export-check-group ul,
.export-check-group p {
    display: grid;
    gap: .35rem;
    margin: 0;
    color: var(--muted);
    font-size: var(--text-base);
    line-height: 1.42;
}

.export-check-group ul {
    padding-left: 1.1rem;
}

.book-studio-print-setup {
    border: 1px solid rgb(var(--ink-rgb) / .12);
    border-radius: 10px;
    background: rgb(var(--white-rgb) / .38);
    margin-top: .65rem;
    padding: .64rem .72rem;
}

.book-studio-print-setup summary {
    display: flex;
    gap: .65rem;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    color: var(--accent);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: .1em;
    line-height: 1;
    text-transform: uppercase;
}

.book-studio-print-setup summary::after {
    display: grid;
    flex: 0 0 1.45rem;
    place-items: center;
    width: 1.45rem;
    height: 1.45rem;
    border: 1px solid rgb(var(--ink-rgb) / .12);
    border-radius: var(--radius-pill);
    background: rgb(var(--white-rgb) / .72);
    color: var(--ink);
    content: "+";
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    letter-spacing: 0;
    line-height: 1;
}

.book-studio-print-setup[open] summary::after {
    content: "−";
}

.book-studio-print-setup summary small {
    min-width: 0;
    overflow: hidden;
    color: var(--muted);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: 0;
    text-align: right;
    text-overflow: ellipsis;
    text-transform: none;
    white-space: nowrap;
}

.book-studio-print-setup form {
    margin-top: .75rem;
}

.book-studio-print-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .55rem;
}

.book-studio-print-grid label {
    display: grid;
    gap: .22rem;
    margin: 0;
}

.book-studio-print-grid label > span {
    color: var(--accent);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: .08em;
    line-height: 1;
    text-transform: uppercase;
}

.book-studio-print-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem .75rem;
    margin-top: .7rem;
    color: var(--muted);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
}

.book-studio-print-toggles label {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    margin: 0;
}

.studio-export-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
    margin: 1rem 0;
}

.studio-export-fields label {
    display: grid;
    gap: .3rem;
    color: var(--colour-muted-strong);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
}

.studio-export-fields label > span {
    display: block;
}

.studio-export-check {
    align-content: center;
    grid-template-columns: auto minmax(0, 1fr);
}

.studio-export-check input {
    margin-top: .2rem;
}

.studio-modal-current {
    display: grid;
    gap: .15rem;
    border: 1px solid rgb(var(--ink-rgb) / .1);
    border-radius: 9px;
    background: rgb(var(--white-rgb) / .52);
    padding: .8rem .9rem;
}

.studio-modal-current span {
    color: var(--colour-muted);
    font-size: var(--text-sm);
}

.book-studio-save-status.is-saving,
.autosave-status.is-saving {
    color: var(--accent);
}

.book-studio-save-status.is-saved,
.autosave-status.is-saved {
    color: var(--colour-success);
}

.book-studio-save-status.is-error,
.autosave-status.is-error {
    color: var(--colour-danger);
}

.book-studio-save-status.is-offline,
.autosave-status.is-offline {
    color: var(--accent);
}

.book-studio-save-status.is-session-expired,
.autosave-status.is-session-expired {
    color: var(--accent);
}

.autosave-status.is-session-expired a {
    color: inherit;
    text-decoration: underline;
}

.book-studio-draft-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
    margin-bottom: .9rem;
    padding: .65rem .9rem;
    border-radius: .6rem;
    background: color-mix(in srgb, var(--accent) 10%, var(--paper));
    border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--paper));
    color: var(--ink);
    font-size: var(--text-sm);
}

.book-studio-draft-banner-actions {
    display: flex;
    gap: .5rem;
    margin-left: auto;
}

.book-studio-empty {
    min-height: calc(100vh - var(--topnav-height) - 72px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.book-studio-empty-card {
    width: min(100%, 520px);
    border: 1px solid rgb(var(--ink-rgb) / .1);
    border-radius: 12px;
    background: rgb(var(--paper-rgb) / .72);
    box-shadow: var(--shadow-soft);
    padding: clamp(2rem, 5vw, 3.25rem);
}

.book-studio-empty-card h2 {
    line-height: 1;
    margin-bottom: .8rem;
}

.book-studio-empty-card p {
    color: var(--muted);
    margin-right: auto;
    margin-left: auto;
    max-width: 30rem;
}

.book-studio-empty-note {
    margin-top: 1rem;
    margin-bottom: 0;
    font-size: var(--text-base);
}

.book-studio-empty-actions {
    display: flex;
    gap: .7rem;
    justify-content: center;
    flex-wrap: wrap;
}

@media (max-width: 1199.98px) {
    .app-body:has(.book-studio),
    .app-main:has(.book-studio),
    .app-main-inner:has(.book-studio),
    .book-studio,
    .book-studio-shell {
        height: auto;
        overflow: visible;
    }

    .book-studio-sidebar,
    .book-studio-editor,
    .book-studio-proof,
    .book-studio-panel-sticky,
    .book-studio-proof-panel,
    .book-studio-editor-form {
        height: auto;
    }

    .book-studio-device-stage {
        flex-basis: clamp(31rem, 66vh, 46rem);
        height: clamp(31rem, 66vh, 46rem);
    }

    #bookInfoModal .modal-dialog,
    #bookInfoModal .modal-content {
        max-height: calc(100vh - 1rem);
    }
}

@media (max-width: 767.98px) {
    .app-page-header {
        align-items: stretch;
        flex-direction: column;
    }

    .app-page-actions {
        flex: 1 1 auto;
        justify-content: stretch;
        width: 100%;
    }

    .app-page-actions .btn {
        width: 100%;
    }

    .series-detail-hero,
    .series-workflow-grid {
        grid-template-columns: 1fr;
    }

    .series-detail-actions,
    .series-detail-actions .btn {
        width: 100%;
    }

    .series-detail-actions {
        justify-content: stretch;
    }

    .series-section-head,
    .series-modal-choice {
        align-items: stretch;
        flex-direction: column;
    }

    .series-readiness-grid {
        grid-template-columns: 1fr 1fr;
    }

    .series-book-row {
        grid-template-columns: 2rem 2.35rem 2.35rem minmax(0, 1fr);
    }

    .series-book-row .status-pill {
        grid-column: 4;
        justify-self: start;
    }

    .box-set-book-row {
        grid-template-columns: auto 2rem 2.35rem minmax(0, 1fr);
    }

    .book-studio-editor-head,
    .book-studio-editor-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .book-studio-editor-footer-actions {
        width: 100%;
        justify-content: space-between;
    }

    .book-studio-outline-link {
        grid-template-columns: 24px minmax(0, 1fr);
    }

    .book-block {
        grid-template-columns: 42px minmax(0, 1fr) 30px;
        gap: .6rem;
    }

    .book-studio-proof-export,
    .studio-export-fields {
        grid-template-columns: 1fr;
    }

    .book-studio-proof-actions {
        flex-wrap: nowrap;
    }

    .book-studio-export-divider {
        width: 100%;
        height: 1px;
        margin-block: .1rem;
    }

    .book-studio-print-proof-modal .modal-dialog {
        max-width: calc(100vw - .75rem);
        margin-inline: auto;
    }

    .book-studio-print-proof-modal .modal-content {
        height: 84vh;
    }

    .book-studio-device-stage {
        flex-basis: clamp(30rem, 70vh, 42rem);
        min-height: 30rem;
        height: clamp(30rem, 70vh, 42rem);
        padding: .65rem;
    }

    .print-proof-shell {
        gap: .75rem;
        padding-inline: 0;
    }

    .print-proof-header {
        align-items: stretch;
        flex-direction: column;
        padding: .8rem;
    }

    .print-proof-actions,
    .print-proof-actions .btn,
    .print-proof-actions form {
        width: 100%;
    }

    .print-proof-viewer {
        min-height: clamp(27rem, 68vh, 42rem);
        padding: .45rem;
    }

    .print-proof-frame {
        height: clamp(26rem, 66vh, 40rem);
    }
}

.preset-library-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-radius: 8px !important;
    padding: .9rem 1rem !important;
}

.preset-library-toolbar strong {
    display: block;
    color: var(--deckle-ink);
    font-family: var(--font-sans);
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    line-height: 1.1;
}

.preset-category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    justify-content: flex-end;
}

.preset-category-button {
    min-height: 2.15rem;
    border: 1px solid var(--deckle-border);
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--deckle-muted);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    line-height: 1.1;
    padding: .35rem .75rem;
}

.preset-category-button:hover,
.preset-category-button.is-active {
    border-color: var(--deckle-ink);
    background: var(--deckle-ink);
    color: var(--paper);
}

.style-preset-support-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .9rem;
    align-items: start;
}

.style-preset-support-card {
    display: grid;
    gap: .8rem;
    border-radius: 8px !important;
    padding: 1rem !important;
}

.style-preset-support-card h3 {
    margin-bottom: .35rem;
}

.style-preset-support-card .text-muted {
    font-size: var(--text-base);
    line-height: 1.45;
}

.style-font-upload-form {
    display: flex;
    flex-direction: column;
    gap: .85rem;
    align-items: stretch;
}

.style-font-upload-form .form-check {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    margin: 0;
    min-height: 0;
    padding-left: 0;
}

.style-font-upload-form .form-check-input {
    flex: 0 0 auto;
    float: none;
    margin: .2rem 0 0;
    width: 1rem;
    height: 1rem;
}

.style-font-upload-form .form-check-label {
    min-width: 0;
    line-height: 1.45;
}

.style-font-upload-form .btn {
    align-self: flex-start;
    white-space: nowrap;
}

.uploaded-font-list {
    display: grid;
    gap: .55rem;
}

.uploaded-font-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    min-height: 2.8rem;
    padding: .55rem .7rem;
    border: 1px solid var(--deckle-border);
    border-radius: 8px;
    background: var(--surface-soft);
}

.uploaded-font-row span {
    min-width: 0;
    color: var(--deckle-ink);
    font-weight: var(--weight-semibold);
    overflow-wrap: anywhere;
}

.uploaded-font-row form {
    flex: 0 0 auto;
}

.style-preset-empty[hidden] {
    display: none !important;
}

@media (max-width: 991.98px) {
    .preset-library-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .preset-category-filter {
        justify-content: flex-start;
    }

    .style-preset-grid,
    .style-preset-support-grid {
        grid-template-columns: 1fr;
    }

    .style-preset-card {
        grid-template-columns: 11rem minmax(0, 1fr);
    }
}

@media (max-width: 575.98px) {
    .style-preset-card {
        grid-template-columns: 1fr;
    }

    .style-preset-thumbnail {
        height: auto;
        min-height: 0;
    }
}

.style-presets-index {
    max-width: none;
}

.style-browser-shell {
    display: grid;
    grid-template-columns: minmax(10.5rem, .15fr) minmax(44rem, 1fr) minmax(25rem, .54fr);
    gap: 1rem;
    align-items: start;
    flex: 1 1 auto;
    min-height: 0;
    box-sizing: border-box;
    max-width: none;
    width: 100%;
    margin: 0;
    padding-bottom: 1rem;
    --style-browser-sticky-top: 1rem;
}

.style-browser-filters,
.style-browser-list,
.style-browser-preview {
    min-width: 0;
    min-height: 0;
}

.style-browser-filters {
    display: grid;
    align-content: start;
    gap: .85rem;
    max-height: none;
    overflow: visible;
    position: sticky;
    top: var(--style-browser-sticky-top);
    border: 1px solid rgb(var(--ink-rgb) / .1);
    border-radius: 10px;
    background: rgb(var(--paper-rgb) / .58);
    box-shadow: var(--shadow-soft);
    padding: 1rem;
}

.style-browser-filters .eyebrow {
    margin: 0;
}

.style-browser-filters .preset-category-filter {
    display: grid;
    gap: .45rem;
    justify-content: stretch;
}

.style-browser-filters .preset-category-button {
    display: flex;
    align-items: center;
    gap: .55rem;
    width: 100%;
    min-height: 2.65rem;
    border-radius: 8px;
    border: 1px solid transparent;
    background: rgb(var(--white-rgb) / .58);
    color: var(--colour-ink);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    padding: .55rem .7rem;
    text-align: left;
}

.style-browser-filters .preset-category-button span {
    width: .58rem;
    height: .58rem;
    border: 1px solid rgb(var(--ink-rgb) / .22);
    border-radius: 50%;
    background: rgb(var(--white-rgb) / .75);
}

.style-browser-filters .preset-category-button:hover,
.style-browser-filters .preset-category-button.is-active {
    border-color: rgb(var(--accent-rgb) / .36);
    background: rgb(var(--accent-rgb) / .1);
    color: var(--colour-ink);
}

.style-browser-filters .preset-category-button.is-active span {
    border-color: rgb(var(--accent-rgb) / .65);
    background: var(--colour-accent);
    box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / .14);
}

.style-browser-tools {
    display: grid;
    gap: .55rem;
    margin-top: .35rem;
    border-top: 1px solid rgb(var(--ink-rgb) / .08);
    padding-top: .85rem;
}

.style-browser-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem;
    align-content: start;
    overflow: visible;
    min-width: 0;
    border: 1px solid rgb(var(--ink-rgb) / .1);
    border-radius: 10px;
    background: rgb(var(--paper-rgb) / .58);
    box-shadow: var(--shadow-soft);
    padding: .8rem .8rem 1rem;
}

.style-browser-helper {
    grid-column: 1 / -1;
    margin: 0 0 .2rem;
    color: var(--colour-muted-strong);
    font-size: var(--text-sm);
    line-height: 1.45;
}

.style-browser-card {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: .8rem;
    align-content: start;
    align-items: stretch;
    border: 1px solid rgb(var(--ink-rgb) / .08);
    border-radius: 8px !important;
    background: rgb(var(--white-rgb) / .68);
    cursor: pointer;
    padding: 1.05rem 1.05rem 1.15rem !important;
    transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease;
}

.style-browser-card:hover,
.style-browser-card:focus-visible {
    border-color: rgb(var(--accent-rgb) / .55);
    background: rgb(var(--white-rgb) / .86);
    box-shadow: 0 10px 24px rgb(var(--ink-rgb) / .075);
    outline: 0;
}

.style-browser-card.is-active {
    border-color: rgb(var(--accent-rgb) / .46);
    background: rgb(var(--white-rgb) / .9);
    box-shadow: 0 10px 24px rgb(var(--ink-rgb) / .06);
}

.style-browser-card h2 {
    margin: .12rem 0 .18rem;
    line-height: 1;
}

.style-browser-card-copy {
    display: grid;
    align-content: start;
    gap: .32rem;
    min-width: 0;
}

.style-browser-card-description {
    margin: .05rem 0 0;
    color: var(--colour-muted-strong);
    font-size: var(--text-base);
    font-weight: var(--weight-regular);
    line-height: 1.35;
}

.style-browser-card .eyebrow {
    margin: 0;
    font-size: var(--text-xs);
}

.style-browser-card > .panel-link,
.style-browser-card-actions {
    justify-self: start;
    align-self: end;
    margin-top: .25rem;
}

.style-browser-card-actions {
    display: grid;
    gap: .35rem;
    justify-items: start;
}

.style-browser-preview {
    height: auto;
    min-width: 0;
    overflow-anchor: none;
    overflow: visible;
    position: sticky;
    top: var(--style-browser-sticky-top);
    padding: 1.25rem !important;
}

.style-sample-preview-head,
.style-builder-device-head {
    margin-bottom: 1rem;
}

.style-sample-preview-head p {
    margin: 0;
    color: var(--colour-muted);
    font-size: var(--text-sm);
    line-height: 1.35;
}

.style-sample-preview-actions {
    display: grid;
    gap: .55rem;
    grid-template-columns: minmax(0, 1fr);
}

.style-browser-preview .style-sample-preview-actions {
    grid-template-columns: minmax(0, 1fr);
}

.style-sample-preview-actions .book-studio-save-status {
    justify-self: end;
}

.style-sample-content-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    margin: 0 0 1rem;
}

.style-sample-content-switcher .btn {
    border-radius: .5rem;
    font-size: var(--text-xs);
    line-height: 1.2;
}

.style-sample-device-stage {
    display: grid;
    place-items: center;
    height: clamp(31rem, 62vh, 43rem);
    min-height: 31rem;
    overflow-anchor: none;
    overflow: hidden;
    border: 1px solid rgb(var(--ink-rgb) / .12);
    border-radius: 8px;
    background:
        radial-gradient(circle at 50% 0%, rgb(var(--white-rgb) / .62), transparent 40%),
        var(--warm);
    box-shadow: inset 0 0 0 1px rgb(var(--white-rgb) / .35);
    padding: .85rem;
}

.style-sample-device-frame {
    --device-width: 350px;
    --device-height: 500px;
    --device-bezel: #242421;
    --device-screen: #f5f4ef;
    --device-radius: 24px;
    --device-padding: 18px;
    --device-content-top: 58px;
    --device-content-bottom: 76px;
    --device-content-side: 40px;
}

.style-sample-preview-sheet {
    background: var(--device-screen);
    overflow: hidden;
    filter: grayscale(1) contrast(1.03) brightness(.99);
}

.style-sample-book-render {
    --deckle-section-preview-scale: 1;
    box-sizing: border-box;
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    color: var(--deckle-style-ink, var(--ink));
    font-family: var(--deckle-builder-body-font, Georgia, "Times New Roman", serif);
    background: var(--deckle-style-paper, #fff);
    padding:
        var(--style-sample-content-top, 58px)
        var(--style-sample-content-side, 40px)
        var(--style-sample-content-bottom, 76px);
}

.style-sample-book-render > .book-section {
    box-sizing: border-box;
    position: relative;
    width: calc(100% / var(--deckle-section-preview-scale, 1));
    max-width: none;
    max-height: none;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: visible;
    background: transparent;
    transform: translateY(var(--deckle-section-preview-offset-y, 0px)) scale(var(--deckle-section-preview-scale, 1));
    transform-origin: left top;
}

.style-sample-book-render::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 3.2rem;
    content: "";
    pointer-events: none;
    background: linear-gradient(to bottom, transparent, var(--deckle-style-paper, #fff));
}

.style-sample-book-render > .section-preview-is-excerpt::after {
    display: none !important;
    content: none !important;
}

.style-sample-book-render .book-section-inner {
    box-sizing: border-box;
    width: 100%;
    padding-top: 0;
}

.style-sample-book-render .book-content,
.style-sample-book-render .chapter-content {
    box-sizing: border-box;
    max-height: none;
    overflow: visible;
    width: 100%;
}

.style-sample-book-render > .section-preview-display-page {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: var(--deckle-section-preview-height, 72vh) !important;
    text-align: center !important;
}

/*
 * Parity fix: title/half-title pages are block/top-flow in the EPUB, print and
 * book preview (title starts ~2em from the top, per each preset's title-page
 * architecture) -- not vertically centred. The generic display-page rule above
 * centres them, which broke parity with everywhere else. Keep the genuinely
 * centred display pages (dedication, praise, also_by, ...) flex-centred; render
 * title pages block so the preset-editor preview matches the real output.
 */
.style-sample-book-render > .section-type-title_page.section-preview-display-page,
.style-sample-book-render > .section-type-half_title.section-preview-display-page {
    display: block !important;
}

.style-sample-book-render > .section-preview-body-start {
    max-height: var(--deckle-section-preview-height, 72vh) !important;
    min-height: 0 !important;
}

.style-sample-book-render > .section-preview-body-start .book-section-inner {
    padding-top: clamp(1.4rem, calc(var(--deckle-preview-vh, 1vh) * 8), 3.4rem) !important;
}

.style-sample-book-render[data-style-sample-kind="body_text"] .book-section-inner,
.style-sample-book-render[data-style-sample-kind="special_blocks"] .book-section-inner {
    padding-top: 0 !important;
}

.style-sample-book-render[data-style-sample-kind="body_text"] .book-content,
.style-sample-book-render[data-style-sample-kind="body_text"] .chapter-content,
.style-sample-book-render[data-style-sample-kind="special_blocks"] .book-content,
.style-sample-book-render[data-style-sample-kind="special_blocks"] .chapter-content {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

.style-sample-book-render > .section-preview-body-start .book-content,
.style-sample-book-render > .section-preview-body-start .chapter-content,
.style-sample-book-render > .section-preview-matter-page {
    max-height: var(--deckle-section-preview-height, 72vh) !important;
    overflow: hidden !important;
}

.style-browser-card[hidden],
.style-preset-empty[hidden] {
    display: none !important;
}

@media (max-width: 1199.98px) {
    .style-browser-shell {
        grid-template-columns: minmax(10rem, .6fr) minmax(20rem, 1fr);
    }

    .style-browser-preview {
        position: static;
        grid-column: 1 / -1;
    }
}

@media (max-height: 820px) and (min-width: 1200px) {
    .style-sample-device-frame {
        --device-scale: .92;
    }
}

@media (max-height: 700px) and (min-width: 1200px) {
    .style-sample-device-frame {
        --device-scale: .84;
    }
}

@media (max-width: 767.98px) {
    .style-presets-index {
        height: auto;
        min-height: calc(100vh - var(--topnav-height));
        overflow: visible;
    }

    .style-browser-shell {
        display: grid;
        grid-template-columns: 1fr;
    }

    .style-browser-filters,
    .style-browser-list {
        position: static;
        overflow: visible;
        max-height: none;
        grid-template-columns: 1fr;
    }

    .style-browser-preview {
        height: auto;
        position: static;
        overflow: visible;
    }

    .style-browser-card {
        grid-template-columns: 1fr;
    }

    .style-browser-card > .panel-link,
    .style-browser-card-actions {
        grid-column: auto;
        justify-self: start;
    }

}


.gsi-material-button {
    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    -webkit-appearance: none;
    background-color: #fff;
    background-image: none;
    border: 1px solid #747775;
    border-radius: 20px;
    box-sizing: border-box;
    color: #1f1f1f;
    cursor: pointer;
    font-family: Roboto, Arial, sans-serif;
    font-size: var(--text-sm);
    height: 40px;
    letter-spacing: 0.25px;
    outline: none;
    overflow: hidden;
    padding: 0 12px;
    position: relative;
    text-align: center;
    transition: background-color .218s, border-color .218s, box-shadow .218s;
    vertical-align: middle;
    white-space: nowrap;
    width: 100%;
    max-width: 400px;
    min-width: min-content;
}

.gsi-material-button .gsi-material-button-icon {
    height: 20px;
    margin-right: 10px;
    min-width: 20px;
    width: 20px;
}

.gsi-material-button .gsi-material-button-content-wrapper {
    align-items: center;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    height: 100%;
    justify-content: space-between;
    position: relative;
    width: 100%;
}

.gsi-material-button .gsi-material-button-contents {
    flex-grow: 1;
    font-family: Roboto, Arial, sans-serif;
    font-weight: var(--weight-semibold);
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: top;
}

.gsi-material-button .gsi-material-button-state {
    transition: opacity .218s;
    bottom: 0;
    left: 0;
    opacity: 0;
    position: absolute;
    right: 0;
    top: 0;
}

.gsi-material-button:disabled {
    cursor: default;
    background-color: #ffffff61;
    border-color: #1f1f1f1f;
}

.gsi-material-button:disabled .gsi-material-button-contents,
.gsi-material-button:disabled .gsi-material-button-icon {
    opacity: 38%;
}

.gsi-material-button:not(:disabled):active .gsi-material-button-state,
.gsi-material-button:not(:disabled):focus .gsi-material-button-state {
    background-color: #303030;
    opacity: 12%;
}

.gsi-material-button:not(:disabled):hover {
    box-shadow: 0 1px 2px 0 rgba(60, 64, 67, .30), 0 1px 3px 1px rgba(60, 64, 67, .15);
}

.gsi-material-button:not(:disabled):hover .gsi-material-button-state {
    background-color: #303030;
    opacity: 8%;
}

.feedback-thread {
    display: grid;
    gap: .9rem;
}

.feedback-thread-item {
    border: 1px solid var(--deckle-border, #ded2c1);
    border-radius: 8px;
    padding: 1rem;
    background: #fffaf3;
}

.feedback-thread-item.admin {
    border-color: rgba(47, 96, 63, .24);
    background: #f5fbf4;
}

/* Post-import review: reclassify section-type list */
.studio-reclassify-list {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    max-height: 22rem;
    overflow-y: auto;
    padding-right: .25rem;
}

.studio-reclassify-row {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.studio-reclassify-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.studio-reclassify-row .form-select {
    flex: 0 0 auto;
    width: auto;
    min-width: 12rem;
}
