/* dharmatiles: the one visual system, shared by the docs site and the
   preview (which serves this file and fonts/ from inside the program).

   The idea: a tile is always shown the same way, on the pale light-box
   plate the renderer uses (#D9E0EB), ruled in its squares.  Around it the
   chrome is Moonpool at night and Lichen & Linen by day; a botanical or
   sea-glass accent marks what you can press. --over and --band paint overhang on a model; --err is the
   interface's danger colour (errors, destructive buttons), and may look alike; the four
   material colours mean element families and nothing else.

   Type: Big Shoulders Display for names and headings (the box-art voice),
   IBM Plex Sans for reading and controls, JetBrains Mono for anything you
   type into a .dtile or a terminal. */

@font-face { font-family: "Big Shoulders Display"; font-style: normal; font-weight: 500 900; font-display: swap; src: url("fonts/big-shoulders-display.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("fonts/plex-sans.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/plex-sans-italic.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("fonts/jetbrains-mono.woff2") format("woff2"); }

:root {
  /* type */
  --f-display: "Big Shoulders Display", "Arial Narrow", sans-serif-condensed, Impact, sans-serif;
  --f-body: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --f-code: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  /* Lichen & Linen is tactile and gently rounded. Moonpool tightens this below. */
  --r: 5px; --r-lg: 10px; --r-mark: 2px;   /* the only corners: controls and panels, and the small marks and bars */
  /* four type sizes, each with its line height; 12 px is the floor.  Every font-size of the page reads these. */
  --fs-s: 12px;  --lh-s: 16px;   /* captions, counts, keys, the status line */
  --fs-m: 14px;  --lh-m: 20px;   /* rows, values, buttons, messages */
  --fs-l: 17px;  --lh-l: 24px;   /* the name at the top of a level */
  --fs-xl: 24px; --lh-xl: 28px;  /* display: the thing itself (Big Shoulders) */
  /* two control heights; a segmented control is --h-md outside and --h-sm inside */
  --h-sm: 24px; --h-md: 30px;
  --mark: 8px;           /* the status mark: one square with --r-mark corners */
  --sq: 24px;            /* the ruling of the plate pattern */
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* the plate: identical in both themes, like the renders */
  --plate: #D9E0EB; --plate-hi: #EBEFF5; --plate-ink: #2B3340;
  /* chrome laid on the plate (status, errors, hints): light in both themes */
  --chip-ink: #1A1714; --chip-muted: #5E5850; --chip-err: #B8281A; --chip-bg: rgb(255 255 255 / .88);
  --chip-line: rgb(43 51 64 / .16); --chip-shadow: 0 8px 24px -12px rgb(26 23 20 / .45);
  --scrim: rgb(18 20 24 / .46);
  /* the editor's open sky: bright lake blue by day */
  --sky-top: #5D9FCA; --sky-mid: #9BCBE2; --sky-horizon: #E3EFF0;
  --sky-cloud: rgb(255 255 255 / .22); --sky-haze: rgb(231 242 238 / .7); --grid-ink: #2B3340;

  /* overhang: these two colours are the gate's, and only the gate's */
  --over: #E5483B; --band: #FF8C1A;
  /* caution: a note (a tile that passes but wants a look, such as dt::steep), in the messages panel and as a mark in the source; the debug layer's yellow (--dbg-cut), the same in both themes; never red or orange. Only as a dot, a stripe or an underline: text on it stays --ink */
  --caution: #E2C21C;
  /* the editor's debug layer, drawn on the model: no red or orange (those
     are overhang); the same in both themes, as the tile is */
  --dbg-spine: #2F6FE0; --dbg-cut: #E2C21C; --dbg-edge: #E356C4; --dbg-flow: #3C4654;
  --dbg-outside: #9AA1AB; --dbg-short-line: #8B46D8; --dbg-short-rim: #10A3A3; --dbg-short-other: #6E8F2A;
  --dbg-crowded: #15171A; --dbg-under: #7A4B2A; --dbg-soil: #D2B48C; --dbg-cover: #FFFFFF;

  /* light: Lichen & Linen */
  --bg: #F3F2EC; --panel: #E6EAE1; --raised: #FCFCF8; --line: #C9D1C8; --line-2: #AEBBB0;
  --ink: #1D2922; --muted: #657168;
  --accent: #287B62; --accent-hi: #1F654F; --on-accent: #F5FFF9;
  /* the places a selected region is made from, drawn beside it in the editor (never overhang's colours) */
  --ref: #5B4BB5; --on-ref: #FFFFFF;
  /* the control points a selected line or region refers to, marked and labelled in the editor (never overhang's colours) */
  --point: #9A2F73; --on-point: #FFFFFF;
  /* a selected cloud (a top= or a pin) drawn on the model: its own colour, so a rock's cloud is not the teal of the rock's selection outline (never overhang's colours) */
  --cloud: #3A56E0;
  --moss: #4F844F; --water: #337F8A; --stone: #64706A; --earth: #987563; --bloom: #895E82;
  --ok: #397A55; --err: #B83B2E;
  --code-bg: #E6EAE1;
  --shadow: 0 1px 2px rgb(29 41 34 / .06), 0 12px 30px -18px rgb(40 51 45 / .3);
  --scroll-shadow: rgb(29 41 34 / .2);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  /* dark: Moonpool */
  --r: 4px; --r-lg: 8px;
  --bg: #081319; --panel: #0E2028; --raised: #172D37; --line: #29454D; --line-2: #3B5C66;
  --ink: #EAF7F5; --muted: #91A9AD;
  --accent: #38C9B3; --accent-hi: #6EE0CD; --on-accent: #051513;
  --ref: #A99BFF; --on-ref: #0B0820;
  --point: #F2A1D8; --on-point: #2A0A1F;
  --cloud: #93A8FF;
  --moss: #72B07C; --water: #83A8FF; --stone: #B9C9CD; --earth: #C08A73; --bloom: #C895E5;
  --ok: #50B780; --err: #F06A5C; --over: #EE5444;
  --sky-top: #06182E; --sky-mid: #0E3A59; --sky-horizon: #2A6374;
  --sky-cloud: rgb(139 205 218 / .09); --sky-haze: rgb(46 105 116 / .48); --grid-ink: #C7E3EC;
  --code-bg: #061015;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 28px -10px rgb(0 0 0 / .6);
  --scroll-shadow: rgb(0 0 0 / .5);
  color-scheme: dark;
} }
:root[data-theme="dark"] {
  --r: 4px; --r-lg: 8px;
  --bg: #081319; --panel: #0E2028; --raised: #172D37; --line: #29454D; --line-2: #3B5C66;
  --ink: #EAF7F5; --muted: #91A9AD;
  --accent: #38C9B3; --accent-hi: #6EE0CD; --on-accent: #051513;
  --ref: #A99BFF; --on-ref: #0B0820;
  --point: #F2A1D8; --on-point: #2A0A1F;
  --cloud: #93A8FF;
  --moss: #72B07C; --water: #83A8FF; --stone: #B9C9CD; --earth: #C08A73; --bloom: #C895E5;
  --ok: #50B780; --err: #F06A5C; --over: #EE5444;
  --sky-top: #06182E; --sky-mid: #0E3A59; --sky-horizon: #2A6374;
  --sky-cloud: rgb(139 205 218 / .09); --sky-haze: rgb(46 105 116 / .48); --grid-ink: #C7E3EC;
  --code-bg: #061015;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 28px -10px rgb(0 0 0 / .6);
  --scroll-shadow: rgb(0 0 0 / .5);
  color-scheme: dark;
}

/* Scroll shadows: js/scroll-shadows.js adds .scrolls to a scrolling panel and
   sh-t / sh-b / sh-l / sh-r at each edge with more content beyond it. */
.scrolls {
  --sh-n: linear-gradient(transparent, transparent);
  background-image: var(--sh-t, var(--sh-n)), var(--sh-b, var(--sh-n)), var(--sh-l, var(--sh-n)), var(--sh-r, var(--sh-n));
  background-repeat: no-repeat;
  background-size: 100% 14px, 100% 14px, 14px 100%, 14px 100%;
  background-position: top, bottom, left, right;
}
.scrolls.sh-t { --sh-t: linear-gradient(to bottom, var(--scroll-shadow), transparent); }
.scrolls.sh-b { --sh-b: linear-gradient(to top, var(--scroll-shadow), transparent); }
.scrolls.sh-l { --sh-l: linear-gradient(to right, var(--scroll-shadow), transparent); }
.scrolls.sh-r { --sh-r: linear-gradient(to left, var(--scroll-shadow), transparent); }

::selection { background: color-mix(in srgb, var(--accent) 38%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r); }

/* the mark: the lotus, drawn in the current colour */
.mark { display: inline-block; width: 1.35em; height: 1.35em; flex: none; vertical-align: -.28em; background: currentColor;
  -webkit-mask: var(--mark-url, url("logo.svg")) center / contain no-repeat; mask: var(--mark-url, url("logo.svg")) center / contain no-repeat; }
.wordmark { font: 800 var(--fs-xl)/1 var(--f-display); letter-spacing: .01em; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.wordmark .mark { color: var(--accent); }

/* buttons: one look everywhere */
.btn, button.btn {
  font: 500 var(--fs-m)/var(--lh-m) var(--f-body); color: var(--ink); background: var(--raised);
  border: 1px solid var(--line); border-radius: var(--r); height: var(--h-md); padding: 0 12px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: border-color .15s var(--ease), background-color .15s var(--ease), color .15s var(--ease);
}
.btn:hover { border-color: var(--line-2); background: color-mix(in srgb, var(--raised) 80%, var(--ink) 4%); }
.btn[aria-pressed="true"], .btn.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.icon { padding: 0; width: var(--h-md); justify-content: center; }
.btn.sm { height: var(--h-sm); padding: 0 8px; font-size: var(--fs-s); line-height: var(--lh-s); }
.btn.icon.sm { width: var(--h-sm); padding: 0; }
/* copy: one control for copying a value, anywhere.  The copy icon turns into a check mark once copied
   (web/preview/js/copy.js); with a label it is a normal button whose words read "Copied". */
.copy.done { color: var(--accent); }
.btn.icon.copy { width: var(--h-sm); height: var(--h-sm); vertical-align: middle; }
/* the one icon set (web/preview/js/view/icons.js): inline svg, drawn in the current colour */
.ico { display: inline-block; flex: none; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ico.cam { stroke-width: 1.3; }

/* the status mark: one 8 px square, one colour for its state: a tile, a build, a message, a stack row, the status line */
.dot { width: var(--mark); height: var(--mark); border-radius: var(--r-mark); flex: none; background: var(--line-2); }
.dot.ready, .dot.ok, .dot.info { background: var(--ok); }
.dot.failed, .dot.bad, .dot.error { background: var(--err); }
.dot.note, .dot.warning { background: var(--caution); }
.dot.building, .dot.busy { background: var(--accent); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* a label: sentence case, one size, one weight, in the ink; the only label style (no capitals, no tracking) */
.cap { font: 600 var(--fs-s)/var(--lh-s) var(--f-body); color: var(--ink); }

/* segmented control: a row of choices, one chosen */
.seg { display: inline-flex; box-sizing: border-box; height: var(--h-md); padding: 2px; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); flex-wrap: wrap; }
.seg > button { font: 500 var(--fs-s)/var(--lh-s) var(--f-body); color: var(--muted); background: transparent; border: 0; border-radius: var(--r); height: var(--h-sm); padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: 1 1 auto; text-align: center; cursor: pointer; white-space: nowrap; transition: color .15s var(--ease), background-color .15s var(--ease); }
/* one rule: a track wider than its buttons (a stretched grid cell, width: 100%) shares the room out; a track that hugs them is unchanged */
.seg > button:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.seg > button[aria-pressed="true"], .seg > button.on { background: var(--accent); color: var(--on-accent); }
.seg > button .n { opacity: .7; font-size: var(--fs-s); margin-left: 3px; font-variant-numeric: tabular-nums; }

/* switch: a checkbox drawn as a sliding square */
.switch { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; font: 400 var(--fs-m)/var(--lh-m) var(--f-body); color: var(--ink); }
.switch input { appearance: none; -webkit-appearance: none; margin: 0; width: 28px; height: 16px; border-radius: var(--r); background: var(--line); position: relative; cursor: pointer; flex: none; transition: background-color .15s var(--ease); }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: var(--r-mark); background: var(--raised); box-shadow: 0 1px 2px rgb(0 0 0 / .25); transition: transform .18s var(--ease); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(12px); background: var(--on-accent); }
.switch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

kbd { font: 500 var(--fs-s)/var(--lh-s) var(--f-code); color: var(--muted); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: var(--r); padding: 2px 4px; background: var(--bg); }

/* every text-like input and every select takes the control style; a missing or new `type` cannot leave one to the browser.
   :where keeps the specificity at an element's, so a class (.pin, .edit, .word-select) still sets its own size. */
input:where(:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="color"], [type="button"], [type="submit"], [type="reset"], [type="image"], [type="hidden"])), select:where(:not([multiple])), .field {
  font: 400 var(--fs-m)/var(--lh-m) var(--f-body); color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--r); padding: 0 10px; width: 100%;
}
input:where(:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="color"], [type="button"], [type="submit"], [type="reset"], [type="image"], [type="hidden"])), select:where(:not([multiple])) { height: var(--h-md); }
input[type="number"] { font-family: var(--f-code); }
input::placeholder { color: var(--muted); }
input:where(:not([type="checkbox"], [type="radio"], [type="range"])):focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input[type="range"] { accent-color: var(--accent); }

/* dialogs: native modal semantics, in the same quiet material */
dialog { width: min(420px, calc(100% - 32px)); color: var(--ink); background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 0; }
dialog::backdrop { background: var(--scrim); backdrop-filter: blur(2px); }
dialog form { padding: 20px; }
dialog .eyebrow { color: var(--ink); font: 600 var(--fs-s)/var(--lh-s) var(--f-body); }
dialog h2 { font: 700 var(--fs-xl)/var(--lh-xl) var(--f-display); margin: 6px 0 18px; }
dialog .field { display: grid; gap: 6px; margin: 12px 0; color: var(--ink); font-size: var(--fs-s); font-weight: 600; }
dialog input, dialog select { width: 100%; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 0 10px; height: var(--h-md); font: var(--fs-m)/var(--lh-m) var(--f-body); }
dialog input:focus, dialog select:focus { border-color: var(--accent); outline: 3px solid color-mix(in srgb, var(--accent) 20%, transparent); }
.dialog-note { color: var(--muted); font-size: var(--fs-s); margin: 14px 0 20px; }
.btn.danger { color: var(--err); }
.btn.danger:hover { border-color: var(--err); }

/* the plate: every render and the live view sit on it */
.plate {
  background-color: var(--plate);
  background-image:
    linear-gradient(color-mix(in srgb, var(--plate-ink) 9%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--plate-ink) 9%, transparent) 1px, transparent 1px);
  background-size: var(--sq) var(--sq);
  background-position: -1px -1px;
  border-radius: var(--r-lg);
}

/* element families: the material colours */
.fam-surface { --fam: var(--earth); } .fam-thing { --fam: var(--stone); } .fam-plant { --fam: var(--moss); }
.fam-water { --fam: var(--water); } .fam-doc { --fam: var(--muted); } .fam-base { --fam: var(--line-2); }

/* scrollbars that belong to the page */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* A picture card: a tile (or any thing with a picture) to press or drag, a picture over its name and size.  The preview's
   Add tiles level lays them in a two-column grid (style.css). */
.acard { box-sizing: border-box; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; align-content: start; overflow: hidden; padding-bottom: 7px; border: 1px solid var(--line); border-radius: var(--r); background: var(--raised); color: var(--ink); cursor: pointer; font: var(--fs-m)/var(--lh-m) var(--f-body); }
.acard:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.acard:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* A tile's small picture (js/thumbs.js): the plate's own tone, quiet, until the picture arrives; red when it could not be made. */
.thumb-pic { display: block; aspect-ratio: 176 / 124; background: var(--plate, #D9E0EB); overflow: hidden; }
.thumb-pic.ph { opacity: .55; }
.thumb-pic.bad { box-shadow: inset 0 0 0 2px var(--err); }
/* a tile that does not build: its mistake's code where the picture would be */
.broken { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; text-align: center; padding: 4px; box-sizing: border-box; color: var(--err); font-size: var(--fs-s); line-height: var(--lh-s); overflow: hidden; }
.broken b { font-weight: 600; overflow-wrap: anywhere; }
.thumb-pic img { width: 100%; height: 100%; display: block; }

/* The seed strip: five candidate seeds of a tile, the current first; a square marks one you own. */
.seed-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 6px 0 8px; }
.seed-card { position: relative; box-sizing: border-box; display: grid; padding: 0 0 3px; overflow: hidden; border: 2px solid var(--line); border-radius: var(--r); background: var(--raised); color: var(--ink); cursor: pointer; font: var(--fs-s)/var(--lh-s) var(--f-body); text-align: left; }
.seed-card:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.seed-card.on { border-color: var(--accent); }
.seed-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.seed-card b { padding: 3px 6px 0; font-weight: 600; font-family: var(--f-code); }
.seed-card .now { position: absolute; right: 5px; top: 5px; padding: 0 5px; border-radius: var(--r-mark); background: var(--accent); color: var(--on-accent); font: 600 var(--fs-s)/var(--lh-s) var(--f-body); }
.seed-card .own { position: absolute; left: 5px; top: 5px; width: var(--mark); height: var(--mark); border-radius: var(--r-mark); background: var(--ok); box-shadow: 0 0 0 1.5px var(--raised); }
.seed-strip-acts { display: flex; gap: 8px; margin-bottom: 8px; }

/* ---- the status line, one component: the editor's bottom bar and the site's cards (js/view/status-line.js) ---- */
.statusline { position: relative; display: flex; align-items: center; min-height: var(--h-md); background: var(--bg); border-top: 1px solid var(--line); font-size: var(--fs-s); color: var(--muted); font-variant-numeric: tabular-nums; }
.statusline .sl-bar { position: absolute; left: 0; top: -1px; height: 2px; width: 0; background: var(--accent); transition: width .12s linear; }
.statusline .sl-main { display: inline-flex; align-items: center; gap: 8px; min-height: var(--h-md); padding: 0 12px; background: none; border: 0; color: var(--ink); cursor: pointer; font: inherit; text-align: left; flex-wrap: wrap; }
.statusline .sl-main:hover, .statusline .sl-main[aria-expanded="true"] { background: var(--panel); }
.statusline .sl-main:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.statusline .sl-counts { color: var(--muted); }
.statusline[data-tone="idle"] .dot { box-sizing: border-box; background: transparent; border: 1.5px dashed var(--muted); }

/* ---- the messages list, one component: the editor's panel and the cards' strip (js/view/messages-panel.js) ---- */
.msglist .msg { display: flex; align-items: flex-start; gap: 10px; padding: 7px 12px 7px 14px; border-left: 3px solid transparent; transition: opacity .15s var(--ease), background-color .3s; }
.msglist .msg + .msg { border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.msglist .msg.error { border-left-color: var(--err); }
.msglist .msg.note, .msglist .msg.warning { border-left-color: var(--caution); }
.msglist .msg .dot { margin-top: 5px; }
.msglist .msg .body { flex: 1; min-width: 0; }
.msglist .msg .head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.msglist .msg .code { font: var(--fs-s) var(--f-code); color: var(--muted); white-space: nowrap; }
.msglist .msg .text { overflow-wrap: anywhere; font-size: var(--fs-m); line-height: 1.4; }
.msglist .msg .help { color: var(--muted); font-size: var(--fs-s); margin-top: 1px; }
.msglist .msg .where { display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font: var(--fs-s) var(--f-code); margin-top: 2px; }
.msglist .msg .where:empty { display: none; }
.msglist .msg .w { font: var(--fs-s) var(--f-code); background: color-mix(in srgb, var(--ink) 8%, transparent); border-radius: var(--r); padding: 0 3px; }
.msglist .msg.goes { cursor: pointer; }
.msglist .msg.goes:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.msglist .msg .acts { flex: none; display: flex; gap: 6px; align-items: center; }
.msglist .msg .acts .btn { height: var(--h-sm); padding: 0 8px; font-size: var(--fs-s); }
.msglist .msg .acts .btn.icon { width: var(--h-sm); height: var(--h-sm); padding: 0; }
.msglist .msg .report-pane { margin-top: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r); background: color-mix(in srgb, var(--ink) 4%, transparent); cursor: default; }
.msglist .msg .report-head { font-size: var(--fs-s); color: var(--muted); margin-bottom: 6px; }
.msglist .msg .report-body { margin: 0; max-height: clamp(48px, 28vh, 160px); overflow: auto; font: var(--fs-s) var(--f-code); white-space: pre-wrap; overflow-wrap: anywhere; }
.msglist .msg .report-opt { display: flex; gap: 6px; align-items: center; font-size: var(--fs-s); margin-bottom: 6px; }
.msglist .msg .report-note, .msglist .msg .report-wait { font-size: var(--fs-s); color: var(--muted); margin-bottom: 6px; }
.msglist .msg .report-err { font-size: var(--fs-s); color: var(--err); margin-bottom: 6px; }
.msglist .msg .report-acts { display: flex; gap: 6px; margin-bottom: 6px; }
.msglist .msg .report-acts .btn { height: var(--h-sm); padding: 0 8px; font-size: var(--fs-s); }
.msglist .msg.dim { opacity: .5; }
.msglist .msg.lit { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.msglist .msg.rec .line, .msglist .msg.run .line { font-weight: 600; }
.msglist .msg .sub { color: var(--muted); font-size: var(--fs-s); }
.msglist .rbar { height: 4px; margin-top: 6px; border-radius: var(--r-mark); background: var(--line); overflow: hidden; max-width: 320px; }
.msglist .rbar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .12s linear; }
.msglist .gauges { display: grid; gap: 4px; margin-top: 6px; max-width: 520px; }
.msglist .underside { margin: 0; flex: none; display: grid; gap: 3px; width: 136px; }
.msglist .underside svg { display: block; width: 100%; max-height: 118px; background: var(--plate); border: 1px solid var(--line-2); border-radius: var(--r); }
.msglist .underside .u-bed { fill: var(--plate-hi); }
.msglist .underside .u-band { fill: var(--band); stroke: var(--band); stroke-width: .35; stroke-linejoin: round; }
.msglist .underside .u-over { fill: var(--over); stroke: var(--over); stroke-width: .35; stroke-linejoin: round; }
.msglist .underside figcaption { color: var(--muted); font-size: var(--fs-s); line-height: var(--lh-s); }
.msglist .underside .sw { display: inline-block; width: 8px; height: 8px; margin-right: 3px; vertical-align: baseline; }
.msglist .underside .sw.over { background: var(--over); }
.msglist .underside .sw.band { background: var(--band); margin-left: 4px; }
.msglist .gauge { display: grid; grid-template-columns: 112px minmax(80px, 1fr) auto; align-items: center; gap: 10px; font-size: var(--fs-s); }
.msglist .g-bar { height: 12px; border-radius: var(--r); background: color-mix(in srgb, var(--ink) 9%, transparent); overflow: hidden; }
.msglist .g-bar i { display: flex; align-items: center; justify-content: flex-end; height: 100%; min-width: 2px; background: var(--ok); border-radius: var(--r); }
.msglist .gauge.warn .g-bar i { background: var(--band); }
.msglist .gauge.bad .g-bar i { background: var(--over); }
.msglist .g-bar b { padding: 0 5px; color: #fff; font-weight: 600; font-size: var(--fs-s); line-height: 12px; }
.msglist .gauge.ok .g-bar i { width: 0 !important; min-width: 0; }
.msglist .g-num { font-variant-numeric: tabular-nums; color: var(--muted); }
.msglist .gauge.bad .g-num { color: var(--over); font-weight: 600; }
.msglist .gate-details { margin-top: 5px; font-size: var(--fs-s); }
.msglist .gate-details > summary { cursor: pointer; color: var(--muted); }
.msglist .nums { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 1px 18px; margin-top: 5px; font-size: var(--fs-s); }
.msglist .nums dt { white-space: nowrap; }
.msglist .nums .pair { display: flex; justify-content: space-between; gap: 10px; }
.msglist .fail { color: var(--ink); font-size: var(--fs-s); margin-top: 2px; }
.msglist .fail::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: var(--r-mark); background: var(--over); }
.msglist .nums dd { text-align: left; }
.msglist .nums dd.bad { color: var(--over); font-weight: 600; }
.msglist .nums dd.warn { color: var(--band); }
.msglist .from-last { padding: 8px 14px 3px; }
.msglist .cleared { padding: 6px 14px; color: var(--muted); font-size: var(--fs-s); cursor: default; }
.msglist .cleared::before { content: "✓ "; }
.msglist .empty-msg { padding: 18px 14px; color: var(--muted); }

/* ---- <dt-example>: a live example on a page (docs/assets/live/).  Complete with no script: the poster and the source are plain markup ---- */
dt-example { display: block; margin: 20px 0 26px; }
dt-example figcaption { margin-top: 8px; color: var(--muted); font-size: var(--fs-m); line-height: var(--lh-m); }
.dtx-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: start; }
@media (min-width: 760px) { .dtx-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); } }
.dtx-view { position: relative; margin: 0; width: 100%; max-width: 100%; background: var(--plate); border: 1px solid color-mix(in srgb, var(--plate-ink) 30%, var(--plate)); border-radius: var(--r); overflow: hidden; touch-action: pan-y; }
.dtx-poster { display: block; width: 100%; height: 100%; object-fit: contain; }
.dtx-gl, .dtx-ov { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; display: none; background: none; border-radius: 0; }
.dtx-ov { pointer-events: none; }
.dtx-ov.dtx-pre { display: block; }
dt-example[data-view="live"] .dtx-gl, dt-example[data-view="live"] .dtx-ov, dt-example[data-state="queued"] .dtx-ov, dt-example:not([data-state="cold"]) .dtx-ov { display: block; }
dt-example[data-view="live"] .dtx-poster { visibility: hidden; }
dt-example[data-state="cold"] .dtx-view { cursor: pointer; }
.dtx-wake { position: absolute; right: 8px; bottom: 8px; }
.dtx-gl { touch-action: none; }
/* a card on a phone: the thumb scrolls the page until it asks to turn the tile */
.dtx-view[data-busy="true"] .dtx-gl, .dtx-view[data-busy="true"] .dtx-poster { opacity: .82; }
dt-example[data-state="queued"] .dtx-view { --queued: 1; }
.dtx-badge { position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: var(--r); background: var(--bg); color: var(--ink); font-size: var(--fs-s); line-height: var(--lh-s); border: 1px solid var(--line-2); pointer-events: none; }
.dtx-badge:empty { display: none; }
.dtx-badge[data-kind="queued"] { border-style: dashed; color: var(--muted); }
.dtx-badge[data-kind="building"]::before { content: ""; display: inline-block; width: var(--mark); height: var(--mark); margin-right: 6px; border-radius: var(--r-mark); background: var(--accent); animation: pulse 1s ease-in-out infinite; }
.dtx-nothing { display: grid; place-items: center; min-height: 140px; background: var(--chip-bg, var(--plate)); }
.dtx-nobuild { display: grid; gap: 4px; padding: 16px; text-align: center; color: var(--plate-ink); }
.dtx-nobuild b { font: 700 var(--fs-l)/var(--lh-l) var(--f-display); letter-spacing: .02em; }
.dtx-nobuild span { font-size: var(--fs-m); }
.dtx-code, .dtx-area, .dtx-mirror { margin: 0; font: var(--fs-m)/var(--lh-m) var(--f-code); tab-size: 4; white-space: pre; }
.dtx-code { padding: 10px 12px; overflow-x: auto; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r); max-width: 100%; box-sizing: border-box; }
.dtx-code code { font: inherit; background: none; padding: 0; }
.dtx-side { display: grid; gap: 10px; min-width: 0; }
.dtx-toggles { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dtx-label { color: var(--muted); font-size: var(--fs-s); margin-right: 4px; }
.dtx-controls:empty { display: none; }
.dtx-control { display: grid; grid-template-columns: 5.5em minmax(60px, 1fr) 4.5em auto; gap: 10px; align-items: center; font-size: var(--fs-m); }
.dtx-control input[type="range"] { width: 100%; min-width: 0; accent-color: var(--accent); }
.dtx-control output { font: var(--fs-s) var(--f-code); color: var(--muted); }
.dtx-control.missing { color: var(--muted); font-size: var(--fs-s); }
.dtx-cname { font-family: var(--f-code); font-size: var(--fs-s); }
.dtx-source { position: relative; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r); }
.dtx-source:focus-within { border-color: var(--accent); }
.dtx-mirror, .dtx-area { box-sizing: border-box; width: 100%; padding: 10px 12px; border: 0; overflow: auto; }
.dtx-mirror { position: absolute; inset: 0; color: transparent; pointer-events: none; overflow: hidden; }
.dtx-area { position: relative; display: block; resize: none; background: transparent; color: var(--ink); outline: none; min-height: 6em; }
.dtx-mirror .m-err { text-decoration: underline wavy var(--err); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.dtx-mirror .m-note { text-decoration: underline wavy var(--caution); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.dtx-mirror .m-lit { background: color-mix(in srgb, var(--accent) 24%, transparent); border-radius: var(--r-mark); }
.dtx-mirror .m-pin { background: color-mix(in srgb, var(--accent) 34%, transparent); border-radius: var(--r-mark); }
.dtx-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.dtx-actions a.btn { text-decoration: none; }
.dtx-msgs { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); padding: 4px 0; }
.dtx-side .statusline { border: 1px solid var(--line); border-radius: var(--r); }
.dtx-fail { padding: 8px 12px; border: 1px solid var(--err); border-radius: var(--r); color: var(--ink); background: color-mix(in srgb, var(--err) 8%, var(--bg)); }
@media (prefers-reduced-motion: reduce) { .dtx-badge[data-kind="building"]::before { animation: none; } }

/* A document's colours: one mapping of the tile language's token classes (dt-lang's highlighter, `Class::css`) to
   the theme, for the editor's source pane and the site's code blocks alike.  The terminal's is `Class::look`, beside
   the classes in crates/dt-lang/src/highlight.rs. */
.tk-node { color: var(--accent); font-weight: 600; }
.tk-property { color: var(--water); }
.tk-string { color: var(--moss); }
.tk-number, .tk-keyword { color: var(--bloom); }
.tk-name, .tk-function { color: var(--accent); }
.tk-comment { color: var(--muted); font-style: italic; }
.tk-punct { color: var(--stone); }
