/* Narrative Decay CSS */

/* Background Noise for the Body */
body.entropy-background::before {
    content: "";
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: -1;
    animation: staticNoise 0.2s infinite alternate;
}

@keyframes staticNoise {
    0% { transform: translate(0,0) scale(1); opacity: 0.02; }
    100% { transform: translate(-1%, 1%) scale(1.02); opacity: 0.04; }
}

/* Re-stabilization flash */
.stabilizing {
    animation: renderFlash 0.4s ease-out forwards;
}

@keyframes renderFlash {
    0% {
        color: #0070f3;
        text-shadow: 0 0 8px rgba(0, 112, 243, 0.8);
    }
    100% {
        color: inherit;
        text-shadow: none;
    }
}

.decay-active {
    opacity: 0.8;
    color: #555; /* Slightly faded */
}

/* Escape Hatch UI */
#opt-escape-hatch {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    font-family: system-ui, -apple-system, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

#hatch-toggle {
    background-color: #222;
    color: #fff;
    border: 1px solid #444;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

#hatch-toggle:hover {
    background-color: #333;
    transform: translateY(-2px);
}

#hatch-toggle.stabilized {
    background-color: #f0faf0;
    color: #2e7d32;
    border-color: #a5d6a7;
}

#hatch-panel {
    background: #fff;
    border: 1px solid #ddd;
    padding: 16px;
    border-radius: 8px;
    width: 300px;
    margin-bottom: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    color: #333;
}

#hatch-panel.hidden {
    display: none;
}

.promise-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-weight: 600;
    font-size: 0.95em;
    cursor: pointer;
    margin: 12px 0;
}

.promise-label input {
    margin-top: 4px;
}

.hatch-warning {
    font-size: 0.8em;
    color: #666;
    margin-bottom: 0;
    font-style: italic;
}
