/* nullpaint · mono, bords nets, polices locales. Aucune dépendance. */
:root {
  --paper: #e6e6e6; --ink: #292929; --mute: #555555; --soft: #8a8a8a; --line: #292929; --well: #dadada;
  --err: #a31515; --ok: #1d6b2f; --on: #e6e6e6; --panel: #ececec;
  --hatch: repeating-linear-gradient(45deg, #d4d4d4 0 6px, #cbcbcb 6px 12px);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1c1c1c; --ink: #e6e6e6; --mute: #a8a8a8; --soft: #777777; --line: #e6e6e6; --well: #272727;
    --err: #ff8a80; --ok: #7bd88f; --panel: #222222;
    --hatch: repeating-linear-gradient(45deg, #2c2c2c 0 6px, #252525 6px 12px); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #1c1c1c; --ink: #e6e6e6; --mute: #a8a8a8; --soft: #777777; --line: #e6e6e6; --well: #272727;
  --err: #ff8a80; --ok: #7bd88f; --panel: #222222;
  --hatch: repeating-linear-gradient(45deg, #2c2c2c 0 6px, #252525 6px 12px); color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: 'Archivo', system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
code { font-family: var(--mono); }
.vh { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.shell { height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
.bar { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 2px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 20px; letter-spacing: -0.03em; display: inline-flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; }
.brand svg { width: 22px; height: 22px; }
.h1 { margin: 0; font: 500 11px/1.2 var(--mono); color: var(--mute); max-width: 24ch; }
.menu { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-inline-start: auto; }
.sep { width: 2px; align-self: stretch; background: var(--line); margin: 2px 4px; opacity: 0.25; }
.btn { all: unset; box-sizing: border-box; cursor: pointer; padding: 9px 10px; border: 2px solid var(--line); font: 700 11px/1 var(--mono); text-transform: uppercase; text-align: center; -webkit-tap-highlight-color: transparent; white-space: nowrap; }
.btn:hover { background: var(--well); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.35; cursor: not-allowed; }
.btn.on, .btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.zoomOut { font: 700 11px/1 var(--mono); min-width: 5ch; text-align: center; }
.langSel { width: auto; background: transparent; border: 2px solid var(--line); border-radius: 0; padding: 8px 6px; font: 700 12px/1 var(--mono); cursor: pointer; }
.langSel option { background: var(--paper); color: var(--ink); }

.work { flex: 1; min-height: 0; display: grid; grid-template-columns: 56px minmax(0, 1fr) 290px; }
.tools { display: flex; flex-direction: column; gap: 4px; padding: 6px; border-inline-end: 2px solid var(--line); overflow-y: auto; }
.tool { all: unset; box-sizing: border-box; cursor: pointer; width: 42px; height: 42px; display: grid; place-items: center; border: 2px solid var(--line); -webkit-tap-highlight-color: transparent; flex: none; }
.tool svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tool:hover { background: var(--well); }
.tool[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.tool:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.vp { position: relative; overflow: hidden; background: var(--hatch); touch-action: none; user-select: none; -webkit-user-select: none; min-width: 0; min-height: 0; }
.stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; background-color: #fff; background-image: linear-gradient(45deg, #d9d9d9 25%, transparent 25%, transparent 75%, #d9d9d9 75%), linear-gradient(45deg, #d9d9d9 25%, transparent 25%, transparent 75%, #d9d9d9 75%); background-size: 16px 16px; background-position: 0 0, 8px 8px; box-shadow: 0 0 0 1px var(--line), 0 8px 30px rgba(0,0,0,0.25); }
.stage canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; }
.stage canvas.px { image-rendering: pixelated; }
#ov { pointer-events: none; }
.txtIn { position: absolute; z-index: 5; margin: 0; padding: 0; border: 1px dashed var(--ink); background: transparent; resize: none; overflow: hidden; outline: none; white-space: pre; line-height: 1.2; min-width: 4ch; min-height: 1.2em; }

.side { border-inline-start: 2px solid var(--line); overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 16px; background: var(--panel); }
.sec { display: flex; flex-direction: column; gap: 8px; }
.sub { margin: 0; font: 700 11px/1 var(--mono); text-transform: uppercase; }
.row { display: flex; align-items: center; gap: 8px; font: 700 11px/1.2 var(--mono); text-transform: uppercase; }
.row > span:first-child { min-width: 9ch; }
.row output { min-width: 5ch; text-align: end; direction: ltr; font-weight: 500; }
.row input[type="range"] { flex: 1; min-width: 0; accent-color: var(--ink); height: 28px; margin: 0; }
.inp { width: 100%; background: transparent; border: 2px solid var(--line); border-radius: 0; padding: 7px 8px; font: 500 13px/1.2 var(--mono); min-width: 0; }
.inp:focus-visible { outline: 3px solid var(--ink); outline-offset: 1px; }
.slots { display: flex; gap: 6px; align-items: center; }
.slot { all: unset; box-sizing: border-box; cursor: pointer; width: 44px; height: 44px; border: 2px solid var(--line); position: relative; }
.slot[aria-pressed="true"] { outline: 3px solid var(--ink); outline-offset: 2px; }
.slot b { position: absolute; left: 2px; top: 1px; font: 800 10px/1 var(--mono); color: #fff; mix-blend-mode: difference; }
.rgb { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 4px; }
.rgb .inp { padding: 7px 4px; text-align: center; }
.native { width: 44px; height: 44px; padding: 0; border: 2px solid var(--line); background: transparent; cursor: pointer; border-radius: 0; }
.pal { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; }
.sw { all: unset; box-sizing: border-box; cursor: pointer; aspect-ratio: 1; border: 1px solid var(--line); min-width: 0; }
.sw:hover { outline: 2px solid var(--ink); }
.chk { display: flex; align-items: center; gap: 8px; font: 700 11px/1.2 var(--mono); text-transform: uppercase; cursor: pointer; }
.chk input { width: 16px; height: 16px; margin: 0; accent-color: var(--ink); }
.layers { display: flex; flex-direction: column; border: 2px solid var(--line); max-height: 230px; overflow-y: auto; background: var(--paper); }
.lay { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-bottom: 1px solid var(--soft); cursor: pointer; }
.lay:last-child { border-bottom: 0; }
.lay[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.lay canvas { width: 36px; height: 28px; background: var(--hatch); border: 1px solid var(--soft); flex: none; }
.lay .nm { flex: 1; min-width: 0; font: 700 12px/1.2 var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lay .nm input { width: 100%; background: var(--paper); color: var(--ink); border: 1px solid var(--ink); font: 700 12px/1.2 var(--mono); padding: 2px; }
.eye { all: unset; cursor: pointer; width: 26px; height: 26px; display: grid; place-items: center; flex: none; }
.eye svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.eye:focus-visible { outline: 2px solid currentColor; }
.lay.off .nm { opacity: 0.45; text-decoration: line-through; }
.lbtns { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.lbtns .btn { padding: 8px 0; }
.lbtns svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.note { margin: 0; font: 500 11px/1.5 var(--mono); color: var(--mute); }
.status { display: flex; gap: 16px; align-items: center; padding: 5px 10px; border-top: 2px solid var(--line); font: 500 11px/1.2 var(--mono); flex-wrap: wrap; }
.status #msg { flex: 1; min-width: 12ch; }
.status #msg.err { color: var(--err); }
.status #msg.ok { color: var(--ok); }
.status span { direction: ltr; }
details.more { border: 2px solid var(--line); padding: 0 10px 10px; }
details.more summary { cursor: pointer; padding: 10px 0; font: 700 11px/1 var(--mono); text-transform: uppercase; }
details.more .btn { display: block; width: 100%; margin-top: 6px; }

dialog { border: 2px solid var(--line); border-radius: 0; background: var(--paper); color: var(--ink); padding: 18px; width: min(92vw, 380px); }
dialog::backdrop { background: rgba(0,0,0,0.55); }
dialog h2 { margin: 0 0 14px; font: 800 18px/1 'Archivo', sans-serif; text-transform: uppercase; }
.dlgBtns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 14px; }
.dlgBtns.four { grid-template-columns: repeat(4, 1fr); margin-top: 0; }
.fldRow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.fldRow label { display: flex; flex-direction: column; gap: 6px; font: 700 11px/1 var(--mono); text-transform: uppercase; }
.dlgRadios { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 12px; }

.about { max-width: 780px; margin: 0 auto; padding: 36px 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.about h2 { margin: 0; font-weight: 900; font-stretch: 62%; text-transform: uppercase; font-size: clamp(34px, 8vw, 54px); line-height: 0.9; }
.about p { margin: 0; line-height: 1.5; }
.about ul { margin: 0; padding-inline-start: 20px; line-height: 1.7; }
.foot { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--soft); display: flex; flex-direction: column; gap: 4px; }

@media (max-width: 859px) {
  .shell { height: auto; min-height: 100dvh; }
  .work { grid-template-columns: 1fr; grid-template-rows: auto 56dvh auto; flex: none; }
  .tools { flex-direction: row; border-inline-end: 0; border-bottom: 2px solid var(--line); overflow-x: auto; overflow-y: hidden; }
  .side { border-inline-start: 0; border-top: 2px solid var(--line); }
  .h1 { display: none; }
  .menu { margin-inline-start: 0; }
}
[dir="rtl"] .about h2 { font-stretch: 100%; text-transform: none; line-height: 1.15; font-weight: 800; }
[dir="rtl"] .btn, [dir="rtl"] .row, [dir="rtl"] .sub, [dir="rtl"] .chk, [dir="rtl"] .note, [dir="rtl"] .h1, [dir="rtl"] .status { font-family: 'Segoe UI', Tahoma, system-ui, sans-serif; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.legalNav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; }
.legalNav a { font: 700 11px/1.5 var(--mono); text-transform: uppercase; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.legalNav a[aria-current="page"] { text-decoration-thickness: 3px; }
.legalNav a:focus-visible, .back:focus-visible, .brand:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
a.brand { color: inherit; text-decoration: none; }
.docPage { max-width: 760px; }
.back { font: 700 11px/1 var(--mono); text-transform: uppercase; color: var(--ink); text-underline-offset: 3px; }
.doc { display: flex; flex-direction: column; gap: 10px; }
.docTitle { margin: 0 0 2px; font-weight: 900; font-size: clamp(34px, 8vw, 54px); line-height: 0.95; letter-spacing: -0.02em; }
.doc h2 { margin: 18px 0 0; font: 800 13px/1.2 var(--mono); text-transform: uppercase; }
.doc p { margin: 0; font-size: 16px; line-height: 1.6; max-width: 68ch; overflow-wrap: anywhere; }
.doc p.note { font: 500 11px/1.5 var(--mono); }
[dir="rtl"] .doc h2, [dir="rtl"] .back, [dir="rtl"] .legalNav a { font-family: 'Segoe UI', Tahoma, system-ui, sans-serif; }
.presets { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.preset span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 420px) { .presets { grid-template-columns: repeat(2, minmax(0, 1fr)); } .app { padding-inline: 16px; } }

.noscript { padding: 12px; border: 2px solid var(--line); }
.page404 { justify-content: center; }

.app { max-width: 1040px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; gap: 26px; padding: 18px 24px calc(28px + env(safe-area-inset-bottom)); }
.top { display: flex; align-items: center; justify-content: space-between; }
