/* ---------- shapes and drawing (section 23) ----------
   Down and to the left opens a dock along the bottom, where the legend was. Shapes is lines, arrows and outlines;
   Draw is a pen, a marker and an eraser over everything. A shape is a cut-out of the cards' own paper, outlined, with a
   line of text in it; a drawing is ink on the canvas, picked up by its ink. */
.ghost.g-shapes { overflow: visible; background: none; }
.g-shapes svg { display: block; width: 100%; height: 100%; overflow: visible; }
.g-shapes svg * { fill: color-mix(in srgb, var(--tc) 10%, transparent); stroke: var(--tc); stroke-width: 1.5px; stroke-linejoin: round; }
.g-shapes svg .sq { fill: none; stroke-linecap: round; }
.g-shapes .gcap { position: absolute; left: 50%; top: calc(100% + 12px); translate: -50% 0; margin: 0; text-align: center; white-space: nowrap; color: var(--tc); }
.g-shapes .gcap b { display: block; font: 500 15px/20px var(--f-ui); }
.g-shapes .gcap span { display: block; font: 400 12px/16px var(--f-ui); color: color-mix(in srgb, var(--tc) 70%, transparent); }
body.shaping #guide { opacity: 0; visibility: hidden; transition: opacity 120ms ease-out, visibility 0s linear 120ms; }

/* A shape and a drawing have no card: only their outline, or their ink, takes a press (until selected). */
.obj.shape, .obj.drawing { background: none; border: 0; border-radius: 8px; box-shadow: none; overflow: visible; }
/* The selection ring follows the outline where it can: round for an ellipse or a pill, soft corners otherwise. */
.obj.shape[data-kind="block"] { border-radius: 10px; }
.obj.shape[data-kind="ellipse"] { border-radius: 50%; }
.obj.shape[data-kind="pill"] { border-radius: 999px; }
.obj.drawing { border-radius: 5px; }
.obj.drawing.sel { outline-offset: 6px; }
#objs > .obj.shape, #objs > .obj.drawing { pointer-events: none; }
#objs > .obj.shape.sel, #objs > .obj.drawing.sel, #objs > .obj.shape:focus-within { pointer-events: auto; }
.obj.shape:focus-within, .obj.drawing:focus-within { box-shadow: none; }
.sh-g { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none;
  filter: drop-shadow(-1px -1px 1.5px var(--hi)) drop-shadow(2px 3px 3px color-mix(in srgb, var(--drop-1) 45%, transparent)); }
.sh-p {
  pointer-events: all; fill: var(--k-t, var(--surface)); stroke: var(--k-a, color-mix(in srgb, var(--ink-3) 72%, var(--surface)));
  stroke-width: 1.5px; stroke-linejoin: round; transition: fill 160ms ease-out, stroke 160ms ease-out;
}
.obj.shape[data-fill="solid"] .sh-p { fill: var(--k-a, var(--ink-2)); stroke: var(--k-a, var(--ink-2)); }
.obj.shape[data-fill="none"] .sh-p { fill: transparent; stroke: var(--k-a, var(--ink-2)); }
.obj.shape[data-fill="none"] .sh-g { filter: none; }
.obj.shape:focus-within .sh-p { stroke: var(--k-a, var(--ink-3)); }
.sh-in { position: absolute; display: flex; align-items: center; justify-content: center; padding: 6px 10px; box-sizing: border-box; pointer-events: none; }
.sx {
  width: 100%; max-height: 100%; overflow: hidden; pointer-events: auto; text-align: center; color: var(--ink);
  font: 500 17px/1.35 var(--f-ui); letter-spacing: -.005em; white-space: pre-wrap; overflow-wrap: anywhere;
}
.obj.shape:not(:focus-within) .sx:empty { min-height: 1lh; }
.obj.shape .sx[data-ph]:empty::before { content: none; }
.obj.shape:focus-within .sx[data-ph]:empty::before { content: "Type"; color: var(--ink-3); }
/* One empty shape selected says how to write in it (a click on it again, or Enter). */
#objs:not(:has(> .sel ~ .sel)) > .obj.shape.sel:not(:focus-within) .sx:empty::before { content: "Click to write"; color: var(--ink-3); font-size: 12px; font-weight: 400; }
@media (pointer: coarse) { #objs:not(:has(> .sel ~ .sel)) > .obj.shape.sel:not(:focus-within) .sx:empty::before { content: "Tap to write"; } }
#objs:not(:has(> .sel ~ .sel)) > .obj.shape[data-fill="solid"].sel:not(:focus-within) .sx:empty::before { color: color-mix(in srgb, var(--on-tc) 72%, transparent); }
.obj.shape[data-fill="solid"] .sx { color: var(--on-tc); }
.obj.shape[data-fill="solid"]:not([data-color]) .sx { color: var(--surface); }
.obj.shape[data-fill="solid"] .sx[data-ph]:empty::before { color: color-mix(in srgb, var(--on-tc) 70%, transparent); }
/* A shape in a colour of one's own is filled with that very colour (solid or not), so its words take the ink on it. */
.obj.shape[data-color^="#"]:not([data-fill="none"]) .sx { color: var(--k-on); }
.obj.shape[data-color^="#"]:not([data-fill="none"]) .sx[data-ph]:empty::before,
#objs:not(:has(> .sel ~ .sel)) > .obj.shape[data-color^="#"]:not([data-fill="none"]).sel:not(:focus-within) .sx:empty::before { color: color-mix(in srgb, var(--k-on) 70%, transparent); }
.obj.shape[data-fs="s"] .sx { font-size: 14.5px; }
.obj.shape[data-fs="l"] .sx { font-size: 21px; letter-spacing: -.008em; }
.obj.shape[data-fs="xl"] .sx { font-size: 29px; line-height: 1.2; letter-spacing: -.014em; }
.obj.shape[data-ff="serif"] .sx { font-family: var(--f-display); font-optical-sizing: auto; }
.obj.shape[data-ff="mono"] .sx { font-family: var(--f-mono); letter-spacing: -.02em; }
.obj.shape[data-ink] .sx { color: var(--ink-c); }
.obj.shape[data-align="left"] .sx { text-align: left; }
.obj.shape[data-align="right"] .sx { text-align: right; }
.obj:is(.shape, .drawing) > .otag { position: absolute; left: 0; bottom: calc(100% + 6px); max-width: 100%; }
.obj.shape.paper, .obj.drawing.paper {
  box-shadow: none;
  filter: drop-shadow(0 calc(var(--lk, 0) * 12px) calc(var(--lk, 0) * 11px) var(--drop-1)) drop-shadow(0 calc(var(--lk, 0) * 3px) calc(var(--lk, 0) * 3px) var(--drop-2));
}
.obj.shape.paper .sh-g { filter: none; }
.obj.shape.sh-new .sh-g { filter: none; }
.obj.shape.sh-new .sh-p { fill: color-mix(in srgb, var(--c-shapes) 8%, var(--surface)); stroke: var(--c-shapes); stroke-dasharray: 5 4; }
.obj.shape.sh-new .sh-in { opacity: 0; }

/* Ink: a pen's stroke is a filled outline (its width varies with the hand); a marker's is a wide translucent line. */
.dw-g { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.dw-s { --dw: var(--ink); fill: var(--dw); }
.obj.drawing .dw-s:not(.mk):not(.ln) { stroke: transparent; stroke-width: 12px; vector-effect: non-scaling-stroke; pointer-events: all; }
/* A stroke as wide all along: a line, round at its ends and turns (ink.js, paintPen). */
.dw-s.ln { fill: none; stroke: var(--dw); stroke-linecap: round; stroke-linejoin: round; }
.obj.drawing .dw-s.ln { pointer-events: stroke; }
.dw-s.mk { fill: none; stroke: var(--mk, var(--mk-ink)); stroke-linecap: round; stroke-linejoin: round; opacity: var(--mk-o); mix-blend-mode: var(--mk-blend); pointer-events: stroke; }
.dw-s[data-c="red"] { --dw: var(--k-red-a); --mk: var(--mk-red); }
.dw-s[data-c="yellow"] { --dw: var(--k-yellow-a); --mk: var(--mk-yellow); }
.dw-s[data-c="green"] { --dw: var(--k-green-a); --mk: var(--mk-green); }
.dw-s[data-c="blue"] { --dw: var(--k-blue-a); --mk: var(--mk-blue); }
.dw-s[data-c="violet"] { --dw: var(--k-violet-a); --mk: var(--mk-violet); }
.dw-s[data-c="xyz"] { --dw: var(--z); --mk: var(--mk-xyz); }     /* XYZ purple: the depth colour itself, day and night */
/* A colour of one's own (data-c="#rrggbb": Draw's Any colour; kcRule gives it --k-c): exactly as it was picked, pen
   and marker alike, day and night (Axio, 2026-11-06). Any colour's swatch and the pen's tip show it so too. */
.dw-s[data-c^="#"], .sd-own, #inkc[data-k^="#"] { --dw: var(--k-c); --mk: var(--dw); }
#ink { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; transform-origin: 0 0; pointer-events: none; }
#ink .dw-s { pointer-events: none; }

/* The dock: two modes on a sliding switch, the tools of the one that is on, and Done (dark while drawing). In Draw on a
   phone or a tablet, which has no keyboard for them, Undo and Redo. */
#sdock {
  position: fixed; left: 0; right: 0; margin-inline: auto; z-index: 12; bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);     /* centred by its margins (as #guide) */
  display: flex; align-items: center; gap: 4px; width: max-content; max-width: calc(100% - 24px); padding: 5px; box-sizing: border-box;
  border-radius: 11px; background: var(--glass); box-shadow: var(--glass-sh);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  font: 500 12.5px/1 var(--f-ui); letter-spacing: -.005em;
  user-select: none; -webkit-user-select: none; transition: opacity 160ms ease-out, bottom 240ms cubic-bezier(.2,.8,.2,1);
}
body.moving #sdock, body.drawing #sdock, body.sizing #sdock, body.marking #sdock, body.dv #sdock { opacity: .25; pointer-events: none; }
body.inking.marking #sdock { opacity: 1; }
:is(#sdock, #ppal) button { font: inherit; letter-spacing: inherit; -webkit-tap-highlight-color: transparent; }
:is(#sdock, #ppal, #pchip) svg { display: block; width: 20px; height: 20px; overflow: visible; }
:is(#sdock, #ppal, #pchip) svg * { fill: none; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }
:is(#sdock, #ppal, #pchip) svg .f { fill: currentColor; stroke: none; }
.sd-sep { flex: none; width: 1px; height: 22px; margin: 0 3px; background: var(--rule-2); }
.sd-mode { position: relative; flex: none; display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 8px; background: var(--press-bg); box-shadow: var(--press); }
.sd-th { position: absolute; left: 3px; top: 3px; bottom: 3px; width: calc(50% - 3px); border-radius: 6px; background: var(--surface); box-shadow: var(--raise-sm), var(--edge); transition: translate 300ms cubic-bezier(.2,.9,.25,1.08); }
.sd-mode[data-m="draw"] .sd-th { translate: 100% 0; }
.sd-m {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 11px 0 9px; border: 0; border-radius: 6px;
  background: transparent; color: var(--ink-3); cursor: pointer; white-space: nowrap;
  transition: color 200ms ease-out;
}
.sd-m[aria-checked="true"] { color: var(--ink); }
#sdock .sd-m svg { width: 18px; height: 18px; }
.sd-win { position: relative; flex: none; display: flex; overflow: hidden; }
.sd-set, .sd-ts, .sd-hist { display: flex; align-items: center; gap: 2px; }
.sd-hist { display: none; }
:where(html.pocket) .sd-hist { display: flex; }
@media (hover: none) and (pointer: coarse) { .sd-hist { display: flex; } }
.sd-set.sd-out { position: absolute; left: 0; top: 0; bottom: 0; pointer-events: none; }
.sd-b {
  position: relative; flex: none; display: grid; place-items: center; width: 40px; height: 38px; padding: 0; border: 0; border-radius: 8px;
  color: var(--ink-2); background: transparent; cursor: pointer;
  transition: background-color 140ms ease-out, color 140ms ease-out, box-shadow 140ms ease-out, scale 140ms ease-out;
}
@media (hover: hover) { .sd-b:hover, .sd-m:hover { color: var(--ink); } .sd-b:hover { background: color-mix(in srgb, var(--surface) 85%, transparent); } }
.sd-b:active { scale: .94; }
.sd-b[aria-pressed="true"] { color: var(--ink); background: var(--press-bg); box-shadow: var(--press); }
.sd-u {
  flex: none; display: grid; place-items: center; width: 36px; height: 38px; padding: 0; border: 0; border-radius: 8px;
  color: var(--ink-2); background: transparent; cursor: pointer; transition: color 140ms ease-out, opacity 140ms ease-out, scale 140ms ease-out;
}
.sd-u:active { scale: .92; }
.sd-u:disabled { opacity: .35; cursor: default; }
.sd-b kbd { font: 500 7.5px/1 var(--f-mono); letter-spacing: .04em; color: var(--ink-3); }
.sd-b kbd { position: absolute; right: 4px; bottom: 3px; opacity: .85; }
.sd-b[aria-pressed="true"] kbd { color: var(--ink-2); }
#sdock .sd-pg path { fill: color-mix(in srgb, currentColor 12%, transparent); stroke-width: 1.25; }
.sd-b[data-t="preset"]::after { content: ""; position: absolute; right: 4px; top: 4px; width: 0; height: 0; border: 2.5px solid transparent; border-top-color: currentColor; border-right-color: currentColor; opacity: .45; }
.sd-cs, .sd-zs { display: flex; align-items: center; gap: 1px; transition: opacity 160ms ease-out; }
.sd-set.erasing :is(.sd-cs, .sd-zs) { opacity: .4; }
.sd-c { position: relative; flex: none; width: 28px; height: 38px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.sd-c::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; translate: -50% -50%; border-radius: 50%;
  background: var(--k-a, var(--ink)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16); transition: scale 140ms cubic-bezier(.2,.9,.25,1.2), box-shadow 140ms ease-out;
}
@media (hover: hover) { .sd-c:hover::before { scale: 1.14; } }
.sd-c[aria-checked="true"]::before { box-shadow: 0 0 0 2px var(--canvas), 0 0 0 3.5px var(--k-a, var(--ink)); }
.sd-set[data-ink="marker"] .sd-c::before { background: var(--mk, var(--mk-ink)); }
.sd-set[data-ink="marker"] .sd-c[aria-checked="true"]::before { box-shadow: 0 0 0 2px var(--canvas), 0 0 0 3.5px var(--mk, var(--mk-ink)); }
.sd-c[data-c="red"] { --mk: var(--mk-red); } .sd-c[data-c="yellow"] { --mk: var(--mk-yellow); } .sd-c[data-c="green"] { --mk: var(--mk-green); }
.sd-c[data-c="blue"] { --mk: var(--mk-blue); } .sd-c[data-c="violet"] { --mk: var(--mk-violet); }
.sd-c[data-c="xyz"] { --k-a: var(--z); --mk: var(--mk-xyz); }
/* Any colour: one's own in a ring of the presets' hues (before there is one, a plus); on, the others' ring around it. */
.sd-own { --k-a: var(--dw); --sd-ring: conic-gradient(var(--k-red-a), var(--k-orange-a), var(--k-yellow-a), var(--k-green-a), var(--k-teal-a), var(--k-blue-a), var(--k-violet-a), var(--k-pink-a), var(--k-red-a)); }
.sd-own::before { background: transparent; box-shadow: none; }
.sd-own::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; translate: -50% -50%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, var(--dw) calc(100% - 3.25px), transparent 0), var(--sd-ring);
  -webkit-mask: radial-gradient(closest-side, #000 calc(100% - 3.5px), transparent calc(100% - 3.25px) calc(100% - 2.25px), #000 calc(100% - 2px));
  mask: radial-gradient(closest-side, #000 calc(100% - 3.5px), transparent calc(100% - 3.25px) calc(100% - 2.25px), #000 calc(100% - 2px));
  transition: scale 140ms cubic-bezier(.2,.9,.25,1.2);
}
.sd-own:not([data-c^="#"])::after {
  background: linear-gradient(var(--ink-2) 0 0) 50% / 6px 1.3px no-repeat, linear-gradient(var(--ink-2) 0 0) 50% / 1.3px 6px no-repeat,
              radial-gradient(closest-side, var(--surface) calc(100% - 3.25px), transparent 0), var(--sd-ring);
}
@media (hover: hover) { .sd-own:hover::after { scale: 1.14; } }
/* The tool's card (Jarred, 2026-11-09, after Notes+): the tool in the hand pressed again shows it over the dock, its point
   at the tool. A brush's: its name, six sizes (each drawn in its colour and width, with its width), the colours. The
   eraser's: Part or Whole strokes, five sizes as rings, Then the pen. */
.sd-opt {
  position: absolute; left: 0; bottom: calc(100% + 12px); z-index: 1; display: grid; justify-items: center; gap: 10px; width: max-content;
  max-width: calc(100vw - 16px); padding: 11px 12px 12px; box-sizing: border-box; border-radius: 14px;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--rule), var(--pop);
}
.sd-opt[hidden] { display: none; }
.sd-opt::after { content: ""; position: absolute; top: 100%; left: var(--so-at, 50%); width: 16px; height: 8px; translate: -50% 0; background: var(--surface); clip-path: polygon(0 0, 100% 0, 50% 100%); }
.so-h { font: 500 13px/1.2 var(--f-ui); color: var(--ink-2); }
.sd-opt .sd-es { display: flex; }
.sd-opt:not([data-ink="eraser"]) :is(.sd-es, .sd-eb), .sd-opt[data-ink="eraser"] .sd-cs { display: none; }
.sd-opt .sd-zs, .sd-opt .sd-cs { display: flex; gap: 4px; }
.sd-opt .sd-z { width: 44px; height: 58px; grid-template-rows: 1fr auto; padding: 6px 0 7px; border-radius: 10px; color: var(--ink-2); }
.sd-opt .sd-z[hidden] { display: none; }
.sd-opt .sd-z i:not(.er) { border-radius: 99px; rotate: 35deg; }
.sd-opt .sd-z small { font: 500 10.5px/1 var(--f-ui); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.sd-opt .sd-z[aria-checked="true"] { background: var(--press-bg); box-shadow: var(--press), inset 0 0 0 1.5px var(--ink); }
.sd-opt .sd-z[aria-checked="true"] small { color: var(--ink); }
.sd-opt .sd-c { width: 36px; height: 36px; }
.sd-opt .sd-c::before, .sd-opt .sd-own::after { width: 26px; height: 26px; }
.sd-opt .sd-eb { width: 100%; justify-content: space-between; flex-direction: row-reverse; padding: 0 2px; }
.sd-opt .sd-eb::after { left: auto; right: 12px; }
.sd-opt .sd-eb[aria-pressed="true"]::after { translate: 10px 0; }
/* A brush's colour on its button, as a pen's band. */
.sd-tip { position: absolute; left: 50%; bottom: 4px; width: 14px; height: 3px; translate: -50% 0; border-radius: 2px; pointer-events: none; }
.sd-eg { display: flex; padding: 2px; border-radius: 8px; background: var(--press-bg); box-shadow: var(--press); }
.sd-e, .sd-eb {
  flex: none; height: 32px; padding: 0 10px; border: 0; border-radius: 6px; cursor: pointer; white-space: nowrap;
  color: var(--ink-3); background: transparent; transition: color 140ms ease-out, background-color 140ms ease-out, box-shadow 140ms ease-out;
}
.sd-e[aria-checked="true"] { color: var(--ink); background: var(--surface); box-shadow: var(--raise-sm), var(--edge); }
.sd-eb { display: flex; align-items: center; gap: 6px; padding: 0 8px; }
.sd-eb::before { content: ""; width: 26px; height: 16px; border-radius: 8px; box-sizing: border-box; background: var(--rule-2); transition: background-color 160ms ease-out; }
.sd-eb { position: relative; }
.sd-eb::after { content: ""; position: absolute; left: 10px; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: translate 160ms cubic-bezier(.2,.9,.25,1.1); }
.sd-eb[aria-pressed="true"] { color: var(--ink); }
.sd-eb[aria-pressed="true"]::before { background: var(--ink); }
.sd-eb[aria-pressed="true"]::after { translate: 10px 0; }
@media (hover: hover) { .sd-e:hover, .sd-eb:hover { color: var(--ink); } }
.sd-z i.er { background: transparent; box-shadow: inset 0 0 0 1.4px currentColor; }
.sd-z { flex: none; display: grid; place-items: center; width: 30px; height: 38px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--ink-3); cursor: pointer; transition: color 140ms ease-out, background-color 140ms ease-out, box-shadow 140ms ease-out; }
.sd-z i { display: block; border-radius: 50%; background: currentColor; transition: width 160ms ease-out, height 160ms ease-out; }
@media (hover: hover) { .sd-z:hover { color: var(--ink-2); } }
.sd-z[aria-checked="true"] { color: var(--ink); background: var(--press-bg); box-shadow: var(--press); }
.sd-done {
  flex: none; display: flex; align-items: center; height: 32px; padding: 0 12px; border: 0; border-radius: 7px; cursor: pointer;
  color: var(--ink-2); background: transparent; white-space: nowrap;
  transition: background-color 200ms ease-out, color 200ms ease-out, box-shadow 200ms ease-out;
}
@media (hover: hover) { .sd-done:hover { color: var(--ink); background: color-mix(in srgb, var(--surface) 85%, transparent); } }
.sd-done.save { color: var(--on-hud); background: var(--hud); box-shadow: 0 6px 14px -8px rgba(0, 0, 0, .5); }
:is(#sdock, #ppal) :is(.sd-b, .sd-m, .sd-c, .sd-z, .sd-u, .sd-done, .sd-e, .sd-eb):focus-visible { outline: 2px solid var(--ink); outline-offset: 0; }
/* The Pencil's double tap and squeeze (section 23b, penGesture): the tool it changed to, on the dark chip by the tip (or
   over the dock) for a moment; and Draw's tools, colours and sizes on a card where the Pencil is, as the dock has them. */
#pchip {
  position: fixed; left: 0; top: 0; z-index: 40; pointer-events: none; translate: -50% -100%; transform-origin: 50% 100%;
  display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px 0 8px; box-sizing: border-box; border-radius: 15px;
  background: var(--hud); color: var(--on-hud); font: 500 12px/1 var(--f-ui); letter-spacing: -.005em; white-space: nowrap;
  box-shadow: 0 8px 18px -8px rgba(0, 0, 0, .45);
}
#pchip svg { width: 18px; height: 18px; }
#ppal {
  position: fixed; left: 0; top: 0; z-index: 31; padding: 5px; box-sizing: border-box; border-radius: 11px;
  background: var(--glass); box-shadow: var(--glass-sh);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  font: 500 12.5px/1 var(--f-ui); user-select: none; -webkit-user-select: none;
}
#ppal .sd-opt { position: static; box-shadow: none; background: transparent; padding: 6px 0 2px; }
#ppal .sd-opt::after { display: none; }
/* The presets, and Any colour's: a card over the dock. */
#sfly, #scol {
  position: fixed; left: 0; top: 0; z-index: 31; width: 236px; padding: 13px 12px 12px; box-sizing: border-box; border-radius: 9px;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--rule), var(--pop); user-select: none; -webkit-user-select: none;
}
.sf-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
#scol .sc-mine:not(:empty) { margin-bottom: 12px; }        /* Your colours, then the picker (section 21d) */
#scol .ip-pick { margin-top: 0; }
.sf-o {
  display: grid; justify-items: center; align-content: center; gap: 5px; min-width: 0; height: 54px; padding: 0; border: 0; border-radius: 6px; cursor: pointer;
  color: var(--ink-2); background: transparent; font: inherit; transition: background-color 120ms ease-out, color 120ms ease-out, box-shadow 120ms ease-out;
}
.sf-o svg { width: 26px; height: 21px; overflow: visible; }
.sf-o svg path { fill: color-mix(in srgb, currentColor 10%, transparent); stroke: currentColor; stroke-width: 1.2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.sf-o small { font: 500 8px/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-q); }
@media (hover: hover) { .sf-o:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 5%, transparent); } }
.sf-o[aria-pressed="true"] { color: var(--ink); background: var(--press-bg); box-shadow: var(--press); }
.sf-o[aria-pressed="true"] small { color: var(--ink-2); }
.sf-o:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
#ipop .sf-grid { grid-template-columns: repeat(5, 1fr); }
#ipop .sf-o { height: 50px; }
#ipop .sf-o small { letter-spacing: .04em; }
/* While drawing: the pen's tip (its colour and width), or the eraser's ring, in place of the pointer. */
#inkc {
  position: fixed; left: 0; top: 0; z-index: 8; pointer-events: none; translate: -50% -50%; border-radius: 50%; box-sizing: border-box;
  background: var(--k-a, var(--ink)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--canvas) 80%, transparent);
}
#inkc[data-ink="marker"] { background: color-mix(in srgb, var(--mk, var(--mk-ink)) 65%, transparent); border-radius: 30%; }
#inkc[data-ink="marker"][data-k="red"] { --mk: var(--mk-red); } #inkc[data-ink="marker"][data-k="yellow"] { --mk: var(--mk-yellow); }
#inkc[data-ink="marker"][data-k="green"] { --mk: var(--mk-green); } #inkc[data-ink="marker"][data-k="blue"] { --mk: var(--mk-blue); }
#inkc[data-ink="marker"][data-k="violet"] { --mk: var(--mk-violet); }
#inkc[data-k="xyz"] { --k-a: var(--z); --mk: var(--mk-xyz); }
#inkc[data-k^="#"] { --k-a: var(--dw); }
#inkc[data-ink="eraser"] { background: color-mix(in srgb, var(--surface) 35%, transparent); box-shadow: inset 0 0 0 1.25px var(--ink-2), 0 0 0 1px color-mix(in srgb, var(--canvas) 80%, transparent); }
/* A fountain pen's tip is its nib: a slanted line as wide as it draws across it (section 23b). */
#inkc[data-ink="fountain"] { background: none; box-shadow: none; }
#inkc[data-ink="fountain"]::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--k-a, var(--ink)); scale: 1 .3; rotate: -45deg;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--canvas) 80%, transparent);
}
/* A pen held above what it would pick (a card, a board, a selected drawing): a small ring where it will land. */
#inkc[data-ink="at"] { background: none; box-shadow: inset 0 0 0 1.5px var(--ink-2), 0 0 0 1px color-mix(in srgb, var(--canvas) 80%, transparent); }
/* A line's angle, or a shape's size, beside the hand. */
#sang {
  position: fixed; left: 0; top: 0; z-index: 40; pointer-events: none; height: 22px; padding: 0 8px; border-radius: 4px;
  background: var(--hud); color: var(--on-hud); font: 500 10.5px/22px var(--f-mono); letter-spacing: .04em; font-variant-numeric: tabular-nums; white-space: nowrap;
  box-shadow: 0 8px 18px -8px rgba(0, 0, 0, .45);
}
@media (hover: hover) and (pointer: fine) {
  body.inking:not(.drawing):not(.panning) #canvas, body.inking:not(.drawing):not(.panning) #canvas * { cursor: none !important; }
  body.inking.lassoing:not(.drawing):not(.panning) #canvas, body.inking.lassoing:not(.drawing):not(.panning) #canvas * { cursor: crosshair !important; }
}
/* The lasso's loop (section 23c), dashed, a hairline at any zoom (it is drawn in screen px); gone while what it picked
   is carried. */
#lasso { position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }
#lasso svg { display: block; width: 100%; height: 100%; overflow: visible; }
#lasso path { fill: color-mix(in srgb, var(--sel) 6%, transparent); stroke: var(--sel); stroke-width: 1.25px; stroke-dasharray: 5 4; stroke-linecap: round; stroke-linejoin: round; }
body.moving #lasso { visibility: hidden; }
body.sm-tool:not(.drawing):not(.panning) #canvas, body.sm-tool:not(.drawing):not(.panning) #canvas * { cursor: crosshair !important; }
body.inking :is(#bview, #tview), body.sm-tool :is(#bview, #tview) { visibility: hidden; }
/* In Draw nothing on the canvas is selected or typed in (Axio, 2026-10-27: "disable the selection mode entirely when i'm
   drawing"): no words selected, no system menu, and no text to write into, which an iPad's Scribble would turn a
   Pencil's strokes near into words or a selection. (Safari's engine selects text that can be typed in whatever
   user-select says, so it can't be, till Done.) */
body.inking #canvas, body.inking #canvas * {
  -webkit-user-select: none !important; user-select: none !important; -webkit-touch-callout: none !important; -webkit-user-modify: read-only !important;
}
/* Nor anything else on the page (Axio, 2026-10-28: drawing with the Pencil on an iPad, the bar at the top was selected,
   the system's Copy, Look Up, Translate menu under it): a touch held still on the canvas, which can't be selected,
   selected the nearest words that could (pencil.js, penTouch). A field off the canvas is typed in as ever (its own
   rule: what user-select says is handed down). */
body.inking, body.inking * { -webkit-user-select: none !important; user-select: none !important; -webkit-touch-callout: none !important; }
body.inking input, body.inking textarea { -webkit-user-select: text !important; user-select: text !important; }
/* Out of Draw, while a pen is down or held above the screen (pencil.js, penNear): no words on the canvas to write into
   but those being typed in, so Scribble never turns a Pencil's drag into words in the text it carries (Axio,
   2026-10-30), nor goes in to type in it. */
body.penning #canvas [contenteditable]:not(:focus) { -webkit-user-modify: read-only !important; }
@media (pointer: coarse) { #sdock kbd, #sfly .sf-fine { display: none; } }
@media not (pointer: coarse) { #sfly .sf-coarse { display: none; } }
@media (max-width: 700px) {      /* a phone, or a window too narrow for one row: two rows, the switch and Done over the tools */
  #sdock { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "mode . done" "win win win"; row-gap: 5px; padding: 5px; border-radius: 10px; }
  #sdock > .sd-sep { display: none; }
  .sd-mode { grid-area: mode; }
  .sd-done { grid-area: done; }
  .sd-win { grid-area: win; justify-self: center; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
}
@media (max-width: 640px) {      /* a phone: smaller tools */
  .sd-b { width: 36px; height: 36px; }
  .sd-c { width: 25px; height: 36px; }
  .sd-z { width: 27px; height: 36px; }
  .sd-set .sd-sep { margin: 0 2px; }
  /* Draw on a phone: Undo, Redo and the seven tools in one row (a 375 px phone too); colours and sizes in the card. */
  .sd-set[data-set="draw"] .sd-ts .sd-b { width: 32px; }
  .sd-u { width: 34px; height: 36px; }
  .sd-opt .sd-z { width: 40px; }
  .sd-opt .sd-c { width: 33px; }
}
/* The dock stays where the thumb is; where the rail lies along the bottom (html.phone: a phone or a tablet, or a window
   as narrow as a phone; rail.css), what is selected gets its rail over it, or above the keyboard (kbFit). */
:where(html.phone) body.shaping #insp { bottom: max(calc(env(safe-area-inset-bottom, 0px) + 24px + var(--sd-h, 89px)), calc(var(--kb, 0px) + 14px)); }

