/* Archivo (SIL OFL), served from this app: no Google Fonts request, works offline on the LAN */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url("/static/fonts/archivo-latin.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url("/static/fonts/archivo-latin-ext.woff2") format("woff2-variations");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0,
    U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Fuga - porcelain, grout and one cobalt glaze.
   Tokens: porcelain (page), panel, ink, muted, line, grout (catalogue joints), glaze (the one accent). */
:root {
  --porcelain: #eef0ef;
  --panel: #fafbfa;
  --ink: #182126;
  --muted: #59656b;
  --line: #d4d9d7;
  --grout: #c9cecc;
  --glaze: #2347a8;
  --glaze-soft: #e3e9f7;
  --glaze-ink: #ffffff;
  --stage: #15191c;
  --stage-2: #1e2428;
  --stage-ink: #e6eaec;
  --stage-muted: #a3afb4;
  --danger: #a3342b;
  --r-s: 4px;
  --r-m: 8px;
  --header-h: 60px;
  --panel-w: 400px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --porcelain: #101416;
    --panel: #161b1e;
    --ink: #e6eaec;
    --muted: #9aa7ac;
    --line: #2a3236;
    --grout: #2c3438;
    --glaze: #7f9cf2;
    --glaze-soft: #1d2740;
    --glaze-ink: #0d1424;
    --stage: #0c0f11;
    --stage-2: #151a1d;
    --danger: #e0786e;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--porcelain);
  color: var(--ink);
  font-family: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
p { margin: 0; }

/* ---------------------------------------------------------------- header */
.topbar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: relative;
  z-index: 5;
}
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; }
.mark { width: 34px; height: 34px; display: block; }
.m-ink { fill: var(--ink); }
.m-glaze { fill: var(--glaze); }
.wordmark {
  font-size: 25px;
  font-weight: 800;
  font-stretch: 125%;
  letter-spacing: -0.035em;
  line-height: 1;
  padding-bottom: 2px;
}
.topbar-actions { display: flex; gap: 12px; align-items: center; }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-s); overflow: hidden; }
.lang button { border: 0; background: none; padding: 5px 10px; font-size: 13px; cursor: pointer; color: var(--muted); }
.lang button.on { background: var(--ink); color: var(--panel); }

/* ---------------------------------------------------------------- buttons */
.primary, .ghost {
  border-radius: var(--r-s);
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
}
.primary { background: var(--glaze); color: var(--glaze-ink); border: 1px solid var(--glaze); }
.primary:hover { filter: brightness(1.1); }
.ghost { background: transparent; border: 1px solid var(--line); color: inherit; }
.ghost:hover { border-color: var(--muted); }
.big { padding: 13px 20px; font-size: 15px; }
.small { padding: 6px 10px; font-size: 13px; }
.linkish {
  border: 0; background: none; padding: 0; cursor: pointer;
  color: var(--glaze); font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
}
button:focus-visible, input:focus-visible, summary:focus-visible, .split:focus-visible, .file-btn:focus-within,
.tile-cell:focus-visible, .folder:focus-visible, a:focus-visible {
  outline: 2px solid var(--glaze);
  outline-offset: 2px;
}
button:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------------------------------------------------------------- layout */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--panel-w);
  height: calc(100dvh - var(--header-h));
}
.stage {
  position: relative;
  background: var(--stage);
  color: var(--stage-ink);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.panel {
  background: var(--panel);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.panel-scroll { flex: 1; overflow-y: auto; padding: 16px 20px 28px; overscroll-behavior: contain; }

/* ---------------------------------------------------------------- empty state */
.dropzone {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
  align-items: center;
  gap: 24px;
  padding: 40px clamp(24px, 5vw, 64px);
  overflow: hidden;
  min-height: 0;
}
.dropzone.drag { outline: 2px dashed var(--glaze); outline-offset: -16px; }
.dz-text { max-width: 33rem; position: relative; z-index: 1; }
.dropzone h1 {
  font-size: clamp(32px, 3.6vw, 50px);
  line-height: 1.02;
  font-weight: 780;
  font-stretch: 118%;
  margin: 0 0 18px;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.dz-lede { color: var(--stage-muted); font-size: 17px; max-width: 28rem; margin-bottom: 26px; }
.dz-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.dropzone .ghost { border-color: #3f4a50; color: var(--stage-ink); }
.dropzone .primary { --glaze: #3b63d6; }
.tips { list-style: none; padding: 0; margin: 30px 0 0; display: grid; gap: 10px; max-width: 28rem; }
.tips li {
  position: relative;
  padding-left: 22px;
  font-size: 14px;
  color: var(--stage-muted);
}
/* a small tile with a joint marks each tip */
.tips li::before {
  content: "";
  position: absolute; left: 0; top: 0.42em;
  width: 10px; height: 10px;
  background:
    linear-gradient(var(--stage), var(--stage)) center / 100% 1.5px no-repeat,
    linear-gradient(var(--stage), var(--stage)) center / 1.5px 100% no-repeat,
    #6d7c84;
}
.file-btn { display: inline-flex; align-items: center; position: relative; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* the catalogue laid as a floor running away from the viewer */
.showcase { align-self: stretch; min-height: 320px; perspective: 1000px; perspective-origin: 50% 0%; position: relative; margin-right: calc(-1 * clamp(24px, 5vw, 64px)); }
.showcase-floor {
  position: absolute;
  left: 8%; right: -20%; top: 4%; bottom: -30%;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 4px;
  background: #2b3338;
  transform: rotateX(54deg) rotateZ(-14deg);
  transform-origin: 50% 0%;
}
.showcase-floor span { aspect-ratio: 1; background: #2b3338 center / cover; }
.showcase::after {
  content: "";
  position: absolute; inset: -2px;
  background: linear-gradient(180deg, var(--stage) 0%, transparent 26%, transparent 64%, var(--stage) 98%),
              linear-gradient(90deg, var(--stage) 4%, transparent 34%);
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  .showcase-floor span { animation: lay 0.5s ease-out both; animation-delay: calc(var(--i) * 28ms); }
  @keyframes lay { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
}

/* ---------------------------------------------------------------- viewer */
.viewer { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.viewer > .frame { margin: auto; }
.frame {
  --ar: 1.333;
  position: relative;
  aspect-ratio: var(--ar);
  width: min(calc(100% - 32px), calc((100dvh - var(--header-h) - 104px) * var(--ar)));
  margin: 16px auto 0;
  overflow: hidden;
  border-radius: var(--r-s);
  touch-action: none;
  -webkit-user-select: none;   /* Safari: without this a drag selects the whole picture (blue) */
  user-select: none;
  -webkit-touch-callout: none;
  background: var(--stage-2);
}
.frame * { -webkit-user-select: none; user-select: none; }
.frame ::selection, .frame::selection { background: transparent; }
.frame img, .frame canvas, .frame svg { -webkit-user-drag: none; }
/* while dragging anywhere (the before/after handle, a wall corner) nothing on the page
   may get selected - Safari otherwise highlights the photo and flickers */
body.dragging, body.dragging * { -webkit-user-select: none !important; user-select: none !important; }
.frame img, .frame canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  -webkit-user-drag: none;
}
.zoom-layer { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
.frame { cursor: pointer; }
.frame.zoomed { cursor: grab; }
.frame.panning, .frame.panning #maskCanvas { cursor: grabbing; }
.frame.zoomed .split, .frame.zoomed .tag-before { display: none; }
.zoom-ctl {
  position: absolute;
  top: 10px; right: 10px;
  display: flex;
  border-radius: var(--r-s);
  overflow: hidden;
  background: rgba(15, 20, 22, 0.66);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.zoom-ctl button {
  min-width: 34px; height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.zoom-ctl button:hover { background: rgba(255, 255, 255, 0.14); }
.zoom-ctl .zoom-level { font-size: 12px; font-variant-numeric: tabular-nums; min-width: 52px; }
#originalImg { clip-path: inset(0 calc(100% - clamp(16px, var(--split, 0%), calc(100% - 16px))) 0 0); }
.frame.masking #resultImg { visibility: hidden; }
.frame.masking #originalImg { clip-path: none; }
#maskCanvas { cursor: pointer; opacity: 0.55; }
.frame.selecting #maskCanvas { cursor: progress; }
.ripple {
  position: absolute;
  width: 34px; height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  animation: ripple 0.6s ease-out forwards;
}
@keyframes ripple { from { transform: scale(0.3); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ripple { animation-duration: 0.01s; } }
.split {
  position: absolute;
  top: 0; bottom: 0;
  left: clamp(16px, var(--split, 0%), calc(100% - 16px));
  width: 2px;
  margin-left: -1px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
  cursor: ew-resize;
}
.split::before { content: ""; position: absolute; inset: 0 -14px; }
.split-grip {
  position: absolute;
  top: 50%; left: 50%;
  width: 30px; height: 30px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
.split-grip::before, .split-grip::after {
  content: "";
  position: absolute;
  top: 50%;
  border: 5px solid transparent;
  transform: translateY(-50%);
}
.split-grip::before { left: 3px; border-right-color: #1f282b; }
.split-grip::after { right: 3px; border-left-color: #1f282b; }
.tag {
  position: absolute;
  top: 10px;
  padding: 3px 8px;
  border-radius: var(--r-s);
  background: rgba(15, 20, 22, 0.66);
  color: #fff;
  font-size: 12px;
  pointer-events: none;
}
.tag-before { left: 10px; opacity: 0; transition: opacity 0.2s; }
.frame.comparing .tag-before { opacity: 1; }
.busy {
  position: absolute;
  right: 10px; bottom: 10px;
  display: flex; gap: 8px; align-items: center;
  padding: 6px 10px;
  border-radius: var(--r-s);
  background: rgba(15, 20, 22, 0.72);
  color: #fff;
  font-size: 13px;
  max-width: calc(100% - 20px);
}
.spinner {
  flex: none;
  width: 14px; height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

.stage-bar, .mask-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 12px 16px 16px;
  flex-wrap: wrap;
}
.stage-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stage .ghost { border-color: #3f4a50; color: var(--stage-ink); }
.stage .primary { --glaze: #3b63d6; }
.status-wrap { flex: 1 1 22rem; min-width: 0; }
.status { font-size: 13px; color: var(--stage-muted); max-width: 46rem; }
.status-wrap .status { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.status-wrap.open .status { -webkit-line-clamp: unset; display: block; }
.stage .linkish { color: #9fb5f5; margin-top: 2px; }

/* ---------------------------------------------------------------- panel */
.block + .block { margin-top: 22px; }
.block-title {
  font-size: 17px;
  font-weight: 720;
  font-stretch: 112%;
  margin: 0;
  letter-spacing: -0.01em;
}

/* surfaces */
.surf-row { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; }
.surf-list { display: flex; flex-wrap: wrap; gap: 6px; }
.surf-list button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 12px 6px 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.surf-list .sw {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--line) center / cover;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.surf-list button[aria-selected="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.surf-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.danger { color: var(--danger); }

/* catalogue */
.cat-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.cat-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.search {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  padding: 0 10px;
  background: var(--porcelain);
}
.search:focus-within { border-color: var(--glaze); }
.search svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 1.8; flex: none; }
.search input { border: 0; background: none; outline: none; padding: 9px 0; width: 100%; font-size: 14px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button {
  flex: none;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 13px;
  cursor: pointer;
}
.chips button.on { background: var(--glaze-soft); border-color: var(--glaze); color: var(--glaze); font-weight: 600; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; margin: 12px 0 10px; font-size: 13px; min-height: 20px; }
.crumbs button { border: 0; background: none; padding: 0; cursor: pointer; color: var(--glaze); font-weight: 600; }
.crumbs .here { color: var(--ink); font-weight: 600; }
.crumbs .sep { color: var(--muted); }

/* folders: each cover is a 2 x 2 patch of the folder's own tiles, joints and all */
.folders { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
.folder {
  border: 0; background: none; padding: 0; text-align: left; cursor: pointer; color: inherit;
}
.folder-cover {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 3px;
  background: var(--grout);
  aspect-ratio: 1;
  transition: background-color 0.15s;
}
.folder-cover span { background: var(--line) center / cover; }
.folder:hover .folder-cover { background: var(--glaze); }
.folder-name { display: flex; align-items: center; gap: 6px; margin-top: 7px; font-weight: 650; font-size: 14px; line-height: 1.25; }
.folder-meta { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.badge {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.01em;
  padding: 1px 5px; border-radius: 3px;
  background: var(--porcelain); border: 1px solid var(--line); color: var(--muted);
}
.all-link { margin: 14px 0 0; }

/* The tiles themselves are laid like a tiled floor: the gaps are the grout joints. */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  background: var(--grout);
  border: 3px solid var(--grout);
}
.tile-cell {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  cursor: pointer;
  background: var(--line);
  overflow: hidden;
  text-align: left;
  color: #fff;
}
.tile-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-cell .cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 18px 6px 5px;
  background: linear-gradient(transparent, rgba(10, 14, 16, 0.72));
  font-size: 11.5px; line-height: 1.2; font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.tile-cell .cap small { display: block; font-weight: 400; opacity: 0.85; font-size: 10.5px; font-variant-numeric: tabular-nums; }
.tile-cell[aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 3px var(--glaze), inset 0 0 0 5px rgba(255, 255, 255, 0.85);
}
.empty-note { font-size: 14px; color: var(--muted); padding: 18px 0; }

/* the picked tile, pinned at the bottom of the panel */
.picked {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 20px 14px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.picked-swatch { width: 48px; height: 48px; background: var(--line) center / cover; border: 2px solid var(--grout); }
.picked-swatch.none {
  background: repeating-linear-gradient(45deg, transparent 0 5px, var(--line) 5px 6px);
}
.picked-surface { font-size: 12px; color: var(--muted); }
.tile-name { font-weight: 700; font-size: 15.5px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-meta { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picked-side { text-align: right; display: grid; gap: 4px; justify-items: end; }
.tile-price { font-weight: 700; font-size: 15.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* folds */
.fold { border-top: 1px solid var(--line); padding-top: 14px; }
.fold > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after {
  content: ""; width: 8px; height: 8px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); margin-right: 4px; transition: transform 0.15s;
}
.fold[open] > summary::after { transform: rotate(225deg); }

.field { margin: 14px 0; }
.label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
.label output { color: var(--ink); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--glaze); margin: 0; }
.seg { display: inline-flex; gap: 6px; }
.seg.wrap { flex-wrap: wrap; }
.seg button {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: var(--r-s);
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
}
.seg button.on { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.quick { display: flex; gap: 6px; margin-top: 8px; }
.quick button {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: var(--r-s);
  padding: 3px 9px;
  font-size: 12px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.18);
  cursor: pointer;
  padding: 0;
}
.swatches button.on { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--glaze); }
.more { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 16px; }
.more summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.hint { font-size: 13px; color: var(--muted); margin: 8px 0 0; }

.toast {
  position: fixed;
  left: 50%; top: calc(var(--header-h) + 14px);
  transform: translateX(-50%);
  max-width: min(92vw, 34rem);
  padding: 10px 14px;
  border-radius: var(--r-s);
  background: var(--ink);
  color: var(--panel);
  font-size: 14px;
  z-index: 20;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

/* ---------------------------------------------------------------- walls */
.quad[hidden] { display: none; }
.quad { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.quad polygon { fill: rgba(255, 166, 64, 0.12); stroke: #ffa640; stroke-width: 1.5; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; }
.quad polygon.sel { fill: rgba(255, 166, 64, 0.2); stroke-width: 2.5; stroke-dasharray: none; }
.quad-handles { position: absolute; inset: 0; pointer-events: none; }
.qh {
  position: absolute;
  width: 20px; height: 20px;
  margin: -10px 0 0 -10px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #f08a24;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  transform: scale(var(--inv, 1));
}
.qh:not(.sel) { width: 14px; height: 14px; margin: -7px 0 0 -7px; border-width: 2px; opacity: 0.85; }
.frame.quading { cursor: crosshair; }
.frame.quading.has-quad { cursor: move; }
/* while drawing walls the zoom buttons must not block the top corners of the photo
   (wheel / pinch zoom still work) */
.frame.quading .zoom-ctl { opacity: 0.3; pointer-events: none; }

/* ---------------------------------------------------------------- tablets and phones */
@media (max-width: 1100px) {
  :root { --panel-w: 360px; }
  .dropzone { grid-template-columns: 1fr; align-content: start; }
  .showcase { order: -1; min-height: 0; height: 190px; margin: -40px calc(-1 * clamp(24px, 5vw, 64px)) -8px; overflow: hidden; }
  .showcase-floor { left: -10%; right: -10%; top: 30px; bottom: -120%; transform: rotateX(58deg) rotateZ(-10deg); grid-template-columns: repeat(6, 1fr); }
  .showcase::after { background: linear-gradient(180deg, var(--stage) 0%, transparent 30%, transparent 55%, var(--stage) 100%); }
}
@media (max-width: 900px) {
  :root { --header-h: 54px; }
  .layout { display: block; height: auto; }
  .topbar { padding: 0 14px; position: sticky; top: 0; }
  .topbar .ghost { padding: 7px 10px; font-size: 13px; }
  .wordmark { font-size: 22px; }
  .mark { width: 30px; height: 30px; }
  .dropzone { padding: 36px 20px 44px; min-height: calc(100dvh - var(--header-h)); gap: 8px; }
  .showcase { margin: -36px -20px 0; height: 170px; }
  /* the photo stays in view while the customer scrolls through the catalogue */
  .stage.working { position: sticky; top: var(--header-h); z-index: 4; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18); }
  .viewer > .frame, .frame {
    width: min(calc(100% - 20px), calc(36dvh * var(--ar)));
    margin: 10px auto 0;
  }
  .stage-bar, .mask-bar { padding: 8px 10px 10px; gap: 8px; }
  .status-wrap { display: none; }
  .mask-bar .status { font-size: 12.5px; }
  .stage-actions { width: 100%; flex-wrap: nowrap; }
  .stage-actions button { flex: 1; padding: 8px 6px; font-size: 12.5px; white-space: normal; line-height: 1.15; }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
  .panel-scroll { overflow: visible; padding: 14px 14px 24px; }
  .picked { position: sticky; bottom: 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); z-index: 3; }
  .tile-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .folders { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .tile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .folders { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar #newPhotoBtn { font-size: 12.5px; }
}
