﻿.loei-title {
    font-size: 1.75rem;
    font-weight: 600;
    text-align: center;
    margin-top: 1rem;
    margin-bottom: 1.25rem;
}

.loei-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    height: 100dvh;
    padding: 1.25rem 1rem;
    text-align: center;
    box-sizing: border-box;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: #333;
    overflow: hidden;
}

@supports not (height: 100dvh) {
    .loei-wrapper {
        height: calc(var(--vh, 1vh) * 100);
    }
}

.loei-center {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: visible;
    padding: 0 1rem;
}

.loei-footer {
    padding-top: 1rem;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 5rem);
    width: 100%;
    flex-shrink: 0;
    box-sizing: border-box;
}

    .loei-footer .btn {
        border-radius: 0.75rem;
        padding: 0.5rem 1.25rem;
        font-size: 1rem;
        font-weight: 500;
        transition: background-color 0.3s ease;
    }

    .loei-footer p {
        margin: 0.25rem 0;
        font-size: 0.95rem;
        color: #444;
    }

        .loei-footer p.h5 {
            font-size: 1.125rem;
            font-weight: 600;
            color: #222;
        }

.loei-arc-wrapper {
    position: relative;
    width: 100%;
    max-width: 360px;
    height: 240px;
    margin-top: 2rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0 1rem;
}

.loei-orbit {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.loei-kai {
    width: min(80vw, 220px);
    z-index: 1;
}

.loei-emoji {
    position: absolute;
    top: 0;
    left: 50%;
    width: 72px;
    height: 72px;
    touch-action: manipulation;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 50%;
    transform-origin: bottom center;
    cursor: pointer;
    pointer-events: auto;
    opacity: 0;
    animation-duration: 0.6s;
    animation-fill-mode: forwards;
    transition: box-shadow 0.3s ease;
    z-index: 2;
}

    .loei-emoji.glow {
        box-shadow: 0 0 14px 6px rgba(40, 167, 69, 0.6);
    }

    .loei-readalong{
    padding: 2rem;
    padding-top:5rem;
    
}


    .loei-emoji.discovered {
        box-shadow: none;
    }

@keyframes fan-out-happy {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(0) scale(0.5);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) rotate(-90deg) translateY(-100px);
    }
}

@keyframes fan-out-sad {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(0) scale(0.5);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) rotate(-45deg) translateY(-100px);
    }
}

@keyframes fan-out-angry {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(0) scale(0.5);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) rotate(0deg) translateY(-100px);
    }
}

@keyframes fan-out-fearful {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(0) scale(0.5);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) rotate(45deg) translateY(-100px);
    }
}

@keyframes fan-out-surprised {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(0) scale(0.5);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) rotate(90deg) translateY(-100px);
    }
}

.fan-happy {
    animation-name: fan-out-happy;
}

.fan-sad {
    animation-name: fan-out-sad;
}

.fan-angry {
    animation-name: fan-out-angry;
}

.fan-fearful {
    animation-name: fan-out-fearful;
}

.fan-surprised {
    animation-name: fan-out-surprised;
}

.loei-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loei-modal {
    font-family: inherit;
    background: #fff;
    border-radius: 1rem;
    padding: 2rem 1.5rem;
    max-width: 280px;
    width: 90%;
    text-align: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    animation: fade-in 0.25s ease-out;
}

.loei-modal-emoji {
    width: 64px;
    margin-bottom: 1rem;
}

.loei-modal-label {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1c1c1c;
    margin-bottom: 1rem;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.loei-modal button {
    padding: 0.5rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 0.75rem;
    background-color: #f1f1f1;
    border: 1px solid #ccc;
    color: #333;
    transition: background-color 0.3s ease;
}

    .loei-modal button:hover {
        background-color: #e2e2e2;
    }

@media (max-width: 480px) {
    .loei-emoji {
        width: 60px;
        height: 60px;
    }

    .loei-arc-wrapper {
        height: 200px;
        padding: 0 1.5rem;
    }

    .loei-kai {
        width: 160px;
    }
}

/* --- iOS WebView guardrails (WKWebView) --- */
@supports (-webkit-touch-callout: none) {
    /* Give the arc a predictable canvas so orbit math stays visible */
    .loei-arc-wrapper {
        width: min(92vw, 360px);
        aspect-ratio: 5 / 3; /* lets height scale from width */
        height: auto; /* use aspect-ratio for height */
        max-height: min(48vh, 320px);
    }
    /* Keep Kai sized relative to the arc, not the device viewport */
    .loei-kai {
        width: auto; /* stop vw from over-scaling */
        max-width: 50%; /* relative to arc wrapper width */
        max-height: 50%; /* relative to arc wrapper height */
        height: auto;
        display: block;
    }
}
