/* Rulingpen viewer.
   Drafting film, India ink and one lettering face. Every rule on the page is drawn at an
   ISO pen width in real millimetres (0.18, 0.35, 0.7); weight of line, not weight of
   type, carries the hierarchy, because drafting lettering has only one weight.

   Two faces. Routed Gothic (cut from Leroy lettering templates) letters the sheet:
   headings, labels, buttons. Its 0 is an O and its 1 is an I, as on a hand-lettered
   drawing, so anything read off the file (names, numbers, handles) is set in B612, the
   cockpit-display face, where every digit is unmistakable. */

@font-face {
  font-family: "Routed Gothic";
  src: url("fonts/routed-gothic.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "B612";
  src: url("fonts/b612-regular.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Routed Gothic Wide";
  src: url("fonts/routed-gothic-wide.ttf") format("truetype");
  font-display: swap;
}

:root {
  --film: #e4e9e6;
  --film-raised: #eff2f0;
  --film-worn: #d3dad6;
  --ink: #15191c;
  --ink-soft: #46505a;
  --graphite: #8d989d;
  --guide: #a8dcee;        /* non-photo blue: construction, hover, selection */
  --blueprint: #0e6686;    /* the same blue dark enough to read: focus, links */
  --redline: #b9261b;      /* checking red: measuring marks, errors */

  --pen-fine: 0.18mm;
  --pen: 0.35mm;
  --pen-bold: 0.7mm;

  --canvas: #1c2126;
  --lettering: "Routed Gothic", "DIN Alternate", "Bahnschrift", "Segoe UI", system-ui, sans-serif;
  --reading: "B612", "DIN Alternate", "Segoe UI", system-ui, sans-serif;
  --lettering-wide: "Routed Gothic Wide", "Routed Gothic", "DIN Alternate", "Bahnschrift", system-ui, sans-serif;

  --bar: 54px;
  --dock: 0px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--film);
  color: var(--ink);
  font: 15.5px/1.4 var(--lettering);
  -webkit-text-size-adjust: 100%;
  overflow: hidden;
}

h1, h2, h3, p, dl, dd, ul, figure { margin: 0; padding: 0; }
ul { list-style: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 8px; top: -60px; z-index: 50;
  padding: 8px 12px; background: var(--ink); color: var(--film);
}
.skip:focus { top: 8px; }

:focus-visible {
  outline: 2px solid var(--blueprint);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ frame */

.app {
  display: grid;
  height: 100vh;
  height: 100dvh;
  grid-template-columns: clamp(216px, 19vw, 256px) minmax(0, 1fr) clamp(264px, 23vw, 312px);
  grid-template-rows: var(--bar) minmax(0, 1fr);
  grid-template-areas: "bar bar bar" "layers stage inspector";
}

.bar {
  grid-area: bar;
  display: flex; align-items: center; gap: 20px;
  padding: 0 14px;
  border-bottom: var(--pen-bold) solid var(--ink);
  min-width: 0;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font: 22px/1 var(--lettering-wide);
  letter-spacing: 0.01em;
}
.mark { width: 28px; height: 28px; fill: none; stroke: var(--ink); stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }
.mark-line { stroke-width: 2; }
.promise { flex: 1; min-width: 0; color: var(--ink-soft); font-size: 14.5px; }
.bar-actions { display: flex; gap: 8px; margin-left: auto; }

.btn {
  min-height: 36px; padding: 0 14px;
  background: var(--film-raised); color: var(--ink);
  border: var(--pen) solid var(--ink); border-radius: 0;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--guide); }
.btn:active:not(:disabled) { background: var(--film-worn); }
.btn:disabled { color: var(--ink-soft); border-color: var(--graphite); background: transparent; }
.btn-ink { background: var(--ink); color: var(--film); }
.btn-ink:hover:not(:disabled) { background: var(--blueprint); border-color: var(--blueprint); color: #fff; }
.btn-ink:active:not(:disabled) { background: var(--ink); }
.btn-small { min-height: 30px; padding: 0 10px; font-size: 14px; }
.btn-square { width: 36px; padding: 0; }

.field {
  min-height: 34px; padding: 0 9px; width: 100%;
  background: #fff; color: var(--ink);
  border: var(--pen) solid var(--ink); border-radius: 0;
  font: 14px/1.3 var(--reading);
}
.field::placeholder { color: var(--ink-soft); opacity: 1; font-family: var(--lettering); font-size: 15px; }
select.field { width: auto; padding-right: 4px; }

/* ------------------------------------------------------------------ panes */

.pane {
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  background: var(--film-raised);
}
.pane-layers { grid-area: layers; border-right: var(--pen) solid var(--ink); }
.pane-inspector { grid-area: inspector; border-left: var(--pen) solid var(--ink); }

.pane-head {
  display: flex; align-items: baseline; gap: 10px;
  padding: 12px 14px 10px;
}
.pane-head h2 { font: 19px/1.1 var(--lettering-wide); }
.pane-count { color: var(--ink-soft); font: 12.5px/1.3 var(--reading); }
.pane-close { display: none; }
.pane-note { padding: 12px 14px; color: var(--ink-soft); }

.layer-tools { padding: 0 14px 10px; display: grid; gap: 8px; border-bottom: var(--pen) solid var(--ink); }
.layer-buttons { display: flex; gap: 8px; }
.layer-buttons .btn { flex: 1; }

.layer-list:empty { display: none; }
.layer-list { overflow: auto; flex: 1; min-height: 0; padding: 4px 0 12px; overscroll-behavior: contain; }
.layer {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border-bottom: var(--pen-fine) solid var(--graphite);
}
.layer:hover, .layer:focus-within { background: var(--guide); }
.layer label {
  display: grid; grid-template-columns: 18px 26px minmax(0, 1fr) auto;
  align-items: center; gap: 8px;
  padding: 6px 4px 6px 14px; min-height: 36px; cursor: pointer;
}
.layer input { width: 16px; height: 16px; margin: 0; accent-color: var(--ink); }
.layer-name { font: 13.5px/1.3 var(--reading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-count { color: var(--ink-soft); font: 12.5px/1.3 var(--reading); font-variant-numeric: tabular-nums; }
.layer-flag { color: var(--ink-soft); font-size: 13px; }
.layer[data-hidden="true"] .layer-name { color: var(--ink-soft); }
.layer-only {
  margin-right: 6px; min-height: 28px; padding: 0 8px; font-size: 13.5px;
  background: transparent; border: var(--pen) solid transparent; color: var(--ink-soft);
  text-decoration: underline; text-decoration-thickness: var(--pen-fine); text-underline-offset: 3px;
}
.layer:hover .layer-only, .layer-only:focus-visible { color: var(--ink); }
.layer-only:hover { border-color: var(--ink); text-decoration: none; }
.layer-only[aria-pressed="true"] { background: var(--ink); color: var(--film); text-decoration: none; }

/* A layer's colour as a stroke on the current background, the way it will draw. */
.swatch {
  display: block; width: 26px; height: 14px; position: relative;
  background: var(--canvas); border: var(--pen-fine) solid var(--ink);
}
.swatch::after {
  content: ""; position: absolute; left: 3px; right: 3px; top: 50%; height: 2px; margin-top: -1px;
  background: var(--stroke, var(--canvas-ink, #fff));
}

.pane-tabs { display: flex; border-bottom: var(--pen) solid var(--ink); }
.pane-tabs [role="tab"] {
  flex: 1; min-height: 42px; padding: 0 6px;
  background: var(--film-worn); color: var(--ink);
  border: 0; border-right: var(--pen) solid var(--ink);
  white-space: nowrap;
}
.pane-tabs [role="tab"]:last-of-type { border-right: 0; }
.pane-tabs [role="tab"][aria-selected="true"] { background: var(--film-raised); box-shadow: inset 0 calc(-1 * var(--pen-bold)) 0 var(--ink); }
.pane-tabs [role="tab"]:hover { background: var(--guide); }
.pane-tabs [role="tab"]:focus-visible { outline-offset: -3px; }
.tab-count {
  font-family: var(--reading);
  display: inline-block; margin-left: 6px; padding: 0 5px; min-width: 18px;
  border: var(--pen) solid currentColor; font-size: 12.5px; line-height: 16px;
}
.panel { overflow: auto; flex: 1; min-height: 0; overscroll-behavior: contain; }
.panel:focus-visible { outline-offset: -3px; }

.group { padding: 12px 14px 4px; }
.group + .group { border-top: var(--pen) solid var(--ink); }
.group h3 { font: 17px/1.2 var(--lettering-wide); margin-bottom: 6px; }
.group-sub { color: var(--ink-soft); font: 13px/1.4 var(--reading); margin: -2px 0 8px; }
.rows { display: grid; grid-template-columns: minmax(84px, 42%) minmax(0, 1fr); }
.rows dt, .rows dd { padding: 4px 0; border-bottom: var(--pen-fine) solid var(--graphite); min-width: 0; }
.rows dt { color: var(--ink-soft); padding-right: 10px; overflow-wrap: anywhere; }
.rows dd { font: 13.5px/1.45 var(--reading); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.rows dd .swatch { display: inline-block; vertical-align: -2px; margin-right: 6px; }
.rows .nested { grid-column: 1 / -1; padding: 0; border-bottom: 0; }
.nested > summary {
  padding: 5px 0; cursor: pointer; color: var(--ink);
  border-bottom: var(--pen-fine) solid var(--graphite);
}
.nested > .rows { margin-left: 12px; }
.thumb { display: block; max-width: 100%; margin: 6px 0 10px; border: var(--pen) solid var(--ink); background: #fff; }

.notes li { padding: 10px 14px; border-bottom: var(--pen-fine) solid var(--graphite); }
.note-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.note-kind { padding: 0 6px; border: var(--pen) solid var(--ink); font-size: 13px; }
.note-kind[data-severity="error"] { background: var(--redline); border-color: var(--redline); color: #fff; }
.note-kind[data-severity="warning"] { background: var(--ink); color: var(--film); }
.note-code { color: var(--ink-soft); font: 12.5px/1.4 var(--reading); overflow-wrap: anywhere; }
.note-text { font: 13.5px/1.45 var(--reading); margin-top: 3px; overflow-wrap: anywhere; }
.linkish { background: none; border: 0; padding: 0; color: var(--blueprint); text-decoration: underline; text-underline-offset: 2px; }

/* ------------------------------------------------------------------ stage */

.stage {
  grid-area: stage;
  display: grid; grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0; min-height: 0;
  padding: 10px 10px 0;
}
.sheet {
  position: relative; min-height: 0; min-width: 0;
  border: var(--pen-bold) solid var(--ink);
  background: var(--canvas);
  overflow: hidden;
}
.app[data-background="white"] { --canvas: #ffffff; --canvas-ink: #000; }
.sheet:has(canvas:focus-visible) { outline: 2px solid var(--blueprint); outline-offset: 2px; }

canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; touch-action: none; outline: none;
  cursor: default;
}
canvas[data-tool="measure"] { cursor: crosshair; }
canvas[data-dragging="true"] { cursor: grabbing; }

.sample-note {
  position: absolute; left: 0; top: 0; max-width: min(72%, 540px);
  padding: 6px 10px; font-size: 14px;
  background: var(--film); color: var(--ink);
  border-right: var(--pen) solid var(--ink); border-bottom: var(--pen) solid var(--ink);
}

.nothing-note {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%);
  width: min(80%, 420px); padding: 12px 14px;
  background: var(--film); color: var(--ink); border: var(--pen) solid var(--ink);
}
.nothing-note .data { font-size: 0.9em; }

.rail {
  position: absolute; right: 10px; top: 10px;
  display: flex; flex-direction: column;
  background: var(--film); border: var(--pen) solid var(--ink);
}
.tool {
  width: 40px; height: 40px; padding: 0;
  display: grid; place-items: center;
  background: var(--film); border: 0; border-bottom: var(--pen-fine) solid var(--graphite);
}
.tool:last-child { border-bottom: 0; }
.tool svg { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.tool svg .solid { fill: var(--ink); stroke: none; }
.tool:hover { background: var(--guide); }
.tool[aria-pressed="true"] { background: var(--ink); }
.tool[aria-pressed="true"] svg { stroke: var(--film); }
.tool[aria-pressed="true"] svg .solid { fill: var(--film); }
.tool:focus-visible { outline-offset: -3px; }
.tool[aria-pressed="true"]:focus-visible { outline-color: var(--guide); }
.rail-gap { height: var(--pen); background: var(--ink); }

.readout {
  position: absolute; left: 0; top: 0;
  background: var(--film); color: var(--ink);
  border-right: var(--pen) solid var(--ink); border-bottom: var(--pen) solid var(--ink);
  border-left: 5px solid var(--redline);
  max-width: calc(100% - 70px);
}
.readout-hint { padding: 6px 10px; font-size: 14px; }
.readout-values { display: flex; flex-wrap: wrap; border-top: var(--pen-fine) solid var(--graphite); }
.readout-values div { padding: 4px 12px 6px 10px; border-right: var(--pen-fine) solid var(--graphite); }
.readout-values div:last-child { border-right: 0; }
.readout-values dt { font-size: 12.5px; color: var(--ink-soft); }
.readout-values dd { font: 15px/1.3 var(--reading); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Empty, loading and error states sit on the sheet like a note taped to it. */
.state {
  position: absolute; inset: 0; display: grid; place-items: center;
  padding: 18px; overflow: auto;
  background: var(--film);
}
.app[data-state="ready"] .state { display: none; }
.state-card { width: min(100%, 520px); }
.state-card h2 { font: 30px/1.12 var(--lettering-wide); margin-bottom: 12px; text-wrap: balance; }
.state-card p { max-width: 46ch; }
.data { font-family: var(--reading); font-size: 0.9em; overflow-wrap: anywhere; }
.state-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.state-code { margin-top: 10px; color: var(--ink-soft); font: 13px/1.4 var(--reading); overflow-wrap: anywhere; }
.state-preview { margin-top: 14px; }
.state-preview img { display: block; max-width: min(100%, 320px); border: var(--pen) solid var(--ink); background: #fff; }
.state-preview figcaption { margin-top: 4px; color: var(--ink-soft); font-size: 14px; }
#state-error h2 { border-left: 6px solid var(--redline); padding-left: 12px; }

/* The loading mark: a line being ruled, again and again. */
.ruling { margin-top: 20px; height: 3px; background: var(--film-worn); overflow: hidden; }
.ruling span { display: block; height: 100%; width: 100%; background: var(--ink); transform-origin: left; animation: rule 1.5s cubic-bezier(.5, 0, .3, 1) infinite; }
@keyframes rule {
  0% { transform: scaleX(0); }
  70% { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(1); opacity: 0; }
}

/* The title block: the drawing's status, set out as a sheet's title block. */
.titleblock {
  position: absolute; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(4, auto);
  background: var(--film); color: var(--ink);
  border-top: var(--pen-bold) solid var(--ink); border-left: var(--pen-bold) solid var(--ink);
  max-width: min(100%, 520px);
}
.tb-cell { padding: 3px 10px 5px 8px; border-right: var(--pen) solid var(--ink); border-bottom: var(--pen) solid var(--ink); min-width: 0; }
.tb-cell dt { font-size: 11px; line-height: 1.25; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-soft); }
.tb-cell dd { font: 14px/1.35 var(--reading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.tb-wide { grid-column: 1 / -1; border-right: 0; }
.tb-wide dd { font-size: 15px; max-width: 500px; }
.tb-scale { border-right: 0; }
.tb-x { grid-column: span 2; border-bottom: 0; }
.tb-y { grid-column: span 2; border-bottom: 0; border-right: 0; }
.tb-x, .tb-y { display: flex; gap: 10px; align-items: baseline; }
.tb-x dd, .tb-y dd { min-width: 11ch; }

.tabs { display: flex; gap: 0; overflow-x: auto; min-height: 40px; padding: 0 0 6px; scrollbar-width: thin; }
.tabs [role="tab"] {
  font: 13.5px/1 var(--reading);
  min-height: 34px; padding: 0 16px; white-space: nowrap;
  background: var(--film-worn); color: var(--ink);
  border: var(--pen) solid var(--ink); border-top: 0; margin-right: -1px;
}
.tabs [role="tab"]:hover { background: var(--guide); }
.tabs [role="tab"][aria-selected="true"] { background: var(--ink); color: var(--film); }
.tabs [role="tab"]:focus-visible { outline-offset: -3px; }
.tabs [role="tab"][aria-selected="true"]:focus-visible { outline-color: var(--guide); }

.dock { display: none; }

/* ------------------------------------------------------------------ dialogs */

.dialog {
  width: min(560px, calc(100vw - 20px)); max-height: calc(100dvh - 20px);
  padding: 0; overflow: auto;
  background: var(--film-raised); color: var(--ink);
  border: var(--pen-bold) solid var(--ink); border-radius: 0;
}
.dialog::backdrop { background: rgba(21, 25, 28, 0.55); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: var(--pen) solid var(--ink); }
.dialog-head h2 { font: 22px/1.1 var(--lettering-wide); }
.dialog-lede { padding: 12px 16px 0; color: var(--ink-soft); }
.export-row { padding: 14px 16px; display: grid; gap: 10px; }
.export-row + .export-row { border-top: var(--pen) solid var(--ink); }
.export-row h3 { font: 18px/1.2 var(--lettering-wide); margin-bottom: 2px; }
.caveat { margin-top: 8px; padding-left: 10px; border-left: 4px solid var(--redline); font-size: 14.5px; }
.export-controls { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.export-buttons { display: flex; gap: 10px; flex-basis: 100%; }
.inline { display: inline-flex; align-items: center; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--ink); }
.licence { display: grid; gap: 5px; }
.licence-entry { display: flex; gap: 8px; }
.licence-entry .btn { min-height: 34px; }
.licence-status { font-size: 14px; color: var(--ink-soft); }
.licence-status[data-state="ok"] { color: var(--ink); }
.licence-status[data-state="bad"], .dialog-status[data-state="bad"] { color: var(--redline); }
.dialog-status { padding: 0 16px 14px; min-height: 1.4em; }
.dialog-status:empty { padding-bottom: 6px; min-height: 0; }

.about { padding: 14px 16px 0; display: grid; gap: 8px; }
.about p { max-width: 62ch; }
.about h3 { font: 18px/1.2 var(--lettering-wide); margin-top: 8px; }
.keys { padding: 4px 16px 16px; }
.keys div { display: grid; grid-template-columns: minmax(120px, 42%) 1fr; gap: 12px; padding: 7px 0; border-bottom: var(--pen-fine) solid var(--graphite); }
kbd { font: inherit; padding: 0 6px; border: var(--pen) solid var(--ink); background: #fff; }

.drop {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center;
  background: rgba(168, 220, 238, 0.9);
  border: 3mm solid var(--ink);
}
.drop p { font: 34px/1.1 var(--lettering-wide); }
.noscript { position: fixed; inset: auto 0 0 0; padding: 14px; background: var(--ink); color: var(--film); z-index: 60; }

/* ------------------------------------------------------------------ small screens */

@media (max-width: 1023px) {
  :root { --dock: 50px; --bar: 50px; }
  .app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) var(--dock);
    grid-template-areas: "bar" "stage" "dock";
  }
  .bar { flex-wrap: wrap; gap: 0 10px; padding: 0 10px; min-height: var(--bar); }
  .brand { font-size: 19px; gap: 7px; min-height: var(--bar); }
  .mark { width: 24px; height: 24px; }
  .promise {
    order: 3; flex: 0 0 calc(100% + 20px); margin: 0 -10px;
    padding: 5px 10px; font-size: 13.5px; line-height: 1.3;
    border-top: var(--pen) solid var(--ink); background: var(--film-raised);
  }
  #help { display: none; }
  .btn { padding: 0 11px; }

  .stage { padding: 8px 8px 0; }
  .rail { right: 6px; top: 6px; }
  .sample-note { max-width: calc(100% - 60px); font-size: 13.5px; }

  .titleblock { position: static; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr); max-width: none; border-left: 0; }
  .sheet { display: grid; grid-template-rows: minmax(0, 1fr) auto; }
  .sheet canvas { position: relative; inset: auto; grid-row: 1; min-height: 0; }
  .tb-format, .tb-units, .tb-x, .tb-y { display: none; }
  .tb-wide { grid-column: auto; border-right: var(--pen) solid var(--ink); border-bottom: 0; }
  .tb-wide dd { max-width: none; }
  .tb-sheet, .tb-scale { border-bottom: 0; }
  .state { bottom: auto; height: 100%; }
  .state-card h2 { font-size: 25px; }

  .dock {
    grid-area: dock; display: grid; grid-template-columns: repeat(4, 1fr);
    border-top: var(--pen-bold) solid var(--ink); background: var(--film);
  }
  .dock button {
    background: var(--film); border: 0; border-right: var(--pen) solid var(--ink);
    min-height: 44px; padding: 0 4px; white-space: nowrap; font-size: 14.5px;
  }
  .dock button:last-child { border-right: 0; }
  .dock button[aria-expanded="true"] { background: var(--ink); color: var(--film); }
  .dock button:focus-visible { outline-offset: -3px; }
  .dock button[aria-expanded="true"]:focus-visible { outline-color: var(--guide); }

  .pane {
    display: none;
    position: fixed; left: 0; right: 0; bottom: var(--dock); z-index: 20;
    height: min(50dvh, 440px);
    border: 0; border-top: var(--pen-bold) solid var(--ink);
  }
  .app[data-sheet="layers"] .pane-layers,
  .app[data-sheet="properties"] .pane-inspector,
  .app[data-sheet="file"] .pane-inspector,
  .app[data-sheet="notes"] .pane-inspector { display: flex; }
  .pane-inspector .pane-tabs [role="tab"] { display: none; }
  .pane-inspector .pane-tabs { justify-content: flex-end; border-bottom: 0; }
  .pane-close {
    display: inline-block; margin-left: auto; min-height: 30px; padding: 0 10px; font-size: 14px;
    background: var(--film-raised); border: var(--pen) solid var(--ink); color: var(--ink);
  }
  .pane-inspector .pane-close { margin: 8px 14px 0 auto; }
  .tabs [role="tab"] { min-height: 36px; }
}

@media (max-width: 420px) {
  .brand span:not(.sr-only) { font-size: 18px; }
  .bar-actions { gap: 6px; }
  .export-controls .btn, .export-buttons .btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .ruling span { animation: none; transform: scaleX(0.6); }
}

@media (forced-colors: active) {
  .tool[aria-pressed="true"], .tabs [role="tab"][aria-selected="true"], .dock button[aria-expanded="true"] { outline: 2px solid Highlight; outline-offset: -4px; }
}
