/* ============================================
   WISTERIA LOVE - Hand Gesture Experience
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&family=Dancing+Script:wght@600;700&display=swap');

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

html, body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: #000;
    font-family: 'Inter', -apple-system, sans-serif;
}

/* ---- Container ---- */
.container {
    position: relative;
    width: 100%;
    height: 100%;
}

/* ---- Webcam Video ---- */
#webcam {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
    z-index: 1;
}

/* ---- Canvas Overlay ---- */
#canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: scaleX(-1);
    z-index: 2;
    pointer-events: none;
}

/* ---- Loading Screen ---- */
.loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, #1a0a1e 0%, #0a0510 60%, #000 100%);
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-icon {
    width: 80px;
    height: 80px;
    position: relative;
    margin-bottom: 30px;
}

.loading-icon::before {
    content: '🫶';
    font-size: 48px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: icon-pulse 2s ease-in-out infinite;
    filter: drop-shadow(0 0 15px rgba(255, 120, 180, 0.8));
}

@keyframes icon-pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.6;
        filter: drop-shadow(0 0 10px rgba(255, 120, 180, 0.5));
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
        filter: drop-shadow(0 0 25px rgba(255, 120, 180, 1));
    }
}

.loading-text {
    color: rgba(255, 200, 220, 0.9);
    font-size: 16px;
    font-weight: 300;
    letter-spacing: 3px;
    text-transform: uppercase;
    animation: text-fade 2s ease-in-out infinite;
}

.loading-subtext {
    color: rgba(255, 180, 200, 0.5);
    font-size: 12px;
    font-weight: 300;
    letter-spacing: 2px;
    margin-top: 10px;
}

@keyframes text-fade {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ---- Instruction Toast ---- */
.instructions {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 150, 200, 0.2);
    border-radius: 16px;
    padding: 16px 28px;
    color: rgba(255, 220, 240, 0.9);
    font-size: 14px;
    font-weight: 300;
    letter-spacing: 0.5px;
    text-align: center;
    line-height: 1.6;
    max-width: 520px;
    transition: opacity 1s ease, transform 1s ease;
    box-shadow: 0 8px 32px rgba(255, 100, 150, 0.1);
}

.instructions.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
    pointer-events: none;
}

.instructions span {
    color: rgba(255, 160, 200, 1);
    font-weight: 600;
}

/* ---- Forgiveness Message (🫶 both hands) ---- */
.forgiveness-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.92);
    z-index: 20;
    max-width: 90%;
    padding: 34px 46px;
    text-align: center;
    background: rgba(20, 5, 15, 0.45);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 170, 200, 0.35);
    border-radius: 24px;
    box-shadow: 0 0 60px rgba(255, 90, 150, 0.25), inset 0 0 40px rgba(255, 150, 190, 0.08);
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.1s ease, transform 1.1s ease;
}

.forgiveness-message.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.forgiveness-message span {
    display: inline-block;
    font-family: 'Dancing Script', cursive;
    font-weight: 700;
    font-size: clamp(28px, 4.2vw, 48px);
    line-height: 1.4;
    color: #ffe3ee;
    text-shadow: 0 0 18px rgba(255, 120, 170, 0.85), 0 0 40px rgba(255, 90, 150, 0.4);
    animation: forgiveness-glow 3s ease-in-out infinite;
}

@keyframes forgiveness-glow {
    0%, 100% {
        text-shadow: 0 0 18px rgba(255, 120, 170, 0.85), 0 0 40px rgba(255, 90, 150, 0.4);
    }
    50% {
        text-shadow: 0 0 28px rgba(255, 150, 190, 1), 0 0 60px rgba(255, 100, 160, 0.6);
    }
}

/* ---- Vignette ---- */
.vignette {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background: radial-gradient(
        ellipse at center,
        transparent 50%,
        rgba(0, 0, 0, 0.4) 100%
    );
}
