* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Sans MS', cursive, sans-serif;
    background: linear-gradient(135deg, #2c1810, #4a2c17);
    color: #f4e4bc;
    overflow-x: hidden;
}

#game-container {
    min-height: 100vh;
    position: relative;
}

/* Header Styles */
#game-header {
    background: linear-gradient(45deg, #1a0f08, #3d251a);
    padding: 1rem;
    border-bottom: 3px solid #8b4513;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

#game-header h1 {
    text-align: center;
    font-size: 2rem;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    margin-bottom: 0.5rem;
}

#game-stats {
    display: flex;
    justify-content: space-around;
    font-size: 1.2rem;
    font-weight: bold;
}

#game-stats > div {
    background: rgba(139, 69, 19, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 10px;
    border: 2px solid #8b4513;
}

/* Main Game Area - Offset to avoid UI overlap */
#game-area {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    grid-template-rows: auto auto;
    gap: 1rem;
    padding: 1rem;
    margin-top: 80px; /* Space for UI indicators */
    min-height: calc(100vh - 200px);
}

/* Customer Area */
#customer-area {
    grid-column: 1;
    grid-row: 1;
}

#customer-card {
    background: linear-gradient(145deg, #3d2817, #2c1810);
    border: 3px solid #8b4513;
    border-radius: 15px;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

#customer-avatar {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

#customer-name {
    font-size: 1.2rem;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 0.5rem;
}

#customer-dialogue {
    font-style: italic;
    color: #f4e4bc;
    background: rgba(0,0,0,0.2);
    padding: 0.5rem;
    border-radius: 8px;
}

/* Order Area */
#order-area {
    grid-column: 2;
    grid-row: 1;
}

#current-order {
    background: linear-gradient(145deg, #4a2c17, #3d2817);
    border: 3px solid #cd853f;
    border-radius: 15px;
    padding: 1rem;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

#current-order h3 {
    color: #ffd700;
    margin-bottom: 0.5rem;
}

#potion-name {
    font-size: 1.5rem;
    font-weight: bold;
    color: #98fb98;
    margin-bottom: 1rem;
    text-align: center;
}

#ingredients-list {
    list-style: none;
    margin: 0.5rem 0;
}

#ingredients-list li {
    background: rgba(0,0,0,0.2);
    padding: 0.3rem 0.5rem;
    margin: 0.2rem 0;
    border-radius: 5px;
    border-left: 3px solid #8b4513;
}

#order-timer {
    margin-top: 1rem;
    position: relative;
}

#order-timer-bar {
    height: 20px;
    background: linear-gradient(90deg, #ff4444, #ffaa44, #44ff44);
    border-radius: 10px;
    transition: width 0.1s linear;
    width: 100%;
}

#order-time-left {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

/* Brewing Area */
#brewing-area {
    grid-column: 3;
    grid-row: 1;
    text-align: center;
}

#cauldron {
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, #2c2c2c, #000);
    border: 5px solid #8b4513;
    border-radius: 50% 50% 40% 40%;
    margin: 0 auto 1rem;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

#cauldron.drag-over {
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    transform: scale(1.05);
}

#cauldron.magic-combo {
    border-color: #ff69b4;
    box-shadow: 0 0 30px rgba(255, 105, 180, 0.8);
    animation: glow 1s ease-in-out infinite alternate;
}

@keyframes glow {
    from { box-shadow: 0 0 20px rgba(255, 105, 180, 0.5); }
    to { box-shadow: 0 0 40px rgba(255, 105, 180, 1); }
}

#cauldron-contents {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 30px;
    border-radius: 50%;
    background: linear-gradient(145deg, #4a4a4a, #1a1a1a);
    overflow: hidden;
}

#cauldron-bubble-effect {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 30%;
    background: linear-gradient(0deg, rgba(0,255,0,0.3), transparent);
    border-radius: 50%;
    animation: bubble 2s ease-in-out infinite;
}

@keyframes bubble {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-5px) scale(1.1); }
}

#cauldron-ingredients {
    position: absolute;
    top: 30px;
    left: 30px;
    right: 30px;
    bottom: 40px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.cauldron-ingredient {
    font-size: 0.8rem;
    background: rgba(255,255,255,0.2);
    padding: 2px 5px;
    border-radius: 3px;
    animation: float 2s ease-in-out infinite;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

#brew-button, #clear-cauldron, #combine-ingredients {
    background: linear-gradient(145deg, #8b4513, #5d2e0a);
    color: #ffd700;
    border: 2px solid #cd853f;
    padding: 0.7rem 1.2rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    margin: 0.5rem;
    transition: all 0.3s ease;
}

#combine-ingredients {
    background: linear-gradient(145deg, #8b5cf6, #7c3aed);
    border-color: #a855f7;
}

#brew-button:hover:not(:disabled), #clear-cauldron:hover, #combine-ingredients:hover {
    background: linear-gradient(145deg, #cd853f, #8b4513);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

#combine-ingredients:hover {
    background: linear-gradient(145deg, #7c3aed, #6d28d9);
}

#brew-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mobile Instruction Animation */
@keyframes mobileInstructionSlide {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes mobileInstructionPulse {
    0%, 100% {
        box-shadow: 0 4px 8px rgba(139, 92, 246, 0.3);
    }
    50% {
        box-shadow: 0 6px 12px rgba(139, 92, 246, 0.6);
    }
}

/* Ingredients Shelf */
#ingredients-shelf {
    grid-column: 1 / -1;
    grid-row: 2;
}

#ingredients-shelf h3 {
    text-align: center;
    color: #ffd700;
    margin-bottom: 1rem;
}

#ingredients-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    background: linear-gradient(145deg, #3d2817, #2c1810);
    border: 3px solid #8b4513;
    border-radius: 15px;
    padding: 1rem;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.ingredient {
    background: linear-gradient(145deg, #5d4037, #4a2c20);
    border: 2px solid #8b4513;
    border-radius: 10px;
    padding: 1rem;
    cursor: grab;
    transition: all 0.3s ease;
    text-align: center;
    min-width: 120px;
    user-select: none;
}

.ingredient:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.4);
    border-color: #ffd700;
}

.ingredient:active {
    cursor: grabbing;
    transform: scale(0.95);
}

.ingredient.dragging {
    opacity: 0.7;
    transform: rotate(5deg);
}

.ingredient-icon {
    display: block;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.ingredient-name {
    font-size: 0.9rem;
    font-weight: bold;
    color: #f4e4bc;
}

/* Messages */
.message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(145deg, #2c5aa0, #1e3a8a);
    color: white;
    padding: 1rem 2rem;
    border-radius: 15px;
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 8px 16px rgba(0,0,0,0.4);
    z-index: 1000;
    animation: messageAppear 2s ease-in-out;
}

#success-message {
    background: linear-gradient(145deg, #22c55e, #16a34a);
}

#error-message {
    background: linear-gradient(145deg, #ef4444, #dc2626);
}

#combo-message {
    background: linear-gradient(145deg, #f59e0b, #d97706);
    animation: comboGlow 2s ease-in-out;
}

@keyframes messageAppear {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

@keyframes comboGlow {
    0%, 100% { box-shadow: 0 8px 16px rgba(0,0,0,0.4); }
    50% { box-shadow: 0 8px 32px rgba(245, 158, 11, 0.8); }
}

.hidden {
    display: none !important;
}

/* Chaos Effects */
#chaos-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 500;
}

#explosion-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 5rem;
    animation: explode 1s ease-out;
}

@keyframes explode {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.5); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

#frog-effect {
    position: absolute;
    top: 20%;
    width: 100%;
    text-align: center;
    font-size: 3rem;
    animation: frogs 2s ease-in-out;
}

@keyframes frogs {
    0% { transform: translateY(-100px); opacity: 0; }
    50% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(100px); opacity: 0; }
}

#smoke-effect {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 4rem;
    animation: smoke 3s ease-out;
}

@keyframes smoke {
    0% { opacity: 0; transform: translateX(-50%) scale(0); }
    30% { opacity: 1; transform: translateX(-50%) scale(1); }
    100% { opacity: 0; transform: translateX(-50%) scale(2); }
}

/* Game Over and Start Screens */
#game-over-screen, #start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#game-over-content, #start-content {
    background: linear-gradient(145deg, #3d2817, #2c1810);
    border: 3px solid #8b4513;
    border-radius: 20px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 8px 16px rgba(0,0,0,0.5);
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

#game-over-content h2, #start-content h1 {
    color: #ffd700;
    margin-bottom: 0.5rem;
    font-size: 1.8rem;
}

#start-content h2 {
    color: #ffd700;
    margin-bottom: 0.3rem;
    font-size: 1.3rem;
}

#game-over-content p, #start-content p {
    margin: 0.3rem 0;
    font-size: 1rem;
}

#restart-game, #start-game {
    background: linear-gradient(145deg, #22c55e, #16a34a);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.3s ease;
}

#restart-game:hover, #start-game:hover {
    background: linear-gradient(145deg, #16a34a, #15803d);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

/* New Animations and Effects */
@keyframes brewing {
    0% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.05) rotate(2deg); }
    50% { transform: scale(1.1) rotate(0deg); }
    75% { transform: scale(1.05) rotate(-2deg); }
    100% { transform: scale(1) rotate(0deg); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes sparkle {
    0%, 100% { opacity: 0; transform: scale(0) rotate(0deg); }
    50% { opacity: 1; transform: scale(1) rotate(180deg); }
}

@keyframes ingredientGlow {
    0%, 100% { box-shadow: 0 8px 16px rgba(0,0,0,0.4); }
    50% { box-shadow: 0 8px 32px rgba(255, 215, 0, 0.6); }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.3); }
    50% { box-shadow: 0 0 25px rgba(255, 215, 0, 0.8), 0 0 35px rgba(255, 215, 0, 0.4); }
}

/* Enhanced Particle Effects */
.particles {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 900;
    font-size: 1.5rem;
    animation: particleFloat 2s ease-out;
}

.particles-success {
    color: #22c55e;
}

.particles-combo {
    color: #f59e0b;
    font-size: 2rem;
}

.enhanced-particle {
    position: fixed;
    pointer-events: none;
    z-index: 950;
    animation: enhancedParticleFloat var(--duration, 2s) ease-out forwards;
    filter: drop-shadow(0 0 3px currentColor);
}

.particle-ingredient {
    animation: enhancedParticleFloat var(--duration, 2s) ease-out forwards,
               particleRotate 1s linear infinite;
}

.particle-discovery {
    animation: enhancedParticleFloat var(--duration, 2s) ease-out forwards,
               particleBounce 0.5s ease-in-out infinite;
}

.particle-legendary {
    animation: enhancedParticleFloat var(--duration, 2s) ease-out forwards,
               particleGlow 1s ease-in-out infinite alternate;
}

@keyframes particleFloat {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -150%) scale(0.8);
    }
}

@keyframes enhancedParticleFloat {
    0% {
        opacity: 1;
        transform: translate(var(--start-x, 50vw), var(--start-y, 50vh)) scale(0) rotate(0deg);
        filter: drop-shadow(0 0 3px currentColor) brightness(1);
    }
    10% {
        opacity: 1;
        transform: translate(var(--start-x, 50vw), var(--start-y, 50vh)) scale(1.3) rotate(90deg);
        filter: drop-shadow(0 0 8px currentColor) brightness(1.5);
    }
    90% {
        opacity: 0.8;
        transform: translate(var(--end-x, 60vw), var(--end-y, 30vh)) scale(1) rotate(360deg);
        filter: drop-shadow(0 0 5px currentColor) brightness(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(var(--end-x, 60vw), var(--end-y, 30vh)) scale(0.3) rotate(450deg);
        filter: drop-shadow(0 0 1px currentColor) brightness(0.8);
    }
}

@keyframes particleRotate {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1); }
}

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

@keyframes particleGlow {
    0% { 
        filter: drop-shadow(0 0 3px currentColor) brightness(1) hue-rotate(0deg);
    }
    100% { 
        filter: drop-shadow(0 0 8px currentColor) brightness(1.5) hue-rotate(60deg);
    }
}

/* Combo Multiplier Display */
.combo-multiplier-display {
    position: fixed;
    z-index: 1000;
    pointer-events: none;
    animation: comboMultiplierShow 2s ease-out forwards;
    text-align: center;
}

.combo-number {
    font-size: 3rem;
    font-weight: bold;
    color: #f59e0b;
    text-shadow: 
        3px 3px 6px rgba(0,0,0,0.8),
        0 0 20px rgba(245, 158, 11, 0.8),
        0 0 40px rgba(245, 158, 11, 0.4);
    animation: comboNumberPulse 0.5s ease-out;
}

.combo-text {
    font-size: 1.2rem;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    margin-top: 0.5rem;
    animation: comboTextGlow 1s ease-in-out infinite alternate;
}

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

@keyframes comboNumberPulse {
    0% {
        transform: scale(0.8);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.2);
        filter: brightness(1.5);
    }
    100% {
        transform: scale(1);
        filter: brightness(1.2);
    }
}

@keyframes comboTextGlow {
    0% {
        text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
        color: #ffd700;
    }
    100% {
        text-shadow: 
            2px 2px 4px rgba(0,0,0,0.8),
            0 0 15px rgba(255, 215, 0, 0.8);
        color: #ffed4e;
    }
}

/* Ingredient Discovery Animations */
.ingredient-discovery {
    animation: ingredientDiscoveryGlow 3s ease-in-out;
    position: relative;
    z-index: 100;
}

.ingredient-discovery::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    background: linear-gradient(45deg, #ffd700, #ff6b6b, #4ecdc4, #45b7d1, #ffd700);
    background-size: 400% 400%;
    animation: ingredientDiscoveryBorder 2s ease infinite;
    border-radius: 15px;
    z-index: -1;
    opacity: 0.8;
}

.ingredient-discovery-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(145deg, #4a2c17, #3d2817);
    border: 4px solid #ffd700;
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    z-index: 1400;
    box-shadow: 
        0 0 40px rgba(255, 215, 0, 0.8),
        0 0 80px rgba(255, 215, 0, 0.4);
    animation: discoveryPopupShow 4s ease-out forwards;
    max-width: 90vw;
}

.discovery-title {
    font-size: 2rem;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 1rem;
    text-shadow: 
        2px 2px 4px rgba(0,0,0,0.8),
        0 0 20px rgba(255, 215, 0, 0.6);
    animation: discoveryTitlePulse 2s ease-in-out infinite;
}

.discovery-ingredients {
    font-size: 1.4rem;
    color: #98fb98;
    margin-bottom: 1rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    animation: discoveryIngredientsGlow 3s ease-in-out infinite alternate;
}

.discovery-subtitle {
    font-size: 1rem;
    color: #f4e4bc;
    font-style: italic;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

@keyframes ingredientDiscoveryGlow {
    0%, 100% {
        box-shadow: 0 8px 16px rgba(0,0,0,0.4);
        transform: scale(1);
    }
    25% {
        box-shadow: 
            0 8px 32px rgba(255, 215, 0, 0.6),
            0 0 40px rgba(255, 215, 0, 0.4);
        transform: scale(1.05);
    }
    50% {
        box-shadow: 
            0 8px 32px rgba(255, 107, 107, 0.6),
            0 0 40px rgba(255, 107, 107, 0.4);
        transform: scale(1.08);
    }
    75% {
        box-shadow: 
            0 8px 32px rgba(78, 205, 196, 0.6),
            0 0 40px rgba(78, 205, 196, 0.4);
        transform: scale(1.05);
    }
}

@keyframes ingredientDiscoveryBorder {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes discoveryPopupShow {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.7) rotateY(15deg);
        filter: blur(5px);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1) rotateY(-5deg);
        filter: blur(2px);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotateY(0deg);
        filter: blur(0px);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8) rotateY(0deg);
        filter: blur(3px);
    }
}

@keyframes discoveryTitlePulse {
    0%, 100% {
        text-shadow: 
            2px 2px 4px rgba(0,0,0,0.8),
            0 0 20px rgba(255, 215, 0, 0.6);
    }
    50% {
        text-shadow: 
            2px 2px 4px rgba(0,0,0,0.8),
            0 0 30px rgba(255, 215, 0, 0.9),
            0 0 50px rgba(255, 215, 0, 0.5);
    }
}

@keyframes discoveryIngredientsGlow {
    0% {
        color: #98fb98;
        text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    }
    100% {
        color: #90ee90;
        text-shadow: 
            2px 2px 4px rgba(0,0,0,0.8),
            0 0 15px rgba(152, 251, 152, 0.8);
    }
}

/* Dynamic Weather Effects */
.weather-particle {
    position: fixed;
    pointer-events: none;
    z-index: 5;
    font-size: 1.2rem;
    top: -50px;
}

.weather-rainy {
    animation: weatherRainfall 3s linear infinite;
}

.weather-stormy {
    animation: weatherLightning 4s ease-in-out infinite;
}

.weather-foggy {
    animation: weatherFog 8s ease-in-out infinite;
}

.weather-windy {
    animation: weatherWind 3s ease-in-out infinite;
}

.weather-sunny {
    animation: weatherSunshine 6s ease-in-out infinite;
}

.weather-change-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(145deg, rgba(0,0,0,0.9), rgba(20,20,40,0.9));
    border: 3px solid #87ceeb;
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    z-index: 1200;
    box-shadow: 
        0 0 30px rgba(135, 206, 235, 0.6),
        0 0 60px rgba(135, 206, 235, 0.3);
    animation: weatherNotificationShow 4s ease-out forwards;
    backdrop-filter: blur(10px);
}

.weather-change-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    animation: weatherIconSpin 2s ease-in-out infinite;
}

.weather-change-text {
    font-size: 1.3rem;
    font-weight: bold;
    color: #87ceeb;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.weather-change-effects {
    font-size: 1rem;
    color: #f4e4bc;
    font-style: italic;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

/* Weather Animation Keyframes */
@keyframes weatherRainfall {
    0% {
        top: -50px;
        opacity: 1;
    }
    100% {
        top: 100vh;
        opacity: 0.3;
    }
}

@keyframes weatherLightning {
    0%, 90%, 100% {
        opacity: 0;
        transform: scale(1) rotate(0deg);
    }
    95% {
        opacity: 1;
        transform: scale(1.5) rotate(15deg);
        filter: brightness(2) drop-shadow(0 0 10px currentColor);
    }
}

@keyframes weatherFog {
    0%, 100% {
        opacity: 0.3;
        transform: translateX(0) scale(1);
    }
    50% {
        opacity: 0.7;
        transform: translateX(50px) scale(1.2);
    }
}

@keyframes weatherWind {
    0% {
        transform: translateX(-20px) rotate(0deg);
        opacity: 0.8;
    }
    50% {
        transform: translateX(100vw) rotate(360deg);
        opacity: 1;
    }
    100% {
        transform: translateX(120vw) rotate(720deg);
        opacity: 0;
    }
}

@keyframes weatherSunshine {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1) rotate(0deg);
        filter: brightness(1) drop-shadow(0 0 5px currentColor);
    }
    50% {
        opacity: 1;
        transform: scale(1.2) rotate(180deg);
        filter: brightness(1.5) drop-shadow(0 0 15px currentColor);
    }
}

@keyframes weatherNotificationShow {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.7) rotateY(15deg);
        filter: blur(5px);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1) rotateY(-5deg);
        filter: blur(2px);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotateY(0deg);
        filter: blur(0px);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8) rotateY(0deg);
        filter: blur(3px);
    }
}

@keyframes weatherIconSpin {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    50% {
        transform: scale(1.1) rotate(180deg);
    }
}

/* Achievement Popup */
.achievement-popup {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(145deg, #ffd700, #ffed4e);
    color: #8b4513;
    padding: 1rem 1.5rem;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: bold;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    z-index: 1100;
    animation: achievementSlide 3s ease-in-out;
    border: 2px solid #8b4513;
}

@keyframes achievementSlide {
    0% { transform: translateX(300px); opacity: 0; }
    15% { transform: translateX(0); opacity: 1; }
    85% { transform: translateX(0); opacity: 1; }
    100% { transform: translateX(300px); opacity: 0; }
}

/* Enhanced Ingredient Effects */
.ingredient.glowing {
    animation: ingredientGlow 1s ease-in-out infinite;
}

.ingredient.selected {
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    transform: translateY(-8px) scale(1.05);
}

/* Enhanced Cauldron Effects */
#cauldron.brewing {
    animation: brewing 1s ease-in-out;
}

#cauldron.success {
    border-color: #22c55e;
    animation: pulseGlow 0.5s ease-in-out;
}

#cauldron.error {
    border-color: #ef4444;
    animation: shake 0.5s ease-in-out;
}

/* Enhanced Bubble Effects */
#cauldron-bubble-effect.active {
    animation: intenseBubble 1s ease-in-out;
}

@keyframes intenseBubble {
    0%, 100% { 
        background: linear-gradient(0deg, rgba(0,255,0,0.3), transparent);
        height: 30%;
    }
    50% { 
        background: linear-gradient(0deg, rgba(0,255,255,0.6), rgba(255,255,0,0.3));
        height: 60%;
    }
}

/* Sound Effect Visual Cues */
.sound-cue {
    position: fixed;
    font-size: 2rem;
    pointer-events: none;
    z-index: 800;
    animation: soundPulse 0.5s ease-out;
}

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

/* Enhanced Order Timer */
#order-timer-bar.critical {
    background: linear-gradient(90deg, #ff0000, #ff4444) !important;
    animation: criticalPulse 0.5s ease-in-out infinite;
}

@keyframes criticalPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Difficulty Indicator */
.difficulty-indicator {
    position: fixed;
    top: 100px;
    right: 20px;
    background: rgba(139, 69, 19, 0.8);
    color: #ffd700;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    border: 2px solid #8b4513;
    font-weight: bold;
    z-index: 900;
}

/* Enhanced Customer Animation */
#customer-avatar.talking {
    animation: customerTalk 2s ease-in-out infinite;
}

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

/* Progress Bar Enhancement */
.progress-enhancement {
    position: relative;
    overflow: hidden;
}

.progress-enhancement::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: progressShine 2s ease-in-out infinite;
}

@keyframes progressShine {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Recipe Book Styles */
#recipe-book {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
}

#recipe-book-content {
    background: linear-gradient(145deg, #3d2817, #2c1810);
    border: 3px solid #8b4513;
    border-radius: 20px;
    padding: 2rem;
    max-width: 80vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 16px rgba(0,0,0,0.5);
}

#recipe-book-content h2 {
    color: #ffd700;
    text-align: center;
    margin-bottom: 1.5rem;
}

#recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.recipe-card {
    background: linear-gradient(145deg, #5d4037, #4a2c20);
    border: 2px solid #8b4513;
    border-radius: 10px;
    padding: 1rem;
    transition: all 0.3s ease;
}

.recipe-card.locked {
    opacity: 0.5;
    filter: grayscale(100%);
}

.recipe-card.unlocked {
    border-color: #ffd700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.recipe-card.unlocked:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(255, 215, 0, 0.4);
}

.recipe-name {
    font-size: 1.2rem;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 0.5rem;
}

.recipe-ingredients {
    list-style: none;
    margin: 0.5rem 0;
}

.recipe-ingredients li {
    background: rgba(0,0,0,0.2);
    padding: 0.2rem 0.5rem;
    margin: 0.1rem 0;
    border-radius: 3px;
    font-size: 0.9rem;
}

.recipe-stats {
    font-size: 0.8rem;
    color: #f4e4bc;
    margin-top: 0.5rem;
}

.recipe-unlock-condition {
    font-style: italic;
    color: #cd853f;
    font-size: 0.8rem;
}

#stats-panel {
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    padding: 1rem;
    margin-top: 1rem;
}

#stats-panel h3 {
    color: #ffd700;
    margin-bottom: 1rem;
}

#lifetime-stats p {
    margin: 0.5rem 0;
    font-size: 1.1rem;
}

#close-recipe-book {
    background: linear-gradient(145deg, #8b4513, #5d2e0a);
    color: #ffd700;
    border: 2px solid #cd853f;
    padding: 0.7rem 1.2rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.3s ease;
}

#close-recipe-book:hover {
    background: linear-gradient(145deg, #cd853f, #8b4513);
    transform: translateY(-2px);
}

#start-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

#start-buttons button {
    background: linear-gradient(145deg, #22c55e, #16a34a);
    color: white;
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 180px;
}

#start-buttons button:hover {
    background: linear-gradient(145deg, #16a34a, #15803d);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

/* Audio Controls */
#audio-controls button {
    background: linear-gradient(145deg, #5d4037, #4a2c20);
    border: 2px solid #8b4513;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #f4e4bc;
}

#audio-controls button:hover {
    transform: translateY(-2px) scale(1.1);
    border-color: #ffd700;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

#audio-controls button:active {
    transform: translateY(0) scale(1.05);
}

/* Save Status Animation */
@keyframes saveStatusShow {
    0% {
        opacity: 0;
        transform: translateX(100px);
    }
    20% {
        opacity: 1;
        transform: translateX(0);
    }
    80% {
        opacity: 1;
        transform: translateX(0);
    }
    100% {
        opacity: 0;
        transform: translateX(100px);
    }
}

#daily-challenge {
    background: linear-gradient(145deg, #f59e0b, #d97706) !important;
}

#daily-challenge:hover {
    background: linear-gradient(145deg, #d97706, #b45309) !important;
}

/* Daily Challenge Indicator */
#daily-challenge-indicator {
    background: linear-gradient(145deg, rgba(245, 158, 11, 0.9), rgba(217, 119, 6, 0.9));
    color: white;
    border-color: #f59e0b;
    min-width: 160px;
}

#challenge-name {
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 0.2rem;
}

#challenge-progress {
    font-size: 0.7rem;
    opacity: 0.9;
}

/* Workshop Theme Selector */
#workshop-themes {
    margin: 0.5rem 0;
    text-align: center;
}

#workshop-themes h3 {
    color: #ffd700;
    margin-bottom: 0.4rem;
    font-size: 1rem;
}

#theme-selector {
    display: flex;
    justify-content: center;
    gap: 0.3rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.theme-option {
    background: linear-gradient(145deg, #5d4037, #4a2c20);
    border: 2px solid #8b4513;
    border-radius: 6px;
    padding: 0.3rem 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8rem;
    min-width: 70px;
    text-align: center;
}

.theme-option:hover:not(.locked) {
    transform: translateY(-2px);
    border-color: #ffd700;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.theme-option.selected {
    border-color: #ffd700;
    background: linear-gradient(145deg, #ffd700, #ffed4e);
    color: #8b4513;
    font-weight: bold;
}

.theme-option.locked {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(100%);
}

.theme-option.locked::after {
    content: ' 🔒';
}

/* Mobile Theme Selector */
@media (max-width: 768px) {
    #theme-selector {
        gap: 0.3rem;
    }
    
    .theme-option {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
        min-width: 70px;
    }
    
    #daily-challenge-indicator {
        min-width: 140px;
    }
    
    #challenge-name {
        font-size: 0.7rem;
    }
    
    #challenge-progress {
        font-size: 0.6rem;
    }
}

/* Power-up Effects */
.powerup-indicator {
    position: fixed;
    top: 150px;
    left: 20px;
    background: linear-gradient(145deg, #8b5cf6, #7c3aed);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    border: 2px solid #a855f7;
    font-weight: bold;
    z-index: 900;
    animation: powerupPulse 2s ease-in-out infinite;
}

@keyframes powerupPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(168, 85, 247, 0.3); }
    50% { box-shadow: 0 0 25px rgba(168, 85, 247, 0.8); }
}

/* Daily Challenge Styles */
.challenge-indicator {
    position: fixed;
    top: 200px;
    left: 20px;
    background: linear-gradient(145deg, #f59e0b, #d97706);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    border: 2px solid #fbbf24;
    font-weight: bold;
    font-size: 0.9rem;
    z-index: 900;
}

/* Power-up Pickup Styles */
.powerup-pickup {
    background: linear-gradient(145deg, #8b5cf6, #7c3aed) !important;
    border: 2px solid #a855f7;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(139, 92, 246, 0.3);
}

.powerup-pickup:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 16px rgba(139, 92, 246, 0.5);
}

.powerup-icon {
    font-size: 1.5rem;
    margin-bottom: 0.3rem;
}

.powerup-name {
    font-size: 0.9rem;
    font-weight: bold;
}

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

/* Enhanced Recipe Cards */
.recipe-tier {
    font-size: 0.8rem;
    color: #cd853f;
    margin-bottom: 0.3rem;
    font-weight: bold;
}

.recipe-description {
    font-size: 0.9rem;
    color: #f4e4bc;
    margin: 0.5rem 0;
    font-style: italic;
}

/* Customer Backstory Tooltip */
.customer-tooltip {
    position: absolute;
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 0.5rem;
    border-radius: 5px;
    font-size: 0.8rem;
    max-width: 200px;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#customer-card:hover .customer-tooltip {
    opacity: 1;
}

/* Special Event Indicators */
.special-event-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(145deg, #ff6b6b, #ee5a52);
    color: white;
    padding: 1.5rem 2rem;
    border-radius: 15px;
    font-size: 1.3rem;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 8px 16px rgba(255, 107, 107, 0.4);
    z-index: 1200;
    animation: specialEventPulse 3s ease-in-out;
}

@keyframes specialEventPulse {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

/* UI Panel System - Positioned ABOVE game content */
.ui-panel {
    position: fixed;
    display: flex;
    flex-direction: row;
    gap: 10px;
    z-index: 900;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
    padding: 0.5rem;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#ui-left-panel {
    top: 80px;
    left: 10px;
    align-items: center;
    flex-wrap: wrap;
    max-width: 45vw;
}

#ui-right-panel {
    top: 80px;
    right: 10px;
    align-items: center;
    flex-wrap: wrap;
    max-width: 45vw;
}

#ui-center-panel {
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    align-items: center;
    flex-direction: column;
    gap: 5px;
    max-width: 300px;
}

/* Base UI Indicator Styling */
.ui-indicator, .difficulty-indicator, .gold-counter {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 0.6rem 1rem;
    font-weight: bold;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    color: #f4e4bc;
    font-size: 0.9rem;
    min-width: 120px;
}

.difficulty-indicator {
    background: linear-gradient(145deg, rgba(139, 69, 19, 0.9), rgba(93, 46, 10, 0.9));
    color: #ffd700;
    border-color: #8b4513;
}

.gold-counter {
    background: linear-gradient(145deg, rgba(255, 215, 0, 0.9), rgba(255, 237, 78, 0.9));
    color: #8b4513;
    border-color: #ffd700;
}

#streak-indicator {
    background: linear-gradient(145deg, rgba(255, 107, 107, 0.9), rgba(238, 90, 82, 0.9));
    color: white;
    border-color: #ff6b6b;
}

#weather-indicator {
    background: linear-gradient(145deg, rgba(135, 206, 235, 0.9), rgba(95, 158, 160, 0.9));
    color: white;
    border-color: #87ceeb;
}

#reputation-indicator {
    background: linear-gradient(145deg, rgba(139, 92, 246, 0.9), rgba(124, 58, 237, 0.9));
    color: white;
    border-color: #8b5cf6;
}

#fever-mode-indicator {
    background: linear-gradient(145deg, #ff6b6b, #feca57, #ff9ff3, #54a0ff);
    background-size: 400% 400%;
    animation: feverGradient 2s ease infinite;
    color: white;
    border-color: #fff;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    min-width: 200px;
}

/* Hover Effects */
.ui-indicator:hover, .difficulty-indicator:hover, .gold-counter:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* Animation for gold counter */
.gold-animation {
    animation: goldGain 0.5s ease-out;
}

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

/* Upgrade Shop Styles */
#upgrade-shop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
}

#upgrade-shop-content {
    background: linear-gradient(145deg, #3d2817, #2c1810);
    border: 3px solid #8b4513;
    border-radius: 20px;
    padding: 2rem;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 16px rgba(0,0,0,0.5);
}

#upgrade-shop-content h2 {
    color: #ffd700;
    text-align: center;
    margin-bottom: 1rem;
}

#shop-gold {
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 1.5rem;
    background: rgba(255, 215, 0, 0.1);
    padding: 0.5rem;
    border-radius: 10px;
}

#upgrades-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.upgrade-card {
    background: linear-gradient(145deg, #5d4037, #4a2c20);
    border: 2px solid #8b4513;
    border-radius: 10px;
    padding: 1rem;
    transition: all 0.3s ease;
}

.upgrade-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.upgrade-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 0.5rem;
}

.upgrade-description {
    color: #f4e4bc;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.upgrade-level {
    font-size: 0.8rem;
    color: #cd853f;
    margin-bottom: 0.5rem;
}

.upgrade-cost {
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 1rem;
}

.upgrade-button {
    background: linear-gradient(145deg, #22c55e, #16a34a);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    width: 100%;
    transition: all 0.3s ease;
}

.upgrade-button:hover:not(:disabled) {
    background: linear-gradient(145deg, #16a34a, #15803d);
    transform: translateY(-1px);
}

.upgrade-button:disabled {
    background: linear-gradient(145deg, #666, #555);
    cursor: not-allowed;
    opacity: 0.6;
}

.upgrade-button.max-level {
    background: linear-gradient(145deg, #ffd700, #ffed4e);
    color: #8b4513;
}


/* Seasonal Events */
#seasonal-banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    background: linear-gradient(90deg, #ff6b6b, #ee5a52, #ff7675);
    color: white;
    text-align: center;
    padding: 0.5rem;
    font-weight: bold;
    z-index: 1000;
    animation: seasonalPulse 3s ease-in-out infinite;
}

@keyframes seasonalPulse {
    0%, 100% { background: linear-gradient(90deg, #ff6b6b, #ee5a52, #ff7675); }
    50% { background: linear-gradient(90deg, #ff7675, #ff6b6b, #ee5a52); }
}

#seasonal-text {
    font-size: 1rem;
    margin-bottom: 0.2rem;
}

#seasonal-bonus {
    font-size: 0.8rem;
    opacity: 0.9;
}

/* Seasonal Themes */
.theme-halloween {
    background: linear-gradient(135deg, #2d1b69, #11052c) !important;
}

.theme-halloween .ingredient {
    box-shadow: 0 0 10px rgba(255, 140, 0, 0.3);
}

.theme-winter {
    background: linear-gradient(135deg, #74b9ff, #0984e3) !important;
}

.theme-winter .ingredient {
    border-color: #74b9ff;
}

.theme-spring {
    background: linear-gradient(135deg, #fd79a8, #e84393) !important;
}

.theme-spring .ingredient {
    animation: springBloom 2s ease-in-out infinite;
}

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

.theme-summer {
    background: linear-gradient(135deg, #fdcb6e, #e17055) !important;
}

.theme-summer .ingredient {
    filter: brightness(1.2) saturate(1.3);
}

/* Weather Effects */
.weather-rainy {
    position: relative;
    overflow: hidden;
}

.weather-rainy::before {
    content: '';
    position: absolute;
    top: -100vh;
    left: 0;
    width: 100%;
    height: 200vh;
    background: repeating-linear-gradient(
        180deg,
        transparent,
        transparent 2px,
        rgba(173, 216, 230, 0.1) 2px,
        rgba(173, 216, 230, 0.1) 4px
    );
    animation: rain 0.5s linear infinite;
    pointer-events: none;
    z-index: 10;
}

@keyframes rain {
    0% { transform: translateY(-100vh); }
    100% { transform: translateY(0); }
}

.weather-stormy {
    animation: lightning 3s ease-in-out infinite;
}

@keyframes lightning {
    0%, 90%, 100% { filter: brightness(1); }
    95% { filter: brightness(2) contrast(1.5); }
}

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

/* Enhanced Button Styling */
#open-upgrade-shop-btn {
    background: linear-gradient(145deg, #8b5cf6, #7c3aed) !important;
}

#open-upgrade-shop-btn:hover {
    background: linear-gradient(145deg, #7c3aed, #6d28d9) !important;
}

#open-high-scores {
    background: linear-gradient(145deg, #ffd700, #ffed4e) !important;
    color: #8b4513 !important;
}

#open-high-scores:hover {
    background: linear-gradient(145deg, #ffed4e, #ffc107) !important;
}

/* Streak Indicators */
#streak-indicator {
    position: fixed;
    top: 320px;
    right: 20px;
    background: linear-gradient(145deg, #ff6b6b, #ee5a52);
    color: white;
    padding: 0.8rem;
    border-radius: 10px;
    border: 2px solid #ff4757;
    font-weight: bold;
    z-index: 900;
    text-align: center;
    min-width: 120px;
    animation: streakPulse 2s ease-in-out infinite;
}

@keyframes streakPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 107, 107, 0.3); }
    50% { box-shadow: 0 0 20px rgba(255, 107, 107, 0.8); }
}

#brewing-streak, #perfect-streak {
    font-size: 0.9rem;
    margin: 0.1rem 0;
}

/* Fever Mode */
#fever-mode-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(145deg, #ff6b6b, #feca57, #ff9ff3, #54a0ff);
    background-size: 400% 400%;
    animation: feverGradient 2s ease infinite, feverPulse 1s ease-in-out infinite;
    color: white;
    padding: 1.5rem 2rem;
    border-radius: 20px;
    font-weight: bold;
    text-align: center;
    z-index: 1000;
    box-shadow: 0 0 30px rgba(255, 107, 107, 0.8);
    border: 3px solid #fff;
}

@keyframes feverGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes feverPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.05); }
}

#fever-text {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

#fever-multiplier {
    font-size: 2rem;
    margin-bottom: 0.3rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

#fever-timer {
    font-size: 1rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* Reputation Indicator */
#reputation-indicator {
    position: fixed;
    top: 400px;
    right: 20px;
    background: linear-gradient(145deg, #8b5cf6, #7c3aed);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    border: 2px solid #a855f7;
    font-weight: bold;
    z-index: 900;
    font-size: 0.9rem;
    animation: reputationGlow 3s ease-in-out infinite;
}

@keyframes reputationGlow {
    0%, 100% { box-shadow: 0 0 10px rgba(139, 92, 246, 0.3); }
    50% { box-shadow: 0 0 20px rgba(139, 92, 246, 0.8); }
}

/* Legendary Ingredient Effects */
.legendary-ingredient {
    position: relative;
    overflow: visible;
}

.legendary-ingredient::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    background: linear-gradient(45deg, #ffd700, #ff6b6b, #4ecdc4, #45b7d1);
    background-size: 400% 400%;
    animation: legendaryGlow 3s ease infinite;
    border-radius: 15px;
    z-index: -1;
}

@keyframes legendaryGlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.legendary-ingredient .ingredient-icon {
    animation: legendaryFloat 2s ease-in-out infinite;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.8));
}

@keyframes legendaryFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-5px) scale(1.1); }
}

/* Quality Indicators */
.quality-indicator {
    position: fixed;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    z-index: 1100;
    animation: qualityShow 2s ease-out;
    pointer-events: none;
}

@keyframes qualityShow {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

/* Customer Mood Indicator */
.customer-mood {
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 1.5rem;
    background: rgba(0,0,0,0.7);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: moodPulse 2s ease-in-out infinite;
}

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

/* Mobile-First Responsive Design */
@media (max-width: 768px) {
    body {
        font-size: 14px;
        background: linear-gradient(135deg, #2c1810, #4a2c17);
        touch-action: manipulation;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
    
    #game-header {
        padding: 0.5rem;
        position: sticky;
        top: 0;
        z-index: 100;
    }
    
    #game-header h1 {
        font-size: 1.5rem;
        margin-bottom: 0.3rem;
    }
    
    #game-stats {
        font-size: 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    #game-stats > div {
        padding: 0.3rem 0.8rem;
        flex: 1;
        min-width: 80px;
        text-align: center;
    }
    
    #game-area {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto;
        gap: 0.5rem;
        padding: 0.5rem;
        margin-top: 120px; /* More space needed on mobile for UI panels */
        min-height: calc(100vh - 220px);
    }
    
    #customer-area { grid-column: 1; grid-row: 1; }
    #order-area { grid-column: 1; grid-row: 2; }
    #brewing-area { grid-column: 1; grid-row: 3; }
    #ingredients-shelf { grid-column: 1; grid-row: 4; }
    
    /* Mobile Customer Card */
    #customer-card {
        padding: 0.8rem;
        margin-bottom: 0.5rem;
    }
    
    #customer-avatar {
        font-size: 2.5rem;
    }
    
    #customer-name {
        font-size: 1.1rem;
    }
    
    #customer-dialogue {
        font-size: 0.9rem;
        padding: 0.4rem;
    }
    
    /* Mobile Order Area */
    #current-order {
        padding: 0.8rem;
    }
    
    #potion-name {
        font-size: 1.3rem;
        margin-bottom: 0.8rem;
    }
    
    #ingredients-list li {
        padding: 0.4rem 0.6rem;
        margin: 0.3rem 0;
        font-size: 0.9rem;
    }
    
    #order-timer-bar {
        height: 25px;
    }
    
    #order-time-left {
        font-size: 0.9rem;
    }
    
    /* Mobile Brewing Area */
    #brewing-area {
        padding: 1rem;
    }
    
    #cauldron {
        width: 120px;
        height: 120px;
        margin: 0 auto 1rem;
        touch-action: none;
    }
    
    /* Mobile Cauldron Ingredients - Icons Only */
    .cauldron-ingredient {
        font-size: 1rem !important;
        background: transparent !important;
        padding: 2px !important;
        border-radius: 50% !important;
        width: 18px !important;
        height: 18px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        overflow: hidden !important;
        white-space: nowrap !important;
        text-overflow: clip !important;
        line-height: 1 !important;
    }
    
    /* Completely hide text content on mobile - show icons only */
    .cauldron-ingredient {
        font-size: 0 !important; /* Hide all text */
        color: transparent !important;
    }
    
    /* Use CSS pseudo-element to show only the first emoji character */
    .cauldron-ingredient::before {
        content: attr(data-icon);
        font-size: 12px !important;
        color: #fff !important;
        display: block !important;
        width: 100% !important;
        height: 100% !important;
        line-height: 18px !important;
        text-align: center !important;
    }
    
    #brew-button, #clear-cauldron, #combine-ingredients {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
        margin: 0.3rem;
        width: 100%;
        max-width: 200px;
        touch-action: manipulation;
    }
    
    /* Mobile Ingredients */
    #ingredients-container {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
        gap: 0.5rem;
        padding: 0.8rem;
    }
    
    .ingredient {
        min-width: 80px;
        padding: 0.6rem 0.4rem;
        font-size: 0.8rem;
        touch-action: none;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    
    .ingredient:active {
        transform: scale(0.95);
        background: linear-gradient(145deg, #8b5cf6, #7c3aed);
    }
    
    .ingredient-icon {
        font-size: 1.8rem;
        margin-bottom: 0.3rem;
    }
    
    .ingredient-name {
        font-size: 0.75rem;
        line-height: 1.2;
    }
    
    /* Mobile UI Panel System - Compact layout */
    .ui-panel {
        max-width: 48vw;
        gap: 3px;
        padding: 0.3rem;
        flex-direction: column;
    }
    
    #ui-left-panel {
        top: 85px;
        left: 2px;
        max-width: 35vw;
    }
    
    #ui-right-panel {
        top: 85px;
        right: 2px;
        max-width: 35vw;
    }
    
    #ui-center-panel {
        top: 85px;
        left: 50%;
        transform: translateX(-50%);
        max-width: 25vw;
        align-items: center;
    }
    
    /* Mobile UI Indicators - Extra compact */
    .ui-indicator, .difficulty-indicator, .gold-counter {
        padding: 0.2rem 0.4rem;
        font-size: 0.7rem;
        min-width: auto;
        backdrop-filter: blur(3px);
        border-radius: 8px;
        margin: 1px;
    }
    
    #fever-mode-indicator {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
        min-width: auto;
        max-width: 90vw;
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }
    
    #weather-icon {
        font-size: 1rem;
        display: block;
        margin: 0.1rem 0;
    }
    
    #weather-name {
        font-size: 0.7rem;
        margin: 0.1rem 0;
    }
    
    #weather-effect {
        font-size: 0.6rem;
        opacity: 0.9;
    }
    
    #brewing-streak, #perfect-streak {
        font-size: 0.7rem;
        margin: 0.1rem 0;
    }
    
    /* Mobile Messages */
    .message {
        padding: 0.8rem 1.5rem;
        font-size: 1.2rem;
        border-radius: 10px;
        max-width: 90vw;
    }
    
    .achievement-popup {
        top: 10px;
        right: 10px;
        left: 10px;
        text-align: center;
        font-size: 1rem;
        padding: 0.8rem 1rem;
    }
    
    /* Mobile Screens */
    #start-content, #game-over-content {
        padding: 1.5rem;
        max-width: 90vw;
        margin: 1rem;
    }
    
    #start-content h1 {
        font-size: 1.8rem;
    }
    
    #start-content h2 {
        font-size: 1.4rem;
    }
    
    #start-buttons {
        gap: 0.8rem;
    }
    
    #start-buttons button {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
        min-width: 180px;
    }
    
    /* Mobile Recipe Book */
    #recipe-book-content {
        padding: 1rem;
        max-width: 95vw;
        max-height: 90vh;
        margin: 1rem auto;
    }
    
    #recipe-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    
    .recipe-card {
        padding: 0.8rem;
    }
    
    .recipe-name {
        font-size: 1.1rem;
    }
    
    /* Mobile Upgrade Shop */
    #upgrade-shop-content {
        padding: 1rem;
        max-width: 95vw;
        max-height: 90vh;
        margin: 1rem auto;
    }
    
    #upgrades-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    
    .upgrade-card {
        padding: 0.8rem;
    }
    
    .upgrade-button {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    
    /* Mobile Chaos Effects */
    #explosion-effect {
        font-size: 4rem;
    }
    
    #frog-effect {
        font-size: 2.5rem;
    }
    
    #smoke-effect {
        font-size: 3rem;
    }
    
    /* Mobile Fever Mode */
    #fever-mode-indicator {
        padding: 1rem 1.5rem;
        border-radius: 15px;
        max-width: 90vw;
    }
    
    #fever-text {
        font-size: 1.3rem;
    }
    
    #fever-multiplier {
        font-size: 1.8rem;
    }
    
    /* Mobile Seasonal Banner */
    #seasonal-banner {
        padding: 0.3rem;
        font-size: 0.9rem;
    }
    
    #seasonal-text {
        font-size: 0.9rem;
    }
    
    #seasonal-bonus {
        font-size: 0.7rem;
    }
    
    /* High Scores Screen */
#high-scores-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
}

#high-scores-content {
    background: linear-gradient(145deg, #3d2817, #2c1810);
    border: 3px solid #8b4513;
    border-radius: 20px;
    padding: 2rem;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 16px rgba(0,0,0,0.5);
}

#high-scores-content h2 {
    color: #ffd700;
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 2rem;
}

#high-scores-grid {
    margin-bottom: 2rem;
}

.score-header {
    display: grid;
    grid-template-columns: 60px 100px 80px 80px 120px;
    gap: 1rem;
    padding: 0.8rem;
    background: linear-gradient(145deg, #8b4513, #5d2e0a);
    border-radius: 10px;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 1rem;
    text-align: center;
}

.score-row {
    display: grid;
    grid-template-columns: 60px 100px 80px 80px 120px;
    gap: 1rem;
    padding: 0.8rem;
    background: linear-gradient(145deg, #5d4037, #4a2c20);
    border: 2px solid #8b4513;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
    text-align: center;
    align-items: center;
}

.score-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    border-color: #ffd700;
}

.score-row.current-session {
    border-color: #22c55e;
    background: linear-gradient(145deg, #16a34a, #15803d);
    color: white;
}

.rank-medal {
    font-size: 1.2rem;
}

#player-stats {
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    padding: 1rem;
    margin-top: 1rem;
}

#player-stats h3 {
    color: #ffd700;
    margin-bottom: 1rem;
    text-align: center;
}

#player-stats p {
    margin: 0.5rem 0;
    font-size: 1.1rem;
    color: #f4e4bc;
}

#close-high-scores {
    background: linear-gradient(145deg, #8b4513, #5d2e0a);
    color: #ffd700;
    border: 2px solid #cd853f;
    padding: 0.7rem 1.2rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    margin: 1rem auto 0;
    display: block;
    transition: all 0.3s ease;
}

#close-high-scores:hover {
    background: linear-gradient(145deg, #cd853f, #8b4513);
    transform: translateY(-2px);
}

/* Mobile High Scores */
@media (max-width: 768px) {
    #high-scores-content {
        padding: 1rem;
        max-width: 95vw;
        max-height: 90vh;
        margin: 1rem auto;
    }
    
    .score-header, .score-row {
        grid-template-columns: 40px 70px 60px 60px 80px;
        gap: 0.5rem;
        padding: 0.6rem;
        font-size: 0.9rem;
    }
    
    #player-stats p {
        font-size: 1rem;
    }
}

/* Story Popup Styling - Enhanced for Fullscreen */
#story-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, rgba(0,0,0,0.95), rgba(20,20,40,0.95));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1500;
    animation: storyFadeIn 0.8s ease-out;
    backdrop-filter: blur(10px);
}

#story-popup::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, rgba(255, 215, 0, 0.1) 0%, transparent 70%);
    animation: storyBackgroundPulse 4s ease-in-out infinite;
}

#story-content {
    background: linear-gradient(145deg, #4a2c17, #3d2817, #2c1810);
    border: 6px solid #ffd700;
    border-radius: 25px;
    padding: 3rem;
    max-width: 85vw;
    max-height: 80vh;
    text-align: center;
    box-shadow: 
        0 0 40px rgba(255, 215, 0, 0.6),
        0 0 80px rgba(255, 215, 0, 0.3),
        inset 0 0 30px rgba(255, 215, 0, 0.1);
    position: relative;
    overflow: hidden;
    transform: perspective(1000px) rotateX(0deg);
    animation: storyContentFloat 6s ease-in-out infinite;
}

#story-content::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    background: linear-gradient(45deg, #ffd700, #ff6b6b, #4ecdc4, #45b7d1, #8b5cf6, #ffd700);
    background-size: 600% 600%;
    animation: storyBorderGlow 4s ease infinite;
    border-radius: 25px;
    z-index: -1;
    opacity: 0.8;
}

#story-content::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    border-radius: 15px;
    pointer-events: none;
    animation: storyInnerGlow 3s ease-in-out infinite alternate;
}

@keyframes storyBorderGlow {
    0% { background-position: 0% 50%; }
    25% { background-position: 100% 50%; }
    50% { background-position: 100% 100%; }
    75% { background-position: 0% 100%; }
    100% { background-position: 0% 50%; }
}

@keyframes storyBackgroundPulse {
    0%, 100% { 
        opacity: 0.3;
        transform: scale(1);
    }
    50% { 
        opacity: 0.6;
        transform: scale(1.1);
    }
}

@keyframes storyContentFloat {
    0%, 100% {
        transform: perspective(1000px) rotateX(0deg) translateY(0px);
    }
    33% {
        transform: perspective(1000px) rotateX(1deg) translateY(-5px);
    }
    66% {
        transform: perspective(1000px) rotateX(-1deg) translateY(5px);
    }
}

@keyframes storyInnerGlow {
    0% {
        opacity: 0.2;
        transform: scale(1);
    }
    100% {
        opacity: 0.4;
        transform: scale(1.05);
    }
}

@keyframes storyFadeIn {
    0% {
        opacity: 0;
        transform: scale(0.7) rotateY(10deg);
        filter: blur(5px);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05) rotateY(-2deg);
        filter: blur(2px);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotateY(0deg);
        filter: blur(0px);
    }
}

#story-title {
    color: #ffd700;
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    text-shadow: 
        3px 3px 6px rgba(0,0,0,0.8),
        0 0 20px rgba(255, 215, 0, 0.6),
        0 0 40px rgba(255, 215, 0, 0.3);
    font-weight: bold;
    letter-spacing: 2px;
    animation: storyTitleGlow 3s ease-in-out infinite;
    position: relative;
}

#story-title::after {
    content: '✨';
    position: absolute;
    top: -10px;
    right: -20px;
    font-size: 1.5rem;
    animation: storySparkle 2s ease-in-out infinite;
}

#story-speaker {
    color: #98fb98;
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 2rem;
    background: linear-gradient(145deg, rgba(152, 251, 152, 0.2), rgba(152, 251, 152, 0.1));
    padding: 1rem 1.5rem;
    border-radius: 15px;
    border: 3px solid #98fb98;
    box-shadow: 
        0 0 20px rgba(152, 251, 152, 0.4),
        inset 0 0 20px rgba(152, 251, 152, 0.1);
    animation: storyElementPulse 4s ease-in-out infinite;
    position: relative;
}

#story-speaker::before {
    content: '🗣️';
    position: absolute;
    left: -15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    animation: storySpeakerBounce 2s ease-in-out infinite;
}

#story-text {
    color: #f4e4bc;
    font-size: 1.4rem;
    line-height: 1.8;
    margin-bottom: 2rem;
    background: linear-gradient(145deg, rgba(0,0,0,0.4), rgba(0,0,0,0.2));
    padding: 1.5rem;
    border-radius: 15px;
    font-style: italic;
    max-height: 250px;
    overflow-y: auto;
    border: 2px solid rgba(244, 228, 188, 0.3);
    box-shadow: inset 0 0 30px rgba(0,0,0,0.5);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    animation: storyTextGlow 5s ease-in-out infinite;
}

#story-unlock {
    color: #ffd700;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 2rem;
    background: linear-gradient(145deg, rgba(255, 215, 0, 0.3), rgba(255, 215, 0, 0.1));
    padding: 1.2rem 1.5rem;
    border-radius: 15px;
    border: 3px solid #ffd700;
    box-shadow: 
        0 0 30px rgba(255, 215, 0, 0.5),
        inset 0 0 20px rgba(255, 215, 0, 0.2);
    animation: storyUnlockPulse 3s ease-in-out infinite;
    position: relative;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

#story-unlock::before {
    content: '🎉';
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    animation: storyUnlockCelebrate 2s ease-in-out infinite;
}

#close-story {
    background: linear-gradient(145deg, #22c55e, #16a34a, #059669);
    color: white;
    border: 3px solid #10b981;
    padding: 1.2rem 2.5rem;
    border-radius: 20px;
    font-size: 1.3rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        0 6px 12px rgba(0,0,0,0.4),
        0 0 20px rgba(34, 197, 94, 0.3),
        inset 0 0 20px rgba(255, 255, 255, 0.1);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.6);
    animation: storyButtonPulse 4s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

#close-story::before {
    content: '⚡';
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    animation: storyButtonIcon 3s ease-in-out infinite;
}

#close-story::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s ease;
}

#close-story:hover {
    background: linear-gradient(145deg, #16a34a, #15803d, #047857);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 
        0 8px 16px rgba(0,0,0,0.5),
        0 0 30px rgba(34, 197, 94, 0.6),
        inset 0 0 25px rgba(255, 255, 255, 0.2);
}

#close-story:hover::after {
    left: 100%;
}

#close-story:active {
    transform: translateY(-1px) scale(1.02);
}

/* Enhanced Story Animation Keyframes */
@keyframes storyTitleGlow {
    0%, 100% {
        text-shadow: 
            3px 3px 6px rgba(0,0,0,0.8),
            0 0 20px rgba(255, 215, 0, 0.6),
            0 0 40px rgba(255, 215, 0, 0.3);
    }
    50% {
        text-shadow: 
            3px 3px 6px rgba(0,0,0,0.8),
            0 0 30px rgba(255, 215, 0, 0.9),
            0 0 60px rgba(255, 215, 0, 0.6);
    }
}

@keyframes storySparkle {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.3) rotate(180deg);
    }
}

@keyframes storyElementPulse {
    0%, 100% {
        box-shadow: 
            0 0 20px rgba(152, 251, 152, 0.4),
            inset 0 0 20px rgba(152, 251, 152, 0.1);
    }
    50% {
        box-shadow: 
            0 0 30px rgba(152, 251, 152, 0.7),
            inset 0 0 30px rgba(152, 251, 152, 0.2);
    }
}

@keyframes storySpeakerBounce {
    0%, 100% {
        transform: translateY(-50%) scale(1);
    }
    50% {
        transform: translateY(-50%) scale(1.2);
    }
}

@keyframes storyTextGlow {
    0%, 100% {
        border-color: rgba(244, 228, 188, 0.3);
        box-shadow: inset 0 0 30px rgba(0,0,0,0.5);
    }
    50% {
        border-color: rgba(244, 228, 188, 0.6);
        box-shadow: inset 0 0 40px rgba(0,0,0,0.7);
    }
}

@keyframes storyUnlockPulse {
    0%, 100% {
        box-shadow: 
            0 0 30px rgba(255, 215, 0, 0.5),
            inset 0 0 20px rgba(255, 215, 0, 0.2);
    }
    50% {
        box-shadow: 
            0 0 40px rgba(255, 215, 0, 0.8),
            inset 0 0 30px rgba(255, 215, 0, 0.4);
    }
}

@keyframes storyUnlockCelebrate {
    0%, 100% {
        transform: translateY(-50%) scale(1) rotate(0deg);
    }
    25% {
        transform: translateY(-50%) scale(1.3) rotate(10deg);
    }
    75% {
        transform: translateY(-50%) scale(1.1) rotate(-10deg);
    }
}

@keyframes storyButtonPulse {
    0%, 100% {
        box-shadow: 
            0 6px 12px rgba(0,0,0,0.4),
            0 0 20px rgba(34, 197, 94, 0.3),
            inset 0 0 20px rgba(255, 255, 255, 0.1);
    }
    50% {
        box-shadow: 
            0 8px 16px rgba(0,0,0,0.5),
            0 0 30px rgba(34, 197, 94, 0.6),
            inset 0 0 25px rgba(255, 255, 255, 0.2);
    }
}

@keyframes storyButtonIcon {
    0%, 100% {
        transform: translateY(-50%) scale(1);
        filter: brightness(1);
    }
    50% {
        transform: translateY(-50%) scale(1.2);
        filter: brightness(1.5);
    }
}

/* Mobile Story Popup */
@media (max-width: 768px) {
    #story-content {
        padding: 2rem 1.5rem;
        max-width: 95vw;
        max-height: 85vh;
        border-width: 4px;
    }
    
    #story-title {
        font-size: 2rem;
        margin-bottom: 1rem;
        letter-spacing: 1px;
    }
    
    #story-title::after {
        right: -15px;
        font-size: 1.2rem;
    }
    
    #story-speaker {
        font-size: 1.2rem;
        margin-bottom: 1.5rem;
        padding: 0.8rem 1.2rem;
    }
    
    #story-speaker::before {
        left: -12px;
        font-size: 1.2rem;
    }
    
    #story-text {
        font-size: 1.1rem;
        max-height: 180px;
        margin-bottom: 1.5rem;
        padding: 1.2rem;
        line-height: 1.6;
    }
    
    #story-unlock {
        font-size: 1rem;
        margin-bottom: 1.5rem;
        padding: 1rem 1.2rem;
    }
    
    #story-unlock::before {
        left: -15px;
        font-size: 1.2rem;
    }
    
    #close-story {
        padding: 1rem 2rem;
        font-size: 1.1rem;
        border-radius: 15px;
    }
    
    #close-story::before {
        left: 12px;
        font-size: 1rem;
    }
}

/* Ultra-small mobile devices */
@media (max-width: 480px) {
    #game-header h1 {
        font-size: 1.3rem;
    }
    
    #game-stats {
        font-size: 0.9rem;
    }
    
    #ingredients-container {
        grid-template-columns: repeat(auto-fit, minmax(75px, 1fr));
        gap: 0.3rem;
    }
    
    .ingredient {
        min-width: 70px;
        padding: 0.5rem 0.3rem;
    }
    
    .ingredient-icon {
        font-size: 1.5rem;
    }
    
    .ingredient-name {
        font-size: 0.7rem;
    }
    
    #cauldron {
        width: 100px;
        height: 100px;
    }
    
    .message {
        font-size: 1.1rem;
        padding: 0.6rem 1.2rem;
    }
}

/* Enhanced Achievement and Particle System Animations */
@keyframes achievementUnlockPulse {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.2);
    }
}

@keyframes celebrationFloat {
    0% {
        opacity: 1;
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    50% {
        opacity: 1;
        transform: translate(calc(var(--end-x) - 50vw), calc(var(--end-y) - 50vh)) rotate(180deg) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(calc(var(--end-x) - 50vw), calc(var(--end-y) - 50vh)) rotate(360deg) scale(0.5);
    }
}

@keyframes enhancedParticleFloat {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    50% {
        opacity: 1;
        transform: translate(calc(var(--end-x) - 50vw), calc(var(--end-y) - 50vh)) scale(1.5);
    }
    100% {
        opacity: 0;
        transform: translate(calc(var(--end-x) - 50vw), calc(var(--end-y) - 50vh)) scale(0.8);
    }
}

@keyframes tutorialFadeIn {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Tutorial System Styling */
.tutorial-highlight {
    position: relative;
    z-index: 1000;
}

.tutorial-highlight::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border: 3px solid #ffd700;
    border-radius: 15px;
    animation: tutorialPulse 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes tutorialPulse {
    0%, 100% {
        border-color: #ffd700;
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    }
    50% {
        border-color: #ffed4e;
        box-shadow: 0 0 25px rgba(255, 215, 0, 0.8);
    }
}

/* Enhanced UI Panel Animations */
@keyframes panelSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ingredient Quality and Enhancement Animations */
@keyframes floatParticle {
    0%, 100% {
        transform: translateY(0px) translateX(0px);
        opacity: 0.8;
    }
    25% {
        transform: translateY(-3px) translateX(2px);
        opacity: 1;
    }
    50% {
        transform: translateY(-5px) translateX(-1px);
        opacity: 0.9;
    }
    75% {
        transform: translateY(-2px) translateX(-3px);
        opacity: 1;
    }
}

@keyframes enhancementPulse {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(2);
    }
}

/* Quality-based ingredient styling */
.quality-poor {
    filter: grayscale(50%) brightness(0.7);
}

.quality-fine {
    animation: fineGlow 3s ease-in-out infinite;
}

.quality-superior {
    animation: superiorGlow 2.5s ease-in-out infinite;
}

.quality-perfect {
    animation: perfectGlow 2s ease-in-out infinite;
}

.quality-legendary {
    animation: legendaryGlow 1.5s ease-in-out infinite;
}

@keyframes fineGlow {
    0%, 100% {
        box-shadow: 0 0 8px rgba(74, 222, 128, 0.4);
    }
    50% {
        box-shadow: 0 0 15px rgba(74, 222, 128, 0.8);
    }
}

@keyframes superiorGlow {
    0%, 100% {
        box-shadow: 0 0 12px rgba(59, 130, 246, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(59, 130, 246, 1.0);
    }
}

@keyframes perfectGlow {
    0%, 100% {
        box-shadow: 0 0 16px rgba(168, 85, 247, 0.6);
    }
    50% {
        box-shadow: 0 0 25px rgba(168, 85, 247, 1.0);
    }
}

@keyframes legendaryGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(251, 191, 36, 0.7);
    }
    50% {
        box-shadow: 0 0 30px rgba(251, 191, 36, 1.0);
    }
}

/* Enhancement interface styling */
.enhancement-option:hover {
    transform: scale(1.05) !important;
    background: #5d4037 !important;
}

/* Boss Encounter Animations */
@keyframes bossIntroFade {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    30% {
        opacity: 1;
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bossAvatarPulse {
    0%, 100% {
        transform: scale(1);
        text-shadow: 0 0 20px rgba(255, 107, 107, 0.8);
    }
    50% {
        transform: scale(1.1);
        text-shadow: 0 0 30px rgba(255, 107, 107, 1.0);
    }
}

@keyframes victoryPulse {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.05);
        box-shadow: 0 0 40px rgba(255, 215, 0, 0.8);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
    }
}

@keyframes failureShake {
    0%, 100% {
        transform: translate(-50%, -50%);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translate(-48%, -50%);
    }
    20%, 40%, 60%, 80% {
        transform: translate(-52%, -50%);
    }
}

@keyframes chaosShake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* Workshop Decoration Animations */
@keyframes floatCrystal {
    0%, 100% {
        transform: rotate(45deg) translateY(0px);
    }
    50% {
        transform: rotate(45deg) translateY(-10px);
    }
}

@keyframes runeGlow {
    0%, 100% {
        text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
        transform: scale(1);
    }
    50% {
        text-shadow: 0 0 20px rgba(255, 215, 0, 1.0);
        transform: scale(1.05);
    }
}

@keyframes spiritFlameFlicker {
    0%, 100% {
        opacity: 0.8;
        transform: scaleY(1);
    }
    25% {
        opacity: 1;
        transform: scaleY(1.1);
    }
    50% {
        opacity: 0.9;
        transform: scaleY(0.9);
    }
    75% {
        opacity: 1;
        transform: scaleY(1.05);
    }
}

@keyframes timeClockTick {
    0%, 100% {
        transform: rotate(0deg);
    }
    50% {
        transform: rotate(5deg);
    }
}

@keyframes starTwinkle {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

@keyframes dragonSkullBreath {
    0%, 90%, 100% {
        text-shadow: 0 0 20px rgba(239, 68, 68, 0.8);
    }
    95% {
        text-shadow: 0 0 30px rgba(255, 140, 0, 1.0);
    }
}

/* Workshop Tab Styling */
.workshop-tab {
    background: linear-gradient(145deg, #5d4037, #4a2c20);
    border: 2px solid #8b4513;
    color: #f4e4bc;
    padding: 0.8rem 1.5rem;
    margin: 0 0.5rem;
    border-radius: 10px 10px 0 0;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.workshop-tab.active {
    background: linear-gradient(145deg, #8b4513, #6d3710);
    border-bottom: 2px solid #3d2817;
    color: #ffd700;
    transform: translateY(2px);
}

.workshop-tab:hover:not(.active) {
    background: linear-gradient(145deg, #6d3710, #5d4037);
    transform: translateY(1px);
}

/* Workshop Item Styling */
.workshop-item {
    transition: all 0.3s ease;
}

.workshop-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.ui-panel {
    animation: panelSlideIn 0.5s ease-out;
}

/* Workshop Theme Transition */
body {
    transition: background 1s ease-in-out;
}

/* Potion Effect Animations */
@keyframes potionSparkle {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    25% {
        transform: scale(1.1) rotate(90deg);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.2) rotate(180deg);
        opacity: 0.6;
    }
    75% {
        transform: scale(1.1) rotate(270deg);
        opacity: 0.8;
    }
}

.potion-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    pointer-events: none;
    animation: potionSparkle 2s ease-in-out infinite;
}

/* Enhanced Cauldron Brewing Effects */
.cauldron-brewing {
    animation: brewing 1s ease-in-out, potionGlow 2s ease-in-out infinite;
}

@keyframes potionGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(255, 215, 0, 0.8), 0 0 60px rgba(255, 215, 0, 0.4);
    }
}

/* Ingredient Quality Indicators */
.ingredient-quality-perfect {
    position: relative;
    overflow: visible;
}

.ingredient-quality-perfect::after {
    content: '✨';
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 1.2rem;
    animation: qualityPulse 1.5s ease-in-out infinite;
}

@keyframes qualityPulse {
    0%, 100% {
        opacity: 0.7;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Enhanced Fever Mode Effects */
#fever-mode-indicator.active {
    animation: feverGradient 2s ease infinite, feverBounce 1s ease-in-out infinite;
}

@keyframes feverBounce {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.05);
    }
}

/* Workshop Customization Preview */
.theme-preview {
    width: 100px;
    height: 60px;
    border-radius: 8px;
    border: 2px solid #8b4513;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.theme-preview:hover {
    transform: scale(1.1);
    border-color: #ffd700;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.theme-preview.selected {
    border-color: #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
}

.theme-preview::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffd700;
    font-size: 1.5rem;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.theme-preview.selected::after {
    opacity: 1;
}

/* Viral Growth Animation Styles */
@keyframes sharePopIn {
    0% {
        transform: scale(0.5) rotate(-10deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.1) rotate(2deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes bragPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 15px rgba(255, 215, 0, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 215, 0, 0);
    }
}

@keyframes engagementBounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

@keyframes buttonPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.7);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 0 10px rgba(255, 107, 107, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0);
    }
}

/* Viral UI Elements */
.share-popup {
    animation: sharePopIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.brag-achievement {
    animation: bragPulse 1.5s ease-in-out infinite;
}

.instant-engagement {
    animation: engagementBounce 1s ease-in-out infinite;
}

/* Mobile-first viral optimization */
@media (max-width: 768px) {
    .share-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .quick-play-btn {
        font-size: 1.2rem;
        padding: 1rem;
        animation: buttonPulse 2s ease-in-out infinite;
    }
    
    .brag-achievement {
        font-size: 0.9rem;
        padding: 0.5rem;
    }
}