:root {
    --color-bg: #0b0c10;
    --color-primary: #FFD700;
    --color-primary-dark: #B8860B;
    --color-paper: #FDFBF7;
    --color-text: #2c2c2c;
    --color-god: #87CEEB;
    
    --font-title: 'Cinzel', serif;
    --font-text: 'Nunito', sans-serif;
}

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

body {
    background: var(--color-bg);
    background-image: radial-gradient(circle at center, #1a1a2e 0%, #0b0c10 100%);
    color: var(--color-text);
    font-family: var(--font-text);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Fundo Mágico */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 10px #FFD700, 0 0 20px #FFD700;
    animation: float-up linear infinite;
}

@keyframes float-up {
    0% { transform: translateY(100vh) scale(0); opacity: 0; }
    50% { opacity: 0.8; }
    100% { transform: translateY(-100px) scale(1); opacity: 0; }
}

/* App Container */
.app-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 1200px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.top-header {
    text-align: center;
    margin-bottom: 2rem;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.logo-title {
    font-family: var(--font-title);
    color: var(--color-primary);
    font-size: 3rem;
    letter-spacing: 2px;
}

.logo-subtitle {
    color: #fff;
    font-size: 1.2rem;
    opacity: 0.8;
}

/* Book Interface */
.book-container {
    width: 90%;
    max-width: 1000px;
    height: 65vh;
    min-height: 500px;
    background: var(--color-paper);
    border-radius: 20px;
    box-shadow: 
        0 20px 50px rgba(0,0,0,0.5),
        inset 0 0 60px rgba(139, 69, 19, 0.1),
        0 0 0 8px var(--color-primary-dark),
        0 0 0 12px #3e2723;
    position: relative;
    overflow: hidden;
    display: flex;
    perspective: 1000px;
}

/* Linha do meio do livro */
.book-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    background: linear-gradient(to right, rgba(0,0,0,0.1), rgba(0,0,0,0.3) 50%, rgba(0,0,0,0.1));
    z-index: 50;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
}

.book-page {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    transition: transform 0.8s cubic-bezier(0.645, 0.045, 0.355, 1), opacity 0.4s ease;
}

.book-page.hidden {
    opacity: 0;
    pointer-events: none;
    transform: rotateY(90deg);
}

.book-page.active {
    opacity: 1;
    pointer-events: all;
    transform: rotateY(0deg);
}

/* Cover Page */
.cover {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
}
.cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.7;
}
.cover-overlay {
    position: absolute;
    text-align: center;
    color: white;
}
.cover-overlay h2 {
    font-family: var(--font-title);
    font-size: 4rem;
    color: var(--color-primary);
    text-shadow: 0 5px 15px rgba(0,0,0,0.8);
    margin-bottom: 2rem;
}

/* Spread Pages (Left/Right) */
.page-left, .page-right {
    width: 50%;
    height: 100%;
    padding: 3rem;
    position: relative;
    overflow-y: auto;
}

.page-left {
    border-right: 1px solid rgba(0,0,0,0.05);
}

/* Tipografia do Livro */
.page-title {
    font-family: var(--font-title);
    color: #3e2723;
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-primary);
    display: inline-block;
}

.page-desc {
    color: #5d4037;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

/* Botões */
.btn-magic {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: #3e2723;
    border: none;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-family: var(--font-title);
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.4);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-magic:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 25px rgba(255, 215, 0, 0.6);
}

.story-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.story-btn {
    background: white;
    border: 2px solid #e0d8c3;
    padding: 15px 20px;
    border-radius: 12px;
    font-family: var(--font-text);
    font-size: 1.1rem;
    font-weight: bold;
    color: #4a362e;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.story-btn i {
    color: var(--color-primary-dark);
    font-size: 1.4rem;
}

.story-btn:hover:not(.locked) {
    background: #fffdf5;
    border-color: var(--color-primary);
    transform: translateX(10px);
}

.story-btn.locked {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f5f5f5;
}

/* =========================================
   ESPETÁCULO VISUAL - ENGINE DE EFEITOS
   ========================================= */

/* Efeito Ken Burns (Zoom Lento) */
.art-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform-origin: center;
    animation: kenburns 25s ease-in-out infinite alternate;
}

@keyframes kenburns {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.25) translate(-3%, 3%); }
}

/* Camada de Efeitos Dinâmicos */
.scene-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 10;
    overflow: hidden;
}

/* Filtros Visuais Dinâmicos para multiplicar imagens */
.filter-night { filter: hue-rotate(180deg) brightness(0.4) contrast(1.5) saturate(1.2); }
.filter-desert { filter: sepia(0.8) hue-rotate(-10deg) brightness(1.1) contrast(1.2); }
.filter-water { filter: hue-rotate(200deg) saturate(2.5) brightness(0.9); }
.filter-magic { filter: saturate(1.5) contrast(1.1); }
.filter-dawn { filter: sepia(0.4) hue-rotate(-30deg) brightness(1.2) contrast(1.1) saturate(1.5); }
.filter-fire { filter: sepia(1) hue-rotate(-50deg) saturate(3) brightness(0.8); }

/* Efeito Estrelas */
.effect-stars {
    background-image: 
        radial-gradient(2px 2px at 20px 30px, #fff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 40px 70px, #fff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 50px 160px, #fff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 90px 40px, #fff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 130px 80px, #fff, rgba(0,0,0,0));
    background-size: 200px 200px;
    animation: stars-twinkle 4s infinite alternate, move-stars 100s linear infinite;
    opacity: 0.8;
}

@keyframes stars-twinkle { 0% { opacity: 0.4; } 100% { opacity: 1; } }
@keyframes move-stars { from { transform: translateY(0); } to { transform: translateY(-1000px); } }

/* Efeito Chuva (Dilúvio) */
.effect-rain {
    background-image: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0.4));
    background-size: 2px 50px;
    animation: rain-fall 0.3s linear infinite;
    transform: rotate(15deg) scale(1.5);
    opacity: 0.8;
}

@keyframes rain-fall {
    0% { background-position: 0 0; }
    100% { background-position: 20px 500px; }
}

/* Raios Divinos / Fogo */
.effect-godrays {
    background: radial-gradient(circle at top, rgba(255, 215, 0, 0.4) 0%, transparent 60%);
    animation: pulse-rays 5s infinite alternate;
    mix-blend-mode: overlay;
}

@keyframes pulse-rays { 0% { opacity: 0.3; transform: scale(1); } 100% { opacity: 0.8; transform: scale(1.2); } }

/* Partículas Mágicas (Vagalumes/Fagulhas) */
.magic-particle {
    position: absolute;
    width: 6px; height: 6px;
    background: #FFD700;
    border-radius: 50%;
    box-shadow: 0 0 10px #FFD700, 0 0 20px #FFF;
    animation: float-particle 4s infinite ease-in-out alternate;
}

@keyframes float-particle {
    0% { transform: translateY(0) scale(1); opacity: 0.2; }
    100% { transform: translateY(-50px) scale(1.5); opacity: 1; }
}

/* Pássaros Animados (CSS Sprite SVG) */
.bird {
    position: absolute;
    width: 30px; height: 30px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M22,2.9C21.7,2.8,21.4,2.9,21.2,3l-9.2,4.6L2.8,3C2.6,2.9,2.3,2.8,2,2.9C1.7,3,1.5,3.2,1.5,3.5v1.2c0,0.2,0.1,0.4,0.3,0.5l10.2,5.1l10.2-5.1c0.2-0.1,0.3-0.3,0.3-0.5V3.5C22.5,3.2,22.3,3,22,2.9z"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    animation: fly-bird 10s linear infinite, flap-wings 0.4s infinite alternate;
    opacity: 0.6;
}

@keyframes fly-bird {
    0% { transform: translateX(-50px) translateY(100px) scale(0.5); }
    100% { transform: translateX(500px) translateY(-50px) scale(1.5); }
}

@keyframes flap-wings {
    0% { transform: scaleY(1); }
    100% { transform: scaleY(0.3); }
}

/* Nuvens Flutuantes */
.cloud {
    position: absolute;
    width: 150px; height: 50px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50px;
    filter: blur(10px);
    animation: float-cloud 30s linear infinite;
}

@keyframes float-cloud {
    0% { transform: translateX(-200px); }
    100% { transform: translateX(600px); }
}

@media (max-width: 768px) {
    .book-container {
        flex-direction: column;
        height: 85vh;
        width: 95%;
    }
    .book-container::after { display: none; }
    
    #page-menu.spread {
        flex-direction: column-reverse;
        overflow-y: auto;
    }
    
    #page-story.spread {
        flex-direction: column-reverse;
        overflow-y: auto;
    }
    
    .page-left, .page-right {
        width: 100%;
        height: auto;
        padding: 1.5rem;
        border-right: none;
    }
    .page-right {
        height: 40vh;
        min-height: 250px;
    }
    .narration-box {
        font-size: 1.2rem;
        padding: 1rem;
        min-height: auto;
        margin-bottom: 1rem;
    }
    .story-title {
        font-size: 1.8rem;
    }
    
    .story-btn {
        padding: 10px 15px;
        font-size: 1rem;
    }
    
    .cover-overlay h2 {
        font-size: 2.5rem;
    }
}
