:root {
    --screen-bg: #fffbf0; 
    --header-bg: #ffffff;
    --accent-pink: #ffc1e3;
    --text-main: #333;
}

* { box-sizing: border-box; }

body {
    background-color: #f7f7f7; 
    background-image: linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5)), url('https://file.garden/aXUfWdPgtglShqRb/backgorund/1.png');
    min-height: 100vh;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start; 
    padding-top: 20px;       
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* --- SCENE CONTAINER --- */
.scene-container {
    position: relative;
    display: flex; justify-content: center;
}

/* --- THE DEVICE CONTAINER (Smaller) --- */
.kindle-device {
    position: relative;
    width: 300px;
    height: auto;
    filter: drop-shadow(0 15px 30px rgba(0,0,0,0.2));
}

/* The Base Image */
.device-bg {
    width: 100%;
    height: auto;
    display: block;
}

/* --- THE SCREEN OVERLAY --- */
.screen-overlay {
    position: absolute;
   
    top: 5.4%;      
    left: 7.4%;     
    width: 84.9%;      
    height: 80%;     
    
    background-color: var(--screen-bg);
    box-shadow: inset 2px 2px 5px rgba(0,0,0,0.1); 
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* --- Status Bar --- */
.status-bar {
    background: white;
    padding: 3px 5px;
    font-size: 7px; /* Smaller font */
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid #eee;
    color: #444; font-weight: bold;
}
.status-icons { display: flex; gap: 3px; }

/* --- App Header --- */
header {
    background-color: var(--header-bg);
    padding: 4px 6px;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid #eee;
}

.logo { font-size: 0.7rem; font-weight: 600; color: var(--text-main); }
.icon-btn { background: none; border: none; font-size: 0.7rem; color: #444; cursor: pointer; }

/* --- Controls --- */
.controls { padding: 4px 6px; background: white; border-bottom: 1px solid #eee; }

.search-bar {
    background: #f4f4f4;
    border-radius: 3px;
    padding: 2px 5px;
    display: flex; align-items: center;
    margin-bottom: 4px; border: 1px solid #ddd;
}
.search-bar i { color: #888; font-size: 0.5rem; margin-right: 4px; }
.search-bar input { border: none; background: transparent; width: 100%; outline: none; font-size: 0.6rem; }

.filter-row { display: flex; gap: 3px; }
.filter-row select {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 2px;
    padding: 1px;
    font-size: 0.55rem;
    color: #333;
    flex: 1;
}

/* --- Library Grid --- */
.library-grid {
    padding: 6px;
    display: grid;
   
    grid-template-columns: repeat(auto-fill, minmax(55px, 1fr)); 
    gap: 6px; 
    overflow-y: auto; 
    flex-grow: 0;
}
.library-grid::-webkit-scrollbar { width: 3px; }
.library-grid::-webkit-scrollbar-thumb { background-color: #ccc; border-radius: 2px; }

.book-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 2px;
    display: flex; flex-direction: column;
    position: relative; overflow:visible;
    transition: transform 0.1s;
}
.book-card:hover { transform: translateY(-1px); border-color: #999; }

.book-cover-container {
    height: 75px; /* Smaller covers */
    background: #f0f0f0;
    position: relative;
}
.book-cover { 
    width: 100%; height: 100%; object-fit: cover; 
    filter: grayscale(100%) contrast(1.1); 
    transition: filter 0.2s;
}
.book-card:hover .book-cover { filter: grayscale(0%); }

.book-info { padding: 3px; }
.book-title {
    font-size: 0.5rem; margin: 0; font-weight: 600; color: #000;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2;
}
.book-author { font-size: 0.45rem; color: #555; margin-bottom: 1px; }
.rating { font-size: 0.45rem; color: #444; letter-spacing: -1px;}

.delete-btn {
    position: absolute; top: 2px; right: 2px;
    background: white; color: #000;
    border: 1px solid #000; border-radius: 50%; width: 12px; height: 12px;
    font-size: 7px; display: none; align-items: center; justify-content: center;
    cursor: pointer; z-index: 5;
}
.book-card:hover .delete-btn { display: flex; }

/* --- Modal --- */
.modal {
    display: none;
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); justify-content: center; align-items: center; z-index: 100;
    backdrop-filter: blur(2px);
}
.modal-content {
    background: white; width: 240px; padding: 12px; border-radius: 4px; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.2); border: 1px solid #ccc;
}
.modal-header { display: flex; justify-content: space-between; margin-bottom: 8px; }
.modal-header h2 { font-size: 0.9rem; margin: 0; }
.close-modal { cursor: pointer; font-size: 1.1rem; }

form input, form select {
    width: 100%; padding: 4px; margin-bottom: 5px;
    border: 1px solid #ccc; border-radius: 2px; font-size: 0.7rem;
}
.primary-btn {
    width: 100%; padding: 5px; background: #333;
    color: white; border: none; border-radius: 2px;
    font-size: 0.75rem; cursor: pointer; font-weight: bold; margin-top: 4px;
}