/* ============ RESET & BASE ============ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #ffffff;
    --text: #0a0a0a;
    --gold: #c9a926;
    --red: #8b0000;
    --bsod-blue: #000080;
    --glitch-red: #ff0000;
    --glitch-green: #00ff41;
}

html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 700;
    cursor: none;
}

body.shake {
    animation: screenShake 0.1s infinite;
}

/* ============ CRT / NOISE / VIGNETTE OVERLAYS ============ */
.crt-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 9998;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.03) 0px,
        rgba(0, 0, 0, 0.03) 1px,
        transparent 1px,
        transparent 2px
    );
}

.noise-overlay {
    position: fixed;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    pointer-events: none;
    z-index: 9997;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    animation: noiseMove 0.2s steps(3) infinite;
}

.vignette {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 9996;
    background: radial-gradient(
        ellipse at center,
        transparent 50%,
        rgba(0, 0, 0, 0.15) 100%
    );
}

/* ============ CUSTOM CURSOR ============ */
#custom-cursor {
    position: fixed;
    pointer-events: none;
    z-index: 10001;
    width: 36px;
    height: 36px;
    transform: translate(-50%, -50%);
    transition: none;
}

#custom-cursor img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: brightness(1.2) contrast(1.3);
}

#custom-cursor.spinning img {
    animation: cursorSpin 0.4s ease-out;
}

.cursor-trail {
    position: fixed;
    pointer-events: none;
    z-index: 9995;
    width: 28px;
    height: 28px;
    opacity: 0.25;
    transform: translate(-50%, -50%);
}

.cursor-trail img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: brightness(0.8) contrast(1.1);
}

/* ============ NAVIGATION ============ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    background: linear-gradient(180deg, #c0c0c0 0%, #a0a0a0 50%, #808080 100%);
    border-bottom: 2px solid #404040;
    padding: 4px 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: #000;
    box-shadow: inset 0 1px 0 #fff, 0 2px 8px rgba(0,0,0,0.5);
    cursor: none;
}

.nav-logo {
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 1px;
    color: #000;
    text-shadow: 1px 1px 0 #c0c0c0;
    white-space: nowrap;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.nav-links a {
    color: #000080;
    text-decoration: underline;
    font-size: 11px;
    padding: 2px 4px;
    transition: all 0.3s;
    cursor: none;
    white-space: nowrap;
}

.nav-links a:hover {
    background: #000080;
    color: #fff;
}

.nav-sep {
    color: #666;
    font-size: 10px;
}

/* nav drift animation for chaos tiers */
.nav-links a.drifting {
    animation: navDrift 3s ease-in-out infinite;
}

/* ============ LOADING BAR ============ */
#loading-bar {
    position: fixed;
    top: 28px;
    left: 0;
    width: 100%;
    height: 3px;
    background: #333;
    z-index: 99;
    opacity: 0;
    transition: opacity 0.5s;
}

#loading-bar.visible {
    opacity: 1;
}

#loading-bar-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--glitch-green), var(--gold));
    transform-origin: right;
    animation: loadBackwards 8s linear infinite;
}

/* ============ MAIN CONTENT ============ */
.main-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 80px 20px 40px;
    gap: 60px;
    position: relative;
    z-index: 10;
}

.hero {
    text-align: center;
}

.coming-soon {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 900;
    font-size: clamp(4rem, 12vw, 10rem);
    color: var(--text);
    text-shadow:
        0 0 10px rgba(0, 0, 0, 0.3),
        0 0 40px rgba(0, 0, 0, 0.1);
    animation: textFlicker 4s ease-in-out infinite;
    position: relative;
    letter-spacing: 2px;
}

.coming-soon::before {
    content: attr(data-text);
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    color: var(--glitch-red);
    opacity: 0;
    clip-path: inset(0 0 0 0);
    animation: glitchClip 3s steps(1) infinite;
}

.coming-soon::after {
    content: attr(data-text);
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    color: var(--glitch-green);
    opacity: 0;
    clip-path: inset(0 0 0 0);
    animation: glitchClip2 3s steps(1) infinite;
}

/* ============ EMAIL FORM ============ */
.email-section {
    text-align: center;
    width: 100%;
    max-width: 500px;
}

#email-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

#email-input {
    background: #f5f5f5;
    border: 1px solid #ccc;
    border-bottom: 2px solid #000;
    color: var(--text);
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-weight: 700;
    font-size: 14px;
    padding: 14px 20px;
    width: 100%;
    outline: none;
    transition: all 0.3s;
    cursor: none;
}

#email-input:focus {
    border-color: #000;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
}

#email-input::placeholder {
    color: #888;
    font-style: italic;
}

#submit-btn {
    background: transparent;
    border: 2px solid #000;
    color: #000;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 900;
    font-size: 24px;
    padding: 12px 60px;
    letter-spacing: 8px;
    position: relative;
    overflow: hidden;
    transition: all 0.4s ease;
    cursor: none;
    animation: blackPulse 2s ease-in-out infinite;
}

#submit-btn:hover {
    border-color: var(--red);
    color: var(--red);
    animation: redPulse 1.2s ease-in-out infinite;
    text-shadow: 0 0 20px rgba(139, 0, 0, 0.8);
}

#submit-btn::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 0; height: 0;
    background: rgba(139, 0, 0, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.6s;
}

#submit-btn:hover::before {
    width: 300px;
    height: 300px;
}

#submit-btn.submitted {
    animation: none;
    border-color: #333;
    color: #555;
    box-shadow: none;
}

/* ============ FAKE POPUP ============ */
.fake-popup {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 340px;
    background: #c0c0c0;
    border: 2px outset #fff;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.5);
    z-index: 9999;
    font-size: 12px;
    color: #000;
    display: none;
    cursor: none;
}

.fake-popup.visible {
    display: block;
    animation: popupAppear 0.1s steps(2);
}

.popup-titlebar {
    background: linear-gradient(90deg, #000080, #1084d0);
    color: #fff;
    padding: 3px 6px;
    font-weight: bold;
    font-size: 11px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.popup-close {
    background: #c0c0c0;
    border: 1px outset #fff;
    color: #000;
    padding: 0 4px;
    font-size: 10px;
    cursor: none;
}

.popup-body {
    padding: 20px;
    text-align: center;
}

.popup-body p {
    margin-bottom: 16px;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-weight: 700;
}

.popup-ok {
    background: #c0c0c0;
    border: 2px outset #fff;
    padding: 4px 30px;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-weight: 700;
    font-size: 12px;
    cursor: none;
}

/* ============ FAKE TOOLTIP ============ */
.fake-tooltip {
    position: fixed;
    background: #ffffe1;
    border: 1px solid #000;
    color: #000;
    font-size: 11px;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-weight: 700;
    padding: 3px 8px;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.fake-tooltip.visible {
    opacity: 1;
}

/* ============ OVERLAY PAGES ============ */
.overlay-page {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(250, 250, 250, 0.97);
    z-index: 500;
    display: none;
    overflow: hidden;
    cursor: none;
}

.overlay-page.active {
    display: block;
    animation: overlayIn 0.3s ease-out;
}

.overlay-close {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #bbb;
    font-size: 10px;
    letter-spacing: 4px;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-weight: 700;
    z-index: 501;
    transition: color 0.3s;
    cursor: none;
}

.overlay-close:hover {
    color: var(--red);
}

.overlay-content {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Overlay image items */
.overlay-img {
    position: absolute;
    width: 60px;
    height: 60px;
    object-fit: contain;
    filter: brightness(1.1) contrast(1.2);
}

/* Fire page specific */
.fire-container .overlay-img {
    animation: fireFlicker 0.3s steps(2) infinite;
}

/* ============ BSOD ============ */
.bsod {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--bsod-blue);
    z-index: 99999;
    display: none;
    padding: 10% 15%;
    cursor: none;
}

.bsod.active {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    animation: bsodIn 0.05s steps(1);
}

.bsod-content {
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    line-height: 1.6;
    max-width: 700px;
}

.bsod-title {
    font-size: 20px;
    background: #aaa;
    color: var(--bsod-blue);
    display: inline-block;
    padding: 2px 12px;
    font-weight: bold;
}

.bsod-blink {
    animation: bsodBlink 1s steps(1) infinite;
}

/* ============ KEYFRAMES ============ */

@keyframes cursorSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes textFlicker {
    0%, 100% { opacity: 1; }
    92% { opacity: 1; }
    93% { opacity: 0.6; }
    94% { opacity: 1; }
    96% { opacity: 0.8; }
    97% { opacity: 1; }
}

@keyframes glitchClip {
    0%, 100% { opacity: 0; }
    20% { opacity: 0.8; clip-path: inset(20% 0 60% 0); transform: translate(-3px, 0); }
    21% { opacity: 0; }
    50% { opacity: 0.6; clip-path: inset(50% 0 20% 0); transform: translate(3px, 0); }
    51% { opacity: 0; }
    80% { opacity: 0.7; clip-path: inset(10% 0 70% 0); transform: translate(-2px, 0); }
    81% { opacity: 0; }
}

@keyframes glitchClip2 {
    0%, 100% { opacity: 0; }
    30% { opacity: 0.5; clip-path: inset(60% 0 10% 0); transform: translate(4px, 0); }
    31% { opacity: 0; }
    60% { opacity: 0.6; clip-path: inset(30% 0 40% 0); transform: translate(-4px, 0); }
    61% { opacity: 0; }
}

@keyframes blackPulse {
    0%, 100% {
        box-shadow:
            0 0 10px rgba(0, 0, 0, 0.3),
            0 0 30px rgba(0, 0, 0, 0.15),
            0 0 60px rgba(0, 0, 0, 0.05);
    }
    50% {
        box-shadow:
            0 0 20px rgba(0, 0, 0, 0.6),
            0 0 50px rgba(0, 0, 0, 0.3),
            0 0 90px rgba(0, 0, 0, 0.1);
    }
}

@keyframes redPulse {
    0%, 100% {
        box-shadow:
            0 0 10px rgba(139, 0, 0, 0.4),
            0 0 30px rgba(139, 0, 0, 0.2),
            0 0 60px rgba(139, 0, 0, 0.1);
    }
    50% {
        box-shadow:
            0 0 25px rgba(139, 0, 0, 0.8),
            0 0 60px rgba(139, 0, 0, 0.4),
            0 0 100px rgba(139, 0, 0, 0.15);
    }
}

@keyframes screenShake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-0.5deg); }
    20% { transform: translate(-3px, 0px) rotate(0.5deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(0.5deg); }
    50% { transform: translate(-1px, 2px) rotate(-0.5deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(3px, 1px) rotate(-0.5deg); }
    80% { transform: translate(-1px, -1px) rotate(0.5deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-0.5deg); }
}

@keyframes noiseMove {
    0% { transform: translate(0, 0); }
    33% { transform: translate(-5%, -5%); }
    66% { transform: translate(5%, 5%); }
    100% { transform: translate(0, 0); }
}

@keyframes navDrift {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(3px, -2px) rotate(0.5deg); }
    50% { transform: translate(-2px, 4px) rotate(-0.3deg); }
    75% { transform: translate(4px, 1px) rotate(0.2deg); }
}

@keyframes loadBackwards {
    0% { transform: scaleX(1); }
    100% { transform: scaleX(0); }
}

@keyframes popupAppear {
    0% { transform: translate(-50%, -50%) scale(0.5); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

@keyframes overlayIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes bsodIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes bsodBlink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

@keyframes fireFlicker {
    0% { filter: brightness(1.2) hue-rotate(0deg) saturate(2); }
    50% { filter: brightness(1.8) hue-rotate(20deg) saturate(3); }
    100% { filter: brightness(1) hue-rotate(-10deg) saturate(2); }
}

@keyframes orbitSpin {
    0% { transform: rotate(0deg) translateX(var(--orbit-radius)) rotate(0deg); }
    100% { transform: rotate(360deg) translateX(var(--orbit-radius)) rotate(-360deg); }
}

@keyframes rainFall {
    0% { transform: translateY(-60px); opacity: 1; }
    100% { transform: translateY(100vh); opacity: 0.5; }
}

@keyframes breathe {
    0%, 100% { transform: rotate(var(--angle)) translateX(120px) scale(1); }
    50% { transform: rotate(var(--angle)) translateX(200px) scale(1.3); }
}

/* ============ UTILITY / CHAOS CLASSES ============ */
.invert-flash {
    filter: invert(1) !important;
}

.flicker-black {
    opacity: 0 !important;
}

/* Fleeing elements */
.fleeing {
    transition: transform 0.3s ease-out;
}
