.photodiode-lab {
    --lab-ink: #24211d;
    --lab-muted: #6a6258;
    --lab-paper: #fffdf7;
    --lab-wash: #f4ede0;
    --lab-rule: #d7c8b2;
    --lab-maroon: #7b1e24;
    --lab-gold: #c18b2e;
    margin: 1.5rem 0 2rem;
    color: var(--lab-ink);
    border: 1px solid var(--lab-rule);
    border-radius: 5px;
    background:
        linear-gradient(135deg, rgba(123, 30, 36, 0.045), transparent 32%),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 27px,
            rgba(72, 59, 43, 0.035) 28px
        ),
        var(--lab-paper);
    box-shadow: 0 12px 35px rgba(61, 45, 30, 0.11);
    overflow: hidden;
}

.photodiode-lab__loading {
    margin: 0;
    padding: 2rem;
}

.photodiode-lab__header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 0.55fr);
    gap: 1.25rem;
    align-items: end;
    padding: 1.5rem 1.75rem;
    color: #fffaf0;
    background:
        radial-gradient(circle at 88% -30%, #c18b2e 0, transparent 38%),
        #54161b;
}

.photodiode-lab__eyebrow {
    margin: 0 0 0.25rem;
    color: #e8c987;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.photodiode-lab__title {
    margin: 0;
    color: inherit;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.55rem, 3vw, 2.35rem);
    font-weight: 500;
    line-height: 1.08;
}

.photodiode-lab__chooser label {
    display: block;
    margin-bottom: 0.35rem;
    color: #f0ddba;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.photodiode-lab__chooser select {
    width: 100%;
    min-height: 2.65rem;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    color: var(--lab-ink);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 3px;
    background: #fffdf7;
    font-size: 0.95rem;
}

.photodiode-lab__body {
    display: grid;
    grid-template-columns: minmax(235px, 0.34fr) minmax(0, 1fr);
    min-height: 560px;
}

.photodiode-lab__controls {
    padding: 1.4rem 1.25rem;
    border-right: 1px solid var(--lab-rule);
    background: rgba(244, 237, 224, 0.78);
}

.photodiode-lab__controls h4 {
    margin: 0 0 1rem;
    color: var(--lab-maroon);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.1rem;
}

.photodiode-lab__control {
    margin-bottom: 1.25rem;
}

.photodiode-lab__control-head {
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.3rem;
}

.photodiode-lab__control label {
    color: var(--lab-ink);
    font-size: 0.82rem;
    font-weight: 700;
}

.photodiode-lab__value {
    color: var(--lab-maroon);
    font-family: "Courier New", monospace;
    font-size: 0.78rem;
    white-space: nowrap;
}

.photodiode-lab input[type="range"] {
    width: 100%;
    height: 1.2rem;
    margin: 0;
    accent-color: var(--lab-maroon);
    cursor: ew-resize;
}

.photodiode-lab__control-scale {
    display: flex;
    justify-content: space-between;
    color: var(--lab-muted);
    font-size: 0.67rem;
}

.photodiode-lab__stage {
    min-width: 0;
    padding: 1.25rem 1.5rem 1.4rem;
}

.photodiode-lab__note {
    min-height: 3.4em;
    margin: 0 0 0.85rem;
    color: var(--lab-muted);
    font-size: 0.88rem;
    line-height: 1.45;
}

.photodiode-lab__plot-wrap {
    position: relative;
    border: 1px solid #ded5c8;
    background: rgba(255, 255, 255, 0.88);
}

.photodiode-lab__plot {
    display: block;
    width: 100%;
    height: auto;
    min-height: 370px;
}

.photodiode-lab__plot text {
    fill: #4a443d;
    font-family: "Courier New", monospace;
    font-size: 12px;
}

.photodiode-lab__plot .axis-label {
    fill: #24211d;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 15px;
}

.photodiode-lab__plot .grid {
    stroke: #ded8cf;
    stroke-width: 1;
}

.photodiode-lab__plot .axis {
    stroke: #665e55;
    stroke-width: 1.25;
}

.photodiode-lab__plot .axis--zero {
    stroke: #342f29;
    stroke-width: 1.8;
}

.photodiode-lab__plot .curve {
    fill: none;
    stroke-width: 3;
    vector-effect: non-scaling-stroke;
}

.photodiode-lab__legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 1rem;
    margin-top: 0.8rem;
    font-size: 0.76rem;
}

.photodiode-lab__legend-item {
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
}

.photodiode-lab__swatch {
    width: 1.5rem;
    height: 3px;
    background: var(--swatch);
}

.photodiode-lab__readouts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
    margin-top: 1rem;
}

.photodiode-lab__readout {
    padding: 0.65rem 0.75rem;
    border-left: 3px solid var(--lab-gold);
    background: #f7f1e6;
}

.photodiode-lab__readout dt {
    margin: 0 0 0.18rem;
    color: var(--lab-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.photodiode-lab__readout dd {
    margin: 0;
    color: var(--lab-maroon);
    font-family: "Courier New", monospace;
    font-size: 0.86rem;
}

@media (max-width: 850px) {
    .photodiode-lab__header,
    .photodiode-lab__body {
        grid-template-columns: 1fr;
    }

    .photodiode-lab__controls {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0 1rem;
        border-right: 0;
        border-bottom: 1px solid var(--lab-rule);
    }

    .photodiode-lab__controls h4 {
        grid-column: 1 / -1;
    }

    .photodiode-lab__readouts {
        grid-template-columns: 1fr;
    }
}
