@import url('https://fonts.googleapis.com/css2?family=Righteous&display=swap');

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: #050505;
    overflow: hidden;
    font-family: 'Righteous', sans-serif;
    color: white;
    user-select: none;
}

canvas {
    display: block;
}

/* UI Overlay Layer */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    box-sizing: border-box;
}

/* HUD - Bars */
#hud-top-left {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bar-container {
    width: 100%;
    height: 24px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #444;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
}

.bar-fill {
    height: 100%;
    width: 100%;
    transition: width 0.1s linear;
    /* Faster response */
    position: relative;
}

/* Striped Animation for Bars */
.bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-image: linear-gradient(45deg,
            rgba(255, 255, 255, 0.15) 25%,
            transparent 25%,
            transparent 50%,
            rgba(255, 255, 255, 0.15) 50%,
            rgba(255, 255, 255, 0.15) 75%,
            transparent 75%,
            transparent);
    background-size: 20px 20px;
    animation: move-stripes 1s linear infinite;
}

@keyframes move-stripes {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 20px 0;
    }
}

#hp-fill {
    background: linear-gradient(90deg, #ff0000, #ff4444);
    box-shadow: 0 0 10px #ff0000;
}

#xp-fill {
    background: linear-gradient(90deg, #00bfff, #1e90ff);
    box-shadow: 0 0 10px #00bfff;
    width: 0%;
}

/* Boss Bar */
#boss-bar-container {
    width: 60%;
    height: 30px;
    background: rgba(0, 0, 0, 0.8);
    border: 3px solid #880000;
    border-radius: 15px;
    overflow: hidden;
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    /* Hidden unless boss is alive */
    box-shadow: 0 0 20px #ff0000;
}

#boss-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #880000, #ff0000);
}

#boss-text {
    position: absolute;
    width: 100%;
    text-align: center;
    top: 0;
    line-height: 30px;
    font-size: 18px;
    text-shadow: 2px 2px 0px black;
    z-index: 2;
    letter-spacing: 2px;
    color: #ffd700;
}


.bar-text {
    position: absolute;
    width: 100%;
    text-align: center;
    top: 0;
    line-height: 22px;
    font-size: 14px;
    text-shadow: 1px 1px 2px black;
    z-index: 2;
}

/* Stats & Timer */
.stat-box {
    text-shadow: 2px 2px 0 #000;
    font-size: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: end;
    color: #ffd700;
}

/* Modal Base */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    /* More transparent background */
    display: none;
    /* Hidden by default */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    z-index: 100;
    backdrop-filter: blur(3px);
}

/* Level Up Cards */
#level-up-modal {
    /* No longer full black radial */
    background: radial-gradient(circle, rgba(20, 10, 0, 0.8) 0%, rgba(0, 0, 0, 0.6) 100%);
    overflow: hidden;
}

/* Sunburst Effect Background */
.sunburst {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200vmax;
    height: 200vmax;
    background: repeating-conic-gradient(from 0deg,
            rgba(255, 215, 0, 0.05) 0deg,
            /* Lower opacity */
            rgba(255, 215, 0, 0.05) 15deg,
            transparent 15deg,
            transparent 30deg);
    transform: translate(-50%, -50%);
    animation: rotate-burst 20s linear infinite;
    z-index: -1;
    pointer-events: none;
}

@keyframes rotate-burst {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Chest Animation */
#fryer-basket {
    font-size: 8rem;
    animation: basket-drop 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    filter: drop-shadow(0 0 20px gold);
    z-index: 15;
    margin-bottom: 20px;
}

@keyframes basket-drop {
    0% {
        transform: translateY(-500px) rotate(10deg);
        opacity: 0;
    }

    60% {
        transform: translateY(20px) rotate(-5deg);
        opacity: 1;
    }

    80% {
        transform: translateY(-10px) rotate(2deg);
    }

    100% {
        transform: translateY(0) rotate(0);
    }
}

#level-up-modal h1 {
    color: #ffd700;
    font-size: 4rem;
    margin-bottom: 20px;
    text-shadow: 0 0 30px #ffd700, 0 0 10px #ff8800;
    animation: bounce-text 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10;
}

@keyframes bounce-text {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    60% {
        transform: scale(1.2);
        opacity: 1;
    }

    100% {
        transform: scale(1);
    }
}

.card-container {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    z-index: 10;
    perspective: 1000px;
}

.upgrade-card {
    background: linear-gradient(135deg, #2a2a2a, #111);
    border: 3px solid #444;
    padding: 20px;
    width: 200px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;

    /* Animation setup - Pop out of chest */
    opacity: 0;
    transform: translateY(100px) scale(0.5);
    animation: card-pop 0.5s forwards cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Staggered animation delays for 3 cards */
.upgrade-card:nth-child(1) {
    animation-delay: 0.5s;
}

.upgrade-card:nth-child(2) {
    animation-delay: 0.7s;
}

.upgrade-card:nth-child(3) {
    animation-delay: 0.9s;
}

@keyframes card-pop {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.upgrade-card:hover {
    transform: translateY(-15px) scale(1.05) !important;
    border-color: #ffd700;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.4);
    background: linear-gradient(135deg, #444, #222);
    z-index: 20;
}

.upgrade-icon {
    font-size: 3.5rem;
    margin: 10px 0;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
}

/* Evolved Card Style */
.upgrade-card.evolved {
    border-color: #ff00ff;
    box-shadow: 0 0 50px rgba(255, 0, 255, 0.5);
    background: linear-gradient(135deg, #400040, #100010);
}

.upgrade-card.evolved .card-title {
    color: #ff00ff;
}

.card-title {
    color: #00ffff;
    font-size: 1.3rem;
    margin-bottom: 5px;
    line-height: 1.2;
}

.card-type {
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: bold;
}

.card-desc {
    color: #ccc;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Start Screen Styling */
#start-overlay {
    background: radial-gradient(circle at center, #221100 0%, #050505 100%);
    overflow: hidden;
}

/* Floating background potatoes */
.bg-potato {
    position: absolute;
    font-size: 2rem;
    opacity: 0.1;
    animation: floatUp 10s linear infinite;
    z-index: -1;
}

@keyframes floatUp {
    from {
        transform: translateY(110vh) rotate(0deg);
    }

    to {
        transform: translateY(-10vh) rotate(360deg);
    }
}

.title-wrapper h1 {
    color: #ffcc00;
    font-size: 6rem;
    margin: 0;
    text-shadow:
        0 0 10px #ff6600,
        0 0 20px #ff0000,
        4px 4px 0px #331100;
    animation: heat-wave 2s infinite ease-in-out;
}

@keyframes heat-wave {

    0%,
    100% {
        transform: scale(1);
        filter: brightness(1);
    }

    50% {
        transform: scale(1.05);
        filter: brightness(1.2);
    }
}

/* Pause & Game Over */
.menu-btn,
.restart-btn {
    background: linear-gradient(to bottom, #ff8800, #cc4400);
    color: white;
    border: 3px solid #ffcc00;
    padding: 15px 50px;
    font-size: 1.8rem;
    font-family: 'Righteous', sans-serif;
    margin-top: 20px;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.2s;
    text-transform: uppercase;
    box-shadow: 0 10px 0 #882200, 0 10px 20px rgba(0, 0, 0, 0.5);
}

.menu-btn:hover,
.restart-btn:hover {
    transform: translateY(5px);
    box-shadow: 0 5px 0 #882200, 0 5px 10px rgba(0, 0, 0, 0.5);
    background: linear-gradient(to bottom, #ffaa00, #ee5500);
}

.menu-btn:active,
.restart-btn:active {
    transform: translateY(10px);
    box-shadow: none;
}

#pause-btn {
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.8);
    font-family: 'Righteous';
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: 0.2s;
}

#pause-btn:hover {
    background: rgba(255, 255, 255, 0.8);
    color: black;
}

/* Win Screen */
#win-screen {
    background: radial-gradient(circle, #222200 0%, #000 100%);
    z-index: 200;
}

#win-screen h1 {
    color: #ffd700;
    font-size: 5rem;
    text-shadow: 0 0 40px gold;
    animation: pulse 1s infinite alternate;
}