/* Owned books include chapter tables: keep each card within the available column. */
.owned-library.content {
    min-width: 0;
    max-width: 100%;
    padding: 0;
    box-shadow: none;
}
.owned-library .books-list {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
}
.owned-library .book-row {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    align-items: start;
    min-width: 0;
    gap: 20px;
    text-align: left;
}
.owned-library .book-info {
    min-width: 0;
    width: 100%;
    align-items: stretch;
    overflow-wrap: anywhere;
}
.owned-library .book-title-row { justify-content: flex-start; }
.owned-library .book-actions { flex-wrap: wrap; }
.owned-library .book-details {
    grid-column: 1 / -1;
    min-width: 0;
    max-width: 100%;
    margin-top: 0;
    overflow-wrap: break-word;
}
.owned-library .book-chapters-scroll {
    max-width: 100%;
    overflow-x: auto;
}
.owned-library .book-chapters-scroll:focus-visible {
    outline: 2px solid #0b777b;
    outline-offset: 3px;
}
.owned-library .book-details input[type="button"],
.owned-library .book-details button {
    max-width: 100%;
    white-space: normal;
}
@media (max-width: 640px) {
    .owned-library .book-row { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .owned-library .book-cover-link { justify-self: center; }
}

h1.txt,
h3.txt {
    color: #0fa6ab;
    font-size: 24px !important;
    font-weight: 500 !important;
}
.my-library__filter-container {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
}
div.intro,
div.intro * {
    font-size: 16px !important;
    color: #000;
}
.books-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 36px 48px;
    margin-top: 24px;
}
.book-row {
    display: flex;
    align-items: flex-start;
    gap: 28px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.07);
    padding: 18px;
}
.book-cover {
    width: 120px;
    height: 180px;
    border-radius: 5px;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}
.book-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 2px;
    flex-grow: 1;
}
.book-title {
    font-size: 18px;
    font-weight: 700;
    color: #111;
    line-height: 1.3;
}
.book-title a {
    color: inherit;
    text-decoration: none;
}
.book-author {
    font-size: 15px;
    color: #888;
    font-weight: 500;
}
.book-author a {
    color: inherit;
    text-decoration: none;
}
.book-part {
    font-size: 14px;
    color: #555;
    font-weight: 400;
    margin-top: auto;
    padding-top: 8px;
}
.book-actions {
    display: flex;
    gap: 16px;
    margin-top: 12px;
}
.btn-blue {
    text-decoration: none;
    text-align: center;
    color: #fff;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.15s;
    background: #0fa6ab;
    box-shadow: 0 1px 14px 2px rgba(15, 166, 171, 0.18);
}
.btn-blue:hover {
    background: #0c8c91;
}
/* ========================
 * Стили для подборок
 * ======================== */
a:has(.podborka-item) {
    text-decoration: none;
}

.podborka-item {
    background: #fff !important;
    padding: 40px 30px;
    border: none !important;
    border-radius: 0 !important;
    border-bottom: 1px solid rgba(0,0,0,0.314) !important;
}

.podborka-item .itemname {
    font-size: 20px;
    font-weight: 400;
    color: #000;
}

.podborka-item p.j {
    color: #777;
    font-weight: 400;
    font-size: 16px;
}

.podborka-item .gray {
    color: #000;
    font-weight: 400;
    font-size: 16px;
}

/* ========================
 * Стили для закладок
 * ======================== */
.zakladki-item {
    border: none !important;
    border-radius: 0 !important;
    border-top: 1px solid rgba(0,0,0,0.314) !important;
    padding: 25px 20px !important;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.zakladki-item .mybm {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.zakladki-item .mybm > h4 {
    font-size: 18px;
    font-weight: 500;
    margin: 0 !important;
}

.new-book-by-favorite-authors p,
.zakladki-item .mybm > p {
    margin: 0 !important;
}

.zakladki-item .tt2 {
    font-size: 16px !important;
    color: #000 !important;
}

.zakladki-item__row {
    display: flex;
    flex-direction: row;
    gap: 20px;
    align-items: center;
}

/* ========================
 * Стили для кнопок и таблиц
 * ======================== */
.btn-orange {
    padding: 7px 10px;
    color: #fff !important;
    text-decoration: none !important;
    background: #f58b28;
    border-radius: 10px;
    font-size: 14px;
}

.btn-orange:hover {
    cursor: pointer;
    opacity: .8;
    transition: .2s;
}

.new-table {
    border-collapse: collapse;
    border: none !important;
    background: transparent !important;
}

.new-table td,
.new-table th {
    margin: 4px !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 8px 10px !important;
}

.new-table th {
    background: #0fa6ab !important;
    color: #fff !important;
    font-size: 18px !important;
    font-weight: 500 !important;
}

.new-table td {
    background: #fff !important;
    color: #000 !important;
    font-weight: 400 !important;
    font-size: 16px !important;
    box-shadow: 0 0 10px rgba(0, 0, 0, .1);
}

/* ========================
 * Стили для новинок от авторов
 * ======================== */
.new-book-by-favorite-authors {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px 30px;
    min-width: 0;
}
.new-book-by-favorite-authors .bookname {
    line-height: 1.4;
    margin: 0 0 6px;
    word-break: break-word;
    overflow-wrap: anywhere;
}
.new-book-by-favorite-authors .bookname a {
    line-height: inherit;
    display: block;
    white-space: normal;
}
.new-book-by-favorite-authors .btn {
    width: 100%;
    max-width: 280px;
    text-align: center;
}
.new-book-by-favorite-authors-wrapper {
    display: flex;
    flex-direction: row;
    gap: 15px;
    border-top: 1px solid #000;
    justify-items: stretch;
    align-items: flex-start;
    min-width: 0;
}
.new-book-by-favorite-authors-wrapper picture,
.new-book-by-favorite-authors-wrapper > img {
    flex-shrink: 0;
    width: 140px;
    height: 210px;
    margin: .6rem;
    border-radius: 6px;
    overflow: hidden;
    display: block;
}
.new-book-by-favorite-authors-wrapper picture img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ========================
 * Стили для целей чтения (прогресс-бар)
 * ======================== */
.circular-progress {
    --size: 250px;
    --half-size: calc(var(--size) / 2);
    --stroke-width: 20px;
    --radius: calc((var(--size) - var(--stroke-width)) / 2);
    --circumference: calc(var(--radius) * pi * 2);
    --dash: calc((var(--progress) * var(--circumference)) / 100);
    animation: 5s linear forwards progress-animation;
}

.new-library-target-big,
.new-library-target__small {
    padding: 15px;
    box-sizing: border-box;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, .1);
}

.circular-progress circle {
    cx: var(--half-size);
    cy: var(--half-size);
    r: var(--radius);
    stroke-width: var(--stroke-width);
    fill: none;
    stroke-linecap: round;
}

.circular-progress circle.bg {
    stroke: #ddd;
}

.circular-progress circle.fg {
    transform: rotate(-90deg);
    transform-origin: var(--half-size) var(--half-size);
    stroke-dasharray: var(--dash) calc(var(--circumference) - var(--dash));
    transition: stroke-dasharray .3s linear;
    stroke: #0fa6ab;
}

@property --progress {
    syntax: "<number>";
    inherits: false;
    initial-value: 0;
}

@keyframes progress-animation {
    from { --progress: 0 }
    to { --progress: 100 }
}

.new-library-target {
    display: flex;
    flex-direction: row;
    gap: 20px;
    justify-content: space-between;
    box-sizing: border-box;
    max-width: 100vw;
}

.new-library-target-big {
    display: flex;
    flex-direction: column;
    gap: 20px;
    justify-content: space-between;
    margin-top: 1rem;
}

.new-library-target__small {
    width: 50%;
}

.new-library-target__today {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
}

.new-library-target__column,
.new-library-target__column > form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.new-library-target__column > h3 {
    margin: 0;
}

.new-library-target__column > p {
    color: #777;
    font-weight: 400;
    font-size: 14px;
}

/* ========================
 * Медиа-запросы (адаптивность)
 * ======================== */
@media (max-width: 1199px) {
    .books-list {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 800px) {
    .book-row {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .book-info {
        width: 100%;
    }
    .book-actions {
        flex-direction: column;
        width: 100%;
    }
    .btn-blue {
        width: 100%;
        box-sizing: border-box;
    }
}
@media screen and (max-width: 600px) {
    .new-book-by-favorite-authors-wrapper picture,
    .new-book-by-favorite-authors-wrapper > img {
        width: 110px;
        height: 165px;
    }
    .new-book-by-favorite-authors {
        padding-left: 0;
    }
    .new-book-by-favorite-authors .btn {
        width: 100% !important;
        max-width: 100%;
    }
    .new-table td,
    .new-table th {
        font-size: 14px !important;
        margin: 1px !important;
    }
    .new-library-target {
        flex-direction: column;
    }
    .new-library-target-big,
    .new-library-target__small {
        width: 90%;
    }
    .zakladki-item .mybm {
        justify-content: center;
        align-items: center;
        margin: 0 auto;
    }
}

.my-library__grid .book-card-mini .toptile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 !important;
    box-shadow: none !important;
    box-sizing: border-box;
}

.my-library__grid .book-card-mini .toptile > div:first-child {
    position: relative;
    width: 100%;
    max-width: 220px;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    border-radius: 12px;
    background: #f0f4f8;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    margin: 0 auto;
}

/*
 * Мобилка: в new_bookinfo.css у .book-card-mini стоит width: fit-content !important на первом блоке.
 * Внутри только absolute picture/img — fit-content даёт нулевую ширину и «пустые» обложки.
 */
@media (max-width: 800px) {
    .my-library__grid .book-card-mini .toptile > div:first-child {
        width: 100% !important;
        max-width: 160px !important;
        flex: none !important;
    }

    .my-library__grid .book-card-mini .toptile .textcenter {
        max-width: 160px;
    }
}

.my-library__grid .book-card-mini .toptile > div:first-child > a {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
}

.my-library__grid .book-card-mini .toptile > div:first-child picture {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    inset: 0 !important;
    margin: 0 !important;
}

.my-library__grid .book-card-mini .toptile > div:first-child img {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    min-height: 0 !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
    position: absolute !important;
    inset: 0 !important;
    z-index: 1;
    aspect-ratio: unset !important;
}

.my-library__grid .book-card-mini .toptile > div:first-child > .sale {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 8;
    margin: 0;
}

.my-library__grid .book-card-mini .toptile .exclusive-pack,
.my-library__grid .book-card-mini .toptile .exclusive {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    left: auto !important;
    z-index: 12 !important;
}

.my-library__grid .book-card-mini .toptile .exclusive-pack::before,
.my-library__grid .book-card-mini .toptile .exclusive::before {
    content: 'ЭКСКЛЮЗИВ';
    position: absolute;
    top: 28px !important;
    right: -33px !important;
    width: 140px !important;
    padding: 0 !important;
    font-size: 11px !important;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-align: center;
    color: #fff;
    background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
    border-radius: 2px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    transform: rotate(45deg);
    transform-origin: center;
}

.my-library__grid .book-card-mini .toptile .textcenter {
    width: 100%;
    max-width: 220px;
    margin: 0 auto;
    padding: 0 4px;
    text-align: center !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    box-sizing: border-box;
}

.my-library__grid .book-card-mini .toptile .cityc,
.my-library__grid .book-card-mini .toptile .booktc {
    width: 100%;
    text-align: center !important;
}

.my-library__grid .book-card-mini .toptile .cityc a.lnk {
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
    width: 100%;
    text-align: center !important;
}

.my-library__grid .book-card-mini .toptile .booktc a.txt {
    display: block;
    width: 100%;
    text-align: center !important;
}
/* Purchased-book actions remain readable when their translated labels wrap. */
.owned-book-preference-form {
    max-width: 100%;
}
.owned-book-preference-form button.btn {
    box-sizing: border-box;
    max-width: 100%;
    height: auto;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* The public new-books catalog renders BookInfo cards in this dedicated grid. */
.catalog-new-books-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 28px 16px;
    align-items: start;
}

.catalog-new-books-grid > .book-card-mini {
    width: 100%;
    min-width: 0;
    margin: 0;
    float: none;
}

div.intro.library-newbooks-intro {
    text-align: left;
    hyphens: none;
}

@media (max-width: 760px) {
    .catalog-new-books-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px 12px;
    }
}
