/* =========================================
   Modal & Visual Effects
   ========================================= */

/* Reset Confirmation Modal */
.js-playground-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.js-playground-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.js-playground-modal {
    background-color: var(--editor-bg);
    color: var(--app-text);
    border: 1px solid var(--editor-border);
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 400px;
    text-align: center;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.js-playground-modal-overlay.active .js-playground-modal {
    transform: translateY(0);
}

.js-playground-modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    display: block;
}

.js-playground-modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.js-playground-modal-btn {
    padding: 8px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid transparent;
    transition: background-color 0.2s;
}

.js-playground-modal-btn.confirm {
    background-color: #d32f2f;
    color: white;
}
.js-playground-modal-btn.confirm:hover {
    background-color: #b71c1c;
}

.js-playground-modal-btn.cancel {
    background-color: transparent;
    border: 1px solid var(--editor-border);
    color: var(--app-text);
}
.js-playground-modal-btn.cancel:hover {
    background-color: var(--editor-gutter-bg);
}

/* Ripple Effect */
.js-playground-ripple {
    position: absolute; border-radius: 50%; transform: scale(0);
    animation: ripple 0.6s linear; background-color: rgba(255, 255, 255, 0.7); pointer-events: none;
}

@keyframes ripple { to { transform: scale(4); opacity: 0; } }

/* Success Overlay Effect (Confetti-like simple animation) */
body::before {
    content: " CONGRATULATIONS! ";
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 3rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 4px 10px rgba(0,0,0,0.5);
    z-index: 1000;
    pointer-events: none;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
}

body.js-playground-success-active::before {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Background flash */
body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,215,0,0.3) 0%, rgba(0,0,0,0) 70%);
    z-index: 999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s;
}

body.js-playground-success-active::after {
    opacity: 1;
    animation: flash 1s infinite alternate;
}

@keyframes flash {
    from { opacity: 0.3; }
    to { opacity: 0.6; }
}

/* Hidden Sandbox */
#sandboxContainer { display: none; }