:root {
    --primary: #cba6f7;
    --accent: #f5c2e7;
    --success: #a6e3a1;
    --danger: #f38ba8;
    --bg-dark: #11111b;
}

* {
    box-sizing: border-box;
    user-select: none;
    -webkit-user-drag: none;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-dark);
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

#game-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    height: 100%;
    max-height: 600px;
    background: #000;
    overflow: hidden;
    border: 4px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border-radius: 12px;
}

#forest-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('/assets/forest_bg.png') no-repeat center center;
    background-size: cover;
    filter: brightness(0.8);
}

/* Tree & Impact */
#tree-container {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 400px;
    display: flex;
    justify-content: center;
    align-items: flex-end;
}

#pine-tree {
    width: 250px;
    height: auto;
    transition: transform 0.1s;
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5));
}

.shake {
    animation: shake 0.2s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* Axe */
#axe-container {
    position: absolute;
    bottom: 200px;
    right: 20%;
    width: 100px;
    height: 100px;
    pointer-events: none;
    z-index: 10;
}

#iron-axe {
    width: 80px;
    height: auto;
    transform: scaleX(-1);
    /* Flip to face left */
    transform-origin: bottom left;
    transition: transform 0.1s;
    filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.5));
}

.swing {
    animation: swing 0.3s ease-in-out;
}

@keyframes swing {
    0% {
        transform: scaleX(-1) rotate(0deg);
    }

    40% {
        transform: scaleX(-1) rotate(45deg);
    }

    100% {
        transform: scaleX(-1) rotate(-45deg);
    }
}

/* HUD */
#hud {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#tree-health-bar {
    width: 100%;
    height: 15px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
}

#health-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--danger), #f38ba8);
    transition: width 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#stats {
    display: flex;
    justify-content: space-between;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    font-size: 1.2rem;
}

/* Meter System */
#meter-container {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    text-align: center;
}

#meter-bar {
    position: relative;
    width: 100%;
    height: 30px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 10px;
    backdrop-filter: blur(4px);
}

#sweet-spot {
    position: absolute;
    top: 0;
    height: 100%;
    width: 15%;
    background: rgba(166, 227, 161, 0.4);
    box-shadow: 0 0 15px var(--success);
    border-left: 2px solid var(--success);
    border-right: 2px solid var(--success);
}

#slider {
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: #fff;
    box-shadow: 0 0 10px #fff;
    z-index: 5;
}

#instruction {
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    color: #bac2de;
    letter-spacing: 2px;
    font-size: 0.8rem;
}

/* Splash Overlay */
#overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(17, 17, 27, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: opacity 0.5s;
}

#modal {
    background: #1e1e2e;
    padding: 40px;
    border-radius: 24px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

#modal h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 10px;
}

#modal p {
    color: #bac2de;
    margin-bottom: 30px;
}

#start-btn {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    padding: 15px 40px;
    border-radius: 30px;
    color: #11111b;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.2s;
}

#start-btn:hover {
    transform: scale(1.05);
}

/* VFX */
.chip {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #795548;
    border-radius: 2px;
    pointer-events: none;
}

.float-text {
    position: absolute;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    color: #fff;
    pointer-events: none;
    animation: floatUp 0.8s ease-out forwards;
}

@keyframes floatUp {
    0% {
        transform: translateY(0);
        opacity: 1;
    }

    100% {
        transform: translateY(-50px);
        opacity: 0;
    }
}