/* Paper-white, dark neutral ink, one accent colour, hairline strokes. No effects. */
:root {
  --paper: #fbfaf7;
  --ink: #1c1b19;
  --ink2: #5b5a55;
  --line: #d9d7d0;
  --accent: #c2452d;
  --accent-ink: #9c3521;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 16px; line-height: 1.45; color: var(--ink); background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; padding: 20px 24px 28px; max-width: 1500px; margin-inline: auto; }
header h1 { font-size: 26px; font-weight: 600; margin: 0 0 4px; letter-spacing: -0.01em; }
.lede { margin: 0 0 16px; color: var(--ink2); max-width: 70ch; font-size: 17px; }
h2 { font-size: 16px; font-weight: 600; margin: 0; }

main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: auto 1fr; gap: 14px 16px; align-items: start; }
#stage { position: relative; border: 1px solid var(--line); min-height: 380px; height: calc(100vh - 430px); overflow: hidden; background: var(--paper); }
#view { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#view.dragging { cursor: grabbing; }
#marks { position: absolute; inset: 0; pointer-events: none; }
.mark { position: absolute; transform: translate(-50%, -50%); font-size: 13px; font-weight: 600; line-height: 1; white-space: nowrap; }
.mark.rec { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); display: grid; place-items: center; }
.mark.electrode { transform: translate(-50%, -100%); color: var(--accent-ink); display: flex; flex-direction: column; align-items: center; }
.mark.electrode::after { content: ""; width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 16px solid var(--accent); margin-top: 3px; }
.mark.electrode span { background: var(--paper); padding: 1px 4px; border: 1px solid var(--accent); }
#clock { position: absolute; top: 12px; left: 14px; font-size: 22px; font-variant-numeric: tabular-nums; }
#clock span { font-weight: 600; }
#scalebar { position: absolute; left: 14px; bottom: 44px; font-size: 13px; color: var(--ink2); display: flex; flex-direction: column; gap: 3px; }
#scaleline { display: block; height: 0; border-top: 1px solid var(--ink); width: 100px; }
#ramp { position: absolute; right: 14px; top: 12px; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink2); }
#ramp i { display: block; width: 46px; height: 6px; background: linear-gradient(90deg, #d3d9de, #7b7a74); }
#ramp i.hot { background: linear-gradient(90deg, #7b7a74, #b05a3d 30%, var(--accent)); }
#hint { position: absolute; left: 14px; bottom: 10px; margin: 0; font-size: 13px; color: var(--ink2); }
#message { position: absolute; right: 14px; bottom: 10px; margin: 0; font-size: 14px; color: var(--accent-ink); max-width: 50%; text-align: right; }

#panel { display: flex; flex-direction: column; gap: 10px; grid-row: span 2; }
fieldset { border: 1px solid var(--line); margin: 0; padding: 6px 14px 10px; min-width: 0; }
legend { font-weight: 600; padding: 0 6px; font-size: 15px; }
label { display: block; margin: 6px 0 0; }
label.inline { display: inline; margin-right: 6px; }
label.switch { display: flex; gap: 8px; align-items: flex-start; }
label.switch input { margin-top: 3px; flex: none; }
label.choice { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
label.file { font-size: 14px; color: var(--ink2); }
label.file input { display: block; margin-top: 4px; font-size: 13px; max-width: 100%; }
select, input[type=number], button { font: inherit; color: inherit; background: var(--paper); border: 1px solid var(--ink2); border-radius: 0; padding: 5px 8px; }
select { width: 100%; }
input[type=number] { width: 4.4em; padding: 3px 6px; }
input[type=range] { width: 100%; accent-color: var(--accent); margin: 4px 0 0; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; }
output { float: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.row { display: flex; gap: 8px; }
button { cursor: pointer; padding: 7px 14px; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; min-width: 7em; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.small { font-size: 14px; margin: 8px 0 0; }
.quiet { color: var(--ink2); }
#source { font-size: 12.5px; line-height: 1.4; margin: 4px 0 0; }
details { margin-top: 6px; font-size: 14px; }
summary { cursor: pointer; color: var(--ink2); }

#traces { border: 1px solid var(--line); padding: 10px 14px 8px; min-width: 0; }
.traceshead { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; }
#reclist { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; padding: 0; font-size: 14px; }
#reclist li { display: flex; align-items: center; gap: 6px; }
#reclist .num { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--ink); display: inline-grid; place-items: center; font-size: 12px; font-weight: 600; }
#reclist .num.el { border-color: var(--accent); color: var(--accent-ink); }
#reclist button { border: 0; padding: 0 4px; color: var(--ink2); font-size: 16px; line-height: 1; }
#plot { width: 100%; height: 210px; display: block; margin-top: 6px; }

footer { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 10px; font-size: 14.5px; max-width: 95ch; }
footer p { margin: 0 0 6px; }
a { color: var(--accent-ink); }

@media (max-width: 900px) {
  main { grid-template-columns: 1fr; }
  #panel { grid-row: auto; }
  #stage { height: 56vh; min-height: 380px; }
  #hint { display: none; }
}
