/* =====================================================================================
   Local mod: hypnosis screen effects (driven by Scripts/hypno.js).
   In the game's own palette and never blocking: while an effect plays the whole page washes towards
   the effect's colour, a watermark (spiral, watch, rings, eyes) shows through the page, the page's
   words glow and drift, and a whisper card sways at the bottom. It all fades away on its own.
   Palette: mauve #734752, plum #865863, rose #a16969, dusty pink #c2a9af, parchment #e4e0d4.
   ===================================================================================== */

/* every piece fades in with .tth-in and out when it's removed */
.tth-tint, .tth-mark, .tth-layer { position: fixed; pointer-events: none; opacity: 0; transition: opacity 1.8s ease; }
.tth-tint.tth-in, .tth-layer.tth-in { opacity: 1; }
.tth-tint.tth-out, .tth-mark.tth-out, .tth-layer.tth-out { opacity: 0 !important; transition-duration: 2.2s; }

/* 1. colour wash: blends with everything on the page (backgrounds, messages, pictures) */
.tth-tint { inset: 0; z-index: 9988; mix-blend-mode: soft-light; }
.tth-tint > div { position: absolute; inset: 0; background: var(--tth-tint, #734752); animation: tth-tint 7s ease-in-out infinite; }
@keyframes tth-tint { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
.tth-fx-spiral { --tth-tint: #734752; }
.tth-fx-pinkspiral, .tth-fx-haze { --tth-tint: #d0577f; }
.tth-fx-pendulum { --tth-tint: #c9a45a; }
.tth-fx-tunnel { --tth-tint: #865863; }
.tth-fx-eyes { --tth-tint: #8a4f9a; }

/* 2. watermark in the middle of the screen, multiplied into the page so it looks printed on it */
.tth-mark {
    left: 50%; top: 50%; z-index: 9989; mix-blend-mode: multiply;
    width: min(76vmin, 620px); height: min(76vmin, 620px);
    margin: calc(min(76vmin, 620px) / -2) 0 0 calc(min(76vmin, 620px) / -2);
}
.tth-mark.tth-in { opacity: .26; }
.tth-mark svg { width: 100%; height: 100%; animation: tth-spin 14s linear infinite; }
.tth-fx-pinkspiral svg { animation-name: tth-spin-rev; animation-duration: 18s; }
@keyframes tth-spin { to { transform: rotate(360deg); } }
@keyframes tth-spin-rev { to { transform: rotate(-360deg); } }

/* pocket watch swinging from the top of the screen */
.tth-mark.tth-fx-pendulum { mix-blend-mode: normal; }
.tth-mark.tth-fx-pendulum.tth-in { opacity: .45; }
.tth-fx-pendulum .tth-swing { position: absolute; left: 50%; top: -48%; width: 0; height: 100%; transform-origin: 0 0; animation: tth-swing 3.6s ease-in-out infinite alternate; }
.tth-fx-pendulum .tth-chain { position: absolute; left: -1px; top: 0; width: 2px; height: 78%; background: #9b8255; }
.tth-fx-pendulum .tth-watch {
    position: absolute; left: -11%; top: 78%; width: 22%; height: 22%; border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #f3e8cf, #c9ad74 45%, #8a7044 80%);
    box-shadow: inset 0 0 0 3px #7a6238;
}
.tth-fx-pendulum .tth-watch::after { content: ""; position: absolute; inset: 16%; border-radius: 50%; background: #f4eddc; box-shadow: inset 0 0 6px rgba(0, 0, 0, .25); }
.tth-fx-pendulum .tth-hand { position: absolute; left: 50%; top: 50%; width: 2px; height: 30%; margin-left: -1px; background: #4a3a1c; transform-origin: 50% 0; z-index: 1; animation: tth-spin 10s linear infinite; }
@keyframes tth-swing { from { transform: rotate(-14deg); } to { transform: rotate(14deg); } }

/* trance tunnel: rings slowly drifting outwards */
.tth-mark.tth-fx-tunnel.tth-in { opacity: .4; }
.tth-fx-tunnel .tth-ring {
    position: absolute; left: 50%; top: 50%; width: 16%; height: 16%; margin: -8% 0 0 -8%; border-radius: 50%;
    border: 3px solid #865863; animation: tth-ring 8s linear infinite; opacity: 0;
}
@keyframes tth-ring { 0% { transform: scale(.3); opacity: 0; } 20% { opacity: .9; } 100% { transform: scale(6); opacity: 0; } }

/* glowing eyes that slowly blink */
.tth-mark.tth-fx-eyes { display: flex; align-items: center; justify-content: center; gap: 14%; }
.tth-mark.tth-fx-eyes.tth-in { opacity: .3; }
.tth-fx-eyes .tth-eye {
    width: 30%; height: 15%; border-radius: 50%;
    background: radial-gradient(circle, #734752 0 18%, #a16969 19% 38%, transparent 39%), #c2a9af;
    animation: tth-blink 6s ease-in-out infinite;
}
@keyframes tth-blink { 0%, 100% { transform: scaleY(1); } 46% { transform: scaleY(1); } 50% { transform: scaleY(.12); } 54% { transform: scaleY(1); } }

/* pink haze: no watermark, just the wash and a warm vignette */
.tth-mark.tth-fx-haze { display: none; }

/* 3. vignette + whisper card */
.tth-layer { inset: 0; z-index: 9990; overflow: hidden; }
.tth-vignette { position: absolute; inset: 0; box-shadow: inset 0 0 200px rgba(115, 71, 82, .55); animation: tth-breathe-v 5s ease-in-out infinite; }
.tth-fx-haze .tth-vignette { box-shadow: inset 0 0 260px rgba(207, 111, 140, .6); }
@keyframes tth-breathe-v { 0%, 100% { opacity: .7; } 50% { opacity: 1; } }

.tth-card {
    position: absolute; left: 50%; bottom: 12vh; transform: translateX(-50%) translateY(10px);
    width: max-content; max-width: min(560px, calc(100vw - 32px)); box-sizing: border-box;
    display: flex; align-items: center; gap: 12px; padding: 12px 18px;
    background: #c2a9af; color: #3d2329; border-bottom: 4px solid #a16969; border-radius: 6px;
    font-size: 17px; line-height: 1.4; font-style: italic;
    transition: transform 1.8s ease; pointer-events: none; /* never blocks the buttons underneath; it fades by itself */
    animation: tth-card-glow 4s ease-in-out infinite;
}
@keyframes tth-card-glow {
    0%, 100% { box-shadow: 0 4px 14px rgba(60, 30, 40, .3), 0 0 0 rgba(161, 105, 105, 0); }
    50% { box-shadow: 0 4px 14px rgba(60, 30, 40, .3), 0 0 26px rgba(161, 105, 105, .9); }
}
.tth-in .tth-card { transform: translateX(-50%) translateY(0); }
.tth-card .tth-icon { width: 34px; height: 34px; flex: none; }
.tth-card .tth-icon svg { width: 100%; height: 100%; animation: tth-spin 9s linear infinite; }
.tth-card .tth-from { display: block; font-size: 12px; font-style: normal; color: #734752; margin-top: 3px; }
/* in a session, each new line fades in as the last one fades out */
.tth-card .tth-text { display: block; transition: opacity .7s ease; }
.tth-card.tth-swap .tth-text { opacity: 0; }
.tth-card .tth-from { white-space: pre; }
.tth-card .tth-w { display: inline-block; white-space: pre; animation: tth-word 3.2s ease-in-out infinite; }
@keyframes tth-word {
    0%, 100% { transform: translateY(0); text-shadow: 0 0 0 rgba(115, 71, 82, 0); }
    50% { transform: translateY(-3px); text-shadow: 0 0 8px rgba(115, 71, 82, .55); }
}

/* 4. hypnotic text: while an effect plays, the page's words glow, drift and soften in waves */
body.tth-active .container p, body.tth-active .container td, body.tth-active .container li,
body.tth-active .container h1, body.tth-active .container h2, body.tth-active .container h3, body.tth-active .container h4,
body.tth-active .container label, body.tth-active .container .slotName, body.tth-active #notificationBox {
    animation: tth-text 5.5s ease-in-out infinite;
}
body.tth-active .container p:nth-of-type(2n), body.tth-active .container li:nth-child(2n), body.tth-active .container tr:nth-child(2n) td { animation-delay: -1.8s; }
body.tth-active .container p:nth-of-type(3n), body.tth-active .container li:nth-child(3n), body.tth-active .container tr:nth-child(3n) td { animation-delay: -3.6s; }
@keyframes tth-text {
    0%, 100% { text-shadow: 0 0 0 rgba(161, 105, 105, 0); filter: blur(0); transform: translate(0, 0); }
    35% { text-shadow: 0 0 6px rgba(161, 105, 105, .75), 0 0 1px rgba(115, 71, 82, .6); filter: blur(.35px); transform: translate(1.5px, -1px); }
    70% { text-shadow: 0 0 10px rgba(207, 140, 129, .8); filter: blur(.15px); transform: translate(-1.5px, 1px); }
}
body.tth-active #notificationBox { box-shadow: 0 0 18px rgba(161, 105, 105, .85); }

/* while someone is mind controlling you: a faint vignette and a small spiral badge */
body.tt-entranced::after {
    content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 9987;
    box-shadow: inset 0 0 120px rgba(115, 71, 82, .22);
    animation: tth-breathe-v 10s ease-in-out infinite;
}
.tth-badge {
    position: fixed; right: 12px; bottom: 12px; z-index: 9991; width: 32px; height: 32px; border-radius: 50%; padding: 3px;
    background: #e4e0d4; border: 1px solid #a16969; box-shadow: 0 1px 4px rgba(60, 30, 40, .25); cursor: pointer; opacity: .9;
}
.tth-badge:hover, .tth-badge:focus { opacity: 1; }
.tth-badge svg { width: 100%; height: 100%; animation: tth-spin 12s linear infinite; }

/* small banner on the mind control pages */
.tth-banner {
    display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin: 6px 0 14px;
    background: #e4e0d4; border-left: 4px solid #a16969; border-radius: 3px; color: #734752;
}
.tth-banner .tth-mini { width: 34px; height: 34px; flex: none; }
.tth-banner .tth-mini svg { width: 100%; height: 100%; animation: tth-spin 12s linear infinite; }
.tth-banner p { margin: 0; font-style: italic; }

@media (prefers-reduced-motion: reduce) {
    .tth-layer *, .tth-mark *, .tth-tint > div, .tth-badge svg, .tth-banner svg, body.tt-entranced::after { animation: none !important; }
    body.tth-active .container *, body.tth-active #notificationBox { animation: none !important; transform: none !important; filter: none !important; }
    .tth-fx-tunnel .tth-ring { opacity: .5; }
}
