:root {
    --bg-color: #2c3e50;
    --ui-text: #ecf0f1;
    --accent: #e74c3c;
    --pizza-yellow: #f1c40f;
}

body {
    margin: 0;
    padding: 0;
    background-color: #1a1a1a;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
    font-family: 'Press Start 2P', cursive;
    overflow: hidden;
    color: var(--ui-text);
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #1a1a1a;
}

canvas {
    background-color: #34495e;
    /* Floor color */
    display: block;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    /* Essential for pixel art look */
    width: 100vw;
    height: 100vh;
    object-fit: contain;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Let clicks pass through to canvas */
}

/* HUD Redesign */
#hud-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100px;
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    box-sizing: border-box;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(50, 30, 10, 0.8), transparent);
}

.hud-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.hud-label {
    font-size: 10px;
    color: #f1c40f;
    text-shadow: 2px 2px 0 #000;
    margin-bottom: 5px;
    text-align: center;
}

.hud-label-dark {
    font-size: 10px;
    color: #333;
    text-align: center;
    font-weight: bold;
}

/* Health - Marinara Meter */
#bottle-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.4));
    transform-origin: bottom center;
}

#bottle-cap {
    width: 46px;
    /* Wider than container */
    height: 10px;
    background: #ecf0f1;
    /* White Lid */
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    position: relative;
    z-index: 10;
    margin-bottom: -4px;
    /* Slight Overlap */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#bottle-cap::after {
    /* Screw top lines detail */
    content: '';
    position: absolute;
    top: 4px;
    left: 2px;
    right: 2px;
    height: 2px;
    background: #bdc3c7;
    border-radius: 1px;
}



#health-container {
    width: 44px;
    height: 80px;
    background: rgba(255, 255, 255, 0.4);
    /* Glassy body */
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 4px 4px 8px 8px;
    /* Mason Jar Shape */
    /* Bottle shape */
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.4);
}

#health-liquid {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, #c0392b, #e74c3c);
    /* Sauce color */
    transition: height 0.3s ease;
}

#health-glass {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.4) 0%,
            rgba(255, 255, 255, 0) 20%,
            rgba(255, 255, 255, 0) 80%,
            rgba(255, 255, 255, 0.2) 100%);
    /* Glass reflection */
    z-index: 2;
    pointer-events: none;
}

/* Prep Station (Weapons) */
.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.plate-bg {
    width: 60px;
    height: 60px;
    background: #ecf0f1;
    border-radius: 50%;
    border: 2px solid #bdc3c7;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3);
}

.chalkboard-bg {
    width: 60px;
    height: 60px;
    background: #2c3e50;
    border: 3px solid #8e44ad;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3);
}

.level-chalkboard {
    background: #2c3e50;
    border: 2px solid #f1c40f;
    border-radius: 4px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3);
    min-width: 60px;
}

#level-number {
    font-size: 20px;
    color: #f1c40f;
    font-weight: bold;
    text-shadow: 2px 2px 0 #000;
    margin-top: 3px;
}

#weapon-icon,
#special-icon {
    width: 40px;
    height: 40px;
    image-rendering: pixelated;
    object-fit: contain;
}

/* Stats Group */
.wood-meter {
    flex-direction: row;
    align-items: center;
    gap: 5px;
}

.mini-icon {
    width: 32px;
    height: 32px;
}

#legna-bar-container {
    width: 100px;
    height: 10px;
    border: 2px solid #d35400;
    background: #000;
}

#legna-fill {
    width: 0%;
    height: 100%;
    background: #e67e22;
    position: relative;
    transition: box-shadow 0.3s ease;
}

#legna-fill.ready {
    animation: legna-pulse 1s ease-in-out infinite;
    box-shadow: 0 0 20px #ff6600, inset 0 0 20px #ff9900;
}

#legna-fill::after {
    content: attr(data-text);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-weight: bold;
    font-size: 14px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
}

@keyframes legna-pulse {

    0%,
    100% {
        box-shadow: 0 0 20px #ff6600, inset 0 0 20px #ff9900;
        filter: brightness(1);
    }

    50% {
        box-shadow: 0 0 40px #ff3300, inset 0 0 30px #ffaa00;
        filter: brightness(1.3);
    }
}

.receipt-bg {
    background: #fff;
    color: #333;
    padding: 10px;
    border-radius: 2px;
    font-family: 'Courier New', monospace;
    /* Receipt font */
    font-weight: bold;
    transform: rotate(-2deg);
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
    min-width: 80px;
    text-align: center;
}

#score {
    font-size: 16px;
    display: block;
    margin-top: 5px;
}

#splash-screen,
#instructions-screen,
#game-over-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(0, 0, 0, 0.85);
    padding: 40px;
    border: 4px solid var(--pizza-yellow);
    border-radius: 8px;
    pointer-events: auto;
    /* Re-enable clicks for buttons */
    min-width: 400px;
}

#splash-screen {
    background: rgba(0, 0, 0, 0.95);
    padding: 20px;
    border: none;
    border-radius: 12px;
}

#splash-image {
    max-width: 100%;
    height: auto;
    margin-bottom: 20px;
    border-radius: 8px;
}

h1 {
    color: var(--accent);
    text-shadow: 4px 4px 0 #000;
    margin-bottom: 30px;
    font-size: 48px;
    line-height: 1.2;
}

.controls {
    margin-top: 30px;
    font-size: 14px;
    color: #bdc3c7;
    line-height: 1.8;
}

#instructions-screen h3 {
    color: var(--pizza-yellow);
    font-size: 16px;
    margin: 20px 0 10px 0;
    text-shadow: 2px 2px 0 #000;
}

#instructions-screen h3:first-of-type {
    margin-top: 10px;
}

.start-prompt {
    margin-top: 30px !important;
    font-size: 18px !important;
    color: var(--pizza-yellow) !important;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

button {
    background: var(--accent);
    color: white;
    font-family: 'Press Start 2P', cursive;
    font-size: 20px;
    padding: 15px 30px;
    border: none;
    cursor: pointer;
    margin-top: 20px;
    transition: transform 0.1s;
    box-shadow: 0 4px 0 #c0392b;
}

button:active {
    transform: translateY(4px);
    box-shadow: none;
}

.hidden {
    display: none;
}

/* Pastry Collection Box */
#pastry-collection {
    position: absolute;
    top: 110px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    border: 3px solid #DAA520;
    border-radius: 8px;
    padding: 10px;
    pointer-events: none;
    display: none;
    /* Hidden until game starts */
    width: fit-content;
    max-width: 200px;
}

.pastry-title {
    font-size: 10px;
    color: #f1c40f;
    text-align: center;
    text-shadow: 2px 2px 0 #000;
    margin-bottom: 8px;
}

.pastry-grid {
    display: grid;
    grid-template-columns: repeat(4, 40px);
    grid-template-rows: repeat(2, 40px);
    gap: 8px;
}

.pastry-slot {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pastry-icon {
    width: 36px;
    height: 36px;
    image-rendering: pixelated;
    object-fit: contain;
}

.pastry-icon.hidden {
    display: none;
}

/* Pastry Collection Ready State - Glowing when all collected */
#pastry-collection.ready {
    animation: pastry-glow 1s ease-in-out infinite;
    border-color: #FFD700;
}

@keyframes pastry-glow {

    0%,
    100% {
        box-shadow: 0 0 8px #FFD700, inset 0 0 8px rgba(255, 215, 0, 0.2);
        filter: brightness(1);
    }

    50% {
        box-shadow: 0 0 12px #FFD700, inset 0 0 12px rgba(255, 215, 0, 0.3);
        filter: brightness(1.2);
    }
}