@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;700;900&family=Space+Mono:wght@400;700&display=swap');

:root {
    --bg-color: #0f172a;
    --primary: #ec4899;
    --primary-hover: #db2777;
    --text-color: #f8fafc;
}

* {
    box-sizing: border-box;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(225,39%,30%,1) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(339,49%,30%,1) 0, transparent 50%);
    font-family: 'Outfit', sans-serif;
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.main-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
}

/* Status Text Above Button */
.status-text {
    position: relative;
    z-index: 3000;
    font-size: 2rem;
    font-weight: 900;
    color: #ef4444;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.7);
    margin-bottom: 2rem;
    height: 2.5rem;
    transition: opacity 0.3s;
}

.status-text.hidden {
    opacity: 0;
}

.container {
    position: relative;
    display: inline-block;
    transition: opacity 0.8s ease, transform 0.3s ease;
    z-index: 2000;
}

.container.fade-out {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.5);
}

/* Yield Text Overlay */
.yield-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 1rem 2rem;
    font-size: 1.5rem;
    font-weight: bold;
    border-radius: 0.5rem;
    z-index: 50;
    pointer-events: none;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.yield-text.hidden {
    opacity: 0;
}

/* Split Button Structure */
.btn-split-wrapper {
    display: flex;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border: none;
    border-radius: 9999px;
    padding: 0;
    cursor: pointer;
    position: relative;
    filter: drop-shadow(0 10px 25px rgba(236, 72, 153, 0.5));
    transition: transform 0.1s;
    outline: none;
}

.btn-split-wrapper:hover {
    transform: translateY(-5px) scale(1.05);
}
.btn-split-wrapper:active {
    transform: translateY(2px) scale(0.95);
}

.btn-half {
    background: transparent;
    color: white;
    padding: 1.5rem 0;
    font-size: 1.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
}

.btn-left {
    padding-left: 3.5rem;
    padding-right: 0.2rem;
    border-radius: 9999px 0 0 9999px;
    z-index: 2;
}

.btn-right {
    padding-left: 0.2rem;
    padding-right: 3.5rem;
    border-radius: 0 9999px 9999px 0;
    transform-origin: left center;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2;
}

.btn-text {
    pointer-events: none;
    white-space: pre;
}

.btn-split-wrapper.restored .btn-right {
    transition: none !important;
}

/* Fake cables hidden inside */
.cables {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-5px); /* Spans across the physical gap */
    width: 25px; /* Just wide enough to go slightly under both buttons */
    height: 60px;
    z-index: 1; /* Behind the halves */
    opacity: 0;
    transition: opacity 0.3s;
}

.cable {
    position: absolute;
    width: 100%;
    border: 3.5px solid;
    border-top: none;
    border-radius: 0 0 15px 15px; /* Perfect U-shape */
    transform-origin: top center;
}

.cable-red { border-color: #ef4444; height: 25px; top: 0px; left: -2px; animation: swing 2s ease-in-out infinite alternate; }
.cable-blue { border-color: #3b82f6; height: 35px; left: 2px; top: 10px; animation: swing 1.8s ease-in-out infinite alternate-reverse; }
.cable-green { border-color: #10b981; height: 20px; left: -1px; top: 20px; animation: swing 2.2s ease-in-out infinite alternate; }
.cable-yellow { border-color: #eab308; height: 45px; left: 1px; top: 5px; animation: swing 1.9s ease-in-out infinite alternate-reverse; }

@keyframes swing {
    0% { transform: rotate(-5deg) scaleY(1); }
    100% { transform: rotate(5deg) scaleY(1.1); }
}

/* Broken State */
.btn-split-wrapper.broken {
    background: transparent;
}

.btn-split-wrapper.broken:hover {
    transform: none; /* Disable hover when broken */
}

.btn-split-wrapper.broken .btn-left {
    background: linear-gradient(135deg, var(--primary) 0%, #c084fc 100%);
    clip-path: polygon(0 0, 100% 0, 95% 50%, 100% 100%, 0 100%);
}

.btn-split-wrapper.broken .btn-right {
    background: linear-gradient(135deg, #c084fc 0%, #8b5cf6 100%);
    clip-path: polygon(5% 0, 100% 0, 100% 100%, 0% 100%, 5% 50%);
    margin-left: -5px;
    transform: rotateZ(15deg) translateY(20px) translateX(10px);
}

.btn-split-wrapper.broken .cables {
    opacity: 1;
}

.btn-split-wrapper.broken .btn-half {
    animation: flicker 0.15s infinite alternate;
}

@keyframes flicker {
    0% { filter: brightness(1) contrast(1); }
    50% { filter: brightness(0.3) contrast(1.5) sepia(0.5) hue-rotate(-50deg); }
    100% { filter: brightness(1.2) contrast(0.8); }
}

/* Glitch Extreme State */
.btn-split-wrapper.glitch-extreme {
    animation: glitch-anim 0.2s infinite linear;
}

.btn-split-wrapper.glitch-extreme .btn-half {
    animation: rgb-split 0.1s infinite linear;
}

@keyframes glitch-anim {
    0% { transform: scale(1) skewX(0deg) rotate(0deg); filter: hue-rotate(0deg) invert(0) contrast(1); }
    10% { transform: scale(3, 0.5) skewX(60deg) rotate(15deg); filter: hue-rotate(90deg) invert(1) contrast(2); }
    20% { transform: scale(0.2, 4) skewX(-60deg) rotate(-15deg); filter: hue-rotate(180deg) invert(0) contrast(0.5); }
    30% { transform: scale(4, 4) skewY(50deg) rotate(45deg); filter: hue-rotate(270deg) invert(1) contrast(3); }
    40% { transform: scale(0.5, 0.2) skewY(-50deg) rotate(-45deg); filter: hue-rotate(360deg) invert(0) contrast(1); }
    50% { transform: scale(3.5, 1) skewX(80deg) rotate(90deg); filter: hue-rotate(45deg) invert(1) contrast(4); }
    60% { transform: scale(0.1, 3) skewX(-80deg) rotate(-90deg); filter: hue-rotate(135deg) invert(0) contrast(0.5); }
    70% { transform: scale(4, 0.5) skewY(80deg) rotate(180deg); filter: hue-rotate(225deg) invert(1) contrast(2); }
    80% { transform: scale(0.2, 0.2) skewY(-80deg) rotate(-180deg); filter: hue-rotate(315deg) invert(0) contrast(1); }
    90% { transform: scale(2, 4) skewX(90deg) rotate(270deg); filter: hue-rotate(405deg) invert(1) contrast(5); }
    100% { transform: scale(1) skewX(0deg) rotate(0deg); filter: hue-rotate(0deg) invert(0) contrast(1); }
}

@keyframes rgb-split {
    0% { text-shadow: 20px 20px red, -20px -20px blue; }
    25% { text-shadow: -30px 20px lime, 30px -20px magenta; }
    50% { text-shadow: 40px -30px blue, -40px 30px red; }
    75% { text-shadow: -50px -40px cyan, 50px 40px yellow; }
    100% { text-shadow: 20px 20px red, -20px -20px blue; }
}

/* Mini Console */
.mini-console {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 33vw;
    height: 33vh;
    background: 
        linear-gradient(rgba(0, 20, 0, 0.95), rgba(0, 20, 0, 0.95)),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0, 255, 0, 0.15) 2px,
            rgba(0, 255, 0, 0.15) 4px
        );
    border: 2px solid #0f0;
    border-radius: 8px;
    font-family: 'Space Mono', monospace;
    font-size: 1.2rem;
    color: #0f0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0, 255, 0, 0.5), inset 0 0 20px rgba(0, 255, 0, 0.2);
    text-shadow: 0 0 5px #0f0;
    z-index: 1000;
}

.mini-console.hidden {
    display: none;
}

.console-header {
    background: #050;
    padding: 2px 5px;
    border-bottom: 2px solid #0f0;
    font-weight: bold;
    color: #fff;
    text-shadow: none;
}

.console-body {
    padding: 5px;
    overflow-y: auto;
    flex: 1;
}

.console-body p {
    margin: 0 0 2px 0;
}

/* Original Popup & Image CSS */
.popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -45%) scale(0.9);
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 3rem;
    border-radius: 2rem;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    opacity: 0;
    transition: opacity 5s ease-in-out, transform 5s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 20;
    pointer-events: none;
    max-width: 90vw;
}

.popup.hidden {
    display: none;
}

.popup.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

.popup-text {
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 900;
    margin: 0;
    background: linear-gradient(to right, #f472b6, #c084fc, #818cf8, #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-shadow: 0px 4px 20px rgba(244, 114, 182, 0.3);
}

.image-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.popup-img {
    max-width: 100%;
    max-height: 60vh;
    border-radius: 1rem;
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.4), 0 0 20px rgba(192, 132, 252, 0.2);
    object-fit: contain;
}

.overlay-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 1rem 2rem;
    border-radius: 0.75rem;
    font-size: clamp(1rem, 3vw, 2.5rem);
    font-weight: 900;
    white-space: nowrap;
    text-transform: uppercase;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    z-index: 30;
    opacity: 0;
    pointer-events: none;
    border: 2px solid #ec4899;
}

.overlay-text.hidden {
    display: none;
}

.overlay-text.visible {
    opacity: 1;
}

/* Ambient Particles */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.particle {
    position: absolute;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: float infinite linear;
}

@keyframes float {
    0% { transform: translateY(0) rotate(0deg); opacity: 0; }
    10% { opacity: 0.5; }
    90% { opacity: 0.5; }
    100% { transform: translateY(-100vh) rotate(360deg); opacity: 0; }
}

/* Screen Shake */
body.shaking {
    animation: screen-shake 0.1s infinite;
}
@keyframes screen-shake {
    0% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(5px, 5px) rotate(1deg); }
    50% { transform: translate(-5px, -5px) rotate(-1deg); }
    75% { transform: translate(-5px, 5px) rotate(0deg); }
    100% { transform: translate(5px, -5px) rotate(1deg); }
}

/* Exploding Sparks */
.spark {
    position: absolute;
    width: 4px;
    height: 15px;
    background: #fff;
    border-radius: 2px;
    box-shadow: 0 0 10px #fff, 0 0 20px #eab308, 0 0 30px #ef4444;
    z-index: 50;
    pointer-events: none;
    transform: translate(-50%, -50%);
    animation: fly-spark 0.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes fly-spark {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0); opacity: 0; }
}

/* BSOD Overlay */
.bsod {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: #0078D7;
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 10%;
    box-sizing: border-box;
}
.bsod.hidden { display: none; }
.bsod h1 { font-size: 8rem; margin: 0 0 20px 0; font-weight: normal; }
.bsod p { font-size: 2rem; margin: 10px 0; font-weight: 300; }

/* Confetti Effect */
.confetti {
    position: absolute;
    z-index: 100;
    pointer-events: none;
    opacity: 1;
}

@keyframes fall-confetti {
    0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
    80% { opacity: 1; }
    100% { transform: translate(var(--tx), var(--ty)) rotate(var(--rot)); opacity: 0; }
}

/* Custom Dialog Box */
.custom-dialog {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000; /* Above everything */
}

.custom-dialog.hidden {
    display: none;
}

.dialog-content {
    background: #1e293b;
    border: 3px solid #ef4444;
    border-radius: 10px;
    padding: 30px;
    width: 450px;
    text-align: center;
    box-shadow: 0 0 50px rgba(239, 68, 68, 0.6);
    color: #fff;
}

.dialog-content p {
    font-size: 1.5rem;
    margin-bottom: 30px;
    font-weight: bold;
}

.dialog-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.dialog-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 10px 30px;
    font-size: 1.2rem;
    border-radius: 5px;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: bold;
    transition: transform 0.1s, background 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.dialog-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

.dialog-btn:active {
    transform: translateY(1px);
}

.dialog-btn-no {
    background: #475569;
}

.dialog-btn-no:hover {
    background: #334155;
}

/* Fake Ads */
.fake-ad {
    position: fixed;
    width: 300px;
    background: #c0c0c0;
    border: 3px solid;
    border-color: #fff #888 #888 #fff;
    z-index: 9000;
    font-family: 'Comic Sans MS', Tahoma, sans-serif;
    color: black;
    box-shadow: 5px 5px 15px rgba(0,0,0,0.5);
    animation: pop-in 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.ad-header {
    background: #000080;
    color: white;
    padding: 2px 5px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}
.ad-header button {
    background: #c0c0c0;
    border: 2px solid;
    border-color: #fff #888 #888 #fff;
    cursor: pointer;
    font-weight: bold;
    color: black;
}
.ad-body {
    padding: 20px;
    text-align: center;
    font-weight: bold;
    font-size: 1.2rem;
    color: red;
    background: yellow;
    border: 2px inset #fff;
    margin: 5px;
    animation: flash-ad 0.5s infinite alternate;
}
@keyframes flash-ad {
    0% { background: yellow; color: red; }
    100% { background: red; color: yellow; }
}
@keyframes pop-in {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    /* Button Adjustments */
    .btn-half {
        font-size: 1rem;
        padding: 1rem 0;
    }
    .btn-left {
        padding-left: 2rem;
    }
    .btn-right {
        padding-right: 2rem;
    }
    .status-text {
        font-size: 1.5rem;
    }
    
    /* Console Adjustments */
    .mini-console {
        width: 90vw;
        height: 40vh;
        font-size: 1rem;
    }
    
    /* Custom Dialog Adjustments */
    .dialog-content {
        width: 90vw;
        padding: 20px;
    }
    .dialog-content p {
        font-size: 1.2rem;
    }
    
    /* BSOD Adjustments */
    .bsod h1 {
        font-size: 4rem;
    }
    .bsod p {
        font-size: 1.2rem;
    }
    
    /* Fake Ads Adjustments */
    .fake-ad {
        width: 80vw;
    }
}
