:root {
    --bg-color: #131313;
    --grid-color: #1A1A1A;
    --terminal-bg: #201f1f;
    --text-color: #e5e2e1;
    --sticker-border: #ffffff;
    --shadow-color: rgba(0, 0, 0, 1);
    --primary-font: 'Space Grotesk', sans-serif;
    --heading-font: 'Press Start 2P', monospace;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 30px 30px;
    font-family: var(--primary-font);
    color: var(--text-color);
    /* STRICT VIEWPORT LOCK */
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

.canvas {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

.scatter-container {
    position: relative;
    /* Lock internal resolution */
    width: 1200px;
    height: 800px;
    transform-origin: center center;
    max-width: none;
}

/* Center Terminal */
.terminal-window {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--terminal-bg);
    border-radius: 14px;
    padding: 40px;
    width: 90%;
    max-width: 550px;
    z-index: 10;
    border: 1px solid #353534;
}

.terminal-window::before,
.terminal-window::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--terminal-bg);
    border-radius: 14px;
    border: 1px solid #353534;
    z-index: -1;
}

.terminal-window::before {
    transform: translate(8px, 8px);
}

.terminal-window::after {
    transform: translate(16px, 16px);
}

.terminal-text {
    font-size: 16px;
    line-height: 1.6;
    margin: 0;
    color: var(--text-color);
    font-family: 'Courier New', monospace;
}

/* Base Sticker Properties */
.sticker {
    position: absolute;
    border-radius: 0;
    cursor: pointer;
    --rot: 0deg;
    transform: translate(-50%, -50%) rotate(var(--rot)) scale(1);
    z-index: 50;
    /* Combined transition for both types of stickers */
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s, filter 0.2s, z-index 0s;
}

/* 1. Box Stickers (For Text/Divs) */
.box-sticker {
    background-color: white;
    border: 4px solid var(--sticker-border);
    box-shadow: 6px 6px 0px 0px var(--shadow-color);
}

.box-sticker:hover {
    transform: translate(-50%, calc(-50% - 6px)) rotate(0deg) scale(1.05) !important;
    box-shadow: 3px 3px 0px 0px var(--shadow-color);
    z-index: 100 !important;
}

.text-sticker {
    font-family: var(--heading-font);
    font-size: 2.5rem;
    color: black;
    padding: 20px 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: -2px;
}

/* 2. Image Stickers (For Transparent PNGs) */
img.img-sticker {
    display: block;
    object-fit: cover;
    background: transparent;
    border: none;
    box-shadow: none;
    /* This creates a tight 3px white outline around the PNG, followed by the black shadow */
    filter:
        drop-shadow(3px 0 0 white) drop-shadow(-3px 0 0 white) drop-shadow(0 3px 0 white) drop-shadow(0 -3px 0 white) drop-shadow(6px 6px 0px rgba(0, 0, 0, 1));
}

img.img-sticker:hover {
    transform: translate(-50%, calc(-50% - 6px)) rotate(0deg) scale(1.05) !important;
    /* The shadow shrinks to simulate pressing/straightening it */
    filter:
        drop-shadow(3px 0 0 white) drop-shadow(-3px 0 0 white) drop-shadow(0 3px 0 white) drop-shadow(0 -3px 0 white) drop-shadow(3px 3px 0px rgba(0, 0, 0, 1));
    z-index: 100 !important;
}

/* ==========================================
   MOBILE RESPONSIVE FIX (THE VERTICAL DESK)
   ========================================== */
@media (max-width: 768px) {

    body,
    .canvas {
        overflow-y: auto !important;
        /* Enable scrolling */
        height: auto !important;
        min-height: 100vh;
    }

    .scatter-container {
        width: 100vw;
        height: 1500px;
        /* Force a long vertical canvas */
        transform: none !important;
        /* Kill the JS scaling for mobile */
    }

    /* Move the Terminal to the top so it's readable first */
    .terminal-window {
        top: 280px !important;
        left: 50% !important;
        width: 92%;
        max-width: none;
        padding: 25px;
    }

    /* Shrink stickers globally for mobile */
    .sticker {
        transform: translate(-50%, -50%) rotate(var(--rot)) scale(0.65) !important;
    }

    /* --- MANUAL MOBILE RE-POSITIONING --- */
    /* We spread them out vertically (top %) so they don't overlap text */

    .text-sticker {
        top: 80px !important;
        left: 50% !important;
        font-size: 2.2rem !important;
    }

    /* AYAN. */

    img[alt="GTA Health Stats"] {
        top: 40px !important;
        left: 80% !important;
    }

    img[alt="GTA Mini Map"] {
        top: 1400px !important;
        left: 50% !important;
        width: 220px !important;
    }

    img[alt="Spider cat"] {
        top: 180px !important;
        left: 20% !important;
    }

    img[alt="Brain"] {
        top: 650px !important;
        left: 80% !important;
    }

    img[alt="Hacker Laptop"] {
        top: 850px !important;
        left: 50% !important;
    }

    img[alt="Da Vinci"] {
        top: 1050px !important;
        left: 25% !important;
    }

    img[alt="Daft Punk Helmet"] {
        top: 550px !important;
        left: 15% !important;
    }

    img[alt="Iced Coffee"] {
        top: 1200px !important;
        left: 85% !important;
    }

    img[alt="Hack The Box Logo"] {
        top: 920px !important;
        left: 75% !important;
    }
}

/* ==========================================
   LOADING ANIMATIONS (THE STICKER BOMB)
   ========================================== */

/* The Terminal Drop-in */
.terminal-window {
    opacity: 0;
    animation: terminalPop 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes terminalPop {
    0% {
        transform: translate(-50%, -30%);
        opacity: 0;
    }

    100% {
        transform: translate(-50%, -50%);
        opacity: 1;
    }
}

/* The Physical Sticker Drop */
.sticker {
    opacity: 0;
    /* The animation duration is 0.4s. The delay will be set dynamically by JS. */
    animation: stickerSlap 0.4s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes stickerSlap {
    0% {
        /* Starts 3x larger, highly rotated, and invisible */
        transform: translate(-50%, -50%) rotate(calc(var(--rot) * 2.5)) scale(3);
        opacity: 0;
    }

    60% {
        /* Slams down and slightly over-shrinks for the "bounce" impact */
        transform: translate(-50%, -50%) rotate(var(--rot)) scale(0.9);
        opacity: 1;
    }

    100% {
        /* Settles into exact manual position */
        transform: translate(-50%, -50%) rotate(var(--rot)) scale(1);
        opacity: 1;
    }
}

/* Hacker Cursor */
.cursor {
    display: inline-block;
    color: var(--text-color);
    animation: blink 1s step-end infinite;
    margin-left: 5px;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* ==========================================
   INTERACTIVE STICKER LINKS & SPEECH BUBBLES
   ========================================== */
a.sticker-link {
    text-decoration: none;
    outline: none;
}

a.sticker-link:hover {
    z-index: 100 !important;
}

a.sticker-link:hover .img-sticker {
    filter: drop-shadow(3px 0 0 white) drop-shadow(-3px 0 0 white) drop-shadow(0 3px 0 white) drop-shadow(0 -3px 0 white) drop-shadow(3px 3px 0px rgba(0, 0, 0, 1));
}

/* The Main Bubble */
.sticker[data-bubble]::after {
    content: attr(data-bubble);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background-color: #fff;
    color: #000;
    border: 3px solid #000;
    border-radius: 12px;
    padding: 8px 14px;
    font-family: var(--primary-font);
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 1);
    margin-bottom: 12px;
    z-index: 999;
}

/* The Bubble Tail (Triangle) */
.sticker[data-bubble]::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    border-width: 8px 8px 0;
    border-style: solid;
    border-color: #000 transparent transparent transparent;
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-bottom: 5px;
    z-index: 998;
}

/* Trigger popup on hover */
.sticker[data-bubble]:hover::after,
.sticker[data-bubble]:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px);
}



/* ==========================================
   HOVER GLITCH FIX FOR LINKS
   ========================================== */
/* Prevents the image inside the link from double-jumping */
a.sticker-link .img-sticker,
a.sticker-link:hover .img-sticker {
    transform: none !important;
    position: static !important;
}

/* Ensure the parent link wrapper is doing the moving */
a.sticker-link {
    display: inline-block;
}