:root {
    --sage-green: #8A9A5B;
    --sage-light: #B2AC88;
    --cream: #FAF9F6;
    --charcoal: #36454F;
    --sand: #E6E2D3;
    --alert: #D9534F;

    --font-heading: 'Playfair Display', serif;
    --font-body: 'Outfit', sans-serif;

    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 10px 30px rgba(0, 0, 0, 0.12);
}

/* Midnight Mode Variables */
[data-theme="dark"] {
    --cream: #1a1a1a;
    /* Deep Charcoal Background */
    --charcoal: #E6E2D3;
    /* Sand Text */
    --sage-green: #8A9A5B;
    /* Keep Sage (maybe adjust if needed) */
    --sage-light: #4a5a3b;
    /* Darker accent */
    --sand: #2d2d2d;
    /* Darker secondary */

    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.5);
    --shadow-hover: 0 10px 30px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .book-card {
    background: #242424;
    border: 1px solid #333;
}

[data-theme="dark"] .filter-chip {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--charcoal);
}

[data-theme="dark"] .filter-chip.active {
    background: var(--sage-green);
    color: white;
}

[data-theme="dark"] .modal-content {
    background: #242424;
    color: var(--charcoal);
    border: 1px solid #444;
}

[data-theme="dark"] input,
[data-theme="dark"] textarea {
    background: #1a1a1a;
    border-color: #444;
    color: var(--charcoal);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--cream);
    color: var(--charcoal);
    font-family: var(--font-body);
    line-height: 1.6;
    min-height: 100vh;
}

/* Header */
.header {
    background-color: var(--cream);
    padding: 2rem 1.5rem 1.5rem;
    /* position: sticky;  <-- Removed per user request */
    /* top: 0; */
    z-index: 100;
    border-bottom: 1px solid rgba(54, 69, 79, 0.1);
    /* backdrop-filter: blur(10px); */
    background-color: var(--cream);
}

/* ... existing ... */

/* Mobile Enhancements */
@media screen and (max-width: 768px) {

    /* Prevent iOS Zoom on focus */
    input,
    textarea,
    select {
        font-size: 16px !important;
    }

    .header {
        padding: 1.5rem 1rem 1rem;
        /* Compact header on mobile */
    }
}

h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    color: var(--charcoal);
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
}

/* Action Row & Circular Buttons */
/* Action Row & Circular Buttons */
.action-row {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    /* Increased gap for desktop */
    margin-top: 1rem;
    width: 100%;
    flex-wrap: wrap;
}

/* Mobile: Stack buttons or tighter grid */
@media screen and (max-width: 600px) {
    .action-row {
        gap: 0.8rem;
        /* create a 3 on top, 2 on bot format approx, or just wrap nicely */
        max-width: 300px;
        /* Force wrap */
        margin: 1rem auto;
    }
}

.icon-btn-filled {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background-color: var(--sage-green);
    color: white;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 10px rgba(138, 154, 91, 0.3);
}

.icon-btn-filled svg {
    width: 24px;
    height: 24px;
    stroke: white;
    stroke-width: 2;
}

/* Winner Reveal Card (High Contrast) */
.winner-reveal {
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-width: 90%;
    margin: 0 auto;
    color: var(--charcoal);
    text-align: center;
    border: 1px solid var(--sage-green);
}

body[data-theme='dark'] .winner-reveal {
    background: rgba(30, 30, 30, 0.95);
    color: var(--cream);
    border-color: var(--sage-green);
}

.roulette-spin-text {
    background: rgba(255, 255, 255, 0.9);
    padding: 1rem 2rem;
    border-radius: 50px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

body[data-theme='dark'] .roulette-spin-text {
    background: rgba(30, 30, 30, 0.9);
    color: white;
}

.icon-btn-filled {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background-color: var(--sage-green);
    color: white;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 10px rgba(138, 154, 91, 0.3);
}

.icon-btn-filled:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(138, 154, 91, 0.5);
}

.icon-btn-filled:active {
    transform: scale(0.95);
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 1.2rem;
    width: 100%;
}

.book-count {
    color: var(--sage-green);
    font-weight: 500;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

/* Header Controls */
.header-controls {
    display: flex;
    /* Ensure side-by-side layout */
    justify-content: space-between;
    align-items: flex-start;
    /* Align to top due to wrapper height */
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.search-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 450px;
}

/* Filter Chips (Premium) */
.filter-row {
    display: flex;
    justify-content: center;
    /* Center alignment */
    gap: 0.5rem;
    padding: 0;
    margin-top: 0.8rem;
    /* Space between search and filters */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    order: 2;
    /* Force below search */
}

/* Reading Goal Tracker */
.goal-container {
    order: 3;
    /* Below filters */
    margin-top: 1rem;
    width: 100%;
    padding: 0 0.5rem;
}

.goal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    color: var(--charcoal);
    font-weight: 600;
}

.goal-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.edit-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.edit-btn:hover {
    opacity: 1;
}

.progress-track {
    width: 100%;
    height: 8px;
    background-color: rgba(138, 154, 91, 0.2);
    /* Sage light opacity */
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--sage-green);
    border-radius: 4px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(138, 154, 91, 0.3);
}

.filter-row::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    background: transparent;
    border: 1px solid rgba(138, 154, 91, 0.3);
    /* Subtle border */
    color: var(--charcoal);
    padding: 0.4rem 1rem;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.filter-chip:hover {
    opacity: 1;
    border-color: var(--sage-green);
    background: rgba(138, 154, 91, 0.05);
}

.filter-chip.active {
    background: var(--sage-green);
    color: white;
    border-color: var(--sage-green);
    opacity: 1;
    box-shadow: 0 4px 12px rgba(138, 154, 91, 0.25);
    transform: translateY(-1px);
}

.search-container {
    position: relative;
    width: 100%;
    max-width: 450px;
    display: flex;
    gap: 0.5rem;
}

#search-input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.8rem;
    background-color: var(--cream);
    border: 1px solid var(--sage-light);
    border-radius: 50px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--charcoal);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
    transition: all 0.3s ease;
}

#search-input:focus {
    outline: none;
    border-color: var(--sage-green);
    box-shadow: 0 4px 12px rgba(138, 154, 91, 0.15);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
    transition: color 0.2s ease;
}

#search-input:focus~.search-icon {
    color: var(--sage-green);
}

.header-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .header-controls {
        flex-direction: row;
        gap: 1rem;
    }

    .search-container {
        flex-grow: 1;
        width: auto;
    }
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.primary-btn {
    background-color: var(--sage-green);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-soft);
}

.primary-btn:hover {
    background-color: #7A8B50;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.icon-btn {
    background-color: white;
    border: 1px solid var(--sage-light);
    color: var(--charcoal);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    border-color: var(--sage-green);
    color: var(--sage-green);
}

/* Library Grid */
.library-grid {
    display: grid;
    /* Default Mobile is dealt with in media queries, but lets be safe */
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 2rem;
    padding: 2rem 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
    perspective: 1000px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Book Card */
.book-card {
    background: white;
    border-radius: 4px 12px 12px 4px;
    box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.1), inset 3px 0 2px rgba(255, 255, 255, 0.3);
    transition: transform 0.1s ease-out, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    opacity: 0;
    animation: fadeIn 0.6s ease forwards;
    cursor: pointer;
    transform-style: preserve-3d;
}

.book-card:hover {
    z-index: 10;
    box-shadow: 15px 15px 30px rgba(0, 0, 0, 0.2), inset 3px 0 2px rgba(255, 255, 255, 0.3);
}

.book-card::before {
    content: '';
    position: absolute;
    right: 2px;
    top: 2px;
    bottom: 2px;
    width: 4px;
    background: linear-gradient(to right, #f5f5f5 0%, #e0e0e0 50%, #f5f5f5 100%);
    border-radius: 0 2px 2px 0;
    z-index: 1;
}

/* Updated Cover Wrapper */
.book-cover-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 2/3;
    background-color: var(--sand);
    overflow: hidden;
    border-radius: 2px 10px 0 0;
}

.book-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.book-card:hover .book-cover {
    transform: scale(1.05);
}

/* READ BADGE */
.read-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--sage-green);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 5;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Book Info */
.book-info {
    padding: 1rem;
}

.book-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--charcoal);
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.book-author {
    font-size: 0.85rem;
    color: #666;
}

/* Loading State */
.loading-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4rem 0;
    color: var(--sage-green);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--sage-light);
    border-top-color: var(--sage-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* Modals */
.modal-overlay,
.roulette-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(54, 69, 79, 0.4);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active,
.roulette-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 2.5rem;
    border-radius: 20px;
    max-width: 900px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.5);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.close-modal {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--charcoal);
    line-height: 1;
    z-index: 10;
}

/* JOURNAL STYLES */
.modal-body {
    display: block;
    /* logic simplified */
    width: 100%;
}

/* @media (min-width: 768px) {
    .modal-body {
        grid-template-columns: 300px 1fr; 
    }
} Removed for text-only journal */

.modal-cover {
    width: 100%;
    border-radius: 8px;
    box-shadow: var(--shadow-hover);
}

.journal-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100%;
}

.journal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--sage-light);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.modal-details h2 {
    font-size: 2rem;
    margin-bottom: 0.25rem;
    line-height: 1.1;
}

.modal-author {
    font-size: 1.1rem;
    color: var(--sage-green);
    margin-bottom: 0.5rem;
}

.read-toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--charcoal);
}

.read-toggle-input {
    width: 20px;
    height: 20px;
    accent-color: var(--sage-green);
}

.journal-textarea {
    width: 100%;
    height: 300px;
    padding: 1.5rem;
    border: 1px solid var(--sage-light);
    border-radius: 12px;
    background-color: #FAFAFA;
    font-family: var(--font-body);
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--charcoal);
    resize: none;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
}

.journal-textarea:focus {
    outline: none;
    background-color: white;
    border-color: var(--sage-green);
    box-shadow: 0 0 0 3px rgba(138, 154, 91, 0.1);
}

.save-journal-btn {
    /* No specific alignment needed as it's in flex container now */
}

.journal-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--sage-light);
}

.danger-btn {
    background-color: white;
    border: 1px solid var(--alert);
    color: var(--alert);
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    margin-right: auto;
    /* Pushes other buttons to the right */
    font-family: var(--font-body);
}

.danger-btn:hover {
    background-color: #fff5f5;
    border-color: #c9302c;
    color: #c9302c;
}

.delete-confirm-text {
    font-size: 0.9rem;
    color: var(--charcoal);
    margin-right: 0.5rem;
    font-weight: 600;
}

.delete-confirm-yes {
    background: var(--alert);
    color: white;
    border: none;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    margin-right: 0.5rem;
}

.delete-confirm-no {
    background: none;
    border: 1px solid #ccc;
    color: #666;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.delete-confirm-yes:hover {
    background-color: #c9302c;
}

.delete-confirm-no:hover {
    background-color: #f5f5f5;
}


/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.stat-card {
    background: var(--cream);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--sage-light);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--sage-green);
    font-family: var(--font-heading);
}

/* Roulette */
.roulette-content {
    text-align: center;
    color: var(--charcoal);
    width: 100%;
}

.roulette-card {
    margin: 1.5rem auto;
    width: 100%;
    max-width: 400px;
    height: 250px;
    background: white;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    /* Subtle texture */
    background-image: linear-gradient(to bottom right, #ffffff, #fcfcfc);
}

.roulette-spin-text h3 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: var(--sage-green);
    line-height: 1.2;
}

.winner-info {
    animation: scaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.winner-info h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #999;
    margin-bottom: 0.5rem;
}

.winner-title {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    color: var(--charcoal);
    margin-bottom: 0.5rem;
    line-height: 1.1;
}

.winner-author {
    font-family: var(--font-body);
    color: var(--sage-green);
    font-weight: 500;
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.hidden {
    display: none !important;
}

/* Add Book Form */
.form-content {
    max-width: 500px;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--sage-light);
    border-radius: 8px;
}

.full-width {
    width: 100%;
    justify-content: center;
    margin-top: 1rem;
}

/* DESKTOP GRID */
@media (min-width: 768px) {
    .library-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 3rem;
        max-width: 1200px;
    }
}

/* MOBILE OPTIMIZATIONS */
@media (max-width: 480px) {
    .header {
        padding: 1rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    .header-controls {
        flex-direction: row;
        flex-wrap: wrap;
        width: 100%;
        justify-content: center;
    }

    .search-container {
        width: 100%;
        order: 1;
    }

    .action-buttons {
        width: 100%;
        order: 2;
        justify-content: space-between;
        margin-top: 0.5rem;
    }

    .library-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .book-card {
        flex-direction: column;
        height: 100%;
    }

    .book-cover-wrapper {
        aspect-ratio: 2/3;
        width: 100%;
    }

    .book-info {
        padding: 0.5rem;
        text-align: center;
    }

    .book-title {
        font-size: 0.9rem;
        margin-bottom: 0.2rem;
    }

    .book-author {
        font-size: 0.75rem;
    }

    .modal-content {
        padding: 1.5rem;
        width: 95%;
        max-height: 90vh;
    }

    .modal-body {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .journal-textarea {
        height: 200px;
    }
}

/* Confirmation Modal */
.confirm-modal-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .confirm-modal-content {
    transform: translateY(0);
}

.confirm-modal-content h3 {
    color: var(--charcoal);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.confirm-modal-content p {
    color: #666;
    margin-bottom: 1.5rem;
}

.secondary-btn {
    background-color: transparent;
    border: 1px solid #ccc;
    color: #666;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.secondary-btn:hover {
    border-color: var(--charcoal);
    color: var(--charcoal);
    background-color: #f9f9f9;
}

.confirm-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.confirm-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: var(--font-body);
    transition: transform 0.1s;
}

.confirm-btn:active {
    transform: scale(0.95);
}

.confirm-btn.yes {
    background-color: var(--alert);
    color: white;
}

.confirm-btn.no {
    background-color: #eee;
    color: var(--charcoal);
}

/* Series Badge */
.book-series {
    font-size: 0.75rem;
    color: var(--sage-green);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.2rem;
}

/* Star Rating */
.journal-actions {
    display: flex;
    gap: 0.8rem;
    margin-top: 1.5rem;
}

.journal-actions button {
    flex: 1;
    /* Make all buttons equal width */
    white-space: nowrap;
    /* Prevent text wrapping */
    padding: 0.8rem 0.5rem;
    /* Adjust padding for uniformity */
    display: flex;
    align-items: center;
    justify-content: center;
}

.star-rating {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
    font-size: 1.5rem;
    color: #ddd;
    /* Empty star color */
    cursor: pointer;
}

.star {
    transition: color 0.2s, transform 0.1s;
}

.star.filled {
    color: #FFD700;
    /* Gold */
}

.star:hover {
    transform: scale(1.2);
}

/* Confetti Container */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* Modal Action Buttons - Final Polish */
.journal-actions {
    display: flex;
    gap: 0.8rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.modal-action-btn {
    flex: 1;
    min-width: 120px;
    padding: 0.8rem 1rem;
    border: none;
    border-radius: 8px;
    font-family: var(--font-body);
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: filter 0.2s, transform 0.1s;
    font-size: 0.95rem;
    color: white;
    letter-spacing: 0.02em;
}

.modal-action-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-save {
    background-color: var(--sage-green);
}

.btn-cover {
    background-color: #4A90E2;
}

.btn-delete {
    background-color: #E74C3C;
}

/* Cover Edit Fix */
.cover-edit-mode {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.cover-input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
}

/* Mobile Modal Optimization */
@media screen and (max-width: 600px) {
    .modal-content {
        padding: 1rem;
        /* Tighter padding */
        max-height: 90vh;
        /* Ensure it fits */
        overflow-y: auto;
        width: 95%;
    }

    .book-detail-grid {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.8rem;
        /* Tighter gap */
    }

    .book-cover-large {
        width: 100px;
        /* Even smaller cover for small screens */
        height: 150px;
    }

    .journal-textarea {
        min-height: 60px;
        /* Compact text area */
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }

    /* 
       Hybrid Layout: 
       [Save] [Change]
       [  Remove  ]
    */
    .journal-actions {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-top: 0.5rem;
    }

    .modal-action-btn {
        padding: 0.6rem;
        font-size: 0.85rem;
        flex: 1 1 45%;
        /* Share row */
    }

    /* Force Remove button to own row */
    .btn-delete {
        flex: 1 1 100%;
        order: 3;
        /* Ensure it's last (though HTML order likely handles this) */
    }
}