/* The playground: a toolbar, the editor beside its output; stacked on phones. */
body.page-playground { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.pg { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 12px max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-bottom)); }
.pg-bar { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 10px; border-radius: 16px; border: var(--hair) solid var(--line); box-shadow: var(--shadow); flex-wrap: nowrap; }
.pg-spacer { flex: 1; }
.pg-select { position: relative; display: inline-flex; align-items: center; }
.pg-select select { appearance: none; -webkit-appearance: none; height: 32px; padding: 0 30px 0 14px; border-radius: 999px; border: var(--hair) solid var(--line); background: var(--fill); color: var(--fg); font: 500 14px var(--font); letter-spacing: -0.01em; cursor: pointer; max-width: 260px; text-overflow: ellipsis; }
.pg-select select:hover { background: var(--fill-2); }
.pg-select .chev { position: absolute; right: 10px; width: 14px; height: 14px; transform: rotate(90deg); pointer-events: none; color: var(--fg-3); }
.pg-select.small select { height: 28px; font-size: 13px; padding-left: 12px; }
.pg-select.block { display: flex; margin: 0 0 8px; }
.pg-select.block select { width: 100%; max-width: none; }
.pg-select option { color: initial; }
.pg-status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pg-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--fg-3); flex: none; transition: background-color .2s; }
.pg-status.ok .dot { background: var(--fg); }
.pg-status.busy .dot { animation: pulse 1s ease-in-out infinite; }
.pg-status.err .dot { background: var(--err); }
.pg-status.warn .dot { background: var(--warn); }
@keyframes pulse { 50% { opacity: .25; } }

.pg-split { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.pg-pane { min-height: 0; min-width: 0; display: flex; flex-direction: column; border-radius: var(--r-l); border: var(--hair) solid var(--line); background: var(--card); box-shadow: var(--shadow); overflow: hidden; }
.pane-head { flex: none; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px 0 16px; border-bottom: var(--hair) solid var(--line); background: var(--glass); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); font-size: 13px; }
.pane-head .file { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.pane-head .file .icon { width: 16px; height: 16px; }
.pane-note { color: var(--fg-3); font-size: 12px; margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.editor-host { flex: 1; min-height: 0; }
.editor-host .cm-editor { height: 100%; }

.tabs { gap: 2px; padding: 0 6px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { appearance: none; border: 0; background: transparent; color: var(--fg-2); height: 30px; padding: 0 12px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; font: 500 13px var(--font); cursor: pointer; white-space: nowrap; transition: background-color .15s, color .15s; }
.tabs button .icon { width: 15px; height: 15px; }
.tabs button:hover { color: var(--fg); background: var(--fill); }
.tabs button[aria-selected="true"] { color: var(--fg); background: var(--fill-2); }
.tabs .count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; font-size: 11px; display: inline-grid; place-items: center; background: var(--fill-2); color: var(--fg-2); }
.tabs .count.err { background: var(--err); color: #fff; }

.panel { flex: 1; min-height: 0; overflow: auto; }
.panel[hidden] { display: none !important; }
.panel.split { display: grid; grid-template-columns: 200px minmax(0, 1fr); overflow: hidden; }
.panel-tools { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: var(--hair) solid var(--line); background: var(--glass); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); }
.empty { display: flex; align-items: center; gap: 8px; margin: 0; padding: 20px; color: var(--fg-2); font-size: 14px; }
.empty .icon { width: 18px; height: 18px; }

.problems { list-style: none; margin: 0; padding: 6px; }
.problems button { appearance: none; width: 100%; text-align: left; border: 0; background: transparent; color: var(--fg); border-radius: 10px; padding: 9px 10px; display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 2px 10px; cursor: pointer; font: 13.5px/1.45 var(--font); }
.problems button:hover, .problems button:focus-visible { background: var(--fill); }
.problems .sev { width: 9px; height: 9px; border-radius: 50%; margin: 5px 0 0 4px; background: var(--fg-3); }
.problems .error .sev { background: var(--err); }
.problems .warning .sev { background: var(--warn); }
.problems .msg { overflow-wrap: anywhere; }
.problems .at { font: 12px var(--mono); color: var(--fg-3); white-space: nowrap; }
.problems .code { grid-column: 2; font: 11.5px var(--mono); color: var(--fg-3); }

/* the diagram: in its colours; in dark mode inverted with the hues turned back, so a red stays red.
   The wheel zooms, a drag pans (app.js): the stage moves inside a fixed viewport. */
.diagram-panel { display: flex; flex-direction: column; overflow: hidden; }
.diagram-panel:fullscreen { background: var(--bg); }
.diagram-view { position: relative; flex: 1; min-height: 0; overflow: hidden; cursor: grab; touch-action: none; }
.diagram-view.panning { cursor: grabbing; }
.diagram-stage { padding: 16px; transform-origin: 0 0; display: flex; justify-content: center; align-items: flex-start; will-change: transform; }
.diagram-stage svg { max-width: 100%; height: auto; border-radius: 12px; background: #fff; box-shadow: 0 0 0 var(--hair) var(--line); user-select: none; }
:root[data-theme="dark"] .diagram-stage svg { filter: invert(.9) hue-rotate(180deg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .diagram-stage svg { filter: invert(.9) hue-rotate(180deg); } }
/* a board picture keeps its colours (the PCBs), its text in the page's colour */
.diagram-stage svg.board-picture, :root[data-theme="dark"] .diagram-stage svg.board-picture { filter: none; background: transparent; box-shadow: none; color: var(--fg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .diagram-stage svg.board-picture { filter: none; } }
.diagram-stage .msg { color: var(--fg-2); font-size: 14px; padding: 8px; }
.diagram-stage .port-marker, .diagram-stage .part-title { cursor: pointer; }
.diagram-stage svg.board-picture path { pointer-events: none; } /* the wires over the markers: a click reaches the marker */
.diagram-stage .port-marker:hover circle, .diagram-stage .port-marker.lit circle { stroke-width: 4; }
.diagram-stage .port-marker.lit circle { fill: #ffe9a8; }
.zoom-tools { display: inline-flex; align-items: center; gap: 2px; margin-left: 4px; flex: none; }
.zoom-tools .iconbtn { width: 28px; height: 28px; }
.zoom-level { appearance: none; border: 0; background: transparent; color: var(--fg-2); font: 500 12px var(--font); min-width: 44px; height: 28px; border-radius: 8px; cursor: pointer; font-variant-numeric: tabular-nums; }
.zoom-level:hover { background: var(--fill); color: var(--fg); }

.files { border-right: var(--hair) solid var(--line); overflow: auto; padding: 8px; }
.files button { appearance: none; display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: transparent; color: var(--fg-2); text-align: left; border-radius: 8px; padding: 6px 8px; font: 12.5px var(--mono); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files button .icon { width: 14px; height: 14px; flex: none; color: var(--fg-3); }
.files button:hover { background: var(--fill); color: var(--fg); }
.files button[aria-selected="true"] { background: var(--fill-2); color: var(--fg); font-weight: 600; }
.files .dir { font: 600 11px var(--font); color: var(--fg-3); padding: 10px 8px 4px; }
.files .notes { font-size: 12px; color: var(--fg-2); padding: 8px; margin: 0; }
.viewer { margin: 0; border: 0; border-radius: 0; background: transparent; padding: 14px 16px; overflow: auto; font-size: 12.5px; line-height: 1.55; white-space: pre; min-height: 0; }

#scene-frame { display: block; width: 100%; height: calc(100% - 53px); border: 0; background: var(--bg); }
#anim-frame { display: block; width: 100%; height: calc(100% - 53px); border: 0; background: var(--bg); }
#panel-anim .panel-tools { flex-wrap: wrap; }
#cad-frame { display: block; width: 100%; height: calc(100% - 53px); border: 0; background: var(--bg); }
.cad-failures { list-style: none; margin: 0; padding: 8px 16px; border-bottom: 1px solid var(--line, rgba(128,128,128,.25)); font-size: 13px; }
.cad-failures li { margin: 4px 0; }
.cad-failures button { font: inherit; color: inherit; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.cad-failures b { color: var(--err, #d24545); font-weight: 600; }
#sim-frame { display: block; width: 100%; height: calc(100% - 53px); border: 0; background: #fff; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 80; padding: 10px 18px; border-radius: 999px; border: var(--hair) solid var(--line); box-shadow: var(--shadow-lg); font-size: 14px; animation: pop .2s var(--ease); max-width: calc(100vw - 32px); }

/* the editor (CodeMirror), in the site's tokens */
.cm-editor { font-size: 13.5px; background: transparent; color: var(--fg); }
.cm-editor.cm-focused { outline: none; }
.cm-scroller { font-family: var(--mono); line-height: 1.6; }
.cm-editor .cm-gutters { background: transparent !important; border-right: var(--hair) solid var(--line) !important; color: var(--fg-3) !important; }
.cm-editor .cm-activeLineGutter, .cm-editor .cm-activeLine { background: var(--fill) !important; }
.cm-editor .cm-activeLineGutter { color: var(--fg); }
.cm-cursor { border-left-color: var(--fg); border-left-width: 1.5px; }
.cm-selectionBackground, .cm-editor .cm-content ::selection { background: var(--fill-2) !important; }
.cm-focused .cm-selectionBackground { background: rgba(127, 127, 127, .28) !important; }
.cm-matchingBracket { background: var(--fill-2); outline: var(--hair) solid var(--line-strong); }
.cm-lintRange-error { background-image: none !important; text-decoration: underline wavy var(--err); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.cm-lintRange-warning { background-image: none !important; text-decoration: underline wavy var(--warn); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.cm-lintRange-info, .cm-lintRange-hint { background-image: none !important; text-decoration: underline dotted var(--fg-3); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.cm-lint-marker { width: 8px !important; height: 8px !important; border-radius: 50%; content: none !important; background: var(--fg-3); margin: 5px 2px 0; }
.cm-lint-marker-error { background: var(--err); }
.cm-lint-marker-warning { background: var(--warn); }
.cm-diagnostic-info, .cm-diagnostic-hint { border-left-color: var(--fg-3); }
.cm-tooltip { border: var(--hair) solid var(--line) !important; border-radius: 12px; background: var(--glass-strong) !important; -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); box-shadow: var(--shadow-lg); color: var(--fg); overflow: hidden; }
.cm-tooltip-lint { font: 13px var(--font); }
.cm-diagnostic { padding: 6px 10px; border-left-width: 3px; }
.cm-diagnostic-error { border-left-color: var(--err); }
.cm-diagnostic-warning { border-left-color: var(--warn); }
.cm-panels { background: var(--glass-strong); color: var(--fg); border-color: var(--line) !important; }
.cm-panel.cm-search input, .cm-panel.cm-search button { font: 13px var(--font); }
.cm-textfield { background: var(--fill); border: var(--hair) solid var(--line); border-radius: 6px; color: var(--fg); }
.cm-button { background: var(--fill); border: var(--hair) solid var(--line); border-radius: 6px; color: var(--fg); background-image: none; }
.cm-searchMatch { background: var(--fill-2); outline: var(--hair) solid var(--line-strong); }
.cm-foldPlaceholder { background: var(--fill-2); border: 0; color: var(--fg-2); }
.cm-content { color: var(--syn-fg); }
.cm-tok-k { color: var(--syn-keyword); }
.cm-tok-kc { color: var(--syn-control); }
.cm-tok-p { color: var(--syn-property); }
.cm-tok-d, .cm-tok-t { color: var(--syn-type); }
.cm-tok-f { color: var(--syn-function); }
.cm-tok-c { color: var(--syn-keyword); }
.cm-tok-n { color: var(--syn-constant); }
.cm-tok-m { color: var(--syn-number); }
.cm-tok-s { color: var(--syn-string); }
.cm-tok-x { color: var(--syn-comment); font-style: italic; }
.cm-tok-o { color: var(--syn-operator); }
.cm-tok-v { color: var(--syn-variable); }
.cm-tok-g { color: var(--syn-tag); }

@media (max-width: 900px) {
  .pg { padding: 10px 12px 12px; gap: 8px; }
  .pg-split { grid-template-columns: minmax(0, 1fr); }
  .pg-bar { flex-wrap: wrap; }
  .pg-status { order: 5; flex-basis: 100%; padding: 2px 4px 0; }
  .btn-sm .lbl { display: none; }
  .btn-sm { padding: 0 10px; }
  .panel.split { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .files { border-right: 0; border-bottom: var(--hair) solid var(--line); max-height: 150px; }
  .pg-bar > .pg-select { flex: 1; min-width: 0; }
  .pg-bar > .pg-select select { width: 100%; max-width: none; }
  .pg-spacer { display: none; }
  .tabs button { height: 34px; }
  .panel-tools { flex-wrap: wrap; }
  .panel-tools .pane-note { margin-left: 0; white-space: normal; }
}

/* Ctrl/⌘+click: the name under the pointer, as a link to its declaration */
.cm-deflink { text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.cm-content.cm-linking { cursor: pointer; }

/* the files of the model: main.arche and those it includes, as tabs */
.files-head { padding-left: 8px; gap: 4px; }
.file-tabs { display: flex; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.file-tabs::-webkit-scrollbar { display: none; }
.ftab { appearance: none; border: 0; background: transparent; color: var(--fg-2); height: 30px; padding: 0 8px 0 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; font: 500 13px var(--font); cursor: pointer; white-space: nowrap; }
.ftab .icon { width: 14px; height: 14px; }
.ftab:hover { background: var(--fill); color: var(--fg); }
.ftab[aria-selected="true"] { background: var(--fill-2); color: var(--fg); font-weight: 600; }
.ftab.err span:not(.x) { text-decoration: underline wavy var(--err); text-underline-offset: 4px; }
.ftab .x { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: var(--fg-3); font-size: 14px; line-height: 1; }
.ftab .x:hover { background: var(--fill-2); color: var(--fg); }
.ftab .x.armed { background: var(--err); color: #fff; }
.file-add { width: 28px; height: 28px; flex: none; }
.file-name { flex: none; width: 170px; height: 28px; padding: 0 10px; border-radius: 999px; border: var(--hair) solid var(--line); background: var(--fill); color: var(--fg); font: 13px var(--mono); }
.file-name[hidden] { display: none; }

/* a problem's quick fix */
.problems li { display: flex; align-items: flex-start; gap: 4px; }
.problems li > button:first-child { flex: 1; min-width: 0; }
.problems .fix { appearance: none; flex: none; margin-top: 6px; height: 26px; padding: 0 12px; border-radius: 999px; border: var(--hair) solid var(--line); background: var(--fill); color: var(--fg); font: 500 12px var(--font); cursor: pointer; }
.problems .fix:hover { background: var(--fill-2); }

/* hover: a name's declaration */
.cm-decl-tip { max-width: 520px; padding: 8px 12px; font: 13px/1.45 var(--font); }
.cm-decl-tip pre { margin: 0; padding: 0; border: 0; background: none; font: 12.5px/1.5 var(--mono); white-space: pre-wrap; color: var(--syn-fg); }
.cm-decl-tip p { margin: 6px 0 0; color: var(--fg-2); }
.cm-decl-tip .where { font: 11.5px var(--mono); color: var(--fg-3); }

/* the Tests tab */
.tests { padding: 8px 12px 20px; font-size: 13.5px; }
.tests .msg { color: var(--fg-2); padding: 8px; }
.tests .summary { margin: 6px 4px 10px; font-weight: 600; font-size: 15px; }
.tests .summary.bad { color: var(--err); }
.tests h3 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--fg-3); margin: 14px 4px 6px; }
.tests ol, .tests ul { list-style: none; margin: 0; padding: 0; }
.tests li button { appearance: none; width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; border: 0; background: transparent; color: var(--fg); text-align: left; padding: 7px 8px; border-radius: 10px; font: inherit; cursor: pointer; }
.tests li button:hover { background: var(--fill); }
.tests .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tests .name b { font-family: var(--mono); font-size: 12.5px; font-weight: 600; }
.tests .dur { font: 11.5px var(--mono); color: var(--fg-3); white-space: nowrap; }
.tests .why { margin: 0 8px 6px 70px; color: var(--fg-2); font-size: 12.5px; overflow-wrap: anywhere; }
.tests .why code { font-size: 12px; }
.chip { display: inline-block; min-width: 52px; text-align: center; padding: 2px 8px; border-radius: 999px; font: 600 11px var(--font); background: var(--fill-2); color: var(--fg-2); }
.chip.pass { background: var(--fg); color: var(--bg); }
.chip.fail, .chip.error { background: var(--err); color: #fff; }
.chip.untested { background: transparent; box-shadow: inset 0 0 0 var(--hair) var(--line); }

/* the examples: a gallery */
.pg-examples { appearance: none; height: 32px; gap: 8px; padding: 0 30px 0 12px; border-radius: 999px; border: var(--hair) solid var(--line); background: var(--fill); color: var(--fg); font: 500 14px var(--font); cursor: pointer; max-width: 300px; }
.pg-examples:hover { background: var(--fill-2); }
.pg-examples > .icon:first-child { width: 15px; height: 15px; flex: none; }
.pg-examples #example-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery { width: min(1080px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: var(--hair) solid var(--line); border-radius: 20px; box-shadow: var(--shadow-lg); color: var(--fg); overflow: auto; }
.gallery::backdrop { background: rgba(0, 0, 0, .35); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.gallery-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px 22px; background: var(--glass-strong, var(--glass)); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.gallery-head h2 { margin: 0; font-size: 20px; letter-spacing: -0.01em; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; padding: 6px 18px 22px; }
.ex-card { appearance: none; display: flex; flex-direction: column; gap: 4px; padding: 10px; border-radius: 16px; border: var(--hair) solid var(--line); background: var(--card); color: var(--fg); text-align: left; cursor: pointer; font: 13px/1.4 var(--font); transition: transform .15s var(--ease), box-shadow .15s; }
.ex-card:hover, .ex-card:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow); }
.ex-card[aria-current="true"] { box-shadow: 0 0 0 2px var(--fg); }
.ex-card .thumb { display: grid; place-items: center; height: 140px; border-radius: 10px; background: #fff; overflow: hidden; margin-bottom: 6px; }
.ex-card .thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ex-card strong { font-size: 14px; }
.ex-card .blurb { color: var(--fg-2); font-size: 12.5px; }
.files .btn.block { width: 100%; justify-content: center; margin-bottom: 8px; }
.files .btn.block .icon { width: 15px; height: 15px; }
@media (max-width: 760px) { .zoom-tools #zoom-full { display: none; } .gallery-grid { grid-template-columns: 1fr 1fr; padding: 6px 10px 16px; } .ex-card .thumb { height: 96px; } }


/* "Add from the store": the shelves, a shelf's pieces by group, a piece's card */
.shelf-menu { width: min(760px, calc(100vw - 24px)); }
.shelf-tools { display: grid; gap: 10px; padding: 0 22px 10px; min-width: 0; }
.shelf-lede { margin: 0; color: var(--fg-2); font-size: 13.5px; }
.shelf-search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 999px; border: var(--hair) solid var(--line); background: var(--fill); color: var(--fg-2); min-width: 0; }
.shelf-search .icon { width: 15px; height: 15px; flex: none; }
.shelf-search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--fg); font: 14px var(--font); outline: none; }
.shelf-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--fg-2); font-size: 13px; }
.shelf-crumbs:empty { display: none; }
.shelf-crumb { appearance: none; border: 0; background: none; padding: 2px 0; color: var(--fg); font: 500 13px var(--font); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.shelf-body { padding: 0 18px 22px; min-width: 0; }
.shelf-body .empty { color: var(--fg-2); padding: 12px 4px; }
.shelf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.ex-card.shelf .count { margin-top: 4px; color: var(--fg-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.shelf-group h4 { margin: 14px 4px 6px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-2); }
.shelf-piece { appearance: none; display: grid; gap: 2px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px; background: none; color: var(--fg); text-align: left; cursor: pointer; font: 13px/1.4 var(--font); min-width: 0; }
.shelf-piece:hover, .shelf-piece:focus-visible { background: var(--fill-2); }
.shelf-piece strong { font-size: 14px; overflow-wrap: anywhere; }
.shelf-piece span { color: var(--fg-2); overflow-wrap: anywhere; }
.shelf-card { display: grid; gap: 10px; padding: 4px 4px 0; min-width: 0; }
.shelf-card h3 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.shelf-card h3 code { font-size: 13px; color: var(--fg-2); }
.shelf-from { margin: -6px 0 0; color: var(--fg-2); font-size: 13px; }
.shelf-card dl { display: grid; gap: 8px; margin: 0; }
.shelf-card dl div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; font-size: 13.5px; }
.shelf-card dt { color: var(--fg-2); font-weight: 500; }
.shelf-card dd { margin: 0; overflow-wrap: anywhere; }
.shelf-writes { margin: 6px 0 0; color: var(--fg-2); font-size: 13px; }
.shelf-card pre { margin: 0; padding: 10px 12px; border-radius: 10px; border: var(--hair) solid var(--line); background: var(--fill); font: 12.5px/1.5 var(--mono); overflow-x: auto; max-width: 100%; }
.shelf-card #store-insert { justify-self: start; }
.shelf-code { min-width: 0; max-width: 100%; }
.shelf-code summary { cursor: pointer; font-size: 13px; font-weight: 500; color: var(--fg-2); }
.shelf-code summary:hover { color: var(--fg); }
.shelf-code pre { margin-top: 8px; max-height: 50vh; overflow: auto; }
@media (max-width: 760px) { .shelf-tools { padding: 0 12px 10px; } .shelf-body { padding: 0 8px 16px; } .shelf-grid { grid-template-columns: minmax(0, 1fr); } .shelf-card dl div { grid-template-columns: minmax(0, 1fr); gap: 2px; } }

/* ---------- the easy playground: the gallery's levels and "Describe it", the picker, "Run it on your computer", a word explained ---------- */
.pg-examples { display: inline-flex; align-items: center; padding: 0 14px 0 12px; }
.pg-pick select { max-width: 220px; }
.gallery-level { padding: 2px 0 0; }
.gallery-level h3 { margin: 0; padding: 10px 22px 4px; font-size: 15px; letter-spacing: -0.01em; }
.gallery-level h3 span { margin-left: 6px; font-weight: 400; font-size: 13px; color: var(--fg-2); }
.gallery-level .gallery-grid { padding-bottom: 12px; }
.gallery-level:last-child .gallery-grid { padding-bottom: 22px; }
.ex-card .level { align-self: flex-start; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: .01em; color: var(--fg-2); background: var(--fill); border: var(--hair) solid var(--line); }
.ex-card .level-first { color: #0b6b3a; background: rgba(22, 163, 74, .12); border-color: rgba(22, 163, 74, .3); }
.ex-card .level-advanced { color: #7a4a00; background: rgba(217, 119, 6, .12); border-color: rgba(217, 119, 6, .3); }
:root[data-theme="dark"] .ex-card .level-first { color: #6ee7a3; }
:root[data-theme="dark"] .ex-card .level-advanced { color: #fbbf6b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ex-card .level-first { color: #6ee7a3; } :root:not([data-theme="light"]) .ex-card .level-advanced { color: #fbbf6b; } }
.describe { margin: 2px 18px 10px; padding: 12px 14px; border-radius: 16px; border: var(--hair) solid var(--line); background: var(--fill); display: flex; flex-direction: column; gap: 8px; font: 13px/1.45 var(--font); }
.describe label strong { font-size: 15px; }
.describe label span { color: var(--fg-2); margin-left: 4px; }
.describe-row { display: flex; gap: 8px; }
.describe-row input { flex: 1; min-width: 0; height: 36px; padding: 0 14px; border-radius: 999px; border: var(--hair) solid var(--line); background: var(--card); color: var(--fg); font: 14px var(--font); }
.describe-row input:focus-visible { outline: 2px solid var(--fg); outline-offset: 1px; }
.describe-row .btn { height: 36px; flex: none; }
.describe-hints { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--fg-2); font-size: 12.5px; }
.describe-word { appearance: none; padding: 2px 10px; border-radius: 999px; border: var(--hair) solid var(--line); background: var(--card); color: var(--fg); font: 12.5px var(--font); cursor: pointer; }
.describe-word:hover { background: var(--fill-2); }
.describe-note { margin: 0; min-height: 0; color: var(--fg-2); }
.describe-note:empty { display: none; }
.run-local { flex: none; border-top: var(--hair) solid var(--line); font: 13px/1.45 var(--font); background: var(--card); }
.run-local summary { display: flex; align-items: center; gap: 8px; padding: 8px 16px; cursor: pointer; color: var(--fg-2); list-style: none; user-select: none; }
.run-local summary::-webkit-details-marker { display: none; }
.run-local summary::after { content: "›"; margin-left: auto; transform: rotate(-90deg); transition: transform .15s; color: var(--fg-3); }
.run-local[open] summary::after { transform: rotate(90deg); }
.run-local summary .icon { width: 15px; height: 15px; }
.run-local-body { padding: 0 16px 12px; max-height: 190px; overflow: auto; color: var(--fg-2); }
.run-local-body p { margin: 0 0 8px; }
.run-local-body ol { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.run-local-body li { display: flex; flex-wrap: wrap; gap: 2px 12px; align-items: baseline; }
.run-local-body code { font: 12.5px var(--mono); color: var(--fg); background: var(--fill); padding: 2px 8px; border-radius: 6px; overflow-wrap: anywhere; }
.cm-explain { max-width: 380px; padding: 9px 12px; font: 13px/1.45 var(--font); }
.cm-explain p { margin: 0; }
.cm-explain .say { color: var(--fg); }
.cm-explain code { font: 12.5px var(--mono); }
.cm-explain .w { font-weight: 600; margin-right: 4px; padding: 1px 6px; border-radius: 6px; background: var(--fill); }
.cm-explain .ext { margin-top: 6px; font-size: 12px; color: var(--fg-2); }
.cm-explain .mark { display: inline-block; padding: 0 7px; border-radius: 999px; border: var(--hair) solid var(--line); background: var(--fill); font-weight: 600; margin-right: 4px; }
.cm-explain .more { margin-top: 6px; font-size: 12.5px; }
.cm-explain .more a { color: var(--fg-2); text-decoration: underline; text-underline-offset: 2px; }
.cm-explain .more a:hover { color: var(--fg); }
@media (max-width: 900px) {
  .pg-examples { padding: 0 10px; }
  .pg-examples .lbl { display: none; }
  .gallery-level h3 { padding: 10px 14px 4px; }
  .gallery-level h3 span { display: block; margin: 0; }
  .describe { margin: 2px 10px 8px; }
  .describe-row { flex-wrap: wrap; }
  .describe-row .btn { flex: 1 0 100%; }
  .cm-explain { max-width: min(380px, calc(100vw - 40px)); }
}

/* ---------- playground-easy: the four tabs of the loop, the phone's switch, the status in words, Check it, the first steps ---------- */
.page-playground { --good: #1f7a45; }
:root[data-theme="dark"] .page-playground { --good: #7fd4a0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .page-playground { --good: #7fd4a0; } }

/* the status: what the requirements are; a click opens Check it */
.pg-status { cursor: pointer; border-radius: 999px; padding: 4px 10px 4px 6px; margin-left: -2px; }
.pg-status:hover { background: var(--fill); }
.pg-status.good { color: var(--good); font-weight: 500; }
.pg-status.good .dot { background: var(--good); }
.pg-status.err { color: var(--err); font-weight: 500; }
.pg-help { width: 32px; padding: 0; justify-content: center; font-weight: 600; font-size: 15px; }
.pg-help[aria-expanded="true"] { background: var(--fill-2); }

/* the four tabs: a word each, at every width */
.groups { gap: 4px; padding: 0 8px; }
.groups button { appearance: none; flex: 0 1 auto; min-width: 0; border: 0; background: transparent; color: var(--fg-2); height: 32px; padding: 0 14px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: 600 14px var(--font); letter-spacing: -0.01em; cursor: pointer; white-space: nowrap; transition: background-color .15s, color .15s; }
.groups button .icon { width: 15px; height: 15px; flex: none; }
.groups button:hover { color: var(--fg); background: var(--fill); }
.groups button[aria-selected="true"] { color: var(--bg); background: var(--fg); }
.groups .count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; font-size: 11px; display: inline-grid; place-items: center; background: var(--err); color: #fff; }
.groups .count[hidden] { display: none; }
.groups button.tour-point { box-shadow: 0 0 0 2px var(--fg); animation: tour-point 1.4s ease-in-out infinite; }
@keyframes tour-point { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--fg) 25%, transparent); } }
@media (prefers-reduced-motion: reduce) { .groups button.tour-point { animation: none; } }
/* under them: one sentence of what the tab shows, and its views */
.group-bar { flex: none; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; padding: 8px 12px 8px 16px; border-bottom: var(--hair) solid var(--line); }
.group-lede { flex: 1 1 260px; margin: 0; color: var(--fg-2); font-size: 13px; line-height: 1.4; }
.subtabs { flex: none; display: flex; padding: 2px; border-radius: 999px; background: var(--fill); max-width: 100%; }
.subtabs[hidden] { display: none; }
.subtabs button { height: 26px; padding: 0 11px; font-size: 12.5px; }
.subtabs button[hidden] { display: none; }
.subtabs button[aria-selected="true"] { background: var(--card); box-shadow: 0 0 0 var(--hair) var(--line), var(--shadow); }
.tabs .count[hidden] { display: none; }

/* a phone: the model or the result */
.pg-switch { display: none; }
.pg-main { flex: 1; min-height: 0; display: flex; gap: 12px; }
.pg-main > .pg-split { flex: 1; min-width: 0; }
@media (max-width: 900px) {
  .pg-switch { flex: none; display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 999px; background: var(--fill); border: var(--hair) solid var(--line); }
  .pg-switch button { appearance: none; border: 0; background: transparent; color: var(--fg-2); height: 34px; border-radius: 999px; font: 600 14px var(--font); cursor: pointer; }
  .pg-switch button[aria-pressed="true"] { background: var(--card); color: var(--fg); box-shadow: var(--shadow); }
  .pg-split[data-pane="model"] > .pg-output, .pg-split[data-pane="result"] > .pg-editor { display: none; }
  .groups { padding: 0 6px; gap: 2px; }
  .groups button { flex: 1 1 0; padding: 0 6px; font-size: 13.5px; }
  .groups button .icon { display: none; }
  .group-bar { padding: 8px 10px 8px 12px; }
  .group-lede { flex-basis: 100%; }
  .subtabs button { height: 30px; }
}

/* a phone on its side: too short for a pane to fill what is left — the page scrolls, the pane keeps a height */
@media (max-width: 900px) and (max-height: 620px) {
  body.page-playground { height: auto; min-height: 100dvh; overflow: visible; }
  .pg-main > .pg-split { flex: none; height: 460px; }
}

/* problems: a sentence, its line, its fix */
.problems li { align-items: center; }
.problems .at { font: 12px var(--font); }
.problems .acts { flex: none; display: inline-flex; align-items: center; gap: 8px; padding-right: 8px; }
.problems .fix { margin-top: 0; width: auto; display: inline-flex; align-items: center; white-space: nowrap; background: var(--fg); color: var(--bg); border-color: transparent; }
.problems li > button:first-child { align-items: start; }
.problems .sev { align-self: start; padding: 0; border: 0; } /* site.css has a .sev of its own (the error pages' badge) */
.tests .msg.note { margin: 4px 0 8px; padding: 8px 10px; border-radius: 10px; background: var(--fill); }
.problems .fix:hover { background: var(--fg); opacity: .85; }
.problems .explain { font-size: 12px; color: var(--fg-2); white-space: nowrap; }
.hints-row { margin: 0; padding: 4px 16px 14px; }
.linkbtn { appearance: none; border: 0; background: none; padding: 0; color: var(--fg); font: 500 13px var(--font); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.linkbtn[hidden] { display: none; }
.cm-tour-line { background: color-mix(in srgb, var(--warn) 16%, transparent); box-shadow: inset 3px 0 0 var(--warn); }

/* Check it: each requirement, met or not */
.reqs-view { padding: 10px 14px 24px; font-size: 14px; }
.req-msg { margin: 8px 4px; color: var(--fg-2); line-height: 1.5; }
.req-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.req { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; padding: 12px 14px 12px 12px; border-radius: 14px; border: var(--hair) solid var(--line); background: var(--card); }
.req .mark { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 15px; background: var(--fill-2); color: var(--fg-2); }
.req.pass .mark { background: var(--good); color: var(--bg); }
.req.fail .mark { background: var(--err); color: #fff; }
.req.fail { border-color: var(--err); }
.req-head { appearance: none; border: 0; background: none; padding: 0; color: var(--fg); font: inherit; text-align: left; cursor: pointer; display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; }
.req-head b { font: 600 12.5px var(--mono); }
.req-head span { font-weight: 600; }
.req-head:hover span { text-decoration: underline; text-underline-offset: 2px; }
.req-text { margin: 4px 0 0; line-height: 1.45; }
.req-by { margin: 6px 0 0; color: var(--fg-2); font-size: 12.5px; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; }
.req.fail .req-state { color: var(--err); font-weight: 600; }
.req.pass .req-state { color: var(--good); font-weight: 600; }
.req .why-btn { margin-left: auto; }
.why { margin-top: 10px; padding-top: 10px; border-top: var(--hair) solid var(--line); font-size: 13.5px; line-height: 1.5; }
.why p { margin: 0 0 6px; }
.why code { font: 12.5px var(--mono); background: var(--fill); padding: 1px 5px; border-radius: 5px; }
.why-case, .why-note, .why-seen { color: var(--fg-2); }
.why-reasons { list-style: none; margin: 8px 0; padding: 0; }
.why-reasons ul { list-style: none; margin: 6px 0 0; padding-left: 14px; border-left: 2px solid var(--line); }
.why-reason > p:first-child { font-weight: 600; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--err) 10%, transparent); }
.why-reason ul .why-reason > p:first-child { font-weight: 400; background: none; padding: 0; }
.why-line { white-space: nowrap; font-weight: 600; }
.why-h, .why-timeline summary { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--fg-3); margin: 12px 0 6px; cursor: default; }
.why-timeline summary { cursor: pointer; }
.why-tl { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow: auto; font-size: 12.5px; }
.why-tl li { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 10px; padding: 3px 0; }
.why-tl .t { font: 11.5px var(--mono); color: var(--fg-3); text-align: right; padding-top: 1px; }
.why-tl .what { overflow-wrap: anywhere; }
.why-tl small { display: block; color: var(--fg-3); font-size: 11.5px; }
.why-tl li.bad .what { color: var(--err); font-weight: 600; }
.why-tl li.good .what { color: var(--good); }
.why-tl li.k-state .what { font-weight: 600; }

/* the first steps: a panel beside the model; a strip above it when there is no room */
.tour { flex: none; width: 290px; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: var(--r-l); border: var(--hair) solid var(--line); background: var(--card); box-shadow: var(--shadow); font-size: 13.5px; line-height: 1.5; }
.tour[hidden] { display: none; }
.tour-head { display: flex; align-items: center; gap: 8px; }
.tour-head strong { font-size: 15px; letter-spacing: -0.01em; }
.tour-count { color: var(--fg-3); font-size: 12px; margin-left: auto; white-space: nowrap; }
.tour-head .iconbtn { width: 28px; height: 28px; font-size: 18px; line-height: 1; flex: none; }
.tour-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; flex: 1; align-content: start; }
.tour-step { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; padding: 8px; border-radius: 12px; }
.tour-step.current { background: var(--fill); }
.tour-step .num { appearance: none; border: 0; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--fill-2); color: var(--fg-2); font: 600 12.5px var(--font); cursor: pointer; padding: 0; }
.tour-step.current .num { background: var(--fg); color: var(--bg); }
.tour-step.done:not(.current) .num { background: var(--good); color: var(--bg); }
.tour-step h3 { margin: 3px 0 0; font-size: 13.5px; font-weight: 600; color: var(--fg-2); }
.tour-step.current h3 { color: var(--fg); font-size: 14.5px; }
.tour-step p { margin: 4px 0 0; }
.tour-step code { font: 12.5px var(--mono); background: var(--card); padding: 1px 5px; border-radius: 5px; box-shadow: 0 0 0 var(--hair) var(--line); }
.tour-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tour-nav { display: flex; justify-content: space-between; gap: 8px; }
@media (max-width: 1180px) {
  .pg-main { flex-direction: column; gap: 8px; }
  /* one row: the step's number, Back and Next, the close button; under it, the step */
  .tour { width: auto; max-height: 42vh; padding: 8px 10px 10px 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 4px 8px; }
  .tour-head { display: contents; }
  .tour-head strong { display: none; }
  .tour-count { grid-area: 1 / 1; margin: 0; font-weight: 600; color: var(--fg-2); }
  .tour-nav { grid-area: 1 / 2; }
  .tour-nav .btn { height: 28px; padding: 0 12px; }
  .tour-head .iconbtn { grid-area: 1 / 3; }
  .tour-steps { grid-area: 2 / 1 / 3 / 4; }
  .tour-step p { font-size: 13.5px; line-height: 1.45; }
  .tour-step:not(.current) { display: none; }
  .tour-step { padding: 0; background: none !important; grid-template-columns: minmax(0, 1fr); }
  .tour-step .num { display: none; }
  .tour-step h3 { margin-top: 0; }
  .tour-acts { margin-top: 8px; }
}
