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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8f9fa;
    -webkit-text-size-adjust: 100%;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
}

.header {
    text-align: center;
    margin-bottom: 20px;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header a {
    text-decoration: none;
    color: inherit;
}

.support-link {
    display: inline-block;
    background: #38a5ff;
    color: white;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 25px;
    margin-top: 10px;
    font-weight: bold;
    transition: background 0.3s;
    min-height: 44px; /* Touch target */
}

.support-link:hover {
    background: #1675c4;
}

.novel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    max-width: 1200px;
    margin: 0 auto;
}

.novel-card {
    background: white;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 3px 15px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%; /* Ensure equal height cards */
}

.novel-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(0,0,0,0.15);
}

.novel-cover-thumbnail {
    width: 100%;
    height: 250px;
    object-fit: cover;
}

.novel-cover-placeholder {
    width: 100%;
    height: 250px;
    background-color: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 1em;
}

.novel-cover-placeholder span {
    padding: 10px;
}

.novel-details {
    padding: 25px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.novel-title {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 12px;
    color: #2c3e50;
    line-height: 1.1;
}

.novel-title a {
    text-decoration: none;
    color: inherit;
}

.novel-author {
    color: #666;
    font-size: 1em;
    margin-bottom: 10px;
    font-weight: 500;
}

.novel-description {
    color: #555;
    font-size: 0.95em;
    line-height: 1.6;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.novel-details .novel-description {
    -webkit-line-clamp: 3;
}

.novel-info .novel-description {
    text-align: justify;
}

.novel-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.9em;
    color: #666;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
    padding: 15px 0;
    border-top: 1px solid #eee;
}

.continue-reading {
    background: #4CAF50;
    color: white;
    padding: 14px 24px;
    text-decoration: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    transition: background 0.3s;
    margin-top: auto;
}

.continue-reading:hover {
    background: #45a049;
}

/* Novel Detail Page */
.nav {
    margin-bottom: 20px;
}

.nav a {
    color: #4CAF50;
    text-decoration: none;
    font-weight: bold;
    padding: 10px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.novel-header {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.novel-cover-large {
    max-width: 200px;
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.novel-cover-placeholder-large {
    width: 200px;
    height: 280px;
    background-color: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 1em;
}

.novel-cover-placeholder-large span {
    padding: 10px;
}

.novel-description-full {
    color: #555;
    font-size: 1em;
    line-height: 1.6;
    margin-bottom: 15px;
    text-align: left;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.novel-header .novel-title {
    font-size: 1.4em;
    font-weight: bold;
    margin-bottom: 10px;
    color: #2c3e50;
}

.stat {
    text-align: center;
}

.stat-number {
    font-size: 1.5em;
    font-weight: bold;
    color: #4CAF50;
}

.stat-label {
    font-size: 0.9em;
    color: #666;
}

.actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.btn {
    padding: 14px 28px;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: background 0.3s;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: #4CAF50;
    color: white;
}

.btn-primary:hover {
    background: #45a049;
}

.btn-secondary {
    background: #2196F3;
    color: white;
}

.btn-secondary:hover {
    background: #1976D2;
}

.download-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.download-btn {
    padding: 10px 18px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    color: white;
    transition: background-color 0.3s;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.pdf-btn {
    background-color: #dc3545;
}

.pdf-btn:hover {
    background-color: #c82333;
}

.epub-btn {
    background-color: #28a745;
}

.epub-btn:hover {
    background-color: #218838;
}

.chapters-section {
    margin: 2rem 0;
}

.section-title {
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: bold;
}

.chapters-container {
    height: 400px;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow-y: auto;
    padding: 1rem;
    background-color: #f9f9f9;
    -webkit-overflow-scrolling: touch;
}

.chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.5rem;
}

.chapter-link {
    display: block;
    padding: 12px;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    transition: background-color 0.2s;
    font-size: 0.85em;
    line-height: 1.3;
    text-align: left;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.chapter-link:hover {
    background-color: #e9e9e9;
    text-decoration: none;
}

.chapters-container::-webkit-scrollbar {
    width: 12px;
}

.chapters-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.chapters-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.chapters-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.chapter-link.current {
    background: #4CAF50;
    color: white;
    border-color: #43a047;
}

/* Chapter Reading */
.chapter-title {
    font-size: 1.5em;
    font-weight: bold;
    color: #2c3e50;
    line-height: 1.3;
}

.navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0;
    flex-wrap: wrap;
    gap: 15px;
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.nav-btn {
    padding: 12px 24px;
    background: #4CAF50;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: background 0.3s;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.nav-btn:hover {
    background: #45a049;
}

.nav-btn.disabled {
    background: #ccc;
    cursor: not-allowed;
    pointer-events: none;
}

.chapter-select {
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    background: white;
    min-height: 44px;
}

.content {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.chapter-text {
    font-family: San Francisco, -apple-system, sans-serif;
    font-size: 18px;
    line-height: 1.6;
    color: #2c3e50;
    max-width: 700px;
    margin: 0 auto;
    text-align: justify;
    text-justify: auto;
}

.floating-nav {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.floating-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #4CAF50;
    color: white;
    border: none;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: all 0.3s;
}

.floating-btn:hover {
    background: #45a049;
    transform: scale(1.1);
}

.floating-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.support-section {
    text-align: center;
    padding: 25px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-top: 30px;
}

.novel-filter select {
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    min-height: 44px;
    font-size: 16px;
}

.novel-rss {
    margin: 8px 0;
}

.rss-link-small {
    padding: 8px 16px;
    background: #ff6600;
    color: white;
    text-decoration: none;
    border-radius: 3px;
    font-size: 12px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.rss-link-small:hover {
    background: #e55a00;
}

.comments-section {
    margin: 40px 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

.comment-form-container {
    margin-bottom: 30px;
}

.comment-form textarea {
    width: 100%;
    min-height: 100px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    font-family: inherit;
}

.comment-form button {
    background: #007cba;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
}

.comment {
    background: white;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
}

.comment-reply {
    border-left: 3px solid #007cba;
    background: #f8f9fa;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 0.9em;
}

.comment-author {
    font-weight: bold;
    color: #333;
}

.admin-badge {
    background: #dc3545;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
}

.comment-time {
    color: #666;
}

.comment-content {
    margin-bottom: 15px;
    line-height: 1.5;
}

.comment-image img {
    max-width: 300px;
    max-height: 200px;
    border-radius: 4px;
    cursor: pointer;
    margin: 10px 0;
}

.comment-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.comment-actions button {
    background: none;
    border: none;
    color: #007cba;
    cursor: pointer;
    font-size: 0.9em;
    padding: 5px;
}

.comment-actions button:hover {
    text-decoration: underline;
}

.reply-form {
    margin-top: 15px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 4px;
}

.reply-form textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.form-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

.form-actions button {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.form-actions button[type="submit"] {
    background: #007cba;
    color: white;
}

.form-actions button[type="button"] {
    background: #6c757d;
    color: white;
}

.spam-indicator {
    background: #dc3545;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8em;
}

.no-comments {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 40px 20px;
}

.login-prompt {
    text-align: center;
    padding: 20px;
    background: #e7f3ff;
    border-radius: 4px;
    margin-bottom: 20px;
}

.anonymous-fields {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.anonymous-fields input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.anonymous-badge {
    background: #6c757d;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
}

.reply-form .anonymous-fields {
    margin-bottom: 10px;
}

.reply-form .anonymous-fields input {
    width: 100%;
    margin-bottom: 5px;
}

/* Image Modal */
.image-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
}

.image-modal-content {
    display: block;
    margin: auto;
    max-width: 90%;
    max-height: 90%;
    margin-top: 50px;
}

.image-modal-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

img {
	border:1px solid #000;>
}

/* ========================================= */
/* NEW - COMPACT LIST VIEW STYLES           */
/* ========================================= */

.novel-list {
    display: flex;
    flex-direction: column;
    gap: 8px; /* Space between each novel entry */
}

.novel-item {
    display: flex; /* Aligns cover and info side-by-side */
    align-items: top; /* Vertically centers the items */
    padding: 10px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s, transform 0.2s;
}

.novel-item:hover {
    background-color: #f8f9fa;
    transform: translateX(5px);
}

.novel-cover-small {
    width: 75px;     /* Small, consistent width for the cover */
    height: 105px;    /* Maintain aspect ratio */
    object-fit: cover;
    border-radius: 4px;
    margin-right: 15px; /* Space between cover and text */
}

.novel-info {
    flex: 1; /* Allows the info section to take up remaining space */
}

.novel-info .novel-title {
    font-size: 1.1em;
    font-weight: 600;
    margin: 0 0 4px 0; /* Reset margin */
    line-height: 1.3;
}

.novel-info .novel-chapters {
    font-size: 0.9em;
    color: #555;
}

/* Hide the old grid on the library page */
.novel-grid {
    display: none;
}

/* Tablet Responsive */
@media (max-width: 1024px) {
    .container {
        padding: 12px;
    }
    
    .novel-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        gap: 20px;
        padding: 0 10px;
    }
    
    .novel-cover-thumbnail, .novel-cover-placeholder {
        height: 220px;
    }
    
    .novel-details {
        padding: 20px;
    }
    
    .novel-title {
        font-size: 1.3em;
    }
    
    .floating-nav {
        right: 15px;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .container {
        padding: 5px;
    }

	.header {
		margin-bottom: 5px;
		padding: 0 0 1.1em;
	}
	
	.header a {
		display: block;
		margin-bottom: -0.5rem;
	}
	
	.header p {
		line-height: 1;
		margin: 0;
	}
    
    .novel-grid {
        /* This rule forces 3 columns with equal width, even on mobile */
        grid-template-columns: repeat(3, 1fr);
        gap: 15px; /* Adjust gap to your preference */
        padding: 0 5px;
    }
    
    .novel-card {
        /* To make cards smaller */
        min-width: unset;
        max-width: unset;
    }
    
    .novel-cover-thumbnail, .novel-cover-placeholder {
        height: 150px;
    }
    
    .novel-details .novel-description {
		margin-bottom: 5px;
        -webkit-line-clamp: 3;
    }
	
    .chapters-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    
    .chapter-link {
        padding: 10px;
        font-size: 0.8em;
    }
    
    .novel-cover-large {
        max-width: 160px;
    }
    
    .novel-cover-placeholder-large {
        width: 160px;
        height: 220px;
    }
	
	.novel-title {
		font-weight: normal;
        font-size: 0.8em; /* Reduce font size for smaller cards */
		line-height: 1.05;
		margin-bottom: 0px;
		letter-spacing: -0.03em;
    }

    .novel-details .novel-author, .novel-details .novel-description {
        /*font-size: 0.8em; /* Reduce font size */
		width: 0;
		height: 0;
		overflow: hidden;
    }

    .novel-details {
        padding: 5px; /* Reduce internal padding */
    }
    
    .chapter-text {
        font-size: 17px;
    }
    
    .navigation {
        padding: 15px;
        gap: 10px;
    }
    
    .content {
        padding: 20px;
    }
    
    .floating-nav {
        right: 10px;
        bottom: 20px;
        top: auto;
        transform: none;
        flex-direction: row;
    }
    
    .floating-btn {
        width: 50px;
        height: 50px;
        font-size: 16px;
    }
    
    .actions {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
    }
	
	.novel-rss {
		display: none;
	}
	
	.novel-stats {
		font-size: 0.8em;
		margin-bottom: 0;
		gap: 10px;
		padding: 0;
	}
	
	.continue-reading {
		display: none;
	}
	
	.support-section {
		padding: 5px 0 5px 0;
		margin-top: 0px;
	}
	
	.m_hidden {
		display: none;
	}
}

@media (max-width: 480px) {
   .novel-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
        padding: 0 5px;
    }
    
    .novel-card {
        /* To make cards smaller */
        min-width: unset;
        max-width: unset;
    }
    
    .novel-cover-thumbnail, .novel-cover-placeholder {
        /* You can reduce the height of the cover to make the card smaller */
        height: 150px; 
    }
    
    .novel-cover-large {
        max-width: 140px;
    }
    
    .novel-cover-placeholder-large {
        width: 140px;
        height: 190px;
    }
    
    .chapter-text {
        font-size: 16px;
        line-height: 1.5;
    }
    
    .chapters-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .chapter-link {
        padding: 8px;
        min-height: 40px;
    }
    
    .chapters-container {
        height: 300px;
    }
    
    .navigation {
        flex-direction: row;
        gap: 15px;
    }
    
    .nav-btn {
        width: 30%;
        justify-content: center;
    }
    
    .chapter-select {
        width: 30%;
    }
    
    .floating-nav {
        bottom: 10px;
        right: 10px;
        gap: 8px;
    }
    
    .floating-btn {
        width: 44px;
        height: 44px;
        font-size: 14px;
    }
	
	.anonymous-fields {
        flex-direction: column;
        gap: 0;
    }

    .anonymous-fields input {
        width: 100%;
        margin-bottom: 10px; /* Adds space between the fields */
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .novel-cover-thumbnail, .novel-cover-large {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}