/* Jerich.io on phones and small tablets.
   The tools keep every control they have on a desktop; on a small screen they are arranged
   around the artwork instead of beside it. mobile.js adds html.jm when the screen is narrow
   (or short and touch-driven) and moves the existing panels into the sheet below the canvas.
   Nothing here applies to desktop. */

html.jm {
  --jm-ink: #1A1917;
  --jm-paper: #F3F0E9;
  --jm-sheet-bg: #FAF8F3;
  --jm-quiet: #6E685D;
  --jm-line: rgba(26, 25, 23, .13);
  --jm-accent: #2A4C9B;
  --jm-bar: 52px;
  --jm-tabs: 60px;
  --jm-safe-t: env(safe-area-inset-top, 0px);
  --jm-safe-b: env(safe-area-inset-bottom, 0px);
  --jm-sheet: 0px;
  overscroll-behavior: none;
}
html.jm, html.jm body { height: 100%; overflow: hidden !important; zoom: 1 !important; }
html.jm body { padding: 0 !important; margin: 0 !important; background: var(--jm-paper) !important; -webkit-text-size-adjust: 100%; }

/* ---- What the phone layout replaces ---- */
html.jm body > header,
html.jm #sidebar-grip,
html.jm .preview-toolbar,
html.jm #step-rail,
html.jm .skip-link { display: none !important; }

/* ---- Top bar ---- */
#jm-bar { display: none; }
html.jm #jm-bar {
  position: fixed; z-index: 60; left: 0; right: 0; top: 0;
  height: calc(var(--jm-bar) + var(--jm-safe-t)); padding: var(--jm-safe-t) 6px 0 10px; box-sizing: border-box;
  display: flex; align-items: center; gap: 2px;
  background: var(--jm-paper); border-bottom: 1px solid var(--jm-line);
  font-family: 'Familjen Grotesk', 'Inter', sans-serif; color: var(--jm-ink);
}
#jm-bar .jm-brand { display: inline-flex; align-items: center; gap: 8px; color: var(--jm-ink); text-decoration: none; min-width: 44px; height: 44px; }
#jm-bar .jm-brand svg { width: 26px; height: 26px; display: block; }
#jm-bar .jm-title { all: unset; display: inline-flex; align-items: center; gap: 4px; height: 44px; padding: 0 6px; cursor: pointer;
  font-size: 15px; font-weight: 600; letter-spacing: -.005em; white-space: nowrap; }
#jm-bar .jm-title svg { width: 12px; height: 12px; opacity: .55; }
#jm-bar .jm-sp { flex: 1; }
#jm-bar .jm-ic { all: unset; box-sizing: border-box; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--jm-ink); cursor: pointer; border-radius: 8px; }
#jm-bar .jm-ic svg { width: 20px; height: 20px; }
#jm-bar .jm-ic:disabled { opacity: .3; }
#jm-bar .jm-ic:focus-visible, #jm-bar .jm-title:focus-visible, #jm-bar .jm-export:focus-visible { outline: 2px solid var(--jm-accent); outline-offset: -2px; }
#jm-bar .jm-export { all: unset; box-sizing: border-box; height: 34px; padding: 0 14px; margin: 0 4px; border-radius: 7px; cursor: pointer;
  background: var(--jm-ink); color: var(--jm-paper); font-size: 13.5px; font-weight: 600; display: inline-flex; align-items: center; }

/* ---- The stage: the artwork, as large as the space allows ---- */
html.jm .layout { display: block !important; height: 100% !important; min-height: 0 !important; }
html.jm .preview {
  position: fixed !important; z-index: 1; left: 0 !important; right: 0 !important;
  top: calc(var(--jm-bar) + var(--jm-safe-t)) !important;
  bottom: calc(var(--jm-tabs) + var(--jm-safe-b) + var(--jm-sheet)) !important;
  width: auto !important; height: auto !important; max-height: none !important; min-height: 0 !important;
  padding: 12px !important; margin: 0 !important; box-sizing: border-box !important;
  display: flex !important; flex-direction: column !important; align-items: center !important; justify-content: center !important; gap: 0 !important;
  overflow: hidden !important; background: var(--jm-paper) !important; border: 0 !important;
}
html.jm .preview > * { flex: none; }
html.jm .preview > div:has(> #canvas-wrap), html.jm .preview > div:has(#canvas-wrap) { margin: 0 !important; gap: 0 !important; justify-content: center !important; }
html.jm #canvas-wrap { touch-action: none; transform-origin: 50% 50%; box-shadow: 0 10px 30px -18px rgba(26, 25, 23, .5); }
html.jm #canvas, html.jm #select-overlay { touch-action: none; }
html.jm #jm-fit { position: absolute; right: 12px; bottom: 12px; z-index: 5; }
#jm-fit { display: none; }
html.jm.jm-zoomed #jm-fit { display: inline-flex; all: unset; box-sizing: border-box; position: fixed; z-index: 30;
  right: 12px; bottom: calc(var(--jm-tabs) + var(--jm-safe-b) + var(--jm-sheet) + 12px);
  height: 34px; padding: 0 12px; border-radius: 17px; background: rgba(26, 25, 23, .82); color: #fff; font: 600 12.5px 'Familjen Grotesk', sans-serif;
  display: inline-flex; align-items: center; cursor: pointer; }

/* ---- Bottom tabs ---- */
#jm-tabs { display: none; }
html.jm #jm-tabs {
  position: fixed; z-index: 50; left: 0; right: 0; bottom: 0;
  height: calc(var(--jm-tabs) + var(--jm-safe-b)); padding-bottom: var(--jm-safe-b); box-sizing: border-box;
  display: flex; align-items: stretch; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  background: var(--jm-paper); border-top: 1px solid var(--jm-line);
  font-family: 'Familjen Grotesk', 'Inter', sans-serif;
}
html.jm #jm-tabs::-webkit-scrollbar { display: none; }
#jm-tabs .jm-tab { all: unset; box-sizing: border-box; flex: 1 1 0; min-width: 46px; padding: 7px 2px 6px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--jm-quiet); font-size: 10.5px; font-weight: 500; letter-spacing: 0; white-space: nowrap; position: relative; }
#jm-tabs .jm-tab svg { width: 21px; height: 21px; }
#jm-tabs .jm-tab[aria-selected="true"] { color: var(--jm-ink); font-weight: 600; }
#jm-tabs .jm-tab[aria-selected="true"]::before { content: ''; position: absolute; top: -1px; left: 22%; right: 22%; height: 2px; background: var(--jm-ink); }
#jm-tabs .jm-tab:focus-visible { outline: 2px solid var(--jm-accent); outline-offset: -3px; }
#jm-tabs .jm-sep { flex: none; width: 1px; margin: 12px 0; background: var(--jm-line); }

/* ---- The sheet ---- */
#jm-sheet { display: none; }
html.jm #jm-sheet {
  position: fixed; z-index: 40; left: 0; right: 0; bottom: calc(var(--jm-tabs) + var(--jm-safe-b));
  height: var(--jm-sheet); display: flex; flex-direction: column;
  background: var(--jm-sheet-bg); border-top: 1px solid var(--jm-line); box-shadow: 0 -12px 30px -24px rgba(26, 25, 23, .5);
  transition: height .28s cubic-bezier(.2, .8, .2, 1); overflow: hidden;
  font-family: 'Familjen Grotesk', 'Inter', sans-serif;
}
html.jm #jm-sheet[data-state="closed"] { border-top: 0; box-shadow: none; }
#jm-sheet .jm-sheet-head { flex: none; display: flex; align-items: center; gap: 4px; height: 44px; padding: 0 6px 0 16px; position: relative;
  border-bottom: 1px solid var(--jm-line); touch-action: none; cursor: grab; }
#jm-sheet .jm-grab { position: absolute; top: 5px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: rgba(26, 25, 23, .2); }
#jm-sheet .jm-sheet-title { flex: 1; font-size: 14px; font-weight: 600; color: var(--jm-ink); padding-top: 4px; }
#jm-sheet .jm-sheet-head button { all: unset; box-sizing: border-box; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--jm-ink); border-radius: 8px; }
#jm-sheet .jm-sheet-head button svg { width: 18px; height: 18px; }
#jm-sheet .jm-sheet-head button:focus-visible { outline: 2px solid var(--jm-accent); outline-offset: -2px; }
#jm-sheet .jm-pane { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; display: none; }
#jm-sheet .jm-pane.is-on { display: block; }
#jm-sheet .jm-pane-pad { padding: 14px 16px 28px; }

/* The tool's own sidebar, now the content of the sheet. */
html.jm #jm-sheet .controls {
  position: static !important; width: auto !important; max-width: none !important; height: auto !important; max-height: none !important;
  overflow: visible !important; padding: 6px 16px 24px !important; margin: 0 !important; border: 0 !important; background: transparent !important;
  box-shadow: none !important; transform: none !important; display: block !important;
}
html.jm #jm-sheet .controls .stage-hint { margin: 6px 0 4px !important; font-size: 13.5px !important; }
html.jm #jm-sheet #stage-next { position: static !important; margin: 18px 0 0 !important; padding: 0 !important; background: transparent !important; box-shadow: none !important; }
html.jm #jm-sheet .section-header { min-height: 50px; }
html.jm #jm-sheet .info-dot { min-width: 30px; min-height: 30px; }

/* The layer list, now the Layers pane. */
html.jm #jm-sheet #slot-panel {
  position: static !important; width: auto !important; min-width: 0 !important; max-width: none !important; max-height: none !important;
  height: auto !important; overflow: visible !important; padding: 12px 16px 28px !important; margin: 0 !important; border: 0 !important; display: block !important;
}
html.jm #jm-sheet #slot-panel .slot-panel-title { display: none !important; }
html.jm #jm-sheet .stack-row { min-height: 48px; }
html.jm #jm-sheet .stack-row .stack-name { padding: 12px 0 !important; font-size: 14px !important; }
html.jm #jm-sheet .stack-row .stack-btns { position: static !important; translate: none !important; opacity: 1 !important; pointer-events: auto !important; background: none !important; padding: 0 !important; }
html.jm #jm-sheet .stack-row .stack-btns button, html.jm #jm-sheet .stack-row .stack-eye, html.jm #jm-sheet .stack-row .stack-more {
  width: 34px !important; height: 40px !important; position: static !important; translate: none !important; opacity: 1 !important; pointer-events: auto !important; margin: 0 !important; }
html.jm #jm-sheet .stack-grip { width: 26px; height: 40px; }

/* Size, format and output, now the Export pane. */
html.jm #jm-sheet .jm-out-group { margin: 0 0 18px; }
html.jm #jm-sheet .jm-out-label { margin: 0 0 8px; font-size: 12px; font-weight: 600; color: var(--jm-quiet); }
html.jm #jm-sheet .ratio-toggle, html.jm #jm-sheet .ratio-toggle.vertical { display: flex !important; flex-direction: row !important; flex-wrap: wrap; gap: 6px !important; width: auto !important; border: 0 !important; }
html.jm #jm-sheet .ratio-toggle button { min-width: 64px !important; height: 40px !important; border: 1px solid var(--jm-line) !important; border-radius: 7px !important;
  font-size: 13px !important; padding: 0 12px !important; background: #fff !important; }
html.jm #jm-sheet .ratio-toggle button.active { border-color: var(--jm-ink) !important; background: var(--jm-ink) !important; color: var(--jm-paper) !important; }
html.jm #jm-sheet .jm-out-group > div, html.jm #jm-sheet .jm-out-group label { max-width: none !important; }
html.jm #jm-sheet .export-row { display: flex !important; flex-direction: column !important; align-items: stretch !important; gap: 8px !important; width: auto !important; padding: 0 !important; margin: 0 !important; position: static !important; }
html.jm #jm-sheet .export-row .hover-note { display: block !important; width: 100%; }
html.jm #jm-sheet .export-row .btn, html.jm #jm-sheet .export-row button { width: 100% !important; min-height: 46px !important; font-size: 14.5px !important; }
html.jm #jm-sheet .export-row input { width: 100% !important; min-height: 44px; }
html.jm #jm-sheet .dims-label { display: block !important; margin: 6px 0 0; color: var(--jm-quiet); font-size: 12px; }
html.jm #jm-sheet .hover-note-bubble { display: none !important; }
html.jm #jm-sheet .hover-note.jm-tip > .hover-note-bubble { display: block !important; position: static !important; width: auto !important; max-width: none !important; margin: 6px 0 0; }

/* The catalogue preview, now the Preview pane: a two-column grid of the frame on every product. */
html.jm #jm-sheet #live-wall { margin: 0 !important; padding: 12px 16px 28px; max-width: none !important; display: block !important; }
html.jm #jm-sheet #live-wall .lw-head { flex-wrap: wrap; gap: 8px 12px; }
html.jm #jm-sheet #live-wall .lw-tools { margin-left: auto; display: flex; gap: 6px; }
html.jm #jm-sheet #live-wall .lw-tools button { min-height: 36px; padding: 0 12px; }
html.jm #jm-sheet #live-wall .lw-row { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important;
  overflow: visible !important; width: auto !important; transform: none !important; }
html.jm #jm-sheet #live-wall .lw-row > * { width: auto !important; min-width: 0 !important; max-width: none !important; }
html.jm .jm-empty { margin: 8px 0; font-size: 13.5px; line-height: 1.5; color: var(--jm-quiet); }

/* ---- Touch sizes inside the sheet ---- */
html.jm #jm-sheet input[type="text"], html.jm #jm-sheet input[type="search"], html.jm #jm-sheet input[type="number"], html.jm #jm-sheet input[type="url"],
html.jm #jm-sheet input[type="email"], html.jm #jm-sheet input[type="date"], html.jm #jm-sheet input[type="time"], html.jm #jm-sheet input[type="datetime-local"],
html.jm #jm-sheet select, html.jm #jm-sheet textarea, html.jm .jr-inline, html.jm #jr-sizebox input, html.jm #jm-menu input { font-size: 16px !important; }
html.jm #jm-sheet select, html.jm #jm-sheet input[type="text"], html.jm #jm-sheet input[type="search"], html.jm #jm-sheet input[type="number"] { min-height: 40px; }
html.jm #jm-sheet .btn { min-height: 44px; }
html.jm #jm-sheet input[type="range"] { height: 32px; touch-action: pan-y; }
html.jm #jm-sheet input[type="range"]::-webkit-slider-thumb { width: 22px !important; height: 22px !important; }
html.jm #jm-sheet input[type="range"]::-moz-range-thumb { width: 22px !important; height: 22px !important; }
html.jm #jm-sheet input[type="checkbox"] { width: 20px !important; height: 20px !important; }
html.jm #jm-sheet .frame-preset-card, html.jm #jm-sheet .preset-gallery > * { touch-action: manipulation; }
html.jm #jm-sheet .preset-gallery:not(.community-gallery) { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 10px !important; }
html.jm #jm-sheet .frame-preset-card .preset-card-name { font-size: 11.5px !important; }
html.jm #jm-sheet .edge-style-swatch, html.jm #jm-sheet .texture-swatch { min-height: 40px; }
html.jm #jm-sheet [id$="-drop-zone"], html.jm #jm-sheet .upload-zone, html.jm #jm-sheet .drop-zone { min-height: 64px; }
@media (hover: none) { html.jm #jm-sheet * { -webkit-tap-highlight-color: rgba(26, 25, 23, .08); } }

/* ---- Menu ---- */
#jm-menu { display: none; }
html.jm #jm-menu[open] { display: block; }
html.jm #jm-menu { position: fixed; z-index: 90; inset: 0; background: rgba(26, 25, 23, .32); font-family: 'Familjen Grotesk', 'Inter', sans-serif; }
#jm-menu .jm-menu-card { position: absolute; top: calc(var(--jm-bar) + var(--jm-safe-t) + 6px); right: 8px; width: min(300px, calc(100vw - 16px));
  max-height: calc(100% - var(--jm-bar) - var(--jm-safe-t) - 20px); overflow-y: auto; background: var(--jm-sheet-bg); border-radius: 12px;
  box-shadow: 0 24px 50px -20px rgba(26, 25, 23, .6); padding: 6px 0; }
#jm-menu .jm-mi { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 0 16px; cursor: pointer;
  font-size: 15px; color: var(--jm-ink); text-decoration: none; }
#jm-menu .jm-mi svg { width: 19px; height: 19px; flex: none; opacity: .75; }
#jm-menu .jm-mi:focus-visible { outline: 2px solid var(--jm-accent); outline-offset: -2px; }
#jm-menu .jm-mi.is-danger { color: #A3301A; }
#jm-menu .jm-mi small { margin-left: auto; font-size: 12px; color: var(--jm-quiet); }
#jm-menu hr { border: 0; border-top: 1px solid var(--jm-line); margin: 6px 0; }
#jm-menu .jm-who { padding: 10px 16px 6px; font-size: 12.5px; color: var(--jm-quiet); }
#jm-menu .jm-legal { display: flex; gap: 16px; padding: 10px 16px 8px; font-size: 12.5px; }
#jm-menu .jm-legal a { color: var(--jm-quiet); text-decoration: none; }

/* ---- Toast ---- */
#jm-toast { position: fixed; z-index: 100; left: 50%; bottom: calc(var(--jm-tabs, 0px) + env(safe-area-inset-bottom, 0px) + 16px); transform: translate(-50%, 20px);
  max-width: calc(100vw - 32px); padding: 11px 16px; border-radius: 10px; background: rgba(26, 25, 23, .92); color: #F3F0E9;
  font: 500 13.5px/1.4 'Familjen Grotesk', 'Inter', sans-serif; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .25s cubic-bezier(.2, .8, .2, 1); }
#jm-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
html:not(.jm) #jm-toast { --jm-tabs: 0px; }

/* ---- Draft banner (all screens) ---- */
#jm-draft { position: fixed; z-index: 95; left: 50%; top: 14px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  max-width: calc(100vw - 24px); padding: 10px 10px 10px 16px; border-radius: 10px; background: #1A1917; color: #F3F0E9;
  font: 500 13.5px/1.35 'Familjen Grotesk', 'Inter', sans-serif; box-shadow: 0 16px 40px -20px rgba(26, 25, 23, .7); }
html.jm #jm-draft { top: calc(var(--jm-bar) + var(--jm-safe-t) + 10px); }
#jm-draft button { all: unset; cursor: pointer; padding: 8px 12px; border-radius: 7px; font-weight: 600; min-height: 20px; }
#jm-draft button.is-main { background: #F3F0E9; color: #1A1917; }
#jm-draft button:focus-visible { outline: 2px solid #F3F0E9; outline-offset: 2px; }

/* ---- Things that float over the stage ---- */
html.jm #jr-sizebox { z-index: 45; }
html.jm .walk-call { max-width: calc(100vw - 24px) !important; }
html.jm .tutorial-panel, html.jm .modal, html.jm [role="dialog"]:not(#jm-menu):not(#jm-draft) { max-width: calc(100vw - 16px) !important; box-sizing: border-box; }

/* ---- Phones held sideways: canvas left, controls right ---- */
@media (orientation: landscape) and (max-height: 520px) {
  html.jm { --jm-bar: 44px; --jm-tabs: 0px; --jm-side: min(46vw, 400px); }
  html.jm .preview { right: var(--jm-side) !important; bottom: 0 !important; padding: 8px !important; }
  html.jm #jm-sheet { left: auto; width: var(--jm-side); top: calc(var(--jm-bar) + var(--jm-safe-t)); bottom: 52px; height: auto !important; border-left: 1px solid var(--jm-line); border-top: 0; }
  html.jm #jm-sheet .jm-grab, html.jm #jm-sheet [data-jm-size] { display: none !important; }
  html.jm #jm-tabs { left: auto; width: var(--jm-side); height: 52px; padding-bottom: 0; border-left: 1px solid var(--jm-line); }
  html.jm #jm-tabs .jm-tab { min-width: 52px; font-size: 10px; gap: 2px; padding: 4px; }
  html.jm #jm-tabs .jm-tab svg { width: 18px; height: 18px; }
  html.jm.jm-zoomed #jm-fit { bottom: 12px; right: calc(var(--jm-side) + 12px); }
}

@media (prefers-reduced-motion: reduce) {
  html.jm .preview, html.jm #jm-sheet, #jm-toast { transition: none !important; }
}

/* ---- Tap to read the notes that used to show on hover ---- */
.jm-why { display: none; }
html.jm #jm-sheet .jm-why { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; min-height: 32px; margin: 0 0 4px; padding: 0 2px;
  font: 500 12.5px 'Familjen Grotesk', 'Inter', sans-serif; color: var(--jm-quiet); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
html.jm #jm-sheet .export-row .jm-why { align-self: flex-start; }
html.jm #info-tip-pop { z-index: 120 !important; max-width: calc(100vw - 24px) !important; }

/* ---- Keyboard open: the panel takes the room above it ---- */
html.jm.jm-kb #jm-tabs { display: none; }
html.jm.jm-kb #jm-sheet { bottom: 0; }
html.jm.jm-kb #jm-sheet .jm-pane { padding-bottom: var(--jm-kb, 0px); }

html.jm #jm-sheet .jm-pane[data-pane="export"] { padding: 14px 16px 28px; box-sizing: border-box; }
html.jm #jm-sheet .jm-out-group > div { display: flex; flex-direction: column; align-items: stretch !important; gap: 4px; }
html.jm #jm-sheet .jm-out-group select { max-width: none !important; width: 100% !important; font-size: 16px !important; padding: 8px 28px 8px 10px !important; }

/* ---- Selected layer actions, above the tabs ---- */
#jm-act { display: none; }
html.jm #jm-act.is-on { display: flex; position: fixed; z-index: 45; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--jm-tabs) + var(--jm-safe-b) + var(--jm-sheet) + 10px);
  max-width: calc(100vw - 16px); overflow-x: auto; scrollbar-width: none;
  background: #1A1917; border-radius: 12px; padding: 4px; gap: 2px; box-shadow: 0 14px 30px -14px rgba(26,25,23,.7);
  font-family: 'Familjen Grotesk', 'Inter', sans-serif; }
#jm-act button { all: unset; box-sizing: border-box; min-width: 50px; height: 50px; padding: 4px 6px; border-radius: 9px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #F3F0E9; font-size: 10.5px; font-weight: 500; }
#jm-act button svg { width: 18px; height: 18px; }
#jm-act button:disabled { opacity: .35; }
#jm-act button:focus-visible { outline: 2px solid #F3F0E9; outline-offset: -2px; }
#jm-act button[data-act="del"] { color: #F0A090; }
html.jm #jm-sheet[data-state="full"] ~ #jm-act { display: none !important; }
@media (orientation: landscape) and (max-height: 520px) {
  html.jm #jm-act.is-on { left: calc((100vw - var(--jm-side)) / 2); bottom: 10px; }
}
/* Layer rows restack with a finger. */
html.jm #stack-list .stack-grip { touch-action: none; }

/* ---- Touch pass (mobile design guidelines) ----------------------------------------------
   Same look as before. What changes is reach and feel under a finger: every control gets at
   least a 44px hit area, small icons keep their drawn size but take a larger invisible
   target, hint text is never below 12px, taps answer with a press state instead of relying
   on hover, and the double-tap zoom delay is switched off on controls. */
html.jm button, html.jm a, html.jm label, html.jm select, html.jm summary, html.jm [role="button"] {
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
html.jm #jm-bar .jm-export { height: 40px; }
html.jm #jm-sheet .jm-sheet-head { height: 48px; }
html.jm #jm-sheet .jm-sheet-head button { width: 44px; height: 44px; }

/* Small round "i" dots and the backdrop swatch: drawn size unchanged, 44px target. */
html.jm .info-dot, html.jm #feed-info-btn { position: relative; }
html.jm .info-dot::after, html.jm #feed-info-btn::after { content: ""; position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; transform: translate(-50%, -50%); }

/* Checkbox rows: the whole row is the target, at least 44px tall. */
html.jm #jm-sheet label:has(> input[type="checkbox"]), html.jm #jm-sheet label.hover-note, html.jm #safe-zone-row {
  min-height: 44px; display: flex !important; align-items: center; gap: 10px; }
html.jm #jm-sheet input[type="checkbox"] { width: 20px; height: 20px; flex: none; }

/* Fields, selects and format buttons: 44px tall; primary load button a touch taller. */
html.jm #jm-sheet select, html.jm #jm-sheet input[type="text"], html.jm #jm-sheet input[type="url"], html.jm #jm-sheet input[type="number"],
html.jm #jm-sheet input[type="search"], html.jm #export-filename, html.jm #channel-select { min-height: 44px; font-size: 16px; }
html.jm #jm-sheet textarea { font-size: 16px; }
html.jm .hover-note[data-ratio], html.jm #fit-image-btn, html.jm #jm-sheet .btn { min-height: 44px; }
html.jm #feed-load-btn { min-height: 48px; }
html.jm #extra-img-btn { min-height: 44px; display: inline-flex; align-items: center; font-size: 13px !important; }
html.jm #backdrop-color { min-width: 44px; min-height: 36px; }
html.jm #backdrop-none { font-size: 12px !important; min-height: 36px; }

/* Colour and pattern swatches: a little larger with room between them, so a thumb hits one. */
html.jm #colour-fill-row, html.jm #pattern-fill-row { display: flex !important; flex-wrap: wrap !important; gap: 8px !important; }
html.jm #colour-fill-row > *, html.jm #pattern-fill-row > * { width: 36px !important; height: 36px !important; min-width: 36px !important; flex: 0 0 36px !important; }
html.jm #jm-sheet p[style*="10.5px"] { font-size: 12px !important; }
html.jm #load-palette-btn { font-size: 12px !important; min-height: 44px; }

/* Hint and helper text floor. */
html.jm #jm-sheet p, html.jm #jm-sheet .hint, html.jm #jm-sheet .stack-hint, html.jm #jm-sheet .stack-empty,
html.jm #jm-sheet .route-tag, html.jm #jm-sheet b, html.jm #jm-sheet span { font-size: max(12px, 1em); }
html.jm #jm-sheet .hint, html.jm #jm-sheet .stack-hint, html.jm #jm-sheet .stack-empty { font-size: 12px !important; }

/* Press feedback, since there is no hover on a phone. Transform and opacity only. */
html.jm button:active, html.jm .btn:active, html.jm #jm-tabs button:active, html.jm a:active { opacity: .72; transition: opacity 0s; }
html.jm #jm-sheet .frame-preset-card:active, html.jm #jm-sheet .preset-gallery > *:active { transform: scale(.98); }
@media (prefers-reduced-motion: reduce) { html.jm #jm-sheet .frame-preset-card:active, html.jm #jm-sheet .preset-gallery > *:active { transform: none; } }
html.jm #jm-bar .jm-export { position: relative; }
html.jm #jm-bar .jm-export::after { content: ""; position: absolute; inset: -4px -2px; }
html.jm #jm-sheet .upload-sub, html.jm #jm-sheet [class*="drop"] p, html.jm #jm-sheet [class*="drop"] span { font-size: 12px !important; }
html.jm #jm-sheet [style*="font-size:11px"], html.jm #jm-sheet [style*="font-size: 11px"], html.jm #jm-sheet [style*="font-size:10px"], html.jm #jm-sheet [style*="font-size: 10px"],
html.jm #jm-sheet [style*="font-size:10.5px"], html.jm #jm-sheet [style*="font-size: 10.5px"], html.jm .jm-out-group .btn { font-size: 12px !important; }

/* Nothing crops on small phones. Tab labels share the bar by their own width rather than equal
   slices, so a long word like "Products" never loses its edges. Notes size to their text and
   wrap inside the screen instead of being squeezed into half of it. */
html.jm #jm-tabs .jm-tab { flex: 1 1 auto; min-width: 0; padding-left: 1px; padding-right: 1px; }
@media (max-width: 360px) { html.jm #jm-tabs .jm-tab { font-size: 10px; } html.jm #jm-tabs .jm-sep { margin-left: 0; margin-right: 0; } }
#jm-toast { width: max-content; max-width: calc(100vw - 32px); box-sizing: border-box; text-align: center; overflow-wrap: anywhere; }
html.jm #jm-sheet, html.jm #jm-sheet * { overflow-wrap: break-word; }
html.jm #jm-sheet .hover-note-bubble { max-width: calc(100vw - 32px); white-space: normal; }
html.jm #jm-bar .jm-title { min-width: 0; overflow: visible; }
