.chapter_popup {
    /* Initially hidden */
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-vanished-color);
    z-index: 9999;
}
.popup_chap_span {
    display: flex;
    flex-direction: row;
    gap: 4px;
    justify-content: center;
}
.popup_chap_span p {
    margin: 0;
}
.chapter_item p {
    margin: 0;
}

.chapter_popup_container {
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 40vw;
    background: var(--background-color);
    border-radius: 1rem;
    box-shadow: 0 4px 16px var(--shadow-semitransparent-color);
    overflow-y: auto;
    text-align:right;
}


.chapter_list_scroll{
    padding: 0.5rem 2rem 0rem 2rem;
}

/* Close X icon*/
.close_popup {
    display: inline-block;
    margin: 1rem 1rem 0 0;
    cursor: pointer;
    transition: transform 0.3s ease;
    z-index: 10000;
}

/*Animation transition X*/
.close_popup:hover {
    transform: rotate(90deg);
}

/* Scrollable chapter list inside card*/
#chapter_list {
    max-height: 70vh;
    overflow-y: auto;
    text-align:center;
}

/*General card-chapter style*/
.chapter_item {
    margin: 0 8px 0.5rem 8px; /* equal horizontal margins */
    padding: 0.5rem;
    border-radius: 8px;
}

/*Unlocked Chpaters*/
.chapter_item.unlocked {
    background-color: var(--card-color);
    cursor: pointer;
}


/*Locked Chpaters*/
.chapter_item.locked {
    background-color: var(--card-locked-color);
}
.chapter_item.bought {
    background-color: var(--bc_primary);
    opacity: 1;
}
/*Hover General card-chapter*/
.chapter_item:hover {
    box-shadow: 0 0.2rem 0.4rem var(--shadow-semitransparent-color);
    transform: scale(1.03);
    cursor: pointer; 
}

@media( max-width: 768px) {
    .chapter_popup_container {
        width: 360px;
        top: 25%;
        max-width: 90%;
        height: 50%;    
    }
}

/*This is your current chapter*/
.current_chapter{
    transform: scale(0.9);
}

/*Hover Current chapter no animation*/
.current_chapter:hover {
    box-shadow: none !important;
    transform: scale(0.9) !important; 
    cursor: default; 
}

.library_popup {
    display: none; /* JS sets to flex when open */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-vanished-color);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

/* Popup container */
.library_popup_container {
    position: relative;
    width: 90%;
    max-width: 380px;
    background: var(--background-color);
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.22);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}

/* ── Shared popup close button ── */
.popup-close-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    background: var(--soft-card-color);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary-color);
    transition: background-color 0.15s ease, color 0.15s ease;
    z-index: 1;
    flex-shrink: 0;
}
.popup-close-btn:hover {
    background: var(--card-hover-color);
    color: var(--text-color);
}
.popup-close-btn svg {
    display: block;
}

/* Keep legacy ID selector working via the shared class */
#library_close_popup {
    font-size: 0; /* hide text fallback — button now uses SVG */
}

/* Center content inside popup */
.popup_content {
    text-align: center;
    padding: 28px 20px 16px 20px;
    overflow-y: auto;
    flex: 1;
}

/* Nueva lista button */
#create_new_list {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    width: 100%;
    max-width: 280px;
    margin-top: 0;
    border-radius: 10px;
    background: var(--button-color);
    border: none;
    cursor: pointer;
    font-size: var(--font-size-sm);
    letter-spacing: 0.01em;
    transition: background-color 0.2s ease, transform 0.15s ease;
}
#create_new_list:hover {
    background: var(--button-hover-color);
    transform: translateY(-1px);
}

/* Separator line */
.popup_separator {
    width: 100%;
    margin: 16px auto;
    border: none;
    height: 1px;
    background: var(--separator-color);
}

/* Scrollable list section */
/* Parent container that holds all the lists */
.library_list_scroll {
    padding: 0.5rem 1rem;
    max-height: 80vh;       /* adjust to your layout */
    overflow-y: auto;

    /* Reserve scrollbar space so layout doesn’t shift */
    scrollbar-gutter: stable;

    /* Hide scrollbar visually until scrolling */
    scrollbar-width: thin;            /* Firefox */
    scrollbar-color: transparent transparent;
}

.library_list_scroll:hover {
    scrollbar-color: var(--shadow-semitransparent-color) transparent;
}

/* Chrome / Edge / Safari */
.library_list_scroll::-webkit-scrollbar {
    width: 8px;             /* thin scrollbar */
}

.library_list_scroll::-webkit-scrollbar-track {
    background: transparent;
}

.library_list_scroll::-webkit-scrollbar-thumb {
    background-color: transparent;
    border-radius: 10px;
}

.library_list_scroll:hover::-webkit-scrollbar-thumb {
    background-color: var(--shadow-semitransparent-color);
}


/* Each list container */
.list_container {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 6px 0;
    background-color: var(--soft-card-color);
    border: 1px solid var(--separator-color);
    transition: background-color 0.15s ease, border-color 0.15s ease;
    cursor: pointer;
}

.list_container:hover {
    background-color: var(--card-hover-color);
    border-color: var(--button-color);
}

.list_container p {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.list_container .list_name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: break-word;
    text-align: left;
    align-self: flex-start;
    margin-right: 10px;
}

/* Form hidden state */
.popup_content form {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    margin-top: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;

    transform: scale(0.8); /* Start smaller */
    transform-origin: top center; /* Makes it come from the top */
    transition: opacity 0.4s ease, max-height 0.4s ease, transform 0.4s ease;
}

/* Form visible state (add 'show' class via JS) */
.popup_content form.show {
    opacity: 1;
    max-height: 200px;
    margin-top: 1rem;

    transform: scale(1); /* Zoom to normal size */
}
/* Input styling */
.popup_content form input[type="text"] {
    padding: 0.6rem;
    width: 80%;
    max-width: 250px;
    border: 2px solid var(--button-color);
    text-align: center;
    border-radius: 10px;;
    background: var(--background-light-color);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Submit button */
.popup_content form button {
    padding: 0.5rem 1.2rem;
    background-color: var(--button-color);
    color: var(--text-white-color); 
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.popup_content form button:hover {
    background-color: var(--button-hover-color);
}

/* Hide scrollbar until scrolling (Chapter Popup List) */
#chapter_list {
  max-height: 70vh;
  overflow-y: auto;
  text-align: center;

  /* Keep layout stable */
  scrollbar-gutter: stable;

  /* Firefox */
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

/* When the user hovers or scrolls */
#chapter_list:hover,
#chapter_list:active,
#chapter_list:focus-within {
  scrollbar-color: var(--shadow-semitransparent-color) transparent;
}

/* Chrome, Edge, Safari */
#chapter_list::-webkit-scrollbar {
  width: 8px;
}

#chapter_list::-webkit-scrollbar-track {
  background: transparent;
}

#chapter_list::-webkit-scrollbar-thumb {
  background-color: transparent;
  border-radius: 8px;
  transition: background-color 0.3s ease;
}

/* Show scrollbar only on hover or scroll */
#chapter_list:hover::-webkit-scrollbar-thumb,
#chapter_list:active::-webkit-scrollbar-thumb,
#chapter_list:focus-within::-webkit-scrollbar-thumb {
  background-color: var(--shadow-semitransparent-color);
}

@media (max-width: 768px) {
  .library_popup_container {
    width: 95%;
    max-width: none;
    border-radius: 12px;
    max-height: 85vh;
  }

  #create_new_list {
    width: 90%; /* Shrink button to fit smaller screen */
    max-width: 300px;
  }

  .popup_content {
    padding: 1.5rem 1rem 1rem 1rem; /* Reduce padding */
  }

  .list_container {
    flex-direction: column; /* Stack items vertically */
    align-items: center;
    margin: 10px 16px;
    padding: 0.75rem;
  }
    
  .list_container p{
      margin: 0;
  }
    
  .popup_content form input[type="text"] {
    width: 90%;
    max-width: 100%;
  }
}
 /*Review title container*/
#title_review {
    display: flex;
    justify-content: space-between;
    align-items: center; /* Optional: vertically align */
}
.reviewForm{
    display: none;
}
/*Sapcing for labels a*/
#title_review p{
    margin: 0;
}
.hor_top_part {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
}
/*General layout right buttons reviews*/
.handle_review a {
    text-decoration: none;
}

/*Padding reviews*/
#reviews {
    display: flex;
    flex-direction: column;
}
.low_part_span{
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}
/*indivdual review container*/
.review-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.2s ease;
    margin-bottom: 26px;
}

/*User container avatr + nick*/
.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

/*user avatar*/
.user-info img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.review_body{
    padding: 12px 16px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--card-color);
}
/*User nickname*/
.name p {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

/*Container title + rating*/
.title-rating {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/*Title fo the review*/
.title-rating .title {
    font-size: 1.1rem;
    font-weight: 700;
}


/*Users rating starts layout*/
.rating {
  display: inline-flex;
  gap: 3px;
}

/*Date of the review*/
.date {
    margin-top: auto;
    text-align: right;
}

/* ── Toggle button: write / edit review ── */
.handle_review a:hover {
    filter: brightness(0.88);
    transform: scale(1.08);
}

/* ── Review form card ── */
.review_form {
    width: 100%;
    text-align: left;
    border: none;
    border-top: 2px solid var(--orange-accent);
    background: var(--card-color);
    padding: 24px 20px 20px;
    border-radius: 0 0 12px 12px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Hide HRs — spacing handled by flex gap */
#reviewForm hr {
    display: none;
}

/* Remove per-field bottom margin — gap handles spacing */
.review_content {
    margin-bottom: 0;
}

/* Star rating: compact, left-aligned */
.rating_container {
    display: flex;
    align-items: center;
    width: 100%;
    height: auto;
    margin: 0;
    justify-content: flex-start;
    gap: 14px;
    flex-wrap: wrap;
}

.star-rating {
    display: flex;
    flex-direction: row-reverse;
    font-size: 36px;
    gap: 3px;
}

.star-rating input[type="radio"] {
    display: none;
}

.star-rating label {
    cursor: pointer;
    transition: color 0.15s ease;
}

.star-rating label::before {
    content: '★';
    color: var(--separator-color);
}

.star-rating label:hover::before,
.star-rating label:hover ~ label::before {
    content: '★';
    color: var(--orange-accent);
    opacity: 0.7;
}

.star-rating input[type="radio"]:checked ~ label::before {
    content: '★';
    color: var(--orange-accent);
    opacity: 1;
}

/* Inputs: bottom-border only, left-aligned, serif title */
.review_form input,
.review_form textarea {
    box-sizing: border-box;
}

.review_form input[type="text"] {
    font-family: var(--font-family-serif, 'Literata', Georgia, serif);
    font-size: 1.05rem;
    font-weight: 600;
    width: 100%;
    padding: 6px 0;
    border: none;
    border-bottom: 1.5px solid var(--separator-color);
    border-radius: 0;
    background: transparent;
    text-align: left;
    color: var(--text-color);
    transition: border-color 0.2s ease;
}

.review_form input[type="text"]:focus {
    outline: none;
    border-bottom-color: var(--orange-accent);
    box-shadow: none;
}

.review_form textarea {
    width: 100%;
    padding: 6px 0;
    border: none;
    border-bottom: 1.5px solid var(--separator-color);
    border-radius: 0;
    background: transparent;
    text-align: left;
    resize: none;
    min-height: 96px;
    max-height: 200px;
    overflow-y: auto;
    font-size: var(--font-size-sm);
    line-height: 1.65;
    color: var(--text-color);
    transition: border-color 0.2s ease;
}

.review_form textarea:focus {
    outline: none;
    border-bottom-color: var(--orange-accent);
    box-shadow: none;
}

/* Spoiler row: styled as a settings item */
.spoiler_title {
    padding: 10px 14px;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
    background: var(--soft-card-color);
    border-radius: 8px;
    border: 1px solid var(--separator-color);
}

.spoiler_title > label:first-child {
    font-size: var(--font-size-sm);
    color: var(--text-secondary-color);
    font-weight: var(--font-weight-medium);
    margin: 0;
    cursor: pointer;
}

/* Submit button: full-width, prominent */
.review_form button[type="submit"] {
    width: 100%;
    margin: 4px 0 0;
    padding: 12px;
    background-color: var(--orange-accent);
    color: var(--text-white-color);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: 600;
    letter-spacing: 0.03em;
    transition: filter 0.15s ease, transform 0.15s ease;
}

.review_form button[type="submit"]:hover {
    filter: brightness(0.88);
    transform: translateY(-1px);
}

/* Feedback message */
#reviewMessage {
    text-align: center;
    margin: 0;
    font-size: var(--font-size-xs, 0.75rem);
    min-height: 1.2em;
}

/* Global HR (outside form) */
hr {
  border: none;
  height: 1px;
  width: 100%;
  background-color: var(--separator-color);
  margin: 24px 0;
}


@media(max-width: 768px) {
    #reviews {
        flex-direction: row;
        overflow-x: scroll;
        padding: 0px;
    }
    .reviews-popup-content {
        width: 100%;
        margin: 0px 24px;
    }
    .star-rating {
        font-size: 30px;
        gap: 2px;
    }
    .review-card{
        flex-shrink: 0;
        width: 330px;
        height: 185px;
        margin-right: 16px;
        border-bottom: none;
        margin-bottom: 0px;
        overflow: hidden;
        padding-bottom: 0px;
    }
    .review_body{
        height: 140px;
    }
    .reviewForm{
        max-width: 100%;
    }
}

.switch {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    width: 40px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: var(--separator-color);
    border-radius: 99px;
    transition: background-color 0.2s ease;
}

.slider:before {
    position: absolute;
    content: "";
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}

input:checked + .slider {
    background-color: var(--orange-accent);
}

input:checked + .slider:before {
    transform: translateX(18px);
  }
    .blurred {
    filter: blur(3px);
    position: relative;
    cursor: pointer;
  }

  .spoiler-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.7);
    color: white;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    text-align: center;
    padding: 10px;
    border-radius: 6px;
  }

  .review-text {
    position: relative;
    transition: filter 0.3s ease;
  }
  .current-user-review .review_body{
    background-color: var(--soft-card-color);
    border: 1px solid var(--button-color);
    border-radius: 8px;
  }

  @media (min-width: 768px) {
    hr {
        margin: 26px 0;
        margin-right: 80px;
        width: calc(100% - 80px);
    }
}
/* ===== REVIEWS POPUP ===== */
.reviews-popup {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.55);
    display: flex; justify-content: center; align-items: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.reviews-popup-content {
    max-height: 88vh;
    width: min(800px, 95vw);
    box-sizing: border-box;
    background: var(--background-color);
    border-radius: 20px;
    display: flex; flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0,0,0,0.25);
}

/* Sticky header */
.reviews-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px 14px;
    border-bottom: 1px solid var(--separator-color);
    flex-shrink: 0;
}

.reviews-popup-title {
    font-size: var(--font-size-md-lg);
    font-weight: var(--font-weight-semibold);
}

/* reviews popup close — extends .popup-close-btn, positioned inside header flow */
.reviews-popup-close-btn {
    position: static;
    background: var(--soft-card-color);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--text-secondary-color);
    transition: background-color 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}

.reviews-popup-close-btn:hover {
    background: var(--card-hover-color);
    color: var(--text-color);
}

.reviews-popup-close-btn svg {
    display: block;
}

/* Top stats section */
.reviews-popup-top {
    display: flex;
    gap: 32px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--separator-color);
    flex-shrink: 0;
    align-items: center;
}

.reviews-popup-left {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 90px;
}

.big-star {
    font-size: 44px;
    color: var(--orange-accent);
    line-height: 1;
}

.reviews-popup-left .rating-number {
    font-size: 2rem;
    font-weight: var(--font-weight-semibold);
    line-height: 1.1;
}

.reviews-popup-left .rating-total {
    font-size: var(--font-size-xs, 0.75rem);
    color: var(--text-secondary-color);
    margin-top: 2px;
}

.reviews-popup-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.rating-row {
    display: flex;
    align-items: center;
    cursor: pointer;
    border-radius: 6px;
    padding: 3px 6px;
    transition: background-color 0.12s ease;
}

.rating-row:hover {
    background: var(--soft-card-color);
}

.rating-label {
    width: 28px;
    font-size: var(--font-size-sm);
    color: var(--text-secondary-color);
    font-weight: var(--font-weight-medium);
}

.rating-bar {
    flex: 1;
    background: var(--soft-card-color);
    height: 7px;
    margin: 0 10px;
    position: relative;
    border-radius: 99px;
    overflow: hidden;
}

.rating-bar > div {
    background: var(--orange-accent);
    height: 100%;
    border-radius: 99px;
}

.rating-count {
    min-width: 24px;
    text-align: right;
    font-size: var(--font-size-sm);
    color: var(--text-secondary-color);
}

.rating-row.active-rating {
    background: var(--orange-accent-soft);
    outline: 1px solid var(--orange-accent-border);
}

/* Bottom section: review list */
.reviews-popup-bottom {
    flex: 1;
    overflow-y: auto;
    padding: 16px 28px 20px;
}

/* Popup review card */
.review-card-popup {
    display: flex;
    gap: 12px;
    flex-direction: column;
    padding: 14px 0;
}

.top-review-part {
    display: flex;
    gap: 10px;
    align-items: center;
}

.review-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.review-header {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    gap: 1px;
    overflow: hidden;
}

.review-header:hover .review-author-name {
    color: var(--button-color);
}

.review-author-name {
    transition: color 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.review-content {
    margin-left: 0;
    margin-top: 0;
    flex: 1;
}

/* ── Review card (popup + inline) ── */
.review-card-popup {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 0;
}

.top-review-part {
    display: flex;
    gap: 10px;
    align-items: center;
}

.review_body_details {
    padding: 14px 16px;
    border-radius: 10px;
    background: var(--card-color);
    box-sizing: border-box;
}

.review-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

/* Stars: larger, orange fill / muted empty */
.review-stars {
    display: inline-flex;
    gap: 2px;
    font-size: 17px;
    line-height: 1;
}

.review-stars .star-filled {
    color: var(--orange-accent);
}

.review-stars .star-empty {
    color: var(--separator-color);
}

/* Review title — serif font for editorial feel */
.review-card-title {
    font-family: var(--font-family-serif, 'Literata', Georgia, serif);
    font-size: var(--font-size-md);
    font-weight: 600;
    line-height: 1.25;
    margin: 0 0 6px 0;
}

/* Review body text — truncated with read-more */
.review-text-body {
    font-size: var(--font-size-sm);
    line-height: 1.55;
    position: relative;
    max-height: 4.8em;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.review-text-body.expanded {
    max-height: 400px;
}

.review-text-body:not(.expanded)::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2.4em;
    background: linear-gradient(to bottom, transparent, var(--card-color));
    pointer-events: none;
}

/* When review body is the lighter current-user card, match gradient */
.current-user-review .review_body .review-text-body:not(.expanded)::after {
    background: linear-gradient(to bottom, transparent, var(--soft-card-color));
}

.review-read-more {
    display: inline-block;
    margin-top: 4px;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--orange-accent);
    cursor: pointer;
    user-select: none;
}

.review-read-more:hover {
    filter: brightness(0.85);
}


/* Clickable review cards in popup */
.review-card-popup {
    cursor: pointer;
}
.review-card-popup:hover .review_body_details {
    background: var(--soft-card-color);
    transition: background-color 0.15s ease;
}

/* ===== SINGLE REVIEW DETAIL POPUP ===== */
.single-review-popup {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    display: flex; justify-content: center; align-items: center;
    z-index: 10001;
    backdrop-filter: blur(3px);
}

.single-review-content {
    position: relative;
    width: min(560px, 92vw);
    max-height: 80vh;
    overflow-y: auto;
    background: var(--background-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.28);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.single-review-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.single-review-author {
    display: flex;
    gap: 10px;
    align-items: center;
    cursor: pointer;
    min-width: 0;
    max-width: 90%;
}

.single-review-author:hover .review-author-name {
    color: var(--button-color);
}

.single-review-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.single-review-title {
    font-family: var(--font-family-serif, 'Literata', Georgia, serif);
    font-size: var(--font-size-lg, 1.15rem);
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
}

.single-review-body {
    font-size: var(--font-size-sm);
    line-height: 1.65;
    color: var(--text-secondary-color);
    white-space: pre-line;
}

@media (max-width: 768px) {
    .reviews-popup-content {
        max-height: 92vh;
        border-radius: 16px;
    }
    .reviews-popup-header, .reviews-popup-top, .reviews-popup-bottom {
        padding-left: 16px;
        padding-right: 16px;
    }
    .reviews-popup-top {
        gap: 16px;
    }
    .reviews-popup-left {
        min-width: 70px;
    }
    .big-star {
        font-size: 34px;
    }
    .reviews-popup-left .rating-number {
        font-size: 1.5rem;
    }
    .review-avatar {
        width: 36px;
        height: 36px;
    }
}
/* Novel container remains unchanged */
.novel {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  padding: 1rem;
  gap: 1rem;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  border-bottom: 1px solid var(--separator-color);
}

.novel:last-child {
  border-bottom: none;
}

/*Move card of similar novels - desktop uses bg highlight instead of float*/
.novel:hover {
  background: var(--card-hover-color);
}

/* Right info: text + image */
.novel-right-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
}
.novel-rating{
  margin: 0;
  margin-top: 4px;
}
.chap_span, .auth_span {
  gap: 4px;
  display: flex;
  flex-direction: row;
}
/* Main info box */
.novel-info {
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* Distribute title top, author/status bottom */
  max-width: 140px;
  height: 120px; /* Match image height */
  margin-right: auto;
  gap: 4px;
}

/* Novel title at the top */
.novel-title {
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;     /* Show up to 2 lines */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Author and status at the bottom */
.novel-bottom {
  display: flex;
  flex-direction: column;
  margin-top: auto;
  gap: 12px;
  justify-content: space-between;
}

/* Author and status styling */
.novel-author,
.novel-status {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Cover image */
.novel-cover {
  height: 120px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 5px;
  flex-shrink: 0;
  box-shadow: 0 3px 6px var(--shadow-semitransparent-color), 0 6px 12px var(--shadow-semitransparent-color);
}

/* Desktop: tighten font scale to match home page novel cards */
.similar_nov_layout .novel-title {
  font-size: var(--font-size-sm);
  line-height: 1.2;
  font-weight: var(--font-weight-semibold);
  -webkit-line-clamp: 2;
}

.similar_nov_layout .novel-author,
.similar_nov_layout .novel-rating,
.similar_nov_layout .novel-status,
.similar_nov_layout .novel-chapters {
  font-size: var(--font-size-xs, 0.72rem);
  line-height: 1.3;
}
.chap_span p {
    margin: 0px;
}

@media (max-width: 768px) {
  /* Mobile: each card is a column (cover on top, title below) — matches home scroll style */
  .novel {
    flex-direction: column;
    gap: 8px;
    padding: 0;
    border-bottom: none;
    width: 100px;
    flex-shrink: 0;
    align-items: flex-start;
    background: transparent;
  }
  .novel:hover {
    background: transparent;
  }
  .novel-cover {
    width: 100px;
    aspect-ratio: 2 / 3;
    height: auto;
    border-radius: 8px;
  }
  .novel-rating, .novel-status, .chap_span, .novel-bottom {
    display: none;
  }
  .similar_nov_layout {
    white-space: unset;
  }
  .novel-title {
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    max-width: 100px;
  }
  .auth_span {
    white-space: nowrap;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .novel-info {
    height: auto;
    max-width: 100px;
    justify-content: flex-start;
  }
  .novel-right-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}