:root {
    /* Premium Color Palette */
    --bg-color: #050505;
    --bg-gradient: radial-gradient(circle at 50% 50%, #1a1a1a 0%, #050505 80%);

    --text-primary: #f0f0f0;
    --text-secondary: #a0a0a0;
    --text-tertiary: #505050;

    --accent-color: #64ffda;
    /* Cyan - Intelligence */
    --accent-glow: rgba(100, 255, 218, 0.4);

    --secondary-accent: #bd93f9;
    /* Purple - Creativity */
    --secondary-glow: rgba(189, 147, 249, 0.4);

    --tertiary-accent: #ffb86c;
    /* Orange - Goal */

    /* Typography */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Playfair Display', serif;

    /* Transitions */
    --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Noise Texture Overlay */
    background-image: url("data:image/svg+xml,%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");
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
    background: var(--bg-gradient);
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s var(--ease-in-out);
    z-index: 1;
}

.screen.active {
    opacity: 1;
    pointer-events: all;
    z-index: 10;
}

/* Landing Styles */
.content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    position: relative;
}

.title {
    font-family: var(--font-display);
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 400;
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
    background: linear-gradient(180deg, #fff 0%, #aaa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    filter: drop-shadow(0 0 30px rgba(255, 255, 255, 0.1));
}

.subtitle {
    font-size: clamp(1rem, 2vw, 1.2rem);
    font-weight: 300;
    color: var(--text-secondary);
    margin-bottom: 4rem;
    text-align: center;
    letter-spacing: 0.05em;
    max-width: 600px;
    line-height: 1.6;
}

.cta-text {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--accent-color);
    font-family: var(--font-main);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 1rem 2.5rem;
    border-radius: 100px;
    transition: all 0.4s var(--ease-out-expo);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    pointer-events: all;
    position: relative;
    overflow: hidden;
}

.cta-text::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: 0.5s;
}

.cta-text:hover {
    background: rgba(100, 255, 218, 0.1);
    border-color: var(--accent-color);
    box-shadow: 0 0 30px var(--accent-glow);
    transform: translateY(-2px);
    letter-spacing: 0.2em;
}

.cta-text:hover::before {
    left: 100%;
}

/* Special Transition Button - "A Real World Case" */
.cta-transition {
    background: linear-gradient(135deg, rgba(255, 184, 108, 0.15) 0%, rgba(255, 121, 198, 0.1) 100%);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 184, 108, 0.4);
    color: var(--tertiary-accent);
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    padding: 1.1rem 3rem;
    border-radius: 100px;
    transition: all 0.5s var(--ease-out-expo);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    pointer-events: all;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 0 30px rgba(255, 184, 108, 0.15),
        0 4px 20px rgba(0, 0, 0, 0.3),
        inset 0 0 20px rgba(255, 184, 108, 0.05);
}

.cta-transition::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 184, 108, 0.2) 25%,
            rgba(255, 255, 255, 0.15) 50%,
            rgba(255, 184, 108, 0.2) 75%,
            transparent 100%);
    animation: transitionShimmer 3s ease-in-out infinite;
}

@keyframes transitionShimmer {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

.cta-transition::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 102px;
    padding: 2px;
    background: linear-gradient(135deg,
            rgba(255, 184, 108, 0.6) 0%,
            rgba(255, 121, 198, 0.4) 50%,
            rgba(255, 184, 108, 0.6) 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.5;
    animation: borderPulse 2s ease-in-out infinite;
}

@keyframes borderPulse {

    0%,
    100% {
        opacity: 0.4;
    }

    50% {
        opacity: 0.8;
    }
}

.cta-transition:hover {
    background: linear-gradient(135deg, rgba(255, 184, 108, 0.25) 0%, rgba(255, 121, 198, 0.15) 100%);
    border-color: rgba(255, 184, 108, 0.7);
    box-shadow:
        0 0 50px rgba(255, 184, 108, 0.3),
        0 0 80px rgba(255, 121, 198, 0.15),
        0 8px 30px rgba(0, 0, 0, 0.4),
        inset 0 0 30px rgba(255, 184, 108, 0.1);
    transform: translateY(-3px) scale(1.02);
    letter-spacing: 0.22em;
    color: #fff;
}

.cta-transition:hover::after {
    opacity: 1;
}

/* Animations */
.fade-in {
    opacity: 0;
    filter: blur(10px);
    transform: translateY(20px);
    animation: cinematicFadeIn 1.2s var(--ease-out-expo) forwards;
}

.delay-1 {
    animation-delay: 0.2s;
}

.delay-2 {
    animation-delay: 0.6s;
}

/* Fast fade-in for journey control buttons */
.fade-in-fast {
    opacity: 0;
    filter: blur(4px);
    transform: translateY(10px);
    animation: cinematicFadeIn 0.35s var(--ease-out-expo) forwards;
}

@keyframes cinematicFadeIn {
    to {
        opacity: 1;
        filter: blur(0);
        transform: translateY(0);
    }
}

/* Journey Styles */
#journey {
    background: transparent;
    /* Handled by #app gradient */
}

#journey.dimmed {
    opacity: 0.45;
    transition: opacity 0.5s var(--ease-in-out);
}

/* Screen pulse effects for loop animation */
#journey.pulse-goal {
    animation: pulseGoalEffect 0.6s ease-out;
}

#journey.pulse-think {
    animation: pulseThinkEffect 0.6s ease-out;
}

@keyframes pulseGoalEffect {
    0% {
        filter: brightness(1);
    }

    30% {
        filter: brightness(1.05) drop-shadow(0 0 20px rgba(255, 184, 108, 0.2));
    }

    100% {
        filter: brightness(1);
    }
}

@keyframes pulseThinkEffect {
    0% {
        filter: brightness(1);
    }

    30% {
        filter: brightness(1.08) drop-shadow(0 0 30px rgba(100, 255, 218, 0.2));
    }

    100% {
        filter: brightness(1);
    }
}

/* Tool burst particles */
.tool-burst-particle {
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-color);
    pointer-events: none;
    z-index: 1000;
    animation: burstOut 0.8s ease-out forwards;
    box-shadow: 0 0 10px var(--accent-color);
}

@keyframes burstOut {
    0% {
        transform: translate(-50%, -50%) rotate(var(--angle)) translateY(0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) rotate(var(--angle)) translateY(60px) scale(0);
        opacity: 0;
    }
}

#agent-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    /* Allow clicks to pass through */
}

/* Scale down the entire agent visualization on smaller screens to preserve safe zones */
@media (max-height: 800px) {
    #agent-container {
        transform: scale(0.85);
    }
}

/* Narrative Box */
#narrative-box {
    position: absolute;
    bottom: 2%;
    /* Percentage based for responsiveness */
    text-align: center;
    width: 100%;
    padding: 0 2rem;
    z-index: 10;
    pointer-events: none;
}

#narrative-text {
    font-size: clamp(1.1rem, 2.5vh, 1.3rem);
    line-height: 1.8;
    margin-bottom: 1rem;
    color: var(--text-primary);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    min-height: 3em;
    max-width: 847px;
    margin-left: auto;
    margin-right: auto;
    transition: opacity 0.5s ease-in-out;
    font-family: var(--font-main);
    letter-spacing: 0.01em;
}

/* Styled narrative text elements */
#narrative-text .key-word {
    font-family: var(--font-display);
    font-weight: 400;
    position: relative;
    padding: 0 0.15em;
}

#narrative-text .key-model {
    color: var(--accent-color);
    text-shadow: 0 0 20px var(--accent-glow);
}

#narrative-text .key-tools {
    color: var(--secondary-accent);
    text-shadow: 0 0 20px var(--secondary-glow);
}

#narrative-text .key-goal {
    color: var(--tertiary-accent);
    text-shadow: 0 0 20px rgba(255, 184, 108, 0.4);
}

#narrative-text .key-emphasis {
    color: #fff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
    font-style: italic;
}

#narrative-text .narrative-dim {
    font-size: 0.9em;
    opacity: 0.7;
}

/* Loop sequence styling */
#narrative-text .loop-sequence {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    margin: 0.5em 0;
    flex-wrap: wrap;
}

#narrative-text .loop-step {
    font-family: var(--font-display);
    color: var(--accent-color);
    padding: 0.3em 0.6em;
    background: rgba(100, 255, 218, 0.08);
    border: 1px solid rgba(100, 255, 218, 0.2);
    border-radius: 6px;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

#narrative-text .loop-arrow {
    color: var(--text-tertiary);
    font-size: 0.9em;
    opacity: 0.7;
}

/* Agent action text - dynamic explanation during loop */
#narrative-text .agent-action-text {
    display: inline-block;
    font-style: italic;
    min-height: 1.4em;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

#narrative-text .agent-action-text.updating {
    opacity: 0;
    transform: translateY(4px);
}

/* Connecting Lines */
#connection-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1s ease;
    overflow: visible;
}

#connection-lines.visible {
    opacity: 1;
}

/* Persistent Definition Header */
#persistent-definition {
    position: absolute;
    top: 8%;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 90vw;
    font-family: var(--font-display);
    font-size: clamp(1rem, 2vw, 1.3rem);
    line-height: 1.5;
    text-align: center;
    color: var(--text-primary);
    z-index: 100;
    opacity: 0;
    transition: opacity 0.8s var(--ease-in-out);
    pointer-events: none;
}

#persistent-definition.visible {
    opacity: 1;
}

#persistent-definition .key-word {
    font-weight: 400;
    position: relative;
    padding: 0 0.15em;
}

#persistent-definition .key-model {
    color: var(--accent-color);
    text-shadow: 0 0 20px var(--accent-glow);
}

#persistent-definition .key-tools {
    color: var(--secondary-accent);
    text-shadow: 0 0 20px var(--secondary-glow);
}

#persistent-definition .key-goal {
    color: var(--tertiary-accent);
    text-shadow: 0 0 20px rgba(255, 184, 108, 0.4);
}

/* Definition Screen */
#definition-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Remove flex centering to rely on absolute positioning */
    display: block;
    z-index: 2;
    pointer-events: none;
}

#definition-screen.visible {
    display: block;
}

.definition-label {
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: var(--text-secondary);
    font-weight: 500;
    text-align: center;
    transition: all 0.5s var(--ease-in-out);
    width: 100%;
    z-index: 10;
}

#definition-text-container {
    position: fixed;
    /* Initial Position: Slightly above center to clear the brain */
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;

    font-size: clamp(1.5rem, 3vw, 2.2rem);
    line-height: 1.5;
    text-align: center;
    white-space: nowrap;
    max-width: 100vw;
    transition: top 1s var(--ease-out-expo), opacity 0.5s ease;
    font-family: var(--font-display);
    color: var(--text-primary);
    z-index: 100;
    pointer-events: none;
}

/* Safe Zone Logic: Move text to top position with smooth transition */
#definition-text-container.at-top {
    top: 10%;
    /* Keep transform the same for smooth Y transition - just change top */
    /* Keep the same font size - no reduction */
}

#model-explanation {
    position: absolute;
    bottom: calc(2% + 5rem);
    left: 50%;
    transform: translate(-50%, 50%);
    width: 100%;
    max-width: 726px;

    font-size: clamp(1.1rem, 2.5vh, 1.3rem);
    line-height: 1.8;
    text-align: center;
    color: var(--text-primary);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.01em;
    font-family: var(--font-main);

    transition: all 0.8s var(--ease-out-expo);
    opacity: 0;
    visibility: hidden;
    display: block;
    z-index: 10;
}

#model-explanation.visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

/* Styled model explanation text elements */
#model-explanation .key-word {
    font-family: var(--font-display);
    font-weight: 400;
    position: relative;
    padding: 0 0.15em;
    vertical-align: baseline;
}

#model-explanation .key-model {
    color: var(--accent-color);
    text-shadow: 0 0 20px var(--accent-glow);
}

#model-explanation .key-tools {
    color: var(--secondary-accent);
    text-shadow: 0 0 20px var(--secondary-glow);
}

#model-explanation .key-goal {
    color: var(--tertiary-accent);
    text-shadow: 0 0 20px rgba(255, 184, 108, 0.4);
}

#model-explanation .key-emphasis {
    color: #fff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
    font-style: italic;
}

#definition-text-container .key-word {
    font-weight: 400;
    position: relative;
    padding: 0 0.2em;
    white-space: nowrap;
    display: inline-block;
}

#definition-text-container .key-word::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    background: currentColor;
    opacity: 0.3;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.5s var(--ease-out-expo);
}

#definition-text-container .key-word:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

#definition-text-container .key-model {
    color: var(--accent-color);
    text-shadow: 0 0 20px var(--accent-glow);
}

#definition-text-container .key-tools {
    color: var(--secondary-accent);
    text-shadow: 0 0 20px var(--secondary-glow);
}

#definition-text-container .key-goal {
    color: var(--tertiary-accent);
    text-shadow: 0 0 20px rgba(255, 184, 108, 0.4);
}

/* Brain & Core */
#brain-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140px;
    height: 140px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
    flex-shrink: 0;
}

#shared-brain-container {
    position: absolute;
    top: 50%;
    left: 50%;
    --brain-offset-x: 0px;
    --brain-offset-y: 0px;
    transform: translate(-50%, -50%) translate(var(--brain-offset-x), var(--brain-offset-y));
    width: 140px;
    height: 140px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    pointer-events: none;
    transition: transform 0.7s var(--ease-out-expo);
    will-change: transform;
}

#brain-container-default {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140px;
    height: 140px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
}

#agent-core {
    width: 90px;
    height: 90px;
    position: relative;
    z-index: 3;
    border-radius: 50%;
    transform-style: preserve-3d;
    transition: transform 1.5s var(--ease-in-out), opacity 1.5s var(--ease-in-out);
    opacity: 0;
    /* Dynamic brain color - defaults to cyan */
    --brain-color: var(--accent-color);
    --brain-glow: var(--accent-glow);
    /* Volumetric Glow Container */
    box-shadow:
        0 0 60px rgba(100, 255, 218, 0.1),
        0 0 100px rgba(100, 255, 218, 0.05);
}

#agent-core.visible {
    opacity: 1;
}

/* Layer 1: Liquid Plasma Core */
.brain-plasma {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at center, #fff 0%, var(--brain-color) 40%, transparent 70%);
    filter: url('#plasma-filter');
    opacity: 0.9;
    z-index: 2;
    animation: pulsePlasma 4s ease-in-out infinite alternate;
    transition: background 0.4s ease;
}

/* Layer 1.5: Neural Mesh (Synaptic Web) */
.brain-mesh {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background:
        repeating-radial-gradient(circle at 50% 50%,
            transparent 0,
            rgba(255, 255, 255, 0.1) 2px,
            transparent 4px),
        repeating-conic-gradient(from 0deg,
            transparent 0deg,
            rgba(100, 255, 218, 0.1) 10deg,
            transparent 20deg);
    mix-blend-mode: overlay;
    opacity: 0.6;
    z-index: 2;
    animation: rotateMesh 30s linear infinite;
}

/* Layer 1.8: Hemispheres (Bicameral Structure) */
.brain-hemispheres {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(90deg,
            transparent 45%,
            rgba(0, 0, 0, 0.3) 50%,
            transparent 55%);
    filter: blur(2px);
    z-index: 2;
    opacity: 0.7;
    pointer-events: none;
}

/* Layer 1.6: Neural Storm (Flickering Activity) */
.brain-storm {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: #fff;
    /* Noise Mask for digital/synaptic look */
    mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='1'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='1'/%3E%3C/svg%3E");
    mix-blend-mode: overlay;
    opacity: 0;
    z-index: 3;
    animation: stormFlicker 0.2s steps(4) infinite;
}

/* Layer 1.7: Synaptic Pulse (Deep Shockwaves) */
.brain-pulse-container {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    overflow: hidden;
    z-index: 2;
    pointer-events: none;
}

.brain-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20%;
    height: 20%;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    opacity: 0;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.brain-pulse.p1 {
    animation: synapticPulse 3s ease-out infinite;
}

.brain-pulse.p2 {
    animation: synapticPulse 3s ease-out infinite 1s;
}

.brain-pulse.p3 {
    animation: synapticPulse 3s ease-out infinite 2s;
}

/* Layer 2: Core Light (The bright center) */
.brain-core-light {
    position: absolute;
    inset: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 40px #fff, 0 0 80px var(--brain-color);
    z-index: 3;
    opacity: 0.8;
    filter: blur(5px);
    animation: breatheLight 3s ease-in-out infinite;
    transition: box-shadow 0.4s ease;
}

/* Layer 3: Tech Ring (Contrast) */
.brain-ring {
    position: absolute;
    inset: -15px;
    border-radius: 50%;
    border: 1px solid var(--brain-glow);
    border-left-color: transparent;
    border-right-color: transparent;
    z-index: 1;
    animation: spinRing 8s linear infinite;
    transition: border-color 0.4s ease;
}

/* State: Thinking */
#agent-core.thinking .brain-plasma {
    background: radial-gradient(circle at center, #fff 0%, var(--brain-color) 40%, transparent 70%);
    animation: pulsePlasmaFast 0.5s ease-in-out infinite alternate;
}

#agent-core.thinking .brain-core-light {
    box-shadow: 0 0 50px #fff, 0 0 100px var(--brain-color);
    animation: breatheLightFast 0.5s ease-in-out infinite;
}

#agent-core.thinking .brain-storm {
    animation: stormFlicker 0.1s steps(2) infinite;
    opacity: 0.3;
    /* Brighter storm when thinking */
}

#agent-core.thinking .brain-pulse {
    border-color: var(--brain-glow);
    animation-duration: 1s;
    /* Faster pulses */
}

#agent-core.thinking .brain-ring {
    border-color: var(--brain-glow);
    border-left-color: transparent;
    border-right-color: transparent;
    animation: spinRing 2s linear infinite;
}

/* State: Traveling */
#shared-brain-container.traveling #agent-core {
    transform: scale(0.9) skewX(-10deg);
}

#shared-brain-container.traveling .brain-plasma {
    filter: url('#plasma-filter') blur(2px);
}

/* Animations */
@keyframes pulsePlasma {
    0% {
        transform: scale(0.95);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.05);
        opacity: 1;
    }
}

@keyframes pulsePlasmaFast {
    0% {
        transform: scale(0.9);
        opacity: 0.9;
    }

    100% {
        transform: scale(1.1);
        opacity: 1;
    }
}

@keyframes rotateMesh {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes stormFlicker {
    0% {
        opacity: 0.1;
        mask-position: 0 0;
        -webkit-mask-position: 0 0;
    }

    25% {
        opacity: 0.15;
        mask-position: 100px 0;
        -webkit-mask-position: 100px 0;
    }

    50% {
        opacity: 0.1;
        mask-position: 0 100px;
        -webkit-mask-position: 0 100px;
    }

    75% {
        opacity: 0.2;
        mask-position: 100px 100px;
        -webkit-mask-position: 100px 100px;
    }

    100% {
        opacity: 0.1;
        mask-position: 0 0;
        -webkit-mask-position: 0 0;
    }
}

@keyframes synapticPulse {
    0% {
        width: 10%;
        height: 10%;
        opacity: 0;
        border-width: 4px;
    }

    10% {
        opacity: 0.6;
    }

    100% {
        width: 140%;
        height: 140%;
        opacity: 0;
        border-width: 0px;
    }
}

@keyframes breatheLight {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }
}

@keyframes breatheLightFast {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.9;
    }

    50% {
        transform: scale(1.2);
        opacity: 1;
    }
}

@keyframes spinRing {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Legacy pseudo-elements removal (just in case) */
#agent-core::after,
#agent-core::before {
    display: none;
}

/* Jar Ring */
#jar-ring {
    position: absolute;
    width: 140px;
    height: 140px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 1s ease;
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.05);
}

#jar-ring.visible {
    opacity: 1;
}

/* Tool Orbit */
#tool-orbit {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    transform: translate(-50%, -50%) scale(0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease, transform 0.8s ease;
    filter: drop-shadow(0 0 12px rgba(100, 255, 218, 0.25));
    z-index: 2;
}

#tool-orbit.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.orbit-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border: 1px dotted rgba(100, 255, 218, 0.35);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: ringGlow 4s ease-in-out infinite;
    mix-blend-mode: screen;
}

.orbit-ring.inner {
    width: 150px;
    height: 150px;
    border-color: rgba(189, 147, 249, 0.45);
    animation-delay: 0.8s;
}

.orbit-ball {
    --orbit-radius: 95px;
    --orbit-duration: 6s;
    --orbit-delay: 0s;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px !important;
    height: 12px !important;
    margin: -6px 0 0 -6px !important;
    border-radius: 50%;
    background: var(--accent-color);
    box-shadow: 0 0 40px rgba(100, 255, 218, 0.9) !important;
    animation: orbit var(--orbit-duration) linear infinite,
        orbitDepth var(--orbit-duration) linear infinite;
    animation-delay: var(--orbit-delay), var(--orbit-delay);
    opacity: 0;
    will-change: transform;
}

#tool-orbit.active .orbit-ball {
    opacity: 1;
}

#tool-orbit:not(.active) .orbit-ball {
    animation-play-state: paused;
}

#tool-orbit.active .orbit-ball {
    animation-play-state: running;
}

.orbit-ball-1 {
    --orbit-radius: 90px;
}

.orbit-ball-2 {
    --orbit-radius: 120px;
    --orbit-duration: 7.5s;
    --orbit-delay: 0.4s;
    background: var(--secondary-accent);
    box-shadow: 0 0 15px rgba(189, 147, 249, 0.4);
}

.orbit-ball-3 {
    --orbit-radius: 70px;
    --orbit-duration: 5.2s;
    --orbit-delay: 0.8s;
    background: #ffb86c;
    box-shadow: 0 0 10px rgba(255, 184, 108, 0.5);
}

.orbit-ball-4 {
    --orbit-radius: 140px;
    --orbit-duration: 9s;
    --orbit-delay: 1.2s;
    background: #ff79c6;
    /* Pink */
    box-shadow: 0 0 12px rgba(255, 121, 198, 0.5);
}

/* Tools */
#agent-tools {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 150;
}

.tool-node {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100px;
    height: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 5;
    pointer-events: auto;
    cursor: pointer;
}

/* Initial state: Planet - glowing orb before revealing as tool */
.tool-node.planet-state {
    transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-160px) rotate(calc(var(--angle) * -1)) scale(0.15);
}

.tool-node.planet-state .tool-icon {
    width: 60px;
    height: 60px;
    background: currentColor;
    box-shadow: 0 0 60px currentColor, 0 0 120px currentColor;
    border: none;
}

.tool-node.planet-state .tool-icon::before,
.tool-node.planet-state .tool-icon::after {
    display: none;
}

.tool-node.planet-state .tool-icon svg {
    opacity: 0;
    transform: scale(0);
}

.tool-node.planet-state .tool-label {
    opacity: 0;
    transform: scale(0);
}

/* Blooming state - animated transition from particle to tool */
.tool-node.blooming {
    opacity: 1;
    animation: toolBloom 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* During bloom: tool-icon morphs from glowing orb to dark container */
.tool-node.blooming .tool-icon {
    width: 80px;
    height: 80px;
    background: rgba(10, 10, 10, 1);
    box-shadow: 0 0 20px currentColor, inset 0 0 15px rgba(255, 255, 255, 0.03);
    border: 1px solid currentColor;
    transition: background 0.6s ease 0.3s, box-shadow 0.6s ease 0.3s, border 0.4s ease 0.4s, width 0.5s ease, height 0.5s ease;
}

/* During bloom: SVG icon fades in with scale */
.tool-node.blooming .tool-icon svg {
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.4s ease 0.5s, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.5s;
}

/* During bloom: glow ring fades in */
.tool-node.blooming .tool-icon::before,
.tool-node.blooming .tool-icon::after {
    display: block;
    opacity: 0;
    animation: fadeInGlowRing 0.4s ease 0.4s forwards;
}

@keyframes fadeInGlowRing {
    to {
        opacity: 0.2;
    }
}

/* During bloom: label materializes */
.tool-node.blooming .tool-label {
    opacity: 0;
    transform: translateY(5px);
    animation: fadeInLabel 0.3s ease 0.8s forwards;
}

@keyframes fadeInLabel {
    to {
        opacity: 0.9;
        transform: translateY(0);
    }
}

/* Blooming animation - particle transforms into tool */
@keyframes toolBloom {
    0% {
        transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-160px) rotate(calc(var(--angle) * -1)) scale(0.15);
    }
    40% {
        transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-160px) rotate(calc(var(--angle) * -1)) scale(0.5);
    }
    70% {
        transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-160px) rotate(calc(var(--angle) * -1)) scale(0.9);
    }
    85% {
        transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-160px) rotate(calc(var(--angle) * -1)) scale(1.05);
    }
    100% {
        transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-160px) rotate(calc(var(--angle) * -1)) scale(1);
    }
}

.tool-node.visible {
    opacity: 1;
    /* Expand out to circle radius 160px */
    transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-160px) rotate(calc(var(--angle) * -1)) scale(1);
}

.tool-node.highlight {
    transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-160px) rotate(calc(var(--angle) * -1)) scale(1.2);
    z-index: 10;
}

.tool-icon {
    background: rgba(10, 10, 10, 1);
    border: 1px solid currentColor;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow:
        0 0 20px currentColor,
        inset 0 0 15px rgba(255, 255, 255, 0.03);
    transition: all 0.4s var(--ease-out-expo);
    position: relative;
}

.tool-icon svg {
    width: 36px;
    height: 36px;
    stroke: currentColor;
    filter: drop-shadow(0 0 6px currentColor);
    transition: all 0.3s;
}

/* Tool color variants */
.tool-node.tool-cyan {
    color: var(--accent-color);
}

.tool-node.tool-purple {
    color: var(--secondary-accent);
}

.tool-node.tool-orange {
    color: var(--tertiary-accent);
}

.tool-node.tool-pink {
    color: #ff79c6;
}

/* Glow ring effect */
.tool-icon::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 1px solid currentColor;
    opacity: 0.2;
    animation: toolRingPulse 3s infinite ease-in-out;
}

.tool-icon::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: radial-gradient(circle, transparent 60%, currentColor 100%);
    opacity: 0.1;
}

@keyframes toolRingPulse {

    0%,
    100% {
        opacity: 0.2;
        transform: scale(1);
    }

    50% {
        opacity: 0.4;
        transform: scale(1.05);
    }
}

.tool-label {
    margin-top: 8px;
    font-size: 0.7rem;
    color: currentColor;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0;
    transition: opacity 0.3s;
    background: rgba(0, 0, 0, 0.8);
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.tool-node.visible .tool-label {
    opacity: 0.9;
}

.tool-node.highlight .tool-icon {
    box-shadow:
        0 0 30px currentColor,
        0 0 60px currentColor,
        inset 0 0 20px rgba(255, 255, 255, 0.1);
    border-color: #fff;
    background: rgba(20, 20, 20, 1);
    transform: scale(1.1);
}

.tool-node.highlight .tool-icon svg {
    filter: drop-shadow(0 0 12px currentColor);
    transform: scale(1.1);
}

.tool-node.highlight .tool-label {
    opacity: 1;
}

/* Tool Tooltips */
.tool-node[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 0.6rem 1rem;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid currentColor;
    border-radius: 8px;
    font-size: 0.75rem;
    font-family: var(--font-main);
    color: var(--text-primary);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s var(--ease-out-expo);
    z-index: 9999;
    box-shadow:
        0 0 20px rgba(0, 0, 0, 0.5),
        0 0 15px currentColor;
    text-transform: none;
    letter-spacing: 0.02em;
    pointer-events: none;
}

.tool-node[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-12px);
}

/* Ensure tooltips show above other elements */
.tool-node:hover {
    z-index: 1000;
}

/* Goal */
#agent-goal {
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translate(-50%, -30px);
    opacity: 0;
    transition: all 1s var(--ease-out-expo);
    z-index: 3;
}

#agent-goal.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* Goal positioned near the brain (first appearance) */
#agent-goal.near-brain {
    top: 32%;
}

#agent-goal.near-brain.visible {
    transform: translate(-50%, 0);
}

.goal-card {
    background: rgba(10, 10, 10, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 184, 108, 0.3);
    padding: 1.2rem 2.5rem;
    border-radius: 16px;
    text-align: center;
    min-width: 220px;
    box-shadow:
        0 0 40px rgba(255, 184, 108, 0.1),
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 0 30px rgba(255, 184, 108, 0.03);
    position: relative;
    overflow: hidden;
    transition: all 0.5s var(--ease-out-expo);
}

/* Subtle animated gradient border */
.goal-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 17px;
    padding: 1px;
    background: linear-gradient(135deg,
            rgba(255, 184, 108, 0.5) 0%,
            transparent 50%,
            rgba(255, 184, 108, 0.3) 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: goalBorderShimmer 4s ease-in-out infinite;
}

@keyframes goalBorderShimmer {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* Inner glow pulse */
.goal-card::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80%;
    height: 80%;
    transform: translate(-50%, -50%);
    background: radial-gradient(ellipse at center, rgba(255, 184, 108, 0.1) 0%, transparent 70%);
    animation: goalInnerPulse 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes goalInnerPulse {

    0%,
    100% {
        opacity: 0.3;
        transform: translate(-50%, -50%) scale(0.95);
    }

    50% {
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(1.05);
    }
}

.goal-card.highlight {
    box-shadow:
        0 0 50px rgba(255, 184, 108, 0.4),
        0 0 100px rgba(255, 184, 108, 0.2),
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 0 40px rgba(255, 184, 108, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.goal-card.highlight::before {
    opacity: 1;
    background: linear-gradient(135deg,
            rgba(255, 184, 108, 0.8) 0%,
            rgba(255, 255, 255, 0.5) 50%,
            rgba(255, 184, 108, 0.8) 100%);
}

.goal-label {
    font-size: 0.65rem;
    color: var(--tertiary-accent);
    letter-spacing: 0.25em;
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.6rem;
    position: relative;
    z-index: 1;
    text-shadow: 0 0 10px rgba(255, 184, 108, 0.3);
}

#goal-text {
    font-size: 1.15rem;
    font-family: var(--font-display);
    color: #fff;
    font-weight: 400;
    position: relative;
    z-index: 1;
    letter-spacing: 0.02em;
}

/* Controls */
#controls {
    pointer-events: all;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

/* Industry Selector */
#industry-selector {
    position: absolute;
    bottom: 180px;
    left: 50%;
    transform: translate(-50%, 0);
    display: flex;
    gap: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
    z-index: 12;
}

#industry-selector.visible {
    opacity: 1;
    pointer-events: all;
}

.industry-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.2rem 1.5rem;
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    transition: all 0.3s var(--ease-out-expo);
    min-width: 100px;
}

.industry-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-color);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.industry-card .icon {
    font-size: 2rem;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.2));
}

.industry-card span {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}

.hidden {
    display: none !important;
    /* Force hide */
}

/* Utility for SVG lines */
line {
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 1;
    transition: all 0.5s;
}

line.active-path {
    stroke: var(--line-color, var(--accent-color));
    stroke-width: 2;
    filter: drop-shadow(0 0 5px var(--line-color, var(--accent-color)));
}

/* Inter-tool connections (tool-to-tool) */
#connection-lines line.inter-tool-line {
    stroke: var(--secondary-accent) !important;
    stroke-width: 1.5 !important;
    stroke-dasharray: 8 5;
    opacity: 0.5;
    animation: interToolPulse 4s ease-in-out infinite;
}

#connection-lines line.inter-tool-line.active-path {
    stroke: var(--secondary-accent) !important;
    stroke-width: 2.5 !important;
    stroke-dasharray: none;
    opacity: 1;
    filter: drop-shadow(0 0 10px var(--secondary-accent));
}

@keyframes interToolPulse {

    0%,
    100% {
        opacity: 0.35;
    }

    50% {
        opacity: 0.7;
    }
}

/* Optional: gentle pop-in for key words on the definition step */
#definition-text-container .key-word {
    animation: wordPop 0.6s ease-out both;
}

#definition-text-container .key-word:nth-of-type(1) {
    animation-delay: 0.3s;
}

#definition-text-container .key-word:nth-of-type(2) {
    animation-delay: 0.45s;
}

#definition-text-container .key-word:nth-of-type(3) {
    animation-delay: 0.6s;
}

#definition-text-container .key-word:nth-of-type(4) {
    animation-delay: 0.75s;
}

@keyframes wordPop {
    0% {
        transform: translateY(6px);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes ringGlow {

    0%,
    100% {
        opacity: 0.4;
        filter: drop-shadow(0 0 6px rgba(100, 255, 218, 0.15));
    }

    50% {
        opacity: 0.8;
        filter: drop-shadow(0 0 14px rgba(100, 255, 218, 0.3));
    }
}

@keyframes orbit {
    from {
        transform: rotate(0deg) translateX(var(--orbit-radius)) rotate(0deg);
    }

    to {
        transform: rotate(360deg) translateX(var(--orbit-radius)) rotate(-360deg);
    }
}

@keyframes orbitDepth {

    0%,
    45% {
        z-index: 1;
        opacity: 0.7;
        filter: brightness(0.7);
    }

    50%,
    100% {
        z-index: 4;
        opacity: 1;
        filter: brightness(1.1);
    }
}

/* Glass Barrier (Containment Field) */
#containment-field {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        inset 0 0 20px rgba(255, 255, 255, 0.05),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    transition: all 1.5s ease;
    z-index: 4;
    /* Above brain */
    pointer-events: none;
}

#containment-field.visible {
    opacity: 1;
    animation: fieldPulse 4s infinite ease-in-out;
}

@keyframes fieldPulse {

    0%,
    100% {
        box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.05), 0 0 0 1px rgba(255, 255, 255, 0.05);
    }

    50% {
        box-shadow: inset 0 0 30px rgba(255, 255, 255, 0.1), 0 0 0 2px rgba(255, 255, 255, 0.1);
    }
}

/* Universe Visualization (Ethereal) */
#universe-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 2s var(--ease-in-out);
    z-index: 1;
}

#universe-container.visible {
    opacity: 1;
}

#universe-particle-label {
    position: absolute;
    top: 0;
    left: 0;
    /* Start slightly to the left so it slides out */
    transform: translate(0, 0);
    font-size: 0.65rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);
    text-shadow:
        0 0 8px rgba(100, 255, 218, 0.5),
        0 0 2px rgba(255, 255, 255, 0.4);
    opacity: 0;
    /* Only animate opacity and filter for the ethereal reveal */
    transition: opacity 0.8s ease, filter 0.8s ease;
    filter: blur(8px);
    pointer-events: none;
    white-space: nowrap;
    will-change: transform, opacity, filter;
}

#universe-particle-label.visible {
    opacity: 0.9;
    filter: blur(0);
}

.universe-particle {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    background: #fff;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.6);
}

#universe-container.visible .universe-particle {
    animation: floatParticle 20s infinite linear;
}

.universe-particle.active-tool {
    box-shadow:
        0 0 55px rgba(255, 255, 255, 0.9),
        0 0 18px currentColor,
        0 0 8px rgba(255, 255, 255, 0.6);
    filter: saturate(1.35) brightness(1.15);
}

#universe-container.visible .universe-particle.active-tool {
    animation: floatParticle 20s infinite linear, activeToolPulse 1.8s ease-in-out infinite alternate;
}

@keyframes activeToolPulse {
    0% {
        filter: saturate(1.1) brightness(1.05);
    }

    100% {
        filter: saturate(1.5) brightness(1.2);
    }
}

/* Particle Variations - More spread out, 10 particles - each with unique color */
.universe-particle.p-1 {
    width: 12px;
    height: 12px;
    background: var(--accent-color);
    /* Cyan */
    box-shadow: 0 0 35px var(--accent-glow);
    margin-top: -140px;
    margin-left: 85px;
    animation-duration: 25s;
    opacity: 0.9;
}

.universe-particle.p-2 {
    width: 16px;
    height: 16px;
    background: var(--secondary-accent);
    /* Purple */
    box-shadow: 0 0 40px var(--secondary-glow);
    margin-top: 115px;
    margin-left: -90px;
    animation-duration: 30s;
    animation-delay: -5s;
    opacity: 0.75;
}

.universe-particle.p-3 {
    width: 8px;
    height: 8px;
    background: var(--tertiary-accent);
    /* Orange */
    box-shadow: 0 0 25px rgba(255, 184, 108, 0.6);
    margin-top: -95px;
    margin-left: -110px;
    animation-duration: 22s;
    animation-delay: -2s;
    opacity: 0.6;
}

.universe-particle.p-4 {
    width: 10px;
    height: 10px;
    background: #fff;
    /* White */
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.4);
    margin-top: 155px;
    margin-left: 50px;
    animation-duration: 28s;
    animation-delay: -8s;
    opacity: 0.5;
}

.universe-particle.p-5 {
    width: 6px;
    height: 6px;
    background: #50fa7b;
    /* Green */
    box-shadow: 0 0 20px rgba(80, 250, 123, 0.6);
    margin-top: 25px;
    margin-left: 160px;
    animation-duration: 35s;
    opacity: 0.4;
}

.universe-particle.p-6 {
    width: 10px;
    height: 10px;
    background: #f1fa8c;
    /* Yellow */
    box-shadow: 0 0 30px rgba(241, 250, 140, 0.5);
    margin-top: -165px;
    margin-left: -45px;
    animation-duration: 20s;
    opacity: 0.85;
}

.universe-particle.p-7 {
    width: 14px;
    height: 14px;
    background: #8be9fd;
    /* Light Blue/Teal */
    box-shadow: 0 0 35px rgba(139, 233, 253, 0.6);
    margin-top: -185px;
    margin-left: 25px;
    animation-duration: 27s;
    animation-delay: -3s;
    opacity: 0.7;
}

.universe-particle.p-8 {
    width: 8px;
    height: 8px;
    background: #ff5555;
    /* Red */
    box-shadow: 0 0 25px rgba(255, 85, 85, 0.6);
    margin-top: 90px;
    margin-left: 130px;
    animation-duration: 32s;
    animation-delay: -10s;
    opacity: 0.55;
}

.universe-particle.p-9 {
    width: 12px;
    height: 12px;
    background: #ff79c6;
    /* Pink */
    box-shadow: 0 0 30px rgba(255, 121, 198, 0.5);
    margin-top: -50px;
    margin-left: -155px;
    animation-duration: 24s;
    animation-delay: -7s;
    opacity: 0.8;
}

.universe-particle.p-10 {
    width: 10px;
    height: 10px;
    background: #6272a4;
    /* Indigo/Blue-Grey */
    box-shadow: 0 0 30px rgba(98, 114, 164, 0.5);
    margin-top: 175px;
    margin-left: -60px;
    animation-duration: 26s;
    animation-delay: -12s;
    opacity: 0.45;
}

@keyframes floatParticle {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) translateX(18px) rotate(0deg) scale(1);
        filter: brightness(0.8) blur(1px);
    }

    50% {
        transform: translate(-50%, -50%) rotate(180deg) translateX(30px) rotate(-180deg) scale(1.15);
        filter: brightness(1.2) blur(0.5px);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg) translateX(18px) rotate(-360deg) scale(1);
        filter: brightness(0.8) blur(1px);
    }
}

/* ================================
   Scenario Result Card
   ================================ */
#scenario-result {
    position: absolute;
    bottom: 22%;
    left: 50%;
    transform: translateX(-50%) translateY(20px) scale(0.8);
    opacity: 0;
    transition: all 1s var(--ease-out-expo);
    z-index: 15;
    pointer-events: none;
}

#scenario-result.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
}

.result-card {
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(100, 255, 218, 0.4);
    border-radius: 12px;
    padding: 1.2rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow:
        0 0 40px rgba(100, 255, 218, 0.15),
        0 10px 40px rgba(0, 0, 0, 0.4);
}

.result-icon {
    width: 40px;
    height: 40px;
    background: rgba(100, 255, 218, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
}

.result-icon svg {
    width: 24px;
    height: 24px;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
}

#scenario-result.visible .result-icon svg {
    animation: checkDraw 0.8s ease-out 0.3s forwards;
}

@keyframes checkDraw {
    to {
        stroke-dashoffset: 0;
    }
}

.result-text {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.result-label {
    font-size: 0.6rem;
    color: var(--accent-color);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.result-status {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-family: var(--font-display);
}

/* Connection beam from brain to contract */
#scenario-container .connection-beam {
    position: absolute;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-color), transparent);
    transform-origin: left center;
    opacity: 0;
    box-shadow: 0 0 10px var(--accent-color);
    pointer-events: none;
}

#scenario-container .connection-beam.active {
    opacity: 1;
    animation: beamPulse 1.5s ease-in-out infinite;
}

@keyframes beamPulse {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 1;
    }
}

/* Chaos Lines - Electric Feel */
#chaos-lines {
    filter: drop-shadow(0 0 8px var(--accent-color));
    mix-blend-mode: screen;
}

#chaos-lines path {
    transition: stroke 0.2s, stroke-width 0.2s, opacity 0.2s;
}

/* ================================
   Neural Signal - Light Trail Animation
   ================================ */
#neural-signal {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--signal-color, #fff);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    z-index: 1; /* Behind tools so it passes through */
    pointer-events: none;
    /* Softer, more diffuse glow */
    box-shadow:
        0 0 6px 2px var(--signal-color, #fff),
        0 0 12px 4px var(--signal-glow, rgba(100, 255, 218, 0.5)),
        0 0 24px 8px var(--signal-glow-soft, rgba(100, 255, 218, 0.2));
    /* Smooth transitions for position */
    transition: none;
    will-change: transform, opacity;
}

#neural-signal.active {
    opacity: 1;
}

/* Trail effect using pseudo-element */
#neural-signal::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 70px;
    height: 3px;
    background: linear-gradient(90deg, 
        var(--signal-color, rgba(255, 255, 255, 0.8)) 0%,
        var(--signal-glow, rgba(100, 255, 218, 0.5)) 15%,
        var(--signal-glow-soft, rgba(100, 255, 218, 0.2)) 40%,
        transparent 100%);
    transform-origin: left center;
    transform: translate(-100%, -50%) rotate(var(--trail-angle, 0deg));
    border-radius: 2px;
    opacity: 0;
    filter: blur(2px);
    transition: opacity 0.2s ease;
}

#neural-signal.traveling::before {
    opacity: 0;
}

/* Incoming signal (returning to brain) - flip the trail */
#neural-signal.incoming::before {
    transform: translate(0, -50%) rotate(calc(var(--trail-angle, 0deg) + 180deg));
}

/* Brain firing state - gentle pulse when sending signal */
#agent-core.firing {
    animation: brainFire 0.6s ease-out;
}

#agent-core.firing .brain-core-light {
    box-shadow: 0 0 45px #fff, 0 0 80px var(--brain-color);
}

#agent-core.firing .brain-plasma {
    filter: url('#plasma-filter') brightness(1.15);
}

@keyframes brainFire {
    0% {
        transform: scale(1);
    }
    40% {
        transform: scale(1.04);
    }
    100% {
        transform: scale(1);
    }
}

/* Brain receiving state - gentle glow when signal returns */
#agent-core.receiving {
    animation: brainReceive 0.5s ease-out;
}

#agent-core.receiving .brain-core-light {
    box-shadow: 0 0 50px #fff, 0 0 90px var(--brain-color);
}

@keyframes brainReceive {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.03);
        filter: brightness(1.1);
    }
    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}

/* Signal traveling animation - slow, smooth easing */
#neural-signal.to-tool {
    transition: transform 0.9s cubic-bezier(0.25, 0.1, 0.25, 1);
}

#neural-signal.to-center {
    transition: transform 0.8s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* ================================
   Finale Screen - Agent Definition Recap
   ================================ */
#finale-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.2s var(--ease-in-out);
}

#finale-screen.visible {
    opacity: 1;
    pointer-events: all;
}

.finale-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4rem;
    padding: 2rem;
    max-width: 90vw;
}

.finale-definition {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 3.2vw, 2.6rem);
    line-height: 1.6;
    text-align: center;
    color: var(--text-primary);
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1.5s var(--ease-out-expo), transform 1.5s var(--ease-out-expo);
}

#finale-screen.visible .finale-definition {
    opacity: 1;
    transform: translateY(0);
}

.finale-definition .key-word {
    font-weight: 400;
    position: relative;
    padding: 0 0.15em;
}

.finale-definition .key-model {
    color: var(--accent-color);
    text-shadow: 0 0 30px var(--accent-glow), 0 0 60px var(--accent-glow);
}

.finale-definition .key-tools {
    color: var(--secondary-accent);
    text-shadow: 0 0 30px var(--secondary-glow), 0 0 60px var(--secondary-glow);
}

.finale-definition .key-goal {
    color: var(--tertiary-accent);
    text-shadow: 0 0 30px rgba(255, 184, 108, 0.5), 0 0 60px rgba(255, 184, 108, 0.3);
}

#finale-restart-btn {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s var(--ease-out-expo), transform 0.8s var(--ease-out-expo);
}

#finale-restart-btn.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ================================
   RESPONSIVE DESIGN - Mobile (max-width: 480px)
   ================================ */
@media (max-width: 480px) {
    /* Landing Page */
    .content-wrapper {
        padding: 0 1.5rem;
    }

    .title {
        margin-bottom: 1rem;
    }

    .subtitle {
        margin-bottom: 2.5rem;
        padding: 0 0.5rem;
    }

    /* Buttons - Touch Friendly */
    .cta-text {
        padding: 0.9rem 1.8rem;
        font-size: 0.85rem;
        letter-spacing: 0.12em;
        min-height: 44px; /* Touch target */
    }

    .cta-transition {
        padding: 0.95rem 2rem;
        font-size: 0.9rem;
        letter-spacing: 0.14em;
        min-height: 44px;
    }

    /* Brain/Core Scaling - BIGGER on mobile */
    #brain-container,
    #shared-brain-container,
    #brain-container-default {
        width: 120px;
        height: 120px;
    }

    /* Move brain visualization UP to prevent overlap with bottom text */
    #shared-brain-container {
        top: 32%;
    }

    #brain-container-default {
        top: 32%;
    }

    #universe-container {
        top: 32%;
    }

    #containment-field {
        top: 32%;
    }

    #agent-core {
        width: 80px;
        height: 80px;
    }

    .brain-ring {
        inset: -12px;
    }

    .brain-core-light {
        inset: 16px;
    }

    /* Jar Ring */
    #jar-ring {
        width: 120px;
        height: 120px;
    }

    /* Tool Orbit Scaling */
    #tool-orbit {
        width: 160px;
        height: 160px;
    }

    .orbit-ball-1 { --orbit-radius: 70px; }
    .orbit-ball-2 { --orbit-radius: 95px; }
    .orbit-ball-3 { --orbit-radius: 58px; }
    .orbit-ball-4 { --orbit-radius: 110px; }

    .orbit-ring.inner {
        width: 120px;
        height: 120px;
    }

    /* Tool Nodes Scaling - NO scale transform, bigger sizes */
    #agent-tools {
        transform: none;
    }

    .tool-node {
        width: 90px;
        height: 100px;
        /* Move tool center UP to match brain position */
        top: 32%;
    }

    /* Override tool positioning for mobile - use 130px radius */
    .tool-node.visible {
        transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-130px) rotate(calc(var(--angle) * -1)) scale(1);
    }

    .tool-node.highlight {
        transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-130px) rotate(calc(var(--angle) * -1)) scale(1.15);
    }

    .tool-node.planet-state {
        transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-130px) rotate(calc(var(--angle) * -1)) scale(0.15);
    }

    @keyframes toolBloomMobile {
        0% {
            transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-130px) rotate(calc(var(--angle) * -1)) scale(0.15);
        }
        40% {
            transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-130px) rotate(calc(var(--angle) * -1)) scale(0.5);
        }
        70% {
            transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-130px) rotate(calc(var(--angle) * -1)) scale(0.9);
        }
        85% {
            transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-130px) rotate(calc(var(--angle) * -1)) scale(1.05);
        }
        100% {
            transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-130px) rotate(calc(var(--angle) * -1)) scale(1);
        }
    }

    .tool-node.blooming {
        animation: toolBloomMobile 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    }

    .tool-icon {
        width: 65px;
        height: 65px;
    }

    .tool-icon svg {
        width: 30px;
        height: 30px;
    }

    .tool-label {
        font-size: 0.7rem;
        padding: 3px 8px;
        letter-spacing: 0.08em;
    }

    /* Tool tooltips - hide on mobile (rely on labels) */
    .tool-node[data-tooltip]::after {
        display: none;
    }

    /* Universe Container */
    #universe-container {
        width: 360px;
        height: 360px;
    }

    /* Universe particles repositioning for smaller container */
    .universe-particle.p-1 { margin-top: -95px; margin-left: 60px; }
    .universe-particle.p-2 { margin-top: 85px; margin-left: -65px; }
    .universe-particle.p-3 { margin-top: -65px; margin-left: -75px; }
    .universe-particle.p-4 { margin-top: 110px; margin-left: 35px; }
    .universe-particle.p-5 { margin-top: 18px; margin-left: 115px; }
    .universe-particle.p-6 { margin-top: -115px; margin-left: -30px; }
    .universe-particle.p-7 { margin-top: -130px; margin-left: 18px; }
    .universe-particle.p-8 { margin-top: 65px; margin-left: 95px; }
    .universe-particle.p-9 { margin-top: -35px; margin-left: -110px; }
    .universe-particle.p-10 { margin-top: 125px; margin-left: -42px; }

    #universe-particle-label {
        font-size: 0.6rem;
        letter-spacing: 0.2em;
    }

    /* Containment Field */
    #containment-field {
        width: 120px;
        height: 120px;
    }

    /* Goal Card - adjusted for brain at 32% instead of 50% */
    #agent-goal {
        top: 10%;
    }

    #agent-goal.near-brain {
        top: 15%;
    }

    .goal-card {
        min-width: 200px;
        padding: 1rem 1.8rem;
        border-radius: 14px;
    }

    .goal-label {
        font-size: 0.6rem;
        margin-bottom: 0.5rem;
        letter-spacing: 0.2em;
    }

    #goal-text {
        font-size: 1.05rem;
    }

    /* Persistent Definition Header */
    #persistent-definition {
        top: 5%;
        padding: 0 1.2rem;
        font-size: clamp(0.9rem, 4.5vw, 1.1rem);
        line-height: 1.5;
    }

    /* Definition Screen */
    .definition-label {
        top: 18%;
        font-size: 0.8rem;
        letter-spacing: 0.2em;
    }

    #definition-text-container {
        top: 28%;
        padding: 0 1.2rem;
        white-space: normal;
        font-size: clamp(1.2rem, 5.5vw, 1.6rem);
        line-height: 1.5;
    }

    #definition-text-container.at-top {
        top: 8%;
    }

    #model-explanation {
        bottom: calc(2% + 4rem);
        padding: 0 1.5rem;
        font-size: clamp(0.95rem, 4.5vw, 1.15rem);
        max-width: 100%;
        line-height: 1.7;
    }

    /* Narrative Box */
    #narrative-box {
        bottom: 3%;
        padding: 0 1.2rem;
    }

    #narrative-text {
        font-size: clamp(0.95rem, 4.5vw, 1.15rem);
        line-height: 1.7;
        max-width: 100%;
        min-height: auto;
    }

    /* Loop sequence - horizontal with 2 items per row on mobile */
    #narrative-text .loop-sequence {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.3em 0.4em;
        justify-content: center;
        max-width: 280px;
        margin: 0 auto;
    }

    #narrative-text .loop-step {
        padding: 0.25em 0.5em;
        font-size: 0.85em;
        min-width: 90px;
        text-align: center;
    }

    #narrative-text .loop-arrow {
        transform: none;
        font-size: 0.8em;
    }

    /* Controls */
    #controls {
        gap: 1rem;
    }

    /* Industry Selector */
    #industry-selector {
        bottom: 140px;
    }

    .industry-card {
        padding: 1rem 1.2rem;
        min-width: 80px;
    }

    .industry-card .icon {
        font-size: 1.5rem;
    }

    .industry-card span {
        font-size: 0.7rem;
    }

    /* Scenario Result */
    #scenario-result {
        bottom: 18%;
    }

    .result-card {
        padding: 1rem 1.2rem;
        gap: 0.8rem;
    }

    .result-icon {
        width: 32px;
        height: 32px;
    }

    .result-icon svg {
        width: 20px;
        height: 20px;
    }

    .result-label {
        font-size: 0.5rem;
    }

    .result-status {
        font-size: 0.8rem;
    }

    /* Finale Screen */
    .finale-content {
        gap: 3rem;
        padding: 1.5rem;
    }

    .finale-definition {
        font-size: clamp(1.2rem, 5vw, 1.8rem);
        line-height: 1.5;
    }

    /* Agent Container - no scale transform, lines are drawn dynamically */
    #agent-container {
        transform: none;
    }

    /* Neural Signal */
    #neural-signal {
        width: 5px;
        height: 5px;
    }

    #neural-signal::before {
        width: 50px;
        height: 2px;
    }
}

/* ================================
   RESPONSIVE DESIGN - Tablet (max-width: 768px)
   ================================ */
@media (min-width: 481px) and (max-width: 768px) {
    /* Landing Page */
    .content-wrapper {
        padding: 0 2rem;
    }

    .subtitle {
        margin-bottom: 3rem;
    }

    /* Buttons */
    .cta-text {
        padding: 0.95rem 2.2rem;
        font-size: 0.85rem;
    }

    .cta-transition {
        padding: 1rem 2.5rem;
        font-size: 0.9rem;
    }

    /* Brain/Core Scaling */
    #brain-container,
    #shared-brain-container,
    #brain-container-default {
        width: 120px;
        height: 120px;
    }

    #agent-core {
        width: 75px;
        height: 75px;
    }

    .brain-ring {
        inset: -12px;
    }

    .brain-core-light {
        inset: 16px;
    }

    /* Jar Ring */
    #jar-ring {
        width: 120px;
        height: 120px;
    }

    /* Tool Orbit Scaling */
    #tool-orbit {
        width: 170px;
        height: 170px;
    }

    .orbit-ball-1 { --orbit-radius: 75px; }
    .orbit-ball-2 { --orbit-radius: 100px; }
    .orbit-ball-3 { --orbit-radius: 58px; }
    .orbit-ball-4 { --orbit-radius: 118px; }

    .orbit-ring.inner {
        width: 128px;
        height: 128px;
    }

    /* Tool Nodes Scaling */
    #agent-tools {
        transform: scale(0.8);
    }

    .tool-node {
        width: 90px;
        height: 100px;
    }

    /* Override tool positioning for tablet - use medium radius */
    .tool-node.visible {
        transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-128px) rotate(calc(var(--angle) * -1)) scale(1);
    }

    .tool-node.highlight {
        transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-128px) rotate(calc(var(--angle) * -1)) scale(1.2);
    }

    .tool-node.planet-state {
        transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-128px) rotate(calc(var(--angle) * -1)) scale(0.15);
    }

    @keyframes toolBloomTablet {
        0% {
            transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-128px) rotate(calc(var(--angle) * -1)) scale(0.15);
        }
        40% {
            transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-128px) rotate(calc(var(--angle) * -1)) scale(0.5);
        }
        70% {
            transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-128px) rotate(calc(var(--angle) * -1)) scale(0.9);
        }
        85% {
            transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-128px) rotate(calc(var(--angle) * -1)) scale(1.05);
        }
        100% {
            transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-128px) rotate(calc(var(--angle) * -1)) scale(1);
        }
    }

    .tool-node.blooming {
        animation: toolBloomTablet 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    }

    .tool-icon {
        width: 65px;
        height: 65px;
    }

    .tool-icon svg {
        width: 30px;
        height: 30px;
    }

    .tool-label {
        font-size: 0.65rem;
    }

    /* Tool tooltips - smaller on tablet */
    .tool-node[data-tooltip]::after {
        font-size: 0.7rem;
        padding: 0.5rem 0.8rem;
    }

    /* Universe Container */
    #universe-container {
        width: 450px;
        height: 450px;
    }

    /* Universe particles repositioning */
    .universe-particle.p-1 { margin-top: -110px; margin-left: 65px; }
    .universe-particle.p-2 { margin-top: 90px; margin-left: -70px; }
    .universe-particle.p-3 { margin-top: -75px; margin-left: -85px; }
    .universe-particle.p-4 { margin-top: 125px; margin-left: 40px; }
    .universe-particle.p-5 { margin-top: 20px; margin-left: 130px; }
    .universe-particle.p-6 { margin-top: -135px; margin-left: -35px; }
    .universe-particle.p-7 { margin-top: -150px; margin-left: 20px; }
    .universe-particle.p-8 { margin-top: 70px; margin-left: 105px; }
    .universe-particle.p-9 { margin-top: -40px; margin-left: -125px; }
    .universe-particle.p-10 { margin-top: 140px; margin-left: -48px; }

    /* Containment Field */
    #containment-field {
        width: 120px;
        height: 120px;
    }

    /* Goal Card */
    #agent-goal {
        top: 14%;
    }

    #agent-goal.near-brain {
        top: 30%;
    }

    .goal-card {
        min-width: 200px;
        padding: 1rem 2rem;
    }

    .goal-label {
        font-size: 0.6rem;
    }

    #goal-text {
        font-size: 1.05rem;
    }

    /* Persistent Definition Header */
    #persistent-definition {
        top: 6%;
        padding: 0 1.5rem;
        font-size: clamp(0.9rem, 2.5vw, 1.15rem);
    }

    /* Definition Screen */
    .definition-label {
        top: 22%;
        font-size: 0.8rem;
    }

    #definition-text-container {
        top: 32%;
        padding: 0 1.5rem;
        font-size: clamp(1.3rem, 3.5vw, 1.8rem);
    }

    #definition-text-container.at-top {
        top: 9%;
    }

    #model-explanation {
        padding: 0 1.5rem;
        font-size: clamp(1rem, 2.5vw, 1.2rem);
        max-width: 600px;
    }

    /* Narrative Box */
    #narrative-box {
        padding: 0 1.5rem;
    }

    #narrative-text {
        font-size: clamp(1rem, 2.5vw, 1.2rem);
        max-width: 600px;
    }

    /* Loop sequence */
    #narrative-text .loop-sequence {
        gap: 0.4em;
    }

    #narrative-text .loop-step {
        font-size: 0.85em;
    }

    /* Industry Selector */
    #industry-selector {
        bottom: 160px;
    }

    /* Scenario Result */
    #scenario-result {
        bottom: 20%;
    }

    .result-card {
        padding: 1.1rem 1.3rem;
    }

    .result-icon {
        width: 36px;
        height: 36px;
    }

    .result-label {
        font-size: 0.55rem;
    }

    .result-status {
        font-size: 0.85rem;
    }

    /* Finale Screen */
    .finale-content {
        gap: 3.5rem;
    }

    .finale-definition {
        font-size: clamp(1.5rem, 4vw, 2.5rem);
    }

    /* Agent Container - no scale transform, lines are drawn dynamically */
    #agent-container {
        transform: none;
    }
}

/* ================================
   RESPONSIVE DESIGN - Small Height Screens
   ================================ */
@media (max-height: 700px) {
    #persistent-definition {
        top: 3%;
    }

    #agent-goal {
        top: 10%;
    }

    #agent-goal.near-brain {
        top: 25%;
    }

    .definition-label {
        top: 15%;
    }

    #definition-text-container {
        top: 25%;
    }

    #definition-text-container.at-top {
        top: 6%;
    }

    #narrative-box {
        bottom: 1%;
    }

    #scenario-result {
        bottom: 15%;
    }

    #industry-selector {
        bottom: 120px;
    }

    #model-explanation {
        bottom: calc(1% + 4rem);
    }
}

/* ================================
   RESPONSIVE DESIGN - Landscape Mobile
   ================================ */
@media (max-width: 850px) and (max-height: 450px) and (orientation: landscape) {
    /* Dramatically scale down for landscape phones */
    #agent-container {
        transform: none;
    }

    #agent-tools {
        transform: scale(0.55);
    }

    /* Override tool positioning for landscape - use smallest radius */
    .tool-node.visible {
        transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-85px) rotate(calc(var(--angle) * -1)) scale(1);
    }

    .tool-node.highlight {
        transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-85px) rotate(calc(var(--angle) * -1)) scale(1.2);
    }

    .tool-node.planet-state {
        transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-85px) rotate(calc(var(--angle) * -1)) scale(0.15);
    }

    @keyframes toolBloomLandscape {
        0% {
            transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-85px) rotate(calc(var(--angle) * -1)) scale(0.15);
        }
        40% {
            transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-85px) rotate(calc(var(--angle) * -1)) scale(0.5);
        }
        70% {
            transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-85px) rotate(calc(var(--angle) * -1)) scale(0.9);
        }
        85% {
            transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-85px) rotate(calc(var(--angle) * -1)) scale(1.05);
        }
        100% {
            transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-85px) rotate(calc(var(--angle) * -1)) scale(1);
        }
    }

    .tool-node.blooming {
        animation: toolBloomLandscape 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    }

    #brain-container,
    #shared-brain-container,
    #brain-container-default {
        width: 80px;
        height: 80px;
    }

    #agent-core {
        width: 55px;
        height: 55px;
    }

    .brain-ring {
        inset: -8px;
    }

    #jar-ring {
        width: 80px;
        height: 80px;
    }

    #containment-field {
        width: 80px;
        height: 80px;
    }

    #universe-container {
        width: 250px;
        height: 250px;
    }

    /* Reposition universe particles for tiny landscape */
    .universe-particle.p-1 { margin-top: -60px; margin-left: 35px; }
    .universe-particle.p-2 { margin-top: 50px; margin-left: -40px; }
    .universe-particle.p-3 { margin-top: -40px; margin-left: -50px; }
    .universe-particle.p-4 { margin-top: 70px; margin-left: 20px; }
    .universe-particle.p-5 { margin-top: 10px; margin-left: 75px; }
    .universe-particle.p-6 { margin-top: -75px; margin-left: -18px; }
    .universe-particle.p-7 { margin-top: -85px; margin-left: 10px; }
    .universe-particle.p-8 { margin-top: 40px; margin-left: 60px; }
    .universe-particle.p-9 { margin-top: -20px; margin-left: -70px; }
    .universe-particle.p-10 { margin-top: 80px; margin-left: -28px; }

    #persistent-definition {
        top: 2%;
        font-size: 0.75rem;
    }

    .definition-label {
        top: 12%;
        font-size: 0.65rem;
    }

    #definition-text-container {
        top: 22%;
        font-size: 1rem;
    }

    #definition-text-container.at-top {
        top: 4%;
    }

    #narrative-box {
        bottom: 2%;
    }

    #narrative-text {
        font-size: 0.85rem;
        line-height: 1.4;
    }

    #narrative-text .loop-sequence {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.25em;
    }

    #narrative-text .loop-step {
        font-size: 0.75em;
        padding: 0.2em 0.4em;
    }

    #narrative-text .loop-arrow {
        transform: none;
        font-size: 0.7em;
    }

    #agent-goal {
        top: 8%;
    }

    #agent-goal.near-brain {
        top: 20%;
    }

    .goal-card {
        min-width: 160px;
        padding: 0.7rem 1.2rem;
    }

    #goal-text {
        font-size: 0.85rem;
    }

    #model-explanation {
        font-size: 0.85rem;
        bottom: calc(2% + 3rem);
    }

    #scenario-result {
        bottom: 12%;
    }

    .result-card {
        padding: 0.8rem 1rem;
    }

    .cta-text,
    .cta-transition {
        padding: 0.7rem 1.5rem;
        font-size: 0.75rem;
    }

    .finale-content {
        gap: 2rem;
    }

    .finale-definition {
        font-size: 1.1rem;
    }
}