:root {
    color-scheme: light;
    --ink: #233436;
    --muted: #536967;
    --edge: #d4dfdc;
    --accent: #105d52;
    --paper: #f7f9f8;
    font: 14px/1.4 "Trebuchet MS", sans-serif;
    color: var(--ink);
    background: var(--paper);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
.workspace { display: flex; height: 100dvh; }
moorhen-web-component { display: block; flex: 1 1 auto; min-width: 0; min-height: 0; }
.panel {
    flex: 0 0 328px;
    min-width: 0;
    padding: 14px 16px;
    border-left: 1px solid var(--edge);
    overflow: auto;
}
.panel:not([open]) { flex-basis: 124px; }
summary { cursor: pointer; }
.panel > summary {
    font-size: 19px;
    font-weight: 700;
    padding-bottom: 10px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--edge);
}
form { display: grid; gap: 7px; }
label, .input-heading, legend { font-weight: 600; }
.input-heading, .cycle-input, .progress-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
select, input, button {
    font: inherit;
    color: inherit;
    min-width: 0;
}
select, input[type=number], button {
    border: 1px solid var(--edge);
    border-radius: 5px;
    padding: 6px 8px;
    background: white;
}
input[type=number] { width: 62px; }
input[type=file] { width: 100%; font-size: 13px; }
input[type=file]::file-selector-button {
    font: inherit;
    color: inherit;
    margin-right: 6px;
    padding: 5px 7px;
    background: #fff;
    border: 1px solid var(--edge);
    border-radius: 5px;
    cursor: pointer;
}
select { width: 100%; }
button { cursor: pointer; font-weight: 600; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .52; cursor: default; }
button.primary { color: white; background: var(--accent); border-color: var(--accent); }
.text-button, .downloads button {
    color: var(--accent);
    border: 0;
    background: transparent;
}
.text-button:hover:not(:disabled), .downloads button:hover:not(:disabled) { text-decoration: underline; }
:focus-visible { outline: 2px solid #0b7264; outline-offset: 2px; }
.columns { display: grid; gap: 6px; margin: 6px 0; }
.columns label { display: grid; grid-template-columns: 90px 1fr; align-items: center; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.run-controls { display: grid; gap: 8px; margin-top: 3px; }
#status { min-height: 1.4em; margin: 8px 0; color: var(--muted); overflow-wrap: anywhere; }
#status[data-error] { color: #9e342b; }
#progress, #results { border-top: 1px solid var(--edge); padding-top: 10px; margin-top: 10px; }
#results { display: grid; gap: 8px; }
#comparison h2 { margin: 0 0 6px; font-size: 14px; }
.comparison-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px;
    padding: 3px;
    background: #eaf0ee;
    border: 1px solid var(--edge);
    border-radius: 7px;
}
.comparison-switch button { border-color: transparent; background: transparent; }
.comparison-switch button[aria-pressed=true] { color: var(--accent); background: white; border-color: var(--edge); }
#use-refined { padding: 5px 0 0; }
#result-maps { padding: 0; margin: 0; border: 0; min-width: 0; }
#result-maps legend { padding: 0; }
#result-maps { margin-block: 3px 0; }
.hint, .map-reflections { color: var(--muted); font-size: 12px; }
.hint, .map-reflections { margin: 0; }
.map-basis { font-size: 13px; font-weight: 600; margin: 3px 0 0; overflow-wrap: anywhere; }
.map-reflections { margin-bottom: 5px; overflow-wrap: anywhere; }
.map-toggles { display: grid; gap: 1px; }
.map-toggles label { display: flex; align-items: center; min-height: 30px; gap: 7px; font-weight: 400; }
.map-toggles input { accent-color: var(--accent); margin: 0; }
.formula { margin-inline-start: 4px; color: var(--muted); white-space: nowrap; }
.map-level { margin-inline-start: auto; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.map-key { width: 8px; height: 8px; border-radius: 2px; background: var(--map-colour); flex: none; }
.weighted-key { --map-colour: var(--weighted-colour, #5557aa); }
.positive-key { --map-colour: var(--positive-colour, #66cc66); }
.negative-key { --map-colour: var(--negative-colour, #cc6666); }
.difference-key { padding-left: 19px; display: flex; flex-wrap: wrap; gap: 2px 10px; color: var(--muted); font-size: 12px; }
.difference-key span { display: inline-flex; align-items: center; gap: 4px; }
#other-maps { margin-top: 6px; }
.downloads { color: var(--muted); }
.downloads button { padding-inline: 0; }
.downloads .actions { gap: 12px; }
.progress-heading { flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.work { color: var(--accent); }
.free { color: #ad4827; }
canvas { display: block; width: 100%; height: auto; margin-top: 4px; }
.cycle-table { max-height: 155px; overflow: auto; }
table { font-variant-numeric: tabular-nums; width: 100%; border-collapse: collapse; }
td, th { padding: 3px 5px; text-align: right; }
thead { border-bottom: 1px solid var(--edge); }
@media (max-width: 780px) {
    .workspace { flex-direction: column; }
    .panel, .panel:not([open]) {
        flex: 0 0 auto;
        max-height: 45dvh;
        border-left: 0;
        border-top: 1px solid var(--edge);
    }
    .panel:not([open]) > summary { margin: 0; padding: 0; border: 0; }
}
