/* ==========================================================================
   Kindle-Optimized E-ink CSS
   - High Contrast Pure B&W / Grayscale
   - Zero Animations / Transitions to prevent E-ink ghosting
   - Touch targets >= 44px for Kindle touchscreens
   ========================================================================== */

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    /* Disable transitions and animations for E-ink performance */
    transition: none !important;
    animation: none !important;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    color: #000000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.4;
}

/* ==========================================================================
   INDEX / LIBRARY PAGE STYLES
   ========================================================================== */

body.index-page {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    width: 95%;
    max-width: 96%;
    margin: 0 auto;
    padding: 10px 0 140px 0;
}

/* ==========================================================================
   Kindle UI Scale Presets (100% Normal, 125% Large, 150% Extra Large)
   ========================================================================== */

body.scale-normal {
    font-size: 16px;
}

/* LARGE (+25%) */
body.scale-large {
    font-size: 20px;
}
body.scale-large .app-title { font-size: 26px; }
body.scale-large .total-books-badge { font-size: 16px; }
body.scale-large .btn-action { min-height: 48px; font-size: 16px; padding: 6px 14px; }
body.scale-large .profile-title { font-size: 16px; }
body.scale-large .profile-tip { font-size: 13px; }
body.scale-large .btn-profile-name { font-size: 16px; padding: 6px 12px; }
body.scale-large .btn-profile-del { font-size: 15px; padding: 6px 10px; }
body.scale-large .btn-add-profile { font-size: 15px; padding: 6px 12px; }
body.scale-large .btn-mode-tab { min-height: 50px; font-size: 16px; padding: 6px 16px; }
body.scale-large .sort-label { font-size: 16px; }
body.scale-large .sort-select { min-height: 48px; font-size: 16px; padding: 6px 10px; }
body.scale-large .search-input { min-height: 50px; font-size: 18px; }
body.scale-large .btn-search,
body.scale-large .btn-search-clear { min-height: 50px; font-size: 16px; padding: 6px 16px; }
body.scale-large .btn-breadcrumb { min-height: 48px; font-size: 16px; padding: 8px 14px; }
body.scale-large .breadcrumb-sep { font-size: 16px; }
body.scale-large .subfolder-header { font-size: 15px; }
body.scale-large .btn-subfolder { min-height: 48px; font-size: 16px; padding: 8px 14px; }
body.scale-large .subfolder-count { font-size: 15px; }
body.scale-large .book-count-info { font-size: 15px; }
body.scale-large .btn-page-nav { min-height: 52px; font-size: 17px; min-width: 130px; padding: 8px 18px; }
body.scale-large .page-indicator { font-size: 18px; }
body.scale-large .book-title { font-size: 20px; }
body.scale-large .book-size { font-size: 13px; }
body.scale-large .book-meta,
body.scale-large .book-meta-item { font-size: 13px; }
body.scale-large .book-progress-badge { font-size: 13px; padding: 2px 7px; }
body.scale-large .page-bm-label { font-size: 14px; }
body.scale-large .page-bm-link { font-size: 14px; padding: 4px 8px; }
body.scale-large .btn-del-page-bm { font-size: 14px; }
body.scale-large .btn-continue { min-height: 48px; font-size: 16px; padding: 8px 16px; }
body.scale-large .btn-restart { min-height: 48px; font-size: 15px; padding: 8px 14px; }
body.scale-large .btn-reset-progress { min-height: 46px; font-size: 14px; padding: 6px 12px; }
body.scale-large .btn-book-bm { min-height: 48px; font-size: 15px; padding: 8px 14px; }
body.scale-large .btn-book-info,
body.scale-large .btn-book-detail { min-height: 48px; font-size: 15px; padding: 8px 14px; }
body.scale-large .btn-book-summary { min-height: 48px; font-size: 15px; padding: 8px 14px; }
body.scale-large .book-info-box,
body.scale-large .book-detail-box,
body.scale-large .book-summary-box { font-size: 16px; line-height: 1.55; }
body.scale-large .info-line { font-size: 16px; margin-bottom: 5px; }
body.scale-large .info-line.info-sub { font-size: 14px; }
body.scale-large .detail-header { font-size: 17px; }
body.scale-large .summary-subheader { font-size: 16px; }
body.scale-large .summary-body { font-size: 16px; line-height: 1.55; }
body.scale-large .summary-loading { font-size: 15px; }
body.scale-large .book-info-detail { font-size: 15px; }
body.scale-large .btn-author-search { font-size: 14px; min-height: 38px; }
body.scale-large .summary-header { font-size: 16px; }
body.scale-large .summary-header-text { font-size: 16px; }
body.scale-large .summary-source { font-size: 13px; }
body.scale-large .btn-summary-more,
body.scale-large .btn-summary-close-bottom { min-height: 44px; font-size: 14px; }
body.scale-large .btn-summary-close-head { font-size: 13px; padding: 4px 10px; }
body.scale-large .book-cover-wrap { width: 75px; }
body.scale-large .book-cover-thumb { width: 75px; height: 105px; }
body.scale-large .detail-cover-wrap { width: 100px; }
body.scale-large .detail-cover-thumb { width: 100px; height: 140px; }
body.scale-large .banner-thumb-img { width: 115px; height: 165px; }
/* Viewer in scale-large */
body.scale-large .btn-nav-back { min-height: 48px; font-size: 16px; padding: 8px 16px; }
body.scale-large .overlay-book-title { font-size: 16px; }
body.scale-large .overlay-page-indicator { font-size: 15px; }
body.scale-large .btn-bookmark-toggle { min-height: 48px; font-size: 15px; padding: 8px 14px; }
body.scale-large .btn-jump { min-height: 48px; font-size: 17px; }
body.scale-large .input-page-jump { height: 46px; font-size: 18px; width: 80px; }
body.scale-large .btn-page-go { height: 46px; font-size: 16px; padding: 0 16px; }
body.scale-large .bookmark-list-title { font-size: 15px; }
body.scale-large .bookmark-chip { font-size: 15px; }

/* EXTRA LARGE (+50%) */
body.scale-xlarge {
    font-size: 24px;
}
body.scale-xlarge .app-title { font-size: 30px; }
body.scale-xlarge .total-books-badge { font-size: 18px; }
body.scale-xlarge .btn-action { min-height: 56px; font-size: 19px; padding: 8px 18px; }
body.scale-xlarge .profile-title { font-size: 18px; }
body.scale-xlarge .profile-tip { font-size: 15px; }
body.scale-xlarge .btn-profile-name { font-size: 19px; padding: 8px 16px; }
body.scale-xlarge .btn-profile-del { font-size: 18px; padding: 8px 14px; }
body.scale-xlarge .btn-add-profile { font-size: 18px; padding: 8px 16px; }
body.scale-xlarge .btn-mode-tab { min-height: 58px; font-size: 19px; padding: 8px 20px; }
body.scale-xlarge .sort-label { font-size: 18px; }
body.scale-xlarge .sort-select { min-height: 56px; font-size: 19px; padding: 8px 14px; }
body.scale-xlarge .search-input { min-height: 58px; font-size: 21px; }
body.scale-xlarge .btn-search,
body.scale-xlarge .btn-search-clear { min-height: 58px; font-size: 19px; padding: 8px 20px; }
body.scale-xlarge .btn-breadcrumb { min-height: 56px; font-size: 19px; padding: 10px 18px; }
body.scale-xlarge .breadcrumb-sep { font-size: 19px; }
body.scale-xlarge .subfolder-header { font-size: 18px; }
body.scale-xlarge .btn-subfolder { min-height: 56px; font-size: 19px; padding: 10px 18px; }
body.scale-xlarge .subfolder-count { font-size: 18px; }
body.scale-xlarge .book-count-info { font-size: 18px; }
body.scale-xlarge .btn-page-nav { min-height: 60px; font-size: 20px; min-width: 150px; padding: 10px 22px; }
body.scale-xlarge .page-indicator { font-size: 21px; }
body.scale-xlarge .book-title { font-size: 24px; line-height: 1.35; }
body.scale-xlarge .book-size { font-size: 15px; }
body.scale-xlarge .book-meta,
body.scale-xlarge .book-meta-item { font-size: 15px; }
body.scale-xlarge .book-progress-badge { font-size: 15px; padding: 4px 10px; }
body.scale-xlarge .page-bm-label { font-size: 16px; }
body.scale-xlarge .page-bm-link { font-size: 16px; padding: 6px 12px; }
body.scale-xlarge .btn-del-page-bm { font-size: 16px; }
body.scale-xlarge .btn-continue { min-height: 56px; font-size: 20px; padding: 10px 22px; }
body.scale-xlarge .btn-restart { min-height: 56px; font-size: 19px; padding: 10px 18px; }
body.scale-xlarge .btn-reset-progress { min-height: 52px; font-size: 17px; padding: 8px 16px; }
body.scale-xlarge .btn-book-bm { min-height: 56px; font-size: 19px; padding: 10px 18px; }
body.scale-xlarge .page-size-label { font-size: 18px; }
body.scale-xlarge .page-size-select { min-height: 56px; font-size: 19px; padding: 8px 14px; }
body.scale-xlarge .btn-book-info,
body.scale-xlarge .btn-book-detail { min-height: 56px; font-size: 19px; padding: 10px 18px; }
body.scale-xlarge .btn-book-summary { min-height: 56px; font-size: 19px; padding: 10px 18px; }
body.scale-xlarge .book-info-box,
body.scale-xlarge .book-detail-box,
body.scale-xlarge .book-summary-box { font-size: 19px; line-height: 1.55; }
body.scale-xlarge .info-line { font-size: 19px; margin-bottom: 6px; }
body.scale-xlarge .info-line.info-sub { font-size: 16px; }
body.scale-xlarge .detail-header { font-size: 20px; }
body.scale-xlarge .summary-subheader { font-size: 19px; }
body.scale-xlarge .summary-body { font-size: 19px; line-height: 1.55; }
body.scale-xlarge .summary-loading { font-size: 18px; }
body.scale-xlarge .book-info-detail { font-size: 18px; }
body.scale-xlarge .btn-author-search { font-size: 17px; min-height: 46px; }
body.scale-xlarge .summary-header { font-size: 19px; }
body.scale-xlarge .summary-header-text { font-size: 19px; }
body.scale-xlarge .summary-source { font-size: 15px; }
body.scale-xlarge .btn-summary-more,
body.scale-xlarge .btn-summary-close-bottom { min-height: 50px; font-size: 17px; }
body.scale-xlarge .btn-summary-close-head { font-size: 15px; padding: 6px 12px; }
body.scale-xlarge .book-cover-wrap { width: 90px; }
body.scale-xlarge .book-cover-thumb { width: 90px; height: 125px; }
body.scale-xlarge .detail-cover-wrap { width: 115px; }
body.scale-xlarge .detail-cover-thumb { width: 115px; height: 160px; }
body.scale-xlarge .banner-thumb-img { width: 125px; height: 180px; }
/* Viewer in scale-xlarge */
body.scale-xlarge .btn-nav-back { min-height: 56px; font-size: 20px; padding: 10px 20px; }
body.scale-xlarge .overlay-book-title { font-size: 19px; }
body.scale-xlarge .overlay-page-indicator { font-size: 18px; }
body.scale-xlarge .btn-bookmark-toggle { min-height: 56px; font-size: 19px; padding: 10px 18px; }
body.scale-xlarge .btn-jump { min-height: 56px; font-size: 20px; }
body.scale-xlarge .input-page-jump { height: 54px; font-size: 22px; width: 95px; }
body.scale-xlarge .btn-page-go { height: 54px; font-size: 20px; padding: 0 20px; }
body.scale-xlarge .bookmark-list-title { font-size: 18px; }
body.scale-xlarge .bookmark-chip { font-size: 18px; }

/* 4. 특대 (XX-LARGE, 28px) */
body.scale-xxlarge {
    font-size: 28px;
}
body.scale-xxlarge .app-title { font-size: 34px; }
body.scale-xxlarge .total-books-badge { font-size: 20px; }
body.scale-xxlarge .btn-action { min-height: 64px; font-size: 22px; padding: 10px 22px; }
body.scale-xxlarge .profile-title { font-size: 20px; }
body.scale-xxlarge .profile-tip { font-size: 17px; }
body.scale-xxlarge .btn-profile-name { font-size: 21px; padding: 10px 18px; }
body.scale-xxlarge .btn-profile-del { font-size: 20px; padding: 10px 16px; }
body.scale-xxlarge .btn-add-profile { font-size: 20px; padding: 10px 18px; }
body.scale-xxlarge .btn-mode-tab { min-height: 64px; font-size: 22px; padding: 10px 24px; }
body.scale-xxlarge .sort-label { font-size: 20px; }
body.scale-xxlarge .sort-select { min-height: 62px; font-size: 21px; padding: 10px 16px; }
body.scale-xxlarge .page-size-label { font-size: 20px; }
body.scale-xxlarge .page-size-select { min-height: 62px; font-size: 21px; padding: 10px 16px; }
body.scale-xxlarge .search-input { min-height: 64px; font-size: 24px; }
body.scale-xxlarge .btn-search,
body.scale-xxlarge .btn-search-clear { min-height: 64px; font-size: 22px; padding: 10px 24px; }
body.scale-xxlarge .btn-breadcrumb { min-height: 62px; font-size: 22px; padding: 12px 20px; }
body.scale-xxlarge .breadcrumb-sep { font-size: 22px; }
body.scale-xxlarge .subfolder-header { font-size: 20px; }
body.scale-xxlarge .btn-subfolder { min-height: 62px; font-size: 22px; padding: 12px 20px; }
body.scale-xxlarge .subfolder-count { font-size: 20px; }
body.scale-xxlarge .book-count-info { font-size: 20px; }
body.scale-xxlarge .btn-page-nav { min-height: 66px; font-size: 23px; min-width: 160px; padding: 12px 24px; }
body.scale-xxlarge .page-indicator { font-size: 24px; }
body.scale-xxlarge .book-title { font-size: 28px; line-height: 1.35; }
body.scale-xxlarge .book-size { font-size: 17px; }
body.scale-xxlarge .book-meta,
body.scale-xxlarge .book-meta-item { font-size: 17px; }
body.scale-xxlarge .book-progress-badge { font-size: 17px; padding: 5px 12px; }
body.scale-xxlarge .page-bm-label { font-size: 18px; }
body.scale-xxlarge .page-bm-link { font-size: 18px; padding: 8px 14px; }
body.scale-xxlarge .btn-del-page-bm { font-size: 18px; }
body.scale-xxlarge .btn-continue { min-height: 64px; font-size: 23px; padding: 12px 24px; }
body.scale-xxlarge .btn-restart { min-height: 64px; font-size: 22px; padding: 12px 20px; }
body.scale-xxlarge .btn-reset-progress { min-height: 58px; font-size: 19px; padding: 10px 18px; }
body.scale-xxlarge .btn-book-bm { min-height: 64px; font-size: 22px; padding: 12px 20px; }
body.scale-xxlarge .btn-book-info,
body.scale-xxlarge .btn-book-detail { min-height: 64px; font-size: 22px; padding: 12px 20px; }
body.scale-xxlarge .btn-book-summary { min-height: 64px; font-size: 22px; padding: 12px 20px; }
body.scale-xxlarge .book-info-box,
body.scale-xxlarge .book-detail-box,
body.scale-xxlarge .book-summary-box { font-size: 22px; line-height: 1.55; }
body.scale-xxlarge .info-line { font-size: 22px; margin-bottom: 7px; }
body.scale-xxlarge .info-line.info-sub { font-size: 19px; }
body.scale-xxlarge .detail-header { font-size: 23px; }
body.scale-xxlarge .summary-subheader { font-size: 22px; }
body.scale-xxlarge .summary-body { font-size: 22px; line-height: 1.55; }
body.scale-xxlarge .summary-loading { font-size: 21px; }
body.scale-xxlarge .book-info-detail { font-size: 20px; }
body.scale-xxlarge .btn-author-search { font-size: 19px; min-height: 50px; }
body.scale-xxlarge .summary-header { font-size: 22px; }
body.scale-xxlarge .summary-header-text { font-size: 22px; }
body.scale-xxlarge .summary-source { font-size: 17px; }
body.scale-xxlarge .btn-summary-more,
body.scale-xxlarge .btn-summary-close-bottom { min-height: 56px; font-size: 19px; }
body.scale-xxlarge .btn-summary-close-head { font-size: 17px; padding: 7px 14px; }
body.scale-xxlarge .book-cover-wrap { width: 105px; }
body.scale-xxlarge .book-cover-thumb { width: 105px; height: 145px; }
body.scale-xxlarge .detail-cover-wrap { width: 130px; }
body.scale-xxlarge .detail-cover-thumb { width: 130px; height: 180px; }
body.scale-xxlarge .banner-thumb-img { width: 135px; height: 195px; }
/* Viewer in scale-xxlarge */
body.scale-xxlarge .btn-nav-back { min-height: 64px; font-size: 23px; padding: 12px 24px; }
body.scale-xxlarge .overlay-book-title { font-size: 22px; }
body.scale-xxlarge .overlay-page-indicator { font-size: 21px; }
body.scale-xxlarge .btn-bookmark-toggle { min-height: 64px; font-size: 22px; padding: 12px 20px; }
body.scale-xxlarge .btn-jump { min-height: 64px; font-size: 23px; }
body.scale-xxlarge .input-page-jump { height: 60px; font-size: 24px; width: 105px; }
body.scale-xxlarge .btn-page-go { height: 60px; font-size: 22px; padding: 0 22px; }
body.scale-xxlarge .bookmark-list-title { font-size: 21px; }
body.scale-xxlarge .bookmark-chip { font-size: 21px; }

/* 5. 초대형 (HUGE, 32px) */
body.scale-huge {
    font-size: 32px;
}
body.scale-huge .app-title { font-size: 38px; }
body.scale-huge .total-books-badge { font-size: 22px; }
body.scale-huge .btn-action { min-height: 72px; font-size: 25px; padding: 12px 26px; }
body.scale-huge .profile-title { font-size: 23px; }
body.scale-huge .profile-tip { font-size: 19px; }
body.scale-huge .btn-profile-name { font-size: 24px; padding: 12px 22px; }
body.scale-huge .btn-profile-del { font-size: 23px; padding: 12px 18px; }
body.scale-huge .btn-add-profile { font-size: 23px; padding: 12px 22px; }
body.scale-huge .btn-mode-tab { min-height: 72px; font-size: 25px; padding: 12px 28px; }
body.scale-huge .sort-label { font-size: 23px; }
body.scale-huge .sort-select { min-height: 70px; font-size: 24px; padding: 12px 20px; }
body.scale-huge .page-size-label { font-size: 23px; }
body.scale-huge .page-size-select { min-height: 70px; font-size: 24px; padding: 12px 20px; }
body.scale-huge .search-input { min-height: 72px; font-size: 27px; }
body.scale-huge .btn-search,
body.scale-huge .btn-search-clear { min-height: 72px; font-size: 25px; padding: 12px 28px; }
body.scale-huge .btn-breadcrumb { min-height: 70px; font-size: 25px; padding: 14px 24px; }
body.scale-huge .breadcrumb-sep { font-size: 25px; }
body.scale-huge .subfolder-header { font-size: 23px; }
body.scale-huge .btn-subfolder { min-height: 70px; font-size: 25px; padding: 14px 24px; }
body.scale-huge .subfolder-count { font-size: 23px; }
body.scale-huge .book-count-info { font-size: 23px; }
body.scale-huge .btn-page-nav { min-height: 74px; font-size: 26px; min-width: 180px; padding: 14px 28px; }
body.scale-huge .page-indicator { font-size: 27px; }
body.scale-huge .book-title { font-size: 32px; line-height: 1.35; }
body.scale-huge .book-size { font-size: 19px; }
body.scale-huge .book-meta,
body.scale-huge .book-meta-item { font-size: 19px; }
body.scale-huge .book-progress-badge { font-size: 19px; padding: 6px 14px; }
body.scale-huge .page-bm-label { font-size: 21px; }
body.scale-huge .page-bm-link { font-size: 21px; padding: 10px 16px; }
body.scale-huge .btn-del-page-bm { font-size: 21px; }
body.scale-huge .btn-continue { min-height: 72px; font-size: 26px; padding: 14px 28px; }
body.scale-huge .btn-restart { min-height: 72px; font-size: 25px; padding: 14px 24px; }
body.scale-huge .btn-reset-progress { min-height: 66px; font-size: 22px; padding: 12px 22px; }
body.scale-huge .btn-book-bm { min-height: 72px; font-size: 25px; padding: 14px 24px; }
body.scale-huge .btn-book-info,
body.scale-huge .btn-book-detail { min-height: 72px; font-size: 25px; padding: 14px 24px; }
body.scale-huge .btn-book-summary { min-height: 72px; font-size: 25px; padding: 14px 24px; }
body.scale-huge .book-info-box,
body.scale-huge .book-detail-box,
body.scale-huge .book-summary-box { font-size: 25px; line-height: 1.55; }
body.scale-huge .info-line { font-size: 25px; margin-bottom: 8px; }
body.scale-huge .info-line.info-sub { font-size: 21px; }
body.scale-huge .detail-header { font-size: 26px; }
body.scale-huge .summary-subheader { font-size: 25px; }
body.scale-huge .summary-body { font-size: 25px; line-height: 1.55; }
body.scale-huge .summary-loading { font-size: 24px; }
body.scale-huge .book-info-detail { font-size: 23px; }
body.scale-huge .btn-author-search { font-size: 22px; min-height: 56px; }
body.scale-huge .summary-header { font-size: 25px; }
body.scale-huge .summary-header-text { font-size: 25px; }
body.scale-huge .summary-source { font-size: 19px; }
body.scale-huge .btn-summary-more,
body.scale-huge .btn-summary-close-bottom { min-height: 62px; font-size: 22px; }
body.scale-huge .btn-summary-close-head { font-size: 19px; padding: 8px 16px; }
body.scale-huge .book-cover-wrap { width: 120px; }
body.scale-huge .book-cover-thumb { width: 120px; height: 165px; }
body.scale-huge .detail-cover-wrap { width: 145px; }
body.scale-huge .detail-cover-thumb { width: 145px; height: 200px; }
body.scale-huge .banner-thumb-img { width: 145px; height: 210px; }
/* Viewer in scale-huge */
body.scale-huge .btn-nav-back { min-height: 72px; font-size: 26px; padding: 14px 28px; }
body.scale-huge .overlay-book-title { font-size: 25px; }
body.scale-huge .overlay-page-indicator { font-size: 24px; }
body.scale-huge .btn-bookmark-toggle { min-height: 72px; font-size: 25px; padding: 14px 24px; }
body.scale-huge .btn-jump { min-height: 72px; font-size: 26px; }
body.scale-huge .input-page-jump { height: 68px; font-size: 27px; width: 120px; }
body.scale-huge .btn-page-go { height: 68px; font-size: 25px; padding: 0 26px; }
body.scale-huge .bookmark-list-title { font-size: 24px; }
body.scale-huge .bookmark-chip { font-size: 24px; }

/* 6. 최대 (MAX, 36px) */
body.scale-max {
    font-size: 36px;
}
body.scale-max .app-title { font-size: 42px; }
body.scale-max .total-books-badge { font-size: 24px; }
body.scale-max .btn-action { min-height: 80px; font-size: 28px; padding: 14px 30px; }
body.scale-max .profile-title { font-size: 26px; }
body.scale-max .profile-tip { font-size: 21px; }
body.scale-max .btn-profile-name { font-size: 27px; padding: 14px 26px; }
body.scale-max .btn-profile-del { font-size: 26px; padding: 14px 22px; }
body.scale-max .btn-add-profile { font-size: 26px; padding: 14px 26px; }
body.scale-max .btn-mode-tab { min-height: 80px; font-size: 28px; padding: 14px 32px; }
body.scale-max .sort-label { font-size: 26px; }
body.scale-max .sort-select { min-height: 78px; font-size: 27px; padding: 14px 24px; }
body.scale-max .page-size-label { font-size: 26px; }
body.scale-max .page-size-select { min-height: 78px; font-size: 27px; padding: 14px 24px; }
body.scale-max .search-input { min-height: 80px; font-size: 30px; }
body.scale-max .btn-search,
body.scale-max .btn-search-clear { min-height: 80px; font-size: 28px; padding: 14px 32px; }
body.scale-max .btn-breadcrumb { min-height: 78px; font-size: 28px; padding: 16px 28px; }
body.scale-max .breadcrumb-sep { font-size: 28px; }
body.scale-max .subfolder-header { font-size: 26px; }
body.scale-max .btn-subfolder { min-height: 78px; font-size: 28px; padding: 16px 28px; }
body.scale-max .subfolder-count { font-size: 26px; }
body.scale-max .book-count-info { font-size: 26px; }
body.scale-max .btn-page-nav { min-height: 82px; font-size: 29px; min-width: 200px; padding: 16px 32px; }
body.scale-max .page-indicator { font-size: 30px; }
body.scale-max .book-title { font-size: 36px; line-height: 1.35; }
body.scale-max .book-size { font-size: 21px; }
body.scale-max .book-meta,
body.scale-max .book-meta-item { font-size: 21px; }
body.scale-max .book-progress-badge { font-size: 21px; padding: 8px 16px; }
body.scale-max .page-bm-label { font-size: 23px; }
body.scale-max .page-bm-link { font-size: 23px; padding: 12px 18px; }
body.scale-max .btn-del-page-bm { font-size: 23px; }
body.scale-max .btn-continue { min-height: 80px; font-size: 29px; padding: 16px 32px; }
body.scale-max .btn-restart { min-height: 80px; font-size: 28px; padding: 16px 28px; }
body.scale-max .btn-reset-progress { min-height: 74px; font-size: 25px; padding: 14px 26px; }
body.scale-max .btn-book-bm { min-height: 80px; font-size: 28px; padding: 16px 28px; }
body.scale-max .btn-book-info,
body.scale-max .btn-book-detail { min-height: 80px; font-size: 28px; padding: 16px 28px; }
body.scale-max .btn-book-summary { min-height: 80px; font-size: 28px; padding: 16px 28px; }
body.scale-max .book-info-box,
body.scale-max .book-detail-box,
body.scale-max .book-summary-box { font-size: 28px; line-height: 1.55; }
body.scale-max .info-line { font-size: 28px; margin-bottom: 9px; }
body.scale-max .info-line.info-sub { font-size: 24px; }
body.scale-max .detail-header { font-size: 30px; }
body.scale-max .summary-subheader { font-size: 28px; }
body.scale-max .summary-body { font-size: 28px; line-height: 1.55; }
body.scale-max .summary-loading { font-size: 27px; }
body.scale-max .book-info-detail { font-size: 26px; }
body.scale-max .btn-author-search { font-size: 25px; min-height: 62px; }
body.scale-max .summary-header { font-size: 28px; }
body.scale-max .summary-header-text { font-size: 28px; }
body.scale-max .summary-source { font-size: 21px; }
body.scale-max .btn-summary-more,
body.scale-max .btn-summary-close-bottom { min-height: 68px; font-size: 25px; }
body.scale-max .btn-summary-close-head { font-size: 21px; padding: 10px 18px; }
body.scale-max .book-cover-wrap { width: 135px; }
body.scale-max .book-cover-thumb { width: 135px; height: 185px; }
body.scale-max .detail-cover-wrap { width: 160px; }
body.scale-max .detail-cover-thumb { width: 160px; height: 220px; }
body.scale-max .banner-thumb-img { width: 155px; height: 225px; }
/* Viewer in scale-max */
body.scale-max .btn-nav-back { min-height: 80px; font-size: 29px; padding: 16px 32px; }
body.scale-max .overlay-book-title { font-size: 28px; }
body.scale-max .overlay-page-indicator { font-size: 27px; }
body.scale-max .btn-bookmark-toggle { min-height: 80px; font-size: 28px; padding: 16px 28px; }
body.scale-max .btn-jump { min-height: 80px; font-size: 29px; }
body.scale-max .input-page-jump { height: 76px; font-size: 30px; width: 135px; }
body.scale-max .btn-page-go { height: 76px; font-size: 28px; padding: 0 30px; }
body.scale-max .bookmark-list-title { font-size: 27px; }
body.scale-max .bookmark-chip { font-size: 27px; }

.header-container {
    border-bottom: 2px solid #000000;
    padding-bottom: 10px;
    margin-bottom: 12px;
}

.app-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.app-title {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.total-books-badge {
    font-size: 14px;
    font-weight: normal;
    color: #444444;
    margin-left: 6px;
    vertical-align: middle;
}

/* View Mode Tabs & Sort Controls */
.view-controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #000000;
}

.view-mode-tabs {
    display: flex;
    gap: 6px;
}

.btn-mode-tab {
    min-height: 44px;
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 800;
    border: 1px solid #000000;
    background-color: #ffffff;
    color: #000000;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-mode-tab.active {
    background-color: #000000;
    color: #ffffff;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sort-label {
    font-size: 13px;
    font-weight: 800;
    color: #000000;
}

.sort-select,
.page-size-select {
    min-height: 44px;
    padding: 6px 10px;
    font-size: 14px;
    font-weight: 800;
    border: 2px solid #000000;
    background-color: #ffffff;
    color: #000000;
    border-radius: 0;
    cursor: pointer;
    vertical-align: middle;
}

.page-size-label {
    font-size: 13px;
    font-weight: 800;
    color: #000000;
    margin-left: 6px;
    margin-right: 2px;
    vertical-align: middle;
}

.pagination-size-wrap {
    display: inline-block !important;
    vertical-align: middle;
    margin: 4px 6px;
    white-space: nowrap;
}

/* Profile Bar */
.profile-section {
    margin-top: 8px;
    padding: 6px 8px;
    background-color: #f4f4f4;
    border: 1px solid #000000;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.profile-title {
    font-size: 13px;
    font-weight: 800;
    color: #000000;
}

.profile-tip {
    font-size: 11px;
    color: #555555;
}

.profile-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.profile-pill {
    display: inline-flex;
    align-items: stretch;
    border: 2px solid #000000;
    background-color: #ffffff;
}

.profile-pill.active {
    background-color: #000000;
}

.btn-profile-name {
    padding: 4px 10px;
    font-size: 13px;
    font-weight: bold;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #000000;
}

.profile-pill.active .btn-profile-name {
    color: #ffffff;
}

.btn-profile-del {
    padding: 4px 7px;
    font-size: 12px;
    font-weight: 800;
    border: none;
    border-left: 1px solid #000000;
    background: #dddddd;
    cursor: pointer;
    color: #000000;
}

.profile-pill.active .btn-profile-del {
    border-left: 1px solid #ffffff;
    background: #333333;
    color: #ffffff;
}

.btn-add-profile {
    padding: 4px 8px;
    font-size: 12px;
    font-weight: bold;
    background-color: #ffffff;
    color: #000000;
    border: 1px dashed #000000;
    cursor: pointer;
}

/* Search Bar */
.search-bar-container {
    margin-bottom: 10px;
}

.search-form {
    display: flex;
    gap: 6px;
    align-items: stretch;
    width: 100%;
}

.search-input {
    flex: 1;
    min-height: 44px;
    padding: 8px 12px;
    font-size: 15px;
    border: 2px solid #000000;
    background-color: #ffffff;
    color: #000000;
    border-radius: 0;
    -webkit-appearance: none;
}

.search-input:focus {
    outline: 2px solid #000000;
    outline-offset: -2px;
}

.btn-search {
    min-height: 44px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 800;
    background-color: #000000;
    color: #ffffff;
    border: 2px solid #000000;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-search:active {
    background-color: #444444;
}

.btn-search-clear {
    min-height: 44px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: bold;
    background-color: #ffffff;
    color: #000000;
    border: 2px solid #000000;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-search-clear:active {
    background-color: #dddddd;
}

/* Explorer Navigation (Breadcrumbs & Subfolders) */
.nav-explorer {
    margin-bottom: 10px;
    border: 1px solid #000000;
    background-color: #ffffff;
    padding: 8px;
}

.breadcrumb-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.btn-breadcrumb {
    min-height: 44px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: bold;
    background-color: #ffffff;
    color: #000000;
    border: 1px solid #000000;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-breadcrumb.active {
    background-color: #000000;
    color: #ffffff;
}

.breadcrumb-sep {
    font-size: 14px;
    font-weight: 900;
    color: #000000;
    padding: 0 2px;
}

.breadcrumb-current {
    font-size: 14px;
    font-weight: 800;
    color: #000000;
    padding: 8px 6px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

/* Subfolder Section */
.subfolder-section {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #000000;
}

.subfolder-header {
    font-size: 12px;
    font-weight: 800;
    color: #333333;
    margin-bottom: 6px;
}

.subfolder-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.btn-subfolder {
    min-height: 44px;
    padding: 8px 12px;
    font-size: 13px;
    background-color: #f9f9f9;
    color: #000000;
    border: 1px solid #000000;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-subfolder:active {
    background-color: #000000;
    color: #ffffff;
}

.subfolder-count {
    font-size: 12px;
    color: #555555;
    font-weight: normal;
}

.btn-subfolder:active .subfolder-count {
    color: #ffffff;
}

/* Book List Header & Count Info */
.book-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    padding: 2px 0;
}

.book-count-info {
    font-size: 12px;
    font-weight: bold;
    color: #333333;
}

.action-buttons {
    display: flex;
    gap: 4px;
}

.btn-action {
    min-height: 42px;
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 800;
    background-color: #ffffff;
    color: #000000;
    border: 2px solid #000000;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.btn-action:active {
    background-color: #000000;
    color: #ffffff;
}

/* Compact Book List for Kindle (Fits 5+ books per screen) */
.book-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.book-card {
    border: 2px solid #000000;
    padding: 6px 10px;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.book-card-body {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
}

.book-card-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.book-cover-wrap {
    flex-shrink: 0;
    width: 65px;
    cursor: pointer;
    line-height: 0;
}

.book-cover-thumb {
    width: 65px;
    height: 90px;
    object-fit: cover;
    border: 1px solid #000000;
    display: block;
    background-color: #eeeeee;
}

.book-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}

.book-title {
    font-size: 15px;
    font-weight: 800;
    margin: 0;
    word-break: break-word;
    color: #000000;
}

.book-size {
    font-size: 11px;
    color: #444444;
    white-space: nowrap;
}

.book-footer {
    display: block;
    margin-top: 8px;
    clear: both;
}

.book-meta {
    display: block;
    margin-bottom: 8px;
    font-size: 11px;
    color: #333333;
}

.book-progress-badge {
    display: inline-block;
    vertical-align: middle;
    padding: 1px 5px;
    border: 1px solid #000000;
    font-weight: 800;
    font-size: 11px;
    background-color: #f4f4f4;
    white-space: nowrap;
    margin-right: 6px;
}

.book-progress-badge.unread {
    border-style: dashed;
    background-color: #ffffff;
    color: #666666;
}

.book-meta-item {
    display: inline-block;
    vertical-align: middle;
    font-size: 11px;
    color: #444444;
    white-space: nowrap;
    margin-right: 8px;
}

.book-actions {
    display: block;
    clear: both;
}

.book-actions a,
.book-actions button {
    display: inline-block;
    vertical-align: middle;
    margin: 3px 4px 3px 0;
}

.btn-continue {
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 800;
    background-color: #000000;
    color: #ffffff;
    text-align: center;
    text-decoration: none;
    border: 2px solid #000000;
    cursor: pointer;
    min-height: 42px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-continue:active {
    background-color: #444444;
}

.btn-restart {
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 800;
    background-color: #ffffff;
    color: #000000;
    text-align: center;
    text-decoration: none;
    border: 2px solid #000000;
    cursor: pointer;
    min-height: 42px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-restart:active {
    background-color: #eeeeee;
}

.btn-reset-progress {
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 800;
    background-color: #ffffff;
    color: #333333;
    border: 2px solid #000000;
    cursor: pointer;
    min-height: 42px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-reset-progress:active {
    background-color: #dddddd;
}

.book-card.bookmarked-card {
    border-width: 3px;
    background-color: #fafafa;
}

.btn-book-bm {
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 800;
    background-color: #ffffff;
    color: #000000;
    border: 2px solid #000000;
    cursor: pointer;
    min-height: 42px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-book-bm.active {
    background-color: #000000;
    color: #ffffff;
}

.btn-book-complete {
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 800;
    background-color: #ffffff;
    color: #000000;
    border: 2px solid #000000;
    cursor: pointer;
    min-height: 42px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-book-complete.active {
    background-color: #000000;
    color: #ffffff;
}

.btn-book-info,
.btn-book-detail {
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 800;
    background-color: #ffffff;
    color: #000000;
    border: 2px solid #000000;
    cursor: pointer;
    min-height: 42px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-book-info.active,
.btn-book-detail.active {
    background-color: #222222;
    color: #ffffff;
}

/* Page Bookmark Chips */
.book-page-bms {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 6px 0;
    border-top: 1px dashed #aaaaaa;
}

.page-bm-label {
    font-size: 12px;
    font-weight: 800;
    color: #222222;
}

.page-bm-chip {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid #000000;
    background-color: #ffffff;
    min-height: 34px;
}

.page-bm-link {
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 800;
    color: #000000;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.page-bm-link:active {
    background-color: #eeeeee;
}

.btn-del-page-bm {
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 900;
    border: none;
    border-left: 1px solid #000000;
    background-color: #dddddd;
    color: #000000;
    cursor: pointer;
}

.btn-del-page-bm:active {
    background-color: #000000;
    color: #ffffff;
}

/* Expandable Book Info & Detail Box */
.book-info-box,
.book-detail-box {
    margin-top: 6px;
    padding: 10px 12px;
    border: 2px solid #000000;
    background-color: #f7f7f7;
    font-size: 13px;
    line-height: 1.5;
}

.detail-header {
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #000000;
    font-size: 13px;
    display: block;
    clear: both;
}

.detail-info-section {
    padding-bottom: 8px;
    border-bottom: 1px dashed #888888;
    margin-bottom: 8px;
}

.detail-info-wrap {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.detail-cover-wrap {
    flex-shrink: 0;
    width: 85px;
    line-height: 0;
}

.detail-cover-thumb {
    width: 85px;
    height: 120px;
    object-fit: cover;
    border: 2px solid #000000;
    display: block;
    background-color: #eeeeee;
}

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

.detail-summary-section {
    margin-top: 6px;
}

.summary-subheader {
    margin: 6px 0 8px 0;
    font-size: 13px;
    color: #222222;
}

.info-line {
    margin-bottom: 4px;
}

.info-line.info-sub {
    font-size: 11px;
    color: #555555;
    margin-bottom: 0;
}

.btn-author-search {
    min-height: 36px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: bold;
    border: 1px solid #000000;
    background-color: #ffffff;
    color: #000000;
    margin-left: 8px;
    cursor: pointer;
}

.btn-author-search:active {
    background-color: #000000;
    color: #ffffff;
}

/* Reset Reading Progress Button */
.btn-reset-progress {
    padding: 8px 10px;
    font-size: 13px;
    font-weight: bold;
    background-color: #f2f2f2;
    color: #333333;
    text-align: center;
    border: 1px solid #666666;
    cursor: pointer;
    min-height: 44px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-reset-progress:active {
    background-color: #000000;
    color: #ffffff;
}

/* Book Summary Button & Expandable Box */
.btn-book-summary {
    padding: 8px 12px;
    font-size: 13px;
    font-weight: bold;
    background-color: #ffffff;
    color: #000000;
    border: 1px solid #000000;
    cursor: pointer;
    min-height: 44px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-book-summary.active {
    background-color: #222222;
    color: #ffffff;
}

.book-summary-box {
    margin-top: 8px;
    padding: 10px 12px;
    border: 2px solid #000000;
    background-color: #fafafa;
    font-size: 13px;
    line-height: 1.6;
}

.summary-header {
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #000000;
    font-size: 13px;
    display: block;
    clear: both;
}

.summary-header-text {
    display: inline-block;
    vertical-align: middle;
    cursor: pointer;
}

.btn-summary-close-head {
    display: inline-block;
    float: right;
    vertical-align: middle;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 800;
    color: #000000;
    background-color: #ffffff;
    border: 2px solid #000000;
    cursor: pointer;
    margin-left: 8px;
}

.btn-summary-close-head:active {
    background-color: #000000;
    color: #ffffff;
}

.summary-author {
    font-weight: normal;
    color: #333333;
}

.summary-source {
    font-size: 11px;
    color: #666666;
    margin-left: 6px;
}

.summary-body {
    white-space: pre-line;
    margin-bottom: 8px;
    color: #111111;
    cursor: pointer;
}

.summary-loading {
    margin: 0;
    color: #555555;
    font-style: italic;
}

.summary-bottom-bar {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px dashed #000000;
    clear: both;
    text-align: left;
}

.summary-bottom-bar button {
    display: inline-block;
    vertical-align: middle;
    margin: 4px 6px 4px 0;
}

.btn-summary-more {
    min-height: 44px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: bold;
    border: 2px solid #000000;
    background-color: #ffffff;
    color: #000000;
    cursor: pointer;
    display: inline-block;
    margin-bottom: 8px;
}

.btn-summary-more:active {
    background-color: #000000;
    color: #ffffff;
}

.btn-summary-close-bottom {
    min-height: 44px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 800;
    background-color: #000000;
    color: #ffffff;
    border: 2px solid #000000;
    cursor: pointer;
    display: inline-block;
    vertical-align: middle;
}

.btn-summary-close-bottom:active {
    background-color: #444444;
}

.empty-state {
    text-align: center;
    padding: 30px 15px;
    border: 2px dashed #666666;
    margin-top: 20px;
}

/* Pagination Bar (Centered, 100% Kindle-Compatible Block/Inline-Block) */
.pagination-bar {
    display: block !important;
    text-align: center;
    margin-top: 14px;
    margin-bottom: 24px;
    padding: 10px 4px;
    border-top: 2px solid #000000;
    border-bottom: 2px solid #000000;
    background-color: #fafafa;
    clear: both;
    width: 100%;
}

.pagination-bar.top-pagination {
    margin-top: 8px;
    margin-bottom: 14px;
    border-top: none;
    border-bottom: 2px solid #000000;
}

.btn-page-nav {
    display: inline-block !important;
    vertical-align: middle;
    min-height: 46px;
    min-width: 110px;
    padding: 8px 14px;
    margin: 4px 6px;
    font-size: 15px;
    font-weight: 800;
    background-color: #ffffff;
    color: #000000;
    border: 2px solid #000000;
    cursor: pointer;
    text-align: center;
    line-height: 28px;
    text-decoration: none;
}

.btn-page-nav:active:not(:disabled) {
    background-color: #000000;
    color: #ffffff;
}

.btn-page-nav:disabled {
    border: 2px dashed #888888 !important;
    color: #888888 !important;
    background-color: #f7f7f7 !important;
    cursor: default;
    opacity: 0.65;
}

.page-indicator {
    display: inline-block !important;
    vertical-align: middle;
    font-size: 16px;
    font-weight: 800;
    color: #000000;
    text-align: center;
    white-space: nowrap;
    margin: 4px 6px;
    padding: 4px 6px;
    min-width: 60px;
}

/* ==========================================================================
   VIEWER PAGE STYLES (Strict Kindle Viewport Lock)
   ========================================================================== */

body.viewer-page {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    touch-action: none;
    position: fixed;
    top: 0;
    left: 0;
    background-color: #ffffff;
}

#viewer-viewport {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
}

#page-img {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

/* 3-Zone Touch Layout */
.touch-zone {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 10;
    background-color: transparent;
    cursor: pointer;
}

.touch-zone.left {
    left: 0;
    width: 25%;
}

.touch-zone.center {
    left: 25%;
    width: 50%;
}

.touch-zone.right {
    left: 75%;
    width: 25%;
}

/* Page Change Flash Indicator for Kindle E-ink response */
.touch-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 28px;
    font-weight: 900;
    padding: 8px 14px;
    background: #ffffff;
    border: 2px solid #000000;
    display: none;
    z-index: 25;
}
.touch-indicator.left { left: 10px; }
.touch-indicator.right { right: 10px; }

/* Overlay UI */
.viewer-overlay {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    z-index: 20;
    background-color: #ffffff;
    color: #000000;
}

.viewer-overlay.visible {
    display: block;
}

.overlay-top {
    top: 0;
    border-bottom: 3px solid #000000;
    padding: 8px 12px;
}

.top-bar-content {
    display: -webkit-flex;
    display: flex;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    -webkit-align-items: center;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

.btn-nav-back {
    display: -webkit-inline-flex;
    display: inline-flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: center;
    justify-content: center;
    width: auto !important;
    min-width: max-content;
    white-space: nowrap !important;
    word-break: keep-all !important;
    flex-shrink: 0;
    -webkit-flex-shrink: 0;
    text-align: center;
    padding: 8px 12px;
    font-size: 15px;
    font-weight: 800;
    color: #000000;
    background-color: #ffffff;
    border: 2px solid #000000;
    text-decoration: none;
    cursor: pointer;
    min-height: 44px;
    box-sizing: border-box;
}

.btn-nav-back:active {
    background-color: #000000;
    color: #ffffff;
}

.overlay-title-group {
    -webkit-flex: 1 1 auto;
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    padding: 0 8px;
    box-sizing: border-box;
}

.overlay-book-title {
    font-size: 14px;
    font-weight: bold;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.overlay-page-indicator {
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.btn-bookmark-toggle {
    display: -webkit-inline-flex;
    display: inline-flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: center;
    justify-content: center;
    width: auto !important;
    min-width: max-content;
    white-space: nowrap !important;
    word-break: keep-all !important;
    flex-shrink: 0;
    -webkit-flex-shrink: 0;
    text-align: center;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: bold;
    background-color: #ffffff;
    color: #000000;
    border: 2px solid #000000;
    cursor: pointer;
    min-height: 44px;
    box-sizing: border-box;
}

.btn-bookmark-toggle.active {
    background-color: #000000;
    color: #ffffff;
}

.btn-bookmark-toggle:active {
    opacity: 0.8;
}

/* Bottom Overlay Menu */
.overlay-bottom {
    bottom: 0;
    border-top: 3px solid #000000;
    padding: 10px 12px 30px 12px;
}

.bottom-jump-bar {
    display: table;
    width: 100%;
    table-layout: fixed;
    margin-bottom: 8px;
}

.btn-jump {
    display: table-cell;
    text-align: center;
    vertical-align: middle;
    padding: 10px 0;
    font-size: 15px;
    font-weight: 800;
    background-color: #ffffff;
    color: #000000;
    border: 2px solid #000000;
    cursor: pointer;
    min-height: 44px;
}

.btn-jump:active {
    background-color: #000000;
    color: #ffffff;
}

.bottom-direct-jump {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.input-page-jump {
    width: 70px;
    height: 40px;
    font-size: 16px;
    text-align: center;
    border: 2px solid #000000;
    font-weight: bold;
}

.btn-page-go {
    height: 40px;
    padding: 0 14px;
    font-size: 14px;
    font-weight: bold;
    background-color: #000000;
    color: #ffffff;
    border: 2px solid #000000;
    cursor: pointer;
}

.bookmark-list-container {
    border-top: 2px solid #000000;
    padding-top: 8px;
    font-size: 15px;
}

.bookmark-list-title {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 6px;
}

.bookmark-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 90px;
    overflow-y: auto;
}

.chip-bookmark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 6px 14px;
    font-size: 17px;
    font-weight: 800;
    border: 2px solid #000000;
    background: #ffffff;
    cursor: pointer;
    text-decoration: none;
    color: #000000;
}

.chip-bookmark:active {
    background: #000000;
    color: #ffffff;
}

/* Loading notice */
.loading-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 12px 20px;
    background-color: #ffffff;
    border: 2px solid #000000;
    font-size: 16px;
    font-weight: bold;
    display: none;
    z-index: 5;
}

/* ==========================================================================
   LOGIN PAGE STYLES (Kindle E-ink High Contrast)
   ========================================================================== */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 16px;
    background-color: #ffffff;
}

.login-container {
    width: 100%;
    max-width: 360px;
    border: 3px solid #000000;
    background: #ffffff;
    padding: 20px 16px;
    text-align: center;
}

.login-title {
    font-size: 20px;
    font-weight: 800;
    margin: 0 0 8px 0;
}

.login-desc {
    font-size: 13px;
    color: #444444;
    margin: 0 0 16px 0;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-input {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border: 2px solid #000000;
    text-align: center;
    box-sizing: border-box;
}

.btn-login {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    font-weight: 800;
    background-color: #000000;
    color: #ffffff;
    border: 2px solid #000000;
    cursor: pointer;
}

.btn-login:active {
    background-color: #555555;
}

.login-error {
    padding: 6px;
    border: 1px solid #000000;
    background-color: #000000;
    color: #ffffff;
    font-size: 13px;
    font-weight: bold;
}

.login-hint {
    margin-top: 14px;
    font-size: 11px;
    color: #666666;
    line-height: 1.4;
    border-top: 1px dashed #aaaaaa;
    padding-top: 8px;
}

/* ==========================================================================
   MODAL DIALOG STYLES (Password Change)
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.65);
    z-index: 1000;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    padding: 14px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-box {
    background: #ffffff;
    border: 3px solid #000000;
    width: 100%;
    max-width: 440px;
    margin: 20px auto;
    padding: 16px;
    box-sizing: border-box;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #000000;
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.modal-title {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
}

.btn-modal-close {
    border: 2px solid #000000;
    background: #ffffff;
    font-size: 14px;
    font-weight: 800;
    padding: 4px 8px;
    cursor: pointer;
}

.form-group {
    margin-bottom: 10px;
    text-align: left;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 4px;
}

.modal-input {
    width: 100%;
    padding: 8px;
    font-size: 14px;
    border: 2px solid #000000;
    box-sizing: border-box;
}

.modal-footer {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    border-top: 1px dashed #000000;
    padding-top: 10px;
}

.btn-modal-primary {
    flex: 1;
    padding: 8px;
    font-size: 14px;
    font-weight: 800;
    background: #000000;
    color: #ffffff;
    border: 2px solid #000000;
    cursor: pointer;
}

.btn-modal-secondary {
    flex: 1;
    padding: 8px;
    font-size: 14px;
    font-weight: bold;
    background: #ffffff;
    color: #000000;
    border: 2px solid #000000;
    cursor: pointer;
}

.modal-msg {
    padding: 6px;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: bold;
    border: 1px solid #000000;
}
.modal-msg.error {
    background: #000000;
    color: #ffffff;
}
.modal-msg.success {
    background: #f4f4f4;
    color: #000000;
}

/* ==========================================================================
   RANDOM BOOKS BANNER STYLES (Kindle E-ink High Contrast)
   ========================================================================== */
.banner-section {
    border: 2px solid #000000;
    background-color: #f9f9f9;
    padding: 10px;
    margin-bottom: 12px;
}

.banner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 2px solid #000000;
    margin-bottom: 10px;
}

.banner-title-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.banner-icon {
    font-size: 18px;
}

.banner-title {
    font-size: 16px;
    font-weight: 800;
    color: #000000;
}

.banner-count-badge {
    font-size: 13px;
    font-weight: normal;
    color: #555555;
}

.banner-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.banner-size-label {
    font-size: 13px;
    font-weight: 800;
    color: #000000;
}

.banner-size-select {
    min-height: 38px;
    padding: 4px 8px;
    font-size: 13px;
    font-weight: 800;
    border: 2px solid #000000;
    background-color: #ffffff;
    color: #000000;
    border-radius: 0;
    cursor: pointer;
}

.btn-banner-action {
    min-height: 38px;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 800;
    background-color: #ffffff;
    color: #000000;
    border: 2px solid #000000;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-banner-action:active {
    background-color: #000000;
    color: #ffffff;
}

.banner-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.banner-card {
    flex: 1 1 160px;
    max-width: 240px;
    border: 2px solid #000000;
    background-color: #ffffff;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-sizing: border-box;
}

.banner-thumb-wrap {
    width: 100%;
    min-height: 155px;
    background-color: #f5f5f5;
    border: 1px solid #000000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 0;
    cursor: pointer;
    box-sizing: border-box;
}

.banner-thumb-img {
    width: 105px;
    height: 150px;
    object-fit: cover;
    border: 1px solid #000000;
    display: block;
    background-color: #ffffff;
    box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.25);
}

.banner-card-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.banner-card-title {
    font-size: 13px;
    font-weight: 800;
    line-height: 1.3;
    color: #000000;
    max-height: 34px;
    overflow: hidden;
    word-break: break-word;
}

.banner-card-author {
    font-size: 11px;
    color: #555555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.banner-card-meta {
    font-size: 11px;
    font-weight: bold;
    color: #222222;
}

.banner-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.btn-banner-read {
    flex: 1;
    min-height: 42px;
    padding: 4px 6px;
    font-size: 13px;
    font-weight: 800;
    background-color: #000000;
    color: #ffffff;
    text-align: center;
    text-decoration: none;
    border: 2px solid #000000;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.btn-banner-detail {
    flex: 1;
    min-height: 42px;
    padding: 4px 6px;
    font-size: 12px;
    font-weight: 800;
    background-color: #ffffff;
    color: #000000;
    border: 2px solid #000000;
    cursor: pointer;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    box-sizing: border-box;
}

.btn-banner-detail:active,
.btn-banner-detail.active {
    background-color: #000000;
    color: #ffffff;
}

/* Banner Inline Detail Box */
.banner-detail-box {
    margin-top: 6px;
    padding: 8px;
    border: 2px solid #000000;
    background-color: #f9f9f9;
    font-size: 11px;
    line-height: 1.4;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-sizing: border-box;
}

.banner-detail-meta {
    font-size: 11px;
    color: #333333;
    border-bottom: 1px dashed #cccccc;
    padding-bottom: 4px;
}

.banner-detail-summary {
    font-size: 11px;
    color: #111111;
}

.banner-summary-text {
    margin: 4px 0 0 0;
    max-height: 140px;
    overflow-y: auto;
    font-size: 11px;
    line-height: 1.4;
    word-break: break-word;
}

.banner-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
    border-top: 1px dashed #cccccc;
    padding-top: 4px;
}

.btn-banner-action-sm {
    padding: 4px 8px;
    min-height: 28px;
    font-size: 11px;
    font-weight: 800;
    background-color: #ffffff;
    color: #000000;
    border: 1px solid #000000;
    cursor: pointer;
}

.btn-banner-action-sm:active {
    background-color: #000000;
    color: #ffffff;
}

/* Single Reset Buttons in Detail Box */
.btn-reset-single-cover {
    margin-top: 6px;
    width: 100%;
    min-height: 36px;
    padding: 4px 8px;
    font-size: 13px;
    font-weight: 800;
    background-color: #ffffff;
    color: #000000;
    border: 2px solid #000000;
    cursor: pointer;
    display: block;
}

.btn-reset-single-summary {
    min-height: 38px;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 800;
    background-color: #ffffff;
    color: #000000;
    border: 2px solid #000000;
    cursor: pointer;
    margin-bottom: 8px;
    display: inline-block;
}

/* Force Profile Selection Modal */
.modal-profile-force-box {
    max-width: 480px;
    border: 3px solid #000000;
}

.profile-force-desc {
    font-size: 15px;
    font-weight: bold;
    color: #000000;
    margin-bottom: 12px;
    line-height: 1.4;
}

.force-profile-list-wrap {
    margin-bottom: 16px;
    padding: 10px;
    border: 2px solid #000000;
    background-color: #f5f5f5;
}

.force-profile-list-label {
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 8px;
}

.force-profile-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn-force-profile-pick {
    min-height: 44px;
    padding: 6px 16px;
    font-size: 15px;
    font-weight: 800;
    background-color: #ffffff;
    color: #000000;
    border: 2px solid #000000;
    cursor: pointer;
}

.btn-force-profile-pick:active {
    background-color: #000000;
    color: #ffffff;
}

.force-add-profile-group {
    margin-top: 14px;
}

.force-profile-input-row {
    display: flex;
    gap: 6px;
}

.force-profile-input-row .modal-input {
    flex: 1;
}

.force-profile-input-row .btn-modal-primary {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 8px 14px;
}

/* Cache Management Items */
.cache-mgmt-item {
    padding: 12px 0;
    border-bottom: 1px solid #cccccc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.cache-item-info {
    flex: 1;
}

.cache-item-info strong {
    font-size: 14px;
    color: #000000;
}

.cache-item-desc {
    font-size: 12px;
    color: #555555;
    margin: 4px 0 0 0;
    line-height: 1.35;
}

.btn-modal-action {
    min-height: 42px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 800;
    background-color: #ffffff;
    color: #000000;
    border: 2px solid #000000;
    cursor: pointer;
    white-space: nowrap;
}

.btn-modal-action:active {
    background-color: #000000;
    color: #ffffff;
}

/* Viewer Contrast Controls & Completion Banner */
.overlay-controls-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.overlay-contrast-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
}

.contrast-label {
    font-size: 13px;
    font-weight: 800;
    color: #000000;
}

.select-contrast {
    min-height: 38px;
    padding: 4px 8px;
    font-size: 13px;
    font-weight: 800;
    border: 2px solid #000000;
    background-color: #ffffff;
    color: #000000;
    border-radius: 0;
    cursor: pointer;
}

.complete-banner-box {
    position: absolute;
    bottom: 36px;
    left: 50%;
    transform: translateX(-50%);
    width: 88%;
    max-width: 520px;
    background-color: #ffffff;
    border: 3px solid #000000;
    padding: 16px 20px;
    text-align: center;
    z-index: 15;
    box-shadow: 4px 4px 0px #000000;
}

.complete-banner-title {
    font-size: 20px;
    font-weight: 800;
    color: #000000;
    margin-bottom: 6px;
}

.complete-banner-desc {
    font-size: 14px;
    color: #333333;
    margin: 0 0 14px 0;
}

.complete-banner-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-viewer-complete {
    min-height: 48px;
    padding: 8px 20px;
    font-size: 16px;
    font-weight: 800;
    background-color: #000000;
    color: #ffffff;
    border: 2px solid #000000;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-viewer-complete.completed {
    background-color: #222222;
    color: #ffffff;
}

.btn-viewer-back {
    min-height: 48px;
    padding: 8px 18px;
    font-size: 15px;
    font-weight: 800;
    background-color: #ffffff;
    color: #000000;
    border: 2px solid #000000;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ==============================================================================
   E-ink Dynamic Preprocessing & Display Settings Panel
   ============================================================================== */
.btn-settings-toggle {
    min-height: 38px;
    padding: 4px 10px;
    font-size: 13px;
    font-weight: 800;
    background-color: #ffffff;
    color: #000000;
    border: 2px solid #000000;
    cursor: pointer;
    white-space: nowrap;
}

.btn-settings-toggle:active {
    background-color: #000000;
    color: #ffffff;
}

.settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 92%;
    max-width: 460px;
    background-color: #ffffff;
    border: 3px solid #000000;
    box-shadow: 6px 6px 0px #000000;
    z-index: 200;
    padding: 16px 18px;
    max-height: 90vh;
    overflow-y: auto;
}

.settings-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #000000;
    padding-bottom: 10px;
    margin-bottom: 14px;
}

.settings-panel-title {
    font-size: 16px;
    font-weight: 800;
    color: #000000;
}

.btn-settings-close {
    background-color: #ffffff;
    border: 2px solid #000000;
    font-size: 13px;
    font-weight: 800;
    padding: 6px 10px;
    cursor: pointer;
    min-height: 36px;
}

.settings-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-label {
    font-size: 13px;
    font-weight: 800;
    color: #000000;
}

.settings-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.btn-setting-opt {
    flex: 1 1 auto;
    min-height: 42px;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 800;
    border: 2px solid #000000;
    background-color: #ffffff;
    color: #000000;
    border-radius: 0;
    cursor: pointer;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-setting-opt.active {
    background-color: #000000 !important;
    color: #ffffff !important;
    border-color: #000000 !important;
}

.btn-setting-opt:active {
    background-color: #444444;
    color: #ffffff;
}

.settings-actions {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    border-top: 2px solid #000000;
    padding-top: 12px;
}

.btn-settings-reset {
    min-height: 42px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 800;
    background-color: #f0f0f0;
    border: 2px solid #000000;
    color: #000000;
    cursor: pointer;
}

.btn-settings-close-main {
    min-height: 42px;
    padding: 6px 20px;
    font-size: 14px;
    font-weight: 800;
    background-color: #000000;
    border: 2px solid #000000;
    color: #ffffff;
    cursor: pointer;
}

.btn-settings-close-main:active {
    background-color: #333333;
}

