html {
    overflow-x: hidden;
    max-width: 100vw;
    width: 100%;
}

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700&family=Playfair+Display:ital,wght@0,400;0,700;1,400&display=swap');

:root {
    --bg-color: #0c090a;
    --wood-light: #523428;
    --wood-base: #3b2319;
    --wood-dark: #22120b;
    --text-color: #f7ede2;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Playfair Display', serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

body::after {
    content: '';
    position: fixed;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    background-image:
        radial-gradient(circle at 50% 0%, rgba(10, 5, 5, 0.4) 0%, rgba(5, 2, 2, 0.85) 100%),
        url('https://images.unsplash.com/photo-1586358489420-a2579a74ea1d?fm=jpg&w=1500&auto=format&fit=crop');
    background-size: cover;
    background-position: center;
    filter: blur(8px);
    z-index: -2;
    pointer-events: none;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.02) 2px, transparent 2px);
    background-size: 50px 50px;
    opacity: 0.5;
    pointer-events: none;
    z-index: -1;
}

/* ===== HEADER ===== */
.library-header {
    text-align: center;
    padding: 3rem 1rem 1.5rem 1rem;
    position: relative;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.library-header h2 {
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    color: #ffd700;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.6), 0 3px 8px rgba(0, 0, 0, 1), 0 0 30px rgba(0, 0, 0, 0.9);
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
    z-index: 500;
}

.library-header p {
    font-size: 1.1rem;
    color: #c9bca7;
    font-style: italic;
    margin-top: 0.5rem;
    margin-bottom: 1.2rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 1);
}

.daffodil-svg {
    width: 45px;
    height: 45px;
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.4));
    transition: transform 0.5s ease;
}

.daffodil-svg:hover {
    transform: scale(1.1) rotate(12deg);
}

/* ─── UPLOAD BUTTON ─── */
.upload-btn {
    background: linear-gradient(135deg, #aa7700, #553300);
    border: 1px solid rgba(255, 215, 0, 0.5);
    color: #f7ede2;
    font-family: 'Cinzel', serif;
    padding: 0.65rem 1.4rem;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(170, 119, 0, 0.3);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.5px;
}

.upload-btn:hover {
    background: linear-gradient(135deg, #cc9900, #664400);
    box-shadow: 0 6px 20px rgba(204, 153, 0, 0.5);
    transform: translateY(-2px);
}



.category-item {
    color: #e8dcc8;
    padding: 11px 22px;
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.category-item:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
}

.category-item.active {
    color: #ffd700;
    background: rgba(255, 215, 0, 0.1);
}

/* ===== SHELVES ===== */
.shelves-wrapper {
    width: 100%;
    padding: 0 0 6rem 0;
    display: flex;
    flex-direction: column;
    gap: 40px;
    min-height: calc(100vh - 220px);
    position: relative;
    z-index: 10;
}

.shelf {
    position: relative;
    display: flex;
    justify-content: flex-start;
    align-items: flex-end;
    flex-wrap: nowrap;
    width: 100%;
    min-height: 200px;
    padding: 0 45px;
    box-sizing: border-box;
    z-index: 10;
}

.shelf::before {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 0;
    width: 100%;
    height: 15px;
    background:
        radial-gradient(circle at center, #ffffff 1px, rgba(255, 255, 255, 0.9) 2px, rgba(255, 215, 0, 0.6) 4px, transparent 7px),
        linear-gradient(to bottom, var(--wood-light), var(--wood-base));
    background-size: 140px 100%, 100% 100%;
    background-position: left center, 0 0;
    background-repeat: repeat-x, no-repeat;
    border-radius: 2px 2px 0 0;
    box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.1), 0 -2px 10px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.shelf::after {
    content: '';
    position: absolute;
    bottom: -35px;
    left: 0;
    width: 100%;
    height: 20px;
    background: linear-gradient(to right, var(--wood-dark), var(--wood-base) 10%, var(--wood-base) 90%, var(--wood-dark));
    border-radius: 0 0 4px 4px;
    box-shadow: 0 20px 30px rgba(0, 0, 0, 0.9), 0 10px 15px rgba(0, 0, 0, 0.7);
    z-index: 9;
}

/* ===== BO'SH JOY (Bitta kitob sig'adigan ochiqlik) ===== */
.book-gap {
    width: 48px;
    min-width: 44px;
    height: 12px;
    flex-shrink: 0;
    position: relative;
    pointer-events: none;
    margin: 0 4px;
    align-self: flex-end;
}

.book-gap::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 4px;
    right: 4px;
    height: 3px;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.45) 0%, transparent 80%);
    border-radius: 2px;
}

/* Qiyshayib suyanuvchi kitob */
.book.leaning-right {
    z-index: 22;
}

.book.leaning-right:hover {
    z-index: 35;
}

.book.leaning-left {
    z-index: 22;
}

.book.leaning-left:hover {
    z-index: 35;
}

/* ===== BOOK ===== */
.book {
    width: var(--w, 46px);
    height: var(--h, 188px);
    min-width: 38px;
    min-height: 175px;
    background: var(--c, #8b2c45);
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    z-index: 20;
    border-radius: 3px 6px 6px 3px;
    background-image: linear-gradient(to right, rgba(255, 255, 255, 0.2) 0%, rgba(0, 0, 0, 0.4) 100%);
    box-shadow: inset 2px 0 5px rgba(255, 255, 255, 0.1), -3px 0 8px rgba(0, 0, 0, 0.6);
    transform-origin: var(--orig, bottom center);
    transform: rotateZ(var(--r, 0deg)) translateY(0);
    margin-left: var(--ml, 0);
    margin-right: var(--mr, 4px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.book::before {
    content: '';
    position: absolute;
    top: 10%;
    bottom: 10%;
    left: 0;
    width: 100%;
    border-top: 2px solid rgba(255, 215, 0, 0.4);
    border-bottom: 2px solid rgba(255, 215, 0, 0.4);
    pointer-events: none;
}

.book:hover {
    transform: rotateZ(var(--r, 0deg)) translateY(-10px);
    box-shadow: -4px 10px 20px rgba(0, 0, 0, 0.5), inset 4px 0 10px rgba(255, 255, 255, 0.15);
    z-index: 30;
}

/* Foydalanuvchi kitobidagi yulduzcha */
.book.user-book::after {
    content: '✦';
    position: absolute;
    top: 4px;
    right: 3px;
    font-size: 7px;
    color: rgba(255, 215, 0, 0.8);
}

.book-title {
    position: absolute;
    top: 10%;
    bottom: 10%;
    left: 0;
    width: 100%;
    height: 80%;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(0.5rem, 0.65rem, 0.8rem);
    line-height: 1.2;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    color: rgba(255, 230, 200, 0.9);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    letter-spacing: 1px;
    white-space: normal;
    text-align: center;
    overflow: hidden;
}

/* ===== UPLOAD MODAL ===== */
.upload-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(8, 5, 4, 0.92);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.upload-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background: linear-gradient(145deg, #1c1210, #100d0c);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 14px;
    padding: 2rem 2.2rem 1.8rem;
    width: 92%;
    max-width: 430px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.95);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-box h3 {
    font-family: 'Cinzel', serif;
    color: #ffd700;
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    text-align: center;
    letter-spacing: 1px;
}

.close-modal {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: #c9bca7;
    font-size: 1.7rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #ffd700;
}

.form-group {
    margin-bottom: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.82rem;
    color: #a09080;
    font-family: 'Cinzel', serif;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.form-group input[type="text"] {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 215, 0, 0.15);
    color: #f7ede2;
    padding: 0.7rem 1rem;
    border-radius: 7px;
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input[type="text"]:focus {
    border-color: rgba(255, 215, 0, 0.45);
}

.cat-select {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 215, 0, 0.15);
    color: #f7ede2;
    padding: 0.7rem 1rem;
    border-radius: 7px;
    font-family: 'Playfair Display', serif;
    font-size: 0.95rem;
    outline: none;
    cursor: pointer;
}

.color-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.color-swatch {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.color-swatch:hover {
    transform: scale(1.2);
}

.color-swatch.selected {
    border-color: #ffd700;
    transform: scale(1.25);
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.file-drop-zone {
    border: 2px dashed rgba(255, 215, 0, 0.25);
    border-radius: 8px;
    padding: 1.4rem;
    text-align: center;
    cursor: pointer;
    color: #a09080;
    font-size: 0.88rem;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
}

.file-drop-zone:hover,
.file-drop-zone.dragging {
    border-color: rgba(255, 215, 0, 0.5);
    background: rgba(255, 215, 0, 0.03);
    color: #c9bca7;
}

.file-drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.file-drop-zone .drop-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 6px;
}

#fileNameDisplay {
    color: #ffd700;
    font-size: 0.82rem;
    margin-top: 6px;
    font-style: italic;
    word-break: break-all;
}

.save-btn {
    width: 100%;
    background: linear-gradient(135deg, #aa7700, #553300);
    border: 1px solid rgba(255, 215, 0, 0.5);
    color: #f7ede2;
    font-family: 'Cinzel', serif;
    font-weight: bold;
    padding: 0.9rem;
    border-radius: 7px;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 1.2rem;
    letter-spacing: 0.5px;
    transition: all 0.3s;
}

.save-btn:hover {
    background: linear-gradient(135deg, #cc9900, #664400);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(170, 119, 0, 0.4);
}

/* ===== TASDIQLASH MODALI ===== */
.confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(8, 5, 4, 0.88);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}

.confirm-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.confirm-box {
    background: #1a1210;
    border: 1px solid rgba(255, 80, 80, 0.3);
    border-radius: 12px;
    padding: 1.8rem 2rem;
    max-width: 340px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9);
    font-family: 'Playfair Display', serif;
    color: #e8dcc8;
    font-size: 1rem;
}

.confirm-yes {
    background: rgba(200, 50, 50, 0.8);
    border: 1px solid rgba(255, 80, 80, 0.4);
    color: #fff;
    font-family: 'Cinzel', serif;
    padding: 0.6rem 1.4rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.confirm-yes:hover {
    background: rgba(220, 60, 60, 0.9);
}

.confirm-no {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #c9bca7;
    font-family: 'Cinzel', serif;
    padding: 0.6rem 1.4rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.confirm-no:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ===== PDF READER ===== */
.book-reader,
.pdf-reader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0d0908 !important;
    background-color: #0d0908 !important;
    color: #fff;
    z-index: 100000 !important;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.98);
    transition: opacity 0.3s ease, transform 0.3s ease;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.book-reader.active,
.pdf-reader.active {
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: scale(1) !important;
}

body.reader-open {
    overflow: hidden !important;
}

body.reader-open .library-header,
body.reader-open .shelves-wrapper,
body.reader-open .load-more-btn {
    visibility: hidden !important;
    pointer-events: none !important;
}

/* legacy close-reader removed */

.reader-content,
.pdf-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: transparent;
    margin: 0 2rem 2rem 2rem;
    border-radius: 8px;
    overflow: hidden;
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(18, 12, 10, 0.97);
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: #ffd700;
    font-family: 'Cinzel', serif;
    padding: 0.8rem 1.8rem;
    border-radius: 8px;
    font-size: 0.9rem;
    opacity: 0;
    pointer-events: none;
    transition: all 0.35s;
    z-index: 700;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== BO'SH HOLAT ===== */
.empty-shelf-msg {
    color: rgba(201, 188, 167, 0.35);
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 1.05rem;
    text-align: center;
    padding: 5rem 2rem;
    line-height: 2;
    width: 100%;
}

/* ===== TO'LIQ ASAR BELGISI ===== */
.book-badge,
.book-pdf-badge {
    position: absolute;
    top: 6px;
    right: 4px;
    background: #ffd700;
    color: #1a1008;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 1px 4px;
    border-radius: 3px;
    line-height: 1.2;
    letter-spacing: 0.5px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    z-index: 5;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ===== HEADER, BRAND & SVG ===== */
.brand-icon-wrap {
    display: inline-flex;
    align-items: flex-end;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
    margin-right: 15px;
}

.brand-icon-wrap .daffodil-svg,
.filter-menu-btn .daffodil-svg {
    margin: 0;
}

.filter-menu-btn {
    display: inline-flex;
    position: relative;
    align-items: flex-end;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.4));
    margin-left: 15px;
    cursor: pointer;
    z-index: 510;
}

.category-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: #140d0a !important;
    background-color: #140d0a !important;
    border: 1px solid rgba(255, 215, 0, 0.5);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.98), 0 0 25px rgba(0, 0, 0, 0.95);
    z-index: 5000 !important;
    min-width: 270px;
    max-height: 420px;
    overflow-y: auto;
    flex-direction: column;
    padding: 8px 0;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
}

.category-dropdown::-webkit-scrollbar {
    width: 6px;
}

.category-dropdown::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
}

.category-dropdown::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.4);
    border-radius: 4px;
}

.category-dropdown::-webkit-scrollbar-thumb:hover {
    background: #ffd700;
}

.category-item {
    color: #e8dcc8;
    padding: 10px 20px;
    font-family: 'Playfair Display', serif;
    font-size: 1.05rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.category-item:hover {
    background: rgba(255, 215, 0, 0.08);
    color: #ffd700;
}

.category-item.active {
    color: #ffd700;
    background: rgba(255, 215, 0, 0.12);
}

.auth-trigger {
    cursor: default;
    -webkit-user-select: none;
    user-select: none;
}

/* ===== READER TOOLBAR & CONTROLS ===== */
.reader-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 18px;
    background: #140d0a !important;
    background-color: #140d0a !important;
    border-bottom: 1px solid rgba(255, 215, 0, 0.25);
    position: relative;
    z-index: 20;
    flex-shrink: 0;
    gap: 10px;
}

.reader-book-info {
    color: #ffd700;
    font-family: 'Cinzel', serif;
    font-size: 0.96rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.reader-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.reader-font-btn {
    background: rgba(255, 215, 0, 0.08);
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: #ffd700;
    padding: 5px 11px;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
    line-height: 1;
    white-space: nowrap;
}

.reader-font-btn:hover {
    background: rgba(255, 215, 0, 0.2);
    border-color: #ffd700;
}

.close-reader {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    margin: 0;
    font-size: 0.86rem;
    font-weight: 600;
    font-family: inherit;
    color: #ff7878;
    background: rgba(255, 107, 107, 0.12);
    border: 1px solid rgba(255, 107, 107, 0.35);
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.2s ease;
    line-height: 1;
}

.close-reader:hover {
    background: rgba(255, 107, 107, 0.25);
    border-color: #ff6b6b;
    color: #ffffff;
}

.close-reader .close-icon {
    font-size: 1.15rem;
    line-height: 1;
}

.reader-frame {
    display: none;
    width: 100%;
    height: 100%;
    border: none;
}

.dynamic-reader {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 30px 20px;
    background: #f4eee3;
    color: #221c16;
    display: none;
}

/* ===== SEARCH & HEADER EXTRAS ===== */
.daffodil-svg {
    display: inline-block;
    width: 45px;
    height: 45px;
    vertical-align: middle;
    margin: 0 12px;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.4));
    transition: transform 0.5s ease;
}

.daffodil-svg:hover {
    transform: scale(1.1) rotate(15deg);
}

.library-header h2 {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 500;
}

.search-container {
    width: 100%;
    max-width: 600px;
    margin: 10px auto 18px auto;
    position: relative;
    z-index: 10;
}

.search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrap input {
    width: 100%;
    padding: 12px 20px 12px 46px;
    background: rgba(22, 14, 11, 0.85);
    border: 1px solid rgba(255, 215, 0, 0.35);
    border-radius: 30px;
    color: #f7ede2;
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    outline: none;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), inset 0 1px 3px rgba(255, 215, 0, 0.1);
    transition: all 0.3s ease;
}

.search-input-wrap input:focus {
    border-color: #ffd700;
    box-shadow: 0 6px 25px rgba(255, 215, 0, 0.25), inset 0 1px 4px rgba(255, 215, 0, 0.2);
    background: rgba(26, 17, 14, 0.95);
}

.search-input-wrap .search-icon {
    position: absolute;
    left: 18px;
    font-size: 1.1rem;
    color: #ffd700;
    pointer-events: none;
    opacity: 0.85;
}

.library-stats {
    font-size: 0.85rem;
    color: #c9bca7;
    margin-top: 4px;
    letter-spacing: 0.5px;
    opacity: 0.85;
}

.load-more-btn {
    background: linear-gradient(135deg, rgba(82, 52, 40, 0.9), rgba(59, 35, 25, 0.9));
    border: 1px solid rgba(255, 215, 0, 0.4);
    color: #ffd700;
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    padding: 12px 30px;
    border-radius: 25px;
    cursor: pointer;
    margin: 25px auto 40px auto;
    display: none;
    transition: all 0.3s;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.7);
}

.load-more-btn:hover {
    background: linear-gradient(135deg, #aa7700, #553300);
    border-color: #ffd700;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.3);
    color: #fff;
}

/* ===================================================
   ===== MOBIL QURILMALAR UCHUN TO'LIQ MOSLASHUV =====
   =================================================== */
@media (max-width: 767px) {
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
        width: 100%;
    }

    .library-container {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }

    .library-header {
        padding: 1.4rem 0.4rem 0.6rem 0.4rem;
        z-index: 100;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
        position: relative;
    }

    .library-header h2 {
        font-size: clamp(1.2rem, 5.2vw, 1.7rem);
        letter-spacing: 0.8px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-wrap: nowrap;
        gap: 8px;
        width: 100%;
        max-width: 100%;
        position: relative;
        z-index: 500;
    }

    .header-title-text {
        white-space: nowrap;
        font-size: inherit;
        text-align: center;
    }

    .brand-icon-wrap,
    .filter-menu-btn {
        margin: 0 2px;
        flex-shrink: 0;
    }

    .brand-icon-wrap .daffodil-svg,
    .filter-menu-btn .daffodil-svg {
        width: 36px;
        height: 36px;
        margin: 0;
    }

    .library-header p {
        font-size: 0.85rem;
        margin-top: 0.2rem;
        margin-bottom: 0.6rem;
        padding: 0 8px;
    }

    .filter-menu-btn {
        position: relative;
        z-index: 510;
    }

    .category-dropdown {
        top: calc(100% + 8px);
        right: -6px;
        width: 280px;
        max-width: 86vw;
        max-height: 60vh;
        background: #140d0a !important;
        background-color: #140d0a !important;
        border: 1px solid rgba(255, 215, 0, 0.55);
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.99), 0 0 25px rgba(0, 0, 0, 0.95);
        z-index: 5000 !important;
    }

    .category-item {
        padding: 9px 15px;
        font-size: 0.88rem;
        line-height: 1.35;
    }

    .search-container {
        width: 92%;
        max-width: 92vw;
        margin: 6px auto 12px auto;
        padding: 0;
        box-sizing: border-box;
        position: relative;
        z-index: 10;
    }

    .search-input-wrap input {
        padding: 10px 16px 10px 38px;
        font-size: 0.88rem;
    }

    .search-input-wrap {
        width: 100%;
    }

    .search-input-wrap input {
        width: 100%;
        font-size: 0.88rem;
        padding: 9px 14px 9px 38px;
        box-sizing: border-box;
    }

    .search-input-wrap .search-icon {
        left: 14px;
        font-size: 0.95rem;
    }

    .library-stats {
        font-size: 0.8rem;
        padding: 0 8px;
        text-align: center;
    }

    /* JAVON VA KITOBLARNING MOBIL O'LCHAMI */
    .shelves-wrapper {
        gap: 32px;
        padding: 0.5rem 0 3.5rem 0;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .shelf {
        padding: 0 10px;
        min-height: 160px;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
        overflow: visible;
        justify-content: center;
    }

    .shelf::before {
        height: 12px;
        bottom: -12px;
    }

    .shelf::after {
        height: 16px;
        bottom: -28px;
    }

    .book {
        min-width: 28px;
        min-height: 135px;
    }

    .book-title {
        font-size: clamp(0.42rem, 0.52rem, 0.65rem);
        letter-spacing: 0.4px;
    }

    .book-gap {
        width: 20px;
        min-width: 16px;
        margin: 0 2px;
    }

    .book-badge,
    .book-pdf-badge {
        font-size: 0.48rem;
        padding: 1px 3px;
        top: 4px;
        right: 2px;
    }

    .pdf-content,
    .reader-content {
        margin: 0 0.4rem 0.4rem 0.4rem;
    }

    .modal-box {
        padding: 1.2rem 1rem;
        width: 95%;
    }

    .reader-toolbar {
        padding: 8px 10px;
        gap: 6px;
        background: #140d0a !important;
        background-color: #140d0a !important;
    }

    .reader-book-info {
        font-size: 0.8rem;
        flex: 1;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .reader-actions {
        gap: 4px;
        flex-shrink: 0;
    }

    .reader-font-btn {
        padding: 4px 7px;
        font-size: 0.75rem;
    }

    .close-reader {
        padding: 4px 8px;
        font-size: 0.78rem;
        gap: 3px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .close-reader .close-icon {
        font-size: 1rem;
    }

    .dynamic-reader {
        padding: 18px 10px;
    }
}
