@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@700&family=Poppins:wght@300;400&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background-color: #0d0f12;
    color: #fff;
    font-family: 'Poppins', sans-serif;
    overflow-x: hidden;
    overflow-y: auto;
}

/* ================= SECRET ADMIN ICON ================= */
#admin-icon {
    position: fixed;
    bottom: 15px;
    left: 15px;
    width: 30px;
    height: 30px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    font-weight: bold;
    font-family: sans-serif;
    cursor: pointer;
    opacity: 0.2;
    transition: all 0.3s ease;
    z-index: 999999;
    color: #fff;
    user-select: none;
}
#admin-icon:hover {
    opacity: 1;
    background: #ff4757;
    border-color: #ff4757;
    transform: scale(1.1);
}

/* ================= HOME SCREEN ================= */
#home-screen {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh; 
    width: 100%;
    background-image: url('cover.jpg'); 
    background-size: cover;
    background-position: center top; 
    background-repeat: no-repeat;
    background-attachment: fixed;
}

.bg-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to right, rgba(13, 15, 18, 0.1) 0%, rgba(13, 15, 18, 0.6) 50%, rgba(13, 15, 18, 0.95) 100%);
    z-index: 1;
}

.home-content {
    position: relative;
    z-index: 10; 
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100vh;
    justify-content: center;
    align-items: flex-end; 
    padding: 40px 8%; 
    gap: 15px; 
}

.title-container {
    margin-bottom: 0;
    z-index: 10;
    text-align: right; 
    pointer-events: none;
    width: 100%;
}

.main-title-logo {
    width: 100%;
    max-width: 450px; 
    height: auto;
    filter: drop-shadow(0px 10px 20px rgba(0, 0, 0, 0.9));
    animation: floatLogo 4s ease-in-out infinite;
}

@keyframes floatLogo {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
    100% { transform: translateY(0px); }
}

/* ===== CHAPTER BANNERS ===== */
#chapter-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 550px; 
    z-index: 20; 
}

.chapter-item {
    position: relative;
    border-radius: 12px;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 5px 20px rgba(0,0,0,0.8);
    overflow: hidden;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    display: flex; 
    width: 100%;
}

.chapter-banner-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover; 
    pointer-events: none; 
}

.chapter-item:hover {
    transform: scale(1.03) translateY(-3px);
    border-color: #ff4757;
    box-shadow: 0 15px 35px rgba(255, 71, 87, 0.5);
}

/* ===== AUTHOR WATERMARK ===== */
.author-credits {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center; 
    gap: 4px;
    z-index: 10;
}

.author-credits .en-text {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    font-weight: 700;
    color: #e0e0e0;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
}

.author-credits .jp-text {
    font-size: 0.7rem;
    color: #ff4757;
    letter-spacing: 1px;
    opacity: 0.8;
}

/* ================= READER SCREEN ================= */
.hidden { display: none !important; }

#reader-screen { 
    display: flex; 
    flex-direction: column; 
    height: 100vh; 
    width: 100vw; 
    background-image: url('cover.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

.reader-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 20px; 
    background: rgba(15, 15, 18, 0.65); 
    backdrop-filter: blur(12px); 
    -webkit-backdrop-filter: blur(12px); 
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    z-index: 100;
}

.header-left, .header-center, .header-right { display: flex; align-items: center; gap: 15px; }
.header-left h2 { font-size: 1.2rem; font-weight: 400; color: #ccc; }

.btn {
    background: rgba(63, 63, 70, 0.8); color: #e4e4e7; border: none;
    padding: 8px 16px; border-radius: 6px; cursor: pointer; transition: 0.2s; font-size: 0.9rem; font-weight: 500;
}
.btn:hover { background: #52525b; color: #fff; }
.btn:disabled { background: #27272a; color: #52525b; cursor: not-allowed; }

/* ================= DOWNLOAD BUTTON ================= */
.download-btn {
    background: rgba(0, 255, 128, 0.2);
    border: 1px solid #00ff80;
    color: #00ff80;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
}
.download-btn:hover {
    background: #00ff80;
    color: #000;
    box-shadow: 0 0 15px rgba(0, 255, 128, 0.5);
}

.zoom-controls {
    display: flex; align-items: center; gap: 10px;
    background: rgba(39, 39, 42, 0.8); padding: 5px 10px; border-radius: 6px; border: 1px solid #3f3f46;
}
.zoom-controls span { font-size: 0.9rem; width: 45px; text-align: center; font-weight: bold; }

.main-area { display: flex; flex: 1; overflow: hidden; position: relative; }

.preview-sidebar {
    width: 220px; 
    background: rgba(15, 15, 18, 0.6); 
    backdrop-filter: blur(12px);
    border-right: 1px solid rgba(255, 255, 255, 0.1); 
    overflow-y: auto;
    display: flex; flex-direction: column; align-items: center; padding: 15px;
    gap: 20px; transition: width 0.3s ease, opacity 0.3s ease; z-index: 50;
}
.preview-sidebar.hidden { display: flex !important; width: 0; opacity: 0; padding: 0; overflow: hidden; border: none; }

.thumbnail {
    width: 170px; border: 3px solid transparent; cursor: pointer; transition: 0.2s;
    background: #fff; border-radius: 6px; overflow: hidden; position: relative; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.6); flex-shrink: 0;
}
.thumbnail:hover { border-color: #888; }
.thumbnail.active { border-color: #ff4757; box-shadow: 0 0 15px rgba(255, 71, 87, 0.8); transform: scale(1.02); }
.thumbnail img { width: 100%; height: auto; display: block; }

.page-badge {
    position: absolute; bottom: 8px; right: 8px; background: #ff4757; color: #fff;
    font-size: 1rem; font-weight: 900; padding: 4px 10px; border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.8); pointer-events: none; z-index: 10;
}

.pdf-viewer {
    flex: 1; 
    display: flex; 
    justify-content: center; 
    align-items: flex-start;
    overflow: auto; 
    padding: 40px 20px; 
    background: rgba(10, 10, 12, 0.65); 
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    touch-action: pan-x pan-y pinch-zoom;
}

.canvas-wrapper { transform-origin: top center; transition: transform 0.1s ease-out; display: flex; justify-content: center; align-items: center; width: 100%; }

canvas, #image-viewer { 
    background: #fff; 
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.95), 0 0 30px rgba(255, 255, 255, 0.1); 
    max-width: 100%; height: auto; 
    border-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
#image-viewer { display: block; object-fit: contain; }

/* ================= MOBILE VIEW ================= */
@media screen and (max-width: 900px) {
    #home-screen { 
        background-position: 35% center; 
        background-attachment: scroll; 
    }
    .bg-overlay { 
        background: linear-gradient(to bottom, rgba(13, 15, 18, 0.2) 0%, rgba(13, 15, 18, 0.8) 50%, rgba(13, 15, 18, 1) 100%); 
    }
    .home-content { 
        justify-content: flex-end; 
        align-items: center; 
        padding: 30px 20px 60px 20px; 
    }
    .title-container { 
        text-align: center; 
        margin-bottom: 15px; 
    }
    .main-title-logo { 
        max-width: 320px; 
    }
    #chapter-list { 
        max-width: 95%; 
    }
    .author-credits { 
        bottom: 10px; 
        align-items: center; 
    }
    .author-credits .en-text { 
        font-size: 0.9rem; 
    }
    .reader-header { 
        flex-wrap: wrap; 
        justify-content: center; 
        gap: 10px; 
        padding: 10px; 
    }
    .header-left, .header-center, .header-right { 
        width: 100%; 
        justify-content: center; 
    }
    .header-left h2 { 
        display: none; 
    }
}