/* Page chrome for the library and designer. Tokens follow styles.css; one class per theme on <body>. */
.ui-dark  { --page:#1a1918; --text:#f3f2f2; --muted:rgba(243,242,242,.7); --rule:rgba(243,242,242,.4); --hair:rgba(243,242,242,.15); --active:var(--color-accent); --kicker:var(--color-accent-400); --field:rgba(255,255,255,.04); --warn:#ff8a78; }
.ui-gold  { --page:#101010; --text:#f3f2f2; --muted:rgba(243,242,242,.7); --rule:rgba(217,164,65,.5); --hair:rgba(243,242,242,.14); --active:#0a7d50; --kicker:#e3bb67; --field:rgba(255,255,255,.04); --warn:#ff8a78; }
.ui-light { --page:#f3f2f2; --text:#201e1d; --muted:#5b5856; --rule:#201e1d; --hair:rgba(32,30,29,.2); --active:var(--color-accent); --kicker:var(--color-accent-700); --field:#fff; --warn:#b3261e; }
body { background:var(--page); color:var(--text); --line:color-mix(in srgb, var(--text) 70%, transparent); }   /* --line: control borders */

.wrap { max-width:1600px; margin:0 auto; padding:32px 24px 64px; display:flex; flex-direction:column; gap:20px; }
.top { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:flex-start; gap:16px 32px; padding-bottom:4px; }
.intro { flex:1 1 480px; min-width:0; display:flex; flex-direction:column; gap:8px; }
.intro h1 { margin:0; font-size:34px; line-height:1.05; }
.intro p { margin:0; max-width:680px; font-size:15px; line-height:1.5; text-wrap:pretty; }
.nav { display:flex; gap:8px 16px; flex-wrap:wrap; font-size:13px; font-weight:600; letter-spacing:.08em; text-transform:uppercase; }
.nav a { color:var(--muted); text-decoration:none; }
.nav a:hover { color:var(--active); }
.nav .on, .nav a.on:hover { color:var(--kicker); border-bottom:2px solid var(--kicker); }
.cap { font-size:11px; font-weight:600; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); }
.hint { color:var(--muted); font-size:13px; line-height:1.45; margin:0 0 8px; }
.status { font-size:13px; color:var(--muted); }
.export { display:flex; flex-direction:column; align-items:flex-start; gap:6px; }
.btns { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.export .btns > .cap { flex:none; width:64px; }
.bar { display:flex; flex-wrap:wrap; gap:12px 32px; align-items:center; border-bottom:1px solid var(--hair); padding-bottom:14px; }
.grp { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.grp[hidden], .seg[hidden] { display:none; }
.seg { display:flex; flex-wrap:wrap; }
.seg button + button { margin-left:-1px; }

button { font:600 13px var(--font-body); padding:6px 12px; border:1px solid var(--line); background:transparent; color:var(--text); cursor:pointer; border-radius:0; text-align:left; }
button:hover { border-color:var(--active); position:relative; }
button[aria-pressed="true"] { background:var(--active); border-color:var(--active); color:#fff; position:relative; }
button.primary { background:var(--active); border-color:var(--active); color:#fff; font-weight:700; font-size:14px; padding:8px 14px; }
button.outline { border-color:var(--active); font-weight:700; font-size:14px; padding:8px 14px; }
button.tight { padding:4px 10px; font-size:12px; }
button.info { width:28px; height:28px; padding:0; border-radius:50%; text-align:center; font:700 15px/1 Georgia, serif; flex:none; }
.intro h1 .info { margin-left:12px; vertical-align:middle; }
.play .pctl button.info { min-width:0; }
.infobody { font-size:14px; line-height:1.5; }
.infobody ul { margin:0 0 10px; padding-left:20px; }
.infobody li { margin-bottom:4px; }
.infobody p { margin:0 0 6px; }
.infobody code { font:13px ui-monospace,Consolas,monospace; }
input, textarea, select { font:500 13px var(--font-body); color:var(--text); background:var(--field); border:1px solid var(--hair); border-radius:0; padding:6px 8px; min-width:0; }
select { border:1px solid var(--line); background:var(--page); padding:6px 8px; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible { outline:2px solid var(--active); outline-offset:2px; }

/* preview + form */
.grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(460px,1fr); gap:24px; align-items:start; }
#previewCol { position:sticky; top:12px; height:calc(100vh - 24px); display:flex; flex-direction:column; min-width:0; }
#previewBar { display:flex; flex-wrap:wrap; gap:6px 12px; align-items:center; padding:10px 14px; font-size:13px; }
#previewBar .hint { margin:0 auto 0 0; }
.turn { display:flex; align-items:center; gap:4px; color:var(--muted); }
.turn #turnName { margin-right:4px; font-size:12px; }
.fplrows { display:grid; grid-template-columns:64px minmax(0,1fr) auto auto; gap:6px 8px; align-items:center; margin-top:14px; }
.fplid { font-size:13px; font-weight:700; white-space:nowrap; }
.xchk.fpown { margin:14px 0 8px; }
#warnSum { color:var(--warn); font-weight:600; }
/* the drawing scales to fit the preview box (viewBox + preserveAspectRatio), never past it */
#stage { flex:1; min-height:0; position:relative; touch-action:none; }
#stage > p { margin:6px 14px; }
#stage > svg, #stage > .duo { position:absolute; inset:4px 14px 14px; width:calc(100% - 28px); height:calc(100% - 18px); display:block; }
#stage .duo { display:flex; gap:12px; }
#stage .duo > svg { flex:1 1 0; min-width:0; height:100%; }
#stage [data-key] { cursor:grab; }
#stage.dragging, #stage.dragging [data-key] { cursor:grabbing; }

#formCol h2 { font-size:15px; font-weight:700; margin:26px 0 6px; padding-top:12px; border-top:1px solid var(--hair); }
#formCol > h2:first-child { margin-top:0; border-top:0; padding-top:0; }
.meta { display:grid; grid-template-columns:1fr 1fr 110px; gap:8px; }
.meta .full { grid-column:1/-1; }
.meta label span { display:block; font-size:12px; color:var(--muted); margin-bottom:2px; }
.meta input, .meta textarea { width:100%; }
.meta textarea { min-height:56px; resize:vertical; }
.meta.links { grid-template-columns:1fr 1fr; margin-top:8px; }
.meta textarea.code { font:12px/1.4 ui-monospace,Consolas,monospace; min-height:84px; }
.fprow { display:flex; align-items:center; gap:8px; margin-top:10px; flex-wrap:wrap; }
.fprow .hint { margin:0; }
.builds { margin-top:8px; display:grid; gap:6px; }
.builds .xchk { margin:0 0 4px; }
.build { display:flex; flex-wrap:wrap; align-items:center; gap:4px 14px; padding:6px 10px; border:1px solid var(--hair); }
.build.on { border-color:var(--kicker); }
.build .hint { margin:0; flex:1 1 160px; }
.lgrid { display:grid; gap:0 8px; align-items:start; }
.colhead { font-size:12px; color:var(--muted); padding:2px 0 4px; border-bottom:1px solid var(--hair); margin-bottom:4px; }
.rowid { font-size:13px; font-weight:700; padding:6px 0 0; cursor:pointer; white-space:nowrap; display:flex; flex-direction:column; line-height:1.15; overflow:hidden; }
.rowid small { font-size:11px; font-weight:500; color:var(--muted); text-overflow:ellipsis; overflow:hidden; }
.rowid .mtype { align-self:flex-start; margin-top:2px; padding:0 5px; font-size:10px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; border-width:1px; border-color:currentColor; color:inherit; }
.cell { padding:3px 0; }
.cell input { width:100%; font-size:14px; }
.cell input.l2 { font-size:13px; }
.cell input.modin { border-left:3px solid var(--mcol); }
.cell input.own { box-shadow:inset 0 -2px 0 var(--kicker); }
.meta.modes { grid-template-columns:repeat(auto-fit,minmax(130px,1fr)); }
.meta.modes select { width:100%; }
.modebar { position:sticky; top:0; z-index:5; display:flex; flex-wrap:wrap; align-items:center; gap:6px 12px; margin:0 0 12px; padding:8px 0 10px; background:var(--page); border-bottom:1px solid var(--kicker); }
.modebar .hint { margin:0; flex:1 1 260px; }
.cell input.midi { font:13px ui-monospace,Consolas,monospace; }
.cell input.midi.bad { border-color:var(--warn); }
.tog { display:flex; align-items:center; justify-content:center; padding-top:7px; }
.tog input { appearance:none; -webkit-appearance:none; width:18px; height:18px; border:2px solid var(--muted); border-radius:50%; margin:0; padding:0; cursor:pointer; background:var(--field); }
.tog input:checked { border-color:var(--mc,currentColor); background:radial-gradient(circle,var(--mc,currentColor) 0 45%,transparent 50%); }
.tog input:disabled { opacity:.35; cursor:not-allowed; }
.rowline { display:contents; }
.rowline.hi > * { background:var(--hair); }
.rowmsg { grid-column:1/-1; font-size:12px; color:var(--warn); margin:-2px 0 4px; }
.rowmsg:empty { display:none; }
.cgrid { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.3fr) auto auto; gap:6px 8px; align-items:center; margin-bottom:8px; }
.cgrid .cstyle { grid-column:1/-1; padding:4px 0 14px; }
.notesgrid { display:grid; gap:12px; }
textarea.notes { min-height:220px; resize:vertical; font:13px/1.5 ui-monospace,Menlo,monospace; width:100%; }
.notesprev { border:1px solid var(--hair); padding:12px 14px; }

/* design */
.design { margin-top:26px; border-top:1px solid var(--hair); padding-top:12px; }
.design summary { cursor:pointer; font-size:15px; font-weight:700; }
.dgrid { display:grid; gap:6px; padding:12px 0; max-width:520px; }
.dc { display:grid; grid-template-columns:170px minmax(0,1fr) 40px; align-items:center; gap:8px; font-size:13px; }
.dcol, .dhead { display:grid; grid-template-columns:170px minmax(0,1fr) minmax(0,1fr); align-items:center; gap:8px; font-size:13px; }
.dhead { color:var(--muted); margin-top:8px; }
.dgrid input[type=range] { accent-color:var(--active); padding:0; border:0; background:none; }
.dgrid input[type=color] { width:100%; height:26px; padding:0; border:1px solid var(--hair); background:none; }
.dgrid input.code { font:13px ui-monospace,Consolas,monospace; }
.dgrid input.bad { border-color:var(--warn); }
.dc output { text-align:right; font-variant-numeric:tabular-nums; }

/* font modal */
dialog { background:var(--page); color:var(--text); border:1px solid var(--line); box-shadow:6px 6px 0 var(--active); padding:24px; width:min(100% - 32px,540px); }
dialog::backdrop { background:rgba(0,0,0,.65); }
.modal { display:flex; flex-direction:column; gap:10px; }
.modal input { width:100%; font-size:14px; padding:8px 10px; border:1px solid var(--line); }
.mhead { display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid var(--hair); padding-bottom:10px; font:800 20px var(--font-heading); }
.mfoot { display:flex; justify-content:flex-end; gap:8px; padding-top:4px; }
.chips { display:flex; flex-wrap:wrap; gap:6px; }
.chips button { font-size:12px; padding:4px 8px; border-width:1px; border-color:var(--rule); }
.fpreview { border:1px solid var(--hair); padding:12px; display:flex; flex-direction:column; gap:6px; }
/* upload to device: the advice for the firmware, then the buttons that write it */
.flashgo { display:flex; flex-wrap:wrap; align-items:center; gap:8px 12px; }
.flashgo button:disabled { opacity:.45; cursor:not-allowed; }
.flashgo progress { flex:1 1 140px; min-width:120px; }
.flashgo .status { flex:1 1 100%; font-size:13px; }
.flashgo .status.err { color:var(--warn); }
.flashgo .status.ok { color:var(--ok); font-weight:700; }
dialog.flash { --ok:#2fae7a; }
.ui-light dialog.flash { --ok:#0a7d50; }
dialog.flash li.done { color:var(--muted); }
dialog.flash li.done::marker { content:"✓ "; color:var(--ok); font-weight:700; }
dialog.flash summary { cursor:pointer; font-weight:700; font-size:14px; }
dialog.flash details > input { margin-top:8px; }
dialog.flash select { width:100%; }
dialog.flash { width:min(100% - 32px,820px); max-height:calc(100vh - 32px); }
dialog.flash ol { margin:6px 0; padding-left:1.4em; }
dialog.flash li { margin:.3em 0; }
.notice.warn { border-color:var(--warn); }
.flashwarn { color:var(--warn); }
/* community directory entry */
dialog.dir { width:min(100% - 32px,640px); }
/* web app: the steps to put it on GitHub Pages */
dialog.app { width:min(100% - 32px,820px); max-height:calc(100vh - 32px); }
#appSteps h2 { font-size:20px; margin-top:.4em; }
#appSteps h3 { font-size:16px; }
#appSteps ol, #appSteps ul { padding-left:1.4em; }
#appSteps li { margin:.35em 0; }
/* repository kit: options, then the image and the README side by side */
dialog.kit { width:min(100% - 32px,1240px); max-height:calc(100vh - 32px); }
.kitopts { display:flex; flex-wrap:wrap; gap:10px 28px; align-items:center; }
.kitbody { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.3fr); gap:16px; align-items:start; }
.kitimg { margin:0; display:flex; flex-direction:column; gap:6px; }
.kitimg figcaption { font-family:ui-monospace,Consolas,monospace; text-transform:none; letter-spacing:0; font-weight:500; color:var(--muted); }
#kitImg { border:1px solid var(--hair); min-height:160px; display:flex; align-items:center; justify-content:center; }
#kitImg img { display:block; width:100%; height:auto; }
.kitreadme { display:flex; flex-direction:column; gap:6px; min-width:0; }
.kithead { display:flex; justify-content:space-between; align-items:center; gap:8px; }
.kitmd { border:1px solid var(--hair); padding:14px 16px; max-height:min(62vh,640px); overflow:auto; }
pre.kitmd { margin:0; }
.kitmd img { max-width:100%; height:auto; }
.kitfiles ul { margin:4px 0 0; padding-left:1.2em; font-size:13px; line-height:1.5; color:var(--muted); }
.kitfiles code { color:var(--text); font:12px ui-monospace,Consolas,monospace; }
.mfoot .status { margin-right:auto; align-self:center; }
@media (max-width:860px) { .kitbody { grid-template-columns:1fr; } }
.modal textarea { width:100%; font-size:14px; padding:8px 10px; border:1px solid var(--line); min-height:64px; resize:vertical; }
.modal .hint { margin:0; }
.dirmsg { margin:0; padding-left:1.2em; font-size:13px; line-height:1.45; color:var(--warn); }
.dirok { margin:0; font-size:13px; color:var(--muted); }
.dirjson { margin:0; padding:10px 12px; border:1px solid var(--hair); background:var(--field); font:12px/1.5 ui-monospace,Consolas,monospace; white-space:pre-wrap; overflow-wrap:anywhere; max-height:240px; overflow:auto; }
.mfoot button:disabled { opacity:.45; cursor:not-allowed; }
#fontPrev { font-size:20px; }

/* library page */
.lib { display:flex; flex-wrap:wrap; gap:32px 40px; align-items:flex-start; }
.lib figure { margin:0; flex:none; min-width:0; width:min(100%, 460px, max(33.333%, 380px)); }   /* width first: a third of the row, 380–460px */
.lib figure.wide { width:min(100%, 920px, max(60%, 700px)); }                                 /* desktop layout, or main + secondary side by side */
.lib figure svg { display:block; width:100%; height:auto; }
.lib figure .duo { display:flex; flex-wrap:wrap; gap:12px; }
.lib figure .duo svg { flex:1 1 300px; min-width:0; }   /* stacks on phones */
.side { flex:1 1 380px; min-width:0; display:flex; flex-direction:column; gap:24px; }
.side table { width:100%; }
.sources { display:flex; flex-direction:column; gap:10px; border-top:1px solid var(--hair); padding-top:16px; font-size:14px; }
.sources a { display:block; margin:0 0 4px; }
/* where a community entry's labels came from */
.notice { border:1px solid var(--kicker); border-left-width:4px; padding:10px 14px; font-size:14px; line-height:1.5; max-width:1100px; }
.notice[hidden] { display:none; }
.notice p { margin:0 0 6px; }
.notice > :last-child { margin-bottom:0; }
.notice a { font-weight:700; }
.notice code { font:13px ui-monospace,Consolas,monospace; }
.notice details { margin-top:8px; }
.notice summary { cursor:pointer; font-weight:700; }
.notice details .ctab { margin-top:8px; }
.notice details td.k { font-size:12px; overflow-wrap:anywhere; }
.notice .seg { display:inline-flex; vertical-align:middle; margin-left:4px; }

/* the firmware repository's README, collapsed under the manual (drawn by readmeFragment in community.js) */
.readme { border-top:1px solid var(--hair); padding-top:14px; }
.readme[hidden] { display:none; }
.readme > summary { cursor:pointer; font-size:15px; font-weight:700; }
.readme > summary .cap { margin-right:6px; }
.readme > summary #readmeName { color:var(--muted); font-weight:600; }
#readmeBody { max-width:980px; padding-top:12px; }
.rm-src { margin-bottom:16px; }
.rm { overflow-wrap:break-word; }
.rm h1 { font:800 32px/1.1 var(--font-heading,Archivo,sans-serif); margin:1em 0 .4em; padding-bottom:.25em; border-bottom:1px solid var(--hair); }
.rm h2 { padding-bottom:.2em; border-bottom:1px solid var(--hair); }
.rm h4, .rm h5, .rm h6 { font-size:15px; margin:1em 0 .3em; }
.rm blockquote, .rm pre, .rm details, .rm dl, .rm video, .rm .rm-mermaid, .rm .rm-yt { margin:0 0 1em; }
.rm img { max-width:100%; height:auto; }
.rm video { display:block; width:100%; max-height:70vh; background:#000; }
.rm .rm-yt { position:relative; max-width:720px; aspect-ratio:16/9; }
.rm .rm-yt iframe { position:absolute; inset:0; width:100%; height:100%; border:0; }
.rm pre { padding:12px 14px; border:1px solid var(--hair); background:var(--field); overflow-x:auto; font:13px/1.5 ui-monospace,Consolas,monospace; }
.rm pre code { font:inherit; white-space:pre; }
.rm :not(pre) > code { padding:.1em .35em; border:1px solid var(--hair); background:var(--field); }
.rm kbd { font:12px ui-monospace,Consolas,monospace; padding:.1em .4em; border:1px solid var(--rule); border-bottom-width:2px; }
.rm blockquote { padding:2px 0 2px 14px; border-left:4px solid var(--hair); color:var(--muted); }
.rm blockquote > :last-child { margin-bottom:0; }
.rm .rm-alert { --al:#4493f8; color:var(--text); border-left-color:var(--al); }
.rm .rm-alert-title { font-weight:700; color:var(--al); margin-bottom:.3em; }
.rm .rm-tip { --al:#3fb950; } .rm .rm-important { --al:#ab7df8; } .rm .rm-warning { --al:#d29922; } .rm .rm-caution { --al:#f85149; }
.ui-light .rm .rm-alert { --al:#0969da; } .ui-light .rm .rm-tip { --al:#1a7f37; } .ui-light .rm .rm-important { --al:#8250df; } .ui-light .rm .rm-warning { --al:#9a6700; } .ui-light .rm .rm-caution { --al:#d1242f; }
.rm .rm-mermaid { overflow-x:auto; padding:12px; border:1px solid var(--hair); }
.rm .rm-mermaid svg { display:block; max-width:100%; height:auto; margin:0 auto; }
.rm li > input[type=checkbox] { margin:0 .4em 0 0; vertical-align:middle; }
.rm ul:has(> li > input[type=checkbox]) { list-style:none; padding-left:.4em; }
.rm details > summary { cursor:pointer; font-weight:600; }
.rm table { width:auto; min-width:50%; }

/* Play: a firmware's approved browser build (play.js), and its controls on the drawing */
.play { border:1px solid color-mix(in srgb, var(--active) 70%, transparent); border-left:4px solid var(--active); padding:12px 16px; max-width:1100px; font-size:14px; line-height:1.5; }
.play[hidden] { display:none; }
/* while playing: no tap highlight, selection or long-press menu on the drawing; with the lock, touching it never scrolls the page */
#fig svg { -webkit-tap-highlight-color:transparent; }
body.playing #fig { -webkit-user-select:none; user-select:none; -webkit-touch-callout:none; }
body.play-lock #fig { touch-action:none; overscroll-behavior:contain; }
/* full screen: the drawing alone; the sound controls in a sheet above the bar */
body.play-stage { overflow:hidden; }
body.play-stage .lib figure#fig { position:fixed; inset:0; z-index:900; width:auto !important; max-width:none; margin:0; padding:8px 8px 60px; background:var(--page); display:flex; align-items:center; justify-content:center; touch-action:none; }
body.play-stage #fig > svg { width:100%; height:100%; }
body.play-stage #play { display:none; position:fixed; left:8px; right:8px; bottom:60px; z-index:902; max-height:70vh; overflow:auto; background:var(--page); box-shadow:0 -8px 24px rgba(0,0,0,.4); }
body.play-stage.stage-sound #play { display:block; }
/* the Labels button (toolbar and full screen): which labels show on the drawing */
body.lbl-nopads #fig .padlabel { display:none; }
body.lbl-faceplate #fig svg > g.over > :not(.fplabels), body.lbl-clean #fig svg > g.over { display:none; }
.figbar { display:flex; gap:8px; justify-content:center; margin-top:10px; }
body.fig-tools .bar .lblgrp, body.fig-tools #playStage { display:none; }
.stagebar { position:fixed; left:0; right:0; bottom:0; z-index:903; display:flex; gap:8px; justify-content:center; padding:8px; background:var(--page); border-top:1px solid var(--hair); }
.stagebar button { min-width:0; padding:8px 12px; }
.stagebar button[data-a="labels"] { min-width:8.5em; text-align:center; }   /* the same width for every view, so the buttons stay under the thumb */
.play p { margin:0; }
.play a { font-weight:700; }
.play code { font:13px ui-monospace,Consolas,monospace; }
.play .pctl { display:flex; flex-wrap:wrap; gap:10px 18px; align-items:center; }
.play .pctl label { display:flex; align-items:center; gap:8px; }
.play input[type=range] { padding:0; border:0; background:none; accent-color:var(--active); }
.play .pctl + .pgrid { margin-top:12px; }
.play .device { margin-top:10px; }
.play .device[hidden] { display:none; }
.play .pctl[hidden] { display:none; }
.play.src-device .b-only { display:none; }
.play:not(.src-device) .d-only { display:none; }
/* the controls in groups: one column each, as many side by side as fit */
.pgrid { display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:14px 28px; align-items:start; }
.pgroup { display:flex; flex-direction:column; gap:8px; min-width:0; }
.pgroup[hidden], .play label[hidden], .play .keys[hidden] { display:none; }
.pgroup > label, .pgroup > .keys { display:grid; grid-template-columns:5.2em minmax(0,1fr); align-items:center; gap:8px; }
.pgroup > label > span:first-child, .pgroup > .keys > span:first-child { color:var(--muted); font-size:13px; }
.pgroup > label.chk { display:flex; }
.pgroup select { width:100%; }
.pgroup input[type=range] { width:100%; }
.pgroup > label:has(.pmeter) { grid-template-columns:5.2em minmax(0,1fr) 48px; }
.pgroup .pmeter { width:auto; }
.prow { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.pgo #playGo { min-width:110px; text-align:center; }
.pgo .status:empty { display:none; }
/* settings the firmware takes over MIDI (device-panel.js): a grid of rows like the groups above */
.play #playDevice:not([hidden]) { display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:14px 28px; margin-top:16px; padding-top:14px; border-top:1px solid var(--hair); }
.play #playDevice .device-note { grid-column:1 / -1; }
.device-row { display:flex; flex-wrap:wrap; gap:6px 10px; align-items:center; }
.device-label { flex:0 0 100%; font-size:11px; font-weight:600; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); }
.device-now { font-size:13px; color:var(--muted); }
/* a root note: one octave of keys, the chosen one lit and named */
.device-choices.keyboard { flex-wrap:nowrap; gap:0; }
.keyboard button { position:relative; width:24px; height:46px; margin-left:-1px; padding:0 0 4px; display:flex; align-items:flex-end; justify-content:center; background:#f3f2f2; color:#201e1d; border:1px solid #7d7979; font-size:0; }
.keyboard button:first-child { margin-left:0; }
.keyboard button.k-black { width:16px; height:28px; margin:0 -8px; z-index:1; background:#201e1d; color:#f3f2f2; border-color:#201e1d; }
.keyboard button:hover { border-color:var(--active); z-index:2; }
.keyboard button[aria-pressed="true"] { background:var(--active); border-color:var(--active); color:#fff; font-size:10px; font-weight:700; z-index:2; }
.keyboard button.k-black[aria-pressed="true"] { padding-bottom:2px; font-size:8px; }
.device-choices { display:flex; flex-wrap:wrap; gap:4px; }
.device-note { color:#c0392b; font-size:12px; margin:0; }
.ctab tr td { transition:background-color .25s; }
.ctab tr.hov td { background:color-mix(in srgb, var(--active) 9%, transparent); transition:none; }
.ctab tr.hot td { background:color-mix(in srgb, var(--active) 24%, transparent); transition:none; }
g[data-for] { pointer-events:none; fill:var(--play,#ff7a1a); stroke:none; }
g[data-for].hl-hover { fill-opacity:.2; }
g[data-for].hl-use { fill-opacity:.5; }
g[data-key].hl-hover { filter:drop-shadow(0 0 5px rgba(255,122,26,.55)); }
g[data-key].hl-use { filter:drop-shadow(0 0 7px rgba(255,122,26,.95)); }
.ctab tr.midirow td[data-last] { font:13px ui-monospace,Consolas,monospace; }
.ctab td.midi .mv { color:var(--play,#ff7a1a); margin-left:.6em; }
.play .hint { margin:8px 0 0; }
.play .status.err { color:var(--warn); }
.pmeter { width:90px; height:8px; background:var(--hair); position:relative; overflow:hidden; }
.pmeter i { position:absolute; left:0; top:0; bottom:0; width:0; background:var(--active); transition:width 60ms linear; }
.playov { --play:#ff7a1a; }
.playov .hit { fill:transparent; pointer-events:all; touch-action:none; }
.playov .hit.knob, .playov .hit.fader { cursor:ns-resize; }
.playov .hit.lever { cursor:pointer; }
.playov .pad { fill:var(--play); fill-opacity:0; pointer-events:all; touch-action:none; cursor:pointer; }
.playov .pad.on { stroke:var(--play); stroke-width:3; stroke-linejoin:round; }
.playov.under { pointer-events:none; }
.playov .padfill { fill:var(--play); fill-opacity:0; }
.playov .padart { --pline:var(--play); --pbg:transparent; opacity:0; }
.playov .track, .playov [data-knob] .val { fill:none; stroke-width:6; stroke-linecap:round; pointer-events:none; }
.playov .track { stroke:rgba(128,128,128,.4); }
.playov [data-knob] .val { stroke:var(--play); }
.playov .ptr { stroke:var(--play); stroke-width:6; stroke-linecap:round; pointer-events:none; }
.playov [data-fader] .val, .playov .thumb { fill:var(--play); pointer-events:none; }
.playov .cap { fill:#f3f2f2; stroke:var(--play); stroke-width:3; pointer-events:none; }
.playov [data-led] { pointer-events:none; opacity:0; transition:opacity 40ms; }
.playov [data-led].on { opacity:1; }
.playov [data-led] .lit { fill:#ff4a2f; }
.playov [data-led] .glow { fill:url(#playGlow); }
.playov .oled { pointer-events:none; }
.playov .oled .bezel { fill:#05070a; stroke:var(--pline,#888); stroke-width:2; }
#stage .oledframe { cursor:move; }
#stage .oledframe .bezel { fill:#05070a; stroke:var(--pline,#888); stroke-width:2; }
#stage .oledframe .screen { fill:#101418; stroke:#ff7a1a; stroke-width:2; stroke-dasharray:8 6; }
#stage .oledframe text { fill:#ff9a4d; pointer-events:none; }
#stage .oledframe .grip { fill:#ff7a1a; cursor:nwse-resize; }

/* about page */
.about { max-width:820px; font-size:15px; line-height:1.6; }
.about h2 { font:800 26px/1.15 var(--font-heading); margin:1.6em 0 .5em; scroll-margin-top:16px; }
.about h3 { font:800 18px/1.2 var(--font-heading); margin:1.2em 0 .4em; }
.about p, .about ul, .about ol { margin:0 0 .9em; }
.about ul, .about ol { padding-left:1.3em; }
.about li { margin:.25em 0; }
.about code { font:13px ui-monospace,Consolas,monospace; }
.about pre { margin:0 0 1em; padding:12px 14px; border:1px solid var(--hair); background:var(--field); font:13px/1.5 ui-monospace,Consolas,monospace; overflow-x:auto; }
.flow { display:grid; grid-template-columns:1fr auto 1fr auto 1fr; align-items:stretch; gap:10px; margin:0 0 1em; }
.flow .box { border:1px solid var(--line); padding:12px 14px; font-size:14px; line-height:1.45; }
.flow .box b { display:block; font-size:15px; margin-bottom:4px; }
.flow .box span { color:var(--muted); }
.flow .arr { align-self:center; text-align:center; font-size:12px; color:var(--muted); max-width:110px; }
.flow .arr::before { content:'→'; display:block; font-size:26px; line-height:1; color:var(--kicker); }
/* the whole route: numbered steps on a line, step 2 forks into two orders and joins again */
.about .route { list-style:none; margin:0 0 1.4em; padding:0; position:relative; }
.route::before { content:''; position:absolute; left:17px; top:18px; bottom:18px; border-left:2px solid var(--kicker); }
.route .step { position:relative; display:grid; grid-template-columns:36px minmax(0,1fr); gap:14px; margin:0 0 14px; }
.route .step:last-child { margin-bottom:0; }
.route .num { position:relative; width:36px; height:36px; display:flex; align-items:center; justify-content:center; background:var(--page); border:1px solid var(--kicker); color:var(--kicker); font:800 16px/1 var(--font-heading); }
.route .card { border:1px solid var(--line); padding:10px 14px 12px; font-size:14px; line-height:1.5; scroll-margin-top:16px; }
.route .card p { margin:0 0 .5em; }
.route .card > :last-child { margin-bottom:0; }
.route .head { display:flex; flex-wrap:wrap; align-items:baseline; justify-content:space-between; gap:4px 12px; margin-bottom:4px; }
.route .head b { font-size:16px; }
.route .tools { display:flex; flex-wrap:wrap; gap:4px; }
.route .tool { display:inline-block; padding:0 6px; border:1px solid var(--hair); font-size:11px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; line-height:1.7; white-space:nowrap; color:var(--muted); }
.route .tool.t-des { border-color:var(--active); background:var(--active); color:#fff; }
.route .tool.t-lib { border-color:var(--kicker); color:var(--kicker); }
.route .tool.t-web { border-color:var(--text); color:var(--text); }
.route .out { padding-top:6px; border-top:1px solid var(--hair); color:var(--muted); }
.route .out span { font-size:11px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--kicker); margin-right:6px; }
.route .fork { display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); gap:10px; margin:8px 0 10px; }
.route .way { border:1px dashed var(--rule); padding:8px 12px; scroll-margin-top:16px; }
.route .way .cap { display:block; color:var(--kicker); margin-bottom:4px; }
.route .way p { margin:0 0 .5em; }
.route .way p:last-child { margin:0; }
.route .or { align-self:center; font-size:12px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); }
/* about: the three parts, side by side */
.about .what { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin:0 0 1.4em; }
.about .what > div { display:flex; flex-direction:column; border:1px solid var(--line); padding:10px 14px 12px; font-size:14px; line-height:1.5; }
.about .what > div > b { font-size:16px; margin-bottom:6px; }
.about .what p { margin:0 0 .6em; }
.about .what p.go { margin:auto 0 0; padding-top:4px; font-weight:700; }
@media (max-width:760px) { .about .what { grid-template-columns:1fr; } }
/* guide: the order at the top, and the note before the steps that don't wait for the review */
.about .order li { margin:0 0 .4em; }
.about .wait { border-left:3px solid var(--kicker); padding:6px 12px; margin:0 0 1.4em; }
@media (max-width:640px) {
  .route .fork { grid-template-columns:1fr; }
  .route .or { justify-self:center; }
}

@media (max-width:760px) {
  .flow { grid-template-columns:1fr; }
  .flow .arr { max-width:none; }
  .flow .arr::before { content:'↓'; }
}

.foot { border-top:1px solid var(--hair); padding-top:16px; font-size:13px; line-height:1.5; color:var(--muted); }

@media (max-width:1000px) {
  .grid { grid-template-columns:1fr; }
  #previewCol { top:0; height:60vh; z-index:2; }
  .intro h1 { font-size:28px; }
}
@media (max-width:560px) {
  .wrap { padding:20px 16px 48px; }
  .meta { grid-template-columns:1fr 1fr; }
  .dc, .dcol, .dhead { grid-template-columns:120px minmax(0,1fr) minmax(0,1fr); }
}

/* main + secondary one above the other */
#stage .duo.stack { flex-direction:column; }
#stage .duo.stack > svg { flex:1 1 0; width:100%; min-height:0; }
.lib figure .duo.stack { flex-direction:column; }
.lib figure .duo.stack svg { flex:none; width:100%; }

/* grab handles: between drawing and table (library), on the preview's edge (designer) */
.split { flex:none; align-self:stretch; width:12px; margin:0 -26px; cursor:col-resize; touch-action:none; display:flex; align-items:flex-start; justify-content:center; position:relative; z-index:1; }
.split span, .colgrip span, .xgrip span { display:block; width:6px; height:48px; border:1px solid var(--line); background:var(--page); box-sizing:border-box; }
.split span { position:sticky; top:45vh; margin-top:120px; }
.colgrip { position:absolute; top:0; bottom:0; right:-18px; width:12px; cursor:col-resize; touch-action:none; display:flex; align-items:center; justify-content:center; z-index:3; }
@media (max-width:1000px) { .colgrip { display:none; } }
@media (max-width:760px) { .split { display:none; } }

/* export preview modal */
dialog.xprev { width:calc(100vw - 32px); max-width:none; height:calc(100vh - 32px); max-height:none; padding:0; display:flex; flex-direction:column; box-shadow:none; }
dialog.xprev:not([open]) { display:none; }
.xbar { display:flex; flex-wrap:wrap; align-items:center; gap:8px 16px; padding:12px 20px; border-bottom:1px solid var(--hair); }
.xbar .sp { flex:1; }
.xbar .hint { margin:0; }
.xscroll { flex:1; overflow:auto; padding:24px; background:rgba(0,0,0,.35); }
.xsheet { width:max-content; margin:0 auto; box-shadow:0 12px 48px rgba(0,0,0,.5); }
.xgrip { position:absolute; top:0; bottom:0; right:-26px; width:12px; cursor:col-resize; touch-action:none; display:flex; align-items:center; justify-content:center; }
.xgrip span { border-color:currentColor; background:transparent; }

/* greyed-out toolbar options keep their place */
.seg button:disabled { opacity:.35; cursor:not-allowed; border-color:var(--line); }
.seg button:disabled[aria-pressed="true"] { background:transparent; color:var(--text); }

/* Labels / Style tabs */
.tabs { display:flex; gap:0; margin:0 0 18px; border-bottom:1px solid var(--hair); }
.tabs button { border:0; border-bottom:3px solid transparent; margin-bottom:-2px; padding:8px 16px 7px; font-size:13px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); }
.tabs button[aria-selected="true"] { color:var(--text); border-bottom-color:var(--active); background:transparent; }
.tabs button:hover { color:var(--text); }
#formCol > .tabs + h2 { margin-top:0; border-top:0; padding-top:0; }
.fphelp { font-size:13px; line-height:1.5; color:var(--muted); max-width:640px; margin:10px 0 8px; }
.fphelp p { margin:0 0 6px; }
.fphelp b { color:var(--text); }
.fphelp code { font:12px ui-monospace,Menlo,monospace; color:var(--text); }
.mcolors { display:flex; flex-wrap:wrap; gap:10px 18px; }
.mcolors label { display:flex; align-items:center; gap:8px; font-size:13px; }
.mcolors input[type=color] { width:44px; height:28px; padding:0; border:1px solid var(--hair); background:none; }
button.cswatch { width:100%; height:26px; padding:0; border:1px solid var(--hair); background:linear-gradient(var(--c),var(--c)), repeating-conic-gradient(#8a8a8a 0 25%, #d8d8d8 0 50%) 0 0/10px 10px; }   /* the squares show through a see-through colour */
button.cswatch[data-open] { outline:2px solid var(--active); outline-offset:1px; }
.mcolors button.cswatch { width:44px; height:28px; }
.cpop { position:absolute; z-index:60; display:grid; gap:8px; padding:10px; background:var(--page); color:var(--text); border:1px solid var(--rule); box-shadow:0 8px 24px rgba(0,0,0,.35); max-width:calc(100vw - 16px); }
.cpop .crow { display:flex; flex-wrap:wrap; align-items:center; gap:6px; }
.cpop .clab { font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:.06em; }
.cpop .crow > .clab:first-child { min-width:52px; }
.cpop .cchip { display:inline-block; width:24px; height:24px; padding:0; border:1px solid var(--hair); background:linear-gradient(var(--c),var(--c)), repeating-conic-gradient(#8a8a8a 0 25%, #d8d8d8 0 50%) 0 0/10px 10px; }
.cpop .hex { width:108px; padding:3px 6px; font:13px ui-monospace,Consolas,monospace; }
.cpop .rgba { width:58px; padding:3px 4px; font:13px ui-monospace,Consolas,monospace; }
.cpop .alpha { width:96px; }
.cpop input[type=color] { width:36px; height:26px; padding:0; border:1px solid var(--hair); background:none; cursor:pointer; }
.cpop .hint { margin:0; font-size:12px; }

.ui-vis { --page:#141414; --text:#f3f2f2; --muted:rgba(243,242,242,.7); --rule:rgba(243,242,242,.35); --hair:rgba(243,242,242,.14); --active:#0a7d50; --kicker:#e3bb67; --field:rgba(255,255,255,.04); --warn:#ff8a78; }
.dc .seg button { padding:4px 10px; font-size:12px; }
.dc .chk { display:flex; align-items:center; gap:6px; }
.dc .chk small { color:var(--muted); font-size:12px; }
.dc input[type=color] { width:100%; height:26px; padding:0; border:1px solid var(--hair); background:none; }

/* export minimap */
.mm { display:flex; flex-direction:column; align-items:center; gap:4px; user-select:none; }
.mm .cap { font-size:10px; color:var(--muted); }
.mm-sheet { width:116px; height:96px; padding:6px; border:2px solid; box-shadow:4px 4px 0 var(--hair); display:flex; flex-direction:column; gap:4px; box-sizing:border-box; }
.mm-sheet button { padding:0; border-radius:0; background:transparent; color:inherit; font:inherit; cursor:pointer; text-align:left; }
.mm-top { display:flex; gap:4px; flex:1; min-height:0; }
.mm-panels { flex:none; display:flex; gap:2px; border:1.5px solid var(--active) !important; padding:2px !important; }
.mm-panels.stacked { flex-direction:column; }
.mm-dev { display:flex; flex-direction:column; justify-content:space-between; width:24px; flex:1; padding:2px; border:1px solid; box-sizing:border-box; min-height:0; }
.mm-panels:not(.stacked) .mm-dev:only-child { width:34px; }
.mm-dev > i { display:block; height:40%; }
.mm-dev b { font:800 5px/1 var(--font-body); letter-spacing:.02em; text-align:center; overflow:hidden; white-space:nowrap; }
.mm-panels .mm-dev + .mm-dev b, .mm-panels .mm-dev:has(+ .mm-dev) b { visibility:hidden; }
.mm-pads { display:grid; grid-template-columns:repeat(4,1fr); gap:1px; height:24%; }
.mm-pads i { display:block; }
.mm-table, .mm-notes { border:1px dashed var(--muted) !important; opacity:.4; padding:3px 4px !important; display:flex; }
.mm-table { flex:1; flex-direction:column; justify-content:space-between; }
.mm-notes { height:22px; flex:none; align-items:center; gap:6px; }
.mm-table.on, .mm-notes.on { border:1.5px solid var(--active) !important; opacity:1; background:color-mix(in srgb, var(--active) 12%, transparent) !important; }
.mm-notes:disabled { cursor:not-allowed; opacity:.2; }
.mm-sheet b { font:800 7px/1 var(--font-body); letter-spacing:.05em; }
.mm-table span { display:flex; flex-direction:column; gap:3px; }
.mm-table span i { display:block; height:2px; border-bottom:1.5px solid currentColor; }
.mm-notes span { flex:1; display:grid; grid-template-columns:1fr 1fr; gap:2px 4px; }
.mm-notes span i { display:block; height:1.5px; background:currentColor; opacity:.55; }
.mm-cap { font-size:10px; color:var(--muted); white-space:nowrap; }
.top > .mm { align-self:flex-start; }

.pdfig { margin:0; display:flex; flex-direction:column; gap:8px; border-top:1px solid var(--hair); padding-top:16px; }
.pdfig img { width:100%; height:auto; display:block; border:1px solid var(--hair); }

/* select with ‹ › step buttons */
.stepper { display:flex; align-items:stretch; min-width:0; }
.stepper select { flex:1; min-width:0; }
.stepper button { padding:0 9px; font-size:15px; line-height:1; }
.stepper button:first-child { border-right:0; }
.stepper button:last-child { border-left:0; }

/* export sheet */
.xsheet { padding:var(--xpad,32px); font-family:Archivo,system-ui,sans-serif; box-sizing:border-box; }
.xh1 { margin:0 0 6px; font:800 40px/1.05 Archivo,sans-serif; }
.xdesc { margin:0 0 20px; max-width:760px; font-size:15px; line-height:1.5; }
.xh1 + .xbody { margin-top:14px; }
.xbody { display:flex; gap:var(--xtgap,40px); align-items:flex-start; }
.xbody[data-table="below"] { flex-direction:column; gap:var(--xtgap,24px); }
.xfigs { position:relative; display:flex; align-items:flex-start; }
/* panel gap as a margin, so it can go below zero and the drawings' empty edges overlap; labels stay above every drawing */
.xfigs { flex-direction:column; }
.xfrow { display:flex; align-items:flex-start; }
.xfrow + .xfrow { margin-top:var(--xfgap,16px); }
.xfrow > .xfig + .xfig { margin-left:var(--xfgap,16px); }
.xcap { font-weight:700; font-size:calc(var(--xfs,14px) * 1.15); margin:0 0 6px; }
.xmode { display:inline-flex; align-items:center; gap:2px; border:1px solid var(--hair); padding:2px 2px 2px 8px; font-size:13px; }
.xmode.on { border-color:var(--text); }
.xmode label { display:flex; align-items:center; gap:4px; margin-right:4px; cursor:pointer; }
.xmode button { padding:2px 7px; min-width:0; }
.xrow[hidden] { display:none; }
.xfigs [data-fig] > img { z-index:0; }
.xfigs [data-fig] > svg { z-index:1; }
.xtable { width:calc(var(--xfs,14px) * 40); flex:none; }
/* text size slider: the table and the notes scale together */
.xsheet .xtable .ctab { font-size:var(--xfs,14px); }
.xsheet .xnotes { font-size:var(--xfs,15px); }
.xsheet .ctab .k { font-size:.85em; }
.xsheet .md h2 { font-size:1.6em; }
.xsheet .md h3 { font-size:1.2em; }
.xsheet .md table { font-size:.93em; }
.xsheet .md code { font-size:.87em; }
.xnotes { margin-top:28px; padding-top:16px; columns:2 420px; column-gap:40px; }
.xfoot { margin:24px 0 0; font-size:11px; line-height:1.5; }
.xfoot span:not(:empty)::before { content:''; display:block; }
.xchk { display:flex; align-items:center; gap:6px; font-size:13px; cursor:pointer; }
.xbar .seg button:disabled { opacity:.35; cursor:not-allowed; }
/* on paper: smaller type, the table takes the room that's left */
.xsheet.paper { padding:var(--xpad,28px); overflow:hidden; }
.xsheet.paper .xh1 { font-size:28px; }
.xsheet.paper .xdesc { font-size:13px; margin-bottom:14px; }
.xsheet.paper .xbody { gap:var(--xtgap,24px); }
.xsheet.paper .xbody[data-table="side"] .xtable { flex:1 1 0; min-width:calc(var(--xfs,12px) * 20); width:auto; }
.xsheet.paper .xbody[data-table="below"] .xtable { width:100%; }
.xsheet.paper .xtable .ctab { font-size:var(--xfs,12px); }
.xsheet.paper .xtable .ctab th, .xsheet.paper .xtable .ctab td { padding:.33em .67em .33em 0; }
.xsheet.paper .xnotes { margin-top:18px; padding-top:12px; columns:2 280px; column-gap:28px; font-size:var(--xfs,12px); }
.xsheet.paper .xfoot { margin-top:14px; font-size:9px; }

.xgrip[hidden] { display:none; }
.xscroll .xsheet + .xsheet { margin-top:24px; }
.xsheet[hidden] { display:none; }
.xpage2 .xnotes2 { columns:2 280px; column-gap:28px; font-size:var(--xfs,12px); }
/* notes on an export sheet: no scroll boxes, tables and headings stay with what follows */
.xsheet .md .tw { overflow:visible; }   /* (break-inside on tables makes html-to-image drop the rows) */
.xsheet .md h2, .xsheet .md h3 { break-after:avoid; }
.xsheet .md li { break-inside:avoid; }

/* notes columns on export sheets: see balanceNotes() */
.xsheet .xnotes, .xsheet .xnotes2 { columns:auto; display:flex; gap:40px; align-items:flex-start; }
.xsheet.paper .xnotes, .xsheet.paper .xnotes2 { columns:auto; gap:28px; }
.ncol { flex:1 1 0; min-width:0; }
.ncol > :first-child { margin-top:0; }

/* export preview bar: minimap on the left, options and actions beside it */
.xbar { align-items:flex-start; gap:12px 20px; flex-wrap:nowrap; }
.xbar > [data-mm] { flex:none; }
.xopts { flex:1; min-width:0; display:flex; flex-direction:column; gap:8px; }
.xrow { display:flex; flex-wrap:wrap; align-items:center; gap:8px 14px; }
.xrow .sp { flex:1; }
.xrow .hint { margin:0; }
.xsl { display:flex; align-items:center; gap:6px; font-size:13px; }
.xsl input[type=range] { width:110px; accent-color:var(--active); padding:0; border:0; background:none; }
.xsl output { min-width:3.2em; font-variant-numeric:tabular-nums; color:var(--muted); }
.xacts { display:flex; flex-wrap:wrap; align-items:center; gap:8px 14px; }
/* phones: the whole screen, the minimap beside the look / paper choices, actions and sliders full width
   below, so the bar stays short and the sheet gets the room */
@media (max-width:700px) {
  dialog.xprev { width:100vw; height:100dvh; margin:0; border-width:0; }
  .xbar { display:grid; grid-template-columns:auto minmax(0,1fr); gap:6px 12px; padding:10px 12px; max-height:55dvh; overflow:auto; }
  .xopts, .xopts > .xrow:first-child { display:contents; }
  .xbar > [data-mm] { grid-column:1; grid-row:1 / span 4; }
  .xrow:first-child > :is(.cap, .sp) { display:none; }
  .xrow:first-child > :is([data-look], [data-paper], [data-orient], .xchk) { grid-column:2; }
  .xacts, .xopts > .xrow:not(:first-child) { grid-column:1 / -1; }
  .xacts { gap:5px; }
  .xbar button { padding:5px 7px; font-size:12px; }
  .xchk { font-size:12px; }
  .xrow[data-sliders] { display:grid; grid-template-columns:1fr 1fr; gap:4px 16px; }
  .xsl { display:grid; grid-template-columns:1fr auto; gap:0 6px; font-size:12px; }
  .xsl input[type=range] { grid-row:2; grid-column:1 / -1; width:100%; }
  .xsl output { grid-row:1; grid-column:2; min-width:0; }
  [data-slreset] { grid-column:1 / -1; justify-self:start; }
  .xrow .hint { font-size:12px; }
  .xscroll { padding:12px; }
}

/* guide.html: the start choices, and a check per line that remembers its tick */
.gsetup { display:flex; flex-wrap:wrap; align-items:flex-end; gap:12px 28px; margin:0 0 8px; padding:12px 0 14px; border-bottom:1px solid var(--hair); position:sticky; top:0; z-index:5; background:var(--page); }
.gsetup .grp { display:flex; flex-direction:column; align-items:flex-start; gap:4px; }
.gsetup .grepo { flex:1 1 240px; }
.gsetup .grepo .grow { display:flex; gap:6px; align-self:stretch; }
.gsetup .grepo input { flex:1; min-width:0; }
.gcheck { margin:0 0 8px; padding:10px 12px; border:1px solid var(--hair); font-size:14px; }
.about .gcheck ul { list-style:none; margin:0 0 6px; padding:0; }
.about .gcheck li { margin:2px 0; }
.gcheck li.no { color:var(--muted); }
.about .gcheck p { margin:0; }
.gsetup .hint { flex-basis:100%; margin:0; }
.guide .chk { display:flex; align-items:flex-start; gap:8px; margin:6px 0 0; padding:6px 8px; border:1px solid var(--hair); cursor:pointer; }
.guide .chk input { margin-top:3px; flex:none; }
.guide .chk.done { border-color:var(--kicker); color:var(--muted); }
.guide .chk + .hint, .guide .card > .hint { margin-top:8px; }
/* guide: the detailed steps, folded; values filled in from the repository at the top are marked */
.guide .gex { margin:0 0 1em; }
.guide details.more { margin:8px 0 0; padding-top:6px; border-top:1px solid var(--hair); }
.guide details.more > summary { cursor:pointer; font-size:13px; font-weight:700; color:var(--kicker); }
.guide details.more[open] > summary { margin-bottom:6px; }
.guide details.more ol, .guide details.more ul { margin:0 0 .5em; padding-left:1.4em; }
.guide details.more li { margin:0 0 .4em; }
.guide details.more ul li { margin:0; }
.guide details.more pre { margin:.3em 0 .5em; padding:8px 10px; font-size:12px; }
.guide details.more .hint { margin:0 0 .3em; }
.guide details.more li > code, .guide details.more p > code { overflow-wrap:anywhere; }
.guide .gentry { display:block; box-sizing:border-box; width:100%; min-height:190px; margin:.3em 0 .3em; padding:8px 10px; border:1px solid var(--hair); background:var(--field); color:var(--text); font:12px/1.5 ui-monospace,Consolas,monospace; resize:vertical; }
.guide .gentrybar { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; margin:0 0 .8em; }
.guide details.more ul.fields { margin:0 0 .6em; font-size:13px; color:var(--muted); }
.guide details.more ul.fields li { margin:0 0 .2em; }
.guide pre span[data-f], .guide code[data-f], .guide code span[data-f] { color:var(--kicker); }
.guide a:not([href]) { text-decoration:underline dotted; cursor:help; }
.guide [hidden] { display:none !important; }
@media (max-width:600px){ .gsetup { position:static; } }

/* library and web app toolbar: what to show on the left, how to show it on the right */
.bar .grp.view { gap:10px 24px; }
.bar label.grp { cursor:default; }
#srcSel { min-width:12em; }
button.lbl { min-width:8.5em; text-align:center; }
.viewbtn { display:none; }
.device-note:empty { display:none; }
@media (max-width:700px) {
  .bar { gap:10px 16px; }
  .bar .pick { width:100%; }
  .bar .pick #srcSel { flex:1; }
  .viewbtn { display:block; order:1; }
  .bar .lblgrp { order:2; }
  .bar .grp.view { order:3; display:none; width:100%; flex-direction:column; align-items:flex-start; }
  .bar.view-open .grp.view { display:flex; }
  .bar #modeGrp { order:4; }
}

/* The community cards, the library's home (index.html showCards). While they are open the firmware's own sections are hidden. */
#cards:not([hidden]) ~ :not(footer) { display:none !important; }
#cards { padding-top:18px; }
.cards-open #viewGrp, .cards-open .lblgrp, .cards-open #viewBtn, .cards-open #modeGrp, .cards-open .export { display:none; }
#cards .hint { margin-top:12px; }
.fwcards { display:grid; grid-template-columns:repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap:14px; }
.fwcard { display:flex; flex-direction:column; border:1px solid var(--hair); background:var(--field); min-width:0; }
.fwsum { display:flex; flex:1; align-items:stretch; gap:14px; width:100%; padding:12px; border:0; font-weight:500; white-space:normal; }
.fwsum .pic { flex:none; width:120px; }
.fwsum .pic svg, .fwsum .pic img { display:block; width:100%; height:auto; }
.fwsum .body { display:flex; flex-direction:column; gap:6px; min-width:0; }
.fwsum b { font-size:16px; font-weight:700; overflow-wrap:anywhere; }
.fwsum .by { font-size:12px; color:var(--muted); }
.fwsum .txt { font-size:13px; line-height:1.45; max-width:70ch; }
.fwsum .tags { display:flex; flex-wrap:wrap; gap:4px 6px; margin-top:auto; padding-top:6px; }
.fwsum .tags span { font-size:11px; border:1px solid var(--hair); padding:1px 6px; }
.meta input.bad { border-color:var(--warn); }
.fwcard[hidden] { display:none; }
.fwcard:hover { border-color:var(--active); }
/* the open card and its row share one outline: the card reaches down over the gap and covers the row's top border */
.fwcard.open { position:relative; z-index:1; background:linear-gradient(var(--field), var(--field)), var(--page); border-color:var(--active); border-bottom:0; margin-bottom:-16px; padding-bottom:17px; }
.fwcard.open .by, .fwcard.open .txt, .fwcard.open .tags, .fwcard.open .fwlinks { display:none; }
/* the card's first links, under its button (cardHTML, community.js) */
.fwlinks { display:flex; flex-wrap:wrap; gap:4px 16px; padding:0 12px 12px; font-size:12px; min-width:0; }
.fwlinks a { overflow-wrap:anywhere; }
.fwcard.open .fwsum { cursor:default; }
.fwsum > * { transition:opacity .2s; }
.fwcard.open .fwsum > * { opacity:.55; }
.fwhead { display:flex; align-items:flex-start; gap:18px; }
.fwhead .pic { flex:none; width:min(200px, 36%); }
.fwhead .pic svg, .fwhead .pic img { display:block; width:100%; height:auto; }
.fwhead .body { display:flex; flex-direction:column; gap:8px; min-width:0; }
.fwhead b { font-size:24px; font-weight:700; overflow-wrap:anywhere; }
.fwhead .by { font-size:13px; color:var(--muted); }
.fwhead .txt { font-size:14px; line-height:1.5; max-width:70ch; }
.fwhead .tags { display:flex; flex-wrap:wrap; gap:4px 6px; }
.fwhead .fwact { margin-top:6px; }
.fwhead .tags span { font-size:11px; border:1px solid var(--hair); padding:1px 6px; }
.fwsum .tags .tag, .fwhead .tags .tag, .cardinfo .tags .tag { background:var(--active); border-color:var(--active); color:#fff; }
.fwfilter { display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin-bottom:12px; }
.fwfilter button[aria-pressed="true"] { background:var(--active); border-color:var(--active); color:#fff; }
/* an open card's videos and sounds: a row of the grid, under the card's own row (placeDetail, index.html) */
.fwdetail { grid-column:1 / -1; display:flex; flex-direction:column; gap:14px; min-width:0; padding:14px; border:1px solid var(--active); background:linear-gradient(var(--field), var(--field)), var(--page); }
.fwdetail .hint { margin:0; }
.fwact { display:flex; flex-wrap:wrap; align-items:center; gap:10px 16px; font-size:13px; }
.media { display:flex; flex-wrap:wrap; align-items:flex-start; gap:16px; }
.mitem { display:flex; flex-direction:column; gap:6px; width:min(560px, 100%); margin:0; }
.mitem.tall { width:min(250px, 100%); }
.mitem.snd { width:min(360px, 100%); }
.mitem video { width:100%; max-height:70vh; background:#000; }
.mitem audio { width:100%; }
.mitem figcaption { display:flex; flex-direction:column; align-items:flex-start; gap:4px; font-size:13px; line-height:1.45; }
.mtext { white-space:pre-line; overflow-wrap:anywhere; }
.mtext.clamp { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:3; overflow:hidden; }
.ytf { position:relative; display:block; width:100%; aspect-ratio:16 / 9; padding:0; border:1px solid var(--hair); background:#000; overflow:hidden; }
.mitem.tall .ytf { aspect-ratio:9 / 16; }
.ytf img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.ytf .go { position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); display:grid; place-items:center; width:64px; height:44px; background:var(--active); color:#fff; font-size:20px; }
/* a manual's own listing, under its notes */
.cardinfo { display:flex; flex-direction:column; gap:12px; margin-top:22px; padding-top:16px; border-top:1px solid var(--hair); }
.cardinfo[hidden] { display:none; }
.cardinfo .tags { display:flex; flex-wrap:wrap; gap:4px 6px; }
.cardinfo .tags span { font-size:11px; border:1px solid var(--hair); padding:1px 6px; }
/* the designer's Library card fields, and the card as the library draws it */
.lcard { display:flex; flex-direction:column; gap:8px; margin-top:8px; }
.lcard .cap { margin-top:8px; }
.lcard input[type=text], .lcard textarea { width:100%; min-width:0; }
.lcard .fprow { margin-top:0; flex-wrap:nowrap; }
.lcard .fprow input[type=text] { flex:1; }
.lcard .fprow button { flex:none; }
.lcard textarea { min-height:44px; resize:vertical; }
.lcard input.bad { border-color:var(--warn); }
.mrows { display:flex; flex-direction:column; gap:10px; }
.mrow { display:flex; flex-direction:column; gap:4px; padding-left:8px; border-left:2px solid var(--hair); }
.tagrow { display:flex; flex-wrap:wrap; gap:6px; }
.tagrow:empty { display:none; }
.cardprev .fwcards { grid-template-columns:minmax(0, 420px); }
.cardprev .fwsum { cursor:default; }
.kitcard { margin-top:14px; }
.kitcard .cardprev { margin-top:6px; }
/* the designer's tour (tourShow, editor.html): its button beside the tabs, the box, and the outlined part */
.tabs button.tourbtn { margin:0 0 4px auto; align-self:center; width:24px; height:24px; padding:0; border:1px solid var(--hair); font:700 14px/1 Georgia, serif; text-transform:none; letter-spacing:0; }
.tour { position:fixed; right:16px; bottom:16px; z-index:50; width:min(380px, calc(100vw - 32px)); padding:14px; border:1px solid var(--active); background:linear-gradient(var(--field), var(--field)), var(--page); box-shadow:0 8px 30px rgba(0,0,0,.45); font-size:14px; line-height:1.5; }
.tour p { margin:10px 0 12px; }
.tour .mfoot button:first-child { margin-right:auto; }
.tour-at { outline:2px solid var(--active); outline-offset:4px; }
/* phones: the open card's row takes the card's place. Its name goes above the picture, and the text beside the picture */
@media (max-width:600px){
  .fwcard.open { display:none; }   /* one column: the row below repeats the card in full */
  .fwhead { display:grid; grid-template-columns:min(150px, 38%) minmax(0, 1fr); gap:8px 14px; }
  .fwhead .body { display:contents; }
  .fwhead b { grid-column:1 / -1; grid-row:1; font-size:22px; line-height:1.15; }
  .fwhead .pic { grid-column:1; grid-row:2 / span 6; width:auto; }
  .fwhead .body > :not(b) { grid-column:2; }
  .fwhead .fwact { margin-top:0; }
}
