/* Acid-Base Titration Simulator – 800px three-column, Flexbox/Grid hybrid */
.titration-lab {
    font-family: 'Courier New', Courier, monospace;
    max-width: 800px;
    margin: 0 auto;
    background: #000;
    color: #ccc;
    padding: 15px;
    border: 1px solid #333;
    box-sizing: border-box;
}

.titration-main-layout {
    display: grid;
    grid-template-columns: 240px 140px 1fr;
    gap: 15px;
    align-items: start;
}

/* Left Column: Buffer & Acid Controls */
.titration-controls-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #111;
    padding: 10px;
    border-radius: 4px;
    font-size: 11px;
    height: 520px;
}

.titration-controls-panel select {
    font-family: 'Courier New', Courier, monospace;
    background: #222;
    color: #ccc;
    border: 1px solid #444;
    padding: 4px 8px;
    width: 100%;
}

.titration-row {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 5px;
}
.titration-row label { min-width: 0; flex-shrink: 0; font-size: inherit; }
.titration-row input[type="range"] { flex: 1; min-width: 0; }
.titration-val { color: #7ec8e3; font-weight: bold; flex-shrink: 0; min-width: 28px; font-size: inherit; }

.titration-buffer-heading {
    font-size: 10px;
    color: #888;
    margin: 6px 0 2px 0;
}

/* Compact Buffer Rows */
.titration-buffer-row {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    margin-bottom: 2px;
}
.titration-buffer-label {
    flex-shrink: 0;
    width: 20px;
    color: #888;
}
.titration-buffer-row input[type="range"] {
    flex: 1;
    min-width: 0;
    max-width: 55px;
}

.titration-chart-options {
    font-size: 10px;
    color: #888;
}
.titration-chart-options label { cursor: pointer; }
.titration-chart-options input[type="checkbox"] { margin-right: 4px; }

.titration-detail {
    font-size: 10px;
    color: #fff;
    margin-top: 4px;
}

/* Middle Column: Beaker Viz & pH readout */
.titration-visual-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-left: 270px;
}

.titration-beaker-wrap {
    position: relative;
    width: 120px;
    height: 160px;
}
.titration-beaker {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 140px;
    border: 2px solid #555;
    border-radius: 0 0 8px 8px;
    background: rgba(40,40,40,0.6);
    overflow: hidden;
}
.titration-beaker-liquid {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30%;
    transition: background-color 0.15s ease, height 0.2s ease;
    border-radius: 0 0 6px 6px;
}
.titration-burette {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 80px;
    border: 2px solid #555;
    border-radius: 0 0 4px 4px;
    background: rgba(30,30,30,0.8);
}

.titration-ph-large {
    font-size: 28px;
    color: #7ec8e3;
    font-weight: bold;
    margin-top: 10px;
}

/* Right Column: Chart */
.titration-chart-panel {
    min-width: 0;
}

.titration-chart-wrap {
    position: relative;
    width: 130%;
    margin-left: -130px;
    margin-top: 230px;
}

.titration-chart-wrap canvas {
    display: block;
    width: 100% !important;
    height: 300px !important;
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 4px;
}

.titration-chart-xscale {
    position: absolute;
    top: 4px;
    left: 4px;
    z-index: 2;
    display: flex;
    gap: 0;
}
.titration-scale-btn {
    font-family: 'Courier New', Courier, monospace;
    font-size: 11px;
    padding: 2px 8px;
    background: #222;
    color: #888;
    border: 1px solid #444;
    cursor: pointer;
}
.titration-scale-btn:first-child { border-radius: 4px 0 0 4px; }
.titration-scale-btn:last-child { border-radius: 0 4px 4px 0; border-left-width: 0; }
.titration-scale-btn:hover { color: #ccc; background: #333; }
.titration-scale-btn.active {
    background: #333;
    color: #7ec8e3;
    border-color: #555;
}

.titration-math-panel {
    margin-top: 16px;
    padding: 12px;
    background: #0d0d0d;
    border: 1px solid #333;
    border-radius: 4px;
    font-size: 14px;
    color: #fff;
    line-height: 1.5;
}
.titration-math-title {
    font-weight: bold;
    color: #fff;
    margin-bottom: 8px;
    font-size: 16px;
}
.titration-math-panel .titration-math-line {
    margin: 4px 0;
}
.titration-math-panel .titration-math-num {
    color: #fff;
    font-family: 'Courier New', Courier, monospace;
}

@media (max-width: 700px) {
    .titration-main-layout {
        grid-template-columns: 1fr;
    }
}
