* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Base Styles */
html, body {
    height: 100%;
    overflow: auto;
}

body {
    color: #ffffff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

h2 {
    font-size: 1.1em;
}

p {
    font-size: 0.9em;
}

/* Layout - Container */
.container {
    min-width: 370px;
    width: 60%;
    margin: 50px auto;
    padding: 30px;
    background-color: rgba(31, 31, 31, 0.95);
    border-radius: 8px;
    position: relative;
    z-index: 1;
}

/* Manga Header & Cover */
.manga-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
}

.manga-cover-wrapper {
    position: relative;
}

.manga-cover {
    width: 240px;
    min-height: 350px;
    min-width: 40px;
    object-fit: cover;
    border-radius: 8px;
    margin-right: 20px;
    transition: transform 0.6s ease-in-out;
    transform-origin: center;
}

.manga-cover:hover {
    transform: perspective(600px) rotateY(15deg) translateZ(20px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

/* Manga Info */
.manga-info {
    flex-grow: 1;
}

.manga-title {
    font-size: 2.0em;
    margin: 0; /* Optimized: simplified from '0 0 0 0' */
    text-align: left;
}

.manga-details-wrapper {
    margin-top: 5px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    text-align: left;
    max-width: 400px;
}

.info-block {
    display: flex; /* Added display: flex; to make flex-direction effective */
    flex-direction: column;
    border-radius: 8px;
    width: 100%;
    text-align: left;
}

.info-label {
    font-weight: bold;
    color: #ff5e57;
    margin-bottom: 5px;
}

.info-value {
    color: #cccccc;
    margin-top: 5px;
    font-size: 1.3em;
}

.info-value li {
    margin-top: 15px;
    list-style: none;
}

/* Demography */
.demography {
    position: absolute;
    top: 20px;
    right: 9%;
    z-index: 10;
    padding: 8px 20px;
    border-radius: 5px;
    font: bold 1rem 'Poppins', sans-serif; /* Optimized: shorthand for font properties */
    color: white;
    background-color: rgba(0, 0, 0, 0.1);
}

.demography.shounen { background-color: rgba(255, 165, 0, 1); }
.demography.shoujo { background-color: rgba(255, 105, 180, 1); }
.demography.seinen { background-color: rgba(255, 0, 0, 1); }
.demography.josei { background-color: rgba(128, 0, 128, 1); }

/* Manga Type (Manhwa, Manga, Manhua) */
.manga-type {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-weight: bold;
    font-size: 0.8rem;
    padding: 5px 10px;
    border-radius: 5px;
    z-index: 2;
}
.manga-type.manhwa { background-color: #3cb371; }
.manga-type.manga { background-color: #4169e1; }
.manga-type.manhua { background-color: #8b0000; }

/* Genres */
.info-generos {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0.6rem 0;
}

.genero-item {
    padding: 0.5rem 1rem;
    background-color: #2e2f2f;
    color: #fff;
    border-radius: 4px;
    font-weight: 500;
    text-transform: capitalize;
    text-decoration: none;
    /* Optimized: 'display: inline-block;' removed as it's a flex item */
}

/* Synopsis */
.synopsis {
    margin-top: 10px;
    line-height: 1.6;
    font-size: 20px;
    text-align: left;
}

#toggle-synopsis {
    color: white;
    text-decoration: none;
    font-weight: bold;
    cursor: pointer;
}

#toggle-synopsis:hover {
    color: #ffcc00;
}

/* Synopsis text truncation */
#synopsis-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: all 0.3s ease;
}

#toggle-synopsis:checked ~ #synopsis-text {
    -webkit-line-clamp: unset;
}

.toggle-label {
    display: inline-block;
    margin-top: 5px;
    cursor: pointer;
    color: rgb(255 255 255 / 95%);
    font-weight: 700;
}

#toggle-synopsis:not(:checked) ~ .toggle-label::after {
    content: attr(data-show);
}
#toggle-synopsis:checked ~ .toggle-label::after {
    content: attr(data-hide);
}

/* Latest Releases Chapters */
.latest-releases {
    margin: 8px 0;
}

.latest-releases h3 {
    font-size: 1.3em;
    margin-bottom: 15px;
}

.chapter-scroll {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
}

.chapter-scroll::-webkit-scrollbar {
    width: 8px;
}
.chapter-scroll::-webkit-scrollbar-thumb {
    background: #ff5e57;
    border-radius: 10px;
}
.chapter-scroll::-webkit-scrollbar-track {
    background: #2a2a2a;
}

.chapter-card {
    background-color: #2a2a2a;
    padding: 15px 20px;
    border-radius: 8px;
    transition: background-color 0.3s ease, transform 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    position: relative;
}

.chapter-card:hover {
    background-color: #3a3a3a;
    transform: translateY(-5px);
}

.chapter-link {
    text-decoration: none;
    color: inherit;
}

.chapter-title {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 8px;
}

.chapter-date {
    font-size: 0.9em;
    color: #cccccc;
}

.chapter-card.read {
    background-color: #4c4c4c !important;
    color: #ffb347;
}

/* Icons & Indicators */
.estado-indicador {
    display: block;
    width: 5px;
    height: 20px;
    background-color: green;
    margin-top: 5px;
    border-radius: 3px;
}

.favicon-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
}

.circle-red {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: rgb(0, 255, 34); /* Note: color is green despite class name */
    border-radius: 50%;
    margin-right: 5px;
}

/* Bookmark Button */
.bookmark-container {
    margin: 0; /* Optimized: simplified from '0 0' */
    display: flex;
    align-items: center;
    gap: 5px;
}

.bookmark-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: #4169e1;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font: bold 0.9rem sans-serif; /* Optimized: shorthand for font properties */
    transition: background-color 0.3s;
    width: 92%;
    justify-content: center;
}

.bookmark-btn:hover {
    background-color: #1a50b3;
}

.bookmark-btn.active {
    background-color: #28a745;
}

/* Comments & Reactions */
#disqus_thread a {
    color: rgb(6, 0, 27);
}

#load-comments {
    background-color: #343434;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font: bold 20px sans-serif; /* Optimized: shorthand for font properties */
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    margin: 15px 0;
}

#reactions__container {
    margin-top: 50px;
}

/* Manga Links Buttons */
.manga-links a.btn {
    display: inline-block;
    padding: 10px 20px;
    margin: 5px;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.3s, transform 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.manga-links a.btn:hover {
    transform: translateY(-2px);
    opacity: 0.95;
}

.btn-primary {
    background-color: #007bff;
    border: none;
    color: #fff;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-secondary {
    background-color: #6c757d;
    border: none;
    color: #fff;
}

.btn-secondary:hover {
    background-color: #545b62;
}

.chapter-card-full {
    grid-column: 1 / -1; /* hace que se expanda en toda la fila */
    text-align: center;
  }
  
  .btn-ver-mas {
    display: block;
    width: 100%;
    padding: 10px;
    background: #ff5722;
    color: #fff;
    font-weight: bold;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.2s;
  }
  
  .btn-ver-mas:hover {
    background: #e64a19;
  }

/* Responsive Styles */
@media (max-width: 880px) {
    .container {
        width: 97%;
        padding: 17px;
        margin: 4px auto;
    }
    .manga-header {
        text-align: center;
    }
    .manga-cover {
        width: 100%;
        max-width: 380px;
        margin-bottom: 4px;
        min-height: 200px;
    }
    .manga-info {
        width: 97%;
        margin-left: 15px;
    }
    .chapter-scroll {
        grid-template-columns: repeat(2, 1fr);
    }
    .demography {
        top: 0; /* Optimized: removed 'px' */
        right: 0; /* Optimized: removed '%' */
        font-size: 0.9rem;
        padding: 4px 11px;
    }
    .synopsis {
        line-height: 1.3;
    }
    .latest-releases {
        margin: 9px 0;
    }
    .genero-item {
        padding: 0.1rem 0.4rem;
        font-weight: 500;
        font-size: 14px;
    }
    .manga-cover-wrapper {
        width: 60%;
    }
    .manga-title {
        font-size: 1.3em;
    }
    .info-value {
        font-size: 1em;
    }
    #synopsis-text {
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
    }
    .info-value li {
        margin-top: 4px;
    }
}

@media (max-width: 480px) {
    .chapter-scroll {
        grid-template-columns: 1fr;
    }
    .info-block {
        text-align: left;
    }
    .manga-header {
        text-align: center;
    }
    .manga-details-wrapper {
        text-align: center;
        justify-content: center;
    }
    .bookmark-btn {
        width: 100%;
    }
}