/* The shipped app (spec v2 · 4 Modes): Draw | Depth | Model | Export over one
   shared artwork, chrome swapping per mode. */
.shape-app {
  --bg: #141414;
  --panel: #1a1a1a;
  --border: #2c2c2c;
  --text: #dcdcdc;
  --muted: #8a8a8a;
  --accent: #4a9eff;
  --accent-border: #7abaff;
  font: 14px/1.4 system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
}
.shape-stage { min-height: 100vh; display: flex; }

/* ---- shell ---- */
.shape-shell { flex: 1; min-height: 100vh; display: flex; flex-direction: column; }

.shape-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.shape-wordmark { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: 0.08em; }
.shape-tabs { display: flex; gap: 4px; margin-left: 8px; }
.shape-tab {
  padding: 7px 16px;
  border: 1px solid transparent;
  background: none;
  color: var(--muted);
  font: inherit;
  border-radius: 8px;
  cursor: pointer;
}
.shape-tab:hover { color: var(--text); }
.shape-tab.active { background: #2c2c2c; color: #fff; border-color: var(--border); }
.shape-thumb { margin-left: auto; }

.shape-workspace { flex: 1; min-height: 0; display: flex; }

.shape-footer {
  border-top: 1px solid var(--border);
  padding: 8px 16px;
  background: var(--panel);
  display: flex;
  align-items: center;
  gap: 16px;
}
.shape-status {
  font: 12px/1.4 monospace;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- shared grid ---- */
.shape-grid-box {
  position: relative;
  background: repeating-conic-gradient(#2a2a2a 0% 25%, #222 0% 50%) 0 0 / 16px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  line-height: 0;
  cursor: crosshair;
}
.shape-grid-box canvas { display: block; image-rendering: pixelated; touch-action: none; }
.shape-mini { border-radius: 4px; }
.shape-mini canvas { border-radius: 4px; }

/* ---- shared buttons / controls ---- */
.shape-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: #242424;
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
}
.shape-btn:hover { background: #2c2c2c; }
.shape-btn.active { background: var(--accent); border-color: var(--accent-border); color: #fff; }
.shape-row { display: flex; gap: 8px; flex-wrap: wrap; }
.shape-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.shape-stats { font: 11px/1.5 monospace; color: #9be; }
.shape-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  background: #181818;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-y: auto;
}
.shape-preview { position: relative; background: #0d0d0d; border: 1px solid #333; border-radius: 8px; overflow: hidden; min-height: 0; }
.shape-preview canvas { display: block; }
.shape-preview-tall { height: 320px; }

/* ---- mode: draw (Draw View Redesign · Variant A Studio) ---- */
.shape-mode { flex: 1; min-height: 0; }
.shape-draw {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 16px;
  min-height: 0;
}
.shape-draw-toolbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 14px;
  background: #181818;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.shape-toolgroup { display: flex; flex-direction: column; gap: 5px; }
.shape-group-label {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.shape-toolrow { display: flex; gap: 6px; }
.shape-tool {
  width: 40px;
  height: 40px;
  font-size: 17px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #242424;
  color: var(--text);
  border-radius: 8px;
}
.shape-tool:hover { background: #2c2c2c; }
.shape-tool.active { background: var(--accent); border-color: var(--accent-border); color: #fff; }
.shape-tool.mirror-on { background: #2c3a52; border-color: #8fc2ff; color: #8fc2ff; }

.shape-draw-body { flex: 1; display: flex; gap: 16px; min-height: 0; }
.shape-panel {
  background: #181818;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}
.shape-panel-title {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.shape-shapes { width: 340px; flex: none; align-self: flex-start; }
.shape-stamp-panel { display: flex; flex-direction: column; gap: 10px; }
.shape-stamp-row { display: flex; gap: 8px; }
.shape-stamp {
  width: 44px;
  height: 44px;
  font-size: 22px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #242424;
  color: var(--text);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.shape-stamp-glyph { display: flex; }
.shape-stamp-glyph svg { width: 24px; height: 24px; display: block; }
.shape-stamp:hover { background: #2c2c2c; }
.shape-stamp.active { background: var(--accent); border-color: var(--accent-border); color: #fff; }
.shape-hint { color: #666; font-size: 11px; line-height: 1.5; }

.shape-draw-center {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 4px;
  overflow: auto;
  min-width: 0;
}
.shape-palette-dock { width: 190px; flex: none; align-self: flex-start; }
.shape-palette { display: grid; grid-template-columns: repeat(4, 26px); gap: 5px; justify-content: center; align-content: start; }
.shape-swatch {
  width: 26px;
  height: 26px;
  border: 2px solid #555;
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
}
.shape-swatch.active { border-color: #fff; }

/* ---- mode: depth ---- */
.shape-depth {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 16px;
  min-height: 0;
}
.shape-depth-buttons { display: flex; flex-direction: column; gap: 5px; }
.shape-depth-row { display: flex; gap: 6px; }
.shape-depth-btn {
  width: 40px;
  height: 40px;
  font-size: 15px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #242424;
  color: var(--text);
  border-radius: 8px;
}
.shape-depth-btn:hover { background: #2c2c2c; }
.shape-depth-btn.active { background: var(--accent); border-color: var(--accent-border); color: #fff; }
.shape-preview-corner {
  position: absolute;
  left: 16px;
  bottom: 16px;
  width: 260px;
  height: 220px;
  z-index: 2;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}

/* ---- clear button ---- */
.shape-clear { margin-left: auto; }
.shape-clear:hover { background: #4a2c2c; border-color: #8a3a3a; }

/* ---- mode: model ---- */
.shape-model {
  display: grid;
  grid-template-columns: 1fr 300px;
  grid-template-rows: minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
}
.shape-model .shape-preview-full { min-height: 0; }
.shape-align { display: inline-flex; gap: 4px; }
.shape-align-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: #242424;
  color: #ccc;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  text-transform: capitalize;
}
.shape-align-btn.active { background: var(--accent); border-color: var(--accent-border); color: #fff; }

/* ---- mode: export ---- */
.shape-export { flex: 1; display: flex; justify-content: center; align-items: flex-start; padding: 40px 16px; }
.shape-export-card { width: 520px; max-width: 100%; }
.shape-export { display: flex; flex-direction: column; gap: 16px; }
.shape-export-head strong { font-size: 16px; }
.shape-export-head span { color: var(--muted); font-size: 13px; margin-left: 10px; }
.shape-export-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.shape-export-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--border);
  background: #1d1d1d;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font: inherit;
}
.shape-export-item:hover { border-color: #6a9eff; }
.shape-export-item.busy { opacity: 0.6; }
.shape-export-item .ext { font-size: 20px; font-weight: 700; }
.shape-export-item .file { font: 12px monospace; color: #9be; }
.shape-export-item .note { color: var(--muted); font-size: 11px; }
.shape-export-status { margin-top: 4px; }
/* ---- v3: gallery (root) ---- */
.gallery-app {
  --bg: #141414;
  --panel: #1a1a1a;
  --border: #2c2c2c;
  --text: #dcdcdc;
  --muted: #8a8a8a;
  --accent: #4a9eff;
  --accent-border: #7abaff;
  font: 14px/1.4 system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}
.gallery-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.gallery-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.gallery-actions .shape-btn, .gallery-hero .shape-btn, .shape-modal .shape-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: #242424;
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  display: inline-block;
}
.gallery-new, .gallery-guest { display: inline-flex; gap: 8px; align-items: center; margin: 0; }
.gallery-size { padding: 6px 8px; cursor: pointer; }
.gallery-hero .gallery-guest + .shape-btn { margin-left: 8px; }
.gallery-main { max-width: 1200px; margin: 0 auto; padding: 32px 16px; }
.gallery-heading { font-size: 18px; margin: 0 0 16px; }
/* v4: the card grid — each card's preview fills it edge-to-edge at 4:3, with
   name / updated time on a bottom scrim strip and always-visible ops. */
.gallery-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.gallery-card {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #1a1a1a;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.gallery-card-open {
  position: absolute;
  inset: 0;
  display: block;
  text-decoration: none;
  color: inherit;
}
.gallery-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #151515;
}
.gallery-card-strip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 22px 10px 8px;
  /* reserve room for the always-visible ops overlaying the strip's right end */
  padding-right: 178px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.82));
}
.gallery-card .gallery-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 2px #000;
}
.gallery-name { color: var(--text); font-weight: 600; text-decoration: none; }
.gallery-name:hover { color: var(--accent); }
.gallery-meta { color: var(--muted); font: 11.5px monospace; white-space: nowrap; }
.gallery-ops {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  display: flex;
  gap: 4px;
}
.gallery-op {
  padding: 2px 7px;
  border: 1px solid var(--border);
  background: #242424;
  color: #bbb;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
}
.gallery-op:hover { color: #fff; border-color: var(--accent-border); }
.gallery-op-danger:hover { border-color: #ff7a7a; color: #ffb0b0; }
.gallery-rename-input {
  font: inherit;
  padding: 2px 6px;
  border: 1px solid var(--accent-border);
  background: #101010;
  color: var(--text);
  border-radius: 6px;
}
.gallery-card-strip .gallery-rename-input { flex: 1; min-width: 0; }
.gallery-hero { text-align: center; padding-top: 15vh; }
.gallery-hero h2 { font-size: 28px; letter-spacing: 0.08em; margin-bottom: 8px; }
.gallery-hero p { color: var(--muted); }
.gallery-hero .shape-btn + .shape-btn { margin-left: 8px; }

/* ---- v3: editor chrome ---- */
.shape-wordmark-link { text-decoration: none; color: var(--text); }
.shape-wordmark-link:hover { color: var(--accent); }
.shape-artwork-name {
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shape-saveas { margin-left: auto; }
.shape-save {
  margin-left: auto;
  font: 12px/1.4 monospace;
  color: var(--muted);
  white-space: nowrap;
}
.shape-save.clickable { color: var(--accent); cursor: pointer; text-decoration: underline; }

/* ---- v3: modals ---- */
.shape-modal-shade {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.shape-modal {
  width: 380px;
  max-width: calc(100vw - 32px);
  background: #1d1d1d;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.shape-modal-title { margin: 0; font-size: 16px; }
.shape-modal-text { margin: 0; color: var(--muted); }
.shape-modal-error { color: #ff9a9a; font-size: 13px; min-height: 1em; }
.shape-modal-switch { color: var(--accent); font-size: 13px; cursor: pointer; }
.shape-modal-field { display: flex; flex-direction: column; gap: 4px; }
.shape-modal-label { color: var(--muted); font-size: 12px; }
.shape-modal-input {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: #101010;
  color: var(--text);
  border-radius: 8px;
}
.shape-modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.shape-btn-danger { border-color: #a33 !important; color: #ffb0b0 !important; }
.shape-btn-danger:hover { border-color: #ff7a7a !important; }

/* ============================================================================
   v5 · Touch & mobile (additive layer — desktop ≥1024px is unchanged above)
   ============================================================================ */

/* ---- viewport & shell mechanics ---- */
html { overscroll-behavior: none; }
body { overscroll-behavior: none; }
.shape-app, .shape-stage, .shape-shell { min-height: 100vh; min-height: 100dvh; }
body.shape-scroll-lock { overflow: hidden; }
.shape-btn, .shape-tool, .shape-stamp, .shape-stamp-rotate, .shape-swatch,
.shape-depth-btn, .shape-align-btn, .shape-tab, .gallery-op,
.gallery-actions .shape-btn, .gallery-hero .shape-btn, .shape-modal .shape-btn {
  touch-action: manipulation;
}

/* ---- grid stage: the zoomable surface (Draw & Depth) ---- */
.shape-grid-stage {
  position: relative;
  flex: 1;
  align-self: stretch;
  min-height: 0;
  overflow: hidden;
  touch-action: none;
  background: repeating-conic-gradient(#232323 0% 25%, #1b1b1b 0% 50%) 0 0 / 14px 14px;
}
.shape-grid-stage canvas {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  image-rendering: pixelated;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: crosshair;
}
/* Desktop: the grid box keeps v4's shrink-wrapped, boxed look (the stage sizes
   itself to the grid at fit); mobile fills the middle via flex. */
.shape-grid-stage-desktop { flex: none; align-self: flex-start; width: 0; height: 0; }
.shape-zoom-cluster {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}
.shape-zoom-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(24, 24, 24, 0.92);
  border: 1px solid #333;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}
.shape-zoom-btn:hover { background: rgba(58, 58, 58, 0.92); }
.shape-zoom-btn.active { background: #2c3a52; border-color: #8fc2ff; color: #8fc2ff; }
.shape-grid-stage canvas.shape-grid-pan { cursor: grab; }
.shape-grid-stage canvas.shape-grid-pan:active { cursor: grabbing; }
.shape-zoom-readout {
  background: rgba(24, 24, 24, 0.92);
  border: 1px solid #333;
  border-radius: 8px;
  color: #8fc2ff;
  font: 11px monospace;
  text-align: center;
  padding: 4px 0;
}
.shape-stamp-rotate {
  width: 44px;
  height: 44px;
  font-size: 22px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #242424;
  color: var(--text);
  border-radius: 8px;
}
.shape-stamp-rotate:hover { background: #2c2c2c; }
.shape-depth-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 110px;
  height: 30px;
  background: #1a1a1a;
  border: 1px solid var(--border);
  border-radius: 999px;
}
.shape-depth-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--accent-border);
}

/* ---- bottom mode tab bar (mobile bands) ---- */
.shape-tabbar {
  flex: none;
  display: flex;
  border-top: 1px solid var(--border);
  background: var(--panel);
  padding-bottom: env(safe-area-inset-bottom);
}
.shape-tabbar .shape-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 2px 8px;
  border: none;
  border-radius: 0;
  background: none;
  color: var(--muted);
  font-size: 10px;
}
.shape-tabbar .shape-tab:hover { color: var(--text); }
.shape-tabbar .shape-tab.active { background: none; color: #fff; }
.shape-tabbar .shape-tab.active .shape-tab-ic { color: var(--accent); }
.shape-tab-ic { font-size: 18px; line-height: 1; }

/* ---- phone / tablet bands (<1024): Docked chrome + bottom sheets ---- */
@media (max-width: 1023px) {
  /* In-editor dialogs are bottom sheets: the shade dims the whole shell incl. the
     tab bar, the sheet pins above the safe-area inset and scrolls internally. */
  .shape-modal-shade { align-items: flex-end; }
  .shape-modal {
    width: 100%;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    max-height: calc(100dvh - 88px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .shape-modal-actions { flex-direction: column; }
  .shape-modal-actions .shape-btn { width: 100%; min-height: 44px; justify-content: center; }
  /* Staleness guard: Keep editing primary (accent) on top, Reload below (desktop
     keeps the side-by-side DOM order). */
  .shape-stale-actions .shape-btn:first-child { order: 2; }
  .shape-stale-actions .shape-btn:last-child {
    order: 1;
    background: var(--accent);
    border-color: var(--accent-border);
    color: #fff;
  }

  /* ---- Docked shell ---- */
  .shape-topbar .shape-tabs { display: none; }
  .shape-topbar { padding: 8px 10px; gap: 10px; }

  /* ---- Draw / Depth Docked surfaces ---- */
  .shape-draw, .shape-depth { gap: 0; padding: 0; }
  .shape-tool-strip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
    background: #171717;
    flex: none;
  }
  .shape-tool-strip .shape-toolgroup { flex-direction: row; align-items: center; gap: 8px; }
  .shape-tool-strip .shape-group-label { display: inline; margin-right: 2px; }
  .shape-tool-strip .shape-toolrow { gap: 6px; }
  .shape-strip-sep { width: 1px; height: 24px; background: var(--border); flex: none; }
  .shape-palette-strip {
    flex: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    background: #181818;
    overflow-x: auto;
  }
  .shape-palette-strip .shape-strip-label {
    color: var(--muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    white-space: nowrap;
  }
  .shape-palette-strip .shape-palette { display: flex; flex-wrap: nowrap; }
  .shape-draw-center { padding: 10px; overflow: hidden; }

  /* ---- Depth mobile ---- */
  .shape-depth-buttons { flex-direction: row; align-items: center; gap: 10px; }
  .shape-preview-corner-mobile {
    position: absolute;
    left: 10px;
    bottom: 10px;
    width: 130px;
    height: 104px;
    z-index: 3;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  }

  /* ---- Model mobile: full-bleed viewport + floating pill ---- */
  .shape-model-mobile { position: relative; display: flex; padding: 0; }
  .shape-model-mobile .shape-preview-full { flex: 1; border: none; border-radius: 0; }
  .shape-model-pill {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
  }
  .shape-model-pill .shape-align {
    background: rgba(20, 20, 20, 0.9);
    border: 1px solid #333;
    border-radius: 999px;
    padding: 4px;
  }
  .shape-model-pill .shape-align-btn {
    padding: 6px 12px;
    border: none;
    background: none;
    border-radius: 999px;
    font-size: 13px;
  }
  .shape-model-toggles { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
  .shape-model-toggles .shape-row { flex-wrap: nowrap; justify-content: flex-end; }
  .shape-model-toggles .shape-btn {
    padding: 6px 10px;
    font-size: 12px;
    background: rgba(24, 24, 24, 0.92);
    border-color: #333;
  }
  .shape-model-toggles .shape-stats {
    max-width: 210px;
    text-align: right;
    background: rgba(24, 24, 24, 0.85);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 4px 8px;
  }

  /* ---- Export mobile: full-width vertical stack ---- */
  .shape-export { padding: 16px 12px; align-items: center; }
  .shape-export-grid { grid-template-columns: 1fr; width: 100%; }
  .shape-export-item { flex-direction: row; align-items: center; gap: 12px; padding: 14px; }
  .shape-export-item .note { margin-left: auto; }

  /* ---- Gallery mobile ---- */
  .gallery-main { padding: 20px 12px; }
  .gallery-topbar { flex-wrap: wrap; gap: 8px; }
  .gallery-actions { flex-wrap: wrap; }
  .gallery-list { grid-template-columns: repeat(2, 1fr); }
}

/* ---- phone band (<560) ---- */
@media (max-width: 559px) {
  .shape-artwork-name { max-width: 150px; }
  .shape-saveas { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 6px 10px; }
  .shape-thumb { display: none; } /* the avatar/mini-thumb is hidden on phones */
  .shape-tabbar .shape-tab-label { display: none; }
  .shape-tabbar .shape-tab { min-height: 44px; }
  .shape-tool-strip .shape-group-label { display: none; } /* icon-only strip on phones */
  .gallery-list { grid-template-columns: 1fr; }
}

/* ---- tablet band (560–1023): phone-like but wider, labels visible ---- */
@media (min-width: 560px) and (max-width: 1023px) {
  .shape-preview-corner-mobile { width: 170px; height: 136px; }
  .shape-palette-strip { justify-content: flex-start; }
}
