/* =========================================================
   NUCLEAR REACTOR PAGE
   ========================================================= */

.reactor-page {
    --reactor-orange: #ff8a2a;
    --reactor-orange-bright: #ffb14a;
    --reactor-blue: #27b8ff;

    --reactor-panel: rgba(13, 17, 20, 0.82);
    --reactor-border: rgba(255, 168, 84, 0.16);
    --reactor-muted: rgba(255, 255, 255, 0.62);
}


.reactor-eyebrow {
    margin-bottom: 10px;

    color: var(--reactor-orange-bright);

    font-size: 0.8rem;
    font-weight: 800;

    letter-spacing: 0.16em;
}

.reactor-hero p {
    max-width: 650px;

    margin: 0;

    color: var(--reactor-muted);

    font-size: clamp(1rem, 1.5vw, 1.18rem);

    line-height: 1.7;
}


/* =========================================================
   ENERGY FLOW
   ========================================================= */

.reactor-hero-energy {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 12px;

    width: 100%;
    max-width: 680px;

    justify-self: end;

    padding:
        18px
        22px;

    box-sizing: border-box;

    border:
        1px solid
        var(--reactor-border);

    border-radius: 18px;

    background: rgba(255,255,255,0.025);
}


.energy-flow-item {
    display: flex;
    align-items: center;
    gap: 10px;
}


.energy-flow-item div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}


.energy-flow-item strong {
    color: #fff;
    font-size: 0.86rem;
}


.energy-flow-item span {
    color: rgba(255,255,255,0.5);

    font-size: 0.7rem;
}


.energy-icon {
    display: grid;

    width: 38px;
    height: 38px;

    place-items: center;

    border-radius: 50%;

    background: rgba(255, 137, 42, 0.1);

    color: var(--reactor-orange-bright);

    font-size: 1.15rem;
}

.energy-arrow {
    color:rgba(255,255,255,0.28);
}

/* =========================================================
   SECTION HEADER
   ========================================================= */

.reactor-section-header {
    display: flex;

    align-items: flex-end;
    justify-content: space-between;

    gap: 24px;

    margin-bottom: 26px;
}


.reactor-section-header h2 {
    margin: 0 0 8px;

    color: #fff;

    font-size:
        clamp(2rem, 4vw, 3.5rem);

    letter-spacing: -0.04em;
}


.reactor-section-header p {
    margin: 0;

    color:
        var(--reactor-muted);

    line-height: 1.6;
}


.reactor-status-pill {
    padding: 9px 14px;

    border:
        1px solid
        rgba(255, 165, 80, 0.18);

    border-radius: 999px;

    background:rgba(255, 137, 42, 0.08);

    color:#ffc47e;

    font-size: 0.78rem;
}



/* =========================================================
   EXPLORER
   ========================================================= */

.reactor-explorer-section {
    margin-bottom: 90px;
}

/* =========================================================
   DIAGRAM CARD
   ========================================================= */

.reactor-diagram-card {
    position: relative;

    overflow: hidden;

    border:
        1px solid
        var(--reactor-border);

    border-radius: 28px;

    background:

        radial-gradient(
            circle at 50% 60%,
            rgba(255, 112, 18, 0.1),
            transparent 40%
        ),

        radial-gradient(
            circle at 50% 20%,
            rgba(28, 128, 186, 0.12),
            transparent 45%
        ),

        linear-gradient(
            150deg,
            #11171c,
            #080b0d 70%
        );
}


.reactor-diagram-card::before {
    content: "";

    position: absolute;

    inset: 0;

    pointer-events: none;

    background-image:

        linear-gradient(
            rgba(255,255,255,0.018) 1px,
            transparent 1px
        ),

        linear-gradient(
            90deg,
            rgba(255,255,255,0.018) 1px,
            transparent 1px
        );

    background-size: 42px 42px;

    mask-image:
        linear-gradient(
            to bottom,
            black,
            transparent 90%
        );
}


.reactor-diagram-top {
    position: absolute;

    z-index: 5;

    top: 18px;
    left: 20px;
    right: 20px;

    display: flex;

    justify-content: space-between;

    pointer-events: none;
}


.reactor-diagram-label {
    color:rgba(255,255,255,0.55);

    font-size: 0.76rem;

    letter-spacing: 0.1em;

    text-transform: uppercase;
}


.reactor-diagram-hint {
    color:rgba(255,255,255,0.35);

    font-size: 0.75rem;
}



/* =========================================================
   SVG
   ========================================================= */

.reactor-svg-wrapper {
    position: absolute;

    display: grid;

    place-items: center;
}


.reactor-svg {
    width: 100%;

    max-width: 900px;

    height: auto;

    overflow: visible;
}


.reactor-part {
    cursor: pointer;

    transition:
        opacity 0.2s ease,
        filter 0.2s ease,
        transform 0.2s ease;
}


.reactor-part:hover {
    filter: brightness(1.18);

    transform: translateY(-2px);
}


.coolant-flow-arrows {
    fill: none;

    stroke:
        rgba(220, 248, 255, 0.75);

    stroke-width: 4;

    stroke-linecap: round;

    stroke-linejoin: round;
}

/* =========================================================
   COOLANT PIPE INTERACTION
   ========================================================= */
.pipe-part {
    cursor: pointer;
}

/* =========================================================
   COOLANT TEMPERATURE COLOURS
   ========================================================= */

.reactor-pipe-system {
    --coolant-hot: #ff792c;
    --coolant-hot-bright: #ffb15c;

    --coolant-cold: #159bd5;
    --coolant-cold-bright: #65dfff;
}

/* Animated coolant segments */

.pipe-flow {
    fill: none;

    stroke-dasharray: 18 14;
    stroke-linecap: round;

    transition:
        stroke 0.4s ease,
        opacity 0.2s ease,
        stroke-width 0.2s ease;
}

/* Hot coolant leaving reactor */

.pipe-hot .pipe-flow-hot {
    stroke: var(--coolant-hot-bright);
}

.pipe-hot {
    color: var(--coolant-hot);
}

/* Cool coolant returning to reactor */

.pipe-return .pipe-flow-return {
    stroke: var(--coolant-cold-bright);
}

.pipe-return {
    color: var(--coolant-cold);
}

/* Hot pipe glow */

.pipe-hot:hover {
    filter:
        drop-shadow(
            0 0 9px
            rgba(255, 112, 35, 0.55)
        );
}

/* Cold pipe glow */

.pipe-return:hover {
    filter:
        drop-shadow(
            0 0 9px
            rgba(39, 184, 255, 0.45)
        );
}


/* HOT: reactor → right */

.pipe-hot:hover .pipe-flow-hot {
    opacity: 1;
    stroke-width: 8px;

    animation:
        coolantFlowHot
        0.9s
        linear
        infinite;
}


/* RETURN: right → reactor */

.pipe-return:hover .pipe-flow-return {
    opacity: 1;
    stroke-width: 8px;

    animation:
        coolantFlowReturn
        0.9s
        linear
        infinite;
}


@keyframes coolantFlowHot {
    from {
        stroke-dashoffset: 0;
    }

    to {
        stroke-dashoffset: -32;
    }
}

@keyframes coolantFlowReturn {
    from {
        stroke-dashoffset: 32;
    }

    to {
        stroke-dashoffset: 0;
    }
}

/* =========================================================
   REACTOR SCHEMATIC DETAILS
   ========================================================= */

.control-part rect:not(:first-child) {
    filter:
        drop-shadow(
            0 0 4px
            rgba(89, 211, 255, 0.4)
        );
}


.moderator-part {
    filter:
        drop-shadow(
            0 8px 12px
            rgba(0, 0, 0, 0.35)
        );
}


.fuel-part rect {
    filter:
        drop-shadow(
            0 0 5px
            rgba(255, 142, 36, 0.75)
        );
}

.reactor-pump {
    pointer-events: none;
}


.reactor-pump circle {
    filter:
        drop-shadow(
            0 0 7px
            rgba(191, 239, 68, 0.35)
        );
}

/* =========================================================
   FLOATING LABELS
   ========================================================= */

.reactor-floating-label {
    position: absolute;

    z-index: 6;

    display: flex;

    flex-direction: column;

    gap: 3px;

    min-width: 125px;

    padding: 10px 13px;

    border:
        1px solid
        rgba(255,255,255,0.08);

    border-radius: 12px;

    background:rgba(11, 15, 18, 0.82);

    backdrop-filter: blur(14px);

    box-shadow:
        0 12px 35px
        rgba(0,0,0,0.25);
}


.reactor-floating-label strong {
    color: #fff;

    font-size: 0.76rem;
}


.reactor-floating-label span {
    color:rgba(255,255,255,0.48);

    font-size: 0.66rem;
}


/* =========================================================
   REACTOR LABEL POSITIONS
   ========================================================= */

/* Control rods */
.label-control {
    top: 15%;
    left: 46%;
}


/* Uranium rods */
.label-fuel {
    left: 17%;
    top: 50%;
}


/* Reactor vessel */
.label-vessel {
    left: 18%;
    bottom: 30%;
}


/* Coolant */
.label-coolant {
    right: 8%;
    top: 39%;
}


/* Graphite moderator */
.label-moderator {
    right: 15%;
    bottom: 35%;
}


/* Containment */
.label-containment {
    left: 7%;
    bottom: 10%;
}



/* =========================================================
   COMPONENT PANEL
   ========================================================= */

.reactor-component-panel {
    padding: 24px;

    border:
        1px solid
        var(--reactor-border);

    border-radius: 28px;

    background:
        linear-gradient(
            160deg,
            rgba(30, 25, 21, 0.96),
            rgba(10, 12, 14, 0.96)
        );
}


.reactor-panel-heading {
    margin-bottom: 22px;
}


.reactor-panel-heading > span {
    color: var(--reactor-orange-bright);

    font-size: 0.7rem;
    font-weight: 800;

    letter-spacing: 0.15em;
}


.reactor-panel-heading h3 {
    margin:
        6px
        0
        8px;

    color: #fff;

    font-size: 1.8rem;
}


.reactor-panel-heading p {
    margin: 0;

    color: var(--reactor-muted);

    font-size: 0.88rem;

    line-height: 1.5;
}



/* =========================================================
   COMPONENT BUTTONS
   ========================================================= */

.reactor-component-list {
    display: flex;

    flex-direction: column;

    gap: 9px;
}


.reactor-component-button {
    display: grid;

    grid-template-columns:
        38px
        1fr
        25px;

    align-items: center;

    gap: 12px;

    width: 100%;

    min-height: 72px;

    padding: 10px 13px;

    border:
        1px solid
        rgba(255,255,255,0.055);

    border-radius: 14px;

    background:
        rgba(255,255,255,0.026);

    text-align: left;

    cursor: pointer;

    transition:
        transform 0.18s ease,
        border-color 0.18s ease,
        background 0.18s ease;
}


.reactor-component-button:hover {
    transform: translateX(4px);

    border-color:rgba(255, 150, 65, 0.22);

    background:rgba(255, 137, 42, 0.055);
}


.reactor-component-button.active {
    border-color:rgba(255, 146, 57, 0.38);

    background:
        linear-gradient(
            90deg,
            rgba(255, 137, 42, 0.14),
            rgba(255,255,255,0.025)
        );
}


.component-number {
    display: grid;

    width: 36px;
    height: 36px;

    place-items: center;

    border-radius: 50%;

    background:rgba(255,255,255,0.045);

    color:rgba(255,255,255,0.4);

    font-size: 0.68rem;

    font-weight: 800;
}


.reactor-component-button.active
.component-number {
    background:rgba(255, 135, 40, 0.15);

    color:#ffc078;
}


.component-text {
    display: flex;

    flex-direction: column;

    gap: 4px;
}


.component-text strong {
    color:rgba(255,255,255,0.92);

    font-size: 0.92rem;
}


.component-text small {
    color:rgba(255,255,255,0.42);

    font-size: 0.69rem;
}


.component-arrow {
    color:rgba(255,255,255,0.36);

    font-size: 1.6rem;
}



/* =========================================================
   PROCESS SECTION
   ========================================================= */

.reactor-process-section {
    margin-top: 80px;
}


.reactor-process-flow {
    display: grid;

    grid-template-columns:
        1fr
        auto
        1fr
        auto
        1fr
        auto
        1fr;

    align-items: center;

    gap: 16px;
}


.reactor-process-card {
    position: relative;

    min-height: 285px;

    padding: 22px;

    overflow: hidden;

    border:
        1px solid
        var(--reactor-border);

    border-radius: 22px;

    background:
        rgba(255,255,255,0.025);
}


.process-number {
    color:
        rgba(255,255,255,0.3);

    font-size: 0.72rem;

    font-weight: 800;
}


.reactor-process-card h3 {
    margin:
        20px
        0
        7px;

    color: #fff;

    font-size: 1.25rem;
}


.reactor-process-card p {
    margin: 0;

    color:
        var(--reactor-muted);

    font-size: 0.84rem;

    line-height: 1.5;
}


.process-connector {
    color:rgba(255,255,255,0.22);

    font-size: 1.7rem;
}



/* =========================================================
   PROCESS GRAPHICS
   ========================================================= */

.process-graphic {
    position: relative;

    display: grid;

    width: 120px;
    height: 120px;

    margin:
        25px
        auto
        10px;

    place-items: center;
}



/* FISSION */

.mini-nucleus {
    display: grid;

    width: 74px;
    height: 74px;

    place-items: center;

    border-radius: 50%;

    background:
        radial-gradient(
            circle at 35% 30%,
            #ffcf62,
            #ff7b1d 65%,
            #932d05
        );

    color: #fff;

    font-weight: 800;

    box-shadow:
        0 0 35px
        rgba(255, 118, 26, 0.42);
}


.mini-neutron {
    position: absolute;

    top: 9px;
    left: 4px;

    width: 9px;
    height: 9px;

    border-radius: 50%;

    background: #fff;

    box-shadow:
        0 0 10px
        white;
}



/* HEAT */

.heat-graphic {
    display: flex;

    align-items: center;
    justify-content: center;

    gap: 10px;
}


.heat-line {
    width: 8px;
    height: 70px;

    border-radius: 999px;

    background:
        linear-gradient(
            to top,
            transparent,
            #ff7a20,
            #ffc35a
        );
}


.heat-line.h2 {
    height: 90px;
}

.heat-line.h3 {
    height: 58px;
}



/* TURBINE */

.turbine-graphic {
    animation:
        reactorTurbineSpin
        9s
        linear
        infinite;
}


.turbine-center {
    position: absolute;

    width: 27px;
    height: 27px;

    border-radius: 50%;

    background:#d5e1e7;
}


.turbine-blade {
    position: absolute;

    width: 58px;
    height: 17px;

    border-radius:
        80% 20% 80% 20%;

    background:
        linear-gradient(
            90deg,
            #5e707b,
            #d7e5ec
        );

    transform-origin: 8px 50%;
}


.blade-a {
    transform:
        translateX(25px)
        rotate(0deg);
}


.blade-b {
    transform:
        translateX(25px)
        rotate(90deg);
}


.blade-c {
    transform:
        translateX(25px)
        rotate(180deg);
}


.blade-d {
    transform:
        translateX(25px)
        rotate(270deg);
}


@keyframes reactorTurbineSpin {

    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }

}



/* ELECTRICITY */

.electricity-graphic {
    color:#ffd25a;

    font-size: 4.2rem;

    text-shadow:
        0 0 28px
        rgba(255, 206, 69, 0.6);
}

/* =========================================================
   REACTOR INTERACTION
   ========================================================= */

.reactor-clickable {
    cursor: pointer;

    transition:
        opacity 0.22s ease,
        transform 0.22s ease;
}


/* =========================================================
   COMPONENT SELECTION
   ========================================================= */

/*
 * When simply exploring the reactor,
 * unselected parts still fade.
 *
 * Do not make them almost invisible.
 */

.reactor-svg.has-reactor-selection:not(.simulation-active)
.reactor-part {
    opacity: 0.52;
}


/*
 * During the simulation, keep the whole reactor readable.
 * The selected component remains slightly emphasised,
 * but the remaining reactor does not disappear.
 */

.reactor-svg.has-reactor-selection.simulation-active
.reactor-part {
    opacity: 0.82;
}


/* Selected component */

.reactor-svg.has-reactor-selection
.reactor-part.reactor-selected {
    opacity: 1;
}

/* Keep selected pump visible */

.reactor-svg
.reactor-pump.reactor-selected {
    opacity: 1;
}


/* Slight response when hovering clickable parts */

.reactor-clickable:hover {
    opacity: 1 !important;
}


/* =========================================================
   SELECTED COMPONENT INFORMATION
   ========================================================= */

.reactor-component-info {
    margin-top: 20px;

    padding: 20px;

    border:
        1px solid
        rgba(255, 255, 255, 0.09);

    border-radius: 18px;

    background:
        linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.055),
            rgba(255, 132, 35, 0.035)
        );
}


.reactor-info-eyebrow {
    margin-bottom: 8px;

    color:#eeac60;

    font-size: 0.72rem;
    font-weight: 800;

    letter-spacing: 0.12em;
}


.reactor-component-info h4 {
    margin:
        0 0 10px;

    color: #ffffff;

    font-size: 1.2rem;
}


.reactor-component-info > p {
    margin:
        0 0 18px;

    color:rgba(255, 255, 255, 0.64);

    font-size: 0.9rem;

    line-height: 1.6;
}


.reactor-info-fact {
    display: flex;
    flex-direction: column;

    gap: 4px;

    padding-top: 14px;

    border-top:
        1px solid
        rgba(255, 255, 255, 0.08);
}


.reactor-info-fact span {
    color:rgba(255, 255, 255, 0.4);

    font-size: 0.7rem;

    text-transform: uppercase;

    letter-spacing: 0.08em;
}


.reactor-info-fact strong {
    color:#f5c078;

    font-size: 0.88rem;
}

/* =========================================================
   REACTOR SIMULATION
   ========================================================= */

.reactor-simulation-section {
    margin: 0;

    padding: 20px;

    border:
        1px solid
        var(--reactor-border);

    border-radius: 24px;

    background:
        linear-gradient(
            155deg,
            rgba(29, 24, 20, 0.96),
            rgba(9, 12, 14, 0.96)
        );
}

/* =========================================================
   REACTOR SIDE COLUMN
   ========================================================= */

.reactor-sim-controls {
    padding: 0;

    border: 0;

    border-radius: 0;

    background: none;
}

.reactor-simulation-section
.reactor-section-header h2 {
    margin-bottom: 6px;

    font-size: 1.65rem;
}


.reactor-simulation-section
.reactor-section-header p {
    font-size: 0.78rem;

    line-height: 1.5;
}


.reactor-simulation-section
.reactor-eyebrow {
    margin-bottom: 6px;

    font-size: 0.66rem;
}

.sim-control-heading {
    margin-bottom: 14px;
}

.sim-control-heading span {
    color: var(--reactor-orange-bright);

    font-size: 0.7rem;
    font-weight: 800;

    letter-spacing: 0.14em;
}


.sim-control-heading strong {
    color: #fff;

    font-size: 1.35rem;
}


.sim-control-block {
    padding:
        14px
        0;

    border-top:
        1px solid
        rgba(255,255,255,0.07);
}


.sim-control-row {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 15px;

    margin-bottom: 13px;
}


.sim-control-row label,
.sim-control-row > span {
    color:rgba(255,255,255,0.8);

    font-size: 0.88rem;
    font-weight: 700;
}


.sim-control-row output {
    color:#ffc078;

    font-size: 0.8rem;
    font-weight: 700;
}


.control-rod-slider {
    width: 100%;

    accent-color:
        var(--reactor-orange);

    cursor: pointer;
}


.sim-control-scale {
    display: flex;

    justify-content: space-between;

    margin-top: 7px;

    color:rgba(255,255,255,0.35);

    font-size: 0.68rem;
}


.sim-switch-row {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 20px;
}


.sim-switch-row > div {
    display: flex;
    flex-direction: column;

    gap: 5px;
}


.sim-switch-row strong {
    color: #fff;

    font-size: 0.9rem;
}


.sim-switch-row span {
    color:rgba(255,255,255,0.44);

    font-size: 0.72rem;
}


.sim-toggle-button {
    min-width: 76px;
    min-height: 42px;

    border:
        1px solid
        rgba(255,255,255,0.1);

    border-radius: 999px;

    background:rgba(255,255,255,0.05);

    color:rgba(255,255,255,0.55);

    font-weight: 800;

    cursor: pointer;

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease;
}


.sim-toggle-button.active {
    border-color:rgba(112, 218, 122, 0.45);

    background:rgba(75, 200, 94, 0.12);

    color:#92f19c;
}


.sim-speed-buttons {
    display: grid;

    grid-template-columns: repeat(3, 1fr);

    gap: 8px;
}


.sim-speed-buttons button {
    min-height: 42px;

    border:
        1px solid
        rgba(255,255,255,0.08);

    border-radius: 10px;

    background:rgba(255,255,255,0.035);

    color:rgba(255,255,255,0.55);

    cursor: pointer;
}


.sim-speed-buttons button.active {
    border-color:rgba(255, 154, 63, 0.42);

    background:rgba(255, 137, 42, 0.12);

    color:#ffc078;
}

.sim-primary-actions button {
    min-height: 48px;

    border-radius: 12px;

    font-weight: 800;

    cursor: pointer;

    transition:
        transform 0.16s ease,
        opacity 0.16s ease;
}


.sim-primary-actions button:hover {
    transform: translateY(-2px);
}


.sim-primary-actions button:disabled {
    opacity: 0.42;

    cursor: default;

    transform: none;
}


.reactor-start-button {
    border:
        1px solid
        rgba(105, 224, 120, 0.35);

    background:rgba(72, 189, 90, 0.13);

    color:#9af2a3;
}


.reactor-scram-button {
    border:
        1px solid
        rgba(255, 78, 78, 0.4);

    background:rgba(225, 53, 53, 0.12);

    color:#ff9292;
}


.reactor-reset-button {
    grid-column: 1 / -1;

    border:
        1px solid
        rgba(255,255,255,0.08);

    background:rgba(255,255,255,0.035);

    color:rgba(255,255,255,0.65);
}


/* =========================================================
   READOUTS
   ========================================================= */
.sim-readout {
    display: flex;
    flex-direction: column;

    justify-content: center;

    min-height: 150px;

    padding: 22px;

    border:
        1px solid
        var(--reactor-border);

    border-radius: 20px;

    background:
        linear-gradient(
            145deg,
            rgba(255,255,255,0.038),
            rgba(255, 126, 31, 0.025)
        );
}


.sim-readout > span {
    margin-bottom: 15px;

    color:rgba(255,255,255,0.42);

    font-size: 0.7rem;
    font-weight: 700;

    letter-spacing: 0.06em;

    text-transform: uppercase;
}


.sim-readout strong {
    color: #fff;

    font-size: clamp(1.5rem, 3vw, 2.2rem);

    line-height: 1;
}


.sim-readout small {
    margin-top: 9px;

    color:
        rgba(255,255,255,0.34);

    font-size: 0.68rem;
}


/* =========================================================
   WARNING
   ========================================================= */

.reactor-sim-warning {
    margin-bottom: 18px;

    padding:
        15px
        18px;

    border:
        1px solid
        rgba(255, 89, 67, 0.38);

    border-radius: 14px;

    background:rgba(205, 51, 36, 0.11);

    color:#ffaaa0;

    font-size: 0.86rem;

    line-height: 1.5;
}


.reactor-sim-warning[hidden] {
    display: none;
}


.simulation-state-pill.warning {
    border-color:rgba(255, 78, 78, 0.38);

    background:rgba(220, 49, 49, 0.12);

    color:#ff9898;
}


/* =========================================================
   LIVE REACTOR SVG
   ========================================================= */

#reactorCoreGlow,
#fuelRods {
    transition: opacity 0.25s ease;
}

/* =========================================================
   COOLANT BUBBLES
   ========================================================= */

.reactor-bubbles {
    pointer-events: none;
    visibility: hidden;

    --bubble-opacity: 0;
}

.reactor-bubbles.is-active {
    visibility: visible;
}

/* Individual bubbles */

.reactor-bubbles .bubble {
    fill: rgba(225, 250, 255, 0.05);

    stroke: rgba(225, 250, 255, 0.65);
    stroke-width: 1;

    opacity: 0;

    animation:
        reactorBubbleRise 4s linear infinite;

    animation-play-state: paused;
}

.reactor-bubbles.is-active .bubble {
    animation-play-state: running;
}

/* Different bubble speeds and timings */

.bubble-1  { animation-duration: 3.8s; animation-delay: -0.5s; }
.bubble-2  { animation-duration: 4.5s; animation-delay: -2.0s; }
.bubble-3  { animation-duration: 3.5s; animation-delay: -1.0s; }
.bubble-4  { animation-duration: 4.2s; animation-delay: -3.0s; }
.bubble-5  { animation-duration: 3.9s; animation-delay: -1.7s; }
.bubble-6  { animation-duration: 4.8s; animation-delay: -2.8s; }
.bubble-7  { animation-duration: 3.6s; animation-delay: -0.8s; }
.bubble-8  { animation-duration: 4.4s; animation-delay: -3.5s; }
.bubble-9  { animation-duration: 4.1s; animation-delay: -2.3s; }
.bubble-10 { animation-duration: 3.7s; animation-delay: -1.4s; }
.bubble-11 { animation-duration: 4.6s; animation-delay: -3.2s; }
.bubble-12 { animation-duration: 4.0s; animation-delay: -0.3s; }

/* Smooth upward movement */

@keyframes reactorBubbleRise {

    0% {
        transform: translate(0, 0);
        opacity: 0;
    }

    12% {
        opacity: var(--bubble-opacity);
    }

    40% {
        transform: translate(3px, -90px);
        opacity: var(--bubble-opacity);
    }

    70% {
        transform: translate(-3px, -175px);
        opacity: var(--bubble-opacity);
    }

    90% {
        transform: translate(2px, -225px);
        opacity: var(--bubble-opacity);
    }

    100% {
        transform: translate(0, -255px);
        opacity: 0;
    }
}

/* Coolant should animate while the pump is operating */

.reactor-pipe-system.simulation-flowing
.pipe-flow-hot {
    opacity: 1;

    animation:
        coolantFlowHot
        var(
            --coolant-flow-duration,
            0.9s
        )
        linear
        infinite;
}


.reactor-pipe-system.simulation-flowing
.pipe-flow-return {
    opacity: 1;

    animation:
        coolantFlowReturn
        var(
            --coolant-flow-duration,
            0.9s
        )
        linear
        infinite;
}


.reactor-pump.running circle {
    filter:
        drop-shadow(
            0 0 13px
            rgba(191, 239, 68, 0.75)
        );
}


/* =========================================================
   PROCESS STAGES
   ========================================================= */

.reactor-process-card {
    transition:
        border-color 0.25s ease,
        background 0.25s ease,
        opacity 0.25s ease;
}


.reactor-process-card
.process-graphic {
    opacity: 0.38;

    transition:
        opacity 0.25s ease,
        filter 0.25s ease;
}


.reactor-process-card.is-active {
    border-color:rgba(255, 151, 60, 0.4);

    background:rgba(255, 126, 31, 0.055);
}


.reactor-process-card.is-active
.process-graphic {
    opacity: 1;
}


.turbine-graphic {
    animation-play-state: paused;
}


.reactor-process-card.is-active
.turbine-graphic {
    animation-play-state: running;
}


/* =========================================================
   HERO ENERGY FLOW
   ========================================================= */

.reactor-hero-energy.simulation-linked
.energy-flow-item {
    opacity: 0.3;

    transition:
        opacity 0.3s ease,
        transform 0.3s ease;
}


.reactor-hero-energy.simulation-linked
.energy-flow-item.is-active {
    opacity: 1;

    transform: translateY(-2px);
}

/* =========================================================
   REACTOR LABEL VISIBILITY
   ========================================================= */

/*
 * Component labels should not appear by default.
 */

.reactor-floating-label {
    opacity: 0;
    visibility: hidden;

    pointer-events: none;

    transition:
        opacity 0.18s ease,
        transform 0.18s ease,
        visibility 0s linear 0.18s,
        border-color 0.2s ease,
        background 0.2s ease,
        box-shadow 0.2s ease;
}


/*
 * Only the currently selected component label appears.
 */

.reactor-floating-label.active {
    opacity: 1 !important;
    visibility: visible;

    pointer-events: auto;

    transition-delay: 0s;
}


.reactor-component-info {
    scroll-margin-top: 16px;

    transition:
        border-color 0.25s ease,
        box-shadow 0.25s ease,
        background 0.25s ease;
}


.reactor-component-info.component-arrived {
    border-color:rgba(255, 157, 69, 0.38);

    box-shadow: 0 0 28px rgba(255, 127, 31, 0.08);
}

/* =========================================================
   FINAL REACTOR RESPONSIVE LAYOUT
   ========================================================= */


/* =========================================================
   PAGE
   ========================================================= */

.reactor-page {
    width:
        min(1500px,calc(100% -clamp(24px,4vw,64px)));

    margin:
        0
        auto;

    padding:
        clamp(
            30px,
            4vw,
            52px
        )
        0
        clamp(
            70px,
            7vw,
            100px
        );

    box-sizing: border-box;
}


/* =========================================================
   HERO
   ========================================================= */

.reactor-hero {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr);

    gap: 28px;

    align-items: start;

    margin-bottom:
        clamp(
            42px,
            5vw,
            64px
        );
}


.reactor-hero-copy {
    max-width: 980px;
}


.reactor-hero h1 {
    max-width: 950px;

    margin:
        0
        0
        18px;

    font-size:
        clamp(
            3rem,
            5.4vw,
            5.5rem
        );

    line-height: 0.96;

    letter-spacing: -0.05em;
}

/* =========================================================
   HERO ENERGY FLOW
   ========================================================= */

.reactor-hero-energy {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        auto
        minmax(0, 1fr)
        auto
        minmax(0, 1fr)
        auto
        minmax(0, 1fr);

    align-items: center;

    gap: 12px;

    width:
        min(
            100%,
            1050px
        );

    max-width: none;

    justify-self: start;

    margin: 0;

    padding:
        16px
        18px;

    box-sizing:
        border-box;
}


.energy-flow-item {min-width: 0;}


.energy-flow-item div {min-width: 0;}


.energy-flow-item strong,
.energy-flow-item span {
    overflow-wrap:
        anywhere;
}


/* =========================================================
   EXPLORER WORKSPACE
   ========================================================= */

.reactor-explorer-grid {
    --reactor-workspace-height:
        clamp(
            640px,
            49vw,
            760px
        );

    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        minmax(440px, 470px);

    gap: 24px;

    align-items: start;
}


/* =========================================================
   REACTOR DIAGRAM
   ========================================================= */

.reactor-diagram-card {
    width: 100%;

    height:
        var(
            --reactor-workspace-height
        );

    min-height: 0;

    box-sizing:
        border-box;
}


.reactor-svg-wrapper {
    inset:
        42px
        18px
        14px;

    overflow: hidden;
}

/* =========================================================
   RIGHT COLUMN
   ========================================================= */

.reactor-side-column {
    display: flex;

    flex-direction: column;

    gap: 18px;

    width: 100%;
    min-width: 0;

    height:
        var(
            --reactor-workspace-height
        );

    padding-right: 8px;

    box-sizing:
        border-box;

    overflow-y: auto;
    overflow-x: hidden;

    overscroll-behavior:
        contain;

    scroll-behavior:
        smooth;

    scrollbar-width:
        thin;

    scrollbar-color:
        rgba(
            255,
            151,
            70,
            0.38
        )
        transparent;
}


.reactor-side-column::-webkit-scrollbar {
    width: 8px;
}


.reactor-side-column::-webkit-scrollbar-track {
    background:
        transparent;
}


.reactor-side-column::-webkit-scrollbar-thumb {
    border:
        2px solid
        transparent;

    border-radius:
        999px;

    background:
        rgba(
            255,
            151,
            70,
            0.38
        );

    background-clip:
        padding-box;
}


/* =========================================================
   SIDE CARDS
   ========================================================= */

.reactor-simulation-section,
.reactor-component-panel {
    width: 100%;
    min-width: 0;

    box-sizing:
        border-box;

    /*
     * The side column is a fixed-height flex container.
     * Do not allow either card to be crushed to fit it.
     * The side column itself should scroll instead.
     */
    flex:
        0 0 auto;
}


.reactor-simulation-section {
    margin: 0;

    padding: 22px;

    /*
     * Do not clip the controls/readouts when
     * the parent flex column gets crowded.
     */
    overflow: visible;
}


/* =========================================================
   SIMULATOR HEADER
   ========================================================= */

.reactor-simulation-section
.reactor-section-header {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        auto;

    align-items: start;

    gap: 14px;

    margin-bottom: 18px;
}


.reactor-simulation-section
.reactor-section-header > div {
    min-width: 0;
}


.reactor-simulation-section
.reactor-section-header h2 {
    font-size:
        clamp(
            1.55rem,
            2vw,
            1.85rem
        );
}


.reactor-simulation-section
.reactor-section-header p {
    max-width: 340px;

    font-size: 0.8rem;

    line-height: 1.5;
}


.simulation-state-pill {
    display: inline-flex;

    align-items: center;

    white-space: nowrap;
}


/* =========================================================
   SIMULATION GRID
   ========================================================= */

.reactor-sim-grid {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr);

    gap: 14px;

    min-width: 0;
}


.reactor-sim-controls {
    min-width: 0;

    padding: 0;

    border: 0;

    background: none;
}


/* =========================================================
   CONTROL HEADING
   ========================================================= */

.sim-control-heading {
    display: flex;

    flex-direction: column;

    align-items: flex-start;

    gap: 4px;

    margin-bottom: 14px;
}


.sim-control-heading span,
.sim-control-heading strong {
    display: block;
}


.sim-control-heading strong {
    font-size: 1.25rem;
}


/* =========================================================
   CONTROL ROW
   ========================================================= */

.sim-control-row {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        auto;

    align-items: center;

    gap: 12px;

    width: 100%;
    min-width: 0;
}


.sim-control-row label,
.sim-control-row > span {
    min-width: 0;
}


.sim-control-row output {
    white-space: nowrap;

    justify-self: end;
}


/* =========================================================
   CONTROL ROD SLIDER
   ========================================================= */

.control-rod-slider {
    display: block;

    width: 100%;
    max-width: 100%;

    margin:
        2px
        0
        0;

    box-sizing:
        border-box;
}


.sim-control-scale {
    width: 100%;

    box-sizing:
        border-box;
}


/* =========================================================
   COOLANT SWITCH
   ========================================================= */

.sim-switch-row {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        auto;

    align-items: center;

    gap: 16px;
}


.sim-switch-row > div {
    min-width: 0;
}


/* =========================================================
   SPEED BUTTONS
   ========================================================= */

.sim-speed-buttons {
    grid-template-columns:
        repeat(
            3,
            minmax(0, 1fr)
        );
}


/* =========================================================
   PRIMARY BUTTONS
   ========================================================= */

.sim-primary-actions {
    display: grid;

    grid-template-columns:
        1.3fr
        1fr
        0.8fr;

    gap: 8px;

    margin-top: 14px;
}


.reactor-reset-button {
    grid-column: auto;
}


.sim-primary-actions button {
    width: 100%;
    min-width: 0;

    padding:
        0
        10px;
}


/* =========================================================
   LIVE READOUTS
   ========================================================= */

.reactor-sim-readouts {
    display: grid;

    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );

    gap: 8px;
}


.sim-readout {
    min-width: 0;
    min-height: 104px;

    padding: 14px;

    box-sizing:
        border-box;

    border-radius: 15px;
}


.sim-readout > span {
    margin-bottom: 9px;

    font-size: 0.62rem;
}


.sim-readout strong {
    font-size:
        clamp(
            1.3rem,
            2vw,
            1.75rem
        );
}


.sim-readout small {
    margin-top: 6px;

    font-size: 0.61rem;
}


/* =========================================================
   COMPONENT PANEL
   ========================================================= */
.reactor-component-list {
    width: 100%;

    min-width: 0;
}


.reactor-component-button {
    min-width: 0;

    box-sizing:
        border-box;
}


/* =========================================================
   TABLET / SMALL LAPTOP
   ========================================================= */

@media (max-width: 1240px) {

    .reactor-explorer-grid {
        grid-template-columns:
            minmax(
                0,
                1fr
            );

        gap: 20px;
    }


    .reactor-diagram-card {
        height:
            clamp(
                520px,
                70vw,
                700px
            );
    }


    .reactor-side-column {
        height: auto;

        padding-right: 0;

        overflow: visible;
    }


    .reactor-simulation-section {
        overflow: visible;
    }


    .reactor-sim-readouts {
        grid-template-columns:
            repeat(
                3,
                minmax(0, 1fr)
            );
    }


    .reactor-component-list {
        display: grid;

        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );

        gap: 10px;
    }


    .reactor-process-flow {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );

        gap: 16px;
    }


    .process-connector {
        display: none;
    }

}


/* =========================================================
   PHONE / SMALL TABLET
   ========================================================= */

@media (max-width: 760px) {

    .reactor-page {
        width:
            calc(
                100% -
                20px
            );

        padding-top: 28px;
    }


    .reactor-hero {
        gap: 22px;

        margin-bottom: 40px;
    }


    .reactor-hero h1 {
        max-width: 100%;

        font-size:
            clamp(
                2.45rem,
                12vw,
                4rem
            );

        line-height: 0.98;
    }


    .reactor-hero p {
        font-size: 0.98rem;

        line-height: 1.6;
    }


    /*
     * Remove arrows and make the four
     * energy stages a clean 2×2 grid.
     */

    .reactor-hero-energy {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );

        gap: 10px;

        padding: 12px;
    }


    .energy-arrow {
        display: none;
    }


    .energy-flow-item {
        padding: 10px;

        border-radius: 12px;

        background:
            rgba(
                255,
                255,
                255,
                0.025
            );
    }


    .energy-icon {
        width: 34px;
        height: 34px;

        flex:
            0
            0
            34px;
    }


    .reactor-section-header {
        flex-direction: column;

        align-items: flex-start;

        gap: 12px;
    }


    /*
     * The general explorer status is unnecessary
     * on the small layout.
     */

    .reactor-explorer-section
    >
    .reactor-section-header
    >
    .reactor-status-pill {
        display: none;
    }


    .reactor-diagram-card {
        height:
            clamp(
                360px,
                94vw,
                520px
            );

        border-radius: 20px;
    }


    .reactor-svg-wrapper {
        inset:
            36px
            2px
            8px;
    }


    .reactor-diagram-hint {
        display: none;
    }


    /*
     * Labels are too intrusive on a phone.
     * The student taps the reactor and reads
     * the information card below instead.
     */

    .reactor-floating-label {
        display: none !important;
    }


    .reactor-simulation-section {
        padding: 18px;

        border-radius: 20px;
    }


    .reactor-simulation-section
    .reactor-section-header {
        grid-template-columns:
            minmax(
                0,
                1fr
            );

        gap: 10px;
    }


    .simulation-state-pill {
        justify-self: start;
    }


    .reactor-simulation-section
    .reactor-section-header p {
        max-width: none;
    }


    .reactor-sim-readouts {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }


    .reactor-component-list {
        grid-template-columns:
            minmax(
                0,
                1fr
            );
    }


    .reactor-process-flow {
        grid-template-columns:
            minmax(
                0,
                1fr
            );
    }


    .reactor-process-card {
        min-height: 240px;
    }

}


/* =========================================================
   SMALL PHONE
   ========================================================= */

@media (max-width: 430px) {

    .reactor-hero-energy {
        grid-template-columns:
            minmax(
                0,
                1fr
            );
    }


    .sim-control-row {
        grid-template-columns:
            minmax(
                0,
                1fr
            );

        gap: 5px;
    }


    .sim-control-row output {
        justify-self: start;
    }


    .sim-primary-actions {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }


    .reactor-reset-button {
        grid-column:
            1 / -1;
    }


    .sim-readout {
        padding: 12px;
    }

}


/* =========================================================
   VERY SMALL PHONE
   ========================================================= */

@media (max-width: 360px) {

    .reactor-sim-readouts {
        grid-template-columns:
            minmax(
                0,
                1fr
            );
    }


    .sim-speed-buttons {
        gap: 5px;
    }

}


/* =========================================================
   TOUCH DEVICES
   ========================================================= */

@media (hover: none) {

    .reactor-part:hover,
    .pipe-part:hover {
        transform: none;

        filter: none;
    }


    .reactor-component-button,
    .sim-toggle-button,
    .sim-speed-buttons button,
    .sim-primary-actions button {
        min-height: 44px;
    }

}

/* =========================================================
   MOBILE REACTOR PICTURE-IN-PICTURE
   ========================================================= */

.reactor-mini-placeholder {
    width: 100%;
}

.reactor-mini-placeholder[hidden] {
    display: none;
}

.reactor-mini-close {
    display: none;
}


/* =========================================================
   MOBILE ONLY
   ========================================================= */

@media (max-width: 760px) {

    .reactor-diagram-card.reactor-mini-floating {

        position: fixed;

        z-index: 1000;

        right:
            max(
                12px,
                env(safe-area-inset-right)
            );

        bottom:
            calc(
                14px +
                env(safe-area-inset-bottom)
            );

        top: auto;
        left: auto;

        width: clamp(
            150px,
            43vw,
            205px
        );

        height: auto;

        min-height: 0;

        aspect-ratio: 1 / 0.9;

        margin: 0;

        border-radius: 16px;

        border:
            1px solid
            rgba(255, 162, 70, 0.38);

        background:
            linear-gradient(
                145deg,
                #111b22,
                #080c10
            );

        box-shadow:
            0 12px 40px rgba(0, 0, 0, 0.65),
            0 0 22px rgba(255, 128, 28, 0.10);

        overflow: hidden;

    }


    /* Hide labels in the miniature */

    .reactor-mini-floating
    .reactor-floating-label,

    .reactor-mini-floating
    .reactor-diagram-top {

        display: none !important;

    }


    /* Fill the miniature with the reactor SVG */

    .reactor-mini-floating
    .reactor-svg-wrapper {

        position: absolute;

        inset: 4px;

        display: grid;

        place-items: center;

    }

    .reactor-mini-floating
    .reactor-svg {

        display: block;

        width: 100%;
        height: 100%;

        max-width: 100%;

        overflow: hidden;

        object-fit: contain;

    }


    /* Close button */

    .reactor-mini-floating
    .reactor-mini-close {

        position: absolute;

        z-index: 20;

        top: 6px;
        right: 6px;

        display: grid;

        place-items: center;

        width: 26px;
        height: 26px;

        padding: 0;

        border:
            1px solid
            rgba(255, 255, 255, 0.18);

        border-radius: 50%;

        background:
            rgba(0, 0, 0, 0.65);

        color: #fff;

        font-size: 19px;

        line-height: 1;

        cursor: pointer;

        touch-action: manipulation;

    }

    .reactor-mini-floating
    .reactor-mini-close:active {

        background:
            rgba(255, 138, 42, 0.5);

    }

}


/* =========================================================
   SMALL PHONES
   ========================================================= */

@media (max-width: 380px) {

    .reactor-diagram-card.reactor-mini-floating {

        width: 150px;

        border-radius: 12px;

    }

}


/* =========================================================
   CONNECTED POWER PLANT SIMULATION
   ========================================================= */

.reactor-plant-section {
    margin: 0 0 90px;
    min-width: 0;
}

.reactor-plant-card {
    overflow: hidden;

    border: 1px solid var(--reactor-border);
    border-radius: 26px;

    background:
        radial-gradient(
            circle at 25% 50%,
            rgba(255, 125, 35, 0.08),
            transparent 50%
        ),
        linear-gradient(
            145deg,
            #11191e,
            #080c0f
        );
}

.reactor-plant-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;

    padding: 20px 24px;

    border-bottom:
        1px solid rgba(255, 255, 255, 0.07);

    color: rgba(255, 255, 255, 0.6);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.09em;
}

.reactor-plant-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;

    font-size: 0.72rem;
    letter-spacing: 0;
    font-weight: 500;
}

.reactor-plant-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.reactor-plant-legend span::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: currentColor;
}

.plant-legend-hot {
    color: #ff9c51;
}

.plant-legend-steam {
    color: #dce5eb;
}

.plant-legend-water {
    color: #39bfff;
}

/* =========================================================
   SVG CONTAINER
   ========================================================= */

.reactor-plant-scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
}

.reactor-plant-svg {
    display: block;
    width: 100%;
    height: auto;
    min-height: 300px;
}

.plant-background {
    fill: rgba(6, 11, 15, 0.25);
    stroke: rgba(255, 255, 255, 0.025);
}

.plant-title {
    fill: #f3f6f8;
    font-size: 12px;
    font-weight: 800;
    text-anchor: middle;
    letter-spacing: 0.045em;
}

.plant-subtitle {
    fill: #8d9ba4;
    font-size: 10px;
    text-anchor: middle;
}

.plant-containment {
    fill: rgba(31, 43, 52, 0.55);
    stroke: #64747e;
    stroke-width: 9;
}

.plant-machine {
    fill: url(#plantVesselGradient);
    stroke: #728691;
    stroke-width: 3;
}

.plant-heat-exchanger {
    fill: none;
    stroke: #ff9b47;
    stroke-width: 8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.plant-reactor-core rect {
    fill: #ff8d29;

    filter:
        drop-shadow(
            0 0 7px rgba(255, 120, 25, 0.65)
        );
}

.plant-control-rods rect {
    fill: #7dd3e9;
    stroke: #b7ebf8;
    stroke-width: 1;
}

.plant-steam-bubbles {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.plant-steam-bubbles circle {
    fill: rgba(220, 241, 255, 0.7);
}

.reactor-plant-svg.has-steam
.plant-steam-bubbles {
    opacity: 1;
}

/* =========================================================
   PIPEWORK
   ========================================================= */

.plant-pipe {
    fill: none;
    stroke-width: 15;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.plant-primary-pipe {
    stroke: #98532e;
}

.plant-steam-pipe {
    stroke: #647883;
}

.plant-water-pipe {
    stroke: #164c66;
}

.plant-flow {
    fill: none;
    stroke-width: 5;
    stroke-linecap: round;
    stroke-linejoin: round;

    stroke-dasharray: 13 17;
    stroke-dashoffset: 0;

    opacity: 0.08;

    animation:
        plantFlowForward
        var(--plant-flow-duration, 2s)
        linear
        infinite;

    animation-play-state: paused;
}

.plant-hot-flow {
    stroke: #ffb25b;
}

.plant-cool-flow {
    stroke: #4ccaff;
}

.plant-steam-flow {
    stroke: #f1f7ff;
    animation-duration:
        var(--plant-steam-duration, 2s);
}

.plant-water-flow {
    stroke: #3dbaff;
    animation-duration:
        var(--plant-steam-duration, 2s);
}

.plant-flow.is-flowing {
    opacity: 0.95;
    animation-play-state: running;
}

@keyframes plantFlowForward {
    from {
        stroke-dashoffset: 0;
    }

    to {
        stroke-dashoffset: -30;
    }
}

/* =========================================================
   TURBINE / GENERATOR
   ========================================================= */

#plantTurbineRotor {
    fill: #e4ebef;
}

.plant-generator-light {
    fill: #e7ab43;
    opacity: 0.12;
}

.plant-electric-flow {
    fill: none;
    stroke: #ffd36e;
    stroke-width: 4;
    stroke-dasharray: 5 9;
    stroke-linecap: round;

    opacity: 0.1;

    animation:
        plantFlowForward
        0.8s
        linear
        infinite;

    animation-play-state: paused;
}

.plant-electric-flow.is-flowing {
    opacity: 1;
    animation-play-state: running;

    filter:
        drop-shadow(
            0 0 5px rgba(255, 190, 50, 0.7)
        );
}

.plant-condenser-water {
    fill: none;
    stroke: #34b9ed;
    stroke-width: 4;
    stroke-linecap: round;
}

.plant-cooling-pipe {
    fill: none;
    stroke: #2684ae;
    stroke-width: 8;
    stroke-linecap: round;
    stroke-linejoin: round;
}


/* =========================================================
   POWER PLANT READOUTS
   ========================================================= */

.reactor-plant-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));

    border-top:
        1px solid rgba(255, 255, 255, 0.07);
}

.reactor-plant-metrics > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;

    min-width: 0;
    padding: 22px 12px;

    text-align: center;
}

.reactor-plant-metrics > div:not(:last-child) {
    border-right:
        1px solid rgba(255, 255, 255, 0.07);
}

.reactor-plant-metrics span {
    color: var(--reactor-muted);
    font-size: 0.77rem;
}

.reactor-plant-metrics strong {
    color: #ffba70;

    font-size:
        clamp(1rem, 1.8vw, 1.5rem);

    font-variant-numeric: tabular-nums;
}

.reactor-plant-note {
    margin: 14px 4px 0;

    color: var(--reactor-muted);
    font-size: 0.78rem;
    line-height: 1.7;
}

/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 900px) {

    .reactor-plant-section {margin-bottom: 65px;}

    .reactor-plant-svg {
        min-width: 800px;
        min-height: 0;
    }

    .reactor-plant-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .reactor-plant-metrics > div:nth-child(2) {border-right: none;}

    .reactor-plant-metrics > div:nth-child(-n+2) {
        border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    }
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 600px) {

    .reactor-plant-card {border-radius: 18px;}

    .reactor-plant-topbar {padding: 16px;}

    .reactor-plant-legend {
        gap: 10px;
        font-size: 0.65rem;
    }

    .reactor-plant-svg {min-width: 760px;}

    .reactor-plant-metrics > div {padding: 17px 8px;}

    .reactor-plant-metrics span {font-size: 0.69rem;}

    .reactor-plant-metrics strong {font-size: 1.1rem;}
}

@media (prefers-reduced-motion: reduce) {
    .reactor-plant-svg .plant-flow,
    .reactor-plant-svg .plant-electric-flow {animation: none;}
}


/* =========================================================
   NUCLEAR FISSION LESSON
   ========================================================= */

.reactor-fission-section {
    margin: 0 0 90px;
    min-width: 0;
    scroll-margin-top: 100px;
}

.reactor-fission-open {
    display: flex;
    align-items: center;
    justify-content: space-between;

    width: 100%;
    margin-top: 18px;
    padding: 13px 16px;

    border: 1px solid rgba(255, 168, 84, 0.35);
    border-radius: 12px;

    background: rgba(255, 138, 42, 0.1);
    color: #ffc47e;

    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.reactor-fission-open[hidden] {display: none;}

.reactor-fission-open:hover {background: rgba(255, 138, 42, 0.2);}

.fission-lesson-card {
    display: grid;
    grid-template-columns:
        minmax(0, 1.3fr)
        minmax(280px, 0.7fr);

    gap: 30px;
    align-items: center;

    padding: 32px;

    border: 1px solid var(--reactor-border);
    border-radius: 26px;

    background:
        radial-gradient(
            circle at 30% 50%,
            rgba(255, 132, 35, 0.09),
            transparent 50%
        ),
        linear-gradient(
            145deg,
            #11191e,
            #080c0f
        );
}

.fission-visual {
    min-width: 0;
    padding: 20px;

    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 18px;

    background: rgba(0, 0, 0, 0.22);
}

.fission-visual svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.fission-stage {display: none;}

.fission-stage.is-active {display: inline;}

.fission-svg-label {
    fill: rgba(230, 239, 245, 0.8);
    font-size: 13px;
}

.fission-visual-note {
    padding: 8px;
    color: var(--reactor-muted);
    text-align: center;
    font-size: 0.72rem;
}

.fission-step-counter {
    margin-bottom: 14px;

    color: var(--reactor-orange-bright);

    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.fission-lesson-content h3 {
    margin: 0 0 14px;

    color: #fff;

    font-size: clamp(1.5rem, 2.5vw, 2.3rem);
    line-height: 1.2;
}

.fission-lesson-content > p {
    color: var(--reactor-muted);
    line-height: 1.7;
}

.fission-lesson-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 25px;
}

.fission-lesson-controls button {
    padding: 11px 14px;

    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;

    background: rgba(255, 255, 255, 0.05);
    color: #fff;

    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.fission-lesson-controls button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
}

.fission-lesson-controls button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.fission-lesson-controls .fission-play-btn {
    background: var(--reactor-orange);
    border-color: var(--reactor-orange);
    color: #141414;
    font-weight: 800;
}

.fission-lesson-content .fission-learning-note {
    margin-top: 24px;
    padding-top: 18px;

    border-top: 1px solid rgba(255, 255, 255, 0.08);

    font-size: 0.82rem;
}


/* =========================================================
   FISSION SVG ANIMATIONS
   ========================================================= */

/* Step 1 — Incoming neutron */

.fission-stage.is-active .fission-incoming {
    animation: fissionNeutronApproach 2.8s ease-in-out both;
    animation-play-state: paused;
}

@keyframes fissionNeutronApproach {
    0% {
        transform: translateX(0);
        opacity: 1;
    }

    85% {
        transform: translateX(235px);
        opacity: 1;
    }

    100% {
        transform: translateX(241px);
        opacity: 0;
    }
}


/* Step 2 — Nucleus splits */


/* =========================================================
   STAGE 2 - NUCLEUS SPLITTING
   ========================================================= */

/* Fragments stay separated when paused */

.fission-fragment-left,
.fission-fragment-right {transform: translateX(0);}


/* Animate only while lesson is playing */

.fission-lesson-card.is-playing
.fission-stage.is-active
.fission-fragment-left {
    animation:
        fissionSplitLeft
        2.8s ease-out forwards;
}

.fission-lesson-card.is-playing
.fission-stage.is-active
.fission-fragment-right {
    animation:
        fissionSplitRight
        2.8s ease-out forwards;
}


/* Left nucleus moves outward */

@keyframes fissionSplitLeft {

    from {transform: translateX(50px);}

    to {transform: translateX(0);}

}


/* Right nucleus moves outward */

@keyframes fissionSplitRight {

    from {
        transform: translateX(-50px);
    }

    to {
        transform: translateX(0);
    }

}



/* Released neutrons */

/* Neutrons visible when navigating manually */

.fission-stage.is-active .fission-emitted {
    opacity: 1;
}


/* Animate neutron release during playback */

.fission-lesson-card.is-playing
.fission-stage.is-active
.fission-emitted {
    animation:
        fissionNeutronScatter
        2.8s ease-out forwards;
}

@keyframes fissionNeutronScatter {
    from {
        transform: translate(0, 0) scale(0.5);
        opacity: 0;
    }

    to {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
}


/* Step 3 — Chain reaction */

.fission-stage.is-active .fission-chain-path {
    stroke-dasharray: 8 11;

    animation: fissionChainFlow 2.8s linear both;
    animation-play-state: paused;
}

@keyframes fissionChainFlow {
    from {
        stroke-dashoffset: 90;
        opacity: 0.1;
    }

    to {
        stroke-dashoffset: 0;
        opacity: 1;
    }
}


/* Step 4 — Neutron absorption */

.fission-stage.is-active .fission-absorbed {
    animation: fissionAbsorption 2.8s ease-in both;
    animation-play-state: paused;
}

@keyframes fissionAbsorption {
    0% {
        transform: translateX(0);
        opacity: 1;
    }

    80% {
        transform: translateX(105px);
        opacity: 1;
    }

    100% {
        transform: translateX(110px);
        opacity: 0;
    }
}


/* Run animations only when playing */

.fission-lesson-card.is-playing
.fission-stage.is-active
.fission-incoming,

.fission-lesson-card.is-playing
.fission-stage.is-active
.fission-fragment-left,

.fission-lesson-card.is-playing
.fission-stage.is-active
.fission-fragment-right,

.fission-lesson-card.is-playing
.fission-stage.is-active
.fission-emitted,

.fission-lesson-card.is-playing
.fission-stage.is-active
.fission-chain-path,

.fission-lesson-card.is-playing
.fission-stage.is-active
.fission-absorbed {animation-play-state: running;}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 760px) {

    .fission-lesson-card {
        grid-template-columns: 1fr;
        gap: 22px;
        padding: 18px;
    }

    .fission-visual {padding: 10px;}

    .fission-lesson-controls {justify-content: center;}

    .fission-lesson-controls button {
        flex: 1 1 auto;
        min-height: 44px;
    }

}

@media (prefers-reduced-motion: reduce) {

    .fission-stage.is-active .fission-incoming,
    .fission-stage.is-active .fission-fragment-left,
    .fission-stage.is-active .fission-fragment-right,
    .fission-stage.is-active .fission-emitted,
    .fission-stage.is-active .fission-chain-path,
    .fission-stage.is-active .fission-absorbed {animation: none;}

}

/* =========================================================
   FISSION - CLUSTERED NUCLEUS
   ========================================================= */

.fission-atomic-nucleus {
    filter:
        drop-shadow(
            0 0 6px
            rgba(255, 150, 50, 0.35)
        );
}


/* =========================================================
   REACTOR TYPES AND HISTORY
   ========================================================= */

.reactor-types-section {
    margin: 90px 0 80px;
}

.reactor-types-heading {
    margin: 48px 0 22px;
}

.reactor-types-heading h3 {
    margin: 0 0 8px;
    color: #fff;
    font-size: clamp(1.3rem, 2.5vw, 1.8rem);
}

.reactor-types-heading p {
    margin: 0;
    color: var(--reactor-muted);
    line-height: 1.65;
}


/* =========================================================
   HISTORY TIMELINE
   ========================================================= */

.reactor-history-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 14px;
}

.reactor-history-item {
    position: relative;
    padding: 22px;
    border: 1px solid var(--reactor-border);
    border-radius: 18px;
    background: var(--reactor-panel);
}

.reactor-history-item::before {
    content: "";
    position: absolute;
    top: 0;
    left: 22px;
    width: 48px;
    height: 3px;
    background: var(--reactor-orange);
    border-radius: 0 0 4px 4px;
}

.reactor-history-year {
    display: block;
    margin-bottom: 12px;
    color: var(--reactor-orange-bright);
    font-size: 1.5rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.reactor-history-item h4 {
    margin: 0 0 10px;
    color: #fff;
    font-size: 1rem;
}

.reactor-history-item p {
    margin: 0;
    color: var(--reactor-muted);
    font-size: 0.88rem;
    line-height: 1.65;
}


/* =========================================================
   REACTOR TYPE CARDS
   ========================================================= */

.reactor-types-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}

.reactor-type-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--reactor-border);
    border-radius: 20px;
    background:
        linear-gradient(
            155deg,
            rgba(28, 25, 22, 0.95),
            rgba(10, 13, 16, 0.96)
        );
}

.reactor-type-card[open] {
    border-color: rgba(255, 177, 74, 0.42);
}

.reactor-type-card summary {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 92px;
    padding: 18px;
    list-style: none;
    cursor: pointer;
}

.reactor-type-card summary::-webkit-details-marker {
    display: none;
}

.reactor-type-card summary:focus-visible,
.reactor-type-glossary:focus-visible {
    outline: 2px solid var(--reactor-orange-bright);
    outline-offset: -3px;
}

.reactor-type-code {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 58px;
    height: 48px;
    padding: 0 4px;
    border: 1px solid rgba(255, 177, 74, 0.2);
    border-radius: 12px;
    background: rgba(255, 138, 42, 0.1);
    color: var(--reactor-orange-bright);
    font-size: 0.86rem;
    font-weight: 800;
}

.reactor-type-name {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    color: #fff;
    font-size: 0.98rem;
    font-weight: 700;
}

.reactor-type-name small {
    color: var(--reactor-muted);
    font-size: 0.76rem;
    font-weight: 400;
}

.reactor-type-chevron {
    color: var(--reactor-orange-bright);
    font-size: 1.5rem;
    transition: transform 0.2s ease;
}

.reactor-type-card[open] .reactor-type-chevron {
    transform: rotate(180deg);
}

.reactor-type-content {
    padding: 0 22px 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.reactor-type-content p {
    margin: 16px 0;
    color: var(--reactor-muted);
    font-size: 0.9rem;
    line-height: 1.75;
}

.reactor-type-content h4 {
    margin: 20px 0 6px;
    color: #fff;
    font-size: 0.92rem;
}

.reactor-type-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px 0;
}

.reactor-type-facts span {
    padding: 7px 10px;
    border: 1px solid rgba(39, 184, 255, 0.18);
    border-radius: 8px;
    background: rgba(39, 184, 255, 0.06);
    color: #a6e1ff;
    font-size: 0.76rem;
}

.reactor-type-glossary {
    width: 100%;
    min-height: 44px;
    padding: 11px 14px;
    border: 1px solid rgba(255, 177, 74, 0.28);
    border-radius: 11px;
    background: rgba(255, 138, 42, 0.09);
    color: var(--reactor-orange-bright);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
}

.reactor-type-glossary:hover {
    background: rgba(255, 138, 42, 0.17);
}


/* =========================================================
   COMPARISON TABLE
   ========================================================= */

.reactor-comparison-scroll {
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid var(--reactor-border);
    border-radius: 18px;
    background: var(--reactor-panel);
    -webkit-overflow-scrolling: touch;
}

.reactor-comparison-table {
    width: 100%;
    min-width: 650px;
    border-collapse: collapse;
    text-align: left;
}

.reactor-comparison-table th,
.reactor-comparison-table td {
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.88rem;
    line-height: 1.5;
}

.reactor-comparison-table thead {
    background: rgba(255, 138, 42, 0.08);
}

.reactor-comparison-table thead th {
    color: var(--reactor-orange-bright);
    font-weight: 700;
}

.reactor-comparison-table tbody th {
    color: #fff;
    font-weight: 700;
    white-space: nowrap;
}

.reactor-comparison-table tbody td {
    color: var(--reactor-muted);
}

.reactor-comparison-table tbody tr:last-child th,
.reactor-comparison-table tbody tr:last-child td {
    border-bottom: none;
}

.reactor-types-note {
    margin: 18px 0 0;
    color: var(--reactor-muted);
    font-size: 0.84rem;
    line-height: 1.7;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 760px) {

    .reactor-types-section {
        margin: 64px 0;
    }

    .reactor-types-grid {
        grid-template-columns: 1fr;
    }

    .reactor-history-grid {
        grid-template-columns:
            repeat(auto-fit, minmax(min(100%, 190px), 1fr));
    }

    .reactor-types-heading {
        margin-top: 36px;
    }

    .reactor-type-card summary {
        padding: 15px;
        min-height: 80px;
    }

    .reactor-type-content {
        padding: 0 16px 18px;
    }

}

@media (max-width: 430px) {

    .reactor-history-grid {
        grid-template-columns: 1fr;
    }

    .reactor-type-name {
        font-size: 0.9rem;
    }

}

@media (prefers-reduced-motion: reduce) {

    .reactor-type-chevron {
        transition: none;
    }

}


/* =========================================================
   REACTOR PAGE GLOSSARY POPUP
   ========================================================= */

.reactor-glossary-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;

    display: none;
    align-items: center;
    justify-content: center;

    padding: 18px;
    box-sizing: border-box;

    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(8px);
}

.reactor-glossary-overlay.is-open {
    display: flex;
}

.reactor-glossary-panel {
    display: flex;
    flex-direction: column;

    width: min(960px, 100%);
    max-height: 90vh;
    max-height: 90dvh;
    min-height: 0;

    overflow: hidden;

    border: 1px solid rgba(255, 168, 84, 0.22);
    border-radius: 22px;

    background: #101417;
    color: #fff;
}

.reactor-glossary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 16px;
    padding: 22px;

    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.reactor-glossary-header h2 {
    margin: 0;
    color: #fff;
    font-size: 1.5rem;
}

.reactor-glossary-header button {
    flex-shrink: 0;
    width: 40px;
    height: 40px;

    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;

    background: rgba(255,255,255,0.05);
    color: #fff;

    font-size: 1.5rem;
    cursor: pointer;
}

.reactor-glossary-body {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);

    flex: 1;
    min-height: 0;
}

.reactor-glossary-sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;

    min-height: 0;
    padding: 18px;
    overflow-y: auto;

    border-right: 1px solid rgba(255,255,255,0.08);
}

.reactor-glossary-sidebar label {
    color: #ffb14a;
    font-size: 0.82rem;
    font-weight: 700;
}

.reactor-glossary-sidebar input {
    width: 100%;
    padding: 12px;

    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;

    background: #1b2226;
    color: #fff;
}

.reactor-glossary-term-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.reactor-glossary-term-list .glossary-term-btn {
    padding: 11px 12px;

    border: 1px solid transparent;
    border-radius: 9px;

    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.78);

    text-align: left;
    cursor: pointer;
}

.reactor-glossary-term-list .glossary-term-btn.is-selected {
    border-color: rgba(255,138,42,0.35);
    background: rgba(255,138,42,0.12);
    color: #ffb14a;
}

.reactor-glossary-content {
    min-width: 0;
    min-height: 0;

    padding: 26px;
    overflow-y: auto;

    line-height: 1.7;
}

.reactor-glossary-content #glossaryCategory {
    color: #ffb14a;
    font-size: 0.78rem;
    font-weight: 800;
}

.reactor-glossary-content h3 {
    margin: 10px 0 14px;
    color: #fff;
    font-size: 1.6rem;
}

.reactor-glossary-content h4 {
    color: #ffb14a;
}

.reactor-glossary-content p,
.reactor-glossary-content li,
.reactor-glossary-content .glossary-example {
    color: rgba(255,255,255,0.75);
}

.reactor-glossary-content .glossary-example {
    padding: 8px 0;
}

@media (max-width: 760px) {

    .reactor-glossary-overlay {
        padding: 10px;
    }

    .reactor-glossary-panel {
        max-height: 94vh;
        max-height: 94dvh;
    }

    .reactor-glossary-body {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }

    .reactor-glossary-sidebar {
        max-height: 180px;
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }

    .reactor-glossary-content {
        overflow: visible;
        padding: 18px;
    }

}
