/*experiment_lab.css*/
.experiment-lab-layout {
    grid-column: 1 / -1;
    height: calc(100vh - 110px);
    min-height: 680px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.experiment-lab-header {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    padding: 8px 0;
    background: transparent;
    border: 0;
}

.experiment-run-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.experiment-workspace {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    border-radius: 18px;
    background:
        radial-gradient(circle at center, rgba(80, 150, 255, 0.10), transparent 52%),
        rgba(5, 5, 5, 0.35);
}

.experiment-main-viewer {
    position: absolute;
    inset: 0;
    background: transparent;
    border: 0;
    padding: 0;
    box-shadow: none;
}

#experimentLabCanvas {
    width: 100%;
    height: 100%;
    display: block;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.experiment-clock-overlay {
    position: absolute;
    top: 18px;
    right: 285px;
    z-index: 6;
    min-width: 150px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(18, 14, 11, 0.88);
    border: 1px solid rgba(238, 172, 96, 0.65);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
    color: #fff1df;
    pointer-events: none;
}

.experiment-clock-label {
    font-size: 12px;
    font-weight: 800;
    color: rgb(238, 172, 96);
    margin-bottom: 2px;
}

.experiment-clock-time {
    font-family: Consolas, "Courier New", monospace;
    font-size: 26px;
    font-weight: 800;
    color: rgb(255, 232, 170);
    line-height: 1.1;
}

.experiment-reaction-time {
    margin-top: 5px;
    font-size: 12px;
    color: rgb(220, 205, 190);
}

@media (max-width: 980px) {
    .experiment-clock-overlay {
        top: 14px;
        right: 14px;
    }
}

.experiment-floating-panel {
    position: absolute;
    top: 18px;
    z-index: 5;
    width: 285px;
    max-height: calc(100% - 36px);
    overflow-y: auto;
    padding: 14px;
    border-radius: 14px;
    background: rgba(34, 28, 24, 0.92);
    border: 1px solid rgba(220, 180, 140, 0.45);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.38);
}

.experiment-left-panel {
    left: 18px;
}

.experiment-right-panel {
    right: 18px;
}

.experiment-floating-panel h2 {
    margin: 0 0 12px;
    color: rgb(238, 172, 96);
    font-size: 18px;
}

.experiment-observation-card {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 180, 90, 0.18);
}

.experiment-step-list {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.experiment-step {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgb(214, 202, 190);
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(220, 180, 140, 0.18);
}

.step-number {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgb(184, 128, 74);
    color: #1d120b;
    font-weight: 800;
    font-size: 13px;
    flex: 0 0 auto;
}

.experiment-apparatus-shelf {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0 0 16px;
    padding: 0;
    background: transparent;
    border: 0;
}

.experiment-apparatus-shelf .apparatus-item {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    min-height: 82px;
    padding: 8px;
}

.experiment-control-box {
    padding-top: 14px;
    border-top: 1px solid rgba(255, 180, 90, 0.18);
}

.experiment-field {
    margin-top: 12px;
}

.experiment-field label {
    display: block;
    color: #fff1df;
    font-weight: 700;
    margin-bottom: 6px;
}

.salt-bridge-halfcell-controls.hidden-apparatus,
.single-solution-control.hidden-apparatus {
    display: none !important;
}

.experiment-floating-panel select,
.experiment-floating-panel input[type="range"] {
    width: 100%;
}

.experiment-slider-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
}

.electrode-result-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 12px;
}

.electrode-result {
    padding: 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.electrode-result h3 {
    margin: 0 0 8px;
    font-size: 14px;
    color: rgb(245, 230, 210);
}

.cathode-result {
    border-left: 4px solid rgba(120, 190, 255, 0.9);
}

.anode-result {
    border-left: 4px solid rgba(255, 150, 110, 0.9);
}

#experimentCathodeEquation,
#experimentAnodeEquation {
    font-family: Consolas, "Courier New", monospace;
    color: rgb(255, 232, 170);
}

.gas-tube-visual {
    position: relative;
    width: 38px;
    height: 68px;
    margin: 0 auto;
    border: 3px solid rgba(225, 240, 248, 0.9);
    border-bottom: 0;
    border-radius: 18px 18px 3px 3px;
    overflow: hidden;
}

.gas-tube-preview-liquid {
    position: absolute;
    left: 4px;
    right: 4px;
    top: 14px;
    bottom: 0;
    background: rgba(90, 165, 235, 0.38);
}

.lit-splint-visual {
    position: relative;
    width: 72px;
    height: 50px;
    margin: 0 auto;
}

.lit-splint-visual::after {
    content: "";
    position: absolute;
    left: 8px;
    top: 26px;
    width: 58px;
    height: 6px;
    border-radius: 999px;
    background: #c99a5f;
    transform: rotate(-10deg);
}

.lit-splint-preview-flame {
    position: absolute;
    left: 3px;
    top: 5px;
    width: 14px;
    height: 23px;
    border-radius: 50% 50% 45% 45%;
    background: radial-gradient(
        ellipse at center bottom,
        #fff4a4 0 28%,
        #ffad3b 34% 72%,
        transparent 74%
    );
    transform: rotate(-8deg);
}

.salt-bridge-visual {
    position: relative;
    width: 68px;
    height: 52px;
}

.salt-bridge-visual::before {
    content: "";
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    height: 34px;
    border-top: 7px solid rgba(230, 220, 190, 0.95);
    border-left: 7px solid rgba(230, 220, 190, 0.95);
    border-right: 7px solid rgba(230, 220, 190, 0.95);
    border-radius: 30px 30px 0 0;
}

/* Narrower floating cards */
.experiment-floating-panel {
    top: 12px;
    width: 245px;
    max-height: calc(100% - 24px);
    padding: 10px;
    border-radius: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
}

.experiment-left-panel {
    left: 12px;
}

.experiment-right-panel {
    right: 12px;
}

/* Better scrollbar */
.experiment-floating-panel {
    scrollbar-width: thin;
    scrollbar-color: rgba(238, 172, 96, 0.75) rgba(24, 18, 14, 0.75);
}

.experiment-floating-panel::-webkit-scrollbar {
    width: 7px;
}

.experiment-floating-panel::-webkit-scrollbar-track {
    background: rgba(24, 18, 14, 0.75);
    border-radius: 999px;
}

.experiment-floating-panel::-webkit-scrollbar-thumb {
    background: linear-gradient(
        to bottom,
        rgba(255, 205, 140, 0.95),
        rgba(184, 128, 74, 0.95)
    );
    border-radius: 999px;
}

.experiment-floating-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 220, 165, 1);
}

/* Tighter headings */
.experiment-floating-panel h2 {
    font-size: 15px;
    margin-bottom: 9px;
}

/* Tighter fields */
.experiment-field {
    margin-top: 9px;
}

.experiment-field label {
    font-size: 13px;
    margin-bottom: 5px;
}

.experiment-floating-panel select {
    height: 34px;
    padding: 5px 8px;
    font-size: 13px;
    border-radius: 8px;
    background: rgba(12, 10, 8, 0.9);
    color: #f5f0eb;
    border: 1px solid rgba(220, 180, 140, 0.45);
}

/* Tighter setup list */
.experiment-step-list {
    gap: 7px;
    margin-top: 10px;
}

.experiment-step {
    gap: 8px;
    padding: 7px 8px;
    border-radius: 9px;
    font-size: 13px;
}

.step-number {
    width: 22px;
    height: 22px;
    font-size: 12px;
}

/* Observation spacing */
.experiment-observation-card {
    margin-top: 13px;
    padding-top: 11px;
}

.electrode-result-grid {
    gap: 8px;
    margin-top: 9px;
}

.electrode-result {
    padding: 8px;
    border-radius: 10px;
}

.electrode-result h3 {
    font-size: 13px;
    margin-bottom: 6px;
}

.info-line {
    margin: 5px 0;
    font-size: 12px;
    line-height: 1.3;
}

/* Apparatus card spacing */
.experiment-apparatus-shelf {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.experiment-apparatus-shelf .apparatus-item {
    min-height: 70px;
    padding: 6px;
    border-radius: 12px;
}

.experiment-apparatus-shelf .apparatus-name {
    font-size: 12px;
}

/* Make controls fit the narrower right card */
.experiment-control-box {
    padding-top: 11px;
}

.experiment-slider-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
}

.experiment-slider-row span {
    font-size: 12px;
    white-space: nowrap;
}

.experiment-current-tool {
    margin-top: 10px;
    padding-top: 9px;
    font-size: 12px;
}

.wire-visual {
    position: relative;
    width: 64px;
    height: 52px;
}

.wire-visual::before {
    content: "";
    position: absolute;
    left: 8px;
    right: 8px;
    top: 12px;
    height: 30px;
    border-top: 4px solid rgba(255, 210, 120, 0.95);
    border-left: 4px solid rgba(255, 210, 120, 0.95);
    border-right: 4px solid rgba(255, 210, 120, 0.95);
    border-radius: 28px 28px 0 0;
}

.wire-visual::after {
    content: "V";
    position: absolute;
    left: 50%;
    top: 5px;
    transform: translateX(-50%);
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: rgba(20, 16, 14, 0.95);
    border: 2px solid rgba(255, 210, 120, 0.95);
    color: rgb(255, 220, 150);
    font-size: 13px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Give the canvas more breathing room between side panels */
.experiment-workspace {
    border-radius: 14px;
}

#experimentReactivityRailCard {
    position: fixed;
    right: 28px;
    top: 110px;
    z-index: 20;
    transition:
        opacity 0.18s ease,
        transform 0.18s ease,
        visibility 0.18s ease;
}

.experiment-reactivity-close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: 1px solid rgba(220, 180, 140, 0.55);
    background: rgba(20, 16, 14, 0.92);
    color: rgb(238, 172, 96);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.experiment-reactivity-close-btn:hover {
    background: rgba(238, 172, 96, 0.2);
}

.experiment-reactivity-toggle-btn {
    position: fixed;
    right: 28px;
    bottom: 86px;
    z-index: 21;
    display: none;
    border: 1px solid rgba(220, 180, 140, 0.75);
    border-radius: 999px;
    padding: 10px 14px;
    background: rgb(238, 172, 96);
    color: #1d120b;
    font-weight: 800;
    cursor: pointer;
}

.experiment-reactivity-toggle-btn:hover {
    background: rgb(255, 194, 120);
}

.experiment-lab-layout .hidden-apparatus {
    display: none !important;
}

.titration-controls input[type="number"] {
    width: 100%;
    height: 34px;
    padding: 5px 8px;
    border-radius: 8px;
    border: 1px solid rgba(220, 180, 140, 0.45);
    background: rgba(12, 10, 8, 0.9);
    color: #f5f0eb;
    box-sizing: border-box;
}

.experiment-input-with-unit {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px;
}

.experiment-input-with-unit span {
    color: rgb(220, 205, 190);
    font-size: 12px;
}

.titration-result-card {
    display: grid;
    gap: 5px;
    padding: 9px;
    margin: 9px 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.055);
    border-left: 4px solid rgba(255, 195, 95, 0.9);
}

#titrationEquation {
    font-family: Consolas, "Courier New", monospace;
    color: rgb(255, 232, 170);
}

/* Apparatus shelf previews */

.conical-flask-visual {
    position: relative;
    width: 58px;
    height: 62px;
    margin: 0 auto;
}

.conical-flask-visual::before {
    content: "";
    position: absolute;
    left: 22px;
    top: 1px;
    width: 14px;
    height: 25px;
    border: 3px solid rgba(225, 238, 246, 0.94);
    border-bottom: 0;
}

.conical-flask-visual::after {
    content: "";
    position: absolute;
    left: 7px;
    bottom: 2px;
    width: 44px;
    height: 39px;
    border: 3px solid rgba(225, 238, 246, 0.94);
    background: rgba(100, 180, 235, 0.20);
    clip-path: polygon(
        36% 0,
        64% 0,
        100% 100%,
        0 100%
    );
}

.pipette-visual {
    position: relative;
    width: 72px;
    height: 48px;
    margin: 0 auto;
}

.pipette-visual::before {
    content: "";
    position: absolute;
    left: 5px;
    right: 5px;
    top: 22px;
    height: 4px;
    border-radius: 999px;
    background: rgba(225, 238, 246, 0.94);
}

.pipette-visual::after {
    content: "";
    position: absolute;
    left: 26px;
    top: 14px;
    width: 20px;
    height: 18px;
    border-radius: 50%;
    border: 3px solid rgba(225, 238, 246, 0.94);
    background: rgba(110, 190, 240, 0.24);
}

.indicator-visual {
    position: relative;
    box-sizing: border-box;

    width: 36px;
    height: 46px;

    /*
     * The top margin provides room for the cap,
     * keeping the entire icon inside the shelf tile.
     */
    margin: 10px auto 2px;

    border-radius: 7px 7px 10px 10px;
    border: 3px solid rgba(245, 230, 210, 0.88);
    background: rgba(255, 170, 70, 0.42);
}

.indicator-visual::before {
    content: "";
    position: absolute;

    left: 50%;
    top: -8px;
    transform: translateX(-50%);

    width: 16px;
    height: 8px;

    background: rgba(100, 65, 40, 0.95);
    border-radius: 3px 3px 0 0;
}

.burette-visual {
    position: relative;
    width: 48px;
    height: 70px;
    margin: 0 auto;
}

.burette-visual::before {
    content: "";
    position: absolute;
    left: 22px;
    top: 1px;
    width: 5px;
    height: 56px;
    border-radius: 999px;
    background:
        linear-gradient(
            to bottom,
            rgba(225, 238, 246, 0.94) 0 15%,
            rgba(95, 175, 235, 0.92) 15% 100%
        );
}

.burette-visual::after {
    content: "";
    position: absolute;
    left: 10px;
    top: 51px;
    width: 29px;
    height: 5px;
    border-radius: 999px;
    background: rgba(245, 210, 150, 0.95);
}

@media (max-width: 980px) {
    .experiment-lab-layout {
        height: auto;
        min-height: 0;
    }

    .experiment-workspace {
        display: grid;
        grid-template-columns: 1fr;
        gap: 14px;
        overflow: visible;
        background: transparent;
    }

    .experiment-main-viewer,
    .experiment-floating-panel {
        position: static;
        width: 100%;
        max-height: none;
    }

    .experiment-main-viewer {
        height: 520px;
        background: rgba(5, 5, 5, 0.35);
        border-radius: 18px;
        overflow: hidden;
    }
}