/* =========================================== */
/* RESET GERAL E FONTES                        */
/* =========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px; 
}

body {
    font-family: 'MedievalSharp', cursive; /* Fonte principal para títulos */
    color: white;
    overflow: hidden;
    background-color: #000;
}

.hidden {
    display: none !important;
}

/* =========================================== */
/* VÍDEO DE INTRODUÇÃO                         */
/* =========================================== */
#video-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: black;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}
#video-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
#video-container p {
    position: absolute;
    bottom: 5vh;
    font-size: 1rem;
    background-color: rgba(0,0,0,0.6);
    padding: 10px 15px;
    border-radius: 5px;
    text-align: center;
}

/* =========================================== */
/* TELA PRINCIPAL E ÁREA DO JOGO               */
/* =========================================== */
#main-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-image: url('floresta.jpg');
    background-size: cover;
    background-position: center;
    text-align: center;
    padding: 15px;
    transition: background-image 1s ease-in-out;
}

#game-area {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* =========================================== */
/* CENAS DO JOGO                               */
/* =========================================== */
#character-selection {
    width: 100%;
}
#character-selection h1 {
    font-size: clamp(2rem, 10vw, 3rem); 
    text-shadow: 2px 2px 8px #000;
}
.character-options {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}
.character-choice {
    width: 45vw;
    height: 55vw;
    max-width: 180px;
    max-height: 220px;
    object-fit: contain;
    border-radius: 10px;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.3s, border-color 0.3s;
}
.character-choice:hover, .character-choice:active {
    transform: scale(1.05);
    border-color: #fff;
}
#narrative-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 95%;
}
#player-char-img {
    max-height: 35vh;
    width: auto;
    max-width: 80%;
}
#text-box {
    background-color: rgba(0,0,0,0.75);
    border: 1px solid #555;
    padding: 20px;
    border-radius: 10px;
    width: 100%; 
}
#text-box p {
    font-size: 1.2rem;
}
#choice-container {
    background-color: rgba(0,0,0,0.75);
    border: 1px solid #555;
    padding: 25px;
    border-radius: 10px;
    width: 95%;
}
#choice-container h2 {
    margin-bottom: 20px;
    font-size: 1.3rem;
}

/* =========================================== */
/* CENA DA ROSA                                */
/* =========================================== */
@keyframes gentle-float {
    0%   { transform: translateY(0px); }
    50%  { transform: translateY(-20px); }
    100% { transform: translateY(0px); }
}
#rose-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}
#clickable-rose {
    width: 50vw;
    max-width: 200px;
    cursor: pointer;
    margin-bottom: 20px;
    animation: gentle-float 4s ease-in-out infinite;
    transition: transform 0.3s;
}
#clickable-rose:hover {
    transform: scale(1.1) !important;
}
#rose-container p {
    font-size: 1.5rem;
    text-shadow: 2px 2px 8px #000;
    background-color: rgba(0,0,0,0.6);
    padding: 10px;
    border-radius: 5px;
}

/* =========================================== */
/* MODAIS (Nickname, Game Over)                */
/* =========================================== */
#nickname-modal, #game-over-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99;
    text-align: center;
    padding: 15px;
}
.modal-content, .game-over-content {
    background-color: #1a1a1a;
    padding: 25px;
    border-radius: 10px;
    border: 1px solid #444;
    width: 100%;
    max-width: 500px;
}
#nickname-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
#nickname-input {
    font-family: 'MedievalSharp', cursive;
    padding: 12px;
    background: #333;
    border: 1px solid #555;
    color: white;
    font-size: 1.1rem;
    width: 100%;
    border-radius: 5px;
}
.game-over-content h1 { font-size: 2.5rem; color: #b11f1f; }
.game-over-content img { max-width: 150px; margin: 20px 0; }

/* =========================================== */
/* MODAL DO LIVRO ANIMADO                      */
/* =========================================== */
#animated-book-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
}
.book {
    width: 90vw;
    height: 70vh;
    max-width: 800px;
    max-height: 500px;
    display: flex;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.page {
    flex: 1;
    padding: 20px;
    background-color: #fdf5e6;
    color: #4a3e2a;
    overflow-y: auto;
    font-family: 'Lora', serif;
    font-size: clamp(0.8rem, 2.5vw, 1rem);
    line-height: 1.6;
    white-space: pre-wrap;
}
.left-page {
    border-right: 2px solid #d3c8b4;
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
}
.right-page {
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
}
#book-navigation {
    width: 90vw;
    max-width: 800px;
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
}
#page-indicator {
    font-size: 1.1rem;
}

/* =========================================== */
/* >> MELHORIA GERAL DOS BOTÕES <<             */
/* =========================================== */
#nickname-form button,
#text-box button,
#choice-container button,
#book-navigation button,
.game-over-content button {
    font-family: 'MedievalSharp', cursive;
    color: #f0e6d2; /* Cor de pergaminho, mais suave que branco */
    background: linear-gradient(to bottom, #7a5c3d, #5a3e1a); /* Gradiente para dar profundidade */
    border: 2px solid #3a2d1a; /* Borda mais escura e grossa */
    border-radius: 5px;
    padding: 12px 20px;
    font-size: 1.2rem;
    cursor: pointer;
    text-shadow: 1px 1px 2px #3a2d1a; /* Sombra no texto para legibilidade */
    box-shadow: 0 4px 0 #3a2d1a, 0 5px 8px rgba(0,0,0,0.5); /* Efeito 3D "grosso" */
    transition: all 0.1s ease-in-out;
    width: auto; /* Garante que os botões não ocupem 100% da largura a menos que especificado */
    margin-top: 10px;
}

/* Botões de escolha ocupam a largura toda */
#choice-container button {
    width: 100%;
}

/* Efeito ao passar o mouse */
#nickname-form button:hover,
#text-box button:hover,
#choice-container button:hover,
#book-navigation button:hover,
.game-over-content button:hover {
    background: linear-gradient(to bottom, #8b6b4c, #6b4d2a); /* Gradiente mais claro */
}

/* Efeito ao clicar (botão "pressionado") */
#nickname-form button:active,
#text-box button:active,
#choice-container button:active,
#book-navigation button:active,
.game-over-content button:active {
    transform: translateY(2px); /* Desce o botão 2px */
    box-shadow: 0 2px 0 #3a2d1a, 0 3px 5px rgba(0,0,0,0.5); /* Diminui a sombra */
}


/* =========================================== */
/* ANIMAÇÕES E EFEITOS (VERSÃO MELHORADA)      */
/* =========================================== */
@keyframes spell-chaos {
  0%   { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
  15%  { transform: translate(-8px, 5px) rotate(-2deg) scale(1.05); opacity: 0.9; }
  30%  { transform: translate(7px, -9px) rotate(1.5deg) scale(0.98); }
  45%  { transform: translate(-4px, 6px) rotate(-2.5deg) scale(1.1); opacity: 0.85; }
  60%  { transform: translate(10px, -5px) rotate(3deg) scale(0.95); }
  75%  { transform: translate(-8px, 9px) rotate(-1deg) scale(1.08); opacity: 0.95; }
  100% { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
}

@keyframes strobe {
    from { opacity: 0; }
    to { opacity: 0.7; }
}

@keyframes hue-cycle {
    from { filter: hue-rotate(0deg) brightness(1.2); }
    to { filter: hue-rotate(360deg) brightness(1.2); }
}

.spell-in-progress {
    animation: spell-chaos 1.2s infinite cubic-bezier(0.36, 0.07, 0.19, 0.97),
               hue-cycle 4s infinite linear;
}

.long-flash {
    animation: strobe 0.15s infinite alternate;
}

#flash-effect { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background-color: white; 
    z-index: 101; 
    opacity: 0; 
    pointer-events: none;
}