/* Cartillas de Páramo — tema alineado con Inventario de Plantas */
:root {
    color-scheme: light;
    --inv-primary: #0ea5e9;
    --inv-primary-dark: #0284c7;
    --inv-accent: #f59e0b;
    --inv-accent2: #10b981;
    --inv-accent3: #8b5cf6;
    --inv-bg: #f8fafc;
    --inv-card: #fff;
    --inv-text: #1e293b;
    --inv-text-muted: #64748b;
    --inv-border: #e2e8f0;
    --inv-navy: #1e3a5f;
    --inv-navy-dark: #0f2744;
    --inv-main-grad: linear-gradient(160deg, #e0e7ff 0%, #c7d2fe 30%, #a5b4fc 100%);
    --ink: var(--inv-text);
    --muted: var(--inv-text-muted);
    --leaf: var(--inv-primary);
    --leaf-dark: var(--inv-primary-dark);
    --moss: #e0f2fe;
    --paper: var(--inv-card);
    --paper-edge: var(--inv-border);
    --sky: #f1f5f9;
    --danger: #dc2626;
    --shadow: 0 12px 32px rgba(30, 58, 95, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: "Outfit", system-ui, sans-serif;
    color: var(--inv-text);
    background: var(--inv-bg);
    position: relative;
    overflow-x: hidden;
}

.cp-catalog-page,
.cp-mode-reader,
.cp-mode-admin,
.cp-login-page,
.cp-admin-hub {
    background: var(--inv-main-grad);
}

.paramo-bg {
    display: none;
}

/* Hojas cayendo (Inventario de Plantas) */
.inv-leaves {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.inv-leaf {
    position: absolute;
    width: 20px;
    height: 20px;
    left: calc(var(--i, 0) * 7% - 5%);
    top: -20px;
    opacity: 0.55;
    animation: inv-leaf-fall 12s linear infinite;
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 18px;
    color: #22c55e;
}

.inv-leaf::before {
    content: "\f06c";
}

.inv-leaf:nth-child(3n) { color: #f59e0b; }
.inv-leaf:nth-child(5n) { color: #d97706; }
.inv-leaf:nth-child(7n) { color: #059669; }
.inv-leaf:nth-child(1) { --i: 1; animation-delay: 0s; animation-duration: 14s; }
.inv-leaf:nth-child(2) { --i: 3; animation-delay: 2s; animation-duration: 11s; font-size: 14px; }
.inv-leaf:nth-child(3) { --i: 5; animation-delay: 4s; animation-duration: 16s; }
.inv-leaf:nth-child(4) { --i: 2; animation-delay: 1s; animation-duration: 13s; }
.inv-leaf:nth-child(5) { --i: 7; animation-delay: 3s; animation-duration: 15s; }
.inv-leaf:nth-child(6) { --i: 4; animation-delay: 5s; animation-duration: 12s; font-size: 22px; }
.inv-leaf:nth-child(7) { --i: 6; animation-delay: 0.5s; animation-duration: 17s; }
.inv-leaf:nth-child(8) { --i: 8; animation-delay: 2.5s; animation-duration: 10s; }
.inv-leaf:nth-child(9) { --i: 10; animation-delay: 6s; animation-duration: 14s; }
.inv-leaf:nth-child(10) { --i: 9; animation-delay: 1.5s; animation-duration: 11s; }
.inv-leaf:nth-child(11) { --i: 11; animation-delay: 4.5s; animation-duration: 15s; }
.inv-leaf:nth-child(12) { --i: 12; animation-delay: 3.5s; animation-duration: 13s; }
.inv-leaf:nth-child(13) { --i: 14; animation-delay: 7s; animation-duration: 16s; }
.inv-leaf:nth-child(14) { --i: 13; animation-delay: 2s; animation-duration: 12s; }
.inv-leaf:nth-child(15) { --i: 15; animation-delay: 5.5s; animation-duration: 18s; }
.inv-leaf:nth-child(16) { --i: 1; animation-delay: 8s; animation-duration: 11s; }
.inv-leaf:nth-child(17) { --i: 6; animation-delay: 1s; animation-duration: 14s; }
.inv-leaf:nth-child(18) { --i: 10; animation-delay: 6.5s; animation-duration: 13s; }

@keyframes inv-leaf-fall {
    0% { top: -20px; transform: translateX(0) rotate(0deg); opacity: 0.55; }
    100% { top: 100vh; transform: translateX(0) rotate(720deg); opacity: 0.35; }
}

.hidden {
    display: none !important;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    padding: 14px clamp(16px, 3vw, 34px);
    border-bottom: none;
    background: linear-gradient(90deg, var(--inv-navy) 0%, var(--inv-navy-dark) 100%);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.2);
    color: #fff;
}

.app-header .brand h1,
.app-header .brand > div > p:not(.eyebrow) {
    color: rgba(255, 255, 255, 0.92);
}

.app-header .eyebrow {
    color: #7dd3fc;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-icon {
    display: grid;
    width: 58px;
    height: 58px;
    place-items: center;
    border-radius: 16px;
    color: #fff;
    font-weight: 800;
    font-size: 1.35rem;
    background: linear-gradient(180deg, var(--inv-primary) 0%, var(--inv-primary-dark) 100%);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15), 0 8px 20px rgba(14, 165, 233, 0.35);
}

.brand-icon i {
    line-height: 1;
}

.brand h1,
.brand p {
    margin: 0;
}

.brand h1 {
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    letter-spacing: -0.04em;
}

.eyebrow {
    color: var(--inv-primary);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.74rem;
}

.header-actions,
.admin-actions,
.book-toolbar,
.panel-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.btn,
.chip-btn,
.book-nav {
    border: 0;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    text-decoration: none;
    transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 18px;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(180deg, #64748b 0%, #475569 100%);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15), 0 6px 12px rgba(0, 0, 0, 0.1);
}

.btn:hover,
.chip-btn:hover,
.book-nav:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.15), 0 10px 20px rgba(0, 0, 0, 0.12);
}

.btn:active,
.chip-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: linear-gradient(180deg, var(--inv-primary) 0%, var(--inv-primary-dark) 100%);
}

.btn-primary:hover {
    background: linear-gradient(180deg, #38bdf8 0%, var(--inv-primary) 100%);
}

.btn-soft {
    color: var(--inv-navy);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--inv-border);
}

.app-header .btn-soft {
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.28);
}

.btn-ghost {
    color: var(--inv-text);
    background: var(--inv-card);
    border: 1px solid var(--inv-border);
}

.app-header .btn-ghost {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.22);
}

.btn-danger {
    background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
}

.btn.full {
    width: 100%;
}

.file-btn {
    position: relative;
    overflow: hidden;
}

.file-btn input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.layout {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(230px, 290px) minmax(0, 1fr) minmax(270px, 350px);
    gap: 20px;
    padding: 22px clamp(14px, 3vw, 34px) 36px;
}

.library-panel,
.admin-panel {
    display: grid;
    align-content: start;
    gap: 16px;
}

.panel-card {
    padding: 18px;
    border: 1px solid var(--inv-border);
    border-radius: 16px;
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 5px 5px 14px rgba(0, 0, 0, 0.05), -2px -2px 6px rgba(255, 255, 255, 0.8);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.panel-card:hover {
    box-shadow: 8px 8px 20px rgba(14, 165, 233, 0.1), -3px -3px 10px rgba(255, 255, 255, 0.9);
}

.panel-card h2 {
    margin: 0 0 10px;
    font-size: 1.05rem;
}

.panel-title-row {
    justify-content: space-between;
}

.chip-btn {
    padding: 8px 12px;
    border-radius: 999px;
    color: #fff;
    background: linear-gradient(180deg, var(--inv-accent2) 0%, #059669 100%);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15);
}

.hint,
.idea-list,
.activity-feedback {
    color: var(--muted);
    font-size: 0.9rem;
}

.idea-list {
    padding-left: 18px;
    margin-bottom: 0;
}

.index-list {
    display: grid;
    gap: 10px;
}

.index-card {
    display: grid;
    grid-template-columns: 38px 1fr;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--inv-border);
    border-left: 4px solid var(--inv-primary);
    border-radius: 12px;
    background: #fff;
    cursor: grab;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.index-card:hover {
    border-left-color: var(--inv-accent);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.12);
}

.index-card.active {
    outline: none;
    border-left-color: var(--inv-accent3);
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.25);
}

.index-card strong,
.index-card span {
    display: block;
}

.index-card span {
    color: var(--muted);
    font-size: 0.78rem;
}

.index-thumb {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 12px;
    color: #fff;
    font-weight: 800;
    background: linear-gradient(180deg, var(--inv-primary) 0%, var(--inv-primary-dark) 100%);
}

.book-stage {
    position: relative;
    min-width: 0;
}

.book-stage-title {
    margin: 0 0 12px;
    text-align: center;
    color: var(--inv-navy);
    font-size: clamp(1.7rem, 4vw, 3.2rem);
    font-weight: 900;
    line-height: 0.95;
    letter-spacing: -0.055em;
    text-shadow: 0 2px 12px rgba(255, 255, 255, 0.6);
}

.book-toolbar {
    justify-content: center;
    margin-bottom: 14px;
}

.book-nav {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 50%;
    color: var(--inv-primary-dark);
    font-size: 2rem;
    background: #fff;
    border: 1px solid var(--inv-border);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.12), 0 12px 24px rgba(14, 165, 233, 0.15);
}

.page-counter {
    min-width: 170px;
    padding: 12px 18px;
    border-radius: 999px;
    text-align: center;
    font-weight: 800;
    background: rgba(255, 255, 255, 0.82);
}

.book {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    max-width: 980px;
    min-height: 680px;
    margin: 0 auto;
    perspective: 1600px;
    transform-style: preserve-3d;
    filter: drop-shadow(0 30px 50px rgba(37, 54, 43, 0.26));
}

.book-turn-hint {
    text-align: center;
    margin: 0 0 12px;
}

.audiobook-float {
    position: absolute;
    left: 8px;
    top: 50%;
    z-index: 14;
    transform: translateY(-50%);
    pointer-events: none;
}

.audiobook-float-btn,
.audiobook-float-panel {
    pointer-events: auto;
}

.audiobook-float-btn {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(145deg, #10b981, #0ea5e9);
    box-shadow: 0 8px 20px rgba(14, 165, 233, 0.34);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.audiobook-float-btn:hover {
    transform: translateY(-2px);
}

.audiobook-float.is-open .audiobook-float-btn {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.55), 0 8px 20px rgba(14, 165, 233, 0.34);
}

.audiobook-float.is-speaking .audiobook-float-btn {
    animation: audiobookPulse 1.3s ease infinite;
}

@keyframes audiobookPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45), 0 8px 20px rgba(14, 165, 233, 0.34);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0), 0 8px 20px rgba(14, 165, 233, 0.34);
    }
}

.audiobook-float-icon {
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1;
}

.audiobook-float-panel {
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    right: auto;
    bottom: auto;
    transform: translateY(-50%);
    display: grid;
    gap: 8px;
    width: min(220px, calc(100vw - 48px));
    padding: 10px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid rgba(14, 165, 233, 0.18);
    box-shadow: 0 12px 28px rgba(30, 58, 95, 0.18);
}

.audiobook-float-panel.hidden {
    display: none;
}

.audiobook-float-title {
    margin: 0;
    color: #173526;
    font-size: 0.82rem;
    font-weight: 800;
}

.audiobook-float-actions {
    display: flex;
    gap: 6px;
}

.audiobook-btn {
    flex: 1;
    min-width: 0;
    padding: 7px 10px;
    border: none;
    border-radius: 999px;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.audiobook-btn-play {
    color: #fff;
    background: linear-gradient(145deg, #0f7a43, #10b981);
}

.audiobook-btn-stop {
    color: #fff;
    background: linear-gradient(145deg, #dc2626, #ef4444);
}

.audiobook-btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.audiobook-btn:disabled,
.btn-primary.is-speaking {
    opacity: 0.65;
    cursor: not-allowed;
}

.audiobook-voice-picker {
    display: grid;
    gap: 3px;
    margin: 0;
    color: var(--leaf-dark);
    font-size: 0.72rem;
    font-weight: 700;
}

.audiobook-voice-picker select {
    width: 100%;
    padding: 7px 9px;
    border-radius: 10px;
    border: 1px solid rgba(30, 58, 95, 0.16);
    background: #fff;
    font-family: inherit;
    font-size: 0.78rem;
    color: #173526;
}

.sheet {
    position: relative;
    overflow: auto;
    min-height: 680px;
    padding: clamp(22px, 3vw, 38px);
    background:
        linear-gradient(90deg, rgba(0, 0, 0, 0.05), transparent 8%, transparent 92%, rgba(0, 0, 0, 0.05)),
        repeating-linear-gradient(0deg, transparent 0 34px, rgba(111, 78, 55, 0.035) 35px),
        var(--paper);
    border: 1px solid var(--paper-edge);
    transform-style: preserve-3d;
    backface-visibility: hidden;
    transition: box-shadow 0.2s ease;
}

.sheet-left {
    border-radius: 26px 6px 6px 26px;
    transform-origin: right center;
}

.sheet-right {
    border-radius: 6px 26px 26px 6px;
    transform-origin: left center;
}

.sheet.sheet-dragging {
    z-index: 6;
    overflow: visible;
}

.sheet.sheet-turning {
    box-shadow:
        0 18px 36px rgba(37, 54, 43, 0.28),
        inset -8px 0 18px rgba(80, 55, 33, 0.12);
}

.page-corner {
    position: absolute;
    bottom: 0;
    z-index: 8;
    width: 78px;
    height: 78px;
    padding: 0;
    border: none;
    cursor: grab;
    touch-action: none;
    opacity: 0.72;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.page-corner:hover {
    opacity: 1;
}

.page-corner.grabbing {
    cursor: grabbing;
    opacity: 1;
}

.page-corner-next {
    right: 0;
    background:
        linear-gradient(135deg, transparent 46%, rgba(255, 255, 255, 0.55) 46%, rgba(214, 193, 162, 0.95) 100%);
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
    border-radius: 0 0 6px 0;
}

.page-corner-prev {
    left: 0;
    background:
        linear-gradient(225deg, transparent 46%, rgba(255, 255, 255, 0.55) 46%, rgba(214, 193, 162, 0.95) 100%);
    clip-path: polygon(0 0, 100% 100%, 0 100%);
    border-radius: 0 0 0 6px;
}

.sheet.sheet-flip-forward {
    z-index: 6;
    animation: turnPageForward 0.4s ease forwards;
}

.sheet.sheet-flip-back {
    z-index: 6;
    animation: turnPageBack 0.4s ease forwards;
}

.book.book-cover-only .sheet-left.sheet-flip-forward-cover {
    animation: turnPageForwardCover 0.4s ease forwards;
}

@keyframes turnPageForward {
    from {
        transform: rotateY(0deg);
    }
    to {
        transform: rotateY(-118deg);
    }
}

@keyframes turnPageForwardCover {
    from {
        transform: rotateY(3deg);
    }
    to {
        transform: rotateY(118deg);
    }
}

@keyframes turnPageBack {
    from {
        transform: rotateY(0deg);
    }
    to {
        transform: rotateY(118deg);
    }
}

.book.book-turning .page-corner {
    pointer-events: none;
    opacity: 0.35;
}

.book-nav:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

@keyframes turnPage {
    from {
        transform: rotateY(-7deg);
    }
    to {
        transform: rotateY(0deg);
    }
}

.page-shadow {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 2;
    width: 28px;
    pointer-events: none;
}

.page-shadow-left {
    left: calc(50% - 28px);
    background: linear-gradient(90deg, transparent, rgba(80, 55, 33, 0.17));
}

.page-shadow-right {
    left: 50%;
    background: linear-gradient(90deg, rgba(80, 55, 33, 0.2), transparent);
}

.page-kicker {
    color: var(--leaf);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.78rem;
}

.sheet h2,
.sheet h3 {
    font-family: "Libre Baskerville", Georgia, serif;
    margin: 10px 0 14px;
    color: #173526;
}

.cover-page {
    min-height: 100%;
    display: grid;
    align-content: end;
    overflow: hidden;
    color: #fff;
    background:
        linear-gradient(180deg, rgba(4, 31, 18, 0.08), rgba(4, 31, 18, 0.85)),
        var(--cover-image, linear-gradient(135deg, #2f7d32, #172f20));
    background-size: cover;
    background-position: center;
}

.cover-page h2 {
    color: #fff;
    font-size: clamp(2.3rem, 7vw, 4.5rem);
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.cover-badge {
    width: max-content;
    padding: 8px 12px;
    border-radius: 999px;
    color: #124126;
    font-weight: 800;
    background: rgba(226, 255, 236, 0.88);
}

.toc-list {
    display: grid;
    gap: 10px;
    padding: 0;
    list-style: none;
}

.toc-list button {
    width: 100%;
    padding: 12px 14px;
    border: 1px dashed rgba(30, 58, 95, 0.28);
    border-radius: 14px;
    text-align: left;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.55);
    cursor: pointer;
}

.species-photo,
.coloring-wrap {
    overflow: hidden;
    border-radius: 22px;
    border: 1px solid rgba(30, 58, 95, 0.14);
    background: #fff;
}

.species-photo {
    min-height: 280px;
}

.species-photo img,
.cover-preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.animated-photo {
    min-height: 180px;
    height: auto;
}

.animated-photo img {
    width: 100%;
    height: auto;
    max-height: 360px;
    object-fit: contain;
    background: #0f172a;
}

.coloring-guide {
    margin: 14px 0 16px;
    padding: 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.58);
    border: 1px dashed rgba(30, 58, 95, 0.22);
}

.coloring-guide h3 {
    margin-top: 0;
}

.coloring-page {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 100%;
}

.coloring-page .coloring-wrap {
    flex: 1 1 auto;
    min-height: 220px;
}

.sheet-activities .activity-list {
    margin-top: 8px;
}

.empty-image {
    display: grid;
    min-height: 240px;
    place-items: center;
    color: var(--muted);
    background: linear-gradient(135deg, rgba(30, 58, 95, 0.08), rgba(255, 255, 255, 0.7));
}

.fact-grid {
    display: grid;
    gap: 12px;
    margin: 18px 0;
}

.fact {
    padding: 14px;
    border-left: 5px solid var(--leaf);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.55);
}

.fact strong {
    display: block;
}

.paint-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.paint-toolbar button,
.paint-toolbar input[type="color"] {
    min-height: 38px;
    border: 1px solid rgba(30, 58, 95, 0.15);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
}

.paint-toolbar button {
    padding: 8px 12px;
    font-weight: 800;
}

.paint-toolbar button.active {
    color: #fff;
    background: var(--leaf);
}

.paint-canvas-stack {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #fff;
}

.paint-canvas-stack canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
}

.observations textarea {
    width: 100%;
    min-height: 100px;
    resize: vertical;
    border: 1px solid rgba(30, 58, 95, 0.18);
    border-radius: 16px;
    padding: 12px;
    font: inherit;
    background: rgba(255, 255, 255, 0.72);
}

.activity-list {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.activity-card {
    padding: 14px;
    border-radius: 18px;
    border: 1px solid rgba(30, 58, 95, 0.14);
    background: rgba(255, 255, 255, 0.68);
}

.option-row,
.drag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.option-row button,
.drag-word,
.drop-zone {
    padding: 9px 12px;
    border: 1px solid rgba(30, 58, 95, 0.17);
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
}

.drop-zone {
    min-width: 140px;
    border-style: dashed;
    color: var(--muted);
}

.youtube-frame,
.local-video {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 0;
    border-radius: 18px;
    background: #000;
}

.local-video {
    display: block;
    object-fit: contain;
}

.admin-card label {
    display: block;
    margin: 12px 0 6px;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 800;
}

.admin-card input,
.admin-card textarea,
.admin-card select {
    width: 100%;
    border: 1px solid rgba(30, 58, 95, 0.18);
    border-radius: 14px;
    padding: 11px 12px;
    font: inherit;
    background: #fff;
}

.admin-actions {
    flex-wrap: wrap;
    margin-top: 14px;
}

.save-status {
    min-height: 20px;
    margin: 10px 0 0;
    color: #0f7a43;
    font-size: 0.9rem;
    font-weight: 800;
}

.activity-admin-list {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.activity-config {
    margin-top: 12px;
}

.multiple-options-builder {
    display: grid;
    gap: 12px;
}

.multiple-option-row {
    display: grid;
    gap: 8px;
    padding: 12px;
    border-radius: 16px;
    border: 1px solid rgba(30, 58, 95, 0.14);
    background: rgba(255, 255, 255, 0.58);
}

.correct-choice {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    margin: 0 !important;
    color: var(--leaf-dark) !important;
}

.correct-choice input {
    width: auto !important;
}

.activity-admin-item {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
    padding: 9px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid transparent;
}

.activity-admin-item.is-editing {
    border-color: rgba(14, 165, 233, 0.45);
    background: rgba(224, 242, 254, 0.85);
}

.activity-admin-label {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.activity-admin-label strong {
    color: var(--leaf);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.activity-admin-actions {
    display: flex;
    flex-shrink: 0;
    gap: 6px;
}

.activity-edit-hint {
    margin-top: 8px;
}

@media (max-width: 1200px) {
    .layout {
        grid-template-columns: minmax(230px, 280px) minmax(0, 1fr);
    }

    .admin-panel {
        grid-column: 1 / -1;
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    }
}

@media (max-width: 850px) {
    .app-header,
    .brand {
        align-items: flex-start;
    }

    .app-header,
    .layout,
    .book {
        display: block;
    }

    .header-actions {
        justify-content: flex-start;
        margin-top: 14px;
    }

    .library-panel {
        margin-bottom: 16px;
    }

    .sheet {
        min-height: auto;
        margin-bottom: 12px;
        border-radius: 22px;
    }

    .page-shadow {
        display: none;
    }
}

/* Lector y editor — alineado con Inventario de Plantas */
body.cp-mode-reader,
body.cp-mode-admin {
    overflow-x: hidden;
    background: var(--inv-main-grad) !important;
}

.cp-mode-reader .app-header,
.cp-mode-admin .app-header {
    margin: 18px auto 0;
    width: min(1420px, calc(100% - 28px));
    border-radius: 16px;
}

.hero-cover {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(310px, 0.95fr);
    gap: clamp(22px, 4vw, 58px);
    align-items: center;
    width: min(1420px, calc(100% - 28px));
    margin: 18px auto 22px;
    padding: clamp(24px, 5vw, 58px);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    background:
        linear-gradient(90deg, rgba(30, 58, 95, 0.92), rgba(15, 39, 68, 0.75)),
        url("../img/libro-guardaparamos-mockup.png"),
        linear-gradient(160deg, var(--inv-navy) 0%, var(--inv-navy-dark) 100%);
    background-size: cover;
    background-position: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.hero-cover::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 78% 18%, rgba(14, 165, 233, 0.35), transparent 28%),
        radial-gradient(circle at 18% 88%, rgba(245, 158, 11, 0.15), transparent 30%);
    pointer-events: none;
}

.hero-copy,
.hero-book-preview {
    position: relative;
    z-index: 1;
}

.hero-pill {
    display: inline-flex;
    width: max-content;
    padding: 9px 14px;
    border: 1px solid rgba(186, 230, 253, 0.45);
    border-radius: 999px;
    color: #e0f2fe;
    font-weight: 900;
    background: rgba(14, 165, 233, 0.22);
}

.hero-copy h2 {
    max-width: 680px;
    margin: 16px 0 14px;
    color: #fff;
    font-size: clamp(2.2rem, 6vw, 5.4rem);
    line-height: 0.92;
    letter-spacing: -0.065em;
    text-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}

.hero-copy p {
    max-width: 620px;
    margin: 0;
    color: rgba(241, 245, 249, 0.86);
    font-size: clamp(1rem, 1.8vw, 1.2rem);
}

.hero-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.hero-chips span {
    padding: 10px 13px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    color: #f8fafc;
    font-weight: 800;
    background: rgba(255, 255, 255, 0.12);
}

.hero-book-preview {
    min-height: 430px;
    display: grid;
    place-items: center;
    perspective: 1100px;
}

.book-mock {
    width: min(310px, 76vw);
    aspect-ratio: 0.76;
    padding: 10px 12px 16px 10px;
    border-radius: 18px 24px 24px 18px;
    background: linear-gradient(90deg, #123025 0 7%, #f8fafc 7% 11%, #d1d5db 11% 13%, #ffffff 13%);
    box-shadow:
        -18px 24px 42px rgba(0, 0, 0, 0.34),
        14px 18px 0 rgba(255, 255, 255, 0.22) inset;
    transform: rotateY(-18deg) rotateZ(-3deg);
}

.book-mock img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: 12px 18px 18px 12px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.34) inset;
}

.floating-card-mini {
    position: absolute;
    padding: 12px 15px;
    border-radius: 18px;
    color: #0f172a;
    font-weight: 900;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 18px 38px rgba(2, 6, 23, 0.25);
}

.card-bird {
    top: 34px;
    right: 4%;
}

.card-paint {
    left: 3%;
    bottom: 40px;
    color: #064e3b;
}

.layout {
    width: min(1420px, calc(100% - 28px));
    margin: 0 auto 42px;
    padding: 0;
    grid-template-columns: minmax(250px, 310px) minmax(0, 1fr) minmax(300px, 370px);
}

.panel-card {
    border-color: rgba(255, 255, 255, 0.36);
    background:
        radial-gradient(circle at 16% 12%, rgba(186, 230, 253, 0.28), transparent 34%),
        rgba(255, 255, 255, 0.92);
    box-shadow: 0 24px 60px rgba(2, 6, 23, 0.22);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.panel-card h2,
.sheet h2,
.sheet h3 {
    color: #0f172a;
}

.book-stage {
    position: relative;
    min-width: 0;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 32px;
    background:
        radial-gradient(circle at 50% -10%, rgba(255, 255, 255, 0.24), transparent 42%),
        rgba(255, 255, 255, 0.08);
    box-shadow: 0 26px 70px rgba(2, 6, 23, 0.28);
    backdrop-filter: blur(10px);
}

.cp-mode-reader .book-stage-title,
.cp-mode-admin .book-stage-title {
    color: var(--inv-navy);
}

.book {
    min-height: 720px;
}

.sheet {
    min-height: 720px;
    color: #26362d;
    background:
        linear-gradient(90deg, rgba(0, 0, 0, 0.08), transparent 7%, transparent 93%, rgba(0, 0, 0, 0.05)),
        radial-gradient(circle at 18% 12%, rgba(254, 240, 138, 0.16), transparent 30%),
        repeating-linear-gradient(0deg, transparent 0 34px, rgba(111, 78, 55, 0.035) 35px),
        #fff8e7;
}

.cover-page {
    background:
        linear-gradient(180deg, rgba(3, 22, 18, 0.05), rgba(3, 22, 18, 0.82)),
        var(--cover-image, url("../img/portada-guardaparamos-junior.png"));
    background-size: cover;
    background-position: center;
}

.cover-page h2 {
    max-width: 9ch;
    color: #ffffff;
    font-family: "Outfit", "Segoe UI", sans-serif;
    font-weight: 900;
    line-height: 0.92;
    letter-spacing: -0.06em;
}

.cover-badge {
    color: #064e3b;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.btn,
.chip-btn,
.book-nav,
.index-card,
.toc-list button,
.activity-card,
.fact,
.admin-card input,
.admin-card textarea,
.admin-card select {
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.cp-mode-reader .btn-primary,
.cp-mode-admin .btn-primary,
.cp-mode-reader .chip-btn,
.cp-mode-admin .chip-btn {
    background: linear-gradient(180deg, var(--inv-primary) 0%, var(--inv-primary-dark) 100%);
}

.cp-mode-reader .index-card,
.cp-mode-admin .index-card {
    border-left-color: var(--inv-primary);
    background: linear-gradient(145deg, #ffffff, #f8fafc);
}

.cp-mode-reader .index-thumb,
.cp-mode-admin .index-thumb {
    background: linear-gradient(180deg, var(--inv-primary) 0%, var(--inv-primary-dark) 100%);
}

.species-photo,
.coloring-wrap {
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.14);
}

.paint-toolbar button.active {
    background: linear-gradient(180deg, var(--inv-primary) 0%, var(--inv-primary-dark) 100%);
}

.book.book-cover-only {
    grid-template-columns: minmax(260px, 430px);
    justify-content: center;
    max-width: 520px;
}

.book.book-cover-only .sheet-left {
    min-height: min(78vh, 720px);
    aspect-ratio: 0.76;
    overflow: hidden;
    border-radius: 18px 28px 28px 18px;
    box-shadow:
        -16px 20px 36px rgba(0, 0, 0, 0.3),
        9px 0 0 rgba(255, 255, 255, 0.34) inset,
        -8px 0 0 rgba(8, 47, 73, 0.28) inset;
    transform-origin: left center;
    transform: rotateY(3deg);
}

.book.book-cover-only .sheet-right,
.book.book-cover-only .page-shadow {
    display: none;
}

.book.book-cover-only .cover-page {
    display: grid;
    align-content: end;
    padding: clamp(22px, 4vw, 34px);
}

.book.book-cover-only .cover-page p {
    display: none;
}

.book.book-cover-only .cover-page h2 {
    font-size: clamp(2.4rem, 6vw, 4.5rem);
}

.reader-chrome {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
}

body.book-reader-mode {
    overflow: hidden;
}

body.book-reader-mode .book-turn-hint {
    display: none;
}

body.book-reader-mode .paramo-bg,
body.book-reader-mode .app-header,
body.book-reader-mode .hero-cover {
    display: none !important;
}

body.book-reader-mode .layout {
    position: fixed;
    inset: 0;
    z-index: 40;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 10px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 10px;
    background: linear-gradient(160deg, var(--inv-navy) 0%, var(--inv-navy-dark) 100%);
}

body.book-reader-mode .library-panel,
body.book-reader-mode .admin-panel {
    display: none !important;
}

body.book-reader-mode.reader-admin-open .layout {
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr) minmax(280px, 360px);
}

body.book-reader-mode.reader-admin-open .library-panel,
body.book-reader-mode.reader-admin-open .admin-panel {
    display: grid !important;
    align-content: start;
    gap: 12px;
    max-height: calc(100vh - 20px);
    overflow: auto;
}

body.book-reader-mode .book-stage {
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 12px;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.06);
}

body.book-reader-mode .book-stage-title {
    flex-shrink: 0;
    margin-bottom: 8px;
    font-size: clamp(1.4rem, 2.5vw, 2.4rem);
}

body.book-reader-mode .book-toolbar {
    flex-shrink: 0;
    margin-bottom: 10px;
}

body.book-reader-mode .audiobook-float {
    left: 10px;
}

body.book-reader-mode .book {
    flex: 1;
    min-height: 0;
    width: 100%;
    max-width: min(98vw, 1500px);
    margin: 0 auto;
    align-self: center;
}

body.book-reader-mode .book.book-cover-only {
    max-width: min(520px, 90vw);
}

body.book-reader-mode .sheet {
    min-height: calc(100vh - 150px);
    max-height: calc(100vh - 150px);
    overflow: auto;
}

body.book-reader-mode .sheet-coloring {
    overflow-y: auto;
}

body.book-reader-mode .coloring-page {
    min-height: calc(100vh - 180px);
}

body.book-reader-mode .coloring-guide {
    flex-shrink: 0;
}

body.book-reader-mode .coloring-guide .animated-photo {
    min-height: auto;
    max-height: none;
    height: auto;
}

body.book-reader-mode .coloring-guide .animated-photo img {
    width: 100%;
    height: auto;
    max-height: min(46vh, 520px);
    object-fit: contain;
}

body.book-reader-mode .coloring-page .coloring-wrap {
    min-height: min(34vh, 360px);
}

body.book-reader-mode .sheet-activities {
    overflow-y: auto;
}

body.book-reader-mode .sheet-activities .activity-list {
    padding-bottom: 24px;
}

body.book-reader-mode.reader-admin-open .sheet {
    min-height: calc(100vh - 150px);
    max-height: calc(100vh - 150px);
}

:fullscreen body,
:fullscreen {
    background: var(--inv-navy-dark);
}

:fullscreen .hero-cover,
:fullscreen .app-header {
    display: none !important;
}

@media (max-width: 1100px) {
    body.book-reader-mode.reader-admin-open .layout {
        grid-template-columns: 1fr;
        overflow: auto;
    }

    body.book-reader-mode.reader-admin-open .library-panel,
    body.book-reader-mode.reader-admin-open .admin-panel {
        max-height: none;
    }

    body.book-reader-mode .sheet {
        min-height: auto;
        max-height: none;
    }
}

@media (max-width: 1200px) {
    .hero-cover {
        grid-template-columns: 1fr;
    }

    .hero-book-preview {
        min-height: 360px;
    }

    .layout {
        grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
    }
}

@media (max-width: 850px) {
    .app-header,
    .hero-cover,
    .layout,
    .book-stage {
        width: min(100% - 18px, 720px);
    }

    .hero-cover {
        padding: 24px;
    }

    .hero-copy h2 {
        font-size: clamp(2rem, 13vw, 3.4rem);
    }

    .hero-book-preview {
        min-height: 300px;
    }

    .book-mock {
        width: min(240px, 70vw);
    }

    .layout {
        display: block;
    }

    .book-stage,
    .library-panel {
        margin-bottom: 16px;
    }

    .book {
        min-height: auto;
    }
}

/* —— Catálogo público y login —— */
.cp-catalog-page .cp-catalog-header {
    margin-bottom: 0;
}

.cp-catalog-main {
    max-width: 1180px;
    margin: 0 auto;
    padding: clamp(20px, 4vw, 48px) clamp(16px, 3vw, 34px) 64px;
}

.cp-catalog-hero {
    margin-bottom: 36px;
    padding: clamp(24px, 4vw, 40px);
    border-radius: 20px;
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid var(--inv-border);
    box-shadow: 5px 5px 14px rgba(0, 0, 0, 0.05), -2px -2px 6px rgba(255, 255, 255, 0.8);
}

.cp-catalog-hero-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 28px;
    align-items: center;
}

.cp-catalog-hero h2 {
    font-family: "Outfit", system-ui, sans-serif;
    font-size: clamp(2rem, 5vw, 3.2rem);
    line-height: 1.1;
    margin: 12px 0 16px;
    letter-spacing: -0.03em;
    color: var(--inv-navy);
}

.cp-catalog-hero .hero-pill {
    color: var(--inv-primary-dark);
    background: rgba(14, 165, 233, 0.12);
    border-color: rgba(14, 165, 233, 0.35);
}

.cp-catalog-hero .hero-chips span {
    color: var(--inv-text);
    background: #fff;
    border-color: var(--inv-border);
}

.cp-catalog-hero-visual {
    position: relative;
    min-height: 280px;
    display: grid;
    place-items: center;
}

.cp-catalog-mock {
    width: min(280px, 72vw);
    transform: rotate(-4deg);
}

.cp-cartilla-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 22px;
}

.cp-cartilla-card {
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid var(--inv-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 6px 6px 16px rgba(0, 0, 0, 0.06), -2px -2px 8px rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: inv-card-enter 0.5s ease backwards;
}

.cp-cartilla-card:nth-child(1) { animation-delay: 0.05s; border-top: 3px solid var(--inv-primary); }
.cp-cartilla-card:nth-child(2) { animation-delay: 0.15s; border-top: 3px solid var(--inv-accent); }
.cp-cartilla-card:nth-child(3) { animation-delay: 0.25s; border-top: 3px solid var(--inv-accent2); }

.cp-cartilla-card:hover {
    transform: translateY(-6px);
    box-shadow: 8px 8px 24px rgba(14, 165, 233, 0.15), -4px -4px 12px rgba(255, 255, 255, 1);
}

.cp-cartilla-thumb {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: linear-gradient(145deg, #e0f2fe, #c7d2fe);
}

.cp-cartilla-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.cp-cartilla-card:hover .cp-cartilla-thumb img {
    transform: scale(1.04);
}

.cp-cartilla-play {
    position: absolute;
    inset: auto 14px 14px 14px;
    padding: 10px 14px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--inv-primary) 0%, var(--inv-primary-dark) 100%);
    color: #fff;
    font-weight: 800;
    font-size: 0.82rem;
    text-align: center;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.cp-cartilla-card:hover .cp-cartilla-play {
    opacity: 1;
    transform: translateY(0);
}

.cp-cartilla-body {
    padding: 18px 18px 22px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.cp-cartilla-tag {
    margin: 0;
    color: var(--leaf);
    font-weight: 800;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.cp-cartilla-body h3 {
    margin: 0;
    font-size: 1.35rem;
    letter-spacing: -0.03em;
}

.cp-cartilla-body p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
    flex: 1;
}

.cp-cartilla-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.cp-catalog-notice {
    max-width: 560px;
}

.cp-catalog-footer {
    text-align: center;
    padding: 24px;
    color: var(--muted);
    font-size: 0.9rem;
}

.cp-login-page {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(160deg, var(--inv-navy) 0%, var(--inv-navy-dark) 50%, #0a1929 100%) !important;
}

.cp-login-card {
    width: min(100%, 420px);
    padding: 32px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.2);
    text-align: center;
    animation: inv-slide-up 0.6s ease;
    position: relative;
    z-index: 1;
}

@keyframes inv-slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes inv-card-enter {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.cp-login-card h1 {
    margin: 12px 0 6px;
}

.cp-login-card label {
    display: block;
    text-align: left;
    margin: 14px 0 6px;
    font-weight: 700;
    font-size: 0.9rem;
}

.cp-login-card input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--inv-border);
    font: inherit;
    background: #fff;
}

.cp-login-card input:focus {
    outline: none;
    border-color: var(--inv-primary);
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
}

.cp-login-card .brand-icon {
    margin: 0 auto 12px;
}

.cp-flash {
    padding: 12px 14px;
    border-radius: 12px;
    margin: 12px 0;
    font-weight: 600;
    font-size: 0.9rem;
}

.cp-flash.ok {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.cp-flash.err {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.cp-admin-hub .cp-admin-hero {
    margin-bottom: 28px;
}

.cp-admin-card .cp-cartilla-actions {
    margin-top: 12px;
}

.hero-cover-compact {
    padding: clamp(18px, 3vw, 28px) clamp(16px, 3vw, 34px);
}

.hero-cover-compact .hero-book-preview {
    min-height: 220px;
}

.cp-mode-reader .layout {
    /* lectura sin panel admin */
}

@media (max-width: 900px) {
    .cp-catalog-hero-grid {
        grid-template-columns: 1fr;
    }

    .cp-cartilla-play {
        opacity: 1;
        transform: none;
    }
}
