/* Tiny Pepe Playground v0.1.2
   Scoped to the plugin's own classes + front-page-only body classes.
*/

.tpp-playground {
    /* TinyPixelPepe / WordPress identity colors sampled from the site's Global Colors. */
    --tpp-lime: #A5F94E;
    --tpp-green: #69AB80;
    --tpp-heading-green: #5F9F74;
    --tpp-coral: #D07267;
    --tpp-panel-bg: rgba(11, 14, 13, 0.95);
    --tpp-border: rgba(105, 171, 128, 0.72);
    --tpp-text: #FFFFFF;
    --tpp-muted: rgba(255, 255, 255, 0.62);

    position: relative;
    width: 100vw;
    height: min(78vh, 900px);
    min-height: 520px;
    margin-left: calc(50% - 50vw);
    overflow: hidden;
    background: #000;
    isolation: isolate;
}

.tpp-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: crosshair;
}

.tpp-controls {
    position: absolute;
    z-index: 5;
    left: 50%;
    bottom: max(18px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 6px;
    border: 1px solid var(--tpp-border);
    border-radius: 999px;
    background: rgba(8, 11, 10, 0.88);
    box-shadow: inset 0 0 0 1px rgba(165, 249, 78, 0.04);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.tpp-control,
.tpp-panel button {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--tpp-text);
    font: inherit;
    cursor: pointer;
}

.tpp-control {
    min-height: 44px;
    min-width: 64px;
    padding: 5px 12px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    line-height: 1;
    color: var(--tpp-lime);
}

.tpp-control:hover,
.tpp-control:focus-visible,
.tpp-control[aria-expanded="true"] {
    background: rgba(165, 249, 78, 0.10);
    color: var(--tpp-lime);
}

.tpp-control:focus-visible,
.tpp-panel button:focus-visible,
.tpp-particle-item input:focus-visible + span {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.tpp-panel {
    position: absolute;
    z-index: 6;
    bottom: 84px;
    left: 50%;
    transform: translateX(-50%);
    width: min(92vw, 360px);
    max-height: min(55vh, 480px);
    overflow: auto;
    padding: 12px;
    border: 1px solid var(--tpp-border);
    border-radius: 16px;
    background: var(--tpp-panel-bg);
    color: var(--tpp-text);
    box-shadow:
        inset 0 0 0 1px rgba(165, 249, 78, 0.035),
        0 8px 30px rgba(0, 0, 0, 0.16);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.tpp-motion-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.tpp-motion-panel[hidden],
.tpp-particle-panel[hidden] {
    display: none;
}

.tpp-motion-panel .tpp-panel-title {
    grid-column: 1 / -1;
}

.tpp-motion-panel button {
    min-height: 44px;
    border: 1px solid var(--tpp-border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--tpp-text);
}

.tpp-motion-panel button:hover,
.tpp-motion-panel button:focus-visible {
    border-color: var(--tpp-lime);
    color: var(--tpp-lime);
    background: rgba(165, 249, 78, 0.08);
}

.tpp-motion-panel button.is-active {
    background: var(--tpp-lime);
    border-color: var(--tpp-lime);
    color: #000;
}

.tpp-panel-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--tpp-lime);
}

.tpp-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.tpp-select-all {
    min-height: 36px;
    padding: 4px 10px;
    border: 1px solid var(--tpp-border) !important;
    border-radius: 999px;
    font-size: 12px !important;
    color: var(--tpp-lime) !important;
}

.tpp-particle-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 12px;
}

.tpp-particle-item {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    font-size: 13px;
    cursor: pointer;
}

.tpp-particle-item input {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    accent-color: var(--tpp-green);
}

.tpp-particle-item span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tpp-particle-item:hover span {
    color: var(--tpp-coral);
}

.tpp-hint {
    position: absolute;
    z-index: 4;
    left: 50%;
    bottom: 82px;
    transform: translateX(-50%);
    color: var(--tpp-muted);
    font-size: 11px;
    letter-spacing: 0.02em;
    pointer-events: none;
    opacity: 0;
    animation: tpp-hint 5s ease 0.8s 1 both;
}

@keyframes tpp-hint {
    0% { opacity: 0; }
    12%, 62% { opacity: 0.68; }
    100% { opacity: 0; }
}

.tpp-empty {
    position: absolute;
    z-index: 4;
    inset: 0;
    display: grid;
    place-content: center;
    gap: 6px;
    padding: 24px;
    text-align: center;
    color: var(--tpp-text);
    pointer-events: none;
}

.tpp-empty[hidden] {
    display: none;
}

.tpp-empty span {
    color: var(--tpp-muted);
    font-size: 13px;
}

/* If desktop is disabled in settings, leave the existing desktop homepage alone. */
@media (min-width: 783px) {
    body.tpp-desktop-disabled .tpp-playground {
        display: none;
    }
}

/* Mobile "app" mode:
   The playground becomes a fixed layer beneath the existing Blocksy/theme header.
   The original homepage is still present underneath and is never edited.
*/
@media (max-width: 782px) {
    html:has(body.tpp-mobile-replace),
    body.tpp-mobile-replace {
        overflow: hidden;
        overscroll-behavior: none;
    }

    body.tpp-mobile-replace .tpp-playground {
        position: fixed;
        z-index: 20;
        top: var(--tpp-mobile-top, 0px);
        right: 0;
        bottom: 0;
        left: 0;
        width: auto;
        height: auto;
        min-height: 0;
        margin: 0;
    }

    body.tpp-mobile-replace .tpp-controls {
        bottom: max(12px, env(safe-area-inset-bottom));
        gap: 2px;
    }

    body.tpp-mobile-replace .tpp-control {
        min-width: 58px;
        padding-inline: 9px;
        font-size: 12px;
    }

    body.tpp-mobile-replace .tpp-panel {
        bottom: calc(72px + env(safe-area-inset-bottom));
        max-height: 48vh;
    }

    body.tpp-mobile-replace .tpp-hint {
        bottom: calc(70px + env(safe-area-inset-bottom));
    }

    body.tpp-mobile-replace .tpp-particle-list {
        grid-template-columns: 1fr 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tpp-hint {
        animation: none;
        opacity: 0.55;
    }
}
