
:root {
    --scanline-color: rgba(255,255,255,0.06);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    background: #000000;
    overflow: hidden;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Layout */

.page-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 5;
}

.skull-wrapper {
    position: relative;
    width: min(420px, 80vw);
    aspect-ratio: 1 / 1;
    transform-origin: center;
}

.skull-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Base skull */

.skull-base {
    z-index: 1;
    filter:
        drop-shadow(0 0 22px rgba(0,0,0,0.95))
        drop-shadow(0 0 10px rgba(0,0,0,0.9));
}

/* Glitch layers */

.skull-layer {
    z-index: 2;
    opacity: 0;
    pointer-events: none;
}

.skull-bright {
    mix-blend-mode: screen;
    filter:
        drop-shadow(0 0 12px rgba(220,220,220,0.9))
        contrast(1.05);
}

.skull-slice {
    mix-blend-mode: lighten;
    clip-path: inset(0);
}

/* Overlays */

.noise-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.18;
    mix-blend-mode: soft-light;
    background-image:
        repeating-linear-gradient(
            0deg,
            rgba(255,255,255,0.09) 0px,
            rgba(255,255,255,0.09) 1px,
            transparent 1px,
            transparent 2px
        ),
        repeating-linear-gradient(
            90deg,
            rgba(0,0,0,0.16) 0px,
            rgba(0,0,0,0.16) 1px,
            transparent 1px,
            transparent 4px
        );
    animation: staticNoise 1.05s steps(8, end) infinite;
    z-index: 1;
}

.scanline-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(
        to bottom,
        transparent 0,
        transparent 2px,
        var(--scanline-color) 3px
    );
    background-size: 100% 4px;
    mix-blend-mode: soft-light;
    opacity: 0.45;
    animation: scanlineMove 4.8s linear infinite;
    z-index: 2;
}

/* Random static bar */

.static-bar {
    position: fixed;
    left: 0;
    width: 100%;
    height: 0;
    opacity: 0;
    background: linear-gradient(
        to bottom,
        rgba(255,255,255,0.55),
        rgba(120,120,120,0.15)
    );
    mix-blend-mode: screen;
    pointer-events: none;
    z-index: 7;
}

/* Flash overlay (dark grey or bright silver chosen via JS) */

.flash-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    mix-blend-mode: screen;
    z-index: 6;
}

.flash-active {
    animation: flashPulse 0.3s ease-out;
}

/* Blocky noise chunks */

.block-noise {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    mix-blend-mode: soft-light;
    background-image:
        repeating-linear-gradient(
            0deg,
            rgba(255,255,255,0.08) 0,
            rgba(255,255,255,0.08) 2px,
            transparent 2px,
            transparent 6px
        ),
        repeating-linear-gradient(
            90deg,
            rgba(0,0,0,0.25) 0,
            rgba(0,0,0,0.25) 4px,
            transparent 4px,
            transparent 12px
        );
    z-index: 6;
}

.block-noise-active {
    animation: blockNoisePulse 0.22s steps(3, jump-end);
}

/* Animations */

@keyframes staticNoise {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-1px, 1px); }
    50% { transform: translate(2px, -1px); }
    75% { transform: translate(-2px, 1px); }
    100% { transform: translate(0, 0); }
}

@keyframes scanlineMove {
    0% { background-position: 0 0; }
    100% { background-position: 0 4px; }
}

@keyframes flashPulse {
    0% { opacity: 0.7; }
    40% { opacity: 0.45; }
    100% { opacity: 0; }
}

@keyframes blockNoisePulse {
    0% { opacity: 0.0; transform: translate(0,0); }
    30% { opacity: 0.5; transform: translate(-3px,1px); }
    70% { opacity: 0.4; transform: translate(2px,-2px); }
    100% { opacity: 0.0; transform: translate(0,0); }
}

/* Glitch packs (skull image slicing / offset) */

.glitch-pack-a .skull-bright {
    opacity: 1;
    animation: chromaGlitchA 0.16s steps(2, jump-end) infinite;
}
.glitch-pack-a .skull-base {
    animation: baseJitterA 0.18s steps(2, jump-end) infinite;
}

.glitch-pack-b .skull-slice {
    opacity: 1;
    animation: sliceGlitchB 0.18s steps(2, jump-end) infinite;
}
.glitch-pack-b .skull-base {
    animation: baseJitterB 0.21s steps(2, jump-end) infinite;
}

.glitch-pack-c .skull-bright,
.glitch-pack-c .skull-slice {
    opacity: 1;
    animation: chromaGlitchC 0.14s steps(2, jump-end) infinite;
}
.glitch-pack-c .skull-base {
    animation: baseJitterC 0.22s steps(2, jump-end) infinite;
}

/* Base jitter variants */

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

@keyframes baseJitterB {
    0% { transform: translate(0,0) scale(1); }
    50% { transform: translate(1px,-1px) scale(1.03); }
    100% { transform: translate(-1px,1px) scale(0.97); }
}

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

/* Slice / mask keyframes */

@keyframes chromaGlitchA {
    0% {
        transform: translate(-2px,-1px);
        clip-path: inset(0 0 35% 0);
    }
    50% {
        transform: translate(2px,1px);
        clip-path: inset(55% 0 0 0);
    }
    100% {
        transform: translate(-1px,1px);
        clip-path: inset(10% 0 45% 0);
    }
}

@keyframes sliceGlitchB {
    0% {
        transform: translate(1px,0);
        clip-path: inset(0 0 60% 0);
    }
    33% {
        transform: translate(-3px,1px);
        clip-path: inset(40% 0 10% 0);
    }
    66% {
        transform: translate(2px,-1px);
        clip-path: inset(15% 0 50% 0);
    }
    100% {
        transform: translate(0,0);
        clip-path: inset(0);
    }
}

@keyframes chromaGlitchC {
    0% {
        transform: translate(-1px,1px);
        clip-path: inset(0 0 30% 0);
    }
    25% {
        transform: translate(2px,-1px);
        clip-path: polygon(0 0, 100% 0, 100% 40%, 0 20%);
    }
    50% {
        transform: translate(-2px,2px);
        clip-path: polygon(0 60%, 100% 50%, 100% 100%, 0 100%);
    }
    75% {
        transform: translate(1px,-2px);
        clip-path: inset(30% 0 30% 0);
    }
    100% {
        transform: translate(0,0);
        clip-path: inset(0);
    }
}

/* Extra skull wrapper effects */

.skull-wrapper.shake {
    animation: skullShake 0.26s steps(2, jump-end) infinite;
}

@keyframes skullShake {
    0% { transform: translate(0,0); }
    25% { transform: translate(-3px,1px); }
    50% { transform: translate(3px,-3px); }
    75% { transform: translate(-2px,2px); }
    100% { transform: translate(0,0); }
}

.skull-wrapper.tilt-left {
    animation: tiltLeft 0.22s steps(2, jump-end) infinite;
}
.skull-wrapper.tilt-right {
    animation: tiltRight 0.22s steps(2, jump-end) infinite;
}
.skull-wrapper.warp {
    animation: skullWarp 0.22s steps(2, jump-end) infinite;
}
.skull-wrapper.zoom {
    animation: skullZoom 0.24s ease-in-out infinite;
}

@keyframes tiltLeft {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-3deg); }
}

@keyframes tiltRight {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(3deg); }
}

@keyframes skullWarp {
    0% { transform: skewX(0deg); }
    50% { transform: skewX(-4deg) scaleY(0.97); }
    100% { transform: skewX(3deg) scaleY(1.03); }
}

@keyframes skullZoom {
    0% { transform: scale(1); }
    50% { transform: scale(1.06); }
    100% { transform: scale(0.99); }
}

/* Responsive */

@media (max-width: 480px) {
    .skull-wrapper {
        width: min(320px, 90vw);
    }
}


/* Lyrics overlay layer */

.lyrics-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9;
    overflow: hidden;
}

.lyric-frag {
    position: absolute;
    white-space: nowrap;
    opacity: 0;
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    letter-spacing: 0.04em;
    text-transform: none;
    text-shadow:
        0 0 4px rgba(0,0,0,0.9),
        0 0 10px rgba(0,0,0,0.8);
    animation-name: lyricFloat;
    animation-timing-function: ease-in-out;
    animation-fill-mode: forwards;
}

@keyframes lyricFloat {
    0% {
        opacity: 0;
        transform: translate(-50%, 10px) scale(0.96);
    }
    15% {
        opacity: 0.85;
    }
    50% {
        opacity: 0.95;
        transform: translate(-50%, 0) scale(1.0);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -20px) scale(1.06);
    }
}
