@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=SF+Pro+Display:wght@400;500;600;700&family=Inter:wght@300;400;500;600;700&family=Noto+Serif:wght@400;500;600&display=swap');

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

/* --- Tipografia Apple --- */
:root {
    --primary: #000;
    --secondary: #555;
    --light-gray: #f5f5f7;
    --border-gray: #e5e5e7;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --card-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.15);
    --sidebar-width: clamp(200px, 22vw, 240px);
    --font-ui: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
    --font-serif: "New York", "New York Medium", "New York Small", "Instrument Serif", "Noto Serif", serif;
}

html.dark-mode {
    --primary: #fff;
    --secondary: #a1a1a3;
    --light-gray: #1d1d1f;
    --border-gray: #424245;
}

body {
    font-family: var(--font-ui);
    background-color: #fff;
    color: var(--primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
    overflow-x: hidden;
}

html, body {
    height: 100%;
}

html.dark-mode body {
    background-color: #000;
}

/* --- Navegação --- */
.nav {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--light-gray);
    border-bottom: 1px solid var(--border-gray);
    backdrop-filter: blur(12px);
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hamburger {
    background: transparent;
    border: 1px solid var(--border-gray);
    color: var(--primary);
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.hamburger:hover {
    transform: translateY(-1px);
    box-shadow: var(--card-shadow);
}

.menu-panel {
    position: absolute;
    top: 64px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 200px;
    padding: 14px;
    background: #fff;
    border: 1px solid var(--border-gray);
    border-radius: 14px;
    box-shadow: var(--card-shadow-hover);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: all 0.2s ease;
}

html.dark-mode .menu-panel {
    background: #111;
}

.menu-panel.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.menu-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    color: var(--primary);
    background: var(--light-gray);
    border: 1px solid transparent;
    cursor: pointer;
}

.menu-link:hover {
    border-color: var(--border-gray);
}

.menu-button {
    background: transparent;
    border: 1px solid var(--border-gray);
}

.font-serif {
    font-family: 'Instrument Serif', serif;
}

/* --- Tipografia --- */
h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

h2 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.2;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6px;
        text-align: center;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--secondary);
}

.text-caption {
    font-size: 0.875rem;
    color: var(--secondary);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--light-gray);
}

::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #999;
}

html.dark-mode ::-webkit-scrollbar-thumb {
    background: #424245;
}

/* --- Apple Books Layout --- */
.books-app {
    background: #f7f7f9;
    color: #1d1d1f;
    min-height: 100vh;
    font-family: var(--font-ui);
    font-weight: 400;
}

.books-app h1,
.books-app h2,
.books-app h3,
.books-app h4,
.books-app .sidebar-logo,
.books-app .shelf-header h2 {
    font-family: var(--font-serif);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.books-app a {
    color: inherit;
}

.app-shell {
    display: grid;
    grid-template-columns: 1fr;
    min-height: 100vh;
    height: 100vh;
    background: #f7f7f9;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px 18px;
    background: #ffffff;
    border-right: 1px solid rgba(0,0,0,0.08);
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sidebar-logo {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    margin-right: 6px;
    vertical-align: middle;
    filter: brightness(0);
}

.sidebar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #f1f2f4;
    color: #6b6b6f;
    font-size: 0.95rem;
}

.sidebar-search input {
    background: transparent;
    border: none;
    outline: none;
    color: #1d1d1f;
    width: 100%;
    font-size: 0.95rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #6b6b6f;
    margin-bottom: 6px;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

.sidebar-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.sidebar-item {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    color: #1d1d1f;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.sidebar-icon {
    width: 18px;
    height: 24px;
    border-radius: 4px;
    background: rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.15);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.06) inset;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: rgba(0,0,0,0.7);
    flex-shrink: 0;
}

.sidebar-item:hover,
.sidebar-item.active {
    background: #f1f2f4;
}

.sidebar-button {
    justify-content: flex-start;
}

.sidebar-footer {
    margin-top: auto;
    padding-bottom: 64px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    background: #f1f2f4;
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e6e7ea;
    display: grid;
    place-items: center;
    font-size: 1rem;
}

.sidebar-user-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.sidebar-ghost {
    background: transparent;
    border: none;
    color: #6b6b6f;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0;
}

.content {
    padding: 16px 0 24px;
    padding-left: var(--sidebar-width);
    background: #ffffff;
    margin-left: 0;
    height: 100vh;
    overflow-y: auto;
}

.hero-panel {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 32px;
    padding: 28px;
    border-radius: 0;
    background: #ffffff;
    border: none;
    margin-bottom: 24px;
}

.hero-copy {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hero-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.75rem;
    color: #6b6b6f;
}

.hero-title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 650;
    letter-spacing: -0.015em;
}

.hero-subtitle {
    color: #6b6b6f;
    font-size: 1.02rem;
    line-height: 1.65;
    font-weight: 450;
}

.hero-actions {
    display: flex;
    gap: 12px;
}

.hero-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border-radius: 14px;
    background: #ffffff;
    color: #1d1d1f;
    font-weight: 550;
    text-decoration: none;
    border: 1px solid #e5e5e7;
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.hero-button:hover {
    transform: translateY(-1px);
    background: #f1f2f4;
    border-color: #d6d6da;
}

.hero-cover {
    display: grid;
    place-items: center;
}

.hero-cover-inner {
    width: 100%;
    max-width: 240px;
}

.reading-goal {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 24px;
    align-items: center;
    padding: 24px;
    border-radius: 0;
    background: #ffffff;
    border: none;
    margin-bottom: 24px;
}

.reading-goal h2 {
    font-size: 1.4rem;
    margin-bottom: 6px;
}

.reading-goal p {
    color: #6b6b6f;
}

.goal-card {
    min-width: 200px;
    padding: 16px 20px;
    border-radius: 0;
    background: #f1f2f4;
    text-align: right;
}

.goal-value {
    font-size: 2rem;
    font-weight: 700;
}

.goal-label,
.goal-caption {
    color: #6b6b6f;
    font-size: 0.85rem;
}

.goal-progress {
    height: 6px;
    background: #e5e5e7;
    border-radius: 999px;
    margin: 10px 0 6px;
    overflow: hidden;
}

.goal-progress-bar {
    height: 100%;
    background: #34c759;
    width: 50%;
    border-radius: inherit;
    transition: width 0.3s ease;
}

.shelves {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.shelf {
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: rgba(255, 255, 255, 0.92);
    border: none;
    border-radius: 0;
    padding: 18px 18px 12px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 18px 30px rgba(0,0,0,0.08);
}

.shelf-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.shelf-header h2 {
    font-size: 1.35rem;
    margin-bottom: 4px;
}

.shelf-header p {
    color: #6b6b6f;
    font-size: 0.95rem;
}

.shelf-link {
    background: transparent;
    border: none;
    color: #6b6b6f;
    font-weight: 600;
    cursor: pointer;
}

.shelf-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
    padding-bottom: 6px;
    background: #ffffff;
    border-radius: 0;
    padding: 16px 10px 14px;
    position: relative;
}

.shelf-row::after {
    content: '';
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 8px;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(0,0,0,0.06), rgba(255,255,255,0.5), rgba(0,0,0,0.06));
    opacity: 0.35;
}

.shelf-control {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #ffffff;
    color: #1d1d1f;
    cursor: pointer;
}

.shelf-scroll {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(120px, 150px);
    gap: 18px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
}

.shelf-scroll::-webkit-scrollbar {
    height: 6px;
}

.shelf-scroll::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 999px;
}

.book-tile {
    scroll-snap-align: start;
    transition: transform 0.3s ease;
}

.book-tile-meta {
    margin-top: 10px;
}

.book-title {
    font-weight: 500;
    font-size: 0.95rem;
    color: #1d1d1f;
    margin-bottom: 4px;
}

.book-author {
    font-size: 0.85rem;
    color: #6b6b6f;
}

.shelf-empty {
    color: #6b6b6f;
    text-align: center;
}

/* --- Apple Books Theme Overrides for other pages --- */
.books-app {
    background: #f7f7f9 !important;
    color: #1d1d1f !important;
    min-height: 100vh;
    font-family: var(--font-ui);
    font-weight: 400;
}

.books-app .navbar,
.books-app .reader-header,
.books-app .reading-header,
.books-app .publish-header {
    background: #ffffff !important;
    border-color: #e5e5e7 !important;
}

.books-app .container,
.books-app .reader-container,
.books-app .publish-container {
    color: #1d1d1f;
}

.books-app .auth-container,
.books-app .form-section,
.books-app .stat-card,
.books-app .reading-item,
.books-app .books-table th,
.books-app .books-table td {
    background: #ffffff !important;
    border-color: #e5e5e7 !important;
}

.books-app .books-table th,
.books-app .books-table td {
    color: #1d1d1f;
}

.books-app .tab-btn {
    color: #6b6b6f;
}

.books-app .tab-btn.active {
    color: #1d1d1f;
    border-bottom-color: #1d1d1f;
}

.books-app .btn-secondary,
.books-app .user-menu,
.books-app .nav-btn,
.books-app .control-btn,
.books-app .bookmark-btn {
    background: #f1f2f4 !important;
    border-color: #e0e0e4 !important;
    color: #1d1d1f !important;
}

.books-app .btn-secondary:hover,
.books-app .user-menu:hover,
.books-app .nav-btn:hover,
.books-app .control-btn:hover,
.books-app .bookmark-btn:hover {
    background: #e6e7ea !important;
}

.books-app .form-group input,
.books-app .form-group textarea,
.books-app .upload-input {
    background: #ffffff !important;
    border-color: #d6d6da !important;
    color: #1d1d1f !important;
}

.books-app .form-group input::placeholder,
.books-app .form-group textarea::placeholder {
    color: #8e8e93;
}

.books-app .publish-header p,
.books-app .header p,
.books-app .stat-label,
.books-app .book-item-meta,
.books-app .reading-item-progress,
.books-app .auth-header p,
.books-app .auth-toggle p {
    color: #6b6b6f !important;
}

.books-app .book-cover::before,
.books-app .book-cover::after {
    opacity: 0;
}

.books-app .progress-bar,
.books-app .progress-fill {
    background: #e5e5e7 !important;
}

.books-app .progress-fill {
    background: #34c759 !important;
}

.books-app .bg-white,
.books-app .bg-gray-50,
.books-app .bg-gray-100 {
    background: #ffffff !important;
}

.books-app .border-gray-200,
.books-app .border-gray-300 {
    border-color: #e5e5e7 !important;
}

.books-app .text-gray-800,
.books-app .text-gray-700,
.books-app .text-gray-600,
.books-app .text-gray-500,
.books-app .text-gray-400 {
    color: #1d1d1f !important;
}

.books-app .divide-gray-200 > :not([hidden]) ~ :not([hidden]) {
    border-color: #e5e5e7 !important;
}

@media (max-width: 1024px) {
    .content {
        padding: 12px 0 20px;
        padding-left: var(--sidebar-width);
    }
    .hero-panel {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: clamp(180px, 32vw, 200px);
    }

    .content {
        padding: 8px 0 16px;
        padding-left: var(--sidebar-width);
    }

    .home-page:not(.mobile-menu-open) .content {
        padding-left: 0;
    }

    .home-page .content {
        padding-top: 72px;
    }

    .home-page .hero-panel {
        padding: 16px;
        margin-bottom: 16px;
        gap: 16px;
    }

    .home-page .hero-title {
        font-size: 1.6rem;
    }

    .home-page .hero-subtitle {
        font-size: 0.9rem;
        line-height: 1.45;
    }

    .home-page .hero-actions {
        gap: 8px;
    }

    .home-page .hero-button {
        padding: 10px 14px;
        border-radius: 10px;
        font-size: 0.9rem;
    }

    .home-page .hero-cover-inner {
        max-width: 180px;
    }

    .home-page .shelves {
        gap: 6px;
    }

    .home-page .shelf {
        padding: 12px 12px 8px;
    }

    .home-page .shelf-header h2 {
        font-size: 1.05rem;
    }

    .home-page .shelf-header p {
        font-size: 0.85rem;
    }

    .home-page .shelf-row {
        padding: 10px 8px 10px;
    }

    .home-page .shelf-scroll {
        gap: 12px;
        grid-auto-columns: minmax(110px, 130px);
    }

    .reading-goal {
        grid-template-columns: 1fr;
        text-align: left;
    }

    .goal-card {
        text-align: left;
    }
}

/* --- Animações suaves --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* --- Cards de livros --- */
.book-card {
    animation: fadeInUp 0.6s ease-out backwards;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 12px;
    background: transparent;
    group: 1;
}

.book-card:hover {
    transform: translateY(-8px);
}

.book-cover-link {
    text-decoration: none;
}

.book-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 3;
    border-radius: 10px;
    background: transparent;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(0,0,0,0.06);
    overflow: visible;
    transform-style: preserve-3d;
    transition: transform 0.35s ease, box-shadow 0.35s ease;
    will-change: transform, box-shadow;
}

.book-cover::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 6%;
    height: 100%;
    background: linear-gradient(180deg, rgba(0,0,0,0.18), rgba(0,0,0,0.03));
    mix-blend-mode: multiply;
    pointer-events: none;
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
}

.book-cover::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 5%;
    height: 100%;
    background: linear-gradient(180deg, rgba(255,255,255,0.55), rgba(255,255,255,0));
    pointer-events: none;
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
    background: transparent;
    display: block;
}

.book-lock-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: rgba(0,0,0,0.72);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    box-shadow: 0 6px 14px rgba(0,0,0,0.22);
    z-index: 2;
}

/* --- Menu mobile (apenas home) --- */
.mobile-menu-toggle {
    display: none;
}

.mobile-menu-overlay {
    display: none;
}

.mobile-brand {
    display: none;
}

.sidebar-brand {
    display: inline;
}

.sidebar-page-title {
    display: none;
}

@media (max-width: 768px) {
    .home-page .mobile-brand {
        position: fixed;
        top: 16px;
        left: 16px;
        width: 40px;
        height: 40px;
        border-radius: 10px;
        border: 1px solid rgba(0,0,0,0.08);
        background: rgba(255,255,255,0.95);
        box-shadow: 0 10px 24px rgba(0,0,0,0.18);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        z-index: 80;
    }

    .home-page .mobile-brand .logo-icon {
        width: 22px;
        height: 22px;
    }

    .home-page.mobile-menu-open .mobile-brand {
        display: none;
    }

    .home-page {
        --sidebar-width: 64px;
    }

    .home-page .mobile-menu-toggle {
        position: fixed;
        top: 16px;
        right: 16px;
        width: 40px;
        height: 40px;
        border-radius: 10px;
        border: 1px solid rgba(0,0,0,0.08);
        background: rgba(255,255,255,0.95);
        box-shadow: 0 10px 24px rgba(0,0,0,0.18);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
        cursor: pointer;
        z-index: 90;
    }

    .home-page .mobile-menu-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.35);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
        z-index: 70;
    }

    .home-page .mobile-menu-overlay.open {
        opacity: 1;
        pointer-events: auto;
    }

    .home-page .sidebar {
        width: 0;
        padding: 0;
        overflow: hidden;
        border-right: none;
    }

    .home-page .sidebar-search,
    .home-page .sidebar-nav,
    .home-page .sidebar-footer {
        display: none;
    }

    .home-page .sidebar-logo {
        display: none;
    }

    .home-page .sidebar-brand {
        display: none;
    }

    .home-page .sidebar-page-title {
        display: inline;
        font-weight: 600;
    }

    .home-page.mobile-menu-open {
        --sidebar-width: 240px;
    }

    .home-page.mobile-menu-open .sidebar {
        width: 240px;
        padding: 24px 18px;
        overflow: visible;
        border-right: 1px solid var(--border-gray);
    }

    .home-page.mobile-menu-open .sidebar-logo {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 0.95rem;
    }

    .home-page.mobile-menu-open .sidebar-search,
    .home-page.mobile-menu-open .sidebar-nav,
    .home-page.mobile-menu-open .sidebar-footer {
        display: block;
    }

    .home-page.mobile-menu-open .sidebar-brand {
        display: inline;
    }

    .home-page.mobile-menu-open .sidebar-page-title {
        display: none;
    }
}

.book-card:hover .book-cover {
    transform: translateY(-6px) rotateY(-5deg) scale(1.01);
    box-shadow: 0 16px 28px rgba(0,0,0,0.22);
}

.book-card:hover {
    transform: translateY(-8px) scale(1.03);
}

.book-tile:hover .book-cover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 16px 28px rgba(0,0,0,0.22);
}

.book-tile:hover {
    transform: translateY(-2px);
}

.book-card h3 {
    margin-top: 12px;
    font-family: 'Instrument Serif', serif;
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--primary);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.book-card p {
    margin-top: 6px;
    font-size: 0.9375rem;
    color: var(--secondary);
    margin-bottom: 8px;
}

.book-meta {
    padding: 4px 4px 0;
}

/* --- Seções --- */
section {
    margin-bottom: 1rem;
}

section h2 {
    margin-bottom: 24px;
    letter-spacing: -0.015em;
}

/* --- Grid de livros --- */
.book-grid,
#book-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 24px;
    padding: 0;
}

@media (min-width: 768px) {
    .book-grid,
    #book-list {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 28px;
    }
}

@media (min-width: 1024px) {
    .book-grid,
    #book-list {
        grid-template-columns: repeat(5, 1fr);
        gap: 32px;
    }
}

/* --- Capítulos recentes --- */
#chapters {
    display: flex;
    overflow-x: auto;
    gap: 16px;
    padding: 0;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.chapter-card {
    flex: 0 0 280px;
    padding: 20px;
    background: var(--light-gray);
    border-radius: 12px;
    border: 1px solid var(--border-gray);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.6s ease-out backwards;
}

.chapter-card:hover {
    background: var(--light-gray);
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-4px);
}

.chapter-card h4 {
    font-size: 1.0625rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--primary);
}

.chapter-card p {
    font-size: 0.875rem;
    margin-bottom: 16px;
}

.chapter-card a {
    font-weight: 500;
    color: #0071e3;
    text-decoration: none;
}

/* --- Reader / Detalhe do livro --- */
#book-detail {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 3rem;
    align-items: start;
    margin-bottom: 3rem;
}

#book-detail .book-cover {
    position: sticky;
    top: 80px;
}

#book-detail .book-cover img {
    width: 100%;
    border-radius: 0;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    animation: scaleIn 0.5s ease-out;
}

#book-detail .book-info h1 {
    margin-bottom: 12px;
}

#book-detail .book-info .author {
    font-size: 1.0625rem;
    color: var(--secondary);
    margin-bottom: 20px;
}

#book-detail .book-info .description {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--secondary);
    margin-bottom: 24px;
}

.read-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #0071e3;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.read-btn:hover {
    background: #0066d6;
    transform: scale(1.02);
}

/* --- Capítulos no reader --- */
.chapters-section {
    margin-top: 3rem;
}

.chapters-section h2 {
    margin-bottom: 24px;
}

#capitulos {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chapter-content {
    background: var(--light-gray);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-gray);
    animation: fadeInUp 0.6s ease-out backwards;
}

.chapter-content h4 {
    margin-bottom: 16px;
    font-size: 1.25rem;
}

.chapter-content p {
    line-height: 1.8;
    text-align: justify;
}

/* --- Botões interativos --- */
.favorite-btn, .rating-star {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.favorite-btn:hover {
    transform: scale(1.1);
}

.favorite-btn.favorited {
    color: #ff2d55;
}

.rating-star {
    color: var(--secondary);
}

.rating-star:hover, .rating-star.active {
    color: #ff9500;
    transform: scale(1.1);
}

/* --- Dark Mode --- */
html.dark-mode {
    color-scheme: dark;
}

/* --- Responsividade --- */
@media (max-width: 1024px) {
    #book-detail {
        grid-template-columns: 1fr;
    }

    #book-detail .book-cover {
        position: static;
        max-width: 300px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    #book-list {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }

    #chapters {
        gap: 12px;
    }

    .chapter-card {
        flex: 0 0 240px;
        padding: 16px;
    }
}

@media (max-width: 480px) {
    #book-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .chapter-card {
        flex: 0 0 200px;
        padding: 12px;
    }

    .book-card h3 {
        font-size: 1rem;
    }
}
