:root {
    --magenta: #d5007f;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    height: 100dvh; /* Better mobile viewport handling */
    overflow: hidden;
    background-color: #fff;
    font-family: Arial, sans-serif;
}

/* Scene Container - Fills screen */
#scene-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: flex-end; /* Align images to bottom */
    padding-bottom: 0;
}

#main-image {
    width: 100%;
    height: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    object-fit: contain; /* Ensure full image visibility */
    object-position: center bottom;
}

#main-image.hidden {
    display: none;
}

/* Snow Canvas */
#snow-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    display: none; /* Hidden by default */
}

/* Gift Container */
#gift-container {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    cursor: pointer;
    text-align: center;
    width: 150px;
    max-width: 30%;
    transition: none; /* Hard cuts */
}

#gift-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#gift-image {
    width: 100%;
    height: auto;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

#gift-text {
    position: absolute;
    top: -40px;
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 10px;
    border-radius: 5px;
    font-weight: bold;
    color: var(--magenta);
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    font-size: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

#mobile-hint {
    margin-top: 5px;
    font-size: 0.8rem;
    color: var(--magenta);
    background: rgba(255,255,255,0.8);
    padding: 2px 5px;
    border-radius: 4px;
    display: none; /* Handled by JS/Media Query */
}

/* UI Controls */
#ui-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    gap: 10px;
}

button {
    background-color: var(--magenta);
    color: white;
    border: none;
    padding: 10px 15px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

button:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

#btn-reset, #btn-mute, #btn-cancel {
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 1.2rem;
}

#btn-cancel {
    background-color: #999; /* Grey to differentiate from main actions, or keep magenta */
    background-color: var(--magenta); 
}

/* Orientation Lock */
#orientation-lock {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--magenta);
    z-index: 10000;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    text-transform: uppercase;
}

#orientation-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    animation: rotate-icon 2s infinite ease-in-out;
}

@keyframes rotate-icon {
    0% { transform: rotate(0deg); }
    50% { transform: rotate(-90deg); }
    100% { transform: rotate(0deg); }
}

.hidden {
    display: none !important;
}

/* Flash Overlay */
#flash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: white;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.1s linear; /* Fast transition for flash */
}

#flash-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* Mobile & Tablet Adjustments */
@media (max-width: 768px) {
    #gift-container {
        width: 60px;
        bottom: 10px;
    }

    #gift-text {
        font-size: 0.7rem;
        top: -30px;
        padding: 3px 6px;
    }
    
    #ui-controls {
        top: 10px;
        right: 10px;
    }

    /* Force landscape logic visually via hints if needed, 
       but keeping layout functional in portrait as requested */
    .mobile-only {
        display: block !important;
    }
}

/* Orientation Lock for Portrait Mobile */
@media screen and (max-width: 768px) and (orientation: portrait) {
    #orientation-lock {
        display: flex;
    }
    #scene-container, #gift-container, #ui-controls {
        display: none !important;
    }
}

/* Hide mobile hint on desktop */
@media (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }
}