/* ======================================================
   KTO Dijital Kütüphane – Kurumsal Mavi Tema
   ====================================================== */

/* Cinzel, Cormorant Garamond, Inter → Poppins yerel fontu kullanıma alındı */

:root {
    --kto-dark:      #060e1e;
    --kto-navy:      #0d1f3c;
    --kto-blue:      #1a4eac;
    --kto-accent:    #2563eb;
    --kto-bright:    #3b82f6;
    --kto-light:     #93c5fd;
    --kto-gold:      #f59e0b;
    --kto-gold-dim:  #d97706;
    --paper:         #fdfcf8;
    --page-shadow:   rgba(0,0,0,0.4);
    --book-width:    1000px;
    --book-height:   700px;
    --page-width:    500px;
    --header-h:      72px;
    --progress-h:    56px;
}

*, *::before, *::after { box-sizing: border-box; }

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
    background: var(--kto-dark);
}

/* ======================================================
   Sahne / Arka Plan
   ====================================================== */
.library-scene {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    background: var(--kto-dark);
}

.scene-background {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

.wood-texture {
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse 120% 80% at 50% -10%, rgba(26,78,172,0.35) 0%, transparent 55%),
        radial-gradient(ellipse 80% 60% at 80% 100%, rgba(37,99,235,0.18) 0%, transparent 50%),
        linear-gradient(160deg, #060e1e 0%, #0d1f3c 50%, #060e1e 100%);
}

.vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 90% 80% at 50% 50%, transparent 30%, rgba(0,0,0,0.55) 100%);
    pointer-events: none;
}

/* ======================================================
   Header – KTO Kurumsal Bar
   ====================================================== */
.library-header {
    height: var(--header-h);
    min-height: var(--header-h);
    padding: 0 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 200;
    background: linear-gradient(135deg, rgba(6,14,30,0.95) 0%, rgba(13,31,60,0.98) 100%);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(59,130,246,0.25);
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
    flex-shrink: 0;
}

/* Sol: Brand */
.brand-plate {
    display: flex;
    align-items: center;
    gap: 14px;
}

.kto-logo-badge {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--kto-blue), var(--kto-accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    box-shadow: 0 4px 12px rgba(37,99,235,0.4);
    flex-shrink: 0;
}

.brand-text h1 {
    font-family: 'Cinzel', serif;
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #60a5fa, #ffffff 60%, #93c5fd);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}

.brand-text span {
    display: block;
    color: rgba(148,163,184,0.9);
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-top: 1px;
    max-width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.back-link {
    color: rgba(255,255,255,0.7);
    font-size: 1.15rem;
    transition: all 0.25s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    text-decoration: none;
}

.back-link:hover {
    color: #fff;
    background: rgba(37,99,235,0.3);
    border-color: rgba(59,130,246,0.4);
    transform: scale(1.08);
}

/* Sağ: Kontroller */
.library-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
    padding-left: 8px;
    border-left: 1px solid rgba(255,255,255,0.08);
}

.control-group:first-child {
    border-left: none;
    margin-left: 0;
    padding-left: 0;
}

/* Sayfa Atlama Grubu */
.page-jump-group {
    gap: 5px;
}
.page-jump-label {
    font-size: .78rem;
    color: rgba(255,255,255,.6);
    white-space: nowrap;
}
#pageJumpInput {
    width: 52px;
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.18) !important;
    border-radius: 6px;
    color: #fff;
    font-size: .84rem;
    padding: 4px 6px;
    outline: none;
    text-align: center;
    -moz-appearance: textfield;
}
#pageJumpInput::-webkit-outer-spin-button,
#pageJumpInput::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#pageJumpInput:focus {
    border-color: rgba(96,165,250,.6) !important;
    background: rgba(255,255,255,0.15);
}

.metal-btn {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.85);
    width: 38px;
    height: 38px;
    border-radius: 9px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    text-decoration: none;
}

.metal-btn:hover {
    background: rgba(37,99,235,0.35);
    border-color: rgba(59,130,246,0.5);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}

.metal-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.metal-btn.active-btn {
    background: linear-gradient(135deg, var(--kto-blue), var(--kto-accent));
    border-color: var(--kto-bright);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37,99,235,0.4);
}

#zoomLevel {
    font-size: 0.78rem;
    font-weight: 600;
    color: rgba(148,163,184,0.9);
    min-width: 36px;
    text-align: center;
}

/* ======================================================
   Kütüphane Dropdown Menüsü
   ====================================================== */
.library-menu {
    background: rgba(13,31,60,0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(59,130,246,0.3);
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
    max-height: 420px;
    overflow-y: auto;
    min-width: 280px;
}

.library-menu .dropdown-header {
    color: var(--kto-light);
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    letter-spacing: 1.5px;
    border-bottom: 1px solid rgba(59,130,246,0.2);
    padding: 12px 16px 10px;
}

.library-menu .dropdown-item {
    font-size: 0.85rem;
    color: rgba(226,232,240,0.85);
    padding: 10px 16px;
    transition: all 0.2s;
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.library-menu .dropdown-item:hover {
    background: rgba(37,99,235,0.2);
    color: #fff;
}

.library-menu .dropdown-item.active {
    background: rgba(37,99,235,0.3);
    color: var(--kto-bright);
    font-weight: 600;
}

.library-menu .dropdown-item i {
    color: var(--kto-bright);
    width: 16px;
    text-align: center;
}

.library-menu::-webkit-scrollbar { width: 4px; }
.library-menu::-webkit-scrollbar-track { background: transparent; }
.library-menu::-webkit-scrollbar-thumb { background: rgba(59,130,246,0.4); border-radius: 2px; }

/* ======================================================
   Kitap Sahnesi
   ====================================================== */
.book-stage {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: visible;   /* Turn.js kıvrım animasyonu için visible olmalı */
    cursor: default;
    padding-bottom: var(--progress-h);
}

.book-wrapper {
    position: relative;
    z-index: 10;
    transform-origin: center center;
    transition: transform 0.2s ease-out;
    user-select: none;
    will-change: transform;
}

/* İlk spread: soldaki boş panel tamamen gizli olsun, yalnız kapak görünsün */
.book-wrapper.first-spread-only-right #canvas-wrapper {
    clip-path: inset(0 0 0 50%);
}

/* Kitap altı gölgesi */
.book-shadow {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%) scaleY(0.3);
    width: 80%;
    height: 60px;
    background: radial-gradient(ellipse, rgba(0,0,0,0.7) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
    border-radius: 50%;
}

/* ======================================================
   Kitap – Özel Sayfa Çevirme Motoru
   ====================================================== */
/* Canvas tabanlı — sadece dış kap */
#flipbook {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Tüm sayfa çevirme efekti canvas içinde çiziliyor */

.cover-leather {
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(59,130,246,0.15) 0%, transparent 60%),
        linear-gradient(160deg, #0d1f3c 0%, #060e1e 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Omurga efekti */
.cover-front .cover-leather::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 28px;
    height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,0.12), rgba(255,255,255,0.04), transparent);
    z-index: 2;
}

.cover-design {
    border: 2px solid rgba(59,130,246,0.4);
    box-shadow: inset 0 0 40px rgba(37,99,235,0.1), 0 0 0 1px rgba(59,130,246,0.1);
    padding: 40px 30px;
    width: 85%;
    height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    border-radius: 4px;
}

.cover-title {
    font-family: 'Cinzel', serif;
    background: linear-gradient(135deg, #93c5fd, #ffffff, #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 2.8rem;
    margin: 24px 0;
    letter-spacing: 4px;
    line-height: 1.2;
}

.cover-subtitle {
    color: rgba(148,163,184,0.8);
    font-family: 'Inter', sans-serif;
    letter-spacing: 3px;
    font-size: 0.8rem;
    margin-top: auto;
    text-transform: uppercase;
}

.cover-logo img {
    height: 64px;
    filter: brightness(0) invert(1) drop-shadow(0 2px 8px rgba(59,130,246,0.4));
}

.cover-decoration .line {
    display: inline-block;
    width: 50px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(59,130,246,0.6), transparent);
    vertical-align: middle;
}

.cover-decoration .year {
    color: var(--kto-light);
    font-family: 'Cinzel', serif;
    font-size: 1.3rem;
    margin: 0 14px;
    vertical-align: middle;
}

/* ======================================================
   İç Sayfalar
   ====================================================== */
.paper-texture {
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(0deg, rgba(0,0,0,0.015) 0px, rgba(0,0,0,0.015) 1px, transparent 1px, transparent 20px);
    pointer-events: none;
    z-index: 0;
}

.page-content {
    position: relative;
    z-index: 1;
    padding: 32px 40px;
    height: 100%;
    color: #1e293b;
    font-family: 'Inter', sans-serif;
}

/* Kitap omurga gölgesi */
#flipbook .page.odd .page-content {
    background: linear-gradient(to right, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.03) 6%, transparent 20%);
}

#flipbook .page.even .page-content {
    background: linear-gradient(to left, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.03) 6%, transparent 20%);
}

/* PDF Sayfası */
.pdf-page {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #fff;
}

.pdf-page canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

/* Placeholder yüklenme göstergesi (sayfalar) */
.page-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    color: #94a3b8;
    font-size: 0.85rem;
    animation: fadeIn 0.4s ease;
}

.page-placeholder i { font-size: 1.8rem; opacity: 0.3; }

/* ======================================================
   Sürükleme İpucu – Sağ Kenar
   ====================================================== */
.drag-hint {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.4s;
}

.drag-hint-inner {
    width: 4px;
    height: 80px;
    background: linear-gradient(to bottom, transparent, rgba(59,130,246,0.6), transparent);
    border-radius: 2px;
    position: relative;
}

.drag-hint-arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(59,130,246,0.7);
    font-size: 1.2rem;
    animation: hintPulse 2s ease-in-out infinite;
}

@keyframes hintPulse {
    0%, 100% { opacity: 0.4; transform: translateY(-50%) translateX(0); }
    50% { opacity: 1; transform: translateY(-50%) translateX(-6px); }
}

/* ======================================================
   Navigasyon Okları
   ====================================================== */
.nav-area {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 80px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    transition: opacity 0.3s;
}

.nav-area.prev { left: 10px; }
.nav-area.next { right: 10px; }

.nav-arrow {
    background: rgba(13,31,60,0.7);
    border: 1px solid rgba(59,130,246,0.35);
    color: rgba(255,255,255,0.8);
    width: 52px;
    height: 52px;
    border-radius: 14px;
    font-size: 1.3rem;
    cursor: pointer;
    backdrop-filter: blur(12px);
    transition: all 0.25s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.nav-arrow:hover {
    background: linear-gradient(135deg, var(--kto-blue), var(--kto-accent));
    border-color: var(--kto-bright);
    color: #fff;
    box-shadow: 0 0 24px rgba(37,99,235,0.5);
    transform: scale(1.08);
}

.nav-arrow:active { transform: scale(0.96); }

/* ======================================================
   Alt İlerleme Barı
   ====================================================== */
.reading-progress {
    position: fixed;
    bottom: 0;
    width: 100%;
    height: var(--progress-h);
    background: linear-gradient(to top, rgba(6,14,30,0.97), rgba(13,31,60,0.92));
    backdrop-filter: blur(16px);
    border-top: 1px solid rgba(59,130,246,0.2);
    padding: 10px 24px 12px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.page-counter {
    color: rgba(148,163,184,0.9);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.progress-bar-container {
    width: min(480px, 90%);
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--kto-blue), var(--kto-accent), var(--kto-bright));
    width: 0%;
    transition: width 0.4s ease;
    border-radius: 10px;
    box-shadow: 0 0 8px rgba(37,99,235,0.5);
}

/* ======================================================
   Yükleme Göstergesi
   ====================================================== */
#pdfLoadingIndicator {
    color: #fff;
    text-align: center;
}

#pdfLoadingIndicator .load-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--kto-blue), var(--kto-accent));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 1.6rem;
    box-shadow: 0 8px 24px rgba(37,99,235,0.4);
    animation: loadPulse 1.6s ease-in-out infinite;
}

@keyframes loadPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 8px 24px rgba(37,99,235,0.4); }
    50% { transform: scale(1.08); box-shadow: 0 12px 32px rgba(37,99,235,0.6); }
}

#pdfLoadingIndicator h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    letter-spacing: 2px;
    margin: 0 0 8px;
    background: linear-gradient(135deg, #93c5fd, #fff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#pdfLoadingIndicator p {
    color: rgba(148,163,184,0.8);
    font-size: 0.85rem;
    margin: 4px 0;
}

#loadingProgress {
    color: var(--kto-light);
    font-size: 0.8rem;
    margin-top: 8px;
}

.load-bar-wrap {
    width: 200px;
    height: 3px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    margin: 12px auto 0;
    overflow: hidden;
}

.load-bar-inner {
    height: 100%;
    background: linear-gradient(90deg, var(--kto-blue), var(--kto-bright));
    border-radius: 2px;
    animation: loadBar 1.8s ease-in-out infinite;
    width: 40%;
}

@keyframes loadBar {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

/* ======================================================
   PDF Bilgi Kartı
   ====================================================== */
.pdf-info-card {
    position: fixed;
    bottom: calc(var(--progress-h) + 14px);
    right: 20px;
    z-index: 200;
}

.pdf-info-toggle {
    background: linear-gradient(135deg, var(--kto-blue), var(--kto-accent));
    border: 1px solid rgba(59,130,246,0.4);
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(37,99,235,0.4);
    transition: all 0.25s;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pdf-info-toggle:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 8px 24px rgba(37,99,235,0.5);
}

.pdf-info-content {
    position: absolute;
    bottom: 56px;
    right: 0;
    width: 300px;
    max-width: calc(100vw - 40px);
    background: rgba(13,31,60,0.97);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(59,130,246,0.3);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
    animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.pdf-info-content h5 {
    color: #e2e8f0;
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 10px;
    line-height: 1.3;
}

.pdf-info-content p {
    color: rgba(148,163,184,0.85);
    font-size: 0.8rem;
    line-height: 1.5;
    margin: 0 0 12px;
}

.pdf-info-content ul { margin: 0; padding: 0; list-style: none; }
.pdf-info-content ul li {
    padding: 5px 0;
    color: rgba(148,163,184,0.85);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.pdf-info-content ul li i { color: var(--kto-bright); width: 14px; }

.pdf-info-content hr {
    border: none;
    border-top: 1px solid rgba(59,130,246,0.2);
    margin: 12px 0;
}

/* ======================================================
   Animasyonlar
   ====================================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Turn.js sayfa çevirme gölge güçlendirmesi */
.turn-page-wrapper { box-shadow: 0 0 40px rgba(0,0,0,0.5); }
.gradient { background: linear-gradient(to right, rgba(0,0,0,0.25), transparent); }

/* ======================================================
   Medya Sorguları
   ====================================================== */
@media (max-width: 1200px) {
    :root { --book-width: 800px; --book-height: 560px; --page-width: 400px; }
}

@media (max-width: 900px) {
    :root { --book-width: 640px; --book-height: 448px; --page-width: 320px; }
    .nav-area { width: 52px; }
    .nav-arrow { width: 42px; height: 42px; font-size: 1rem; }
}

@media (max-width: 720px) {
    :root { --book-width: 480px; --book-height: 672px; --page-width: 480px; }
    .cover-title { font-size: 2rem; }
}

/* ======================================================
   Mobil (≤768px) — tek sayfa PDF, dokunma ve alt kontroller
   Masaüstü düzeni 769px üstünde aynı kalır.
   ====================================================== */
@media (max-width: 768px) {
    :root {
        --header-h: auto;
        --progress-h: 52px;
    }

    .library-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 10px 12px calc(10px + env(safe-area-inset-top, 0px));
        min-height: 0;
        height: auto;
    }

    .brand-plate {
        flex-wrap: nowrap;
        gap: 10px;
        min-width: 0;
    }

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

    .brand-text h1 {
        font-size: 0.72rem;
        letter-spacing: 1px;
        white-space: normal;
        line-height: 1.25;
    }

    .brand-text span {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        white-space: normal;
        max-width: none;
        font-size: 0.62rem;
        line-height: 1.3;
    }

    .back-link {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
    }

    .kto-logo-badge {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }

    .library-controls {
        width: 100%;
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 4px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        padding: 6px 2px 8px;
        margin: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.07);
    }

    .library-controls::-webkit-scrollbar {
        height: 3px;
    }

    .library-controls::-webkit-scrollbar-thumb {
        background: rgba(59, 130, 246, 0.45);
        border-radius: 2px;
    }

    .control-group {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        flex-shrink: 0;
    }

    .control-group + .control-group {
        padding-left: 6px;
        margin-left: 6px;
        border-left: 1px solid rgba(255, 255, 255, 0.1);
    }

    .metal-btn {
        width: 40px;
        height: 40px;
        font-size: 13px;
    }

    .page-jump-label {
        display: none;
    }

    #pageJumpInput {
        width: 44px;
        font-size: 0.8rem;
    }

    #zoomLevel {
        font-size: 0.7rem;
        min-width: 32px;
    }

    .book-stage {
        padding-bottom: calc(var(--progress-h) + env(safe-area-inset-bottom, 0px));
        overflow-x: hidden;
        align-items: center;
    }

    .nav-area {
        top: auto;
        bottom: calc(var(--progress-h) + env(safe-area-inset-bottom, 0px) + 6px);
        transform: none;
        width: 52px;
        height: 56px;
        z-index: 60;
    }

    .nav-area.prev {
        left: max(6px, env(safe-area-inset-left, 0px));
    }

    .nav-area.next {
        right: max(6px, env(safe-area-inset-right, 0px));
    }

    .nav-arrow {
        width: 48px;
        height: 48px;
        font-size: 1.15rem;
        border-radius: 14px;
    }

    .reading-progress {
        height: calc(var(--progress-h) + env(safe-area-inset-bottom, 0px));
        padding: 8px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    }

    .page-counter {
        font-size: 0.72rem;
    }

    .progress-bar-container {
        width: min(100%, 100vw - 32px);
    }

    /* Bilgi butonu: kontrol şeridinin hemen altı, PDF üst kenarından yukarıda */
    .pdf-info-card {
        top: calc(env(safe-area-inset-top, 0px) + clamp(96px, 15vh, 132px));
        bottom: auto;
        right: max(10px, env(safe-area-inset-right, 0px));
        left: auto;
        z-index: 220;
    }

    .pdf-info-toggle {
        width: 46px;
        height: 46px;
    }

    .pdf-info-content {
        top: calc(100% + 10px);
        bottom: auto;
        right: 0;
        left: auto;
        width: min(300px, calc(100vw - 20px));
        max-height: min(50vh, 380px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        animation: slideDownPdfInfo 0.22s ease-out;
    }

    @keyframes slideDownPdfInfo {
        from { opacity: 0; transform: translateY(-10px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    .book-wrapper.first-spread-only-right #canvas-wrapper {
        clip-path: none;
    }
}

@media (max-width: 520px) {
    .metal-btn { width: 36px; height: 36px; font-size: 12px; }
    #zoomLevel { display: none; }
}
