/* Sediment Sorter: a river restoration crew's test reach. Scene drawn by art.js (colours from the --ss-* properties below). */
html {
  --ss-sky1: #d5edf5; --ss-sky2: #a9d5e4; --ss-hill2: #8fb98a; --ss-grass1: #79ad68; --ss-grass2: #4f8a48;
  --ss-leaf1: #5e9e55; --ss-leaf2: #3b7239; --ss-trunk: #6b4a2b; --ss-reed: #4f7a35;
  --ss-water1: #5fb0cf; --ss-water2: #23708f; --ss-surf: #d6f1fb; --ss-streak: rgba(235, 250, 255, .75);
  --ss-ground1: #a07c53; --ss-ground2: #6c4e30; --ss-strata: #4f3820;
  --ss-pit1: #5a4128; --ss-pit2: #3c2a18; --ss-pit-line: #2b1d10;
  --ss-rock1: #b9b4aa; --ss-rock2: #6e6a63; --ss-rock-line: #45413c;
  --ss-log1: #b07a43; --ss-log2: #7a4e25; --ss-log-end: #d6a86e; --ss-log-line: #4a2e14;
  --ss-steel1: #eef1f3; --ss-steel2: #a7b1b8; --ss-steel-line: #56616a;
  --ss-plate: #ffffff; --ss-plate-line: #1d6a78; --ss-plate-text: #12333b; --ss-speed: #1d6a78;
  --ss-boulder: #77736d; --ss-boulder-l: #4a4743; --ss-gravel: #a49d8e; --ss-gravel-l: #6c6658;
  --ss-sand: #e6bf55; --ss-sand-l: #a9832a; --ss-silt: #c9a27a; --ss-silt-l: #8f6c48; --ss-clay: #b86a4e; --ss-clay-l: #7d3f2b;
  --ss-tag: rgba(255, 255, 255, .88); --ss-tag-text: #12333b;
  --ss-ink: #13262c; --ss-panel1: #f6fbfc; --ss-panel2: #e6f1f4; --ss-accent: #1d6a78; --ss-ok: #13704a; --ss-bad: #b3261e;
  --ss-card: #ffffff; --ss-line: #b8cbd1;
  --ss-dep: #c9b38a; --ss-dep-dot: #7d6334; --ss-tra: #9fd2e3; --ss-ero: #e59a7e; --ss-ero-line: #a54a2c;
}
html[data-theme="dark"] {
  --ss-sky1: #1e3440; --ss-sky2: #2c4f60; --ss-hill2: #33513a; --ss-grass1: #3c6a3a; --ss-grass2: #2a4d29;
  --ss-leaf1: #4d8a46; --ss-leaf2: #2e5a2d; --ss-trunk: #9a7552; --ss-reed: #7aa660;
  --ss-water1: #2f7f9f; --ss-water2: #154a60; --ss-surf: #8fd0e6; --ss-streak: rgba(200, 240, 255, .6);
  --ss-ground1: #5d4630; --ss-ground2: #3a2a1a; --ss-strata: #a88760;
  --ss-pit1: #2e2115; --ss-pit2: #1d140b; --ss-pit-line: #c6a57c;
  --ss-rock1: #8a857c; --ss-rock2: #4c4944; --ss-rock-line: #c8c2b8;
  --ss-steel1: #6f7a82; --ss-steel2: #434c53; --ss-steel-line: #c3ccd2;
  --ss-plate: #102a31; --ss-plate-line: #6fc6d6; --ss-plate-text: #eaf7fa; --ss-speed: #8fe0ee;
  --ss-tag: rgba(10, 28, 34, .85); --ss-tag-text: #eaf7fa;
  --ss-ink: #e7f2f4; --ss-panel1: #182a30; --ss-panel2: #12222a; --ss-accent: #6fc6d6; --ss-ok: #4fd08c; --ss-bad: #ff8a80;
  --ss-card: #1b2f36; --ss-line: #3f5a63;
  --ss-dep: #8a7650; --ss-dep-dot: #e3cf9f; --ss-tra: #2f6f86; --ss-ero: #9a4b33; --ss-ero-line: #f0a68a;
}

/* ── layout ── */
.ss { position: absolute; inset: 0; display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 12px; padding: 10px;
  color: var(--ss-ink); font-size: 16px; }
.ss *, .ss *::before { box-sizing: border-box; }
.ss input, .ss button { font: inherit; }
.ss-controls { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow: auto; padding: 10px 12px;
  background: linear-gradient(var(--ss-panel1), var(--ss-panel2)); border: 3px solid var(--ss-accent); border-radius: 14px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .16); }
.ss-controls > * { flex: none; }
.ss-right { display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 0; overflow: auto; }
.ss-kicker { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ss-accent); }
.ss-step { display: grid; gap: 4px; }
.ss-step-b { display: grid; gap: 4px; }
.ss-step-h { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 17px; line-height: 1.2; }
.ss-n { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ss-accent);
  color: var(--ss-panel1); font-size: 16px; font-weight: 800; }
.ss-step.is-done .ss-n { background: var(--ss-ok); }
.ss-note { margin: 0; line-height: 1.3; }
.ss-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }

/* sliders */
.ss-slider { display: grid; gap: 2px; }
.ss-slider-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 700; }
.ss-slider-v { font-weight: 800; color: var(--ss-accent); font-variant-numeric: tabular-nums; }
.ss-slider.is-unset .ss-slider-v { color: inherit; font-weight: 600; font-style: italic; opacity: .85; }
.ss-slider input[type="range"] { width: 100%; height: 24px; margin: 0; accent-color: var(--ss-accent); cursor: pointer; }
.ss-slider.is-unset input[type="range"] { accent-color: #8a979c; }
.ss-slider input:focus-visible, .ss-seg-b:focus-visible, .ss-num input:focus-visible, .ss-run:focus-visible,
.ss-scene:focus-visible, .ss summary:focus-visible { outline: 3px solid #b07800; outline-offset: 2px; }

/* bed sample */
.ss-bed { border-radius: 10px; overflow: hidden; border: 2px solid var(--ss-line); }
.ss-bed-svg { display: block; width: 100%; height: auto; }
.ss-seg-mark { margin-left: auto; }
.ss-seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.ss-seg-b { display: flex; flex-direction: column; align-items: center; gap: 0; min-height: 44px; padding: 3px 2px; border: 2px solid var(--ss-line);
  border-radius: 9px; background: var(--ss-card); color: var(--ss-ink); cursor: pointer; font-size: 16px; line-height: 1.1; }
.ss-seg-i { font-size: 16px; font-weight: 800; }
.ss-seg-b.is-on { border-color: var(--ss-accent); background: var(--ss-accent); color: var(--ss-panel1); font-weight: 700; }
.ss-seg-b:disabled { cursor: default; }
.ss-seg-b.is-truth { box-shadow: 0 0 0 3px var(--ss-ok); }
.ss-seg-b:disabled:not(.is-on) { opacity: .8; }

/* AP numbers */
.ss-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ss-num { display: grid; gap: 2px; }
.ss-num-l { display: flex; flex-wrap: wrap; gap: 4px; align-items: baseline; font-weight: 700; }
.ss-num-row { display: flex; align-items: center; gap: 4px; }
.ss-num input { width: 100%; min-width: 0; min-height: 40px; padding: 4px 8px; border: 2px solid var(--ss-line); border-radius: 8px;
  background: var(--ss-card); color: var(--ss-ink); font-variant-numeric: tabular-nums; }
.ss-num input:disabled { opacity: .85; }
.ss-unit { flex: none; font-size: 16px; }
.ss-seal { margin: 0; padding: 2px 8px; border-radius: 8px; background: var(--ss-card); border: 1px dashed var(--ss-line); line-height: 1.3; }

.ss-run { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; margin-top: 2px; padding: 8px 12px;
  border: 0; border-radius: 12px; background: var(--ss-accent); color: var(--ss-panel1); font-weight: 800; cursor: pointer;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .25); }
.ss-run:disabled { opacity: .55; cursor: default; box-shadow: none; }
.ss-run.is-done { background: var(--ss-ok); opacity: .9; }

.ss-mark { font-weight: 800; font-size: 16px; }
.ss-mark.is-ok { color: var(--ss-ok); }
.ss-mark.is-bad { color: var(--ss-bad); }

/* scene */
.ss-scene { flex: none; border-radius: 12px; overflow: hidden; border: 2px solid var(--ss-line); background: var(--ss-sky1); }
.ss-svg { display: block; width: 100%; height: auto; }
.ss-t { font-family: inherit; font-size: 18px; fill: var(--ss-ink); }
.ss-t-plate { font-weight: 700; fill: var(--ss-plate-text); }
.ss-t-speed { font-weight: 800; fill: var(--ss-speed); }
.ss-t-trap { font-weight: 800; fill: #fff; paint-order: stroke; stroke: rgba(0, 0, 0, .55); stroke-width: 3px; }
.ss-t-tag { font-size: 16px; font-weight: 700; fill: var(--ss-tag-text); }
.ss-t-bed { font-weight: 800; fill: #fff; paint-order: stroke; stroke: rgba(0, 0, 0, .5); stroke-width: 3px; }
.ss-t-bedg { font-size: 16px; font-weight: 700; fill: #fff; paint-order: stroke; stroke: rgba(0, 0, 0, .5); stroke-width: 3px; }
.ss-streak { fill: none; stroke: var(--ss-streak); stroke-width: 2.4; stroke-linecap: round; }
.ss-trap-glow { stroke: transparent; }
.ss-trap.is-win .ss-trap-glow { stroke: var(--ss-ok); animation: ss-glow 1s ease-in-out 2; }
@keyframes ss-glow { 50% { stroke-opacity: .2; } }
.ss-svg.is-running .ss-gate { transform: translateX(10px); transition: transform .2s; }

/* trap cards */
.ss-cards { flex: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.ss-card { padding: 5px 8px; border: 2px solid var(--ss-line); border-radius: 10px; background: var(--ss-card); line-height: 1.2; }
.ss-card p { margin: 0; }
.ss-card-h { display: flex; justify-content: space-between; gap: 4px; flex-wrap: wrap; }
.ss-card--out { border-style: dashed; }
.ss-card.is-ok { border-color: var(--ss-ok); }
.ss-card.is-bad { border-color: var(--ss-bad); }
.ss-card.is-flash { animation: ss-flash .5s ease-in-out 3; }
@keyframes ss-flash { 50% { box-shadow: 0 0 0 4px var(--ss-bad); } }

/* threshold chart */
.ss-chart { flex: none; position: relative; padding: 6px 10px 4px; border: 2px solid var(--ss-line); border-radius: 10px; background: var(--ss-card); }
.ss-chart-h { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 2px 12px; }
.ss-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.ss-key { display: inline-block; width: 22px; height: 14px; border-radius: 3px; border: 1px solid var(--ss-line); }
.ss-chart-b { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 0 8px; }
.ss-chart-l { display: grid; grid-template-rows: 20px repeat(5, 20px) 22px; align-items: center; }
.ss-row-l { display: flex; align-items: center; gap: 5px; white-space: nowrap; line-height: 1; }
.ss-row-l.is-absent b { font-weight: 400; }
.ss-axis-l { font-size: 16px; text-align: right; }
.ss-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .4); }
.ss-dot--boulder { background: var(--ss-boulder); width: 14px; height: 14px; }
.ss-dot--gravel { background: var(--ss-gravel); width: 12px; height: 12px; }
.ss-dot--sand { background: var(--ss-sand); width: 10px; height: 10px; }
.ss-dot--silt { background: var(--ss-silt); width: 8px; height: 8px; }
.ss-dot--clay { background: var(--ss-clay); width: 6px; height: 6px; }
.ss-plot { position: relative; display: grid; grid-template-rows: 20px repeat(5, 20px) 22px; align-items: center; }
.ss-track { position: relative; height: 14px; border-radius: 4px; overflow: hidden; }
.ss-track.is-absent { opacity: .5; }
.ss-z { position: absolute; top: 0; bottom: 0; }
.ss-z-dep { background-color: var(--ss-dep); background-image: radial-gradient(var(--ss-dep-dot) 1.2px, transparent 1.4px); background-size: 6px 6px; }
.ss-z-tra { background: var(--ss-tra); }
.ss-z-ero { background: repeating-linear-gradient(135deg, var(--ss-ero) 0 4px, var(--ss-ero-line) 4px 6px); }
.ss-axis { position: relative; height: 22px; border-top: 1px solid var(--ss-line); }
.ss-tick { position: absolute; top: 2px; transform: translateX(-50%); font-size: 16px; line-height: 1; white-space: nowrap; }
.ss-tick.is-first { transform: none; }
.ss-tick.is-last { transform: translateX(-100%); }
.ss-tick.is-minor { top: 0; width: 0; height: 6px; border-left: 1px solid var(--ss-line); }
.ss-tick:not(.is-minor)::before { content: ''; position: absolute; top: -2px; left: 50%; height: 6px; border-left: 1px solid var(--ss-line); }
.ss-tick.is-first::before { left: 0; } .ss-tick.is-last::before { left: 100%; }
.ss-reach-lines { position: absolute; left: 0; right: 0; top: 0; bottom: 22px; pointer-events: none; }
.ss-rl { position: absolute; top: 18px; bottom: 0; width: 0; border-left: 3px solid var(--ss-ink); }
.ss-rl-chip { position: absolute; top: -18px; left: -1px; display: grid; place-items: center; min-width: 20px; height: 18px; padding: 0 4px;
  border-radius: 9px; background: var(--ss-ink); color: var(--ss-card); font-size: 16px; font-weight: 800; line-height: 1; }

/* reference + about */
.ss-extras { flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: start; }
.ss-extras details { padding: 4px 10px; border: 2px solid var(--ss-line); border-radius: 10px; background: var(--ss-card); }
.ss-extras summary { cursor: pointer; font-weight: 700; }
.ss-extras details[open] { grid-column: 1 / -1; }
.ss-extras p { margin: 6px 0; line-height: 1.4; }
.ss-reference table { border-collapse: collapse; width: 100%; margin: 6px 0; font-size: 16px; }
.ss-reference caption { text-align: left; font-weight: 700; margin-bottom: 4px; }
.ss-reference th, .ss-reference td { padding: 4px 6px; border-bottom: 1px solid var(--ss-line); text-align: left; }
.ss-ex { border-collapse: collapse; width: 100%; font-size: 16px; }
.ss-ex caption { text-align: left; font-weight: 700; margin-bottom: 4px; }
.ss-ex th, .ss-ex td { padding: 4px 6px; border-bottom: 1px solid currentColor; text-align: left; }

/* assess: the catch only, no verdict colours */
.ss.is-assess .ss-card.is-ok, .ss.is-assess .ss-card.is-bad { border-color: var(--ss-line); }

@media (max-width: 900px) {
  .ss { position: static; grid-template-columns: 1fr; }
  .ss-controls, .ss-right { overflow: visible; }
  .ss-scene { overflow-x: auto; }
  .ss-svg { min-width: 720px; }
  .ss-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ss-chart { overflow-x: auto; }
  .ss-chart-b { min-width: 560px; }
  .ss-extras { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .ss *, .ss *::before { animation: none !important; transition: none !important; }
}
