Skip to content

Realistic watercolor drawings

TypeScript paintwatercolor
25.3 KB
Raw Blame
:root {
  --ink: #2a2a33;
  --ink-soft: rgba(42, 42, 51, 0.55);
  --ink-faint: rgba(42, 42, 51, 0.28);
  --glass: rgba(246, 243, 236, 0.78);
  --line: rgba(42, 42, 51, 0.12);
  --accent: #2338a8;
  --radius: 14px;
  color-scheme: light;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body, #root, .app { margin: 0; height: 100%; overflow: hidden; background: #fff; }

body {
  font: 12px/1.3 "Avenir Next", "Helvetica Neue", system-ui, sans-serif;
  color: var(--ink);
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

button { font: inherit; color: inherit; }

.paper {
  position: fixed; inset: 0; width: 100%; height: 100%;
  touch-action: none; cursor: none; display: block;
}

.cursor {
  position: fixed; left: 0; top: 0; z-index: 4;
  border: 1px solid rgba(42, 42, 51, 0.55); border-radius: 50%;
  pointer-events: none; opacity: 0;
  transition: width 0.08s, height 0.08s, opacity 0.2s, border-color 0.2s;
}
.cursor[data-tool="water"] { border-color: rgba(60, 90, 160, 0.55); box-shadow: inset 0 0 10px rgba(60, 90, 160, 0.15); }
.cursor[data-tool="lift"] { border-style: dashed; }

.hint {
  position: fixed; left: 50%; top: 46%; transform: translate(-50%, -50%);
  z-index: 3; pointer-events: none; text-align: center;
  font-size: 11px; letter-spacing: 0.3em; text-transform: uppercase; line-height: 2.2;
  color: rgba(42, 42, 51, 0.35);
  transition: opacity 1.2s ease;
}
.hint.gone { opacity: 0; }

/* floating panels */
.panel {
  position: fixed; z-index: 5;
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(40, 35, 25, 0.08);
}

.panel button {
  background: none; border: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 8px; border-radius: 10px;
  color: var(--ink-soft);
  transition: background 0.15s, color 0.15s;
}
.panel button span { font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; }
.panel button:hover:not(:disabled) { color: var(--ink); background: rgba(42, 42, 51, 0.06); }
.panel button:disabled { opacity: 0.35; cursor: default; }
.panel button.on { color: var(--ink); background: rgba(42, 42, 51, 0.09); }
.panel button.danger { color: #a0281c; }

.tools {
  left: calc(14px + env(safe-area-inset-left)); top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 2px; padding: 6px;
}
.tools .tool { width: 56px; }
.tools hr { width: 32px; border: 0; border-top: 1px solid var(--line); margin: 3px auto; }

/* current brush: a dab thumbnail that opens the library */
.tool.pick .thumb { width: 28px; height: 28px; display: block; }
.tool.pick .brushname { max-width: 52px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel .tool.pick.open { color: var(--ink); background: rgba(42, 42, 51, 0.09); }

/* brush library */
.library {
  left: calc(84px + env(safe-area-inset-left)); top: 50%; transform: translateY(-50%);
  width: 356px; max-height: calc(100vh - 28px);
  display: flex; flex-direction: column;
  z-index: 6;   /* above the text panel, which shares its spot */
}
.panel-head {
  display: grid; grid-template-columns: 1fr auto; align-items: start; column-gap: 8px;
  padding: 12px 10px 8px 14px; border-bottom: 1px solid var(--line);
}
.panel-head > span:first-child { font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink); }
.panel-head .sub { grid-column: 1; font-size: 10px; color: var(--ink-faint); line-height: 1.4; margin-top: 3px; }
.panel-head .icon { grid-column: 2; grid-row: 1 / span 2; }
.panel button.icon { padding: 4px; border-radius: 8px; flex-direction: row; }

.brushes {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  padding: 10px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
}
.brush {
  position: relative; display: flex; flex-direction: column; gap: 4px;
  padding: 6px 8px 7px; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.35);
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.brush:hover { background: rgba(255, 255, 255, 0.6); }
.brush:focus-visible { outline: 2px solid rgba(42, 42, 51, 0.5); outline-offset: 1px; }
.brush.on { background: rgba(255, 255, 255, 0.75); border-color: rgba(42, 42, 51, 0.55); }
.brush .stroke { width: 150px; height: 44px; display: block; max-width: 100%; }
.brush .label { font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); }
.brush.on .label { color: var(--ink); }
.brush .remove { position: absolute; top: 4px; right: 4px; opacity: 0; color: var(--ink-faint); }
.brush:hover .remove, .brush.on .remove { opacity: 1; }
.brush .remove:hover { color: #a0281c; }

.library-foot { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px; border-top: 1px solid var(--line); }
.panel .import { flex-direction: row; gap: 6px; padding: 6px 10px; border: 1px dashed var(--ink-faint); }
.panel .import span { font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; }
.library-foot .note { font-size: 10px; color: var(--ink-faint); line-height: 1.35; }

.toast {
  position: fixed; left: 50%; top: calc(18px + env(safe-area-inset-top)); transform: translateX(-50%);
  z-index: 6; pointer-events: none;
  padding: 7px 14px; border-radius: 999px;
  background: rgba(42, 42, 51, 0.82); color: #f6f3ec;
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
}

.actions {
  right: calc(14px + env(safe-area-inset-right)); top: calc(14px + env(safe-area-inset-top));
  display: flex; gap: 2px; padding: 5px;
}

.settings {
  right: calc(14px + env(safe-area-inset-right)); top: calc(84px + env(safe-area-inset-top));
  width: 230px; padding: 14px 16px 10px;
  display: flex; flex-direction: column; gap: 9px;
}
.slider { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 10px; }
.slider span { font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); }
/* reference + save panels: drop down under the action bar like the settings */
.popover {
  right: calc(14px + env(safe-area-inset-right)); top: calc(84px + env(safe-area-inset-top));
  width: 268px; padding: 12px 14px 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.popover .panel-head { padding: 0; border-bottom: 0; }
.popover .import { align-self: flex-start; }
.popover .field { display: flex; flex-direction: column; gap: 5px; }
.popover .field > span { font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); }
.panel button.primary {
  flex-direction: row; justify-content: center; padding: 8px 10px;
  background: rgba(42, 42, 51, 0.82); color: #f6f3ec;
  font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase;
}
.panel button.primary:hover:not(:disabled) { background: rgba(42, 42, 51, 0.92); color: #fff; }

/* the reference image's move / scale frame */
.ref-frame {
  position: fixed; z-index: 4; cursor: move; touch-action: none;
  outline: 1px dashed rgba(42, 42, 51, 0.7); outline-offset: -1px;
  box-shadow: 0 0 0 1px rgba(246, 243, 236, 0.6);
}
.ref-frame i {
  position: absolute; width: 14px; height: 14px; margin: -7px;
  background: #f6f3ec; border: 1px solid rgba(42, 42, 51, 0.7); border-radius: 3px;
}
.ref-frame i[data-corner="nw"] { left: 0; top: 0; cursor: nwse-resize; }
.ref-frame i[data-corner="ne"] { right: 0; top: 0; cursor: nesw-resize; }
.ref-frame i[data-corner="sw"] { left: 0; bottom: 0; cursor: nesw-resize; }
.ref-frame i[data-corner="se"] { right: 0; bottom: 0; cursor: nwse-resize; }

/* asks what a dropped image is for */
.drop-choice { z-index: 7; display: flex; gap: 4px; padding: 6px; }
.drop-choice button { flex-direction: row; gap: 6px; padding: 8px 12px; }
.fill-choice {
  z-index: 7; left: 50%; top: calc(18px + env(safe-area-inset-top)); transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 6px; padding: 10px 10px 6px; max-width: calc(100vw - 32px);
}
.fill-choice p { margin: 0 4px; font-size: 12px; color: var(--ink); }
.fill-choice .row { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.fill-choice button { flex-direction: row; gap: 6px; padding: 8px 12px; }
.fill-choice button span { display: inline; }

.settings .reset { align-self: flex-end; padding: 4px 6px; font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 22px; background: transparent; margin: 0; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track { height: 1px; background: var(--ink-faint); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 12px; height: 12px; margin-top: -6px; border-radius: 50%;
  background: #f6f3ec; border: 1px solid rgba(42, 42, 51, 0.7);
}
input[type="range"]::-moz-range-track { height: 1px; background: var(--ink-faint); }
input[type="range"]::-moz-range-thumb { width: 11px; height: 11px; border-radius: 50%; background: #f6f3ec; border: 1px solid rgba(42, 42, 51, 0.7); }

.palette {
  left: 50%; transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom));
  max-width: calc(100vw - 28px);
  padding: 2px 4px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
/* room inside the scroller for the selected swatch's lift, scale and ring, which it would otherwise clip */
.swatches { display: flex; gap: 6px; overflow-x: auto; max-width: 100%; padding: 10px 7px 4px; scroll-padding-inline: 7px; scrollbar-width: none; }
.swatches::-webkit-scrollbar { display: none; }

.panel .swatch, .swatch {
  flex: 0 0 auto;
  width: 30px; height: 30px; padding: 0; border-radius: 47% 53% 50% 50% / 52% 48% 52% 48%;
  border: 1px solid rgba(42, 42, 51, 0.12);
  cursor: pointer; position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.panel .swatch:hover { transform: translateY(-2px); background-color: transparent; }
.swatch.on { transform: translateY(-3px) scale(1.08); box-shadow: 0 0 0 2px #f6f3ec, 0 0 0 3px rgba(42, 42, 51, 0.6); }
.swatch.custom {
  display: block; overflow: hidden;
  background: conic-gradient(from 30deg, #e0301e, #f6d409, #4f7d2a, #0e5a9c, #4b2c7a, #d0306a, #e0301e);
}
.swatch.custom input { opacity: 0; position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0; }

.well { display: flex; gap: 12px; align-items: center; min-height: 16px; font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); }
.well .mix { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-faint); }
.well .mix i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 1px solid rgba(42, 42, 51, 0.15); }

.error {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-soft); padding: 24px; text-align: center;
}
.error .sub { color: var(--ink-faint); }

/* phones: compact chrome */
/* phones: compact chrome. Tools across the top (zoom tucked under their right end),
   actions and palette along the bottom, panels in the space between. */
@media (max-width: 640px) {
  :root {
    --m-gap: 10px;
    --m-top: calc(66px + env(safe-area-inset-top));        /* below the tool bar */
    --m-bottom: calc(146px + env(safe-area-inset-bottom)); /* above the action bar */
  }
  .panel button { padding: 8px 7px; }
  .panel button span { display: none; }
  /* the bars scroll sideways rather than run off narrow screens */
  .tools, .actions { overflow-x: auto; overscroll-behavior: contain; scrollbar-width: none; }
  .tools::-webkit-scrollbar, .actions::-webkit-scrollbar { display: none; }
  .tools {
    top: calc(var(--m-gap) + env(safe-area-inset-top)); left: calc(var(--m-gap) + env(safe-area-inset-left)); transform: none;
    flex-direction: row; max-width: calc(100vw - 2 * var(--m-gap) - env(safe-area-inset-left) - env(safe-area-inset-right));
  }
  .tools .tool { width: auto; flex: 0 0 auto; }
  .tools hr { flex: 0 0 auto; width: 1px; height: 24px; border-top: 0; border-left: 1px solid var(--line); margin: auto 2px; }
  .actions {
    top: auto; bottom: calc(92px + env(safe-area-inset-bottom));
    left: calc(var(--m-gap) + env(safe-area-inset-left)); right: calc(var(--m-gap) + env(safe-area-inset-right));
    justify-content: space-between;
  }
  .actions button { flex: 0 0 auto; }
  .library {
    left: var(--m-gap); right: var(--m-gap); top: auto; transform: none; width: auto;
    bottom: var(--m-bottom); max-height: min(46vh, calc(100dvh - var(--m-top) - var(--m-bottom) - 50px));
  }
  .panel-head .sub, .library-foot .note { display: none; }
  .brush .stroke { width: 100%; height: 40px; }
  .panel .import span { display: inline; }
  .toast { top: calc(112px + env(safe-area-inset-top)); max-width: calc(100vw - 2 * var(--m-gap)); text-align: center; }
  .settings, .popover {
    top: auto; bottom: var(--m-bottom); right: var(--m-gap);
    max-width: calc(100vw - 2 * var(--m-gap)); max-height: calc(100dvh - var(--m-top) - var(--m-bottom) - 50px); overflow-y: auto;
  }
  .popover .import span, .drop-choice button span, .panel button.primary span { display: inline; }
  .palette { bottom: calc(var(--m-gap) + env(safe-area-inset-bottom)); max-width: calc(100vw - 2 * var(--m-gap)); }
  .panel .swatch, .swatch { width: 28px; height: 28px; }
  .hand-pip { width: 120px; bottom: calc(var(--m-bottom) + 6px); }
}

/* text tool */
.paper.placing { cursor: crosshair; }
.ghost {
  position: fixed; inset: 0; width: 100%; height: 100%; z-index: 3;
  pointer-events: none; overflow: visible;
}
.ghost path { fill: none; stroke: rgba(42, 42, 51, 0.45); stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 3 3; }

.tool-panel {
  left: calc(84px + env(safe-area-inset-left)); top: 50%; transform: translateY(-50%);
  width: 316px; max-height: calc(100vh - 28px);
  display: flex; flex-direction: column;
}
.tool-body { display: flex; flex-direction: column; gap: 10px; padding: 10px 12px 8px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.panel-head .head-actions { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 2px; }
.panel button.fold { display: none; }
.panel button.fold svg { transform: rotate(90deg); transition: transform 0.15s; }
.panel button.fold.folded svg { transform: rotate(-90deg); }
.tool-panel.folded .tool-body { display: none; }
.text-input {
  width: 100%; font: 15px/1.3 "Avenir Next", "Helvetica Neue", system-ui, sans-serif; color: var(--ink);
  padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55); outline: none;
  -webkit-user-select: text; user-select: text;
}
.text-input:focus { border-color: rgba(42, 42, 51, 0.5); }

.fontlist {
  flex: 0 0 auto; max-height: 172px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.35); padding: 4px;
}
.fontgroup { font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); padding: 8px 8px 3px; }
.fontrow { display: block; padding: 1px 6px; border-radius: 7px; cursor: pointer; border: 1px solid transparent; }
.fontrow:hover { background: rgba(255, 255, 255, 0.7); }
.fontrow:focus-visible { outline: 2px solid rgba(42, 42, 51, 0.5); outline-offset: -2px; }
.fontrow.on { background: rgba(255, 255, 255, 0.85); border-color: rgba(42, 42, 51, 0.5); }
.fontrow i { background-image: var(--atlas); display: block; width: 260px; height: 32px; max-width: 100%; background-repeat: no-repeat; background-size: 260px auto; opacity: 0.85; }
.fontrow span { display: block; font-size: 12px; line-height: 32px; }

.shapes { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 2px; }
.svg-file { display: flex; align-items: center; gap: 6px; min-width: 0; }
.svg-name { flex: 1; min-width: 0; font-size: 12px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel .svg-pick { flex: 0 0 auto; padding: 5px 9px; border-radius: 7px; font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; background: rgba(255, 255, 255, 0.85); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); }
.panel .shapes button { padding: 6px 2px; gap: 2px; min-width: 0; }
.panel .shapes button span { font-size: 8px; letter-spacing: 0.06em; white-space: nowrap; }
.panel .shapes button.on { color: var(--ink); background: rgba(255, 255, 255, 0.85); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); }

.tool-rows { display: flex; flex-direction: column; gap: 7px; }
.tool-rows .slider { grid-template-columns: 58px 1fr; }
.seg { display: flex; gap: 2px; padding: 2px; border-radius: 9px; background: rgba(42, 42, 51, 0.06); }
.panel .seg button { flex: 1; padding: 5px 4px; border-radius: 7px; font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; }
.panel .seg button.on { background: rgba(255, 255, 255, 0.85); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); }

.tool-foot { flex: none; display: flex; align-items: center; gap: 8px; min-height: 22px; padding: 0 12px 10px; font-size: 10px; color: var(--ink-soft); }
.tool-foot .status { flex: 1; }
.panel .stop { flex-direction: row; gap: 5px; padding: 4px 8px; border: 1px solid var(--line); color: #a0281c; }
.tool-foot .credit { font-size: 10px; color: var(--ink-faint); text-decoration: none; white-space: nowrap; }
.tool-foot .credit:hover { color: var(--ink); }

@media (max-width: 640px) {
  .tool-panel {
    left: var(--m-gap); right: var(--m-gap); top: auto; transform: none; width: auto;
    bottom: var(--m-bottom); max-height: min(46vh, calc(100dvh - var(--m-top) - var(--m-bottom) - 50px));
  }
  .tool-panel .panel-head .sub { display: none; }
  .tool-panel .panel-head { padding-top: 8px; padding-bottom: 6px; align-items: center; }
  .tool-panel .panel-head > span:first-child { align-self: center; }
  .panel button.fold { display: flex; }
  .tool-panel.folded .panel-head { border-bottom: 0; }
  .tool-foot { font-size: 11px; color: var(--ink); padding-top: 2px; }
  .panel .stop span { display: inline; }
  .fontlist { max-height: 138px; }
  .fontrow { padding: 3px 6px; }
  .tool-foot .credit { display: none; }
}

/* paper picker */
.popover.paper-panel { width: 286px; max-height: calc(100vh - 156px); }   /* clear of the zoom control */

.popover .project { border-top: 1px solid rgba(42, 42, 51, 0.08); padding-top: 10px; }
.popover .project-buttons { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.popover .project .note { margin: 0; font-size: 10px; line-height: 1.35; color: var(--ink-faint); }

/* ---- history ---- */
.popover.history-panel { width: 250px; max-height: calc(100vh - 156px); }
.history-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; margin: 0 -4px; padding: 0 4px; }
.panel .history-list button { flex-direction: row; justify-content: flex-start; gap: 8px; padding: 6px 8px; border-radius: 8px; text-align: left; }
.panel .history-list button span { font-size: 11px; letter-spacing: 0; text-transform: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel .history-list button svg { flex: none; }
.panel .history-list button.undone { opacity: 0.4; }
.panel .history-list button.on { background: rgba(255, 255, 255, 0.85); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); }
@media (max-width: 640px) {
  .popover.history-panel { max-height: 52vh; }
  .panel .history-list button span { display: inline; }
}
.papers {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; margin: 0 -4px; padding: 0 4px 2px;
}
.paper-card {
  display: flex; flex-direction: column; gap: 4px; padding: 5px 5px 6px; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent; background: rgba(255, 255, 255, 0.35);
  transition: background 0.15s, border-color 0.15s;
}
.paper-card:hover { background: rgba(255, 255, 255, 0.6); }
.paper-card:focus-visible { outline: 2px solid rgba(42, 42, 51, 0.5); outline-offset: 1px; }
.paper-card.on { background: rgba(255, 255, 255, 0.75); border-color: rgba(42, 42, 51, 0.55); }
.paper-card .sheet { display: block; max-width: 100%; border-radius: 6px; box-shadow: 0 0 0 1px rgba(42, 42, 51, 0.08); }
.paper-card .label { font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); padding-left: 2px; }
.paper-card.on .label { color: var(--ink); }
@media (max-width: 640px) {
  .popover.paper-panel { max-height: 52vh; }
  .paper-card .sheet { width: 100% !important; height: auto !important; }
}

/* paper size */
.paper-panel .papers { min-height: 140px; }
.paper-size { gap: 7px; }
.sizes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; }
.panel .sizes button {
  gap: 1px; padding: 5px 2px; border-radius: 8px; min-width: 0;
  border: 1px solid transparent; background: rgba(255, 255, 255, 0.35);
}
.panel .sizes button.on { background: rgba(255, 255, 255, 0.85); border-color: rgba(42, 42, 51, 0.55); }
.sizes b { font-weight: 500; font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }
.sizes i { font-style: normal; font-size: 9px; color: var(--ink-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.custom-size { display: flex; align-items: center; gap: 6px; }
.custom-size .text-input { font-size: 13px; padding: 6px 8px; font-variant-numeric: tabular-nums; }
.custom-size em { font-style: normal; font-size: 10px; color: var(--ink-soft); }
.paper-size .note { margin: 0; font-size: 10px; line-height: 1.35; color: var(--ink-faint); }

/* zoom */
.zoom {
  right: calc(14px + env(safe-area-inset-right)); bottom: calc(14px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 1px; padding: 4px;
}
.panel.zoom button { padding: 6px; border-radius: 8px; }
.panel.zoom .pct { min-width: 50px; font-size: 11px; font-variant-numeric: tabular-nums; }

/* navigating: Space held or a pan / pinch under way */
body.space-pan .paper { cursor: grab; }
body.panning .paper { cursor: grabbing; }
body.space-pan .cursor, body.panning .cursor { opacity: 0 !important; }

@media (max-width: 640px) {
  /* pinch zooms, so only the readout and fit stay: tucked under the tool bar's right end */
  .zoom { right: calc(var(--m-gap) + env(safe-area-inset-right)); top: var(--m-top); bottom: auto; padding: 3px; }
  .panel.zoom button[aria-label="Zoom out"], .panel.zoom button[aria-label="Zoom in"] { display: none; }
  .panel.zoom .pct { min-width: 44px; padding: 5px 4px; }
  .panel.zoom button { padding: 5px; }
}

/* short landscape phones: the side tool bar scrolls instead of running off the bottom */
@media (min-width: 641px) and (max-height: 560px) {
  .tools { top: calc(10px + env(safe-area-inset-top)); transform: none; max-height: calc(100dvh - 20px); overflow-y: auto; scrollbar-width: none; }
  .tools::-webkit-scrollbar { display: none; }
  .tools .tool { flex: 0 0 auto; }
  .tools .tool span, .actions button span, .panel-head .sub { display: none; }
  .tools .tool { width: 44px; }
  .library, .tool-panel { top: 10px; transform: none; max-height: calc(100dvh - 20px); }
}

/* hand painting: the hand cursor, its dwell ring, the hovered control and the camera picture */
.hand-overlay { position: fixed; inset: 0; z-index: 8; pointer-events: none; }
.hand-target {
  position: absolute; box-sizing: border-box; border-radius: 9px;
  border: 1.5px solid rgba(42, 42, 51, 0.35); background: rgba(42, 42, 51, 0.04);
  transition: left 0.08s, top 0.08s, width 0.08s, height 0.08s;
}
.hand-target.grab { border-color: rgba(60, 90, 160, 0.8); background: rgba(60, 90, 160, 0.08); }
.hand-cursor { position: absolute; left: 0; top: 0; overflow: visible; }
.hand-cursor .base { fill: rgba(255, 255, 255, 0.35); stroke: rgba(42, 42, 51, 0.5); stroke-width: 1.5; }
.hand-cursor .dwell { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; }
.hand-cursor .dot { fill: rgba(42, 42, 51, 0.7); transition: r 0.1s; }
.hand-cursor.pinch .base { stroke: var(--ink); fill: rgba(42, 42, 51, 0.12); }
.hand-cursor.paint .base { stroke: rgba(60, 90, 160, 0.9); fill: rgba(60, 90, 160, 0.14); }
.hand-cursor.paint .dot { fill: rgba(60, 90, 160, 0.9); }
.hand-pip {
  position: fixed; z-index: 5; pointer-events: none;
  right: calc(14px + env(safe-area-inset-right)); bottom: calc(66px + env(safe-area-inset-bottom));   /* above the zoom control */
  width: 160px; aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden;
  background: rgba(42, 42, 51, 0.85); border: 1px solid var(--line); box-shadow: 0 6px 24px rgba(40, 35, 25, 0.12);
}
.hand-pip video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.hand-pip .box { position: absolute; left: 15%; top: 15%; width: 70%; height: 70%; border: 1px dashed rgba(255, 255, 255, 0.55); border-radius: 6px; }
.hand-pip span {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 0 12px;
  font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: #f6f3ec; background: rgba(42, 42, 51, 0.5);
}
.settings .hand-row .seg { flex: 1; }
.settings .note { font-size: 10px; color: var(--ink-faint); line-height: 1.4; margin-top: -4px; }