@import url('https://fonts.googleapis.com/css2?family=Bubblegum+Sans&family=Fredoka+One&display=swap');

:root {
    --bg-color: #f5f5f0;
    --accent-color: #e67e22; /* More vibrant orange */
    --meter-bg: rgba(0, 0, 0, 0.2);
    --meter-fill: #00ff88; /* Vibrant green to contrast with warm background */
    --text-color: #2c3e50; /* Dark navy/charcoal instead of brownish */
    --bubble-border: #e67e22;
    --title-font: 'Bubblegum Sans', cursive;
    --btn-font: 'Fredoka One', cursive;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    overflow: hidden;
    user-select: none;
}

.hidden {
    display: none !important;
}

#start-screen, #game-screen, #end-screen {
    width: 100vw;
    height: 100vh;
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: fadeInUp 0.8s ease-out;
}

#start-screen {
    background-image: url('./assets/start-bg.webp');
}

#game-screen {
    background-image: url('./assets/game-bg.webp');
}

#end-screen {
    background-image: url('./assets/end-bg.webp');
}

#start-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: none;
    padding: 40px;
    border-radius: 30px;
}

#start-title {
    font-family: var(--title-font);
    font-size: 80px;
    color: white;
    line-height: 1.1;
    margin-bottom: 40px;
    text-shadow: 
        4px 4px 0px #e67e22,
        -2px -2px 0px #e67e22,
        2px -2px 0px #e67e22,
        -2px 2px 0px #e67e22,
        0px 8px 15px rgba(0, 0, 0, 0.3);
    letter-spacing: 2px;
}

#start-button {
    font-family: var(--btn-font);
    background: #e67e22;
    color: white;
    border: 4px solid white;
    padding: 20px 60px;
    font-size: 32px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
    box-shadow: 0 8px 0 #d35400, 0 15px 25px rgba(0,0,0,0.2);
    animation: pulse 2s infinite ease-in-out;
    letter-spacing: 1px;
}

#start-button:hover {
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 12px 0 #d35400, 0 20px 30px rgba(0,0,0,0.25);
}

#start-button:active {
    transform: scale(0.95) translateY(5px);
    box-shadow: 0 2px 0 #d35400, 0 5px 10px rgba(0,0,0,0.2);
}

@media (max-width: 600px) {
    #start-title {
        font-size: 50px;
    }
    #start-button {
        padding: 15px 40px;
        font-size: 24px;
    }
}

#end-ganesha-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#end-ganesha {
    width: 400px;
    height: auto;
}

#end-speech-bubble {
    position: absolute;
    top: -60px;
    right: -100px;
    background: white;
    padding: 20px 30px;
    border-radius: 30px;
    border: 5px solid var(--accent-color);
    font-family: var(--title-font);
    font-size: 22px;
    color: var(--accent-color);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    animation: bubbleWobble 1.2s ease-in-out infinite;
    transform-origin: bottom left;
}

@keyframes bubbleWobble {
    0%, 100% { transform: rotate(-2deg) scale(1); }
    25% { transform: rotate(2deg) scale(1.04); }
    50% { transform: rotate(-1deg) scale(1.07); }
    75% { transform: rotate(2.5deg) scale(1.03); }
}

#end-speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 40px;
    border-width: 20px 20px 0;
    border-style: solid;
    border-color: white transparent transparent;
}

#end-speech-bubble::before {
    content: '';
    position: absolute;
    bottom: -23px;
    left: 39px;
    border-width: 21px 21px 0;
    border-style: solid;
    border-color: var(--accent-color) transparent transparent;
}

#game-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 20px;
}

/* Hunger Meter */
#meter-container {
    position: absolute;
    top: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 100;
}

#meter-label {
    font-size: 25px;
    font-weight: 900;
    letter-spacing: 2px;
    justify-self: center;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

#meter-bar {
    width: 350px;
    height: 30px;
    background-color: var(--meter-bg);
    border-radius: 11px;
    overflow: hidden;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.3);
    border: 2px solid rgba(255,255,255,0.3);
}

#meter-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #00ff88, #00ffee);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.6);
}

.meter-bump {
    animation: meterPulse 0.3s ease-out;
}

/* Dialogue Box */
#dialogue-box {
    position: absolute;
    top: 60px;
    left: -150px;
    background: white;
    padding: 15px 25px;
    border-radius: 25px;
    border: 3px solid var(--accent-color);
    color: var(--text-color);
    font-weight: 800;
    font-size: 20px;
    opacity: 0;
    transform: translateY(10px) scale(0.8);
    transition: opacity 0.4s, transform 0.4s;
    z-index: 100;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    min-width: 180px;
    text-align: center;
    pointer-events: none;
}

#dialogue-box::after {
    content: '';
    position: absolute;
    bottom: 20px;
    right: -18px;
    border-width: 15px 0 15px 20px;
    border-style: solid;
    border-color: transparent transparent transparent white;
}

#dialogue-box::before {
    content: '';
    position: absolute;
    bottom: 18px;
    right: -23px;
    border-width: 17px 0 17px 23px;
    border-style: solid;
    border-color: transparent transparent transparent var(--accent-color);
}

#dialogue-box.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Main Layout */
#main-layout {
    width: 100%;
    max-width: 1600px;
    height: 80%;
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr;
    align-items: center;
    gap: 40px;
}

/* Left: Food Selection */
#food-selection {
    display: flex;
    flex-direction: column;
    /* gap: 5px; */
    padding-left: 60px;
}

.food-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* gap: 8px; */
    cursor: pointer;
    transition: transform 0.2s;
    animation: float 4s infinite ease-in-out;
}

.food-item:nth-child(2n) {
    animation-delay: 0.5s;
}

.food-item:nth-child(3n) {
    animation-delay: 1s;
}

.food-item:hover {
    transform: scale(1.1);
}

.food-item:active {
    transform: scale(0.95);
    animation: pop 0.2s ease-out;
}

@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.food-item img {
    width: 150px;
    height: auto;
    margin-bottom: 45px;
    object-fit: contain;
}

.food-item span {
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    color: var(--text-color);
    letter-spacing: 1px;
}

/* Center: Plate */
#plate-container {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;

    margin-top: 200px;   /* adjust this value */
}

#plate {
    width: 300px;
    height: 120px;
    background-color: #fffdfa;
    border-radius: 50%;
    position: relative;
    box-shadow: 
        0 10px 0 #e6e0d4,
        0 20px 40px rgba(0,0,0,0.12);
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid #f0e6d2;
}

#plate::before {
    content: '';
    position: absolute;
    width: 85%;
    height: 75%;
    background-color: rgba(230, 126, 34, 0.05);
    border: 1px solid rgba(230, 126, 34, 0.1);
    border-radius: 50%;
}

.accumulated-food {
    position: absolute;
    width: 150px;
    height: 150px;
    object-fit: contain;
    pointer-events: none;
}

/* Right: Ganesha */
#ganesha-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-right: 60px;
    position: relative;
}

#ganesha {
    width: 400px;
    height: auto;
    transition: transform 0.5s ease-in-out;
}

.ganesha-idle {
    animation: breathe 3s ease-in-out infinite;
}

.ganesha-eating {
    /* animation: eat 0.8s ease-in-out infinite; */
    animation: breathe 3s ease-in-out infinite;
}

.ganesha-final {
    transform: rotate(-5deg) scale(1.02);
}

@keyframes breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes eat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05) translateY(-10px); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

#tap-hint {
    position: absolute;
    top: 125px;
    font-family: var(--title-font);
    font-size: 20px;
    color: #ffe0a0;
    background: rgba(80, 45, 10, 0.55);
    border: 2px dashed #d4a04a;
    border-radius: 20px;
    padding: 7px 22px;
    letter-spacing: 1px;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.4);
    animation: pulse 2.5s infinite ease-in-out;
    z-index: 100;
}

/* Arc Animation */
.flying-food {
    position: fixed;
    width: 150px;
    height: 150px;
    object-fit: contain;
    pointer-events: none;
    z-index: 1000;
}

/* End Message removed as per new structure */
/* Game Over state */
.game-over .food-item {
    cursor: default;
    pointer-events: none;
    opacity: 0.7;
}
