.book-page {
    display: grid;
    grid-template-rows: auto auto;
    gap: 32px;
}

/* ── Top section: cover + info + meta ── */
.book-top {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 24px;
    align-items: start;
}

.book-cover {
    background: #ece9e3;
    border: 1px solid #e0e0d8;
    border-radius: 4px;
    aspect-ratio: 2 / 3;
    overflow: hidden;
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ── Main info ── */
.book-info {
    border: 1px solid #e0e0d8;
    border-radius: 4px;
    padding: 16px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.book-title {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.book-author {
    font-size: 0.95rem;
    color: #555;
}

.book-price {
    font-size: 1.1rem;
    font-weight: 600;
}

.book-download-btn {
    display: inline-block;
    background: #1a1a1a;
    color: #fff;
    text-decoration: none;
    padding: 9px 20px;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    align-self: flex-start;
    cursor: pointer;
    transition: background 0.15s;
}

.book-download-btn:hover {
    background: #333;
}

.book-formats {
    font-size: 0.8rem;
    color: #777;
}

.book-formats span {
    font-weight: 500;
    color: #444;
}

.book-stats {
    display: flex;
    gap: 20px;
    font-size: 0.82rem;
    color: #777;
    padding-top: 4px;
}

.book-stats strong {
    color: #1a1a1a;
    font-weight: 600;
}

.book-added {
    font-size: 0.8rem;
    color: #999;
}

/* ── Meta box (pages, characters, tags) ── */
.book-meta-box {
    border: 1px solid #e0e0d8;
    border-radius: 4px;
    padding: 16px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 0.85rem;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.meta-label {
    color: #888;
}

.meta-value {
    font-weight: 500;
    text-align: right;
}

.meta-divider {
    border: none;
    border-top: 1px solid #e0e0d8;
    margin: 0;
}

.book-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.book-tag {
    background: #f0efe9;
    color: #555;
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 3px;
    text-decoration: none;
}

.book-tag:hover {
    background: #e5e4de;
    color: #1a1a1a;
}

/* ── Description ── */
.book-description {
    font-size: 0.9rem;
    line-height: 1.7;
    color: #333;
    border-top: 1px solid #e0e0d8;
    padding-top: 24px;
}

/* ── Download modal ── */
dialog[id^="download-modal-"] {
    border: 1px solid #e0e0d8;
    border-radius: 6px;
    padding: 28px;
    min-width: 320px;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

dialog[id^="download-modal-"]::backdrop {
    background: rgba(0,0,0,0.35);
}

dialog[id^="download-modal-"] h3 {
    margin: 0 0 16px;
    font-size: 1rem;
    font-weight: 600;
}

.download-formats-list {
    list-style: none;
    margin: 0 0 20px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.download-formats-list a {
    display: inline-block;
    padding: 8px 14px;
    background: #f0efe9;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #1a1a1a;
    text-decoration: none;
    transition: background 0.15s;
}

.download-formats-list a:hover:not(.download-link--disabled) {
    background: #e0dfd8;
}

.download-formats-list a.download-link--disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.download-terms-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: #555;
    margin-bottom: 20px;
    cursor: pointer;
}

.download-terms-label a {
    color: #1a1a1a;
    text-decoration: underline;
}

.download-modal-close {
    display: block;
    width: 100%;
    padding: 8px;
    background: none;
    border: 1px solid #e0e0d8;
    border-radius: 4px;
    font-size: 0.875rem;
    font-family: inherit;
    color: #777;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.download-modal-close:hover {
    border-color: #aaa;
    color: #1a1a1a;
}
