@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Poppins:wght@600;700;800&display=swap');

:root {
    --codex-bg: #0f172a;
    --codex-surface: #111827;
    --codex-card: #1f2937;
    --codex-dark: #f9fafb;
    --codex-slate: #e5e7eb;
    --codex-gold: #d6b85a;
    --codex-muted: #9ca3af;
    --codex-border: rgba(255,255,255,0.08);
    --codex-radius: 18px;
}

body {
    background:
        radial-gradient(circle at top left, rgba(214,184,90,0.14), transparent 35%),
        linear-gradient(135deg, #0f172a, #111827);
    color: var(--codex-dark);
    font-family: "Inter", system-ui, sans-serif;
    min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6,
.navbar-brand {
    font-family: "Poppins", system-ui, sans-serif;
}

.navbar {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.codex-sidebar {
    background: rgba(17, 24, 39, 0.92);
    border-right: 1px solid var(--codex-border);
}

.codex-sidebar-title {
    font-family: "Poppins", system-ui, sans-serif;
    font-weight: 800;
    letter-spacing: -0.04em;
    margin-bottom: 1.25rem;
    color: var(--codex-gold);
}

.codex-sidebar .list-group-item {
    background: transparent;
    border: 0;
    border-radius: 14px;
    margin-bottom: 8px;
    color: var(--codex-slate);
    font-weight: 600;
    transition: all 0.18s ease;
}

.codex-sidebar .list-group-item:hover {
    transform: translateX(4px);
    background: rgba(255,255,255,0.08);
    color: #ffffff;
}

.codex-card,
.codex-stat,
.card {
    background: rgba(31,41,55,0.94);
    border: 1px solid var(--codex-border);
    border-radius: var(--codex-radius);
    color: var(--codex-dark);
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.28);
}

.codex-card {
    transition: all 0.2s ease;
}

.codex-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.38);
}

.codex-card-soft {
    background: linear-gradient(135deg, rgba(31,41,55,0.96), rgba(17,24,39,0.96));
    border-radius: var(--codex-radius);
    border: 1px solid var(--codex-border);
    color: var(--codex-dark);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
}

.codex-title {
    font-weight: 800;
    letter-spacing: -0.04em;
}

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

.btn-codex,
.btn-codex-gold {
    border-radius: 999px;
    padding: 0.6rem 1.25rem;
    font-weight: 700;
    border: 0;
}

.btn-codex {
    background: var(--codex-slate);
    color: #111827;
}

.btn-codex-gold {
    background: var(--codex-gold);
    color: #111827;
}

.btn-codex-gold:hover {
    background: #b8921f;
    color: #111827;
}

.codex-editor {
    min-height: 620px;
    font-size: 1.15rem;
    line-height: 1.9;
    border: 0;
    outline: none;
    resize: vertical;
    background: #0f172a;
    color: #f9fafb;
}

.codex-stat {
    padding: 1rem;
}

.codex-page {
    max-width: 1500px;
    margin: 0 auto;
}

.form-control,
.form-select,
textarea {
    background-color: #111827;
    color: #f9fafb;
    border-color: var(--codex-border);
}

.form-control:focus,
.form-select:focus,
textarea:focus {
    background-color: #111827;
    color: #f9fafb;
    border-color: var(--codex-gold);
    box-shadow: 0 0 0 0.2rem rgba(214,184,90,0.15);
}

.list-group-item {
    background-color: rgba(31,41,55,0.94);
    color: var(--codex-dark);
    border-color: var(--codex-border);
}

/* v0.26.2 - Brand Identity Polish */
:root {
    --codex-black: #040608;
    --codex-ink: #070b12;
    --codex-navy: #08121f;
    --codex-deep: #0d1627;
    --codex-card: rgba(9, 14, 24, 0.96);
    --codex-card-soft: rgba(14, 22, 36, 0.94);
    --codex-parchment: #f6e7be;
    --codex-gold: #d8b25c;
    --codex-gold-bright: #f1d98d;
    --codex-gold-dark: #9e6b2c;
    --codex-muted: rgba(246,231,190,0.68);
    --codex-border: rgba(216,178,92,0.22);
}

body {
    background:
        radial-gradient(circle at 72% 0%, rgba(216,178,92,0.13), transparent 30%),
        radial-gradient(circle at 12% 0%, rgba(216,178,92,0.08), transparent 32%),
        linear-gradient(135deg, var(--codex-black), var(--codex-navy) 52%, #05070c);
    color: var(--codex-parchment);
}

h1, h2, h3, h4, h5, h6,
.navbar-brand,
.codex-sidebar-title,
.codex-study-title,
.codex-title {
    font-family: Georgia, 'Times New Roman', serif;
    letter-spacing: 0.015em;
}

.codex-card,
.codex-stat,
.card,
.codex-card-soft {
    background:
        radial-gradient(circle at top right, rgba(216,178,92,0.07), transparent 34%),
        linear-gradient(180deg, rgba(12,18,30,0.97), rgba(6,10,17,0.97));
    border-color: rgba(216,178,92,0.18);
}

.btn-codex-gold {
    background: linear-gradient(135deg, #fff0ad, #d8b25c 52%, #a77330);
    color: #130f08;
    border: 1px solid rgba(255,240,173,0.3);
}

/* =========================================================
   Personal Library Shelves & Spines
   ========================================================= */
.library-page {
    --library-wood: #56351f;
    --library-wood-light: #8b5a32;
    --library-wood-dark: #2d190e;
    --library-shelf-edge: #a76d38;
}

/* Shelf Section without background or borders */
.library-shelf-section {
    margin-bottom: 2.5rem;
    padding: 0.5rem 0 1rem;
    border: none !important;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none !important;
}

.library-shelf-heading,
.library-series-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
}
.library-shelf-heading { padding: .3rem .35rem 1rem; }
.library-shelf-heading h2,
.library-series-heading h3 { margin: 0; color: var(--codex-dark); }
.library-shelf-heading h2 { font-family: Georgia, serif; }
.library-shelf-label,
.library-series-kicker {
    display: block;
    margin-bottom: .18rem;
    color: var(--codex-gold-bright, var(--codex-gold));
    font-size: .66rem;
    font-weight: 800;
    letter-spacing: .16em;
}
.library-series-group + .library-series-group { margin-top: 2rem; }
.library-series-heading { padding: 0 .6rem .55rem; }
.library-series-heading h3 { font-size: 1rem; font-weight: 750; }
.library-series-count {
    padding: .25rem .55rem;
    border: 1px solid var(--codex-border);
    border-radius: 999px;
    color: var(--codex-muted);
    font-size: .72rem;
}

/* Shelf Bay: transparent back wall */
.library-wood-shelf {
    position: relative;
    display: block;
    min-height: 0;
    padding: 24px 20px 0;
    overflow: visible;
    border: none !important;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none !important;
}

.library-books-row {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 14px;
    min-height: 275px;
}

.library-book {
    position: relative;
    flex: 0 0 auto;
}

/* Original Spines */
.library-spine {
    position: relative;
    display: block;
    width: 72px;
    height: 268px;
    color: #fff;
    text-decoration: none;
    border-radius: 5px 5px 2px 2px;
    transform-origin: bottom center;
    transition: transform .2s ease, filter .2s ease;
    box-shadow: 5px 5px 12px rgba(0,0,0,.45);
    overflow: hidden;
    background: hsl(var(--spine-hue) 42% 30%);
}

.library-spine:hover {
    transform: translateY(-10px);
    filter: brightness(1.08);
    color: #fff;
}

.library-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.library-cover-placeholder {
    display: grid;
    place-items: center;
    font-family: Georgia, serif;
    font-size: 3rem;
    background: linear-gradient(145deg, hsl(var(--spine-hue) 48% 39%), hsl(var(--spine-hue) 44% 22%));
}

.library-spine-face {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 14px 7px;
    text-align: center;
    background: linear-gradient(90deg, rgba(0,0,0,.45), rgba(255,255,255,.12) 45%, rgba(0,0,0,.35));
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    text-shadow: 0 1px 3px #000;
    opacity: 0;
    transition: opacity .2s ease;
}

.library-spine:not(:has(.library-cover-placeholder)) .library-spine-face {
    opacity: 0;
}

.library-spine:hover .library-spine-face,
.library-spine:has(.library-cover-placeholder) .library-spine-face {
    opacity: 1;
}

.library-spine-face strong {
    font-family: Georgia, serif;
    letter-spacing: .04em;
}

.library-spine-face small {
    opacity: .85;
}

.library-book-meta {
    display: none;
}

/* Solid Timber Shelf Base Plank */
.library-shelf-plank {
    position: relative !important;
    left: -8px;
    right: -8px;
    bottom: 0;
    height: 26px;
    border-radius: 3px 3px 8px 8px;
    background:
        linear-gradient(180deg, rgba(255,255,255,.16), transparent 16%),
        linear-gradient(180deg, var(--library-shelf-edge), var(--library-wood) 34%, var(--library-wood-dark));
    box-shadow:
        0 8px 0 var(--library-wood-dark),
        0 14px 22px rgba(0,0,0,.6),
        inset 0 -3px 0 rgba(0,0,0,.25),
        inset 0 1px 0 rgba(255,255,255,.18);
}

.library-shelf-plank span {
    position: absolute;
    inset: 5px 6% auto;
    height: 2px;
    opacity: .3;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent);
}

.library-volume-badge {
    position: absolute;
    z-index: 3;
    top: 5px;
    right: 5px;
    min-width: 25px;
    padding: .18rem .3rem;
    border-radius: 999px;
    background: rgba(10,8,6,.82);
    color: #fff4cf;
    font-size: .62rem;
    font-weight: 800;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.35);
}

/* Grid View */
.library-grid-view .library-shelf-section { padding: 1rem 0; }
.library-grid-view .library-series-group { margin-bottom: 1.5rem; }
.library-grid-view .library-wood-shelf {
    padding: 0;
    background: none !important;
    box-shadow: none !important;
}
.library-grid-view .library-books-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    align-items: stretch;
    gap: 1.2rem;
    min-height: 0;
}
.library-grid-view .library-shelf-plank { display: none; }
.library-grid-view .library-book {
    display: flex;
    min-width: 0;
    flex-direction: column;
    padding: 14px;
    border: 1px solid var(--codex-border);
    border-radius: 14px;
    background: var(--codex-card-bg);
    box-shadow: 0 10px 24px rgba(0,0,0,.13);
}
.library-grid-view .library-spine {
    width: 100%;
    height: 280px;
    transform: none;
    box-shadow: none;
}
.library-grid-view .library-spine:hover { transform: translateY(-3px); }
.library-grid-view .library-spine-face { display: none; }
.library-grid-view .library-book-meta { display: block; padding-top: 14px; }
.library-grid-view .library-book-meta h5 { margin-bottom: .2rem; }
.library-grid-view .library-book-meta p { margin-bottom: .35rem; opacity: .75; }
.library-series-meta {
    margin-bottom: .4rem;
    color: var(--codex-gold-bright, var(--codex-gold));
    font-size: .78rem;
    font-weight: 700;
}
.library-book-blurb {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    margin: .55rem 0;
    color: var(--codex-muted) !important;
    font-size: .82rem;
    line-height: 1.45;
}
.library-rating { color: #d4af37; letter-spacing: .08em; }

/* =========================================================
   ISBN Scanner Viewfinder & Camera Elements
   ========================================================= */
.isbn-scanner-page .eyebrow {
    font-size: .72rem;
    letter-spacing: .16em;
    font-weight: 800;
    color: var(--codex-accent, #c9a45c);
}
.scanner-card {
    border: 1px solid color-mix(in srgb, var(--codex-accent, #c9a45c) 35%, transparent);
}
.scanner-stage {
    position: relative;
    min-height: 500px;
    background: radial-gradient(circle at 50% 45%, #23302f 0, #101817 55%, #080d0d 100%);
    overflow: hidden;
    display: grid;
    place-items: center;
}
.scanner-stage video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity .3s ease;
    background: #050707;
}
.scanner-stage.is-live video {
    opacity: 1 !important;
    visibility: visible !important;
}
.scanner-stage.is-live .scanner-placeholder {
    opacity: 0;
    pointer-events: none;
}
.scanner-placeholder {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 340px;
    padding: 2rem;
    color: #e9e0ce;
    transition: opacity .25s ease;
}
.scanner-placeholder strong,
.scanner-placeholder span { display: block; }
.scanner-placeholder span { opacity: .72; margin-top: .6rem; }
.scanner-book-glyph {
    font-size: 4rem;
    color: #d6b46d;
    text-shadow: 0 0 28px rgba(214,180,109,.35);
}
.scanner-vignette {
    position: absolute;
    inset: 0;
    z-index: 3;
    background: radial-gradient(ellipse at center, transparent 25%, rgba(0,0,0,.55) 100%);
    pointer-events: none;
}
.scanner-frame {
    position: absolute;
    z-index: 4;
    width: min(78%, 620px);
    aspect-ratio: 1.7 / 1;
    pointer-events: none;
}
.scanner-frame .corner {
    position: absolute;
    width: 56px;
    height: 56px;
    border-color: #e2bc6d;
    filter: drop-shadow(0 0 8px rgba(226,188,109,.75));
}
.corner-tl { left: 0; top: 0; border-left: 4px solid; border-top: 4px solid; }
.corner-tr { right: 0; top: 0; border-right: 4px solid; border-top: 4px solid; }
.corner-bl { left: 0; bottom: 0; border-left: 4px solid; border-bottom: 4px solid; }
.corner-br { right: 0; bottom: 0; border-right: 4px solid; border-bottom: 4px solid; }
.scanner-line {
    position: absolute;
    left: 4%;
    right: 4%;
    height: 3px;
    top: 8%;
    background: linear-gradient(90deg, transparent, #fff1b6 15%, #d3a94f 50%, #fff1b6 85%, transparent);
    box-shadow: 0 0 10px #e8c46e, 0 0 28px rgba(232,196,110,.85);
    animation: codex-scan-line 2.4s ease-in-out infinite;
}
.scanner-line:after {
    content: "";
    position: absolute;
    left: 10%;
    right: 10%;
    top: -14px;
    height: 30px;
    background: radial-gradient(ellipse, rgba(232,196,110,.22), transparent 70%);
}
@keyframes codex-scan-line {
    0%, 100% { top: 8%; opacity: .65; }
    50% { top: 90%; opacity: 1; }
}
.scanner-instruction {
    position: absolute;
    z-index: 5;
    bottom: 24px;
    padding: .55rem 1rem;
    border-radius: 999px;
    background: rgba(5,10,10,.72);
    border: 1px solid rgba(226,188,109,.35);
    color: #f5e7c6;
    backdrop-filter: blur(8px);
}
.scanner-success {
    position: absolute;
    z-index: 7;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(7,20,14,.86);
    color: #eaffef;
    opacity: 0;
    pointer-events: none;
    transform: scale(.98);
    transition: .25s ease;
}
.scanner-success.is-visible {
    opacity: 1;
    transform: scale(1);
}
.scanner-success-mark {
    display: grid;
    place-items: center;
    width: 86px;
    height: 86px;
    border-radius: 50%;
    font-size: 3rem;
    background: #2d9c5b;
    box-shadow: 0 0 38px rgba(63,210,116,.5);
    margin-bottom: 1rem;
}
.scanner-success strong { font-size: 1.35rem; }
.scanner-success span:last-child { margin-top: .35rem; opacity: .8; letter-spacing: .08em; }
.scanner-stage.is-detected .scanner-frame { filter: hue-rotate(75deg); }
.athena-lookup-card {
    background: linear-gradient(145deg, color-mix(in srgb, var(--codex-card-bg, #17191c) 94%, #76602c 6%), var(--codex-card-bg, #17191c));
}
.athena-orb {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    font-family: Georgia, serif;
    font-weight: 700;
    font-size: 1.45rem;
    color: #1a160d;
    background: radial-gradient(circle at 35% 30%, #fff0b7, #c69c46 65%, #6f4f1d);
    box-shadow: 0 0 26px rgba(198,156,70,.34);
}
.lookup-steps { display: grid; gap: .75rem; margin-top: 1.25rem; }
.lookup-steps > div {
    position: relative;
    display: grid;
    grid-template-columns: 38px 1fr 18px;
    align-items: center;
    gap: .8rem;
    padding: .85rem;
    border-radius: .75rem;
    border: 1px solid color-mix(in srgb, currentColor 12%, transparent);
    opacity: .58;
    transition: .25s ease;
}
.lookup-steps > div > span {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--codex-accent, #c9a45c) 18%, transparent);
    font-weight: 800;
}
.lookup-steps strong, .lookup-steps small { display: block; }
.lookup-steps small { opacity: .68; }
.lookup-steps i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: currentColor;
    opacity: .2;
}
.lookup-steps .is-active {
    opacity: 1;
    border-color: color-mix(in srgb, var(--codex-accent, #c9a45c) 55%, transparent);
    transform: translateX(4px);
}
.lookup-steps .is-active i {
    background: var(--codex-accent, #c9a45c);
    opacity: 1;
    box-shadow: 0 0 12px var(--codex-accent, #c9a45c);
    animation: lookup-pulse 1s infinite;
}
.lookup-steps .is-complete { opacity: 1; }
.lookup-steps .is-complete i { background: #42b96d; opacity: 1; }
.lookup-steps .is-error i { background: #d85a5a; opacity: 1; }
@keyframes lookup-pulse { 50% { transform: scale(1.6); opacity: .45; } }

.scanner-stage.is-camera-loading:before {
    content: "Starting camera…";
    position: absolute;
    z-index: 8;
    inset: auto 50% 50% auto;
    transform: translate(50%, 50%);
    padding: .65rem 1rem;
    border-radius: 999px;
    background: rgba(0,0,0,.72);
    color: #fff;
    border: 1px solid rgba(226,188,109,.45);
}
.scanner-camera-select { width: auto; min-width: 190px; max-width: 310px; }
.scanner-zoom-controls {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .25rem .4rem;
    border: 1px solid color-mix(in srgb, var(--codex-accent, #c9a45c) 28%, transparent);
    border-radius: 10px;
    background: color-mix(in srgb, var(--codex-card-bg, #fff) 88%, transparent);
}
.scanner-zoom-controls #zoomValue { min-width: 3.25rem; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.scanner-zoom-controls .btn { min-width: 2.25rem; font-size: 1.15rem; line-height: 1; }

@media (max-width: 767.98px) {
    .scanner-stage { min-height: 390px; }
    .scanner-frame { width: 88%; aspect-ratio: 1.55/1; }
    .scanner-stage video { object-fit: contain; }
}
@media (max-width: 575.98px) {
    .scanner-zoom-controls { width: 100%; justify-content: center; }
    .scanner-camera-select { width: 100%; max-width: none; }
}

/* =========================================================
   Personal Library Fullscreen Shell & Navigation
   ========================================================= */
body.codex-library-mode { overflow-x: hidden; }
.codex-library-fullscreen-shell {
    width: 100%;
    min-height: calc(100vh - 64px);
    padding: 0 0 2rem;
    background: var(--codex-page-bg, var(--bs-body-bg));
}
.library-fullscreen-page { max-width: none !important; width: 100%; }
.library-nav-bar {
    position: sticky;
    top: 0;
    z-index: 1010;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem 1rem;
    border: 1px solid color-mix(in srgb, var(--codex-accent, #c9a45c) 42%, transparent);
    border-radius: 16px;
    background: color-mix(in srgb, var(--codex-sidebar-bg, #16120f) 92%, transparent);
    box-shadow: 0 12px 30px rgba(0,0,0,.2);
    backdrop-filter: blur(14px);
}
.library-nav-brand { display: flex; align-items: center; gap: .8rem; color: #fff; }
.library-nav-brand strong, .library-nav-brand small { display: block; }
.library-nav-brand small { opacity: .65; font-size: .76rem; }
.library-nav-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--codex-accent, #c9a45c) 18%, transparent);
    border: 1px solid color-mix(in srgb, var(--codex-accent, #c9a45c) 50%, transparent);
}
.library-nav-actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.library-heading-row { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; }
.library-count-badge {
    padding: .45rem .8rem;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--codex-accent, #c9a45c) 40%, transparent);
    background: color-mix(in srgb, var(--codex-card-bg, #fff) 92%, transparent);
    font-weight: 700;
}
.library-search-bar { position: relative; z-index: 2; }

/* Stat Cards */
.library-living-overview {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1rem;
}
a.library-stat-card {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--codex-border, rgba(255, 255, 255, .14));
    border-radius: 16px;
    background: var(--codex-card-bg, rgba(20, 20, 24, .72));
    box-shadow: 0 10px 24px rgba(0, 0, 0, .12);
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
a.library-stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--codex-accent, #b8944e);
    box-shadow: 0 16px 30px rgba(0, 0, 0, .2);
}
a.library-stat-card > span { font-size: 1.55rem; }
a.library-stat-card strong { display: block; font-size: 1.35rem; line-height: 1; }
a.library-stat-card small { display: block; margin-top: .3rem; opacity: .72; }
.library-tbr-card {
    background: color-mix(in srgb, var(--codex-card-bg, rgba(20, 20, 24, .72)) 78%, var(--codex-accent, #b8944e) 22%);
}

@media (max-width: 1399px) { .library-living-overview { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 767px) { .library-living-overview { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .library-living-overview { grid-template-columns: 1fr; } }

/* =========================================================
   Full-Page Transparent Backdrop Layer
   ========================================================= */
body.has-custom-page-backdrop {
    background-image:
        linear-gradient(180deg, rgba(7, 10, 18, 0.20) 0%, rgba(5, 7, 13, 0.30) 100%),
        var(--user-page-backdrop) !important;
    background-size: cover !important;
    background-position: center center !important;
    background-attachment: fixed !important;
    background-repeat: no-repeat !important;
}

body.has-custom-page-backdrop .codex-library-fullscreen-shell,
body.has-custom-page-backdrop .library-page {
    background: transparent !important;
}

/* Make shelf sections and backings 100% transparent so artwork shows completely */
body.has-custom-page-backdrop .library-shelf-section {
    background: transparent !important;
    backdrop-filter: none !important;
    border: none !important;
    box-shadow: none !important;
}

body.has-custom-page-backdrop .library-stat-card,
body.has-custom-page-backdrop .library-search-bar {
    background: rgba(17, 24, 39, 0.55) !important;
    backdrop-filter: blur(10px);
}

@media (max-width: 576px) {
    .library-wood-shelf { gap: 8px; padding: 20px 12px 0; }
    .library-spine { width: 56px; height: 220px; }
    .library-grid-view .library-wood-shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .library-grid-view .library-spine { height: 230px; }
}
/* =========================================================
   FORCED TRANSPARENCY: Remove all brown panels & frosting
   ========================================================= */

/* 1. Eliminate any frosted glass or solid fills on shelf sections */
.library-shelf-section,
body .library-shelf-section,
body.has-custom-page-backdrop .library-shelf-section,
body.codex-library-mode .library-shelf-section {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 0.5rem 0 1.5rem !important;
}

/* 2. Strip the vertical brown wood-grain background completely */
.library-wood-shelf,
.library-shelf-view .library-wood-shelf,
.codex-library-mode .library-wood-shelf,
.codex-library-mode .library-shelf-view .library-wood-shelf,
body .library-wood-shelf {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    border: none !important;
    padding-top: 10px !important;
    padding-bottom: 0 !important;
}

/* 3. Keep the wooden bottom plank anchored directly under the books */
.library-shelf-plank,
.library-wood-shelf .library-shelf-plank {
    position: relative !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 24px !important;
    margin-top: 0 !important;
    display: block !important;
    background: linear-gradient(180deg, #8b5a32 0%, #56351f 40%, #2d190e 100%) !important;
    border-top: 2px solid #a76d38 !important;
    box-shadow: 0 14px 25px rgba(0, 0, 0, 0.75) !important;
}

/* 4. Ensure containers do not hide the body background wallpaper */
.codex-library-fullscreen-shell,
.library-fullscreen-page,
.library-page,
#libraryCollection {
    background: transparent !important;
    background-color: transparent !important;
}