.kitap-body,
.kitap-body * {
    box-sizing: border-box;
}

.kitap-body {
    margin: 0;
    /* Sabit yükseklik: page-flip 'stretch' kabın YÜKSEKLİĞİNİ de okur — min-height ile yükseklik belirsiz kalır. */
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    background: #2b2f36;
    color: #e8eaed;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    overflow: hidden;
}

.kitap-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.kitap-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    background: #1e2128;
    border-bottom: 1px solid #3a3f47;
    flex-shrink: 0;
    z-index: 10;
}

.kitap-toolbar__left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.kitap-toolbar__title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kitap-toolbar__right {
    flex-shrink: 0;
}

.kitap-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    color: inherit;
    background: transparent;
}

.kitap-btn--ghost {
    border-color: #4a5059;
}

.kitap-btn--ghost:hover {
    background: #353a42;
}

.kitap-btn--primary {
    background: #4a7cff;
    color: #fff;
    border-color: #4a7cff;
}

.kitap-btn--primary:hover {
    background: #3d6ae6;
}

.kitap-progress {
    padding: 4px 12px;
    background: #252830;
    flex-shrink: 0;
}

.kitap-progress__bar {
    height: 3px;
    background: #4a5059;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}

.kitap-progress__bar::after {
    content: "";
    display: block;
    height: 100%;
    width: var(--kitap-pct, 0%);
    background: #4a7cff;
    transition: width 0.15s ease;
}

.kitap-progress__text {
    font-size: 11px;
    color: #9aa0a8;
}

.kitap-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    position: relative;
    overflow: hidden;
}

.kitap-stage {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Çevirme animasyonunun kıvrılan köşesi kitabın dışına taşar → 'auto' iken anlık kaydırma çubuğu çıkıyordu.
       Kaydırma yalnız yakınlaştırmada gerekir (.kitap-zoomed). */
    overflow: hidden;
}

/* Kitap kabı sahneyi doldurur — page-flip 'stretch' genişliği EBEVEYNDEN okur (içeriğe göre daralırsa minWidth'e düşüp tek sayfa olur). */
.kitap-flip-wrap {
    width: 100%;
    height: 100%;
    padding: 16px;
    transform-origin: center center;
    transition: transform 0.15s ease;
}

.kitap-body [hidden] {
    display: none !important;
}

.kitap-stage.kitap-zoomed {
    align-items: flex-start;
    justify-content: flex-start;
    overflow: auto;
}

.kitap-stage.kitap-zoomed .kitap-flip-wrap {
    transform-origin: top left;
}

.kitap-flip {
    width: 100%;
    height: 100%;
    margin: 0 auto;
}

.kitap-sayfa {
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
    position: relative;
    overflow: hidden;
}

.kitap-sayfa canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.kitap-sayfa__loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    color: #666;
    font-size: 13px;
}

/* Tek sayfalık PDF: sayfa sahneye EN-BOY oranını koruyarak sığar (gövde kaydırılamaz → taşma kesilirdi). */
.kitap-single {
    width: 100%;
    height: 100%;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kitap-single canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    margin: 0 auto;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.kitap-error {
    text-align: center;
    padding: 24px;
}

.kitap-error p {
    margin: 0 0 16px;
    color: #f5a9a9;
}

.kitap-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    background: #1e2128;
    border-top: 1px solid #3a3f47;
    flex-shrink: 0;
}

.kitap-ctrl {
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid #4a5059;
    border-radius: 6px;
    background: #2b2f36;
    color: #e8eaed;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.kitap-ctrl:hover {
    background: #353a42;
}

.kitap-ctrl:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.kitap-controls__sep {
    width: 1px;
    height: 24px;
    background: #4a5059;
    margin: 0 4px;
}

.kitap-page-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
}

.kitap-page-input {
    width: 48px;
    text-align: center;
    padding: 6px 4px;
    border: 1px solid #4a5059;
    border-radius: 6px;
    background: #2b2f36;
    color: #e8eaed;
    font-size: 13px;
}

.kitap-page-total {
    color: #9aa0a8;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .kitap-toolbar__title {
        font-size: 13px;
    }

    .kitap-btn {
        padding: 6px 8px;
        font-size: 12px;
    }

    .kitap-controls {
        gap: 4px;
    }

    .kitap-ctrl {
        min-width: 32px;
        height: 32px;
        font-size: 12px;
    }
}
