:root {
    --bg: #0b0b0b;
    --blob-calm: #4facfe;
    --blob-worry: #a18cd1;
    --blob-panic: #ff0844;
    --blob-chaos: #333;
    --text: #fff;
    
    /* UI Variables */
    --imessage-bg: #000;
    --imessage-blue: #0A84FF;
    --imessage-gray: #262628;
    --outlook-blue: #0078D4;
}

/* FLOATING REACTIONS */
.floating-reaction {
    position: absolute;
    bottom: -50px;
    font-size: 3rem;
    pointer-events: none;
    z-index: 1000;
    animation: floatUp 3s ease-out forwards;
    filter: drop-shadow(0 0 10px rgba(0,0,0,0.5));
}

@keyframes floatUp {
    0% { transform: translateY(0) scale(0.5); opacity: 0; }
    10% { opacity: 1; transform: translateY(-50px) scale(1.2); }
    100% { transform: translateY(-80vh) scale(1); opacity: 0; }
}

/* CHAT FEED (Sidebar) */
#comments-feed {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 350px;
    height: 100vh;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 15px;
    z-index: 3000;
    pointer-events: none;
    mask-image: linear-gradient(to bottom, transparent, black 20%);
    -webkit-mask-image: linear-gradient(to bottom, transparent, black 20%);
}

.comment-bubble {
    background: rgba(20, 20, 20, 0.7);
    backdrop-filter: blur(10px);
    border-left: 4px solid #00d2ff;
    padding: 12px 15px;
    border-radius: 8px; /* Slightly rounded */
    color: #fff;
    font-size: 0.95rem;
    line-height: 1.4;
    animation: slideInRight 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: right center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    pointer-events: auto;
    width: fit-content;
    align-self: flex-end; /* Align right */
    max-width: 100%;
}

.comment-bubble .author {
    font-size: 0.8rem;
    color: #4facfe; /* Much brighter blue */
    margin-bottom: 5px;
    display: block;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5); /* Pop out */
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 3px;
}

.comment-bubble.question {
    border-left-color: #ffd700;
    background: rgba(60, 50, 0, 0.8);
    border-top: 1px solid rgba(255, 215, 0, 0.2);
}

.comment-bubble.question .author {
    color: #ffd700;
}

@keyframes slideInRight {
    from { transform: translateX(50px) scale(0.8); opacity: 0; }
    to { transform: translateX(0) scale(1); opacity: 1; }
}

@keyframes slideOutRight {
    to { transform: translateX(50px); opacity: 0; }
}

/* STRESS METER REMOVED */

/* GLITCH EFFECT */
.glitch-mode {
    animation: glitch-anim 0.15s infinite;
    filter: hue-rotate(90deg) contrast(150%);
}
@keyframes glitch-anim {
    0% { transform: translate(0); }
    20% { transform: translate(-3px, 3px); }
    40% { transform: translate(-3px, -3px); }
    60% { transform: translate(3px, 3px); }
    80% { transform: translate(3px, -3px); }
    100% { transform: translate(0); }
}

/* FLYING COMMENTS (Danmaku) */
.flying-comment {
    position: absolute;
    white-space: nowrap;
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(0,0,0,0.5);
    padding: 5px 15px;
    border-radius: 20px;
    top: 10%; /* dynamic */
    right: -100%; /* Start off screen */
    animation: flyAcross 10s linear forwards;
    pointer-events: none;
    z-index: 999;
    backdrop-filter: blur(2px);
    border: 1px solid rgba(255,255,255,0.1);
}

@keyframes flyAcross {
    0% { transform: translateX(0); left: 100%; }
    100% { transform: translateX(-100vw); left: 0; } /* Simple layout calc fix */
}
/* Improved anim for accurate pixel movement if needed, but 'left: 100%' to 'transform -X' is standard */
@keyframes flyAcross {
    from { left: 100vw; transform: translateX(0); }
    to { left: 0; transform: translateX(-100%); }
}

body {
    margin: 0;
    padding: 0;
    background: radial-gradient(circle at center, #1a1a1a 0%, #000 100%);
    color: var(--text);
    font-family: 'Montserrat', sans-serif;
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Background Noise Texture */
body::before {
    content: "";
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: url('data:image/svg+xml;utf8,%3Csvg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="noiseFilter"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.65" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noiseFilter)" opacity="0.05"/%3E%3C/svg%3E');
    opacity: 0.4;
    pointer-events: none;
    animation: noise 0.5s steps(3) infinite;
    z-index: 0;
}
@keyframes noise { 0% { transform: translate(0,0); } 100% { transform: translate(5px,5px); } }


/* STAGE */
.stage {
    position: absolute;
    width: 600px;
    height: 600px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.mind-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

/* THE MORPHING BLOB */
.blob {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, rgba(79, 172, 254, 0.8), rgba(0, 242, 254, 0.8));
    border-radius: 50%;
    box-shadow: 
        inset 10px 10px 30px rgba(255,255,255,0.4), 
        inset -10px -10px 30px rgba(0,0,0,0.1),
        0 0 30px rgba(0, 242, 254, 0.3),
        0 0 80px rgba(0, 242, 254, 0.1);
    backdrop-filter: blur(5px);
    transition: all 1s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: absolute;
    animation: morph 8s ease-in-out infinite; 
    z-index: 5;
    mix-blend-mode: screen;
}

/* BLOB STATES */
.blob.state-worry {
    background: linear-gradient(135deg, #a18cd1, #fbc2eb);
    box-shadow: 
        inset 10px 10px 30px rgba(255,255,255,0.3),
        0 0 40px rgba(161, 140, 209, 0.4);
    animation: morph-worry 3s linear infinite;
    transform: scale(1.1);
    filter: blur(0px); /* Clean up blur */
}

.blob.state-panic {
    background: radial-gradient(circle at 30% 30%, #ff0844, #ffb199);
    box-shadow: 
        inset 0 0 50px #600000,
        0 0 100px rgba(255, 8, 68, 0.8);
    animation: shake-panic 0.1s infinite, morph-panic 1s infinite alternate;
    width: 350px;
    height: 350px;
    opacity: 0.9;
}

.blob.state-distort {
    background: conic-gradient(from 180deg, #fff, #333, #fff);
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    width: 500px;
    height: 500px;
    opacity: 0.1;
    animation: spin 5s linear infinite;
    filter: blur(10px) grayscale(100%);
    z-index: 1; /* Move behind UI */
}

.blob.state-crush {
    width: 50px;
    height: 50px;
    background: #fff;
    box-shadow: 0 0 0 2000px #000;
    border-radius: 50%;
    animation: pulse-crush 1s infinite;
    z-index: 50; /* Above everything */
}

/* SCENE ELEMENTS (UI Windows) */
.scene-element {
    position: absolute;
    z-index: 20;
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.scene-element.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto; /* Allow text selection etc if needed */
}

/* === IMESSAGE UI === */
.imessage-container {
    width: 320px;
    height: 500px;
    background: #000;
    border: 1px solid #333;
    border-radius: 35px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0,0,0,0.8);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.imessage-header {
    background: rgba(30,30,30,0.8);
    backdrop-filter: blur(10px);
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-bottom: 1px solid #333;
    z-index: 2;
}

.avatar {
    width: 40px; height: 40px;
    background: linear-gradient(to bottom, #8e8e93, #636366);
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    font-weight: bold; font-size: 1.2rem;
    margin-bottom: 5px;
}

.contact-name { text-align: center; }
.contact-name .name { display: block; font-size: 0.8rem; font-weight: 500; }
.contact-name .status { display: block; font-size: 0.6rem; color: #8e8e93; }

.imessage-content {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    background: #000;
}

.msg {
    max-width: 75%;
    padding: 8px 15px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.4;
    position: relative;
}

.msg.received {
    background: var(--imessage-gray);
    color: #fff;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.msg.received::before {
    content: ''; position: absolute; bottom: 0; left: -6px;
    width: 10px; height: 10px;
    background: var(--imessage-gray);
    border-bottom-right-radius: 10px;
    z-index: -1;
}

/* Ghost messages for overthinking */
.msg.ghost {
    background: transparent;
    border: 1px dashed rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.5);
    align-self: flex-end;
}

/* Typing Indicator */
.typing-indicator {
    background: var(--imessage-gray);
    width: 40px;
    height: 25px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3px;
    margin-top: 10px;
    align-self: flex-start;
    opacity: 0; /* Hidden by default */
}

/* When blob is panicking, show typing */
.blob.state-distort ~ .imessage-container .typing-indicator {
    opacity: 1;
}

.typing-indicator span {
    width: 5px; height: 5px; border-radius: 50%; background: #8e8e93;
    animation: typing 1.4s infinite ease-in-out both;
}
.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

.imessage-input-bar {
    padding: 10px;
    border-top: 1px solid #333;
    display: flex; align-items: center; gap: 10px;
    background: #1c1c1e;
}

.camera-icon { font-size: 1.2rem; color: #8e8e93; }
.input-field {
    flex: 1;
    border: 1px solid #333;
    border-radius: 15px;
    padding: 5px 10px;
    color: #8e8e93; font-size: 0.9rem;
}


/* === OUTLOOK UI === */
.outlook-container {
    width: 500px;
    height: 350px;
    background: #fff;
    color: #333;
    border-radius: 8px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5);
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-flow: column;
}

.outlook-ribbon {
    background: var(--outlook-blue);
    padding: 8px 15px;
    display: flex; justify-content: space-between; align-items: center;
    color: white; font-weight: bold; font-size: 0.9rem;
}

.outlook-meta {
    background: #f3f2f1;
    border-bottom: 1px solid #e1dfdd;
    padding: 10px 15px;
    display: flex; flex-direction: column; gap: 8px;
}

.meta-row { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; }

.btn-send {
    background: var(--outlook-blue);
    color: white; border: none; padding: 5px 15px;
    border-radius: 2px; font-weight: 600; font-size: 0.85rem;
}

.outlook-body {
    flex: 1;
    padding: 20px;
    font-family: 'Calibri', sans-serif;
    font-size: 1.1rem;
    position: relative;
    background: white;
}

.cursor-blink { animation: blink 1s infinite; color: black;}
@keyframes blink { 50% { opacity: 0; } }

/* Alert Overlay in Outlook */
.outlook-alert {
    position: absolute;
    bottom: 20px; right: 20px;
    background: #fff4ce;
    border: 1px solid #fde74c;
    padding: 10px;
    font-size: 0.8rem;
    border-radius: 5px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s;
}

/* When blob worries, show alert */
.blob.state-worry ~ .outlook-container .outlook-alert {
    opacity: 1;
    transform: translateY(0);
}

.brain-icon { font-size: 5rem; filter: drop-shadow(0 0 10px red); }


/* === NEW SCENES STYLES === */

/* TRIGGER: Notification Bubble */
.trigger-container {
    width: 300px;
    top: 20%; right: 20%; /* Position roughly where a mac notification appears */
}
.notification-bubble {
    background: rgba(40, 40, 40, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    gap: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transform-origin: top right;
}
.notification-bubble .icon {
    font-size: 2rem;
}
.notification-bubble .content {
    display: flex; flex-direction: column; justify-content: center;
}
.notification-bubble .title { font-weight: bold; font-size: 0.9rem; margin-bottom: 3px; }
.notification-bubble .body { font-size: 0.9rem; color: #ccc; }


/* WEB: Floating Thoughts */
.web-container {
    width: 100%; height: 100%;
    top: 0; left: 0;
    pointer-events: none;
}
.thought {
    position: absolute;
    background: #fff;
    color: #000;
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: bold;
    opacity: 0;
    transform: scale(0);
    box-shadow: 0 5px 15px rgba(255,255,255,0.2);
}
.thought::after {
    /* Little tail to point to blob roughly */
    position: absolute; content: '';
    width: 10px; height: 10px; background: #fff;
    bottom: -3px; left: 50%; transform: translateX(-50%) rotate(45deg);
}


/* PLAYER: Retro Video Interface */
.player-container {
    width: 500px;
    height: 300px;
}
.video-window {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.8);
    display: flex; flex-direction: column;
    overflow: hidden;
}
.video-header {
    background: #2a2a2a;
    padding: 8px 15px;
    font-size: 0.8rem;
    color: #888;
    text-align: center;
    border-bottom: 1px solid #000;
}
.video-screen {
    flex: 1;
    background: #000;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    position: relative;
}
/* Grid effect on video */
.video-screen::before {
    content: ''; position: absolute; inset: 0;
    background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.05) 3px);
    pointer-events: none;
}
.replay-icon { font-size: 3rem; color: #fff; opacity: 0.5; margin-bottom: 10px; }
.replay-text { color: #fff; font-family: monospace; }

.video-controls {
    height: 40px;
    background: #2a2a2a;
    display: flex; align-items: center;
    padding: 0 15px;
    gap: 15px;
}
.progress-bar {
    flex: 1; height: 4px; background: #000; border-radius: 2px;
    overflow: hidden;
}
.progress-bar .fill {
    width: 0%; height: 100%; background: #4a90e2;
}
.btns { color: #888; letter-spacing: 5px; font-size: 0.8rem; }


/* KEYFRAMES for Blob */
@keyframes morph {
    0% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
    50% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
    100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
}
@keyframes morph-worry {
    0% { border-radius: 20% 80% 20% 80% / 20% 80% 20% 80%; transform: rotate(0deg); }
    100% { border-radius: 80% 20% 80% 20% / 80% 20% 80% 20%; transform: rotate(360deg); }
}
@keyframes morph-panic {
    0% { border-radius: 50%; transform: scale(1); }
    100% { border-radius: 40%; transform: scale(1.2); }
}
@keyframes shake-panic {
    0% { transform: translate(2px, 2px) rotate(0deg); }
    100% { transform: translate(-2px, -2px) rotate(0deg); }
}
@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes pulse-crush { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(0.8); opacity: 0.5; } }


/* OVERLAY TEXT */
.overlay {
    position: absolute; bottom: 50px; width: 100%; text-align: center; z-index: 100; pointer-events: none;
}
.text-slide {
    position: absolute; bottom: 0; left: 0; width: 100%; opacity: 0; transform: translateY(20px); transition: all 0.8s ease;
}
.text-slide.active { opacity: 1; transform: translateY(0); }
h1 { font-size: 4rem; font-weight: 200; letter-spacing: 10px; text-transform: uppercase; margin: 0; }
h2 { font-size: 2rem; font-weight: 800; color: #888; margin-bottom: 10px; }
p { font-size: 1.2rem; color: #aaa; max-width: 600px; margin: 0 auto; }
.hint { margin-top: 20px; font-size: 0.8rem; color: #444; }

/* DOTS */
.progress-dots {
    position: absolute; right: 30px; top: 50%; transform: translateY(-50%);
    display: flex; flex-direction: column; gap: 15px;
}
.dot { width: 10px; height: 10px; border-radius: 50%; background: #333; transition: background 0.3s; }
.dot.active { background: #fff; box-shadow: 0 0 10px #fff; }