/* Electromagnetic waves and energy flow: tool-specific styles only.
   Layout, cards, plots and teaching blocks come from simulation.css and optics-lab-theme.css. */

.emw-presets {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.emw-presets .preset-option {
    min-width: 0;
    white-space: normal;
    line-height: 1.25;
}

.emw-presets .preset-option.active {
    outline: 2px solid var(--optics-accent, #0f7f7a);
    outline-offset: 1px;
}

.emw-select-label {
    display: block;
    margin-bottom: 6px;
    font-size: .88rem;
    font-weight: 600;
    color: var(--text-primary);
}

.emw-select {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    font: inherit;
    font-size: .9rem;
    color: var(--text-primary);
    background: var(--surface-elevated, #f7f6fb);
    border: 1px solid var(--border-color, #dcd8eb);
    border-radius: 8px;
}

.emw-note {
    margin: 6px 0 0;
    font-size: .8rem;
    line-height: 1.45;
    color: var(--text-secondary);
}

.emw-note a {
    color: inherit;
    text-decoration: underline;
}

.control-group.is-disabled {
    opacity: .45;
}

/* legend under the 3-D view: shape + colour, so it reads without colour vision */
.emw-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 4px 16px;
    font-size: .82rem;
    line-height: 1.4;
    color: var(--optics-ink-2);
}

.emw-legend li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.emw-swatch {
    flex: 0 0 26px;
    height: 0;
    margin-top: .7em;
    border-top: 3px solid;
}

.emw-swatch.emw-e {
    border-color: #69f5e7;
}

.emw-swatch.emw-h {
    border-color: #f8d477;
    border-top-width: 3px;
    border-top-style: solid;
    box-shadow: 0 3px 0 -1px #f8d477;
}

.emw-swatch.emw-s {
    border-color: #f187c8;
    border-top-width: 4px;
}

.emw-swatch.emw-locus {
    border-top: 3px dotted #b8b2cf;
}

.emw-swatch.emw-probe {
    border-top: 2px dashed #b8b2cf;
}

body:not(.dark-mode) .emw-swatch.emw-e {
    border-color: #0f8c86;
}

body:not(.dark-mode) .emw-swatch.emw-h {
    border-color: #a37400;
    box-shadow: 0 3px 0 -1px #a37400;
}

body:not(.dark-mode) .emw-swatch.emw-s {
    border-color: #b8327f;
}

body:not(.dark-mode) .emw-swatch.emw-locus,
body:not(.dark-mode) .emw-swatch.emw-probe {
    border-color: #5f667b;
}

.emw-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
    padding: 0;
    margin: 0;
    background: none;
    border: 0;
}

.emw-related ul {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    padding-left: 18px;
}

#readouts dd {
    font-variant-numeric: tabular-nums;
}

/* long readout values: stack label over value in wider cells */
#readouts {
    grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr));
    gap: 10px 18px;
    padding: 12px;
    border-radius: 12px;
    background: var(--optics-card-bg);
    border: 1px solid var(--optics-card-border);
}

#readouts>div {
    flex-direction: column;
    justify-content: flex-start;
    gap: 2px;
}

#readouts dd {
    text-align: left;
    overflow-wrap: anywhere;
}

.emw-legend li>span:last-child {
    min-width: 0;
}