/* Entropy Garden — sidebar, modals, HUD, terminal, playlist */

/* --- CANVAS --- */
#grid-canvas {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10;
    touch-action: none;
    opacity: 0;
    transition: opacity 2.5s ease-out;
}

body.cipher-active #grid-canvas {
    pointer-events: auto;
    cursor: ns-resize;
}

#grid-canvas.matrix-visible {
    opacity: 1;
    /* greyscale/blur stay at 0 awake so idle can interpolate the same filter list */
    filter:
        hue-rotate(var(--matrix-hue, 0deg))
        grayscale(0%)
        blur(0px)
        var(--chroma-filter);
}

/* Safari / lite: skip animated hue-rotate; keep static chromatic split */
body.perf-safari #grid-canvas.matrix-visible,
body.perf-lite #grid-canvas.matrix-visible {
    filter:
        grayscale(0%)
        blur(0px)
        var(--chroma-filter-lite);
}

/* Idle sleep: same 15s greyscale/blur ramp as the UI; chroma preserved after */
body.idle-dissociating #grid-canvas.matrix-visible {
    transition: filter 15s ease-in-out, opacity 2.5s ease-out;
    filter:
        hue-rotate(var(--matrix-hue, 0deg))
        grayscale(100%)
        blur(3px)
        var(--chroma-filter);
}

body.idle-dissociating.perf-safari #grid-canvas.matrix-visible,
body.idle-dissociating.perf-lite #grid-canvas.matrix-visible {
    filter:
        grayscale(100%)
        blur(3px)
        var(--chroma-filter-lite);
}

body.idle-dissociating.corrupted #grid-canvas.matrix-visible {
    filter:
        grayscale(100%)
        blur(3px)
        var(--chroma-filter-corrupted);
}

/* --- PANOPTICON EYE --- */
body:not(.ios-ui) #panopticon-eye {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, calc(-50% + 72px));
    width: clamp(110px, 16vw, 190px);
    height: clamp(110px, 16vw, 190px);
    z-index: 12;
    pointer-events: none;
    opacity: 0;
    transition:
        opacity 2.5s ease-out,
        transform 1.5s cubic-bezier(0.25, 1, 0.5, 1);
    filter: none;
}

#panopticon-eye {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: clamp(110px, 16vw, 190px);
    height: clamp(110px, 16vw, 190px);
    z-index: 12;
    pointer-events: none;
    opacity: 0;
    transition: opacity 2.5s ease-out;
    filter: none;
}

.panopticon-inner {
    width: 100%;
    height: 100%;
    transform-origin: center center;
    position: relative;
    z-index: 1;
}

#panopticon-comment {
    position: fixed;
    z-index: 13;
    margin: 0;
    padding: 6px 12px;
    box-sizing: border-box;
    width: max-content;
    width: fit-content;
    max-width: min(320px, 88vw);
    text-align: center;
    white-space: normal;
    font-family: var(--main-font);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    line-height: 1.4;
    color: rgba(0, 255, 0, 0.82);
    text-shadow: 0 0 8px rgba(0, 255, 0, 0.35);
    background: rgba(0, 8, 0, 0.55);
    border-radius: var(--radius-sm, 4px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.45s ease, visibility 0.45s ease;
    -webkit-user-select: none;
    user-select: none;
}

#panopticon-comment.has-media {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    max-width: min(220px, 42vw);
}

#panopticon-comment .panopticon-comment-text {
    display: block;
}

#panopticon-comment .panopticon-comment-media {
    display: block;
    width: 100%;
    max-width: 180px;
    height: auto;
    border-radius: var(--radius-sm, 4px);
    border: 1px solid rgba(0, 255, 0, 0.35);
    object-fit: cover;
    pointer-events: none;
}

body.corrupted #panopticon-comment .panopticon-comment-media {
    border-color: rgba(255, 0, 85, 0.4);
}

#panopticon-comment.visible {
    opacity: 1;
    visibility: visible;
}

body.garden-loading #panopticon-comment,
body:not(.garden-ready) #panopticon-comment {
    display: none !important;
}

body.corrupted #panopticon-comment {
    color: rgba(255, 0, 85, 0.82);
    text-shadow: 0 0 8px rgba(255, 0, 85, 0.35);
}

/* Not scoped to .visible — keeps oracle styling through the fade-out */
body.god-mode #panopticon-comment,
#panopticon-comment.panopticon-comment-god {
    color: rgba(210, 225, 255, 0.88);
    text-shadow: 0 0 10px rgba(160, 200, 255, 0.45);
    letter-spacing: 0.12em;
    font-size: 0.62rem;
    text-transform: uppercase;
}

/* Preformatted god-mode shapes (letter triangle, etc.) */
#panopticon-comment.has-pre {
    letter-spacing: 0.06em;
    line-height: 1.35;
    max-width: none;
    font-size: 0.68rem;
}

#panopticon-comment.has-pre .panopticon-comment-text {
    display: block;
    width: max-content;
    margin-inline: auto;
    text-align: left;
    white-space: pre;
    font-family: ui-monospace, 'Menlo', 'Cascadia Mono', 'Consolas', monospace;
    letter-spacing: 0.08em;
    /* letter-spacing adds after the last glyph — nudge so the pyramid reads centered */
    transform: translateX(-0.04em);
}

body:not(.ios-ui) #panopticon-eye.visible {
    opacity: 0.72;
    transform: translate(-50%, -50%);
}

#panopticon-eye.visible {
    opacity: 0.72;
}

.panopticon-sleep-zzz {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

#panopticon-eye.panopticon-zzz .panopticon-sleep-zzz {
    opacity: 1;
    visibility: visible;
}

.panopticon-sleep-zzz span {
    position: absolute;
    left: 22%;
    top: 18%;
    font-family: var(--main-font);
    font-size: clamp(1.05rem, 3.4vw, 1.65rem);
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1;
    color: rgba(0, 255, 0, 0.95);
    text-shadow:
        0 0 6px rgba(0, 255, 0, 0.85),
        0 0 14px rgba(0, 255, 0, 0.55),
        0 1px 0 rgba(0, 0, 0, 0.85);
    opacity: 0;
    animation: panopticonSleepZzz 2.6s ease-in-out infinite;
    will-change: transform, opacity;
}

.panopticon-sleep-zzz span:nth-child(2) {
    font-size: clamp(1.25rem, 4vw, 1.95rem);
    animation-delay: 0.85s;
}

.panopticon-sleep-zzz span:nth-child(3) {
    font-size: clamp(1.45rem, 4.6vw, 2.25rem);
    animation-delay: 1.7s;
}

body.corrupted .panopticon-sleep-zzz span {
    color: rgba(255, 80, 130, 0.98);
    text-shadow:
        0 0 6px rgba(255, 0, 85, 0.9),
        0 0 14px rgba(255, 0, 85, 0.55),
        0 1px 0 rgba(0, 0, 0, 0.85);
}

@keyframes panopticonSleepZzz {
    0% {
        opacity: 0;
        transform: translate(0, 4px) scale(0.75);
    }
    12% {
        opacity: 1;
    }
    70% {
        opacity: 0.9;
    }
    100% {
        opacity: 0;
        transform: translate(58%, -36px) scale(1.25);
    }
}

@media (prefers-reduced-motion: reduce) {
    .panopticon-sleep-zzz span {
        animation: none;
        opacity: 0;
    }

    .panopticon-sleep-zzz span:nth-child(2) {
        left: 44%;
        top: 8%;
        opacity: 0.95;
    }

    .panopticon-sleep-zzz span:nth-child(3) {
        left: 66%;
        top: 0%;
        opacity: 0.85;
    }

    #panopticon-eye.panopticon-zzz .panopticon-sleep-zzz span:first-child {
        top: 16%;
        opacity: 1;
    }
}

#panopticon-eye.dizzy {
    filter: none;
}

body.corrupted #panopticon-eye {
    filter: none;
}

body.corrupted #panopticon-eye.dizzy {
    filter: none;
}

#panopticon-eye.panopticon-high {
    filter: none;
    animation: panopticonHighPulse 4.2s ease-in-out infinite;
}

#panopticon-eye.panopticon-high .panopticon-iris-outer {
    stroke: #ff8fd0;
    opacity: 0.75;
}

#panopticon-eye.panopticon-high .panopticon-iris-mid {
    stroke: #b6ffb8;
    opacity: 0.95;
}

#panopticon-eye.panopticon-high .panopticon-pupil {
    fill: #ff4fa8;
}

#panopticon-eye.panopticon-high .panopticon-lid {
    stroke: #c8ffc8;
}

body.corrupted #panopticon-eye.panopticon-high {
    filter: none;
}

#panopticon-eye svg {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Tab-away reading scene — book under the eye, gaze scan driven in JS */
.panopticon-away-scene {
    position: absolute;
    left: 50%;
    top: 88%;
    width: 72%;
    transform: translateX(-50%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    z-index: 0;
}

#panopticon-eye.away-reading .panopticon-away-scene {
    opacity: 1;
    visibility: visible;
}

#panopticon-eye.away-fading .panopticon-away-scene {
    opacity: 0;
    visibility: hidden;
}

.panopticon-away-book {
    position: relative;
}

.panopticon-away-laptop {
    display: none;
    position: relative;
}

.away-activity-laptop .panopticon-away-book {
    display: none;
}

.away-activity-laptop .panopticon-away-laptop {
    display: block;
}

/* Nudge laptop left so the eye aims at the open screen */
.away-activity-laptop .panopticon-away-scene {
    left: 28%;
    transform: translateX(-50%);
}

.panopticon-away-book-icon {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    background-color: var(--neon-green);
    filter: drop-shadow(0 0 8px rgba(0, 255, 0, 0.45));
    mask-image: url('../assets/icons/book%20cover.svg');
    -webkit-mask-image: url('../assets/icons/book%20cover.svg');
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    transition: background-color 0.3s ease, filter 0.3s ease;
}

.panopticon-away-laptop-icon {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(0, 255, 0, 0.45));
    transition: filter 0.3s ease;
}

body.corrupted #panopticon-eye.away-reading .panopticon-away-book-icon {
    background-color: var(--alert-red);
    filter: drop-shadow(0 0 8px rgba(255, 0, 85, 0.45));
}

body.corrupted #panopticon-eye.away-reading .panopticon-away-laptop-icon {
    filter: hue-rotate(-120deg) drop-shadow(0 0 8px rgba(255, 0, 85, 0.45));
}

/* Morning coffee — bottom-left of the eye, local 09:15–09:30 */
.panopticon-morning-coffee {
    position: absolute;
    left: -10%;
    bottom: -4%;
    width: 42%;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 2;
    transition: opacity 0.45s ease, visibility 0.45s ease;
}

#panopticon-eye.panopticon-coffee-time .panopticon-morning-coffee {
    opacity: 1;
    visibility: visible;
}

.panopticon-coffee-icon {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    background-color: var(--neon-green);
    filter: drop-shadow(0 0 8px rgba(0, 255, 0, 0.45));
    mask-image: url('../assets/img/panopticon/coffee.png');
    -webkit-mask-image: url('../assets/img/panopticon/coffee.png');
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    transition: background-color 0.3s ease, filter 0.3s ease;
}

body.corrupted #panopticon-eye.panopticon-coffee-time .panopticon-coffee-icon {
    background-color: var(--alert-red);
    filter: drop-shadow(0 0 8px rgba(255, 0, 85, 0.45));
}

.panopticon-socket-fill {
    fill: rgba(0, 20, 0, 0.12);
    stroke: none;
}

.panopticon-socket-inlay {
    fill: url(#panopticon-inlay-shadow);
    stroke: none;
    pointer-events: none;
}

.panopticon-socket-inlay-rim {
    fill: url(#panopticon-inlay-rim);
    stroke: none;
    pointer-events: none;
    mix-blend-mode: multiply;
}

body.god-mode .panopticon-socket-fill,
body.god-mode .panopticon-socket-inlay,
body.god-mode .panopticon-socket-inlay-rim {
    fill: none;
}

body.corrupted .panopticon-socket-fill {
    fill: rgba(20, 0, 5, 0.18);
}

body.corrupted .panopticon-socket-inlay {
    fill: url(#panopticon-inlay-shadow);
    opacity: 0.85;
}

body.corrupted .panopticon-socket-inlay-rim {
    opacity: 0.9;
}

.panopticon-lid {
    stroke: var(--neon-green);
    stroke-width: 3;
    fill: none;
    stroke-linejoin: round;
}

body.corrupted .panopticon-lid {
    stroke: var(--alert-red);
}

.panopticon-iris-outer {
    stroke: var(--neon-green);
    stroke-width: 1.5;
    fill: none;
    opacity: 0.55;
}

.panopticon-iris-mid {
    stroke: var(--neon-green);
    stroke-width: 2;
    fill: none;
    opacity: 0.85;
}

.panopticon-pupil {
    fill: var(--neon-green);
}

body.corrupted .panopticon-iris-outer,
body.corrupted .panopticon-iris-mid {
    stroke: var(--alert-red);
}

body.corrupted .panopticon-pupil {
    fill: var(--alert-red);
}

#panopticon-eye svg {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body.corrupted #grid-canvas.matrix-visible {
    filter:
        grayscale(0%)
        blur(0px)
        var(--chroma-filter-corrupted);
}

/* --- INTERACTIVE TERMINAL (FAB morphs into panel and back) --- */
#terminal-container {
    --terminal-fab-size: 52px;
    position: fixed;
    right: calc(env(safe-area-inset-right) + 10px);
    bottom: calc(env(safe-area-inset-bottom) + 10px);
    left: auto;
    width: var(--terminal-fab-size);
    height: var(--terminal-fab-size);
    font-family: var(--main-font);
    font-size: 0.75rem;
    color: var(--neon-green);
    background: rgba(0, 12, 0, 0.92);
    border: 2px solid var(--neon-green);
    padding: 0;
    z-index: 10060;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 0 3px var(--neon-green);
    box-shadow: 0 0 14px rgba(0, 255, 0, 0.25);
    box-sizing: border-box;
    overflow: hidden;
    border-radius: var(--radius-md);
    transform: translateX(calc(100% + 24px));
    opacity: 0;
    pointer-events: none;
    cursor: default;
    transition:
        width 0.46s cubic-bezier(0.22, 1, 0.36, 1),
        height 0.46s cubic-bezier(0.22, 1, 0.36, 1),
        padding 0.46s cubic-bezier(0.22, 1, 0.36, 1),
        border-radius 0.46s cubic-bezier(0.22, 1, 0.36, 1),
        transform 1.5s cubic-bezier(0.25, 1, 0.5, 1),
        opacity 0.55s ease,
        background 0.35s ease,
        box-shadow 0.35s ease;
}

body.garden-loading #terminal-container,
body:not(.garden-ready) #terminal-container,
#terminal-container[hidden] {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

body.garden-ready #terminal-container.fab-ready:not([hidden]) {
    display: flex !important;
}

body.garden-ready #terminal-container.fab-ready.reveal-in:not([hidden]) {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

body.garden-ready #terminal-container.fab-ready.active:not([hidden]) {
    transform: translateX(0);
    opacity: 1;
    width: min(350px, calc(100vw - 20px - env(safe-area-inset-right)));
    height: min(220px, 44dvh);
    padding: 8px 10px;
    align-items: stretch;
    justify-content: flex-end;
    background: rgba(0, 0, 0, 0.9);
    box-shadow: 0 0 18px rgba(0, 255, 0, 0.18);
    pointer-events: auto;
}

#terminal-container #ios-terminal-toggle {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: inherit;
    background: transparent;
    color: inherit;
    font-family: inherit;
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    text-shadow: 0 0 6px var(--neon-green);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    opacity: 1;
    transition: opacity 0.2s ease;
    z-index: 2;
}

#terminal-container.active #ios-terminal-toggle {
    opacity: 0;
    pointer-events: none;
    transition-delay: 0s;
}

#terminal-container:not(.active) #ios-terminal-toggle {
    transition-delay: 0.22s;
}

#terminal-container #ios-terminal-toggle .ios-terminal-toggle-glyph {
    pointer-events: none;
}

body.garden-ready #terminal-container.fab-ready:not(.active):not([hidden]):hover {
    background: var(--neon-green);
    color: #000;
    -webkit-text-fill-color: #000;
    text-shadow: none;
    box-shadow: 0 0 18px rgba(0, 255, 0, 0.35);
}

body.garden-ready #terminal-container.fab-ready:not(.active):not([hidden]):hover #ios-terminal-toggle,
body.garden-ready #terminal-container.fab-ready:not(.active):not([hidden]):hover #ios-terminal-toggle .ios-terminal-toggle-glyph {
    color: #000;
    -webkit-text-fill-color: #000;
    text-shadow: none;
}

body.corrupted.garden-ready #terminal-container.fab-ready:not(.active):not([hidden]):hover {
    background: var(--alert-red);
    color: #000;
    -webkit-text-fill-color: #000;
    text-shadow: none;
    box-shadow: 0 0 18px rgba(255, 45, 45, 0.35);
}

body.corrupted.garden-ready #terminal-container.fab-ready:not(.active):not([hidden]):hover #ios-terminal-toggle,
body.corrupted.garden-ready #terminal-container.fab-ready:not(.active):not([hidden]):hover #ios-terminal-toggle .ios-terminal-toggle-glyph {
    color: #000;
    -webkit-text-fill-color: #000;
    text-shadow: none;
}

#terminal-container .terminal-panel {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}

#terminal-container.active .terminal-panel {
    opacity: 1;
    pointer-events: auto;
    transition-delay: 0.14s;
}

/* --- TERMINAL EATING ANIMATION --- */
@keyframes terminalBurp {
    0% { transform: scale(1); }
    30% { 
        transform: scale(1.05); /* Bulges outward by 5% */
        background: rgba(0, 40, 0, 0.95); /* Flashes a slightly brighter green */
        border-left: 6px solid var(--neon-green); /* Thickens the border */
    }
    100% { transform: scale(1); }
}

.burp-active {
    animation: terminalBurp 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#terminal-output { 
    flex-grow: 1; 
    overflow-y: auto; 
    display: flex; 
    flex-direction: column; 
    opacity: 0; 
    transition: opacity 0.3s ease; 
    pointer-events: none;
    padding-right: 8px; /* Breathing room for the scrollbar */
}

#terminal-container.active #terminal-output {
    opacity: 1; 
    pointer-events: auto; 
}

/* Pushes text to the bottom without breaking the scroll */
.term-entry:first-child {
    margin-top: auto; 
}

/* --- THE NEON SCROLLBAR --- */
#terminal-output::-webkit-scrollbar { 
    width: 6px; 
    display: block; /* Makes it visible again */
}

#terminal-output::-webkit-scrollbar-track { 
    background: rgba(0, 20, 0, 0.4); 
    border-radius: var(--radius-sm);
}

#terminal-output::-webkit-scrollbar-thumb { 
    background: var(--neon-green); 
    border-radius: var(--radius-sm); 
}

body.corrupted #terminal-output::-webkit-scrollbar-thumb { 
    background: var(--alert-red); 
}

.term-entry { 
    margin: 2px 0; animation: fadeInTerm 0.3s forwards; 
    opacity: 0; word-wrap: break-word; 
}

#terminal-output .term-entry em {
    font-style: italic;
    color: var(--cyan);
}

#terminal-input-line { display: flex; gap: 5px; margin-top: 5px; align-items: center; }

#terminal-container:not(.active) #terminal-input-line {
    pointer-events: none;
}

#term-input { 
    background: transparent; border: none; color: #fff; 
    font-family: var(--main-font); font-size: 0.75rem; 
    width: 100%; outline: none; text-shadow: 0 0 3px #fff; 
}

body.corrupted #terminal-container { 
    border-color: var(--alert-red); color: var(--alert-red); 
    text-shadow: 0 0 3px var(--alert-red); 
}

/* --- HUD --- */
#hud { 
    position: absolute; top: 20px; left: 50%; 
    transform: translate(-50%, -150px); z-index: 20; 
    text-align: center; width: 100%; pointer-events: none; 
    display: flex; flex-direction: column; align-items: center; 
    gap: 10px; opacity: 0; 
}

.hud-title-card {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 100;
    text-align: center;
}

.hud-title-card::after {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: var(--radius-xl);
    background: linear-gradient(90deg,
        hsl(0, 100%, 50%), hsl(60, 100%, 50%), hsl(120, 100%, 50%),
        hsl(180, 100%, 50%), hsl(240, 100%, 50%), hsl(300, 100%, 50%), hsl(0, 100%, 50%)
    );
    background-size: 200% 100%;
    background-position: var(--rainbow-offset, 0%) 50%;
    z-index: -1;
    padding: 3px;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    pointer-events: none;
}

.hud-credit {
    margin: 0;
    padding: 0;
    font-family: var(--main-font);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    line-height: 1.35;
    background: linear-gradient(90deg,
        hsl(0, 100%, 50%), hsl(60, 100%, 50%), hsl(120, 100%, 50%),
        hsl(180, 100%, 50%), hsl(240, 100%, 50%), hsl(300, 100%, 50%), hsl(0, 100%, 50%)
    );
    background-size: 200% 100%;
    background-position: var(--rainbow-offset, 0%) 50%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

body.corrupted .hud-credit {
    background: none;
    -webkit-background-clip: unset;
    background-clip: unset;
    -webkit-text-fill-color: currentColor;
    color: var(--alert-red);
    text-shadow: 0 0 12px rgba(255, 0, 85, 0.55), 0 0 24px rgba(255, 0, 85, 0.25);
}

@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
    .hud-credit {
        background: none;
        -webkit-text-fill-color: var(--neon-green);
        color: var(--neon-green);
        text-shadow: 0 0 8px rgba(0, 255, 0, 0.4);
    }
}

/* --- GHOST REFRESH HINT --- */
#refresh-hint {
    display: none;
    color: var(--neon-green);
    font-family: var(--main-font);
    font-size: 0.75rem;
    letter-spacing: 2px;
    opacity: 0;
    pointer-events: none;
    text-shadow: 0 0 5px var(--neon-green);
    margin-top: auto;
    padding-top: 18px;
    text-align: center;
    width: 100%;
    flex-shrink: 0;
}

body.corrupted #refresh-hint {
    color: var(--alert-red);
    text-shadow: 0 0 5px var(--alert-red);
}

#hud.active.anim-drop { animation: animDrop 1.5s cubic-bezier(0.25, 1, 0.5, 1) forwards; }

#hud.active.anim-rise { animation: animRise 1.5s cubic-bezier(0.25, 1, 0.5, 1) forwards; }

#hud.active.anim-zoom { animation: animZoom 1.5s cubic-bezier(0.25, 1, 0.5, 1) forwards; }

#hud.active.anim-slide { animation: animSlide 1.5s cubic-bezier(0.25, 1, 0.5, 1) forwards; }

#hud.active.anim-glitch { animation: animGlitch 1.5s linear forwards; }

/* --- FULL SPECTRUM TEXT CYCLE (NO GLOW) --- */
@keyframes textSpectrum {
    0%   { color: hsl(0, 100%, 50%); }
    17%  { color: hsl(60, 100%, 50%); }
    33%  { color: hsl(120, 100%, 50%); }
    50%  { color: hsl(180, 100%, 50%); }
    67%  { color: hsl(240, 100%, 50%); }
    83%  { color: hsl(300, 100%, 50%); }
    100% { color: hsl(360, 100%, 50%); }
}

h1 { 
    font-family: 'PsychedelicFlames', var(--main-font);
    font-weight: normal; 
    font-size: 4.5rem; 
    margin: 0; 
    padding: 22px 40px 18px;
    transform: translateY(4px);
    text-transform: uppercase; 
    letter-spacing: 6px; 

   /* --- THE CENTERING ENGINE --- */
    display: inline-flex;       /* Changes from inline-block to flex */
    align-items: center;        /* Centers vertically (Y-axis) */
    justify-content: center;     /* Centers horizontally (X-axis) */
    
    margin: 0; 
    position: relative; 
    z-index: 100;


    /* --- TEXT RAINBOW --- */
    background: linear-gradient(90deg, 
        hsl(0, 100%, 50%), hsl(60, 100%, 50%), hsl(120, 100%, 50%), 
        hsl(180, 100%, 50%), hsl(240, 100%, 50%), hsl(300, 100%, 50%), hsl(0, 100%, 50%)
    );
    background-size: 200% 100%;
    background-position: var(--rainbow-offset, 0%) 50%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

/* Title border lives on .hud-title-card; credit sits below the frame in #hud. */

/* Updated animation to loop seamlessly */
@keyframes gradientShift { 
    0% { background-position: 0% 50%; } 
    100% { background-position: 400% 50%; } 
}

#panopticon-eye.flash-anim,
.flash-anim { animation: flash 0.3s ease-out; }

/* --- MODALS --- */
.modal { display: none; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 450px; z-index: 20000; }

.modal.wide { width: 700px; }

.modal-content { 
    background: var(--glass); color: #ddd; padding: 40px; 
    border-radius: var(--radius-lg);
    border: 1px solid rgba(0, 255, 0, 0.25);
    border-left: 5px solid var(--neon-green);
    box-shadow: 10px 10px 30px rgba(0,0,0,0.8);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal h2 { 
    font-family: var(--main-font); /* <-- Added! */
    margin-top: 0; 
    color: var(--neon-green); 
    font-size: 1.5rem; 
    border-bottom: 1px solid #555; 
    padding-bottom: 15px; 
    margin-bottom: 20px; 
    display: flex; 
    align-items: center; 
    gap: 15px; 
    cursor: grab; 
}

.modal h2:active { cursor: grabbing; }

.modal.dragging,
.modal.dragging * { user-select: none; }

.modal h2.drag-handle { touch-action: none; }

.icon-spin { width: 30px; height: 30px; display: inline-block; animation: spin3D 4s linear infinite; }

.scrollable-content { max-height: 50vh; overflow-y: auto; padding-right: 15px; }

#modal-vault.modal.wide {
    width: min(94vw, 980px);
}

#modal-vault .modal-content {
    max-height: min(88vh, 980px);
    overflow: hidden;
}

#modal-vault .scrollable-content {
    flex: 1 1 auto;
    min-height: 0;
    max-height: min(68vh, 780px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-right: 15px;
}

#modal-about .scrollable-content {
    padding-top: 8px;
}

.about-identity-header {
    border-bottom: 1px solid rgba(0, 255, 0, 0.25);
    margin-bottom: 20px;
    padding-bottom: 20px;
}

.about-identity-meta {
    width: 100%;
}

.about-bio-body {
    padding-top: 4px;
}

.scrollable-content::-webkit-scrollbar { width: 6px; }

.scrollable-content::-webkit-scrollbar-thumb { background: var(--neon-green); border-radius: var(--radius-sm); }

body.corrupted .scrollable-content::-webkit-scrollbar-thumb { background: var(--alert-red); }

.live-feed {
    margin-top: 1.25rem;
    padding-top: 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.live-feed-stats {
    margin: 0 0 0.65rem;
    font-family: monospace;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    color: rgba(236, 236, 236, 0.92);
}

.live-feed-stream {
    display: grid;
    place-items: center;
    min-height: 3.4em;
    padding: 0.7rem 0.85rem;
    border: 1px solid rgba(0, 255, 0, 0.14);
    border-radius: var(--radius-sm);
    background: rgba(0, 18, 0, 0.38);
}

body.corrupted .live-feed-stream {
    border-color: rgba(255, 80, 100, 0.18);
    background: rgba(28, 0, 6, 0.38);
}

.live-feed-status {
    margin: 0;
    width: 100%;
    font-family: monospace;
    font-size: 0.8rem;
    line-height: 1.45;
    text-align: center;
    color: rgba(0, 255, 0, 0.82);
}

body.corrupted .live-feed-status {
    color: rgba(255, 80, 100, 0.86);
}

.live-feed-status.is-animating {
    animation: liveFeedItem 4.2s ease forwards;
    will-change: transform, opacity;
}

.trophy-case-scroll { max-height: 55vh; }

.trophy-case-intro {
    font-size: 0.85rem;
    color: #888;
    margin: 0 0 12px;
    line-height: 1.5;
}

.trophy-count {
    font-family: var(--main-font);
    color: var(--cyan);
    margin: 0 0 16px;
    letter-spacing: 0.05em;
}

.trophy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.trophy-card {
    border: 1px solid rgba(0, 255, 0, 0.2);
    border-radius: var(--radius-md);
    padding: 10px 10px 12px;
    text-align: center;
    background: rgba(0, 12, 0, 0.35);
    min-height: 132px;
    display: grid;
    grid-template-rows: 50px minmax(0, 1fr);
    align-items: start;
    gap: 8px;
}

.trophy-card.locked {
    border-color: rgba(255, 255, 255, 0.08);
    opacity: 0.55;
}

.trophy-card.unlocked {
    border-color: rgba(0, 255, 0, 0.45);
    box-shadow: 0 0 12px rgba(0, 255, 0, 0.12);
}

.trophy-visual {
    width: 100%;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.trophy-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    min-height: 72px;
}

.trophy-card.locked .trophy-meta {
    visibility: hidden;
}

.trophy-icon {
    width: 40px;
    height: 40px;
    display: block;
    flex-shrink: 0;
}

.trophy-unlock-flash-icon {
    width: 70px;
    height: 70px;
    display: block;
}

/* Theme-colored icons (mask + --neon-green; follows corrupted mode) */
.mask-icon {
    display: inline-block;
    flex-shrink: 0;
    background-color: var(--neon-green);
    background-image: none;
    filter: none;
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    transition: background-color 0.3s ease;
}

body.corrupted .mask-icon {
    background-color: var(--alert-red);
}

.mask-icon--sidebar {
    width: 24px;
    height: 24px;
}

.mask-icon--sidebar-lg {
    width: 30px;
    height: 30px;
}

.mask-icon--playlist {
    width: 18px;
    height: 18px;
}

.mask-icon--identity {
    mask-image: url('../assets/icons/identity.svg');
    -webkit-mask-image: url('../assets/icons/identity.svg');
}

.mask-icon--stats {
    mask-image: url('../assets/icons/stats.svg');
    -webkit-mask-image: url('../assets/icons/stats.svg');
}

.mask-icon--about {
    mask-image: url('../assets/icons/about.svg');
    -webkit-mask-image: url('../assets/icons/about.svg');
}

.mask-icon--storage {
    mask-image: url('../assets/icons/storage.svg');
    -webkit-mask-image: url('../assets/icons/storage.svg');
}

.mask-icon--mr-disco {
    mask-image: url('../assets/icons/mr-disco-sidebar.png');
    -webkit-mask-image: url('../assets/icons/mr-disco-sidebar.png');
}

.mask-icon--signal {
    mask-image: url('../assets/icons/signal.svg');
    -webkit-mask-image: url('../assets/icons/signal.svg');
}

.mask-icon--vault {
    mask-image: url('../assets/icons/vault.svg');
    -webkit-mask-image: url('../assets/icons/vault.svg');
}

.mask-icon--cog {
    mask-image: url('../assets/icons/cog.svg');
    -webkit-mask-image: url('../assets/icons/cog.svg');
}

.mask-icon--joystick {
    mask-image: url('../assets/icons/joystick.svg');
    -webkit-mask-image: url('../assets/icons/joystick.svg');
}

.mask-icon--cards {
    mask-image: url('../assets/icons/cards.svg');
    -webkit-mask-image: url('../assets/icons/cards.svg');
}

.mask-icon--feather {
    mask-image: url('../assets/icons/feather.svg');
    -webkit-mask-image: url('../assets/icons/feather.svg');
}

.mask-icon--trophy {
    mask-image: url('../assets/icons/trophy.svg');
    -webkit-mask-image: url('../assets/icons/trophy.svg');
}

.mask-icon--skip {
    mask-image: url('../assets/icons/skip.png');
    -webkit-mask-image: url('../assets/icons/skip.png');
}

.mask-icon--skip-next {
    mask-image: url('../assets/icons/skip.png');
    -webkit-mask-image: url('../assets/icons/skip.png');
    transform: scaleX(-1);
}

.mask-icon--play {
    mask-image: url('../assets/icons/play.svg');
    -webkit-mask-image: url('../assets/icons/play.svg');
}

.mask-icon--pause {
    mask-image: url('../assets/icons/pause.svg');
    -webkit-mask-image: url('../assets/icons/pause.svg');
}

.trophy-unlock-flash-icon.mask-icon {
    width: 72px;
    height: 72px;
}

.trophy-unlock-flash {
    position: fixed;
    top: 16%;
    left: 50%;
    z-index: 1000001;
    pointer-events: none;
    transform: translateX(-50%);
    animation: trophyUnlockFlash 1.35s ease forwards;
}

.trophy-mystery {
    font-family: var(--main-font);
    font-size: 1.75rem;
    line-height: 40px;
    height: 40px;
    color: #555;
    letter-spacing: 0;
}

.terminal-insult-flash {
    position: fixed;
    top: 16%;
    left: 50%;
    z-index: 1000001;
    pointer-events: none;
    transform: translateX(-50%);
    animation: terminalInsultFlash 1.35s ease forwards;
}

.terminal-insult-flash-icon {
    width: 72px;
    height: 72px;
    display: block;
    object-fit: contain;
}

.trophy-title {
    font-family: var(--main-font);
    font-size: 0.72rem;
    color: var(--neon-green);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.trophy-card.locked .trophy-title { color: #666; }

.trophy-desc {
    font-size: 0.7rem;
    color: #999;
    line-height: 1.35;
    margin: 0;
}

.modal ul { list-style: none; padding: 0; margin: 0; }

.modal li { margin-bottom: 12px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 5px; }

.stat-row { display: flex; justify-content: space-between; }

.stat-val { color: var(--neon-green); font-weight: bold; text-align: right; max-width: 60%; }

.lightbox-close {
    position: fixed;
    top: 40px;
    right: 40px;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    font-size: 0;
    font-weight: bold;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1000000;
    line-height: 1;
    padding: 0;
    box-sizing: border-box;
}

.lightbox-close::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: transparent;
    transition: background-color 0.2s ease;
}

.lightbox-close::after {
    content: '×';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(calc(-50% + 0.5px), -50%);
    font-family: var(--main-font);
    font-size: 24px;
    font-weight: bold;
    line-height: 1;
    color: var(--neon-green);
    -webkit-text-fill-color: var(--neon-green);
    transition: color 0.2s ease, -webkit-text-fill-color 0.2s ease;
    pointer-events: none;
}

.modal-content > .lightbox-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
}

#lightbox-overlay > .lightbox-close {
    position: fixed;
    top: 40px;
    right: 40px;
}

.lightbox-close:hover::before {
    background: var(--neon-green);
}

.lightbox-close:hover::after {
    color: #000;
    -webkit-text-fill-color: #000;
}

a.social-link { color: var(--neon-green); text-decoration: none; border-bottom: 1px dotted var(--neon-green); transition: color 0.3s, background 0.3s, border-color 0.3s; cursor: pointer; }

a.social-link:hover { color: #000; background: var(--neon-green); border-bottom-color: transparent; border-bottom-style: solid; }

.comms-socials {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin: 12px 0 0;
}

.comms-social {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    border-radius: 50%;
    opacity: 0.9;
    transition: opacity 0.2s ease, transform 0.2s ease, filter 0.2s ease;
}

.comms-social img {
    display: block;
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.comms-social:hover {
    opacity: 1;
    transform: translateY(-1px);
    filter: drop-shadow(0 0 6px rgba(0, 255, 0, 0.45));
}

body.corrupted .comms-social:hover {
    filter: drop-shadow(0 0 6px rgba(255, 0, 85, 0.45));
}

.project-title { color: var(--neon-green); font-weight: bold; display: block; }

.project-desc { color: #888; font-size: 0.85rem; display: block; font-style: italic; margin-top: 4px; }

.bio-p { line-height: 1.6; margin-bottom: 15px; color: #ddd; }

/* --- BIO PROFILE PICTURE --- */
.bio-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(0, 255, 0, 0.3);
    padding-bottom: 15px;
}

/* Identity + Bio Dump: centered avatar above copy */
.modal .bio-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    /* Room above avatar so box-shadow isn't clipped by scrollable overflow */
    padding-top: 20px;
}

.modal .bio-header > :not(.pfp-wrapper) {
    width: 100%;
}

/* --- BIO PROFILE PICTURE --- */
.pfp-wrapper {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 2px solid var(--neon-green);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.4);
    overflow: hidden; /* This acts as the clipping mask */
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-inline: auto;
}

.pfp-wrapper picture {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
}

.pfp-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    /* Zoom past beige corners while keeping the face centered */
    transform: scale(1.25);
    transform-origin: center center;
}

/* --- VAULT GRID (3-column masonry, vertical scroll) --- */
#modal-vault .vault-grid {
  --vault-gap: 14px;
  columns: 3;
  column-gap: var(--vault-gap);
  padding: 4px 2px 8px 0;
  width: 100%;
  box-sizing: border-box;
}

.vault-item {
    position: relative;
    display: block;
    width: 100%;
    height: fit-content;
    margin: 0 0 var(--vault-gap, 14px);
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    background: rgba(0,25,0,0.3);
    border: 1px solid var(--neon-green);
    overflow: hidden;
    border-radius: var(--radius-md);
    transition: border-color 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.vault-item:hover {
    border-style: solid; 
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.3);
}

/* Pins fill column width; frame height shrink-wraps to each asset */
.vault-media {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: none;
    object-fit: contain;
    object-position: center;
    filter: grayscale(80%) contrast(1.2) brightness(0.8);
    transition: filter 0.4s ease;
}

.vault-media--col-fill {
    width: 100%;
    max-width: 100%;
    height: auto;
    object-fit: contain;
    object-position: center;
}

.vault-media--landscape {
    aspect-ratio: auto;
    height: auto;
    max-height: none;
}

.vault-media:is(video:not(.vault-media--contain):not(.vault-media--sun):not(.vault-media--genesis)) {
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: none;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.vault-media.vault-media--sun:is(video) {
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: none;
    aspect-ratio: 541 / 675;
    object-fit: cover;
    object-position: center;
}

.vault-media.vault-media--genesis:is(video) {
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: none;
    aspect-ratio: 5 / 4;
    object-fit: cover;
    object-position: center;
}

.vault-media.vault-media--contain:is(video) {
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: none;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: #fff;
}

.vault-media--contain {
    object-fit: contain;
    background: #fff;
}

.vault-item-sphere {
    aspect-ratio: 1 / 1;
    cursor: pointer;
    background: #fff;
}

.vault-item-sphere:hover {
    box-shadow: 0 0 18px rgba(0, 255, 0, 0.35);
}

.vault-item--locked {
    display: none;
    aspect-ratio: 572 / 938;
    min-height: 180px;
    background:
        repeating-linear-gradient(
            0deg,
            rgba(0, 255, 0, 0.03) 0,
            rgba(0, 255, 0, 0.03) 2px,
            transparent 2px,
            transparent 6px
        ),
        rgba(0, 12, 0, 0.88);
    cursor: pointer;
}

.vault-item--locked:hover {
    box-shadow: 0 0 18px rgba(0, 255, 0, 0.45);
}

body.corrupted .vault-item--locked {
    display: block;
    border-color: var(--alert-red, #ff3355);
    background:
        repeating-linear-gradient(
            0deg,
            rgba(255, 51, 85, 0.05) 0,
            rgba(255, 51, 85, 0.05) 2px,
            transparent 2px,
            transparent 6px
        ),
        rgba(18, 0, 6, 0.92);
}

body.corrupted .vault-item--locked:hover {
    box-shadow: 0 0 18px rgba(255, 51, 85, 0.42);
}

body.corrupted .vault-locked-face {
    color: var(--alert-red, #ff3355);
}

.vault-locked-face {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    width: 100%;
    height: 100%;
    min-height: inherit;
    padding: 1.25rem 0.75rem;
    box-sizing: border-box;
    color: var(--neon-green);
    text-align: center;
}

.vault-locked-icon {
    font-size: clamp(2rem, 8vw, 2.75rem);
    line-height: 1;
    filter: grayscale(0.2);
}

.vault-locked-label {
    font-family: var(--font-mono, monospace);
    font-size: 0.72rem;
    letter-spacing: 0.28em;
    opacity: 0.85;
}

.vault-dialogue-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000002;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(2px);
    cursor: default;
}

.vault-dialogue-overlay[hidden] {
    display: none !important;
}

.vault-dialogue-panel {
    width: min(34rem, 100%);
    max-height: min(70vh, 34rem);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 1.1rem 0.9rem;
    border: 1px solid var(--neon-green);
    border-radius: var(--radius-md);
    background: rgba(0, 18, 0, 0.96);
    box-shadow: 0 0 24px rgba(0, 255, 0, 0.18);
    cursor: default;
}

.vault-dialogue-title {
    margin: 0;
    font-family: var(--font-mono, monospace);
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    color: var(--neon-green);
    opacity: 0.9;
}

.vault-dialogue-log {
    flex: 1 1 auto;
    min-height: 5.5rem;
    overflow: hidden;
    display: flex;
    align-items: center;
    padding-right: 0.2rem;
    font-family: var(--font-mono, monospace);
    font-size: 0.92rem;
    line-height: 1.45;
}

.vault-dialogue-log .vault-dialogue-line {
    width: 100%;
    margin: 0;
}

.vault-dialogue-line--cpu {
    color: #7dff7d;
}

.vault-dialogue-line--user {
    color: #dfffe0;
}

.vault-dialogue-speaker {
    color: var(--neon-green);
    font-weight: 700;
}

.vault-dialogue-gestures {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    vertical-align: middle;
}

.vault-dialogue-gestures--triple {
    min-width: 7.5rem;
    min-height: 2.4rem;
}

.vault-dialogue-gestures--waiting {
    visibility: hidden;
}

.vault-dialogue-gesture {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    background: center / contain no-repeat;
    vertical-align: middle;
    flex-shrink: 0;
}

.vault-dialogue-gesture--pending {
    visibility: hidden;
}

.vault-dialogue-choice--gesture {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 3rem;
}

.vault-dialogue-hint {
    margin: 0;
    font-family: var(--font-mono, monospace);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: lowercase;
    color: rgba(0, 255, 0, 0.65);
    animation: crtFlicker 1.4s infinite;
}

.vault-dialogue-actions {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.vault-dialogue-actions[hidden] {
    display: none !important;
}

.vault-dialogue-choice {
    width: 100%;
    margin: 0;
    padding: 0.72rem 0.85rem;
    border: 1px solid var(--neon-green);
    border-radius: var(--radius-md);
    background: rgba(0, 30, 0, 0.72);
    color: #dfffe0;
    font-family: var(--font-mono, monospace);
    font-size: 0.88rem;
    line-height: 1.35;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.vault-dialogue-choice:hover,
.vault-dialogue-choice:focus-visible {
    outline: none;
    border-color: #b8ffb8;
    background: rgba(0, 42, 0, 0.88);
    box-shadow: 0 0 14px rgba(0, 255, 0, 0.22);
}

.vault-dialogue-choice--reveal {
    border-color: var(--alert-red, #ff3355);
    color: #ffe3ea;
    background: rgba(36, 0, 10, 0.82);
}

.vault-dialogue-choice--reveal:hover,
.vault-dialogue-choice--reveal:focus-visible {
    border-color: #ff6680;
    background: rgba(52, 0, 14, 0.92);
    box-shadow: 0 0 14px rgba(255, 51, 85, 0.28);
}

body.corrupted .vault-dialogue-panel {
    border-color: var(--alert-red, #ff3355);
    box-shadow: 0 0 24px rgba(255, 51, 85, 0.18);
}

body.corrupted .vault-dialogue-title,
body.corrupted .vault-dialogue-speaker {
    color: var(--alert-red, #ff3355);
}

body.corrupted .vault-dialogue-line--cpu {
    color: #ff9db0;
}

body.corrupted .vault-dialogue-hint {
    color: rgba(255, 120, 140, 0.72);
}

body.corrupted .vault-dialogue-choice {
    border-color: var(--alert-red, #ff3355);
    background: rgba(36, 0, 10, 0.82);
    color: #ffe3ea;
}

body.corrupted .vault-dialogue-choice:hover,
body.corrupted .vault-dialogue-choice:focus-visible {
    border-color: #ff6680;
    background: rgba(52, 0, 14, 0.92);
    box-shadow: 0 0 14px rgba(255, 51, 85, 0.28);
}

.vault-media--sphere {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    background: #fff;
}

.vault-sphere-scene {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    perspective: 520px;
    background: #fff;
}

.vault-sphere-starburst {
    position: absolute;
    width: 89%;
    height: 89%;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    opacity: 1;
    animation: vault-sphere-starburst 15s linear infinite;
    pointer-events: none;
    z-index: 0;
    overflow: visible;
}

.vault-sphere-starburst polygon {
    fill: #000;
}

.vault-sphere-canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: block;
    background: transparent;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.vault-sphere-canvas--ready {
    opacity: 1;
}

.vault-sphere-eyes {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4%;
    z-index: 2;
    pointer-events: none;
}

.vault-sphere-eye {
    width: 15%;
    height: auto;
    flex-shrink: 0;
    overflow: visible;
}

.vault-sphere-eye-sclera {
    stroke: none;
}

.vault-sphere-eye--dark .vault-sphere-eye-sclera {
    fill: #000;
}

.vault-sphere-eye--light .vault-sphere-eye-sclera {
    fill: #fff;
}

.vault-sphere-eye-iris {
    fill: url(#panopticon-rainbow);
}

.vault-sphere-eye-pupil {
    fill: #0a0a0a;
}

@keyframes vault-sphere-starburst {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Reveals the full, bright, psychedelic color when you hover over it! */
.vault-item:hover .vault-media {
    filter: grayscale(0%) contrast(1) brightness(1); 
}

.video-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: -1;
}

.vault-item.carousel-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    padding: 0;
}

#lightbox-overlay .lightbox-content.vault-media--contain,
#lightbox-overlay video.lightbox-content.vault-media--contain {
    object-fit: contain;
    background: #fff;
    width: min(88vw, 88vh);
    height: min(88vw, 88vh);
    max-width: 900px;
    max-height: 900px;
}

#lightbox-overlay video.lightbox-content.vault-media--sun {
    width: min(90vw, calc(90vh * 541 / 675), 720px);
    height: auto;
    max-width: 720px;
    max-height: 90vh;
    aspect-ratio: 541 / 675;
    object-fit: cover;
    object-position: center;
    background: #000;
}

.carousel-stage {
    position: absolute;
    inset: 0;
}

.carousel-controls {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 11;
    background: none;
    padding: 0;
}

.carousel-controls .carousel-btn {
    pointer-events: auto;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.carousel-wrapper {
  overflow: hidden;
  width: 100%;
  height: 100%;
}

.carousel-track {
  display: flex;
  height: 100%;
  transition: transform 0.4s ease-in-out;
  will-change: transform;
}

/* Grayscale filters to match the other vault items */
.carousel-slide {
  flex: 0 0 100%;
  width: 100%;
  min-width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  filter: grayscale(80%) contrast(1.2) brightness(0.8);
  transition: filter 0.4s ease;
  cursor: zoom-in;
}

/* Reveal full color on hover */
.vault-item:hover .carousel-slide {
  filter: grayscale(0%) contrast(1) brightness(1); 
}

/* Terminal-Themed UI Buttons */
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: var(--neon-green);
  border: 1px solid var(--neon-green);
  padding: 8px 12px;
  cursor: pointer;
  font-size: 16px;
  z-index: 10;
  opacity: 0; /* Hidden by default so they don't block the art! */
  border-radius: var(--radius-sm);
  transition: all 0.3s ease;
}

/* Reveal the arrows only when you hover over the box */
.vault-item:hover .carousel-btn {
  opacity: 1;
}

.carousel-btn:hover {
  background: var(--neon-green);
  color: #000;
  box-shadow: 0 0 10px var(--neon-green);
}

/* Force them to the absolute edges using !important to prevent centering glitches */
.prev-btn { left: 0 !important; right: auto !important; }

.next-btn { right: 0 !important; left: auto !important; }

/* --- VAULT LIGHTBOX OVERLAY --- */
#lightbox-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.9); /* Almost pitch black */
    z-index: 999999; /* Sits above absolutely everything */
    justify-content: center;
    align-items: center;
    cursor: pointer; /* Indicates you can click to close */
    opacity: 0;
    transition: opacity 0.3s ease;
}

#lightbox-overlay.active {
    display: flex;
    opacity: 1;
}

.vault-lightbox-parting-gesture {
    position: fixed;
    left: 50%;
    bottom: 14%;
    z-index: 1000000;
    pointer-events: none;
    transform: translateX(-50%);
    animation: terminalInsultFlash 1.35s ease forwards;
}

.vault-lightbox-parting-gesture-icon {
    width: 72px;
    height: 72px;
}

/* The actual image/video inside the lightbox */
.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    border: 2px solid var(--neon-green);
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.3); /* Neon glow */
    border-radius: var(--radius-md);
    cursor: default; /* Standard cursor when hovering over the art itself */
    transform: scale(0.9);
    transition: transform 0.3s ease;
    object-fit: contain; /* Ensures the whole image fits on screen */
}

#lightbox-overlay img.lightbox-content {
    max-width: min(98vw, 1600px);
    max-height: 94vh;
    width: auto;
    height: auto;
}

#lightbox-overlay.active img.lightbox-content {
    transform: scale(1);
}

#lightbox-overlay.active .lightbox-content {
    transform: scale(1); /* Gives it a slight "pop in" effect */
}

#lightbox-overlay .vault-sphere-lightbox {
    position: relative;
    width: min(88vw, 88vh);
    height: min(88vw, 88vh);
    max-width: 900px;
    max-height: 900px;
    aspect-ratio: 1;
    padding: 0;
    overflow: hidden;
    background: #fff;
}

#lightbox-overlay .vault-sphere-lightbox .vault-sphere-scene {
    position: absolute;
    inset: 0;
}

/* --- BOSS KEY FAKE MAYA CRASH --- */
#boss-key-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #a0a0a0;
    z-index: 100000;
    font-family: var(--main-font);
    cursor: default;
    /* Win95 chrome is light — isolate from page color-scheme: dark */
    color-scheme: light;
    color: #000;
    -webkit-text-fill-color: #000;
}

#boss-key-overlay.active { display: block; }

.win-bg { width: 100%; height: 100%; background: #4a6d8c; }

.win95-window {
    width: 450px;
    background: #c0c0c0;
    border-top: 2px solid #fff;
    border-left: 2px solid #fff;
    border-right: 2px solid #000;
    border-bottom: 2px solid #000;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 2px 2px 5px rgba(0,0,0,0.5);
    color: #000;
    -webkit-text-fill-color: #000;
}

.win95-titlebar {
    background: #000080;
    color: #fff;
    -webkit-text-fill-color: #fff;
    padding: 3px 5px;
    font-weight: bold;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
}

#close-maya-btn { cursor: pointer; }

.win95-content {
    padding: 25px;
    display: flex;
    align-items: flex-start;
    gap: 20px;
    color: #000;
    -webkit-text-fill-color: #000;
    font-size: 13px;
    line-height: 1.5;
}

.win95-icon {
    width: 40px;
    height: 40px;
    background: red;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    -webkit-text-fill-color: #fff;
    font-weight: bold;
    font-size: 28px;
    flex-shrink: 0;
}

.win95-buttons { text-align: center; margin-bottom: 20px; }

.win95-btn {
    background: #c0c0c0;
    border-top: 2px solid #fff;
    border-left: 2px solid #fff;
    border-right: 2px solid #000;
    border-bottom: 2px solid #000;
    padding: 6px 20px;
    margin: 0 10px;
    cursor: pointer;
    font-family: var(--main-font);
    font-size: 12px;
    color: #000;
    -webkit-text-fill-color: #000;
}

.win95-btn:active {
    border-top: 2px solid #000;
    border-left: 2px solid #000;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
}

/* --- SINGULARITY EVENT --- */
#singularity-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background-color: #000;
    z-index: 100030;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    text-align: center;
    color: var(--cyan);
}

/* Ritual takes over the full viewport (iOS HUD/terminal sit at ~10004+) */
body.singularity-active #terminal-container,
body.singularity-active #playlist-menu,
body.singularity-active #settings-menu,
body.singularity-active #ios-scroll-shell,
body.singularity-active #docking-bay,
body.singularity-active #hud,
body.singularity-active #panopticon-eye,
body.singularity-active .control-panel,
body.singularity-active #sidebar-menu,
body.singularity-active #refresh-hint,
body.singularity-active #hamburger-icon {
    visibility: hidden !important;
    pointer-events: none !important;
}

#singularity-bg { 
    position: absolute; top: 0; left: 0; 
    width: 100%; height: 100%; 
    background-color: #050505; 
    background-image: url('../assets/img/backgrounds/bartek-garbowicz-xJeCLqsBUqc-unsplash.webp');
    background-size: cover; 
    background-position: center; 
    opacity: 0; z-index: 0; 
    animation: fadeInBg 5s ease-in-out forwards; 
}

#singularity-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; touch-action: none; cursor: grab; }

#singularity-canvas:active { cursor: grabbing; }

#poem-container { 
    position: absolute; 
    z-index: 10; 
    font-family: var(--poem-font);
    font-size: 1.35rem;
    font-weight: 400;
    line-height: 2.05;
    letter-spacing: 0.015em;
    font-variant-ligatures: common-ligatures;
    color: #fff;
    text-shadow: 0 0 10px cyan; 
    max-width: 800px;
    padding: 20px; 
    pointer-events: none; 
}

body.singularity-active #poem-container {
    pointer-events: auto;
    touch-action: pan-y;
}

body.singularity-active #singularity-controls {
    z-index: 100050;
    pointer-events: auto;
}

/* THE NEW SCROLL UP ANIMATION */
@keyframes scrollPoemUp {
    0% { top: 100%; opacity: 0; }  /* Starts below the screen */
    5% { opacity: 1; }
    90% { opacity: 1; }
    100% { top: -80%; opacity: 0; } /* Drifts high up above the screen */
}

.poem-line { 
    display: block; 
    margin-bottom: 15px; 
    opacity: 0; 
    animation: simpleFade 1s forwards;
    font-family: inherit;
    font-style: normal;
}

/* FIXED SINGULARITY CONTROLS */
#singularity-controls { 
    position: absolute; bottom: 10%; 
    left: 50%; transform: translateX(-50%); 
    z-index: 10000; display: flex; gap: 20px; 
    opacity: 0; pointer-events: auto; 
}

.singularity-btn { 
    padding: 10px 20px; 
    border: 1px solid var(--neon-green); 
    color: var(--neon-green); 
    cursor: pointer; 
    font-family: var(--main-font); 
    text-transform: uppercase; 
    background: rgba(0,0,0,0.8); 
    border-radius: var(--radius-sm);
    transition: all 0.3s;
    position: relative; 
    z-index: 10000; 
    pointer-events: auto; 
}

@media (hover: hover) and (pointer: fine) {
    .singularity-btn:hover {
        background: var(--neon-green);
        color: black;
        box-shadow: 0 0 15px var(--neon-green);
    }
}

/* <--- THIS IS THE BRACKET YOU WERE MISSING! */

/* --- SIDEBAR & HAMBURGER MENU --- */
/* Moves the Hamburger container to the TOP LEFT */
/* --- 1. Position the Hamburger (Top Left) --- */
.control-panel { 
    position: absolute; 
    top: 20px; 
    left: 30px; 
    right: auto !important; 
    z-index: 10001; /* High z-index to stay above grid */
    display: flex; 
}

/* --- Settings menu (top right): Safe Mode + Eye SFX --- */
.settings-menu {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 16px);
    right: calc(env(safe-area-inset-right, 0px) + 16px);
    z-index: 10030;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    opacity: 0;
    transform: translateY(calc(-100% - 48px));
    pointer-events: none;
    transition: transform 1.5s cubic-bezier(0.25, 1, 0.5, 1), opacity 1.5s ease;
}

.settings-menu.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.settings-toggle {
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.settings-toggle .mask-icon--cog {
    width: 22px;
    height: 22px;
    transform-origin: center;
    transition: transform 0.15s ease, background-color 0.3s ease, filter 0.3s ease;
}

.settings-toggle:hover .mask-icon,
.settings-toggle:focus-visible .mask-icon {
    background-color: #000;
    filter: none;
}

.settings-toggle.is-spinning .mask-icon--cog {
    animation: settings-cog-spin 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes settings-cog-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .settings-toggle.is-spinning .mask-icon--cog {
        animation: none;
    }
}

.settings-menu.is-open .settings-toggle {
    background: var(--neon-green);
    color: #000;
    border-color: #000;
}

.settings-menu.is-open .settings-toggle .mask-icon {
    background-color: #000;
    filter: none;
}

body.corrupted .settings-menu.is-open .settings-toggle {
    background: var(--alert-red);
}

.settings-dropdown {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    min-width: 148px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.82);
    border: 1px solid rgba(0, 255, 0, 0.35);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.settings-dropdown[hidden] {
    display: none !important;
}

body.corrupted .settings-dropdown {
    border-color: rgba(255, 0, 85, 0.4);
}

.settings-item {
    width: 100%;
    position: static !important;
    top: auto !important;
    right: auto !important;
    left: auto !important;
    opacity: 1 !important;
    transform: none !important;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

#panopticon-mute-btn.is-muted,
#birds-mute-btn.is-muted {
    color: var(--cyan);
    border-color: rgba(0, 255, 255, 0.45);
}

body.corrupted #panopticon-mute-btn.is-muted,
body.corrupted #birds-mute-btn.is-muted {
    color: var(--alert-red);
    border-color: rgba(255, 0, 85, 0.45);
}

/* --- 3. Hamburger Toggle Logic & Color --- */
#hamburger-icon {
    width: 35px; 
    height: 25px;
    cursor: pointer;
    display: flex; 
    flex-direction: column; 
    justify-content: space-between;
}

#hamburger-icon span { 
    display: block; 
    width: 100%; 
    height: 3px; 
    background: var(--neon-green) !important; /* Force green */ 
    border-radius: var(--radius-pill);
    transition: all 0.3s ease; 
}

/* Optional: Subtle glow boost on hover */
#hamburger-icon:hover span { 
    filter: brightness(1.2);
    box-shadow: 0 0 12px var(--neon-green);
}

/* --- 4. Sidebar Orientation (Left Side) --- */
#sidebar-menu {
    position: fixed;
    top: 0; 
    left: -500px; 
    width: 250px; 
    height: 100vh;
    background: rgba(5, 5, 5, 0.95);
    border-right: 2px solid var(--neon-green); 
    z-index: 9999;
    transition: left 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding-top: 100px;
    z-index: 10000;
    border-top-right-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
    overflow: hidden;
}

#sidebar-menu.active { 
    left: 0 !important; 
}

#sidebar-menu::before {
    content: '';
    position: absolute;
    top: 0;
    /* This creates a 500px wide 'shield' to the left of your actual menu */
    left: -500px; 
    width: 500px;
    height: 100%;
    background: rgba(5, 5, 5, 0.95); /* Matches your sidebar color */
    pointer-events: none;
}

#sidebar-menu ul { list-style: none; padding: 0; margin: 0; }

#sidebar-menu li {
    padding: 20px 30px;
    margin: 0 10px;
    color: var(--neon-green);
    font-family: var(--main-font);
    font-size: 1.1rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(0, 255, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 15px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

#sidebar-menu li:hover {
    background: var(--neon-green);
    box-shadow: inset 0 0 15px rgba(0,0,0,0.5);
    color: #000 !important;
    -webkit-text-fill-color: #000 !important;
}

/* --- SIDEBAR TEXT ANIMATION --- */
.sidebar-text {
    color: var(--neon-green) !important;
    -webkit-text-fill-color: var(--neon-green) !important;
    display: inline-block;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    /* Avoid translateZ — Safari often paints transformed text white */
    transform: translateX(-15px);
    /* Don't transition color/fill — Safari interpolates them as white */
    transition:
        max-width 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        opacity 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    white-space: nowrap;
}

/* --- THE HOVER OVERRIDES --- */
#sidebar-menu li:hover .sidebar-text,
#sidebar-menu li:hover .sidebar-text *,
#sidebar-menu li:hover .track-title-content,
#sidebar-menu li:hover .track-title-scroll,
#sidebar-menu li:hover .track-title-gap {
    color: #000 !important;
    -webkit-text-fill-color: #000 !important;
    text-shadow: none !important;
}

#sidebar-menu li:hover .sidebar-text {
    max-width: 200px;
    opacity: 1;
    transform: translateX(0);
}

#sidebar-menu li:hover .mask-icon {
    filter: none !important;
    background-color: #000 !important;
}

#sidebar-menu li .sidebar-text.track-title-marquee {
    flex: 1;
    min-width: 0;
}

/* Legacy alias — prefer .mask-icon */
.ui-icon {
    width: 24px;
    height: 24px;
    display: inline-block;
    flex-shrink: 0;
}

#playlist-menu {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 10002;
    background: rgba(0, 0, 0, 0.7);
    border-left: 2px solid var(--neon-green);
    padding: 10px;
    font-family: var(--main-font);
    border-radius: var(--radius-md);
    opacity: 0;
    transform: translateY(calc(100% + 48px));
    pointer-events: none;
    transition:
        transform 1.5s cubic-bezier(0.25, 1, 0.5, 1),
        opacity 1s ease,
        background 0.3s ease,
        border-color 0.3s ease;
}

/* Real mouse only — sticky :hover on iOS turns the panel green and can hide the title */
@media (hover: hover) and (pointer: fine) {
    #playlist-menu:hover {
        background: var(--neon-green);
        border-left-color: #000;
    }

    #playlist-menu:hover #playlist-header,
    #playlist-menu:hover #track-title,
    #playlist-menu:hover .track-title-content {
        color: #000 !important;
        -webkit-text-fill-color: #000 !important;
        text-shadow: none !important;
    }

    #playlist-menu:hover .ui-btn {
        border-color: #000;
        color: #000 !important;
        -webkit-text-fill-color: #000 !important;
        background: transparent;
        text-shadow: none !important;
    }

    #playlist-menu:hover .ui-btn:hover {
        background: rgba(0, 0, 0, 0.2);
        color: #000 !important;
        -webkit-text-fill-color: #000 !important;
    }

    #playlist-menu .ui-btn:hover .mask-icon,
    #playlist-menu:hover .mask-icon {
        filter: none;
        background-color: #000 !important;
    }

    body.corrupted #playlist-menu:hover {
        background: var(--alert-red);
        border-left-color: #000;
    }

    body.corrupted #playlist-menu:hover #playlist-header,
    body.corrupted #playlist-menu:hover #track-title,
    body.corrupted #playlist-menu:hover .track-title-content {
        color: #000 !important;
        -webkit-text-fill-color: #000 !important;
        text-shadow: none !important;
    }

    body.corrupted #playlist-menu .ui-btn:hover .mask-icon,
    body.corrupted #playlist-menu:hover .mask-icon {
        filter: none;
        background-color: #000 !important;
    }
}

/* Add this new class to handle the reveal */
#playlist-menu.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

#playlist-header {
    margin-bottom: 8px;
    font-size: 0.75rem;
    color: var(--neon-green);
    letter-spacing: 1px;
    min-width: 0;
    display: flex;
}

#track-title {
    flex: 1;
    min-width: 0;
    max-width: min(42vw, 220px);
    overflow: hidden;
    color: inherit;
    font-size: inherit;
    letter-spacing: inherit;
    line-height: 1.3;
}

.track-title-scroll {
    display: inline-flex;
    align-items: baseline;
    white-space: nowrap;
}

.track-title-marquee.is-static .track-title-scroll {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-title-marquee.is-scrolling .track-title-scroll {
    animation: track-title-marquee var(--marquee-duration, 20s) linear infinite;
    will-change: transform;
}

.track-title-marquee.is-scrolling:hover .track-title-scroll {
    animation-play-state: paused;
}

.track-title-gap {
    display: inline-block;
    padding: 0 1.5em;
    opacity: 0.45;
}

#playlist-controls {
    display: flex;
    gap: 8px;
}

#playlist-controls .ui-btn {
    font-size: 1rem;
    padding: 2px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#playlist-controls .ui-btn:hover .mask-icon {
    background-color: #000 !important;
}

#playlist-menu .ui-btn {
    font-size: 0.65rem;
    padding: 3px 8px;
}

body.corrupted #playlist-menu {
    border-color: var(--alert-red);
}

/* --- CORRUPT MODE FX OVERLAY (scanlines / static / tears) --- */
#corrupt-fx {
    position: fixed;
    inset: 0;
    z-index: 55;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    contain: strict;
}

body.corrupted.garden-ready #corrupt-fx {
    visibility: visible;
    opacity: 1;
}

body.corrupted.garden-ready::before {
    opacity: 0.3;
    filter: hue-rotate(-18deg) saturate(1.35) contrast(1.12);
}

.corrupt-fx-scanlines,
.corrupt-fx-noise,
.corrupt-fx-tear,
.corrupt-fx-blocks,
.corrupt-fx-vignette {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.corrupt-fx-scanlines {
    background: repeating-linear-gradient(
        to bottom,
        rgba(255, 40, 80, 0.045) 0px,
        rgba(255, 40, 80, 0.045) 1px,
        transparent 1px,
        transparent 3px
    );
    opacity: 0.35;
    mix-blend-mode: screen;
    animation: corruptScanDrift 9s linear infinite;
}

.corrupt-fx-noise {
    opacity: 0.07;
    mix-blend-mode: soft-light;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 180 180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
    background-size: 180px 180px;
    animation: corruptNoiseScrub 0.35s steps(2) infinite;
}

.corrupt-fx-vignette {
    background: radial-gradient(
        ellipse at center,
        transparent 42%,
        rgba(40, 0, 10, 0.28) 78%,
        rgba(0, 0, 0, 0.55) 100%
    );
    opacity: 0.55;
}

.corrupt-fx-tear {
    top: var(--corrupt-tear-y, 42%);
    bottom: auto;
    height: var(--corrupt-tear-h, 8%);
    left: -8%;
    right: -8%;
    opacity: 0;
    transform: translateX(var(--corrupt-tear-x, 10px));
    background:
        linear-gradient(
            90deg,
            transparent 0%,
            rgba(255, 0, 85, 0.35) 18%,
            rgba(0, 255, 255, 0.2) 52%,
            rgba(255, 80, 120, 0.35) 82%,
            transparent 100%
        ),
        repeating-linear-gradient(
            to bottom,
            rgba(255, 255, 255, 0.18) 0 1px,
            transparent 1px 3px
        );
    mix-blend-mode: screen;
    filter: contrast(1.35) saturate(1.4);
}

.corrupt-fx-blocks {
    opacity: 0;
    left: var(--corrupt-block-x, 20%);
    top: var(--corrupt-block-y, 30%);
    right: auto;
    bottom: auto;
    width: min(38vw, 280px);
    height: min(18vh, 120px);
    background:
        repeating-linear-gradient(
            90deg,
            rgba(255, 0, 85, 0.55) 0 6px,
            rgba(0, 0, 0, 0.65) 6px 12px,
            rgba(0, 255, 255, 0.2) 12px 14px,
            transparent 14px 22px
        );
    mix-blend-mode: color-dodge;
    transform: skewX(-8deg);
    box-shadow: 0 0 24px rgba(255, 0, 85, 0.35);
}

body.corrupt-static .corrupt-fx-noise {
    opacity: 0.42;
    animation-duration: 0.08s;
    filter: contrast(1.6) brightness(1.25);
}

body.corrupt-static .corrupt-fx-scanlines {
    opacity: 0.85;
    animation-duration: 0.6s;
}

body.corrupt-tear .corrupt-fx-tear {
    opacity: 0.95;
    animation: corruptTearPulse 0.2s steps(3) both;
}

body.corrupt-blocks .corrupt-fx-blocks {
    opacity: 0.9;
    animation: corruptBlockStutter 0.22s steps(2) both;
}

body.corrupt-flicker .corrupt-fx-vignette {
    animation: corruptVignettePulse 0.32s steps(3) both;
}

body.corrupt-flicker .corrupt-fx-scanlines {
    opacity: 0.95;
    animation: corruptScanFlash 0.32s steps(4) both;
}

body.corrupted.garden-ready:not(.perf-lite):not(.idle-dissociating) #grid-canvas.matrix-visible {
    animation: corruptMatrixBleed 7s ease-in-out infinite;
}

@keyframes corruptScanDrift {
    0% { background-position: 0 0; }
    100% { background-position: 0 120px; }
}

@keyframes corruptNoiseScrub {
    0% { transform: translate(0, 0); }
    50% { transform: translate(-2%, 1%); }
    100% { transform: translate(1%, -2%); }
}

@keyframes corruptTearPulse {
    0% { opacity: 0; transform: translateX(calc(var(--corrupt-tear-x, 10px) * -1)) scaleY(0.4); }
    35% { opacity: 1; transform: translateX(var(--corrupt-tear-x, 10px)) scaleY(1.15); }
    70% { opacity: 0.85; transform: translateX(calc(var(--corrupt-tear-x, 10px) * -0.4)) scaleY(0.85); }
    100% { opacity: 0; transform: translateX(0) scaleY(1); }
}

@keyframes corruptBlockStutter {
    0% { opacity: 0; clip-path: inset(0 60% 0 0); }
    40% { opacity: 1; clip-path: inset(0 10% 0 0); transform: skewX(-12deg) translateX(6px); }
    70% { opacity: 0.7; clip-path: inset(20% 0 10% 30%); transform: skewX(6deg) translateX(-8px); }
    100% { opacity: 0; clip-path: inset(0 0 0 100%); }
}

@keyframes corruptVignettePulse {
    0%, 100% { opacity: 0.55; }
    25% { opacity: 0.95; }
    50% { opacity: 0.35; }
    75% { opacity: 1; }
}

@keyframes corruptScanFlash {
    0%, 100% { opacity: 0.35; filter: none; }
    30% { opacity: 1; filter: contrast(1.8) brightness(1.3); }
    55% { opacity: 0.2; }
    80% { opacity: 0.9; }
}

@keyframes corruptMatrixBleed {
    0%, 100% {
        filter:
            grayscale(0%)
            blur(0px)
            var(--chroma-filter-corrupted);
    }
    48% {
        filter:
            grayscale(0%)
            blur(0px)
            drop-shadow(3px 0 0 rgba(255, 0, 85, 0.85))
            drop-shadow(-3px 0 0 rgba(255, 80, 120, 0.55));
    }
    52% {
        filter:
            grayscale(8%)
            blur(0.4px)
            drop-shadow(-4px 1px 0 rgba(255, 0, 85, 0.9))
            drop-shadow(4px -1px 0 rgba(0, 255, 255, 0.35));
    }
}

/* --- CHROMATIC ABERRATION GLITCH --- */
@keyframes chromaticFlash {
    0% {
        transform: translate(2px, 1px) skewX(2deg);
        text-shadow: 3px 0 0 var(--alert-red), -3px 0 0 var(--cyan);
        filter: drop-shadow(3px 0 0 var(--alert-red)) drop-shadow(-3px 0 0 var(--cyan));
    }
    15% {
        transform: translate(-5px, 2px) skewX(-3deg);
        text-shadow: -5px 0 0 var(--alert-red), 5px 0 0 var(--cyan), 0 2px 0 rgba(255, 255, 255, 0.25);
        filter: drop-shadow(-5px 0 0 var(--alert-red)) drop-shadow(5px 0 0 var(--cyan)) contrast(1.25);
    }
    20% {
        transform: translate(-3px, -2px) skewX(-2deg);
        text-shadow: -4px 0 0 var(--alert-red), 4px 0 0 var(--cyan);
        filter: drop-shadow(-4px 0 0 var(--alert-red)) drop-shadow(4px 0 0 var(--cyan));
    }
    40% {
        transform: translate(2px, 0px) skewX(1deg);
        text-shadow: 2px 0 0 var(--alert-red), -2px 0 0 var(--cyan);
        filter: none;
    }
    55% {
        transform: translate(6px, -1px) skewX(4deg);
        text-shadow: 6px 0 0 var(--alert-red), -2px 0 0 var(--cyan);
        filter: hue-rotate(-25deg) drop-shadow(6px 0 0 var(--alert-red));
    }
    60% {
        transform: translate(-1px, 3px) skewX(-1deg);
        text-shadow: -3px 0 0 var(--alert-red), 3px 0 0 var(--cyan);
        filter: drop-shadow(-3px 0 0 var(--alert-red)) drop-shadow(3px 0 0 var(--cyan));
    }
    80% {
        transform: translate(1px, -1px) skewX(0deg);
        text-shadow: 3px 0 0 var(--alert-red), -3px 0 0 var(--cyan);
        filter: none;
    }
    100% {
        transform: translate(0) skewX(0deg);
        text-shadow: none;
        filter: none;
    }
}

/* Toggled by the corrupt glitch engine in main.js */
body.chromatic-active {
    /* Chain with fadeInPage so the boot fade-in isn't reset */
    animation: fadeInPage 1.5s ease-out forwards, chromaticFlash 0.38s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

/* Lite / Safari: keep overlay FX, skip whole-page chromatic transforms */
body.perf-lite.chromatic-active,
body.perf-safari.chromatic-active {
    animation: fadeInPage 1.5s ease-out forwards;
}

body.perf-lite.chromatic-active #corrupt-fx .corrupt-fx-noise,
body.perf-safari.chromatic-active #corrupt-fx .corrupt-fx-noise {
    opacity: 0.35;
}

/* --- VAULT GENESIS VIDEO --- */

/* Thumbnail in the pin grid — clicks open the lightbox */
.vault-item video.vault-media--genesis {
    pointer-events: none;
    display: block;
}

#lightbox-overlay video.lightbox-content.vault-media--genesis {
    pointer-events: auto;
    width: min(90vw, calc(90vh * 5 / 4));
    height: auto;
    max-height: 90vh;
    max-width: 90vw;
    aspect-ratio: 5 / 4;
    object-fit: contain;
    background: #000;
    border: 2px solid var(--neon-green);
}

/* Drop this right above your closing </style> tag */
    .lightbox-overlay {
      display: none; 
      position: fixed;
      top: 0;
      left: 0;
      width: 100vw;
      height: 100vh;
      background: rgba(0, 0, 0, 0.9);
      z-index: 999999;
      justify-content: center;
      align-items: center;
    }

.lightbox-overlay.active {
      display: flex;
      opacity: 1;
      visibility: visible;
      z-index: 1000001;
    }

.lightbox-image-wrapper {
      position: relative;
      display: inline-block;
      max-width: 90vw;
      max-height: 90vh;
    }

#lightbox .lightbox-image-wrapper .lightbox-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
}

#lightbox-img {
      max-width: 100%;
      max-height: 90vh;
      object-fit: contain;
      border: 4px solid var(--neon-green);
      box-shadow: 6px 6px 0px rgba(0, 255, 0, 0.2);
      border-radius: var(--radius-md);
      display: block; /* Removes weird spacing under the image */
    }

.lightbox-btn {
      position: absolute;
      top: 50%;
      transform: translateY(-50%);
      background: rgba(0, 0, 0, 0.8);
      color: var(--neon-green);
      border: 1px solid var(--neon-green);
      padding: 16px 20px;
      cursor: pointer;
      font-size: 24px;
      z-index: 1000000;
      border-radius: var(--radius-sm);
      transition: all 0.2s;
    }

.lightbox-btn:hover { 
      background: var(--neon-green); 
      color: #000;
      box-shadow: 0 0 15px var(--neon-green);
    }

/* Pull the arrows 20px inward so they sit over the image */
    .lb-prev { left: 20px; }

.lb-next { right: 20px; }

.carousel-slide {
      cursor: zoom-in;
    }

/* --- MR. DISCO MODAL --- */
#modal-projects {
    width: min(94vw, 860px);
}

#modal-projects .modal-content {
    max-height: min(88vh, 720px);
    overflow: hidden;
}

#modal-projects .scrollable-content.mr-disco-showcase {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1 1 auto;
    min-height: 0;
    max-height: min(72vh, 620px);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.mr-disco-showcase-row {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    min-width: 0;
}

@media (max-width: 640px) {
    .mr-disco-showcase-row {
        flex-direction: column;
    }

    .mr-disco-stage {
        width: min(100%, 280px);
        max-height: min(38vh, 260px);
        margin-inline: auto;
    }

    .mr-disco-archive.is-open {
        width: 100%;
        max-width: 100%;
        height: min(38vh, 280px);
        min-height: min(38vh, 280px);
        max-height: min(38vh, 280px);
    }
}

.mr-disco-stage-shell {
    border: 2px solid var(--neon-green);
    border-radius: 8px;
    box-shadow: 0 0 24px rgba(0, 255, 0, 0.12);
    background: #141414;
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

.mr-disco-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.mr-disco-stage::before {
    content: '';
    position: absolute;
    inset: -35%;
    background: conic-gradient(
        from 0deg,
        #ff0055,
        #ffcc00,
        #0f0,
        #0ff,
        #6600ff,
        #ff0055
    );
    animation: discoStageChroma 14s linear infinite;
    z-index: 0;
}

@keyframes discoStageChroma {
    to { transform: rotate(360deg); }
}

.mr-disco-stage #disco-host {
    position: relative;
    z-index: 1;
    width: 88%;
}

.mr-disco-stage svg {
    width: 100%;
    height: auto;
    overflow: visible;
}

.mr-disco-search {
    position: relative;
    z-index: 2;
    margin: -20px 0 0;
    padding: 20px 16px 10px;
    background: linear-gradient(
        to bottom,
        rgba(8, 8, 8, 0) 0%,
        rgba(8, 8, 8, 0.42) 42%,
        rgba(10, 10, 10, 0.88) 100%
    );
    backdrop-filter: blur(12px) saturate(120%);
    -webkit-backdrop-filter: blur(12px) saturate(120%);
}

.mr-disco-search::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: 36px;
    background: linear-gradient(to top, rgba(6, 6, 6, 0.62), transparent);
    pointer-events: none;
}

.mr-disco-search input {
    width: 100%;
    margin: 0;
    padding: 4px 0 6px;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
    background: transparent;
    color: rgba(236, 236, 236, 0.9);
    font-family: Avenir, 'Avenir Next', Montserrat, 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 400;
    font-size: 0.74rem;
    letter-spacing: 0.03em;
    transition: border-color 0.2s ease, color 0.2s ease;
    box-shadow: none;
}

.mr-disco-search input::placeholder {
    color: rgba(170, 170, 170, 0.42);
}

.mr-disco-search input:focus {
    outline: none;
    border-bottom-color: rgba(0, 255, 0, 0.22);
    color: rgba(250, 250, 250, 0.96);
}

.mr-disco-archive {
    flex: 0 0 auto;
    width: 0;
    max-width: 0;
    height: 0;
    min-height: 0;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    padding: 0;
    visibility: hidden;
    background: linear-gradient(
        to bottom,
        rgba(10, 10, 10, 0.88) 0%,
        rgba(8, 8, 8, 0.96) 100%
    );
    border: 2px solid transparent;
    border-radius: 8px;
    transition:
        max-width 0.42s cubic-bezier(0.22, 1, 0.36, 1),
        width 0.42s cubic-bezier(0.22, 1, 0.36, 1),
        max-height 0.42s cubic-bezier(0.22, 1, 0.36, 1),
        height 0.42s cubic-bezier(0.22, 1, 0.36, 1),
        min-height 0.42s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.28s ease,
        padding 0.42s cubic-bezier(0.22, 1, 0.36, 1),
        border-color 0.28s ease,
        visibility 0s linear 0.42s;
    pointer-events: none;
}

.mr-disco-archive[hidden] {
    display: none;
}

.mr-disco-archive.is-open {
    width: min(280px, 34vw);
    max-width: min(280px, 34vw);
    height: min(72vh, 560px);
    min-height: min(72vh, 560px);
    max-height: min(72vh, 560px);
    opacity: 1;
    padding: 12px 14px 14px;
    overflow: auto;
    visibility: visible;
    pointer-events: auto;
    border-color: rgba(0, 255, 0, 0.22);
    box-shadow: 0 0 18px rgba(0, 255, 0, 0.08);
    transition:
        max-width 0.42s cubic-bezier(0.22, 1, 0.36, 1),
        width 0.42s cubic-bezier(0.22, 1, 0.36, 1),
        max-height 0.42s cubic-bezier(0.22, 1, 0.36, 1),
        height 0.42s cubic-bezier(0.22, 1, 0.36, 1),
        min-height 0.42s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.28s ease,
        padding 0.42s cubic-bezier(0.22, 1, 0.36, 1),
        border-color 0.28s ease,
        visibility 0s linear 0s;
}

.mr-disco-archive h3 {
    margin: 0 0 8px;
    font-family: Avenir, 'Avenir Next', Montserrat, 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 400;
    font-size: 0.92rem;
    line-height: 1.35;
    color: #f0f0f0;
}

.alt-history-entries {
    display: grid;
    gap: 0;
}

.alt-history-entry + .alt-history-entry {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.alt-history-entry h3 {
    margin: 0 0 6px;
}

.alt-history-meta {
    margin: 0 0 6px;
    font-family: Avenir, 'Avenir Next', Montserrat, 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 400;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--neon-green);
}

.alt-history-excerpt {
    margin: 0 0 8px;
    font-family: Avenir, 'Avenir Next', Montserrat, 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 400;
    font-size: 0.78rem;
    line-height: 1.5;
    color: #bdbdbd;
}

.alt-history-tags {
    margin: 0;
    font-size: 0.68rem;
    color: #777;
}

.alt-history-note {
    margin: 10px 0 0;
    font-size: 0.66rem;
    color: rgba(120, 120, 120, 0.85);
    font-style: italic;
}

.mr-disco-hint {
    margin: 0;
    flex-shrink: 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
    color: rgba(0, 255, 0, 0.55);
}

.mr-disco-hint--touch {
    display: none;
}
