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

.abfc-app,
.abfc-reader-wrap,
.abfc-app *,
.abfc-reader-wrap * {
    box-sizing: border-box;
}

.abfc-app p:empty,
.abfc-reader-wrap p:empty,
.abfc-app > br,
.abfc-reader-wrap > br {
    display: none !important;
}

.abfc-single-page-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 12px;
}

.abfc-app,
.abfc-reader-wrap {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Yu Gothic", sans-serif;
    color: #0f172a;
    width: 100%;
    max-width: 1280px;
    margin: 6px auto;
    padding: 8px;
    -webkit-tap-highlight-color: transparent;
}

.abfc-enter-anim {
    animation: abfcViewIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

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

body.abfc-modal-open {
    overflow: hidden;
}

/* ==========================================================================
   KHO SÁCH (BOOK SHELF VIEW)
   ========================================================================== */
.abfc-shelf-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.abfc-shelf-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #4f46e5;
    background: #eef2ff;
    padding: 3px 10px;
    border-radius: 999px;
    margin-bottom: 4px;
}

.abfc-shelf-title {
    margin: 0 !important;
    font-size: 20px !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    line-height: 1.25 !important;
}

.abfc-shelf-total {
    color: #64748b;
    font-weight: 700;
    font-size: 16px;
}

.abfc-search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.abfc-search-box i {
    position: absolute;
    left: 11px;
    color: #94a3b8;
    font-size: 13px;
    pointer-events: none;
}

.abfc-shelf-search {
    padding: 7px 12px 7px 32px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 10px !important;
    font-size: 13.5px !important;
    background: #ffffff !important;
    color: #0f172a !important;
    min-width: 210px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.abfc-shelf-search:focus {
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14) !important;
}

.abfc-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.abfc-filter-pill {
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #475569;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.abfc-filter-pill:hover {
    border-color: #c7d2fe;
    color: #4338ca;
}

.abfc-filter-pill.active {
    background: #4f46e5;
    border-color: #4f46e5;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

/* Portrait 1:2 Book Grid */
.abfc-book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(122px, 1fr));
    gap: 10px;
    width: 100%;
}

.abfc-book-card {
    position: relative;
    aspect-ratio: 1 / 2;
    width: 100%;
    min-height: 0;
    border: none;
    border-radius: 6px 12px 12px 6px;
    padding: 10px 10px 10px 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: left;
    cursor: pointer;
    color: #ffffff;
    overflow: hidden;
    font-family: inherit;
    box-shadow:
        0 8px 18px rgba(15, 23, 42, 0.14),
        inset -3px 0 0 rgba(255, 255, 255, 0.24),
        inset 0 -3px 0 rgba(0, 0, 0, 0.12);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.28s ease;
}

.abfc-book-card:hover {
    transform: translateY(-5px) scale(1.018);
    box-shadow:
        0 18px 30px rgba(15, 23, 42, 0.22),
        inset -3px 0 0 rgba(255, 255, 255, 0.34),
        inset 0 -3px 0 rgba(0, 0, 0, 0.15);
}

.abfc-book-card:active {
    transform: scale(0.975);
}

.abfc-book-sheen {
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 25%, rgba(255, 255, 255, 0.16) 45%, transparent 65%);
    transform: translateX(-110%);
    transition: transform 0.55s ease;
    pointer-events: none;
}

.abfc-book-card:hover .abfc-book-sheen {
    transform: translateX(110%);
}

/* Curated modern book cover palettes */
.abfc-book-card.is-palette-0 { background: linear-gradient(155deg, #4338ca 0%, #6366f1 100%); }
.abfc-book-card.is-palette-1 { background: linear-gradient(155deg, #047857 0%, #10b981 100%); }
.abfc-book-card.is-palette-2 { background: linear-gradient(155deg, #b45309 0%, #f59e0b 100%); }
.abfc-book-card.is-palette-3 { background: linear-gradient(155deg, #be123c 0%, #f43f5e 100%); }
.abfc-book-card.is-palette-4 { background: linear-gradient(155deg, #0369a1 0%, #0ea5e9 100%); }
.abfc-book-card.is-palette-5 { background: linear-gradient(155deg, #6d28d9 0%, #a855f7 100%); }

.abfc-book-spine {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 8px;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.28) 0%, rgba(255, 255, 255, 0.18) 65%, rgba(0, 0, 0, 0.1) 100%);
}

.abfc-book-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    width: 100%;
    z-index: 1;
}

.abfc-book-type-pill {
    font-size: 9.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(4px);
    padding: 2px 6px;
    border-radius: 6px;
    white-space: nowrap;
}

.abfc-book-resume-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fde047;
    box-shadow: 0 0 0 3px rgba(253, 224, 71, 0.35);
    flex-shrink: 0;
}

.abfc-book-cover-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
    margin: auto 0;
    padding: 6px 2px;
    z-index: 1;
    width: 100%;
}

.abfc-book-motif {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.32);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
}

.abfc-book-name {
    font-size: 13.5px;
    font-weight: 800;
    line-height: 1.3;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.abfc-book-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.22);
    padding-top: 6px;
    width: 100%;
    text-align: center;
    z-index: 1;
}

.abfc-book-meta {
    font-size: 10.5px;
    font-weight: 700;
    opacity: 0.92;
}

.abfc-empty-notice {
    text-align: center;
    padding: 28px 16px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    color: #475569;
    font-size: 14px;
}

/* ==========================================================================
   BOOK READER TOPBAR, BREADCRUMB & CHAPTERS GRID
   ========================================================================== */
.abfc-reader-topbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}

.abfc-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 9px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #1e293b;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    max-width: 210px;
}

.abfc-nav-btn .abfc-back-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.abfc-nav-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.abfc-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13px;
    color: #64748b;
}

.abfc-crumb-link {
    background: none;
    border: none;
    padding: 2px 4px;
    color: #4f46e5;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    border-radius: 4px;
}

.abfc-crumb-link:hover {
    background: #eef2ff;
    text-decoration: underline;
}

.abfc-crumb-current {
    font-weight: 800;
    color: #0f172a;
}

.abfc-crumb-sep {
    color: #cbd5e1;
}

.abfc-reader-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 16px;
    color: #475569;
    font-weight: 700;
}

.abfc-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid #e2e8f0;
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: abfcSpin 0.7s linear infinite;
}

@keyframes abfcSpin {
    to { transform: rotate(360deg); }
}

/* Chapters / Sets Grid */
.abfc-chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
}

.abfc-chapter-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.abfc-chapter-card:hover {
    transform: translateY(-2px);
    border-color: #818cf8;
    box-shadow: 0 8px 18px rgba(79, 70, 229, 0.12);
}

.abfc-chapter-card.is-resumable {
    border-color: #f59e0b;
    background: #fffbeb;
}

.abfc-chapter-num {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #ffffff;
    font-size: 13px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.abfc-chapter-card.is-set .abfc-chapter-num {
    background: linear-gradient(135deg, #059669, #10b981);
}

.abfc-chapter-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.abfc-chapter-title {
    font-size: 13.5px;
    font-weight: 800;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.abfc-chapter-meta {
    font-size: 11.5px;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.abfc-chapter-sample {
    color: #4f46e5;
    font-weight: 700;
}

.abfc-chapter-arrow {
    color: #94a3b8;
    font-size: 12px;
    flex-shrink: 0;
}

/* ==========================================================================
   SET TOOLBAR, AUDIO & OBI GRID (3:1 RATIO)
   ========================================================================== */
.abfc-set-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.abfc-set-toolbar-left {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.abfc-set-title {
    margin: 0 !important;
    font-size: 17px !important;
    font-weight: 800 !important;
    color: #0f172a !important;
}

.abfc-set-count-badge {
    font-size: 11.5px;
    font-weight: 800;
    color: #4f46e5;
    background: #eef2ff;
    padding: 3px 9px;
    border-radius: 999px;
}

.abfc-set-sibling-nav {
    display: inline-flex;
    gap: 4px;
}

.abfc-mini-btn {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    font-size: 11.5px;
    font-weight: 700;
    padding: 4px 9px;
    border-radius: 7px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.18s;
}

.abfc-mini-btn:hover:not(:disabled) {
    border-color: #6366f1;
    color: #4f46e5;
}

.abfc-mini-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.abfc-set-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.abfc-pagesize-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #475569;
}

.abfc-pagesize-select {
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    padding: 4px 8px !important;
    font-size: 12.5px !important;
    font-weight: 700 !important;
    background: #ffffff !important;
    color: #0f172a !important;
    font-family: inherit;
    cursor: pointer;
}

.abfc-audio-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 6px 10px;
    margin-bottom: 10px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.abfc-audio-label {
    font-size: 12px;
    font-weight: 800;
    color: #334155;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.abfc-audio-player {
    flex: 1;
    min-width: 200px;
    height: 32px;
}

/* Obi Flashcard Grid: Compact spacing, strict 3:1 width:height */
.abfc-obi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    width: 100%;
}

.abfc-obi-card {
    aspect-ratio: 3 / 1;
    width: 100%;
    min-height: 0;
    display: flex;
    align-items: stretch;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    cursor: pointer;
    overflow: hidden;
    text-align: left;
    font-family: inherit;
    color: #0f172a;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
    transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.2s ease, box-shadow 0.2s ease;
}

.abfc-obi-card:hover {
    transform: translateY(-2px);
    border-color: #6366f1;
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.14);
}

.abfc-obi-card:active {
    transform: scale(0.98);
}

.abfc-obi-card.is-last-studied {
    border-color: #f59e0b;
    background: #fffdf5;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.24);
}

.abfc-obi-num {
    width: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #4f46e5 0%, #6366f1 100%);
    color: #ffffff;
    font-size: 11.5px;
    font-weight: 900;
    border-right: 1px solid rgba(79, 70, 229, 0.15);
}

.abfc-obi-card.is-last-studied .abfc-obi-num {
    background: linear-gradient(180deg, #d97706 0%, #f59e0b 100%);
    color: #ffffff;
}

.abfc-obi-content {
    flex: 1;
    min-width: 0;
    min-height: 0;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.abfc-obi-front {
    font-size: 14.5px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    width: 100%;
}

.abfc-obi-img-badge {
    font-size: 12px;
    color: #4f46e5;
}

/* Pagination */
.abfc-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 14px;
}

.abfc-page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.18s;
}

.abfc-page-btn:hover:not(:disabled) {
    border-color: #6366f1;
    color: #4f46e5;
}

.abfc-page-btn.active {
    background: #4f46e5;
    border-color: #4f46e5;
    color: #ffffff;
}

.abfc-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.abfc-page-ellipsis {
    color: #94a3b8;
    padding: 0 4px;
}

.abfc-page-info {
    font-size: 12px;
    color: #64748b;
    font-weight: 700;
    margin-left: 6px;
}

/* ==========================================================================
   MODALS: RESUME PROMPT, FLASHCARD POPUP, REPORT
   ========================================================================== */
.abfc-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.64);
    backdrop-filter: blur(5px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    animation: abfcFadeIn 0.2s ease;
}

@keyframes abfcFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.abfc-modal-card {
    position: relative;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
    width: 100%;
    max-width: 440px;
    padding: 22px;
    text-align: center;
    animation: abfcPopIn 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.abfc-resume-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 30px;
    height: 30px;
    border: none;
    background: #f1f5f9;
    color: #64748b;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s, color 0.18s;
}

.abfc-resume-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

@keyframes abfcPopIn {
    from { opacity: 0; transform: scale(0.94) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.abfc-resume-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 10px;
    border-radius: 14px;
    background: #eef2ff;
    color: #4f46e5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.abfc-resume-title {
    margin: 0 0 6px 0 !important;
    font-size: 18px !important;
    font-weight: 800 !important;
    color: #0f172a !important;
}

.abfc-resume-desc {
    margin: 0 0 10px 0 !important;
    font-size: 13.5px;
    color: #64748b;
}

.abfc-resume-preview {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 16px;
}

.abfc-resume-location {
    font-size: 12px;
    font-weight: 700;
    color: #4f46e5;
    margin-bottom: 4px;
}

.abfc-resume-card-front {
    font-size: 17px;
    font-weight: 800;
    color: #0f172a;
    word-break: break-word;
}

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

.abfc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 800;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}

.abfc-btn-primary {
    background: #4f46e5;
    color: #ffffff;
}

.abfc-btn-primary:hover {
    background: #4338ca;
}

.abfc-btn-secondary {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.abfc-btn-secondary:hover {
    background: #e2e8f0;
}

/* Flashcard Popup Dialog (Minimalist Design) */
.abfc-popup-dialog {
    width: 100%;
    max-width: 540px;
    max-height: 88vh;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 25px 60px -12px rgba(15, 23, 42, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: abfcPopIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.abfc-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 20px 12px;
    background: #ffffff;
}

.abfc-popup-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.abfc-popup-counter {
    background: #eef2ff;
    color: #4338ca;
    font-size: 12px;
    font-weight: 800;
    padding: 4px 11px;
    border-radius: 999px;
    white-space: nowrap;
}

.abfc-popup-setname {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.abfc-popup-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.abfc-popup-icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    border-radius: 999px;
    border: none;
    background: #f1f5f9;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.18s;
}

.abfc-popup-icon-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.abfc-popup-progress-track {
    width: 100%;
    height: 2px;
    background: #f1f5f9;
    overflow: hidden;
    flex-shrink: 0;
}

.abfc-popup-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 100%);
    transition: width 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.abfc-popup-stage {
    flex: 1;
    overflow: hidden;
    display: flex;
    background: #ffffff;
}

.abfc-popup-card {
    flex: 1;
    padding: 24px 28px 28px;
    overflow-y: auto;
    touch-action: pan-y;
    transition: transform 0.22s ease, opacity 0.22s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.abfc-popup-card.is-anim-next {
    animation: abfcSlideNext 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.abfc-popup-card.is-anim-prev {
    animation: abfcSlidePrev 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes abfcSlideNext {
    from { opacity: 0.4; transform: translateX(24px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes abfcSlidePrev {
    from { opacity: 0.4; transform: translateX(-24px); }
    to { opacity: 1; transform: translateX(0); }
}

.abfc-popup-front-box {
    padding: 6px 4px 22px;
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #f1f5f9;
}

.abfc-popup-front-content {
    font-size: 28px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.4;
    letter-spacing: -0.01em;
    word-break: break-word;
}

.abfc-popup-backs-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
}

.abfc-popup-back-item {
    width: 100%;
    word-break: break-word;
}

.abfc-popup-back-item.is-back1 {
    font-size: 18px;
    font-weight: 700;
    color: #4338ca;
    line-height: 1.5;
}

.abfc-popup-back-item.is-back2 {
    font-size: 15.5px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.65;
}

.abfc-popup-back-item.is-back3 {
    font-size: 14.5px;
    font-weight: 500;
    color: #64748b;
    line-height: 1.55;
}

.abfc-popup-back-item.is-back4,
.abfc-popup-back-item.is-image {
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    line-height: 1.5;
}

.abfc-popup-back-item.is-media {
    margin-top: 4px;
}

.abfc-card-img {
    max-width: 100%;
    max-height: 220px;
    border-radius: 14px;
    object-fit: contain;
    display: block;
    margin: 4px auto;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.abfc-empty-text {
    color: #94a3b8;
    font-style: italic;
}

.abfc-popup-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 20px;
    background: #ffffff;
    border-top: 1px solid #f1f5f9;
}

.abfc-popup-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: 999px;
    border: none;
    background: #4f46e5;
    color: #ffffff;
    font-size: 13.5px;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.18s, transform 0.15s, box-shadow 0.18s;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.22);
}

.abfc-popup-nav-btn:hover:not(:disabled) {
    background: #4338ca;
    transform: translateY(-1px);
}

.abfc-popup-nav-btn:disabled {
    background: #f1f5f9;
    color: #94a3b8;
    box-shadow: none;
    cursor: not-allowed;
}

.abfc-popup-hint {
    font-size: 11.5px;
    color: #94a3b8;
    font-weight: 600;
    text-align: center;
}

/* Report Modal */
.abfc-report-modal {
    text-align: left;
    max-width: 460px;
    padding: 0;
    overflow: hidden;
}

.abfc-report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.abfc-report-title {
    font-weight: 800;
    color: #0f172a;
    font-size: 14.5px;
}

.abfc-report-body {
    padding: 16px;
}

.abfc-report-preview {
    margin: 0 0 10px 0 !important;
    font-size: 13px;
    color: #475569;
}

.abfc-report-textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-family: inherit;
    font-size: 13.5px;
    resize: vertical;
}

.abfc-report-status {
    margin-top: 8px;
    font-size: 13px;
    font-weight: 700;
}

.abfc-report-status.is-success {
    color: #059669;
}

.abfc-report-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS (OPTIMIZED GRID ON MOBILE & TABLET)
   ========================================================================== */
@media (max-width: 1099px) {
    .abfc-obi-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .abfc-single-page-container {
        padding: 4px;
    }

    .abfc-app,
    .abfc-reader-wrap {
        padding: 6px;
        margin: 4px auto;
    }

    .abfc-shelf-title {
        font-size: 17px !important;
    }

    .abfc-shelf-search {
        min-width: 160px;
        width: 100%;
    }

    /* Keep Book Shelf multi-column grid (3 books per row) */
    .abfc-book-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .abfc-book-card {
        padding: 7px 6px 7px 11px;
        border-radius: 4px 10px 10px 4px;
    }

    .abfc-book-motif {
        width: 26px;
        height: 26px;
        font-size: 13px;
    }

    .abfc-book-name {
        font-size: 11.5px;
        -webkit-line-clamp: 4;
    }

    .abfc-book-type-pill {
        font-size: 8.5px;
        padding: 1px 5px;
    }

    .abfc-book-meta {
        font-size: 9.5px;
    }

    /* Chapters/Sets grid: 2 columns on mobile */
    .abfc-chapters-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    .abfc-chapter-card {
        padding: 8px;
        gap: 7px;
    }

    .abfc-chapter-num {
        width: 26px;
        height: 26px;
        font-size: 11.5px;
        border-radius: 7px;
    }

    .abfc-chapter-title {
        font-size: 12px;
    }

    .abfc-chapter-meta {
        font-size: 10.5px;
    }

    /* Obi Card Grid: 2 columns on mobile (NOT 1 per row!), strict 3:1 ratio */
    .abfc-obi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    .abfc-obi-num {
        width: 24px;
        font-size: 10.5px;
    }

    .abfc-obi-content {
        padding: 4px 7px;
    }

    .abfc-obi-front {
        font-size: 12.5px;
        line-height: 1.24;
    }

    .abfc-popup-dialog {
        max-height: 92vh;
        border-radius: 20px;
    }

    .abfc-popup-card {
        padding: 18px 18px 22px;
    }

    .abfc-popup-front-box {
        padding: 4px 4px 16px;
        margin-bottom: 16px;
    }

    .abfc-popup-front-content {
        font-size: 22px;
    }

    .abfc-popup-back-item.is-back1 {
        font-size: 16.5px;
    }

    .abfc-popup-back-item.is-back2 {
        font-size: 14.5px;
    }

    .abfc-popup-hint {
        display: none;
    }

    .abfc-popup-nav-btn {
        padding: 8px 14px;
        font-size: 13px;
    }

    .abfc-popup-icon-btn span {
        display: none;
    }
}
