* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #1a1a2e;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    cursor: pointer;
}

body.playing {
    cursor: default;
}

#gameCanvas {
    display: block;
    width: 100vw;
    height: 100vh;
}

#startOverlay {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    text-align: center;
}

#startOverlay p {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
    animation: pulse 2s ease-in-out infinite;
    letter-spacing: 2px;
    font-weight: 300;
}

#startOverlay.hidden {
    display: none;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

#giftPopup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: linear-gradient(145deg, rgba(30, 40, 60, 0.95), rgba(20, 25, 40, 0.98));
    border: 2px solid rgba(255, 180, 100, 0.4);
    border-radius: 12px;
    padding: 35px 45px;
    text-align: center;
    z-index: 200;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 0 80px rgba(255, 150, 100, 0.15), 0 0 40px rgba(0, 0, 0, 0.5);
    max-width: 420px;
    backdrop-filter: blur(10px);
}

#giftPopup.show {
    transform: translate(-50%, -50%) scale(1);
}

#giftPopup h2 {
    color: #ffcc80;
    font-size: 1.6rem;
    margin-bottom: 12px;
    font-weight: 500;
}

#giftPopup p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 22px;
}

#giftPopup .gift-image {
    font-size: 3.5rem;
    margin: 12px 0 18px;
}

#giftPopup button {
    background: linear-gradient(145deg, #ffb347, #ff9500);
    border: none;
    padding: 12px 40px;
    font-size: 0.95rem;
    border-radius: 20px;
    cursor: pointer;
    color: #1a1a2e;
    font-weight: 600;
    transition: all 0.3s ease;
    letter-spacing: 1px;
}

#giftPopup button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 25px rgba(255, 150, 50, 0.4);
}

#lockedPopup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: linear-gradient(145deg, rgba(60, 30, 30, 0.95), rgba(40, 20, 20, 0.98));
    border: 2px solid rgba(255, 100, 100, 0.4);
    border-radius: 12px;
    padding: 25px 35px;
    text-align: center;
    z-index: 200;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
    box-shadow: 0 0 40px rgba(255, 50, 50, 0.15);
    backdrop-filter: blur(10px);
}

#lockedPopup.show {
    transform: translate(-50%, -50%) scale(1);
}

#lockedPopup p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    margin: 8px 0;
}

#lockedPopup .hint {
    color: rgba(255, 200, 150, 0.7);
    font-size: 0.85rem;
    font-style: italic;
}

#lockedPopup .key-icon {
    font-size: 1.2rem;
}

#finalMessage {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #2d1f3d 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.5s ease;
}

#finalMessage.show {
    opacity: 1;
    pointer-events: auto;
}

#finalMessage h1 {
    font-size: 3rem;
    color: #fff;
    text-shadow: 0 0 50px rgba(255, 180, 100, 0.5);
    font-weight: 300;
    letter-spacing: 4px;
}

#instructions {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
    z-index: 50;
    display: none;
    letter-spacing: 1px;
}

#giftCounter {
    position: fixed;
    top: 20px;
    right: 25px;
    color: rgba(255, 200, 100, 0.8);
    font-size: 1rem;
    z-index: 50;
    display: none;
    letter-spacing: 1px;
}

#inventory {
    position: fixed;
    top: 20px;
    left: 25px;
    z-index: 50;
    display: none;
    gap: 8px;
}

.inv-slot {
    width: 44px;
    height: 44px;
    border: 2px solid rgba(255, 200, 100, 0.3);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.inv-slot.has-key {
    border-color: rgba(255, 220, 100, 0.8);
    box-shadow: 0 0 20px rgba(255, 200, 50, 0.4);
    animation: keyGlow 1.5s ease-in-out infinite;
}

@keyframes keyGlow {
    0%, 100% { box-shadow: 0 0 15px rgba(255, 200, 50, 0.3); }
    50% { box-shadow: 0 0 25px rgba(255, 200, 50, 0.6); }
}


#hintMessage {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(145deg, rgba(20, 30, 50, 0.9), rgba(10, 15, 30, 0.95));
    border: 1px solid rgba(255, 220, 100, 0.4);
    border-radius: 8px;
    padding: 12px 24px;
    z-index: 60;
    display: none;
    animation: hintFadeIn 0.5s ease;
}

#hintMessage p {
    color: rgba(255, 230, 150, 0.95);
    font-size: 1rem;
    margin: 0;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(255, 200, 100, 0.3);
}

#hintMessage.fade-out {
    animation: hintFadeOut 1s ease forwards;
}

@keyframes hintFadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes hintFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}
