/* Mystic Lotto Generator — Fullscreen with scaled image */
html,
body {
    height: 100%;
    margin: 0;
}

/* Wrapper fills the viewport */
.mlg-wrap {
    position: relative;
    width: 100vw;
    height: 100svh;
    margin: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, 'Helvetica Neue', Arial;
}

/* Scene fills container */
.mlg-scene {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #120628;
}

/* Image centered & scaled smaller */
:root {
    --mlg-img-scale: .82;
}

/* adjust this number to shrink/grow image */

.mlg-bg {
    position: absolute;
    left: 50%;
    top: 50%;
    width: auto;
    height: auto;
    max-width: 100vw;
    max-height: 100svh;
    transform: translate(-50%, -50%) scale(var(--mlg-img-scale));
    transform-origin: center;
    z-index: 0;
    filter: saturate(1.05) contrast(1.02);
    background: #120628;
}

/* Crystal ball overlay */
.mlg-ball-clip {
    position: absolute;
    left: 50%;
    top: 62%;
    /* move it lower to match her hands */
    transform: translate(-50%, -29%);
    width: min(36vw, 175px);
    /* was 58vw / 480px, much too big */
    aspect-ratio: 1/1;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, .08),
        0 0 40px 6px rgba(223, 214, 255, 0.35) inset;
    pointer-events: none;
}

.mlg-canvas {
    width: 100%;
    height: 100%;
    display: block;
    filter: blur(.2px);
}

/* Mystical glow + reveal */
.mlg-reveal {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    letter-spacing: .04em;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, .7), 0 0 22px #bda8ff;
    font-size: clamp(14px, 2vw, 20px);
    text-align: center;
    padding: 10px;
    mix-blend-mode: screen;
    opacity: 0;
    transition: opacity .35s ease;
}

.mlg-wrap.revealed .mlg-reveal {
    opacity: 1;
}

/* Caption + controls */
.mlg-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    z-index: 2;
}

.mlg-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    background: linear-gradient(180deg, rgba(20, 8, 40, .7), rgba(10, 4, 20, .9));
    padding: 10px 14px;
    border-radius: 999px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, .4),
        0 0 30px rgba(110, 0, 180, .35) inset;
    backdrop-filter: blur(6px);
}

.mlg-label {
    color: #f1e9ff;
    font-size: 14px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.mlg-select {
    appearance: none;
    background: #2a1852;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 10px;
    padding: 8px 30px 8px 10px;
    font-weight: 600;
}

.mlg-btn {
    pointer-events: auto;
    cursor: pointer;
    background: radial-gradient(120% 180% at 50% -20%, #ffe8a8, #b17cff 60%, #3b0a8c);
    color: #120628;
    border: 0;
    font-weight: 800;
    padding: 10px 16px;
    border-radius: 999px;
    transition: transform .08s ease, box-shadow .2s ease;
    box-shadow: 0 10px 24px rgba(62, 10, 140, .5),
        0 0 0 2px rgba(255, 255, 255, .15) inset;
}

.mlg-btn:active {
    transform: translateY(1px) scale(.98);
}

/* Output */
.mlg-output {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(96px + env(safe-area-inset-bottom));
    /* lift above Generate */
    z-index: 6;
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* Slightly more lift + smaller pills on narrow phones */
@media (max-width: 560px) {
    .mlg-output {
        bottom: calc(118px + env(safe-area-inset-bottom));
    }

    .mlg-pill {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
}

/* Pills */
.mlg-pill {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    margin: 0 4px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #fff, #d9d9d9 55%, #a4a4a4);
    color: #121212;
    font-weight: 900;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, .25), 0 2px 8px rgba(0, 0, 0, .5);
}

.mlg-pill.pb {
    background: radial-gradient(circle at 30% 30%, #ffe0e0, #ff8b8b 60%, #a30000);
    color: #fff;
    text-shadow: 0 1px 0 #000;
}

/* Sparkles */
.mlg-wrap:after {
    content: '';
    pointer-events: none;
    position: absolute;
    inset: 0;
    background: radial-gradient(800px 400px at 50% 55%, rgba(255, 255, 255, .05), transparent 70%),
        radial-gradient(360px 200px at 20% 10%, rgba(255, 200, 255, .06), transparent 60%),
        radial-gradient(360px 240px at 80% 20%, rgba(180, 220, 255, .05), transparent 65%);
}

@media (max-width:560px) {
    :root {
        --mlg-img-scale: .9;
    }

    .mlg-controls {
        flex-wrap: wrap;
    }
}

/* ---- FORCE CENTER ON MOBILE (wins against theme) ---- */
@media (max-width: 768px) {

    .entry-content .mlg-wrap,
    .wp-block-group .mlg-wrap,
    .site-content .mlg-wrap,
    .mlg-wrap {
        position: relative !important;
        width: 100vw !important;
        max-width: 100vw !important;
        margin: 0 !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        /* center horizontally */
    }

    .mlg-scene {
        width: 100% !important;
        height: 100% !important;
        margin: 0 auto !important;
    }

    /* If your theme adds inner padding, neutralize it for our block */
    .entry-content>.mlg-wrap,
    .wp-block-group.is-layout-constrained>.mlg-wrap {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

/* ===== Mobile fix: keep lotto numbers visible ===== */
@media (max-width: 768px) {
    .mlg-output {
        position: static !important;
        /* cancel absolute positioning */
        top: auto !important;
        bottom: auto !important;
        left: auto !important;
        transform: none !important;

        display: flex !important;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
        align-items: center;

        margin: 0 12px 10px !important;
        /* a little space above the button */
        color: #fff !important;
        z-index: 10 !important;
    }

    .mlg-caption {
        flex-direction: column-reverse !important;
        /* output above the Generate button */
        align-items: center !important;
        gap: 10px !important;
    }

    .mlg-pill {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
}