@import url('https://fonts.googleapis.com/css2?family=Jersey+15&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Jersey 15", sans-serif;
    font-weight: 400;
    font-style: normal;
}

body {
    /* background-color: #bce3ff; */
    background-image: url('assets/img/fundos/fundo-sky.png');
    background-size: cover;
    background-repeat: repeat-x; /* repetição horizontal */
    
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 15px 30px;

    /* animação das nuvens */
    animation: moverNuvens 60s linear infinite;
}

/* Header do Jogo (Pontuação e Botão Exit) */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 8vh;
}

.score-container {
    display: flex;
    align-items: center;
    font-size: 1.7rem;
    color: #212121;
}

.star-icon {
    font-size: 1.8rem;
    margin-right: 8px;
}

.btn-exit {
    display: inline-block;
    background-color: #ffffff;
    color: #000000;
    text-decoration: none;
    padding: 8px 20px;
    border: 3px solid #000000;
    border-radius: 10px;
    box-shadow: 3px 3px 0px #000000;
    font-size: 1.1rem;

    transition: transform 0.05s, box-shadow 0.05s;
    transition: all 0.3s ease;
}
.btn-exit:hover {
    background-color: #c1dcff;
}

.btn-exit:active {
    transform: translate(3px, 3px);
    box-shadow: 0px 0px 0px #000000;
}

/* informações (andar, .. )*/
.status-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 70%;
    max-width: 850px;
    margin: 15px auto 50px auto;
}

.floor-indicator h2 {
    font-size: 2.2rem;
    color: #333333;
    font-weight: bold;
}


/* Estruturação da Masmorra */
.game-layout {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
}

.container-masmorra {
    /* fundo: */
    /* background-image: url('assets/img/fundos/fundo-masmorra-plain.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat; */
    background-color: #9e9e9e;

    border-top: 10px solid rgb(87, 87, 87);
    border-right: 10px solid rgb(87, 87, 87);
    border-left: 10px solid rgb(87, 87, 87);

    width: 70%;
    max-width: 850px;
    height: 82vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    /* margin: 20px 20px 0 20px; */
    box-shadow: inset 0 0 50px rgba(0,0,0,0.35), 0 10px 20px rgba(0,0,0,0.15);
    position: absolute;
    bottom: 0;
}

.bottom-floor {
    /* fundo */
    /* background-image: url('assets/img/fundos/fundo-masmorra-plain.png');
    background-size: cover;
    background-repeat: no-repeat; */

    border-top: 10px solid rgb(87, 87, 87);
    box-shadow: inset 0 0 50px rgba(0,0,0,0.35), 0 10px 20px rgba(0,0,0,0.15);
    background-color: #8f8f8f;
    width: 100%;
    height: 50px;
}

/* Barra de Tempo (Timer) */
.timer-bar-container {
    width: 100%;
    max-width: 400px;
    height: 25px;
    background-color: #454545;
    border: 3px solid #393939;
    border-radius: 12px;
    margin: 0 auto 20px auto;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.4);
    margin-top: 50px;
}

.timer-bar-fill {
    width: 100%;
    height: 100%;
    background-color: #00e676; /* Verde neon inicial */
    transition: width 0.1s linear, background-color 0.3s ease; /* Transição suave de cor */
    box-shadow: inset 0 3px 6px rgba(255,255,255,0.3); /* Efeito de brilho em cima da barra */
}

/* Zona de Combate Central (Slime + Balão) */
.combat-zone {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.slime-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.elemento-slime {
    width: 340px;
    height: auto;
    image-rendering: pixelated; /* Mantém a nitidez se as imagens forem Pixel Art */
}

/* Balão de Fala da Conta */
.speech-bubble {
    position: absolute;
    background: #ffffff;
    border: 3px solid #212121;
    border-radius: 14px;
    padding: 25px;
    left: 300px;
    top: 80px;
    min-width: 200px;
    text-align: center;
    box-shadow: 4px 4px 0px rgba(0,0,0,0.15);
}

.speech-bubble h2 {
    font-size: 2.3rem;
    color: #000000;
}

/* Seta do Balão de Fala (Borda preta externa e fundo branco interno) */
.speech-bubble::after, .speech-bubble::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 65%;
    transform: translateY(-50%);
    border-style: solid;
    display: block;
    width: 0;
}

.speech-bubble::after {
    border-width: 7px 12px 7px 0;
    border-color: transparent #ffffff transparent transparent;
    z-index: 2;
    left: -11px;
}

.speech-bubble::before {
    border-width: 10px 14px 10px 0;
    border-color: transparent #000000 transparent transparent;
    z-index: 1;
    left: -16px;
}

/* Alternativas de Resposta (Bolinhas) */
.alternatives-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    width: 100%;
    margin-bottom: 35px;
}

.btn-option {
    background-color: #e0e0e0;
    border: 2px solid #6b6b6b;
    color: #000000;
    font-size: 2.3rem;
    width: 85px;
    height: 85px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 5px 6px rgba(0,0,0,0.2);
    outline: none;
    margin-bottom: 80px;

    transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}

.btn-option:hover {
    background-color: #ffffff;
    border-color: #000000;
    transform: scale(1.08);

    transform: scale(1.05) translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    background-color: #f0f0f0;
}

.btn-option:active {
    transform: scale(0.95);
    box-shadow: 0 2px 3px rgba(0,0,0,0.2);

    transform: scale(0.95); /* Dá um feedback tátil de clique */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}


/* =========================================
   NOVAS ADIÇÕES: CARD DO HERÓI COM BARRA DE VIDA INTEGRADA E ANIMAÇÕES
   ========================================= */

/* Card do Herói (Gatinho) */
.hero-card {
    position: absolute;
    bottom: 25px; /* Posicionado acima do bottom-floor */
    left: 20px;
    display: flex;
    align-items: center;
    background-color: rgba(30, 30, 30, 0.9);
    border: 4px solid #5050de;
    border-radius: 8px;
    padding: 10px;
    z-index: 10;
    box-shadow: 4px 4px 0px rgba(0,0,0,0.5);
    gap: 12px;
}

.hero-avatar img {
    width: 64px;
    height: 64px;
    image-rendering: pixelated;
    border: 3px solid #000;
    background-color: #aed581; /* Fundo do avatar */
    border-radius: 6px;
    display: block;
}

.hero-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hero-info h3 {
    color: #ffffff;
    font-size: 1.1rem;
    text-transform: uppercase;
    text-shadow: 2px 2px 0 #000;
    letter-spacing: 1px;
}

/* Estilo da Barra de Vida integrada ao Card */
.health-bar-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hp-label {
    font-weight: bold;
    font-size: 1.1rem;
    color: #ffffff; /* Letra branca para contrastar com o card escuro */
    text-shadow: 1px 1px 0 #000;
    display: flex;
    align-items: center;
    gap: 5px;
}

.health-bar-container {
    width: 140px; /* Reduzido para encaixar perfeitamente no card */
    height: 16px;
    background-color: #4a4a4a;
    border: 2px solid #2c2c2c;
    border-radius: 4px;
    overflow: hidden;
}

.health-bar-fill {
    width: 100%;
    height: 100%;
    background-color: #d53321; /* vermelho inicial */
    transition: width 0.3s ease-in-out, background-color 0.3s;
}

/* Animação de Dano no Card do Herói e Tela */
.damage-animation {
    animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
    filter: sepia(1) hue-rotate(300deg) saturate(5) opacity(0.8); /* Flash de dano vermelho */
}

@keyframes shake {
    10%, 90% { transform: translate3d(-2px, 0, 0); }
    20%, 80% { transform: translate3d(4px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-8px, 0, 0); }
    40%, 60% { transform: translate3d(8px, 0, 0); }
}

/* Textos Flutuantes de Feedback (Substitui os Alerts) */
.feedback-message {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    opacity: 0;
    pointer-events: none;
    z-index: 50;
    text-shadow: 3px 3px 0 #000;
}

.feedback-show {
    animation: popUpFade 0.8s forwards;
}

@keyframes popUpFade {
    0% { opacity: 0; transform: translate(-50%, -30%) scale(0.5); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -70%) scale(0.8); }
}

.text-red { color: #ff5252; }
.text-green { color: #69f0ae; }
.text-gold { color: #ffd700; font-size: 2rem; }

/* =========================================
   ANIMAÇÃO DE IDLE (ESPERA) DO SLIME
   ========================================= */
.elemento-slime {
    /* Define o ponto de origem da animação para a base do slime, para ele não "flutuar" pelo teto */
    transform-origin: bottom center; 
    animation: slimeIdle 2s infinite ease-in-out;
}

@keyframes slimeIdle {
    0%, 100% {
        transform: scale(1) translateY(0);
    }
    50% {
        /* No meio da animação: ele estica um pouco pros lados (1.08), 
           achata um pouco em cima (0.92) e dá um pulinho leve (-8px) */
        transform: scale(1.08, 0.92) translateY(-8px);
    }
}

/* =========================================
   MODAL DE FIM DE JOGO (VITÓRIA E GAME OVER)
   ========================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* Fundo escurecido */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    display: none;
    opacity: 0;
}

.modal-content {
    background-color: #2c2c2c;
    border: 4px solid #5050de;
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    color: white;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 16px rgba(0,0,0,0.8);
    animation: scaleUp 0.3s ease-out forwards;
}

@keyframes scaleUp {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-content h2 {
    font-size: 2.4rem;
    margin-bottom: 30px;
    text-shadow: 2px 2px 0 #000;
}

.modal-content p {
    font-size: 1.4rem;
    margin-bottom: 35px;
    white-space: pre-line; /* Permite quebra de linha com \n no JS */
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.btn-modal {
    padding: 10px 20px;
    font-size: 1.6rem;
    border: 2px solid #000;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
    transition: transform 0.1s, filter 0.2s;
    font-family: inherit;

    transition: all 0.2s ease;
}

.btn-modal:active {
    transform: scale(0.95);
}
.btn-modal:hover {
    filter: brightness(1.2); 

    transform: scale(1.05);
    filter: brightness(1.1);
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.btn-green { background-color: #5c64ff; }
.btn-red { background-color: #605f6f90; }


/* Keyframes da animação de movimento do fundo */
@keyframes moverNuvens {
    from {
        background-position: 0 center;
    }
    to {
        background-position: -2000px center; /* O fundo desliza para a esquerda */
    }
}



/* =============================================
   RESPONSIVIDADE (foi feito pelo claude)
   ============================================= */

/* ── Tablet: ≤ 900px ── */
@media (max-width: 900px) {
    body { padding: 10px 16px; }

    .container-masmorra { width: 88%; }
    .status-panel       { width: 88%; margin-bottom: 30px; }

    .elemento-slime     { width: 260px; }

    /* Balão: diminui um pouco e fica mais próximo do slime */
    .speech-bubble {
        left: 220px;
        top: 60px;
        padding: 18px;
        min-width: 160px;
    }
    .speech-bubble h2   { font-size: 1.9rem; }

    .btn-option         { width: 72px; height: 72px; font-size: 1.9rem; margin-bottom: 50px; }

    .hero-card          { bottom: 18px; left: 14px; padding: 8px; gap: 8px; }
    .hero-avatar img    { width: 52px; height: 52px; }
    .health-bar-container { width: 110px; }
}

/* ── Mobile grande: ≤ 600px ── */
@media (max-width: 600px) {
    body { padding: 8px 8px; }

    .score-container    { font-size: 1.3rem; }
    .star-icon          { font-size: 1.3rem; margin-right: 5px; }
    .btn-exit           { padding: 6px 14px; font-size: 0.95rem; }

    .status-panel       { width: 96%; margin: 8px auto 16px auto; }
    .floor-indicator h2 { font-size: 1.6rem; }

    .container-masmorra { width: 97%; }

    .timer-bar-container { margin-top: 26px; max-width: 80%; height: 20px; }

    .elemento-slime     { width: 180px; }

    /*
     * No mobile o balão de fala fica ACIMA do slime em vez de à direita,
     * porque não há largura suficiente para posicionamento lateral.
     */
    .slime-wrapper      { flex-direction: column-reverse; align-items: center; gap: 12px; }

    .speech-bubble {
        position: relative; /* sai do absolute para não vazar */
        left: auto;
        top: auto;
        min-width: 140px;
        padding: 14px 18px;
        /* Seta aponta para baixo (em direção ao slime) */
    }
    /* Reposiciona a seta do balão para apontar para baixo */
    .speech-bubble::before,
    .speech-bubble::after {
        top: auto;
        left: 50%;
        transform: translateX(-50%);
        bottom: -16px;
        border-width: 14px 10px 0 10px;
    }
    .speech-bubble::before {
        border-color: #000000 transparent transparent transparent;
        bottom: -18px;
        z-index: 1;
    }
    .speech-bubble::after {
        border-color: #ffffff transparent transparent transparent;
        bottom: -14px;
        z-index: 2;
        left: 50%;
    }
    .speech-bubble h2   { font-size: 1.6rem; }

    .alternatives-container { gap: 16px; margin-bottom: 90px; }
    .btn-option {
        width: 68px;
        height: 68px;
        font-size: 1.7rem;
        margin-bottom: 0;
    }

    /* Card do herói menor */
    .hero-card          { bottom: 12px; left: 8px; padding: 6px; gap: 6px; }
    .hero-avatar img    { width: 44px; height: 44px; }
    .hp-label           { font-size: 0.9rem; }
    .health-bar-container { width: 90px; height: 13px; }

    .feedback-message   { font-size: 2.6rem; }
    .text-gold          { font-size: 1.4rem; }

    .modal-content h2   { font-size: 1.8rem; }
    .modal-content p    { font-size: 1.1rem; }
    .btn-modal          { font-size: 1.2rem; padding: 8px 16px; }
}

/* ── Mobile pequeno: ≤ 400px ── */
@media (max-width: 400px) {
    .elemento-slime     { width: 140px; }
    .speech-bubble h2   { font-size: 1.3rem; }

    .btn-option         { width: 58px; height: 58px; font-size: 1.4rem; }
    .alternatives-container { gap: 10px; }

    .hero-avatar img    { width: 36px; height: 36px; }
    .health-bar-container { width: 72px; }

    .score-container    { font-size: 1.1rem; }
    .floor-indicator h2 { font-size: 1.3rem; }
}
