@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600&family=Quicksand:wght@400;600&display=swap');

:root {
    --forest-dark: #0b1510;
    --moss-glow: #7CFF9B;
    --moss-soft: #4CAF6A;
    --text-main: #E6F2EA;
    --accent-gold: #C8B560;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(
        circle at top,
        #13261c 0%,
        var(--forest-dark) 60%
    );
    font-family: 'Quicksand', sans-serif;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 20, 10, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.overlay-content {
    text-align: center;
    padding: 40px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #7cff9e;
    box-shadow: 0 0 20px #7cff9e,
                0 0 40px rgba(124, 255, 158, 0.4);
    position: relative;
    z-index: 10000;
}

.overlay-hidden {
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
}

.hidden {
    display: none;
}

.game-title {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: #7cff9e;
    text-shadow: 0 0 10px #7cff9e,
                0 0 20px #7cff9e;
}

.game-tagline {
    margin-bottom: 25px;
    color: #d8ffe7;
    font-size: 1.1rem;
}

#start-game-btn {
    padding: 12px 25px;
    font-size: 1rem;
    background: transparent;
    color: #7cff9e;
    border: 2px solid #7cff9e;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 0 10px #7cff9e;
    transition: all 0.3s ease;
}

#start-game-btn:hover {
    background: #7cff9e;
    color: black;
    box-shadow: 0 0 20px #7cff9e;
}

.landing,
.game-container {
    background: rgba(15, 30, 22, 0.7);
    border: 2px solid rgba(124, 255, 155, 0.3);
    box-shadow:
        0 0 25px rgba(124, 255, 155, 0.15),
        inset 0 0 20px rgba(124, 255, 155, 0.05);
    border-radius: 20px;
    padding: 40px;
    max-width: 600px;
    text-align: center;
    position: relative;
    z-index: 1;
}

h1 {
    font-family: 'Cinzel', serif;
    font-size: 2.8rem;
    margin-bottom: 20px;
    color: var(--moss-glow);
    text-shadow:
        0 0 8px rgba(124, 255, 155, 0.8),
        0 0 20px rgba(124, 255, 155, 0.4);
}

p {
    font-size: 1.15rem;
    line-height: 1.6;
    color: var(--text-main);
}

.begin-btn,
.action-btn {
    display: inline-block;
    margin-top: 30px;
    padding: 14px 32px;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'Quicksand', sans-serif;
    color: #0b1510;
    background: linear-gradient(135deg, var(--moss-glow), var(--moss-soft));
    border: none;
    border-radius: 999px;
    cursor: pointer;
    box-shadow:
        0 0 15px rgba(124, 255, 155, 0.6),
        0 0 30px rgba(124, 255, 155, 0.3);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    text-decoration: none;
}

.begin-btn:hover,
.action-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow:
        0 0 25px rgba(124, 255, 155, 0.9),
        0 0 45px rgba(124, 255, 155, 0.5);
}

.action-btn {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.action-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 0 12px rgba(120, 255, 180, 0.6);
}

.action-btn:active {
    transform: translateY(0);
    box-shadow: 0 0 6px rgba(120, 255, 180, 0.4);
}

.stats {
    font-size: 0.95rem;
    color: #cfe8d5;
    margin-bottom: 20px;
    padding: 10px 16px;
    border-radius: 12px;
    background: rgba(10, 25, 18, 0.6);
    border: 1px solid rgba(140, 255, 200, 0.25);
    box-shadow:
        0 0 10px rgba(120, 255, 180, 0.15),
        inset 0 0 8px rgba(120, 255, 180, 0.08);
    text-shadow: 0 0 6px rgba(140, 255, 200, 0.4);
    display: inline-block;
}

.stats span.blessed {
    color: #ffe6a8;
    text-shadow: 0 0 8px rgba(255, 230, 168, 0.8);
}

.fireflies {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.fireflies span {
    position: absolute;
    width: 6px;
    height: 6px;
    background: rgba(124, 255, 155, 0.9);
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(124, 255, 155, 0.8),
                0 0 12px rgba(124, 255, 155, 0.6);
    animation: float 12s linear infinite, blink 4s ease-in-out infinite;
}

.fireflies span:nth-child(1) { top: 20%; left: 10%; animation-delay: 0s }
.fireflies span:nth-child(2) { top: 60%; left: 20%; animation-delay: 2s }
.fireflies span:nth-child(3) { top: 40%; left: 70%; animation-delay: 4s }
.fireflies span:nth-child(4) { top: 80%; left: 50%; animation-delay: 1s }
.fireflies span:nth-child(5) { top: 30%; left: 85%; animation-delay: 3s }
.fireflies span:nth-child(6) { top: 70%; left: 75%; animation-delay: 5s }
.fireflies span:nth-child(7) { top: 15%; left: 55%; animation-delay: 6s }
.fireflies span:nth-child(8) { top: 50%; left: 40%; animation-delay: 2.5s }
.fireflies span:nth-child(9) { top: 90%; left: 15%; animation-delay: 4.5s }
.fireflies span:nth-child(10) { top: 10%; left: 90%; animation-delay: 1.5s }

@keyframes float {
    0% {
        transform: translateY(0) translateX(0);
    }
    50% {
        transform: translateY(-40px) translateX(20px);
    }
    100% {
        transform: translateY(0) translateX(0);
    }
}

@keyframes blink {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 1; }
}

.character-area {
    margin: 20px 0;
    text-align: center;
    position: relative;
}

.fairy-sprite {
    width: 140px;
    height: auto;
    display: block;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.fairy-wrapper {
    display: inline-block;
}

@keyframes fairyBob {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
    100% { transform: translateY(0px); }
}

.blessed {
    animation: fairyFloat 2s ease-in-out infinite;
}

.fairy--blessed .fairy-sprite {
    filter: drop-shadow(0 0 12px #7cff9e)
            drop-shadow(0 0 22px #7cff9e);
}

@keyframes fairyFloat {
    0% { transform: translateX(0px); }
    50% { transform: translateX(8px); }
    100% { transform: translateX(0px); }
}

@keyframes fairyShake {
    0% { transform: translateX(0px); }
    25% { transform: translateX(-2px); }
    50% { transform: translateX(2px); }
    75% { transform: translateX(-2px); }
    100% { transform: translateX(0px); }
}

.fairy--angry {
    filter: drop-shadow(0 0 12px #ff4d4d);
    animation: fairyBob 3s ease-in-out infinite,
                fairyShake 0.4s infinite;
}

.bob {
    animation: bob 3s ease-in-out infinite;
}

@keyframes bob {
    0% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
    100% { transform: translateY(0); }
}

.sway {
    animation: sway 2s ease-in-out infinite;
}

@keyframes sway {
    0% { transform: translateX(0); }
    50% { transform: translateX(6px); }
    100% { transform: translateX(0); }
}

.wizard-wrapper {
    position: relative;
    display: inline-block;
    margin: 20px auto;
}

.wizard-sprite {
    width: 120px;
    image-rendering: pixelated;
    animation: bob 3s ease-in-out infinite;
}

.wizard-wrapper--blessed .wizard-sprite {
    filter: drop-shadow(0 0 8px #9cffb4) drop-shadow(0 0 18px #5bd96b);
}

.wizard-wrapper--angry .wizard-sprite {
    filter: drop-shadow(0 0 8px #ff6b6b) drop-shadow(0 0 18px #ff2e2e);
    animation: bob 3s ease-in-out infinite, fairyShake 0.4s infinite alternate;
}

.wizard-wrapper--blessed::after {
    content: "";
    position: absolute;
    top: 40%;
    left: 60%;
    width: 25px;
    height: 25px;
    background: radial-gradient(circle, #9cffb4 0%, transparent 70%);
    border-radius: 50%;
    animation: staffGlow 2.5s infinite ease-in-out;
}

.wizard-wrapper--healing::after {
    background: radial-gradient(circle, white 0%, transparent 70%);
}

@keyframes staffGlow {
    0%,100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.3); }
}

.wizard-wrapper--healing .wizard-sprite{
    filter: drop-shadow(0 0 12px white)
            drop-shadow(0 0 28px white)
            brightness(1.2) !important;

    animation: bob 3s ease-in-out infinite, pulseGlow 1.5s ease-in-out infinite;
}

@keyframes pulseGlow {
    0% {
        filter: drop-shadow(0 0 10px white)
                drop-shadow(0 0 20px white)
                brightness(1.1);
    }
    50% {
        filter: drop-shadow(0 0 20px white)
                drop-shadow(0 0 40px white)
                brightness(1.3);
    }
    100% {
        filter: drop-shadow(0 0 10px white)
                drop-shadow(0 0 20px white)
                brightness(1.1);
    }
}

.dialogue-box {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(200, 255, 200, 0.4);
    border-radius: 14px;
    padding: 16px;
    margin-top: 20px;
    width: 100%;
    max-width: 500px;
    overflow: visible;
    z-index: 10;
}

.dialogue-box--angry {
    border-color: #ff5c5c;
    box-shadow: 0 0 12px #ff5c5c;
    color: #ffdede;
}

.dialogue-box--blessed {
    border-color: #8affc1;
    box-shadow: 0 0 12px #8affc1;
}

.dialogue-box--blessed .dialogue-btn:hover {
    background: rgba(150, 255, 150, 0.25);
}

.blessed img {
    filter: drop-shadow(0 0 10px #7cffb2)
            drop-shadow(0 0 20px #7cffb2);
}

.typewriter {
    display: block;
    margin-bottom: 12px;
}

.typewriter::after {
    content: "|";
    margin-left: 3px;
    animation: blink 1s infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

.sparkles {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.sparkles span {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #d8fff3;
    border-radius: 50%;
    box-shadow: 0 0 8px #9fffe0;
    animation: sparkleFloat 3s linear infinite;
    opacity: 0;
}

@keyframes sparkleFloat {
    0% {
        transform: translateY(20px) scale(0.5);
        opacity: 0;
    }
    30% {
        opacity: 1;
    }
    100% {
        transform: translateY(-60px) scale(1.2);
        opacity: 0;
    }
}

.wizard-sparkles span {
    position: absolute;
    width: 6px;
    height: 6px;
    background: rgba(140, 200, 140, 0.8);
    box-shadow: 0 0 6px rgba(140, 200, 140, 0.9);
    transform: rotate(45deg);
    animation: wizardSparkle 3s ease-out forwards;
}

.wizard-sparkles--healing span {
    background: white;
    box-shadow: 0 0 10px white;
    animation-duration: 1.5s;
}

@keyframes wizardSparkle {
    0% {
        opacity: 0;
        transform: translateY(10px) rotate(45deg);
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateY(-40px) rotate(45deg);
    }
}

.dialogue-choices {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    position: relative;
    z-index: 5;
}

.dialogue-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(200, 255, 200, 0.4);
    color: #eaffea;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 0.9rem;
    backdrop-filter: blur(4px);
}

.dialogue-btn:hover {
    background: rgba(150, 255, 150, 0.25);
    transform: translateY(-2px);
}

.dialogue-box--angry .dialogue-btn:hover {
    background: rgba(255, 120, 120, 0.25) !important;
}

#fade-overlay {
    position: fixed;
    inset: 0;
    background: black;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease-in-out;
    z-index: 9999;
}

#fade-overlay.active {
    opacity: 1;
}

.werewolf-sprite {
    width: 160px;
    image-rendering: pixelated;
}

.werewolf-wrapper {
    margin: 20px auto;
    position: relative;
    display: inline-block;
}

@keyframes werewolfPace {
    0% { transform: translateX(-6px); }
    50% { transform: translateX(6px); }
    100% { transform: translateX(-6px); }
}

.werewolf-pacing {
    animation: werewolfPace 1.8s ease-in-out infinite;
}

.werewolf-angry {
    animation: wolfGlow 0.8s ease-in-out infinite alternate,
               wolfBreath 1.2s ease-in-out infinite;
}

.werewolf-warning {
    filter: drop-shadow(0 0 8px rgba(255, 180, 60, 0.8));
}


@keyframes wolfGlow {
    from {
        filter: drop-shadow(0 0 6px rgba(255, 0, 0, 0.6));
    }
    to {
        filter: drop-shadow(0 0 16px rgba(255, 0, 0, 1));
    }
}

@keyframes wolfBreath {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

@keyframes wolfHit {
    0% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    50% { transform: translateX(6px); }
    75% { transform: translateX(-4px); }
    100% { transform: translateX(0); }
}

.werewolf-hit {
    animation: 
        wolfGlow 0.8s ease-in-out infinite alternate,
        wolfBreath 1.2s ease-in-out infinite,
        wolfHit 0.25s ease;
}

@keyframes wolfDefeat {
    0% { transform: rotate(0deg) scale(1); opacity:1; }
    40% { transform: rotate(-20deg) scale(0.95); }
    100% { transform: rotate(-90deg) scale(0.7); opacity:0.5; }
}

.werewolf-defeated {
    animation: wolfDefeat 1s ease forwards;
    filter: grayscale(80%);
}

.hp-bar-container {
    width: 220px;
    margin: 10px auto 15px;
    text-align: center;
}

.hp-bar {
    width: 100%;
    height: 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    overflow: hidden;
    margin: 5px auto;
    box-shadow: inset 0 0 6px rgba(0,0,0,0.6);
}

.hp-fill {
    height: 100%;
    transition: width 0.4s ease;
}

.hp-text {
    font-size: 0.85rem;
    margin-top: 4px;
    color: #ffdede;
    text-shadow: 0 0 6px rgba(255, 100, 100, 0.5);
}

@keyframes hpFlash {
    0% {
        filter: brightness(2.5);
        box-shadow: 0 0 14px rgba(255, 50, 50, 1);
    }
    100% {
        filter: brightness(1);
        box-shadow: 0 0 8px rgba(255, 60, 60, 0.6);
    }
}

@keyframes hpShake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    50% { transform: translateX(4px); }
    75% { transform: translateX(-3px); }
    100% { transform: translateX(0); }
}

.ambient-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;

    background: radial-gradient(
        circle at 50% 50%,
        rgba(124, 255, 155, 0.18) 0%,
        rgba(124, 255, 155, 0.08) 30%,
        rgba(124, 255, 155, 0.02) 55%,
        transparent 75%
    );

    animation: forestPulse 4s ease-in-out infinite;
}

@keyframes forestPulse {
    0% {
        opacity: 0.6;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    100% {
        opacity: 0.6;
        transform: scale(1);
    }
}

.troll-sprite {
    width: 180px;
    image-rendering: pixelated;
    animation: bob 3s ease-in-out infinite;
}

.troll-wrapper {
    margin: 20px auto;
}

.troll-warning {
    filter: drop-shadow(0 0 10px rgba(255, 180, 60, 0.8));
}

@keyframes trollGlow {
    from {
        filter: drop-shadow(0 0 6px rgba(255, 120, 0, 0.6));
    }
    to {
        filter: drop-shadow(0 0 16px rgba(255, 140, 0, 1));
    }
}

.troll-angry {
    animation: trollGlow 0.8s ease-in-out infinite alternate,
               wolfBreath 1.2s ease-in-out infinite;
}

.troll-hit {
    animation:
        trollGlow 0.8s ease-in-out infinite alternate,
        wolfBreath 1.2s ease-in-out infinite,
        wolfHit 0.25s ease;
}

@keyframes trollDefeat {
    0% { transform: rotate(0deg) scale(1); opacity:1; }
    40% { transform: rotate(-15deg) scale(0.95); }
    100% { transform: rotate(-85deg) scale(0.7); opacity:0.5; }
}

.troll-defeated {
    animation: trollDefeat 1s ease forwards;
    filter: grayscale(80%);
}

.player-hp {
    margin-bottom: 10px;
    font-size: 14px;
    color: #ffdddd;
}

.enemy-name {
    margin-top: 10px;
    font-weight: bold;
    text-align: center;
}

.player-fill {
    background: linear-gradient(to right, #4caf50, #81c784);
}

.enemy-fill {
    background: linear-gradient(to right, #e53935, #ef5350);
}

.player-wrapper {
    text-align: center;
    margin-top: 10px;
}

.player-sprite {
    width: 120px;
    image-rendering: pixelated;
    filter: drop-shadow(0 0 6px rgba(120, 255, 180, 0.4));
    animation: floatIdle 3s ease-in-out infinite;
}

@keyframes floatIdle {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-4px); }
    100% { transform: translateY(0px); }
}

.hp-hit {
    animation: hpFlash 0.25s ease, hpShake 0.25s ease;
}

.player-sprite-container {
    display: flex;
    justify-content: center;
    margin: 10px 0;
}

@keyframes playerPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes playerHitShake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    50% { transform: translateX(4px); }
    75% { transform: translateX(-4px); }
    100% { transform: translateX(0); }
}

.player-hit {
    animation: floatIdle 3s ease-in-out infinite, playerPulse 0.3s ease, playerHitShake 0.3s ease;
    filter: drop-shadow(0 0 12px rgba(120, 255, 180, 0.8))
        drop-shadow(0 0 25px rgba(120, 255, 180, 0.6))
        brightness(1.4)
        saturate(1.3);
}

@keyframes playerDefeat {
    0% { transform: rotate(0deg) scale(1); opacity: 1; }
    40% { transform: rotate(-15deg) scale(0.95); }
    100% { transform: rotate(-90deg) scale(0.7); opacity: 0.5; }
}

.player-defeated {
    animation: playerDefeat 1s ease forwards;
    filter: grayscale(80%);
}

.player--celebration {
    animation: playerCelebrate 1.2s ease-in-out infinite;
    filter: drop-shadow(0 0 12px #7cff9e)
            drop-shadow(0 0 30px #ffffff)
            brightness(1.3);
}

@keyframes playerCelebrate {
    0%   { transform: scale(1) translateY(0); }
    50%  { transform: scale(1.08) translateY(-6px); }
    100% { transform: scale(1) translateY(0); }
}

.player-sparkles span {
    background: #ffffff;
    box-shadow: 0 0 10px #7cff9e;
}

body.ending {
        background: radial-gradient(circle at top, #111 0%, #000 70%);
}

body.ending .game-container {
    border: 2px solid rgba(180, 180, 180, 0.25);
    box-shadow: 0 0 20px rgba(200, 200, 200, 0.1), inset 0 0 15px rgba(255, 255, 255, 0.03);
}

body.ending p, 
body.ending .stats {
    color: #ccc;
    text-shadow: none;
}

body.ending .action-btn {
    background: linear-gradient(135deg, #666, #444);
    color: #eee;
    box-shadow: 0 0 10px rgba(200, 200, 200, 0.2);
}

body.ending .action-btn:hover {
    background: #888;
    color: black;
}

body.ending .ambient-glow {
    display: none;
}

body.ending .fireflies span {
    background: rgba(200, 200, 200, 0.3);
    box-shadow: none;
}

body.ending .sparkles span {
    background: rgba(220, 220, 220, 0.4);
    box-shadow: 0 0 6px rgba(200, 200, 200, 0.2);
}

body.ending img {
    filter: grayscale(60%) brightness(0.8);
}