body, html {
    margin: 0; padding: 0; width: 100%; height: 100%;
    overflow: hidden; font-family: 'Georgia', serif;
    /* Static background - no more parallax needed */
   background: 
        linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), 
        url('BG/tablebg.jpg') no-repeat center center;
    background-size: cover;
}

.screen-overlay {
    width: 100vw; height: 100vh; display: flex;
    justify-content: center; align-items: center; 
    /* Darkens the table slightly so the light feels like it's hitting the book */
    background: rgba(0,0,0,0.3); 
}

/* --- DIARY (Table Top Logic) --- */
.book-container {
    width: 500px; 
    height: 650px; 
    background: #e6dec5; /* Slightly darker "aged" paper tone */
    
    /* Deepened shadows for more weight on the table */
    box-shadow: 
        0 2px 5px rgba(0, 0, 0, 0.7),   
        0 15px 30px rgba(0, 0, 0, 0.6),  
        0 40px 80px rgba(0, 0, 0, 0.5),  
        inset 15px 0 25px rgba(0, 0, 0, 0.2); /* Stronger inner crease shadow */

    border-radius: 5px 15px 15px 5px; 
    position: relative; 
    padding: 40px 40px 40px 70px; 
    transition: transform 0.3s ease;
    overflow: hidden; 
}

/* THE DARKENED LEATHER SPINE */
.book-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 32px; 
    height: 100%;
    background: url('BG/leather.jpg') center center;
    background-size: cover;
    
    /* DARKENING FILTERS: 
       Brightness (0.4) makes it dark, 
       Contrast (1.2) keeps the leather grain visible */
    filter: brightness(0.85) contrast(1) sepia(0.2);
    
    z-index: 2;
    box-shadow: 4px 0 8px rgba(0,0,0,0.3); /* Harder shadow where leather meets paper */
}

/* THE DIMMED LIGHT HIGHLIGHT */
.book-container::after {
    content: "";
    position: absolute;
    top: 0;
    left: 2px;
    width: 5px; 
    height: 100%;
    /* Dimmed the highlight so it's not too bright against the dark leather */
    background: linear-gradient(to right, rgba(255,255,255,0.1), rgba(255,255,255,0));
    z-index: 3;
    pointer-events: none;
}
/* --- MODAL --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); backdrop-filter: blur(8px);
    display: flex; justify-content: center; align-items: center; z-index: 10000;
}

.modal-card {
    background: #f4ecd8; padding: 30px; border-radius: 10px;
    width: 90%; max-width: 450px; border-left: 10px solid #3d2b1f;
}

.toolbar { margin-bottom: 10px; display: flex; gap: 8px; }
.toolbar button { 
    padding: 5px 12px; cursor: pointer; background: #d3c7ab; 
    border: 1px solid #b5a88a; border-radius: 4px; color: #5d4a37; 
}

#modalText, #modalImg, #modalPass {
    width: 100%; padding: 10px; margin-bottom: 15px;
    border: 1px solid #d3c7ab; background: rgba(255,255,255,0.5); 
    box-sizing: border-box; font-family: inherit;
}

#modalText { height: 150px; resize: none; }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
#submitBtn { background: #5d4a37; color: white; border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; }
.cancel-btn { background: transparent; border: 1px solid #5d4a37; padding: 10px 20px; border-radius: 4px; cursor: pointer; }

/* --- CONTENT AREA --- */
.page-header { display: flex; justify-content: space-between; border-bottom: 2px solid #d3c7ab; padding-bottom: 10px; margin-bottom: 20px; }
.diary-title { font-weight: bold; color: #5d4a37; text-transform: uppercase; }
.entry-date { color: #8c7a65; font-style: italic; }

.entry-content {
    height: 500px; /* Adjusted height for better footer clearance */
    color: #2c1e16;
    line-height: 1.6;
    font-size: 1.1rem;
    overflow-y: scroll; 
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.entry-content::-webkit-scrollbar { display: none; }
.text-body { white-space: pre-wrap; margin-bottom: 20px; }

/* --- LINKS --- */
.diary-link { color: #0000FF; text-decoration: underline; word-break: break-word; }
.diary-link:hover { color: #ff0000; }

/* --- IMAGES --- */
.entry-img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 20px auto;
}



/* --- FOOTER & NAV --- */
.page-footer { position: absolute; bottom: 30px; right: 40px; }
.navigation { display: flex; align-items: center; gap: 15px; }
.nav-arrow { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: #5d4a37; }

.page-number-container input { 
    width: 40px; background: transparent; border: 1px solid #d3c7ab; 
    text-align: center; color: #5d4a37; font-family: inherit;
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] { -moz-appearance: textfield; }