:root {
    --codice-font-size: 1.25rem;
    --color-oro: #e5ac44;
    --codice-transition: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
/* v27.0 */

/* =========================================
   BOTÓN MAPA FLOTANTE (v27.0)
   ========================================= */
.codice-btn-mapa {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    background: rgba(15, 15, 15, 0.9);
    border: 1px solid rgba(229, 172, 68, 0.3);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10002;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.5);
    text-decoration: none;
}

.ui-visible .codice-btn-mapa {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.codice-btn-mapa img {
    width: 28px;
    filter: sepia(1) brightness(0.7) contrast(1.2);
    transition: 0.3s;
}

.codice-btn-mapa:hover {
    border-color: var(--color-oro);
    background: rgba(229, 172, 68, 0.1);
    box-shadow: 0 0 20px rgba(229, 172, 68, 0.3);
}

.codice-btn-mapa:hover img {
    filter: sepia(1) brightness(1.1) contrast(1.2);
}

/* =========================================
   CABECERA Y FOOTER
   ========================================= */
.codice-header {
    position: fixed; top: 0; left: 0; width: 100%; z-index: 100000;
    background: rgba(10, 10, 10, 0.95); backdrop-filter: blur(15px);
    transition: 0.4s ease; opacity: 0; visibility: hidden;
    padding: 12px 25px; display: flex !important; 
    justify-content: space-between !important; align-items: center !important;
    transform: translateY(-100%);
    box-sizing: border-box;
}
.ui-visible .codice-header { opacity: 1; visibility: visible; transform: translateY(0); }

.codice-controls-top { display: flex !important; align-items: center !important; gap: 15px; margin-right: 20px; }

/* BOTONES CABECERA */
.codice-btn, .btn-marcador-codice, .codice-btn-close {
    background: transparent !important; border: none !important;
    color: var(--color-oro) !important; width: 48px !important; height: 48px !important;
    cursor: pointer !important; display: flex !important; align-items: center !important;
    justify-content: center !important; transition: transform 0.3s ease;
}
.codice-btn svg, .btn-marcador-codice svg, .codice-btn-close svg { width: 24px !important; height: 24px !important; }
.btn-marcador-codice.has-bookmark svg { fill: var(--color-oro) !important; filter: drop-shadow(0 0 5px var(--color-oro)); }

/* =========================================
   TÍTULOS CENTRADOS
   ========================================= */
.lector-titulo {
    text-align: center !important;
    width: 100% !important;
    display: block !important;
    font-family: 'Cinzel', serif;
    color: var(--color-oro);
    margin: 1.5rem 0 !important;
}

/* =========================================
   BOTONES FINALES PREMIUM
   ========================================= */
.codice-nav-buttons {
    display: flex; gap: 25px; justify-content: center; width: 100%; margin-top: 3.5rem;
}
.btn-codice-home, .btn-codice-next {
    display: flex; align-items: center; justify-content: center;
    padding: 16px 32px; border-radius: 12px; font-family: 'Cinzel', serif;
    font-size: 0.95rem; font-weight: bold; text-decoration: none;
    text-transform: uppercase; letter-spacing: 2px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(229, 172, 68, 0.4);
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}
.btn-codice-home { background: rgba(30, 30, 30, 0.6); color: var(--color-oro) !important; backdrop-filter: blur(10px); }
.btn-codice-home:hover { background: rgba(229, 172, 68, 0.1); border-color: var(--color-oro); transform: translateY(-5px); }
.btn-codice-next { background: linear-gradient(135deg, rgba(229, 172, 68, 0.2) 0%, rgba(229, 172, 68, 0.05) 100%); color: var(--color-oro) !important; border: 1px solid var(--color-oro); }
.btn-codice-next:hover { background: var(--color-oro); color: #000 !important; transform: translateY(-5px) scale(1.03); }

/* =========================================
   MARCADOR (RIBBON)
   ========================================= */
.codice-bookmark-ribbon {
    position: absolute !important;
    top: 0 !important;
    right: 10% !important;
    width: 40px !important;
    height: 80px !important;
    background: var(--color-oro) !important;
    z-index: 9999 !important;
    cursor: pointer !important;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 85%, 0 100%) !important;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5) !important;
    animation: ribbonDrop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards !important;
    display: block !important;
}
.codice-bookmark-ribbon.removing { animation: ribbonRaise 0.4s ease-in forwards !important; }
@keyframes ribbonDrop { from { transform: translateY(-100%); } to { transform: translateY(0); } }
@keyframes ribbonRaise { from { transform: translateY(0); } to { transform: translateY(-110%); } }

/* =========================================
   SISTEMA DE SELECCIÓN
   ========================================= */
.selection-toolbar {
    position: absolute; display: none; background: rgba(10, 10, 10, 0.98); backdrop-filter: blur(15px);
    border: 1px solid var(--color-oro); border-radius: 16px; padding: 15px; z-index: 9999999;
    box-shadow: 0 15px 45px rgba(0,0,0,0.9); flex-direction: column; gap: 12px; width: 320px; box-sizing: border-box;
}
.toolbar-buttons { display: flex; gap: 8px; width: 100%; }
.selection-toolbar button {
    background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(229, 172, 68, 0.15);
    color: var(--color-oro); font-size: 0.8rem; padding: 12px 8px;
    cursor: pointer; transition: all 0.25s ease; border-radius: 10px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; 
    flex: 1; font-family: 'Cinzel', serif; gap: 5px;
}

/* =========================================
   SEPARADORES DE ESCENA (PLUMAS) - v28.0
   ========================================= */
.separador-pluma {
    width: 60px !important;
    height: 30px !important;
    margin: 40px auto !important;
    display: flex !important;
    background-size: contain !important;
    flex-shrink: 0 !important;
}
.separador-pluma.triple {
    width: 140px !important;
    height: 40px !important;
    gap: 15px !important;
}
.separador-pluma.triple span {
    width: 40px !important;
    height: 25px !important;
    background-size: contain !important;
}

/* LAYOUT Y PÁGINAS */
.modo-codice-standalone {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 9999; background-color: #000; overflow: hidden; font-family: 'Lora', serif;
}
.codice-pages-container {
    width: 100vw; height: 100vh; overflow-x: auto; overflow-y: hidden;
    display: flex; scroll-snap-type: x mandatory;
    transition: transform var(--codice-transition), border-radius var(--codice-transition);
}
.ui-visible .codice-pages-container { transform: scale(0.82); border-radius: 20px; }
.codice-content-flow { display: flex; height: 100vh; }

.page-block, .codice-page-auto {
    flex: 0 0 100vw; width: 100vw !important; height: 100vh !important;
    background-color: #0c0c0c; scroll-snap-align: center; 
    scroll-snap-stop: always !important;
    position: relative;
    display: flex !important; flex-direction: column !important;
    justify-content: center !important; align-items: center !important;
    padding: 80px 0 !important; /* Margen base */
    box-sizing: border-box !important;
}
.codice-page-content-area {
    width: 70% !important; max-width: 900px;
    height: 70vh !important; /* ALTURA FIJA PARA EL MOTOR DE PÁGINAS */
    display: flex; flex-direction: column; justify-content: center; text-align: justify;
    overflow: hidden; /* Evita que el texto se asome antes de paginar */
}
#codice-cover .codice-page-content-area { height: 80vh !important; }

/* UI FOOTER */
.codice-footer {
    position: fixed; bottom: 0; width: 100%; z-index: 10001;
    background: rgba(10, 10, 10, 0.95); backdrop-filter: blur(15px);
    transition: 0.4s ease; opacity: 0; visibility: hidden; padding: 25px 40px; display: flex; justify-content: center;
    transform: translateY(100%);
}
.ui-visible .codice-footer { opacity: 1; visibility: visible; transform: translateY(0); }

.codice-slider { flex: 1; -webkit-appearance: none; height: 4px; background: rgba(229, 172, 68, 0.2); border-radius: 2px; }
.codice-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; background: var(--color-oro); border-radius: 50%; border: 3px solid #111; }
.page-num-indicator { font-family: 'Cinzel', serif; color: var(--color-oro); min-width: 65px; text-align: center; }
.codice-progress-container { display: flex; align-items: center; gap: 20px; width: 100%; max-width: 800px; }

/* TEMAS */
.tema-sepia .page-block, .tema-sepia .codice-page-auto { background-color: #f4ecd8 !important; color: #433422 !important; }
.tema-claro .page-block, .tema-claro .codice-page-auto { background-color: #ffffff !important; color: #111 !important; }

/* MÓVIL */
@media (max-width: 600px) {
    .page-block, .codice-page-auto { padding: 80px 0 100px 0 !important; margin-right: 40px; }
    .codice-page-content-area { width: 88% !important; }
    .codice-btn, .btn-marcador-codice, .codice-btn-close { width: 40px !important; height: 40px !important; }
    .codice-btn svg, .btn-marcador-codice svg, .codice-btn-close svg { width: 22px !important; height: 22px !important; }
    .btn-codice-home, .btn-codice-next { padding: 12px 20px; font-size: 0.8rem; }
    .codice-controls-top { margin-right: 10px; gap: 8px; }
    .codice-header { padding: 10px 15px; }
    .selection-toolbar { width: 280px; }
    .codice-btn-mapa { bottom: 100px; right: 20px; width: 48px; height: 48px; }
    .codice-btn-mapa img { width: 22px; }
}

.codice-pages-container::-webkit-scrollbar { display: none; }
