* {
    box-sizing: border-box;
}

:root {
    --bg-color: #0d0d0d;
    --card-bg: rgba(255, 255, 255, 0.05);
    --text-color: #ffffff;
    --accent-green: #76b900;
    --accent-blue: #0071c5;
    --accent-purple: #a020f0;
    --phase-1-color: #76b900;
    --phase-2-color: #a020f0;
    --font-main: 'Inter', sans-serif;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow: hidden;
    /* Prevent scrolling */
    height: 100vh;
    width: 100vw;
}

/* TIMELINE NAVIGATION */
#timeline-container {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    width: 95%;
    max-width: 1600px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-line {
    position: absolute;
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.2);
    z-index: 1;
}

.timeline-nodes {
    display: flex;
    justify-content: space-between;
    width: 100%;
    position: relative;
    z-index: 2;
}

.t-node {
    width: 16px;
    height: 16px;
    background: #444;
    border: 2px solid #888;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    z-index: 10;
}

.t-node:hover {
    transform: scale(1.1) translateY(-5px);
    border-color: var(--accent-green);
    background: #333;
}

.t-node.active {
    background: var(--accent-green);
    border-color: #fff;
    color: #000;
    transform: scale(1.2);
    box-shadow: 0 0 15px var(--accent-green);
}

/* Result State (High Contrast) */
.t-node.has-result {
    border-color: #fff;
    background: var(--accent-blue);
    /* Solid Blue */
    color: #fff;
    /* White Text */
    box-shadow: 0 0 10px var(--accent-blue);
}

.t-node.active.has-result {
    /* If active AND result, default to Green/Black as it indicates 'current' */
    background: var(--accent-green);
    color: #000;
    border-color: #fff;
    box-shadow: 0 0 15px var(--accent-green);
}

.t-node.visited {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

/* Updated SLIDE DECK Transitions */
#slide-deck {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    /* Default Hidden State: Off-screen Right (for forward nav assumption) */
    transform: translateX(100%) scale(0.9);
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.6s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #1a1a1a 0%, #000000 100%);
    overflow: hidden;
    /* FORCE NO SCROLL */
    pointer-events: none;
    visibility: hidden;
}

/* ACTIVE State */
.slide.active-slide {
    opacity: 1;
    transform: translateX(0) scale(1);
    pointer-events: all;
    visibility: visible;
    z-index: 10;
}

/* EXIT States (applied to the slide leaving) */
.slide.exit-left {
    transform: translateX(-100%) scale(0.9);
    opacity: 0;
}

.slide.exit-right {
    transform: translateX(100%) scale(0.9);
    opacity: 0;
}

/* INITIAL POSITIONS for incoming slides (helper classes) */
.slide.start-right {
    transform: translateX(100%) scale(0.9);
}

.slide.start-left {
    transform: translateX(-100%) scale(0.9);
}

/* LAYOUT & TYPOGRAPHY RESTORATION (SUPERSIZED) */
.slide-content {
    max-width: 1600px;
    width: 95%;
    height: 100%;
    padding: 2rem;
    padding-bottom: 100px;
    /* Space for timeline */
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    /* Allow scroll if content is tall */
    scrollbar-width: thin;
    scrollbar-color: var(--accent-green) #222;
}

.center-content {
    text-align: center;
    justify-content: center;
    height: 100%;
}

h1 {
    font-size: 3.5rem;
    /* Drastic reduction from 5rem */
    background: linear-gradient(90deg, #fff, #aaa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
    line-height: 1.1;
    text-align: center;
}

h2 {
    font-size: 3rem;
    /* Reduced from 4rem */
    margin-bottom: 1rem;
    color: #fff;
    text-align: center;
}

h3 {
    font-size: 2.2rem;
    /* Reduced from 2.8rem */
    margin-bottom: 1.5rem;
    color: var(--accent-green);
    border-bottom: 3px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
    display: inline-block;
}

p {
    font-size: 1.3rem;
    /* Reduced from 1.6rem */
    color: #ccc;
    max-width: 1200px;
    line-height: 1.4;
    margin-bottom: 1rem;
    text-align: center;
}

ul {
    font-size: 1.5rem;
    line-height: 1.8;
}

/* COMPONENTS */
.tags span {
    background: var(--card-bg);
    padding: 0.8rem 1.5rem;
    border-radius: 30px;
    border: 1px solid var(--accent-blue);
    margin: 0 0.5rem;
    font-size: 1.2rem;
    display: inline-block;
}

.grid {
    display: grid;
    gap: 2rem;
    justify-content: center;
    width: 100%;
}

.two-col {
    grid-template-columns: 1fr 1fr;
    max-width: 1400px;
}

.three-col {
    grid-template-columns: 1fr 1fr 1fr;
    max-width: 1600px;
}

/* CANVAS OVERLAY */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    /* Top of everything */
    pointer-events: none;
    /* Let clicks pass through */
}

.card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-green);
}

.card h4 {
    margin: 0 0 1rem 0;
    font-size: 1.5rem;
    color: #fff;
}

/* PLAYGROUND STYLES */
.playground-box {
    background: rgba(0, 0, 0, 0.3);
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    margin-top: 1rem;
}

.bit-container {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.bit {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.bit.up {
    background: var(--accent-green);
    color: #000;
    box-shadow: 0 0 15px rgba(118, 185, 0, 0.4);
}

.bit.down {
    background: var(--accent-purple);
    color: #fff;
    box-shadow: 0 0 15px rgba(160, 32, 240, 0.4);
}

.bit:hover {
    transform: scale(1);
    opacity: 1;
}

/* --- GQE Pipeline (Reset) --- */
.pipeline-container {
    width: 100%;
}

.flow-node.visual-box {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    background: #111;
    transition: transform 0.3s ease;
}

.flow-node.visual-box:hover {
    transform: scale(1.02);
    border-color: #fff;
}

.flow-node.visual-box-small {
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.diamond-container {
    margin: 1rem 0;
}

.loop-container {
    background: rgba(255, 255, 255, 0.02);
}

/* Ensure sampling output fits */
#sampling-output .circuit-sample-item {
    height: 40px;
    min-width: 60px;
    font-size: 0.6rem;
    padding: 0.2rem;
}

.op-tile {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--accent-purple);
    border-radius: 4px;
    padding: 2px;
    font-size: 0.7rem;
    text-align: center;
    color: #fff;
    font-family: monospace;
}

.controls .btn {
    background: transparent;
    border: 1px solid #fff;
    color: #fff;
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    margin: 0 0.5rem;
    transition: all 0.3s;
}

.controls .btn:hover {
    background: #fff;
    color: #000;
}

.energy-meter {
    font-size: 1.5rem;
    margin-top: 1.5rem;
}

#energy-value {
    color: var(--accent-green);
    font-weight: bold;
}

/* WORKFLOW */
.workflow-chart {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.flow-step {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem 2rem;
    border-radius: 8px;
    border: 1px solid var(--accent-blue);
    font-weight: bold;
}

.flow-arrow {
    font-size: 1.5rem;
    color: #666;
    text-align: center;
    width: 100%;
    margin: 0.2rem 0;
}

/* ROLES GRID */
.role-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.role-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.role-card h4 {
    margin: 0 0 0.5rem 0;
    color: var(--accent-blue);
    font-size: 1rem;
}

.role-card p {
    font-size: 0.8rem;
    margin: 0;
}

/* MTS Section Styles */
.mts-container {
    background: rgba(0, 0, 0, 0.5);
    padding: 1.5rem;
    /* Reduced from 2rem */
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 1200px;
    margin: 1rem auto;
    /* Reduced from 2rem */
}

.config-panel.card {
    background: rgba(255, 255, 255, 0.05);
    padding: 1.5rem;
}

.input-row {
    display: flex;
    gap: 1.5rem;
    justify-content: space-between;
}

.input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.input-group label {
    font-size: 0.8rem;
    color: #aaa;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.input-group input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--accent-green);
    padding: 0.8rem;
    border-radius: 6px;
    font-family: var(--font-main);
    font-size: 1.1rem;
    text-align: center;
    transition: border-color 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent-green);
}

.input-group input::-webkit-outer-spin-button,
.input-group input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.accent-btn {
    background: var(--accent-green);
    color: #000;
    border: none;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.accent-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(118, 185, 0, 0.4);
}

.accent-btn:active {
    transform: translateY(0);
}

.blink {
    animation: blinker 1.5s linear infinite;
    color: var(--accent-green);
    font-weight: bold;
}

@keyframes blinker {
    50% {
        opacity: 0;
    }
}

.metric-box {
    text-align: center;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-radius: 8px;
}

.metric-box .label {
    display: block;
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.seq-bit-small {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: bold;
    border: 1px solid rgba(0, 0, 0, 0.2);
    margin: 2px;
}

.seq-bit-small.pos {
    background: var(--accent-green);
    color: black;
}

.seq-bit-small.neg {
    background: var(--accent-purple);
    color: white;
}

/* Last slide (Member Learning) — scaled down for fit */
#slide-16 .slide-16-scaled {
    transform: scale(0.88);
    transform-origin: center center;
}

/* PRD GRID (Slide 9) */
.prd-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.5rem;
    width: 100%;
    margin-top: 1rem;
    max-width: 1400px;
}

/* --- Phase 2: Storytelling Styles --- */
.story-card {
    background: rgba(255, 255, 255, 0.05);
    border-left: 4px solid var(--phase-2-color);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    text-align: left;
}

.story-card h3 {
    margin-top: 0;
    color: white;
}

.highlight-text {
    font-size: 1.2rem;
    color: var(--accent-orange);
    font-style: italic;
    margin-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 0.5rem;
}

.equation-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #444;
    padding: 1.5rem;
    border-radius: 12px;
    font-family: 'Courier New', monospace;
    margin: 2rem 0;
    text-align: center;
}

.equation-box code {
    display: block;
    font-size: 1.4rem;
    color: var(--accent-green);
    margin: 1rem 0;
}

.circle-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.5rem;
    margin: 0 auto 0.5rem auto;
    border: 2px solid #555;
}

/* Tiling Visual */
.tiling-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    margin: 2rem 0;
}

.tile-block {
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.3);
    padding: 1rem;
    border-radius: 8px;
}

.tile-block.small {
    border-color: var(--phase-1-color);
}

.tile-block.large {
    border-color: var(--phase-2-color);
    background: rgba(0, 255, 136, 0.05);
}

.pattern {
    background: #222;
    padding: 0.5rem;
    margin: 0.25rem 0;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--accent-green);
    border-left: 3px solid var(--accent-green);
}

.pattern-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.25rem;
}

.workflow-chart.vertical {
    flex-direction: column;
}

.flow-step.final {
    background: var(--accent-green);
    color: #000;
    border: none;
    font-weight: bold;
}

.prd-card {
    background: rgba(40, 40, 40, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: left;
}

.prd-card h4 {
    color: var(--accent-blue);
    font-size: 1.4rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
}

.prd-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.prd-list li {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    line-height: 1.4;
    color: #eee;
}

.prd-list li strong {
    color: #fff;
    display: block;
    margin-bottom: 0.2rem;
}

.prd-list .sub-text {
    font-size: 0.9rem;
    color: #aaa;
    display: block;
    margin-top: 0.1rem;
}

.prd-list ul {
    margin-top: 0.5rem;
    padding-left: 1.2rem;
    list-style: disc;
}

.prd-list ul li {
    margin-bottom: 0.3rem;
    font-size: 0.95rem;
}

/* --- Simple Shape Flowchart (Slide 7) --- */
.simple-chart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 1rem 0;
}

.simple-node {
    background: #222;
    /* Box background */
    border: 1px solid #555;
    /* Distinct border */
    color: #eee;
    padding: 1rem 1.5rem;
    text-align: center;
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
    width: 260px;
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    /* Shadow for depth */
    z-index: 2;
    position: relative;
    font-weight: 600;
}

.simple-node.success {
    background: var(--accent-green);
    color: #000;
    border-color: #588e00;
    box-shadow: 0 0 15px rgba(118, 185, 0, 0.4);
}

.simple-arrow {
    color: #888;
    font-size: 1.4rem;
    margin: 5px 0;
    text-shadow: 0 2px 4px #000;
}

.simple-diamond-wrapper {
    width: 140px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1.5rem 0;
}

.simple-diamond {
    width: 110px;
    height: 110px;
    background: #222;
    border: 2px solid #555;
    transform: rotate(45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    z-index: 2;
}

.diamond-content {
    transform: rotate(-45deg);
    text-align: center;
    font-size: 0.85rem;
    font-weight: bold;
    line-height: 1.2;
    color: #fff;
    width: 150px;
}

.path-label {
    background: #444;
    color: #fff;
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 4px;
    margin-bottom: 5px;
    border: 1px solid #666;
}

/* --- NEW GQE CHART STYLES (Restored) --- */
.gqe-chart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 85%;
    /* Optimized for fit */
    margin-top: 0;
    transform: scale(1.15);
    /* Optimized scale */
    transform-origin: center center;
    overflow: visible;
}

.equation-note {
    position: absolute;
    top: 4rem;
    /* Down from 2rem */
    right: 10rem;
    /* Left from 3rem */
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #444;
    border-radius: 8px;
    padding: 1.5rem;
    /* More padding */
    width: 450px;
    /* Massive size */
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
}

.gqe-row {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.gqe-row.main {
    gap: 0.5rem;
}

.gqe-row.loop {
    margin-top: 0.8rem;
    justify-content: flex-end;
    /* Align right */
    padding-right: 80px;
    /* Align specifically under Engine/Diamond */
}

/* Nodes */
.gqe-node {
    background: #222;
    border: 1px solid #555;
    color: #eee;
    padding: 0.8rem 0.5rem;
    width: 130px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    position: relative;
    z-index: 2;
}

.gqe-node.success {
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.gqe-node.small {
    width: 110px;
    height: 60px;
    font-size: 0.75rem;
    background: #1a1a1a;
    border: 1px solid #444;
}

/* Diamond */
.gqe-diamond {
    width: 90px;
    height: 90px;
    background: #222;
    border: 1px solid var(--accent-purple);
    transform: rotate(45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    z-index: 2;
}

.gqe-diamond span {
    transform: rotate(-45deg);
    font-size: 0.7rem;
    text-align: center;
    width: 100px;
    color: #eee;
}

/* Arrows */
.gqe-arrow {
    font-size: 1.5rem;
    color: #666;
    margin: 0 2px;
}

.engine-node-large {
    width: 180px !important;
    height: 140px !important;
    /* Reduced scale */
    font-size: 1rem !important;
    font-weight: bold;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    /* Title at top */
    padding-top: 2px !important;
    /* Even higher */
    background: #111 !important;
    box-shadow: 0 0 15px rgba(0, 100, 255, 0.3) !important;
}

.engine-node-large>div:first-child {
    margin-top: -2px;
}

/* Loop Specifics */
.loop-group {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    /* Subtle guide background */
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

.loop-label {
    font-size: 0.75rem;
    color: #aaa;
    margin-right: 0.5rem;
}

.loop-down,
.loop-up {
    color: var(--accent-purple);
    font-weight: bold;
    font-size: 1.2rem;
}