/* --- A. SCROLLING & PINNING STRUCTURE --- */
#visualizer-wrapper, .scroll-container {
    position: relative;
    z-index: 2;
}
.scroll-container {
    height: 900vh;
}
.synthesis-visualizer-section {
    position: sticky;
    top: 0;
    height: 100vh;
    width: 100%;
}

/* --- B. THE "CONTENT BLOCK" WRAPPER --- */
/* This wrapper is the ANCHOR. It is centered perfectly
   and acts as the positioning context for the intro. */
.visualizer-content-wrapper {
    /* Center the wrapper itself. */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    
    /* Make it a positioning context for its children. */
    position: relative;

    /* Define its shape. */
    width: 100%;
    max-width: 900px;
}

/* --- C. VISUALIZER INTRO (HEADLINE & SUBHEADLINE) --- */
/* The intro is positioned absolutely, RELATIVE TO THE CONSOLE'S WRAPPER. */
.visualizer-intro {
    /* 1. Take it out of the layout flow. */
    position: absolute;
    
    /* 2. Place its BOTTOM edge at the TOP edge of the console wrapper. */
    bottom: 100%;
    
    /* 3. Horizontally center it. */
    left: 50%;
    transform: translateX(-50%);
    
    /* 4. Define its width and create the visual gap using padding. */
    width: 100%;
    text-align: center;
    /* This padding creates the space between the header text and the console. */
    /* THIS IS THE "KNOB" TO ADJUST THE GAP. */
    padding-bottom: 3rem; 
    box-sizing: border-box;
}
/* --- D. VISUALIZER CONTAINER & CONSOLE --- */
/* No special positioning needed, it's handled by the wrapper */
.synthesis-visualizer-container, #synthesis-console {
    width: 100%;
    position: relative;
}


#synthesis-console {
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.03) 100%), rgba(11, 19, 43, 0.9);
    border: 2px solid var(--kinetic-teal);
    box-shadow: 0 0 40px rgba(0, 245, 212, 0.5), inset 0 0 40px rgba(0, 245, 212, 0.5);
    backdrop-filter: blur(20px) saturate(1.8);
    animation: pulse-border 1.4s ease-in-out infinite;
}

/* 
  THE "PERFECT SHAPE" RULE:
  This restores the original fixed height of the console's content area,
  guaranteeing the aspect ratio you liked.
*/
.console-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 580px; 
}

/* --- C. CONSOLE HEADER & PROGRESS BAR --- */
.console-header {
    position: relative;
    background: transparent;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 20px 20px 0 0;
    z-index: 10;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(0, 245, 212, 0.1);
}
.console-title {
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--kinetic-teal);
    letter-spacing: 2px;
    font-weight: 700;
}
@keyframes light-blink { 0%, 100% { opacity: 0.7; } 50% { opacity: 1; } }
.console-lights span { position: relative; display: inline-block; width: 14px; height: 14px; border-radius: 50%; margin-left: 10px; border: 2px solid rgba(120, 120, 120, 0.2); box-sizing: border-box; transition: all 0.3s ease; }
.console-lights span::after { content: ''; position: absolute; top: 1px; left: 2px; width: 5px; height: 5px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0) 70%); }
.console-lights span:nth-child(1) { background-color: #ff5f56; box-shadow: inset 1px 1px 2px rgba(255,255,255,0.2), inset -1px -1px 3px rgba(0,0,0,0.4), 0 0 10px #ff5f56; animation: light-blink 2s infinite 0s; }
.console-lights span:nth-child(2) { background-color: #ffbd2e; box-shadow: inset 1px 1px 2px rgba(255,255,255,0.2), inset -1px -1px 3px rgba(0,0,0,0.4), 0 0 10px #ffbd2e; animation: light-blink 2s infinite 0.2s; }
.console-lights span:nth-child(3) { background-color: #27c93f; box-shadow: inset 1px 1px 2px rgba(255,255,255,0.2), inset -1px -1px 3px rgba(0,0,0,0.4), 0 0 10px #27c93f; animation: light-blink 2s infinite 0.4s; }
.master-progress-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 4px;
    box-shadow: inset 0px 1px 2px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 245, 212, 0.1);
    overflow: hidden;
    padding: 0;
}
#master-progress-bar {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--kinetic-teal) 0%, var(--hyper-blue) 100%);
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: left;
}

/* --- D. VIEW CONTAINER & TRANSITIONS --- */
.console-output {
    position: relative;
    flex-grow: 1;
    min-height: 0;
    background-color: #0d172e;
    color: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 18px;
    font-family: 'Roboto Mono', monospace;
}
#swipe-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    transform: scaleX(0);
    transform-origin: left;
    z-index: 5;
    pointer-events: none;
    background-color: rgba(2, 4, 10, 0.7);
    backdrop-filter: blur(4px);
}
.swipe-edge { position: absolute; }
.output-view {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    opacity: 0;
    pointer-events: none;
    padding: 0;
    overflow: auto;
}

/* --- E. TEXT VIEW --- */
.text-view {
    opacity: 1;
    pointer-events: auto;
    padding: 40px;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9rem;
}
.text-view p {
    margin: 0 0 0.75em 0;
    font-family: inherit; /* Inherit from .text-view */
}
.is-typing {
    display: inline-block;
    width: 10px;
    height: 1.2em;
    background-color: var(--kinetic-teal);
    vertical-align: text-bottom;
    animation: blinkCursor .6s infinite;
    font-family: inherit;
}
@keyframes blinkCursor { 50% { opacity: 0; } }
.text-view .success-line {
    color: var(--kinetic-teal);
    font-weight: bold;
}

/* --- F. DATAVIZ VIEW --- */
#dataviz-view .dataviz-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem 1.5rem 0;
}
#dataviz-view .dataviz-panel {
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
#dataviz-view .bottom-panels-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
}
#dataviz-view .dataviz-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    color: var(--hyper-blue);
    margin: 0 0 0.8rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(77, 159, 255, 0.2);
    text-shadow: 0 0 8px var(--hyper-blue);
}
#dataviz-view .dataviz-grid { display: grid; gap: 0.75rem 1rem; }
#dataviz-view .focus-grid { grid-template-columns: 1fr; }
#dataviz-view .topics-grid { grid-template-columns: 1fr 1fr; }
#dataviz-view .chart-item { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px; }
#dataviz-view .chart-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.9);
}
#dataviz-view .chart-percent {
    font-family: 'Roboto Mono', monospace;
    font-weight: 700;
    color: white;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}
#dataviz-view .glass-bar-container {
    grid-column: 1 / 3 !important;
    margin-top: 4px !important;
    height: 18px !important;
    min-height: 18px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 6px !important;
    padding: 2px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    display: block !important;
}
#dataviz-view .glass-bar-fill {
    height: 100% !important;
    background: linear-gradient(90deg, var(--kinetic-teal) 0%, var(--hyper-blue) 100%);
    border-radius: 4px;
    box-shadow: 0 0 10px var(--hyper-blue), inset 0 0 3px rgba(255, 255, 255, 0.5);
    transform: scaleX(0);
    transform-origin: left;
}

/* --- G. NEURAL SYNTHESIS VIEW --- */
#neural-view { padding: 20px; }
#neural-view .loading-screen-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 50px;
    height: 100%;
    text-align: center;
}
#neural-view .computation-header {
    width: 100%;
    margin-bottom: 1rem;
    font-family: 'JetBrains Mono', monospace;
}
#neural-view #main-process {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--starlight);
    margin-bottom: 0.5rem;
    min-height: 1.2em;
}
#neural-view #sub-process {
    font-size: 0.9rem;
    color: var(--hyper-blue);
    min-height: 1.2em;
}
#neural-view .neural-nodes-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    height: 150px;
    width: 100%;
    margin: 1rem 0;
}
#neural-view .neural-node {
    height: 80px;
    width: auto;
    flex-shrink: 0;
}
#neural-view .completion-status {
    opacity: 0;
    margin-top: .5rem;
    padding: 10px 20px;
    background: rgba(0, 229, 91, 0.15);
    border: 1px solid rgba(0, 229, 91, 0.5);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 229, 91, 0.8);
}

/* --- H. ITINERARY VIEW (Consolidated & Refined) --- */
.itinerary-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 40px;
    box-sizing: border-box;
}
.itinerary-main-header {
    text-align: center;
    margin-bottom: 25px; /* Compacted margin */
    flex-shrink: 0;
}
.itinerary-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--hyper-blue);
    text-shadow: 0 0 15px var(--hyper-blue);
    margin: 0;
}
.itinerary-layout {
    display: flex;
    flex-grow: 1;
    gap: 20px; /* Compacted gap */
    min-height: 0;
}
.itinerary-list {
    flex: 0 0 38%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.list-item {
    padding: 10px 15px;
    border: 1px solid rgba(77, 159, 255, 0.2);
    border-radius: 8px;
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
    will-change: transform;
    cursor: pointer;
}
.list-item.active {
    background: rgba(0, 245, 212, 0.15);
    border-color: var(--kinetic-teal);
    box-shadow: 0 0 15px rgba(0, 245, 212, 0.4);
    transform: scale(1.02);
}
.list-item-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--starlight);
    margin: 0 0 4px;
}
.list-item-time {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.8rem;
    color: var(--system-color, var(--kinetic-teal)); /* Fallback color */
    margin: 0;
}
.itinerary-detail-pane {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}
.detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(77, 159, 255, 0.3);
    flex-shrink: 0;
}
.detail-content {
    padding-top: 15px;
    overflow-y: auto;
}
.detail-section h4 {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--hyper-blue);
    margin: 0 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.detail-section p {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem; /* Slightly smaller for consistency */
    line-height: 1.6;
    margin: 0 0 20px 0;
    opacity: 0.9;
    word-break: break-word;
}

/* --- I. RESPONSIVE --- */
@media (max-width: 768px) {

     .synthesis-visualizer-section {
        padding: 0 0px;
        box-sizing: border-box;
    }

    #dataviz-view .dataviz-body {
        padding: 1rem;
        gap: 1.5rem;
    }
    #dataviz-view .dataviz-panel {
        padding: 1rem;
    }
    #dataviz-view .bottom-panels-grid,
    #dataviz-view .topics-grid {
        grid-template-columns: 1fr;
    }
    .itinerary-layout {
        flex-direction: column;
    }
    .itinerary-list {
        flex: 0 0 auto; /* Allow list to size naturally */
    }
    /* 1. Reduce padding inside the text view */
    .text-view {
        padding: 20px; /* Was 40px */
    }

    /* 2. Make the text smaller and tighter */
    .text-view p {
        font-size: 0.8rem;   /* Was 0.9rem */
        margin-bottom: 0.5em; /* Was 0.75em */
    }

    /* 3. Adjust the typing cursor to match the new font size */
    .is-typing {
        height: 1.2em; /* This is relative to the new font-size, so it adjusts automatically */
    }
      .desktop-only {
        display: none;
    }

    /* --- A. General Console & Typography Adjustments --- */
    .console-header {
        padding: 12px 15px; /* Tighter header */
    }
    .console-title {
        font-size: 0.8rem; /* Smaller console title */
    }

    /* --- B. TEXT VIEW (Screen 1) FIX --- */
    .text-view {
        padding: 20px;
    }
    .text-view p {
        font-size: 0.8rem;
        margin-bottom: 0.5em;
    }
    .desktop-only {
        display: none;
    }
    
/* Find and REPLACE the entire mobile dataviz block with this one */

/* --- C. DATAVIZ VIEW (Screen 2) - COMPACT MOBILE LAYOUT --- */
#dataviz-view .dataviz-body {
    /* Set minimal padding around the entire view */
    padding: 1rem 1.25rem; 
}

#dataviz-view .dataviz-panel {
    padding: 0;
    background: none;
    border: none;
    /* Set a small, consistent margin between major sections */
    margin-bottom: 1rem; 
}
#dataviz-view .dataviz-panel:last-child {
    margin-bottom: 0;
}

#dataviz-view .dataviz-title {
    font-size: 0.8rem; /* Smaller title */
    text-align: left;
    /* Tighter spacing below the title */
    margin-bottom: 0.5rem; 
    padding-bottom: 0.4rem;
}

#dataviz-view .bottom-panels-grid {
    display: block; 
}

/* --- Single-Column Chart Items (Skill Level, Session Focus) --- */
#dataviz-view .chart-item:not(.topics-grid .chart-item) {
    display: flex; 
    align-items: center; 
    gap: 0.5rem; 
    /* Remove bottom margin; let parent control spacing */
    margin-bottom: 0.2rem; 
}
#dataviz-view .chart-item:not(.topics-grid .chart-item) .chart-label {
    flex: 0 1 40%; /* Give label a bit more space */
    font-size: 0.7rem; 
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#dataviz-view .chart-item:not(.topics-grid .chart-item) .glass-bar-container {
    flex: 1 1 auto; 
    height: 10px !important; 
    min-height: 10px !important;
}
#dataviz-view .chart-item:not(.topics-grid .chart-item) .chart-percent {
    flex: 0 0 35px; /* Tighter width */
    font-size: 0.7rem; 
    text-align: right;
}

/* --- Two-Column Chart Items (Topic Interest) --- */
#dataviz-view .topics-grid {
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    /* Minimal gap between items */
    gap: 0.2rem 1rem; 
}
#dataviz-view .topics-grid .chart-item {
    display: grid; 
    grid-template-areas: "label label" "bar score"; 
    grid-template-columns: 1fr auto;
    gap: 0.1rem 0.5rem; /* Minimal gap */
    align-items: center;
}
#dataviz-view .topics-grid .chart-item .chart-label {
    grid-area: label; 
    font-size: 0.7rem; 
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#dataviz-view .topics-grid .chart-item .glass-bar-container {
    grid-area: bar; 
    display: flex; 
    height: 8px !important; 
    min-height: 8px !important;
    max-width: 80%; /* <-- THIS IS THE FIX. Add this line back in. */
}

#dataviz-view .topics-grid .chart-item .chart-percent {
    grid-area: score; 
    font-size: 0.7rem; 
    text-align: right;
}
    /* --- D. ITINERARY VIEW (Screen 4) FIX --- */
    .itinerary-layout {
        flex-direction: column;
    }
    .itinerary-list {
        flex: 0 0 auto;
    }

    /* --- E. NEURAL SYNTHESIS VIEW (Screen 3) FIX --- */
    
    /* 1. Stabilize the header to prevent layout shift from text typing */
    #neural-view .computation-header {
        height: 100px; /* Give it a fixed height to contain the longest text */
        display: flex;
        flex-direction: column;
        justify-content: center; /* Vertically center the text for a cleaner look */
    }

    /* 2. Make the text smaller for mobile */
    #neural-view #main-process {
        font-size: 1.1rem; 
    }
    
    #neural-view #sub-process {
        font-size: 0.8rem;
    }

    /* 3. Make the "loading bar" (neural nodes) much smaller to fit the screen */
    #neural-view .neural-nodes-container {
        gap: 3px; /* Further reduce the gap between nodes */
        margin-top: 0;
    }

    #neural-view .neural-node {
        height: 40px; /* Make each node significantly smaller */
    }

    /* 4. Make the completion status box less wide and taller on mobile */
    #neural-view .completion-status {
        padding: 10px 15px;      /* Slightly adjust padding for the new shape */
        font-size: 0.8rem;         /* Keep the smaller font size */
        margin-top: 1rem;          /* Keep the margin */
        max-width: 80%;            /* KEY CHANGE: Make it narrower */
        text-align: center;        /* KEY CHANGE: Center the wrapped text */
        box-sizing: border-box;    /* Good practice with padding/width */
    }

/* --- D. ITINERARY VIEW (Screen 4) - FINAL MOBILE FIX (ONE PARAGRAPH) --- */
    .itinerary-view {
        padding: 20px;
    }
    .itinerary-title {
        font-size: 1.2rem;
        margin-bottom: 10px;
    }
    .itinerary-layout {
        flex-direction: column;
    }

    /* Keep the horizontal control panel */
    .itinerary-list {
        flex: 0 0 auto;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        margin-bottom: 10px;
    }
    .list-item {
        flex-grow: 1;
        text-align: center;
        padding: 8px 10px;
    }
    .list-item-title {
        font-size: 0.75rem;
        margin: 0;
    }
    .list-item-time {
        display: none;
    }

    /* Let the detail pane grow naturally */
    .itinerary-detail-pane {
        overflow: visible;
        border-top: 1px solid rgba(77, 159, 255, 0.2);
        padding-top: 15px;
    }
    
    .detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        padding-bottom: 12px;
    }

    /* ▼▼▼ KEY CSS FIXES ARE HERE ▼▼▼ */

    /* 1. HIDE the "Content" header */
    .detail-section h4 {
        display: none;
    }
    
    /* 2. HIDE THE ENTIRE "Breakout Rooms" section (header and paragraph) */
    .detail-section:last-of-type {
        display: none;
    }

    /* 3. Style the single remaining paragraph to have no extra margin */
    .detail-section p {
        font-size: 0.85rem;
        line-height: 1.5;
        margin: 0; /* Remove all margins */
    }

    
}