@font-face { font-family: "Source Han Sans SC"; src: url("./fonts/source-han-sans-sc-ui-400.woff2") format("woff2"); font-style: normal; font-weight: 400; font-display: swap; }
@font-face { font-family: "Source Han Sans SC"; src: url("./fonts/source-han-sans-sc-ui-500.woff2") format("woff2"); font-style: normal; font-weight: 500; font-display: swap; }
@font-face { font-family: "Source Han Sans SC"; src: url("./fonts/source-han-sans-sc-ui-700.woff2") format("woff2"); font-style: normal; font-weight: 600 700; font-display: swap; }
/* Hallmark | scope: app polish | theme: locked soft clay | signature: a spacious sticker canvas */
/* Critique: clipped upload and collage regions; crowded mobile steps; overly small effect labels. */
/* Hallmark · dismissed 29 · Glass surfaces only appear in the sticker collection dialogs explicitly requested by the user. */
/* Hallmark · answered F7 · The crop and style groups now have no card shell; shared recipes apply to controls with matching roles, while the canvas and dark folders remain distinct. */
/* Hallmark · answered F24 · Sticker collection dialogs retain a thin boundary for translucent content and a shadow to separate the temporary modal from the editor. */
/* Hallmark · waive 24b · locked DESIGN.md spacing and compact sticker controls · Preserve established editor geometry while correcting mobile clipping. */
:root {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --motion-panel: 180ms;
  --motion-list: 150ms;
  --effect-row-divider: rgb(209 196 186 / 42%);
  --motion-result: 150ms;
  --motion-flight: 260ms;
  --motion-count: 180ms;
  --motion-release: 120ms;
  --motion-adjustment: 180ms;
  --ink-swatch-1: #fff;
  --ink-swatch-2: #202020;
  --ink-swatch-3: #ff87ae;
  --ink-swatch-4: #62bfe8;
  --ink-swatch-5: #ffd36e;
  --ink-swatch-6: #ae8be8;
  --ink-swatch-7: #ff89b6;
  --ink-swatch-8: #ffaf51;
  --ink-swatch-9: #7bd9ff;
  --ink-swatch-10: #ae85ff;

  color-scheme: light;
  font-synthesis: none;
  --paper: #f2eee9;
  --sheet: #fcfaf7;
  --surface: #fcfaf7;
  --canvas: #f7f4ef;
  --ink: #352f2b;
  --muted: #706760;
  --quiet: #766a62;
  --line: #e4dbd3;
  --line-strong: #d1c4ba;
  --accent: #875b4c;
  --accent-hover: #754a3d;
  --accent-pressed: #684035;
  --accent-soft: #f1e6df;
  --brand-mark: #bd7358;
  --brand-soft: #f5e5df;
  --brand-ink: #5e392e;
  --success: #4f7667;
  --danger: #a85348;
  --disabled: #706760;
  --disabled-bg: #efe9e3;
  --font-sans: "Inter", "Source Han Sans SC", "Noto Sans SC", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  --radius-sheet: 16px;
  --radius-panel: 12px;
  --radius-control: 8px;
  --gap: 14px;
  --focus-ring: 0 0 0 3px rgb(135 91 76 / 24%);
  --checkboard: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Crect width='20' height='20' fill='%23fbf9f6'/%3E%3Crect width='10' height='10' fill='%23ece5de'/%3E%3Crect x='10' y='10' width='10' height='10' fill='%23ece5de'/%3E%3C/svg%3E");
  /* Supporting interface tones; user artwork keeps its own palette. */
  --checker-light: #fbf9f6;
  --on-accent: #fcfaf7;
  --hint-surface: rgb(53 47 43 / 90%);
  --switch-track: #e8e1da;
  --modal-shadow: rgb(53 47 43 / 16%);
  --selection-shadow: rgb(53 47 43 / 12%);
  --folder-shadow: rgb(53 47 43 / 7%);
  --folder-dashed: #c8ad9e;
  --danger-strong: #a4483e;
  --dialog-highlight: rgb(255 255 255 / 72%);
  --glass-surface: rgb(252 250 247 / 88%);
  --dialog-shade: rgb(53 47 43 / 24%);
  --dialog-blur-shade: rgb(53 47 43 / 34%);
  --dialog-solid: rgb(252 250 247 / 94%);
  --create-dialog-shade: rgb(53 47 43 / 30%);
  --glass-border: rgb(228 219 211 / 82%);
  --selection-border: rgb(228 219 211 / 75%);
  --selection-surface: rgb(252 250 247 / 90%);
  --sticker-surface: rgb(255 255 255 / 62%);
  --selected-ring: rgb(135 91 76 / 12%);
  --toast-border: #514640;
  --toast-action-border: rgb(255 255 255 / 45%);
  --preview-shade: rgb(53 47 43 / 48%);
  --folder-surface: #665047;
  --folder-secondary: #e4d5cb;
  --folder-count: #81675b;

}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html, body { width: 100%; height: 100%; min-width: 320px; min-height: 100%; margin: 0; overflow-x: clip; overflow-y: hidden; overscroll-behavior: none; }
body, button, input, select, textarea, output { font-family: var(--font-sans); }
body { color: var(--ink); background: var(--paper); font-size: 14px; line-height: 1.5; }
button, input, select, textarea { color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 1; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: var(--focus-ring); }
input[type="range"] { accent-color: var(--accent); }
.hidden { display: none !important; }

.app-shell {
  width: min(100%, 1600px);
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  margin: 0 auto;
  padding: 0 12px 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper);
}
.topbar {
  flex: 0 0 60px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; color: var(--ink); text-decoration: none; }
.brand strong { display: block; font-size: 15px; font-weight: 600; line-height: 1.2; letter-spacing: -.015em; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.2; }
.topbar-meta { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 13px; }
.local-badge { min-height: 32px; display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: var(--sheet); }
.local-badge i, .live-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--success); }
.topbar-note { color: var(--muted); }

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(360px, .78fr) minmax(0, 1.42fr);
  gap: 20px;
  margin: 0 8px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sheet);
  background: var(--sheet);
}
.workspace.style-mode, .workspace.light-mode { grid-template-columns: minmax(360px, .72fr) minmax(0, 1.5fr); }
.editor-column, .control-column { min-width: 0; min-height: 0; }
.editor-column { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; }
.editor-heading { flex: none; min-height: 54px; display: flex; align-items: center; justify-content: flex-start; gap: 16px; margin: 0 0 12px; }
.editor-heading h1, .shelf-heading h1 { margin: 0; color: var(--ink); font-size: 24px; font-weight: 600; line-height: 1.25; letter-spacing: -.025em; }
.subhead, .shelf-heading > p:last-child { margin: 2px 0 0; color: var(--muted); font-size: 13px; line-height: 1.35; white-space: nowrap; }

.stage-card, .control-card, .next-card, .collage-controls, .box-toolbar, .shelf-item, .shelf-empty, .collection-workspace {
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
}
.stage-card { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.stage-toolbar, .stage-footer { flex: none; min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 12px; }
.stage-toolbar { border-bottom: 1px solid var(--line); }
.stage-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.stage-label { min-width: 0; display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; white-space: nowrap; }
.toolbar-actions, .canvas-actions, .zoom-tools { display: flex; align-items: center; gap: 4px; }
.text-button, .reset-link, .ghost-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 6px 9px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; }
.text-button:hover, .reset-link:hover, .ghost-button:hover { color: var(--accent); background: var(--accent-soft); }
.toolbar-actions .text-button[aria-pressed="true"] { border: 1px solid var(--line-strong); color: var(--ink); background: var(--accent-soft); }
.toolbar-actions .text-button[aria-pressed="false"] { color: var(--ink); }
.checker-icon { width: 13px; height: 13px; flex: none; display: inline-block; margin-right: 4px; border: 1px solid var(--line-strong); border-radius: 3px; background-image: var(--checkboard); background-size: 8px 8px; vertical-align: -2px; }
.zoom-tools { margin-left: 4px; color: var(--muted); }
.zoom-tools button { min-width: 32px; min-height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--sheet); color: var(--ink); font-size: 16px; }
.zoom-tools .zoom-reset { min-width: 0; min-height: 28px; padding: 0 3px; border: 0; border-radius: 3px; background: transparent; color: var(--quiet); font-size: 11px; line-height: 1; }
.zoom-tools button:hover { border-color: var(--line-strong); background: var(--paper); }
.zoom-tools .zoom-reset:hover { border-color: transparent; background: transparent; color: var(--accent); text-decoration: underline; }
.zoom-tools output { min-width: 38px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; text-align: center; }
.stage { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; background-color: var(--checker-light); background-image: var(--checkboard); background-size: 20px 20px; }
.stage.solid-bg { background: var(--canvas); background-image: none; }
.stage.dragging { outline: 2px dashed var(--accent); outline-offset: -8px; }
.empty-state { max-width: 380px; padding: 24px 18px; color: var(--ink); text-align: center; }
.upload-art { width: 132px; height: 104px; position: relative; display: grid; place-items: center; margin: 0 auto 10px; }
.upload-icon { width: 70px; height: 70px; display: grid; place-items: center; border: 1px dashed var(--line-strong); border-radius: 18px 18px 18px 6px; color: var(--accent); background: var(--sheet); }
.upload-icon svg { width: 30px; height: 30px; stroke: currentColor; stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.spark { position: absolute; display: block; pointer-events: none; }
.spark-a { width: 12px; height: 12px; top: 13px; left: 12px; background: var(--brand-mark); clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.spark-b { width: 9px; height: 9px; right: 13px; bottom: 10px; border: 2px solid var(--success); border-radius: 50%; }
.empty-state h2 { margin: 0 0 7px; font-size: 20px; font-weight: 600; line-height: 1.35; }
.empty-state p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.upload-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin-top: 18px; }
.primary-button, .next-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border: 1px solid var(--accent); border-radius: var(--radius-control); background: var(--accent); color: var(--on-accent); font-size: 14px; font-weight: 600; }
.primary-button:hover, .next-button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.primary-button:active, .next-button:active { background: var(--accent-pressed); border-color: var(--accent-pressed); }
.primary-button span, .next-button span { color: inherit; }
.secondary-button, .sample-button, .queue-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius-control); background: var(--sheet); color: var(--ink); font-size: 14px; font-weight: 500; }
.secondary-button:hover, .sample-button:hover, .queue-button:hover { border-color: var(--ink); background: var(--paper); }
.primary-button:disabled, .next-button:disabled { border-color: var(--disabled-bg); color: var(--disabled); background: var(--disabled-bg); }
.secondary-button:disabled, .sample-button:disabled, .queue-button:disabled { border-color: var(--line); color: var(--disabled); background: var(--disabled-bg); }
.text-button:disabled, .icon-button:disabled { color: var(--disabled); }
.sample-button, .queue-button { background: transparent; }
.drop-hint { display: block; margin-top: 14px; color: var(--muted); font-size: 13px; }
.canvas-wrap { position: relative; width: 100%; height: 100%; min-width: 0; min-height: 0; display: grid; place-items: center; padding: 12px; transform-origin: center; will-change: transform; }
.canvas-wrap canvas { grid-area: 1 / 1; display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; touch-action: none; }
.canvas-wrap canvas#interactionCanvas { position: absolute; inset: 12px; width: calc(100% - 24px); height: calc(100% - 24px); max-width: calc(100% - 24px); max-height: calc(100% - 24px); touch-action: none; }
.canvas-hint { position: absolute; left: 50%; bottom: 16px; max-width: calc(100% - 24px); padding: 8px 12px; transform: translateX(-50%); border-radius: 7px; color: var(--on-accent); background: var(--hint-surface); font-size: 13px; text-align: center; pointer-events: none; }
.icon-button { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); font-size: 20px; }
.icon-button:hover { border-color: var(--line); color: var(--ink); background: var(--paper); }
.privacy-note { flex: none; display: flex; align-items: center; gap: 8px; margin: 9px 0 0; color: var(--muted); font-size: 13px; }
.privacy-note svg { width: 15px; height: 15px; flex: none; stroke: var(--success); stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.control-column { grid-column: 1; grid-row: 1; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 10px; overflow: hidden; }
.control-panel-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; border-bottom: 1px solid var(--line); }
.control-panel-tabs::before { content: "贴纸编辑步骤"; grid-column: 1 / -1; color: var(--muted); font-size: 11px; line-height: 1.2; }
.control-panel-tab { position: relative; min-width: 0; min-height: 44px; padding: 7px 4px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 14px; font-weight: 500; touch-action: manipulation; }
.control-panel-tab:hover { color: var(--ink); }
.control-panel-tab.active { border-bottom-color: var(--accent); color: var(--ink); font-weight: 600; }
.control-panel { display: none; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; align-content: start; gap: 12px; padding: 0 3px 10px 0; }
.control-panel.active { display: grid; }
.workspace.style-mode .style-category-hint, .workspace.light-mode .style-category-hint { margin: 2px 0 0; padding: 4px 0; }
.workspace.style-mode #filterGrid, .workspace.light-mode #lightGrid { margin-top: 0; }
.control-card { padding: 15px; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.section-title > div { min-width: 0; }
.section-title h2 { margin: 0; color: var(--ink); font-size: 16px; font-weight: 600; line-height: 1.35; }
.section-title p { margin: 3px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.reset-link { margin-left: auto; padding-inline: 7px; color: var(--accent); font-size: 13px; }
.mode-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.mode-tab { position: relative; min-height: 44px; padding: 8px 5px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; }
.mode-tab:hover { color: var(--ink); }
.mode-tab.active { border-bottom-color: var(--accent); color: var(--ink); font-weight: 600; }
.mode-tab svg { width: 15px; height: 15px; margin-right: 4px; vertical-align: -3px; stroke: currentColor; stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.mode-content { padding-top: 12px; }
.helper-row { display: flex; gap: 9px; margin: 2px 0 12px; color: var(--ink); font-size: 13px; line-height: 1.5; }
.helper-icon { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; color: var(--accent); background: var(--sheet); }
.helper-icon svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.helper-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 13px; }
.full-width { width: 100%; }
.shape-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.shape-button { min-width: 0; min-height: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 5px 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--sheet); color: var(--muted); font-size: 11px; white-space: nowrap; }
.shape-button:hover { border-color: var(--line-strong); color: var(--ink); }
.shape-button svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.shape-button img { width: 26px; height: 26px; object-fit: contain; }
.shape-button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.slider-row { min-height: 40px; display: grid; grid-template-columns: minmax(86px, auto) minmax(65px, 1fr) 44px; gap: 9px; align-items: center; margin: 8px 0; }
.slider-row label, .slider-row output { color: var(--muted); font-size: 13px; }
.slider-row output { text-align: right; font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; min-height: 44px; margin: 0; }
input[type="color"] { width: 44px; height: 44px; padding: 5px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--sheet); }
select, input[type="text"], .box-toolbar input:not([type="file"]) { min-width: 0; min-height: 44px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-control); background: var(--sheet); font-size: 14px; }
.tiny-help { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.shape-gesture-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.shape-gesture-actions .tiny-help { margin: 3px 0; }
.lasso-refine { margin: 9px 0 12px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); }
.lasso-refine .switch-row { min-height: 42px; }
.lasso-refine .slider-row { margin: 5px 0; }
.switch-row { position: relative; min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--ink); font-size: 14px; }
.switch-row strong { font-weight: 500; }
.switch-row small { display: block; color: var(--muted); font-size: 13px; }
.switch-row input { position: absolute; z-index: 1; right: 0; width: 48px; height: 32px; margin: 0; opacity: 0; cursor: pointer; }
.switch-row i { width: 38px; height: 22px; position: relative; flex: none; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--switch-track); transition: background-color 140ms ease; }
.switch-row i::after { content: ""; width: 16px; height: 16px; position: absolute; top: 2px; left: 2px; border-radius: 50%; background: var(--on-accent); transition: transform 140ms ease; }
.switch-row input:checked + i { border-color: var(--accent); background: var(--accent); }
.switch-row input:checked + i::after { transform: translateX(16px); }
.switch-row input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.stroke-heading-row { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stroke-heading-row h2 { margin: 0; color: var(--ink); font-size: 16px; font-weight: 600; line-height: 1.35; }
.stroke-toggle { min-height: 44px; position: relative; display: inline-flex; align-items: center; justify-content: flex-end; gap: 9px; padding-right: 48px; color: var(--ink); font-size: 14px; cursor: pointer; touch-action: manipulation; }
.stroke-toggle input { position: absolute; z-index: 1; right: 0; width: 48px; height: 34px; margin: 0; opacity: 0; cursor: pointer; }
.stroke-toggle i { width: 38px; height: 22px; position: absolute; right: 5px; top: 11px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--switch-track); transition: background-color 140ms ease; }
.stroke-toggle i::after { content: ""; width: 16px; height: 16px; position: absolute; top: 2px; left: 2px; border-radius: 50%; background: var(--on-accent); transition: transform 140ms ease; }
.stroke-toggle input:checked + i { border-color: var(--accent); background: var(--accent); }
.stroke-toggle input:checked + i::after { transform: translateX(16px); }
.stroke-toggle input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.stroke-help { margin: 0 0 6px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.smart-cutout { margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line); }
.smart-cutout > p { margin: 0 0 8px; font-size: 14px; font-weight: 500; }
.smart-cutout > p small { display: block; margin-top: 3px; color: var(--muted); font-size: 13px; font-weight: 400; }
.collage-control-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.outline-button, .collage-control-actions button, .box-toolbar button, .smart-cutout button, .move-light-button, .file-label { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 7px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-control); background: var(--sheet); color: var(--ink); font-size: 13px; font-weight: 500; }
.collage-control-actions button:hover, .box-toolbar button:hover, .smart-cutout button:hover, .move-light-button:hover, .file-label:hover { border-color: var(--ink); background: var(--paper); }
.smart-cutout button.active, .move-light-button.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.stroke-controls.disabled { display: none; opacity: .58; }
.stroke-controls.disabled button, .stroke-controls.disabled input { pointer-events: none; }
.stroke-card .color-row, .color-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.swatches, .light-presets { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.swatch, .light-swatch { width: 44px; height: 44px; position: relative; flex: none; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; background: transparent; }
.swatch::before, .light-swatch::before { content: ""; width: 24px; height: 24px; display: block; border: 1px solid var(--modal-shadow); border-radius: 50%; background: var(--swatch); }
.swatch.selected::after, .light-swatch.selected::after { content: ""; position: absolute; inset: 3px; border: 1.5px solid var(--accent); border-radius: 10px; }
.swatch.metallic-silver::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Crect width='8' height='32' fill='%23545e6b'/%3E%3Crect x='8' width='6' height='32' fill='%23c8d0d9'/%3E%3Crect x='14' width='6' height='32' fill='%23ffffff'/%3E%3Crect x='20' width='5' height='32' fill='%23929daa'/%3E%3Crect x='25' width='7' height='32' fill='%23e3e8ed'/%3E%3C/svg%3E"); }
.custom-color { width: 44px; height: 44px; position: relative; flex: none; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--accent); background: var(--sheet); }
.custom-color input { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; opacity: 0; cursor: pointer; }
.custom-color span { font-size: 20px; pointer-events: none; }
.mini-label { color: var(--muted); font-size: 13px; }
.category-rail { display: flex; flex-wrap: nowrap; gap: 6px; margin: 0 0 10px; padding: 1px 1px 5px; overflow-x: auto; scrollbar-width: none; }
.category-rail::-webkit-scrollbar { display: none; }
.category-pill { min-width: max-content; min-height: 44px; flex: 0 0 auto; padding: 6px 11px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; }
.filter-card .category-rail { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin-bottom: 3px; padding: 0; overflow: visible; }
.light-card .category-rail { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin-bottom: 3px; padding: 0; overflow: visible; }
.filter-card .category-pill { min-width: 0; width: 100%; padding: 5px 2px; font-size: 12px; }
.light-card .category-pill { min-width: 0; width: 100%; padding-inline: 6px; }
.style-category-hint { display: none; }
.category-pill:hover { border-color: var(--line-strong); color: var(--ink); }
.category-pill.active { border-color: var(--line-strong); color: var(--accent); background: var(--accent-soft); }
/* Approved selector: B's two-column directory with A's soft-clay selected surface. */
.filter-grid, .light-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; margin-top: 8px; padding: 0; border: 0; background: transparent; }
.filter-grid:empty, .light-grid:empty { display: none; }
.filter-option, .light-option { min-width: 0; min-height: 68px; position: relative; display: grid; grid-template-columns: 10px minmax(0, 1fr) 12px; align-items: center; gap: 10px; padding: 12px 8px; border: 0; border-bottom: 1px solid var(--effect-row-divider); border-radius: 6px 6px 0 0; background: transparent; color: var(--ink); text-align: left; overflow-wrap: anywhere; }
.filter-swatch { width: 10px; height: 10px; display: block; border: 0; border-radius: 50%; background: var(--filter-color); }
.filter-name-wrap, .light-name-wrap { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.filter-name-zh, .light-name-zh { max-width: 100%; color: inherit; font-size: 14px; font-weight: 500; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
.filter-name-en, .light-name-en { max-width: 100%; color: var(--muted); font-family: var(--font-sans); font-size: 12px; font-weight: 400; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
.filter-option::before { display: none; }
.light-option::before { content: ""; position: static; width: 10px; height: 10px; border: 0; border-radius: 50%; background: var(--accent); }
.filter-option:hover, .light-option:hover { background: var(--paper); border-bottom-color: var(--effect-row-divider); }
.filter-option.active, .light-option.active, .filter-option.active:hover, .light-option.active:hover { color: var(--accent); background: var(--accent-soft); border-bottom-color: var(--effect-row-divider); }
.filter-option.active .filter-swatch { outline: none; box-shadow: none; }
.filter-option.active::after, .light-option.active::after { content: "✓"; grid-column: 3; grid-row: 1; color: var(--accent); font-size: 13px; line-height: 1; }
.adjustment-panel { margin-top: 8px; border-top: 1px solid var(--line); border-radius: 6px; }
.adjustment-panel > summary { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer; list-style: none; }
.adjustment-panel > summary::-webkit-details-marker { display: none; }
.adjustment-panel > summary::after { content: "+"; color: var(--accent); font-size: 18px; line-height: 1; }
.adjustment-panel[open] > summary::after { content: "−"; }
.adjustment-panel .style-options, .adjustment-panel .light-options { margin-top: 0; padding-top: 0; border-top: 0; }
.style-options, .light-options { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.style-action-row { display: flex; justify-content: space-between; gap: 8px; }
.style-extra-row, .gradient-stops { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); color: var(--ink); font-size: 13px; }
.style-extra-row > label, .gradient-stops > label, .gradient-stops > span { color: var(--muted); font-size: 13px; }
.style-extra-row input[type="color"], .gradient-stops input[type="color"] { width: 38px; height: 38px; }
.param-slider { flex: 1; display: flex; align-items: center; gap: 8px; }
.param-slider input { min-width: 0; flex: 1; }
.param-slider output { min-width: 34px; color: var(--muted); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.gradient-stops { justify-content: flex-start; flex-wrap: wrap; }
.gradient-stops > label, .gradient-stops > span { min-width: 88px; }
.gradient-stops button { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 8px; background: var(--sheet); color: var(--ink); font-size: 18px; }
.next-card { padding: 18px; }
.next-top { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.next-icon { width: 28px; height: 28px; display: grid; place-items: center; color: var(--accent); }
.next-icon svg { width: 24px; height: 24px; stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.coming-label { color: var(--muted); font-size: 13px; }
.next-card h3 { margin: 11px 0 6px; font-size: 18px; font-weight: 600; }
.next-card > p { margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.next-button, .queue-button { width: 100%; margin-top: 7px; }
.phase-note { display: block; margin-top: 10px; color: var(--muted); font-size: 13px; }

.bottom-nav { flex: none; min-height: 64px; display: flex; align-items: center; justify-content: center; gap: 16px; margin: 0 8px; padding: 5px 12px env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: var(--paper); }
.nav-item { min-width: 88px; min-height: 48px; position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px 12px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); touch-action: manipulation; }
.nav-item:hover { color: var(--ink); background: var(--accent-soft); }
.nav-item > span { width: 20px; height: 20px; display: grid; place-items: center; }
.nav-item svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.nav-item small { font-size: 12px; line-height: 1.2; }
.nav-item.active { color: var(--accent); background: var(--accent-soft); }
.nav-count { position: absolute; top: 1px; right: 12px; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 4px; border-radius: 999px; color: var(--brand-ink); background: var(--brand-soft); font-size: 11px; font-variant-numeric: tabular-nums; }

.shelf-view { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; margin: 0 8px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius-sheet); background: var(--sheet); scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.shelf-view[data-view="waiting"] { display: flex; flex-direction: column; }
.shelf-view[data-view="waiting"] #shelfEmpty { flex: 1; min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.shelf-view[data-view="collage"] { display: flex; flex-direction: column; }
.shelf-view[data-view="collage"] #collageWorkspace { min-height: 0; flex: 1; display: flex; flex-direction: column; }
.shelf-view[data-view="collage"] .collage-layout { min-height: 0; flex: 1; }
.shelf-view[data-view="box"] #boxWorkspace { min-height: 0; flex: 1; display: flex; flex-direction: column; }
.shelf-view[data-view="box"] #boxFolders { min-height: 120px; flex: 1; align-content: start; }
.shelf-view[data-view="box"] #boxEmpty { min-height: 200px; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.shelf-heading { margin: 0 0 16px; }
.shelf-heading h1 { display: flex; align-items: center; gap: 9px; }
#waitingCount { min-width: 25px; height: 25px; display: inline-grid; place-items: center; padding: 0 6px; border-radius: 999px; color: var(--ink); background: var(--paper); font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.shelf-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.shelf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.shelf-item { min-width: 0; display: flex; flex-direction: column; gap: 7px; padding: 10px; transition: border-color 140ms ease, transform 140ms ease; }
@media (hover: hover) and (pointer: fine) { .shelf-item:hover { border-color: var(--line-strong); transform: translateY(-1px); } }
.shelf-item:active { transform: scale(.99); }
.shelf-item img { width: 100%; aspect-ratio: 1; display: block; object-fit: contain; border-radius: 8px; background-color: var(--checker-light); background-image: var(--checkboard); background-size: 16px 16px; cursor: zoom-in; }
.shelf-item button { min-height: 40px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--sheet); color: var(--ink); font-size: 13px; }
.shelf-item button:first-of-type { border-color: var(--accent); color: var(--accent); }
.shelf-item button:hover { background: var(--paper); }
.shelf-empty { margin-top: 12px; padding: 28px 18px; text-align: center; }
.shelf-empty > span { width: 48px; height: 48px; display: grid; place-items: center; margin: 0 auto 10px; border: 1px solid var(--line-strong); border-radius: 16px 16px 16px 6px; color: var(--accent); background: var(--sheet); }
.shelf-empty > span svg { width: 25px; height: 25px; stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.shelf-empty h2 { margin: 0 0 5px; font-size: 18px; font-weight: 600; }
.shelf-empty p { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.collection-workspace { margin-top: 16px; padding: 14px; }
.collage-layout { display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); align-items: start; gap: 14px; }
.collage-controls { max-height: 66vh; display: flex; flex-direction: column; gap: 10px; padding: 14px; overflow: auto; }
.collage-controls > label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
.collage-controls select { width: 100%; }
.collage-controls input[type="color"] { width: 44px; }
.collage-controls input[type="range"] { flex: 1; }
.collage-preview-wrap { min-height: 300px; max-height: 70vh; display: grid; place-items: center; padding: 12px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--canvas); }
.collage-preview-wrap canvas { display: block; max-width: min(100%, 640px); max-height: 66vh; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; background-color: var(--checker-light); background-image: var(--checkboard); background-size: 18px 18px; }
.background-preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 7px; }
.background-preset { min-width: 0; min-height: 72px; display: flex; flex-direction: column; align-items: stretch; gap: 5px; padding: 5px; border: 1px solid var(--line); border-radius: 8px; background: var(--sheet); color: var(--ink); font-size: 12px; text-align: center; }
.background-preset img { width: 100%; height: 43px; object-fit: cover; border-radius: 4px; }
.background-preset span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.background-preset.active { outline: 2px solid var(--accent); outline-offset: 1px; }
.background-transparent-swatch { width: 100%; min-height: 43px; display: block; border-radius: 4px; background-color: var(--checker-light); background-image: var(--checkboard); background-size: 14px 14px; }
.collage-assets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.collage-asset { width: 74px; min-height: 88px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 5px; border: 1px solid var(--line); border-radius: 8px; background: var(--sheet); color: var(--muted); font-size: 12px; }
.collage-asset img { width: 100%; height: 62px; object-fit: contain; border-radius: 4px; background-color: var(--checker-light); background-image: var(--checkboard); background-size: 12px 12px; }
.box-toolbar { display: flex; align-items: end; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; padding: 12px; }
.box-toolbar input[type="file"] { display: none; }
.box-toolbar #boxLimit { color: var(--muted); font-size: 13px; }
.box-toolbar > p { margin: 0 auto 0 0; color: var(--muted); font-size: 13px; }
.box-toolbar-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.box-folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.box-folder-entry { min-width: 0; min-height: 136px; position: relative; display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--sheet); color: var(--ink); text-align: left; transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease; }
.box-folder-entry::before { content: ""; position: absolute; top: -1px; left: 18px; width: 27px; height: 8px; border: 1px solid var(--line); border-bottom: 0; border-radius: 6px 6px 0 0; background: var(--sheet); transform: translateY(-5px); }
@media (hover: hover) and (pointer: fine) { .box-folder-entry:hover { border-color: var(--line-strong); box-shadow: 0 8px 20px var(--folder-shadow); transform: translateY(-2px); } }
.box-folder-add { grid-template-columns: 1fr; justify-items: center; align-content: center; gap: 8px; border-style: dashed; border-color: var(--folder-dashed); color: var(--accent); background: var(--sheet); text-align: center; }
.box-folder-add::before { display: none; }
@media (hover: hover) and (pointer: fine) { .box-folder-add:hover { border-color: var(--accent); background: var(--accent-soft); box-shadow: none; } }
.box-folder-plus { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--accent); background: var(--paper); font-size: 22px; line-height: 1; }
.box-folder-add .box-folder-copy { align-items: center; }
.box-folder-add .box-folder-copy small { display: none; }
.folder-icon { width: 44px; height: 38px; display: grid; place-items: center; border-radius: 10px; color: var(--accent); background: var(--accent-soft); }
.folder-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.box-folder-copy { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.box-folder-copy strong { font-size: 15px; font-weight: 600; }
.box-folder-copy small { color: var(--muted); font-size: 12px; }
.box-folder-count { min-width: 30px; height: 27px; display: grid; place-items: center; padding: 0 8px; border-radius: 999px; color: var(--accent); background: var(--accent-soft); font-size: 12px; font-variant-numeric: tabular-nums; }
.box-dialog-actions { display: flex; gap: 6px; }
.box-dialog-actions button, .box-detail-actions button, .box-selection-bar button { min-height: 40px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--sheet); font-size: 13px; }
.box-dialog-actions button:hover, .box-detail-actions button:hover, .box-selection-bar button:hover { border-color: var(--line-strong); background: var(--paper); }
.danger-button { color: var(--danger-strong) !important; }
.sticker-box-dialog { width: min(800px, calc(100% - 28px)); max-width: none; max-height: min(90dvh, 820px); margin: auto; padding: 0; overflow: hidden; border: 1px solid var(--dialog-highlight); border-radius: 20px; color: var(--ink); background: var(--glass-surface); box-shadow: 0 22px 72px var(--dialog-shade); backdrop-filter: blur(18px) saturate(125%); }
.sticker-box-dialog::backdrop { background: var(--dialog-blur-shade); backdrop-filter: blur(7px); }
.folder-create-dialog { width: min(390px, calc(100% - 28px)); max-width: none; margin: auto; padding: 22px; border: 1px solid var(--dialog-highlight); border-radius: 18px; color: var(--ink); background: var(--dialog-solid); box-shadow: 0 22px 72px var(--dialog-shade); backdrop-filter: blur(18px) saturate(125%); }
.folder-create-dialog::backdrop { background: var(--create-dialog-shade); backdrop-filter: blur(5px); }
.folder-create-dialog form { display: grid; gap: 12px; }
.folder-create-dialog h2 { margin: 0; font-size: 19px; font-weight: 600; }
.folder-create-dialog label { color: var(--muted); font-size: 13px; }
.folder-create-dialog input, .folder-create-dialog select { width: 100%; min-height: 44px; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--sheet); }
.folder-create-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.folder-create-actions button { min-height: 42px; padding-inline: 14px; }
.box-dialog-shell { min-height: 280px; display: flex; flex-direction: column; }
.box-dialog-header { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--glass-border); }
.box-dialog-header h2 { margin: 0; font-size: 20px; font-weight: 600; }
.box-dialog-header .preview-close { position: static; flex: none; }
.box-dialog-list, .box-dialog-detail { min-height: 0; padding: 16px 20px 20px; overflow: auto; }
.box-selection-bar { position: sticky; z-index: 1; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -4px 0 12px; padding: 8px 10px; border: 1px solid var(--selection-border); border-radius: 10px; background: var(--selection-surface); backdrop-filter: blur(12px); }
.box-selection-bar > span { flex: none; color: var(--muted); font-size: 12px; }
.box-selection-bar > div { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.box-selection-bar button { min-height: 36px; padding: 5px 9px; font-size: 12px; }
.box-dialog-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.box-dialog-item { min-width: 0; padding: 7px; border: 1px solid var(--line); border-radius: 11px; background: var(--sticker-surface); }
.box-dialog-item.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--selected-ring); }
.box-dialog-item > button { width: 100%; min-height: 0; display: flex; flex-direction: column; align-items: stretch; gap: 7px; padding: 0; border: 0; color: var(--ink); background: transparent; text-align: left; }
.box-dialog-item img { width: 100%; aspect-ratio: 1; display: block; object-fit: contain; border-radius: 7px; background-color: var(--checker-light); background-image: var(--checkboard); background-size: 14px 14px; }
.box-dialog-item small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.box-dialog-empty { padding: 48px 12px; color: var(--muted); text-align: center; }
.box-dialog-detail { text-align: center; }
.box-dialog-detail > .reset-link { display: block; margin: 0 auto 10px 0; }
.box-dialog-detail img { width: min(100%, 440px); max-height: 52dvh; display: block; margin: 0 auto; object-fit: contain; border-radius: 10px; background-color: var(--checker-light); background-image: var(--checkboard); background-size: 18px 18px; }
.box-dialog-detail h3 { margin: 10px 0 12px; font-size: 14px; font-weight: 500; }
.box-detail-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }

.toast { position: fixed; z-index: 80; left: 50%; bottom: calc(78px + env(safe-area-inset-bottom)); max-width: min(560px, calc(100% - 28px)); min-height: 44px; display: flex; align-items: center; gap: 12px; padding: 7px 10px 7px 14px; transform: translate(-50%, 8px); border: 1px solid var(--toast-border); border-radius: 9px; color: var(--on-accent); background: var(--ink); opacity: 0; pointer-events: none; transition: opacity 140ms ease, transform 140ms ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast-action { min-height: 44px; padding: 5px 10px; border: 1px solid var(--toast-action-border); border-radius: 7px; background: transparent; color: var(--on-accent); font-size: 13px; }
.sticker-flight { position: fixed; z-index: 79; pointer-events: none; object-fit: contain; transform: translate3d(0, 0, 0); transition: transform 280ms ease-out, opacity 280ms ease-out; }
.sticker-preview-dialog { position: fixed; inset: 0; width: min(620px, calc(100% - 32px)); max-width: none; max-height: 88dvh; margin: auto; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-sheet); color: var(--ink); background: var(--sheet); box-shadow: 0 18px 48px var(--modal-shadow); /* taste-skill-ignore: modal preview floats over the editor */ }
.sticker-preview-dialog::backdrop { background: var(--preview-shade); }
.sticker-preview-dialog img { width: 100%; height: min(68dvh, 560px); display: block; object-fit: contain; border-radius: 8px; background-color: var(--checker-light); background-image: var(--checkboard); background-size: 18px 18px; }
.sticker-preview-dialog p { margin: 12px 44px 0 0; color: var(--muted); font-size: 14px; }
.preview-close { width: 44px; height: 44px; position: absolute; top: 5px; right: 5px; border: 0; border-radius: 8px; background: var(--paper); color: var(--ink); font-size: 22px; }
@keyframes badge-bump { 0%,100% { transform: scale(1); } 45% { transform: scale(1.12); } }
.nav-item.bump, .nav-count.bump { animation: badge-bump 240ms ease-out; }

@media (max-width: 980px) {
  .app-shell { padding-inline: 8px; }
  .workspace { grid-template-columns: minmax(300px, .82fr) minmax(0, 1.18fr); gap: 14px; padding: 16px; }
  .control-card { padding: 13px; }
  .control-panel-tabs { gap: 7px; }
  .workspace.style-mode, .workspace.light-mode { grid-template-columns: minmax(310px, .75fr) minmax(0, 1.25fr); }
}

@media (min-width: 761px) and (max-width: 900px) {
  .workspace, .workspace.style-mode, .workspace.light-mode {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1.18fr) minmax(220px, .82fr);
    gap: 12px;
    padding: 14px;
  }
  .workspace .editor-column { grid-column: 1; grid-row: 1; }
  .workspace .control-column { grid-column: 1; grid-row: 2; }
  .workspace .editor-heading { min-height: 42px; margin-bottom: 7px; }
  .workspace .subhead { font-size: 12px; }
  .workspace.style-mode, .workspace.light-mode { grid-template-rows: minmax(0, 1.32fr) minmax(220px, .68fr); }
  .workspace .control-panel { padding-bottom: 6px; }
}

@media (max-width: 760px) {
  html, body { height: 100%; }
  .app-shell { width: 100%; padding: 0; background: var(--sheet); }
  .topbar { flex-basis: 54px; min-height: 54px; padding: 0 14px; background: var(--paper); }
  .brand strong { font-size: 14px; }
  .brand small { display: none; }
  .topbar-meta { gap: 7px; font-size: 13px; }
  .local-badge { min-height: 30px; padding-inline: 8px; }
  .topbar-note { display: none; }
  .workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1.24fr) minmax(0, .76fr); gap: 8px; margin: 0; padding: 8px; border: 0; border-radius: 0; }
  .workspace .editor-column { grid-column: 1; grid-row: 1; }
  .workspace .control-column { grid-column: 1; grid-row: 2; }
  .workspace.style-mode, .workspace.light-mode { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1.08fr) minmax(0, .92fr); }
  .editor-heading { min-height: 43px; margin-bottom: 5px; }
  .editor-heading h1 { font-size: 20px; }
  .subhead { font-size: 12px; }
  .stage-card { border-radius: 10px; }
  .stage-toolbar { flex-wrap: wrap; gap: 2px 6px; min-height: 46px; padding: 4px 8px; }
  .stage-label { flex: 1 0 auto; font-size: 13px; }
  .toolbar-actions { flex: 1 1 auto; justify-content: flex-end; }
  .stage-toolbar #compareButton, .stage-toolbar #checkerToggle, .stage-toolbar .zoom-tools { display: none; }
  .text-button { min-height: 44px; padding: 5px 6px; font-size: 12px; }
  .zoom-tools { gap: 2px; }
  .zoom-tools button { min-width: 44px; min-height: 44px; }
  .stage-footer { min-height: 42px; padding: 3px 8px; font-size: 12px; }
  .icon-button { width: 40px; height: 40px; }
  .privacy-note { display: none; }
  .control-column { position: relative; grid-template-rows: auto minmax(0, 1fr); gap: 4px; padding: 0; }
  .stage-footer #canvasActionsHome { display: none; }
  .stage-toolbar #compareButton, .stage-toolbar #checkerToggle, .stage-toolbar .zoom-tools { display: none; }
  .stage-toolbar .toolbar-actions { flex: 0 0 auto; margin-left: auto; }
  .control-panel-tabs { gap: 4px; }
  .control-panel-tab { min-height: 44px; font-size: 13px; }
  .control-panel { gap: 8px; padding: 0 1px 8px 0; }
  .control-card { padding: 12px; border-radius: 10px; }
  .section-title { margin-bottom: 9px; }
  .section-title h2 { font-size: 15px; }
  .section-title p { font-size: 13px; }
  .category-rail { gap: 5px; margin-bottom: 8px; }
  .category-pill { min-height: 44px; padding: 5px 10px; font-size: 13px; }
  .filter-card .category-rail { gap: 3px; margin-bottom: 3px; }
  .filter-card .category-pill { min-height: 36px; padding: 4px 1px; font-size: 11px; }
  .filter-card .section-title p, .light-card .section-title p { display: none; }
  .filter-card .section-title, .light-card .section-title { margin-bottom: 4px; }
  .category-rail { margin-bottom: 3px; }
  .light-card .category-pill { min-height: 36px; padding: 4px 8px; }
  .adjustment-panel { margin-top: 5px; }
  .adjustment-panel > summary { min-height: 38px; }
  .shape-transform-slider { display: none; }
  .slider-row { grid-template-columns: minmax(76px, auto) minmax(50px, 1fr) 40px; gap: 6px; margin: 5px 0; }
  .slider-row label, .slider-row output, .style-extra-row > label, .gradient-stops > label, .gradient-stops > span { font-size: 13px; }
  .switch-row { min-height: 44px; }
  .next-card { padding: 12px; }
  .next-card .coming-label, .next-card > p, .phase-note { display: none; }
  .next-card h3 { margin: 0 0 6px; font-size: 16px; }
  .next-top { display: none; }
  .next-button, .queue-button { min-height: 44px; margin-top: 5px; }
  .bottom-nav { min-height: 60px; gap: 2px; margin: 0; padding: 4px 8px calc(4px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--paper); }
  .nav-item { min-width: 0; flex: 1; min-height: 48px; padding: 3px 5px; }
  .nav-count { right: calc(50% - 28px); }
  .shelf-view { margin: 0; padding: 14px; border: 0; border-radius: 0; }
  .shelf-view[data-view="waiting"] #shelfEmpty { min-height: 240px; }
  .shelf-view[data-view="collage"] #collageWorkspace { padding: 0; }
  .shelf-view[data-view="collage"] .collage-layout { min-height: 0; }
  .shelf-view[data-view="box"] #boxWorkspace { margin-top: 0; }
  .shelf-heading { margin-bottom: 12px; }
  .shelf-heading h1 { font-size: 22px; }
  .shelf-grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 9px; }
  .shelf-item { padding: 8px; }
  .shelf-item button { min-height: 42px; }
  .shelf-empty { padding: 20px 12px; }
  .collection-workspace { margin-top: 12px; padding: 10px; }
  .collage-layout { display: flex; flex-direction: column-reverse; gap: 10px; }
  .collage-preview-wrap { width: 100%; min-height: 220px; max-height: 38dvh; }
  .collage-preview-wrap canvas { max-height: 34dvh; }
  .collage-controls { width: 100%; max-height: none; padding: 11px; }
  .box-toolbar { align-items: stretch; }
  .sticker-preview-dialog { padding: 14px; }
  .toast { bottom: calc(68px + env(safe-area-inset-bottom)); }
}

@media (max-width: 420px) {
  .workspace { grid-template-rows: minmax(0, 1.18fr) minmax(0, .82fr); padding: 7px; gap: 7px; }
  .workspace.style-mode, .workspace.light-mode { grid-template-rows: minmax(0, 1.02fr) minmax(0, .98fr); }
  .editor-heading { min-height: 39px; }
  .editor-heading h1 { font-size: 18px; }
  .stage-label { gap: 5px; }
  .zoom-tools { margin-left: 1px; }
  .zoom-tools button { min-width: 44px; min-height: 44px; }
  .zoom-tools output { min-width: 31px; }
  .stage-toolbar { padding-inline: 6px; }
  .stage-footer { gap: 3px; }
  .canvas-actions { gap: 0; }
  .canvas-actions .text-button { padding-inline: 5px; }
  .control-panel-tabs { gap: 1px; }
  .control-panel-tab { font-size: 13px; }
  .control-card { padding: 10px; }
  .shape-grid { gap: 4px; }
  .shape-button { min-height: 44px; }
  .swatches, .light-presets { gap: 0; }
  .swatch, .light-swatch { width: 40px; height: 44px; }
  .swatch::before, .light-swatch::before { width: 22px; height: 22px; }
  .category-pill { padding-inline: 9px; }
  .nav-item small { font-size: 12px; }
}

@media (max-width: 760px) {
  .box-toolbar { align-items: center; }
  .box-toolbar > p { flex-basis: 100%; }
  .box-toolbar-actions { width: 100%; justify-content: space-between; }
  .box-folder-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .box-folder-entry { min-height: 112px; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 8px; padding: 13px 10px; }
  .box-folder-add { grid-template-columns: 1fr; padding: 13px 10px; }
  .folder-icon { width: 36px; height: 34px; }
  .box-folder-copy strong { font-size: 13px; }
  .box-folder-copy small { font-size: 11px; }
  .sticker-box-dialog { width: calc(100% - 20px); max-height: 88dvh; border-radius: 16px; }
  .box-dialog-header { min-height: 66px; padding: 11px 14px; }
  .box-dialog-list, .box-dialog-detail { padding: 12px 14px 14px; }
  .box-dialog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .box-selection-bar { align-items: flex-start; flex-direction: column; gap: 7px; padding: 8px; }
  .box-selection-bar > div { width: 100%; justify-content: flex-start; }
  .box-selection-bar button { min-height: 40px; flex: 1 1 28%; }
  .box-detail-actions button { min-height: 44px; flex: 1 1 42%; }
  .zoom-tools .zoom-reset { min-width: 52px; min-height: 44px; padding-inline: 3px; border: 0; font-size: 11px; }
}

@media (max-height: 700px) and (max-width: 760px) {
  .topbar { flex-basis: 48px; min-height: 48px; }
  .workspace { grid-template-rows: minmax(0, 1.04fr) minmax(0, .96fr); }
  .workspace.style-mode, .workspace.light-mode { grid-template-rows: minmax(0, 1.04fr) minmax(0, .96fr); }
  .editor-heading { min-height: 34px; margin-bottom: 4px; }
  .editor-heading h1 { font-size: 17px; }
  .control-panel-tabs::before { display: none; }
  .stage-toolbar, .stage-footer { min-height: 40px; }
  .control-card { padding: 4px; }
  .filter-card .section-title, .light-card .section-title { margin-bottom: 2px; }
  .filter-card .section-title h2, .light-card .section-title h2 { font-size: 14px; }
  .filter-card .section-title .reset-link, .light-card .section-title .reset-link { min-height: 28px; padding-block: 2px; font-size: 11px; }
  .filter-card .category-pill, .light-card .category-pill { min-height: 34px; padding-block: 2px; }
  .adjustment-panel { margin-top: 2px; }
  .adjustment-panel > summary { min-height: 30px; }
  .control-panel { padding-bottom: 4px; }
  .bottom-nav { min-height: 52px; }
}

@media (max-height: 740px) and (min-width: 761px) {
  .topbar { flex-basis: 52px; min-height: 52px; }
  .workspace { padding-block: 12px; }
  .editor-heading { min-height: 44px; margin-bottom: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Sticker storage uses a deeper warm clay surface. */
.box-folder-entry:not(.box-folder-add) { background: var(--folder-surface); color: var(--surface); border-color: var(--folder-surface); }
.box-folder-entry:not(.box-folder-add)::before { background: var(--folder-surface); border-color: var(--folder-surface); }
.box-folder-entry:not(.box-folder-add) .box-folder-copy small { color: var(--folder-secondary); }
.box-folder-entry:not(.box-folder-add) .folder-icon,
.box-folder-entry:not(.box-folder-add) .box-folder-count { color: var(--surface); background: var(--folder-count); }
.background-upload { border-style: dashed; color: var(--accent); }
.background-upload-plus { height: 43px; display: grid; place-items: center; font-size: 26px; }
#collageCanvas { touch-action: none; user-select: none; -webkit-user-select: none; }
@media (max-width: 760px) {
  .collage-transform-control { display: none !important; }
}
/* Workbench polish: stable canvas, quiet tool groups, direct save action. */
@media (min-width: 901px) {
  .workspace, .workspace.style-mode, .workspace.light-mode { grid-template-columns: minmax(0, 1fr) 360px; }
  .workspace .editor-column { grid-column: 1; grid-row: 1; }
  .workspace .control-column { grid-column: 2; grid-row: 1; }
  .collage-layout { grid-template-columns: minmax(0, 1fr) 360px; }
  .collage-preview-wrap { grid-column: 1; grid-row: 1; }
  .collage-controls { grid-column: 2; grid-row: 1; }
}
.control-column { grid-template-rows: auto minmax(0, 1fr) auto; }
.control-card, .next-card { border: 0; border-radius: 0; background: transparent; padding: 12px 4px; }
.control-card + .control-card { border-top: 1px solid var(--line); }
.editor-save-action { padding-top: 8px; border-top: 1px solid var(--line); }
.editor-save-action .next-button { width: 100%; margin: 0; }
.mobile-canvas-history { display: none; }
.stage[data-preview-mode="true"] { touch-action: none; overflow: hidden; }
.light-capability-hint { padding: 6px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.editor-heading h1, .shelf-heading h1 { min-width: 0; overflow-wrap: break-word; text-wrap: balance; }
.collage-layout { align-items: stretch; }
.collage-controls { min-height: 0; max-height: none; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; align-content: start; border: 0; border-radius: 0; padding: 0; overflow: hidden; }
.collage-tool-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.collage-tool-tabs button { min-height: 44px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); }
.collage-tool-tabs button.active { border-bottom-color: var(--accent); color: var(--ink); font-weight: 600; }
.collage-tool-panel { min-height: 0; display: grid; align-content: start; gap: 8px; overflow: auto; padding: 0 2px; scrollbar-width: thin; }
.collage-tool-panel label { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.collage-setting-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.collage-setting-row label { align-items: stretch; flex-direction: column; gap: 4px; }
.collage-controls .background-preset-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.collage-export-actions { padding-top: 8px; border-top: 1px solid var(--line); }
.collage-export-actions button { flex: 1; }
.collage-preview-wrap { min-width: 0; min-height: 0; max-height: none; overflow: hidden; }
.collage-preview-wrap canvas { width: auto; height: auto; max-width: 100%; max-height: 100%; min-width: 0; min-height: 0; }
.collage-assets { flex: 0 0 94px; flex-wrap: nowrap; overflow: auto; min-height: 0; padding-bottom: 4px; }
.collage-asset { flex: 0 0 74px; }
.collage-asset span { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.box-toolbar, .collection-workspace { border: 0; background: transparent; }
@media (max-width: 760px) {
  .workspace, .workspace.style-mode, .workspace.light-mode { grid-template-rows: minmax(0, 1.1fr) minmax(0, 1fr); gap: 4px; }
  .workspace.style-mode, .workspace.light-mode { grid-template-rows: minmax(240px, 1fr) minmax(0, var(--mobile-tool-height, 340px)); }
  .control-column { grid-template-rows: auto minmax(0, 1fr) auto; gap: 2px; }
  .control-panel-tabs { padding-right: 0; gap: 4px; }
  .control-panel-tabs::before { display: none; }
  .mobile-canvas-history { position: absolute; z-index: 8; top: 8px; left: 8px; display: block; }
  .mobile-canvas-history .canvas-actions { gap: 4px; }
  .mobile-canvas-history .icon-button { width: 44px; height: 44px; min-height: 44px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--sheet); color: var(--ink); touch-action: manipulation; font-size: 23px; }
  .mobile-canvas-history .icon-button:disabled { color: var(--disabled); background: var(--canvas); }
  .mobile-canvas-history .icon-button:active:not(:disabled) { background: var(--accent-soft); }
  .control-panel { padding-bottom: 2px; }
  .control-card { padding: 4px 2px; }
  .filter-card .reset-link, .light-card .reset-link { min-height: 32px; }
  .editor-save-action { display: flex; align-items: center; gap: 8px; padding-top: 4px; }
  .editor-save-action .next-button { flex: 1; width: auto; }
  .filter-card > .section-title, .light-card > .section-title { min-height: 32px; margin-bottom: 0; }
  .filter-card > .section-title > div, .light-card > .section-title > div { display: none; }
  .editor-heading { min-height: 38px; margin-bottom: 4px; }
  .editor-heading h1 { font-size: 18px; }
  .stage-toolbar { min-height: 36px; padding-block: 0; }
  .stage-toolbar .text-button { min-height: 36px; }
  .stage-footer { min-height: 28px; padding-block: 2px; }
  .empty-state { width: 100%; max-width: 360px; padding: 8px; }
  .upload-art { width: 56px; height: 44px; margin-bottom: 4px; }
  .upload-icon { width: 40px; height: 40px; border-radius: 10px; }
  .upload-icon svg { width: 22px; height: 22px; }
  .spark, .drop-hint { display: none; }
  .empty-state h2 { font-size: 16px; margin-bottom: 4px; }
  .empty-state p { font-size: 11px; line-height: 1.4; }
  .upload-actions { margin-top: 8px; gap: 8px; }
  .upload-actions button { padding: 8px 12px; font-size: 13px; }
  .adjustment-panel > summary { min-height: 30px; padding-block: 4px; }
  .shelf-view[data-view="collage"] { padding: 8px; overflow: hidden; }
  .shelf-view[data-view="collage"] .shelf-heading { margin-bottom: 6px; }
  .shelf-view[data-view="collage"] .shelf-heading h1 { font-size: 18px; }
  .shelf-view[data-view="collage"] .shelf-heading p { font-size: 11px; }
  .shelf-view[data-view="collage"] .collage-layout { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(140px, 1fr) auto; gap: 6px; }
  .collage-preview-wrap { grid-row: 1; width: 100%; min-height: 0; height: 100%; max-height: none; padding: 6px; }
  .collage-preview-wrap canvas { max-height: 100%; max-width: 100%; }
  .collage-controls { grid-row: 2; max-height: none; width: 100%; padding: 0; gap: 4px; }
  .collage-tool-panel { max-height: 230px; }
  .collage-tool-tabs button { min-height: 36px; }
  .collage-setting-row label { flex-direction: column; align-items: stretch; font-size: 11px; }
  .collage-setting-row select { min-width: 0; min-height: 34px; padding: 4px; font-size: 11px; }
  .background-preset-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .background-preset { min-height: 52px; padding: 3px; }
  .background-preset img { height: 30px; }
  .background-transparent-swatch { min-height: 30px; }
  .background-preset span { font-size: 10px; }
  .background-upload-plus { min-height: 30px; height: 30px; }
  .collage-tool-panel > label:has(input[type="color"]) { min-height: 30px; }
  .collage-controls input[type="color"] { height: 28px; }
  .collage-export-actions { padding-top: 4px; }
  .collage-export-actions button { min-height: 36px; padding-block: 4px; }
  .collage-assets { flex-basis: 76px; margin-top: 6px; }
  .collage-asset { min-height: 68px; height: 68px; font-size: 10px; }
  .collage-asset img { height: 42px; }
  .box-folder-entry { grid-template-columns: minmax(0, 1fr); align-content: center; justify-items: start; gap: 8px; min-height: 132px; padding: 16px; }
  .box-folder-entry .box-folder-count { position: absolute; top: 12px; right: 12px; }
  .box-folder-copy strong { font-size: 14px; overflow-wrap: anywhere; }
  .box-folder-add { justify-items: center; }
}
@media (max-width: 760px) and (max-height: 700px) {
  .workspace { grid-template-rows: minmax(0, 1fr) minmax(0, 1.15fr); }
  .workspace.style-mode, .workspace.light-mode { grid-template-rows: minmax(220px, 1fr) minmax(0, var(--mobile-tool-height, 290px)); }
  #controlPanel-edit .stroke-help { display: none; }
  #controlPanel-edit .section-title { margin-bottom: 4px; }
  .empty-state .upload-art { display: none; }
  .empty-state p br { display: none; }
  .empty-state h2 { font-size: 15px; }
  .editor-heading { min-height: 32px; }
  .collage-tool-panel { max-height: 200px; }
  .collage-setting-row label { flex-direction: row; align-items: center; white-space: nowrap; }
  .collage-setting-row select { width: 106px; }
  .background-preset { min-height: 48px; gap: 2px; }
  .background-preset img { height: 24px; }
  .background-transparent-swatch { min-height: 24px; }
  .collage-tool-panel { gap: 6px; }
  .background-upload-plus { min-height: 24px; height: 24px; }
  .shelf-view[data-view="collage"] .shelf-heading p { display: none; }
}

/* Category names read as a simple index rather than another row of cards. */
.filter-card .category-rail, .light-card .category-rail { gap: 4px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.filter-card .category-pill, .light-card .category-pill { min-height: 44px; padding: 6px 2px; border: 0; border-radius: 0; background: transparent; color: var(--muted); font-size: 12px; }
.filter-card .category-pill.active, .light-card .category-pill.active { color: var(--accent); background: transparent; }
@media (max-width: 760px) {
  .filter-grid, .light-grid { gap: 0 12px; margin-top: 4px; }
  .filter-option, .light-option { min-height: 62px; padding: 10px 6px; gap: 8px; }
  .filter-name-zh, .light-name-zh { font-size: 13px; }
}
@media (max-width: 760px) and (max-height: 700px) {
  .filter-option, .light-option { min-height: 56px; padding-block: 8px; }
}
/* Motion is limited to feedback; pointer coordinates and export pixels never tween. */
.render-status { position: absolute; z-index: 6; right: 12px; bottom: 12px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--sheet); color: var(--muted); font-size: 12px; pointer-events: none; }
.canvas-wrap #comparisonCanvas { grid-area: 1 / 1; z-index: 4; pointer-events: none; }
#compareButton { transition: transform 100ms var(--ease-out), background-color 100ms ease; }
#compareButton:active, #compareButton.is-comparing { transform: scale(.98); background: var(--accent-soft); }
.mode-content { transform-origin: top center; }
.sticker-flight { transition: none; }
@media (prefers-reduced-motion: reduce) {
  #compareButton, #compareButton:active, #compareButton.is-comparing { transform: none; transition: none; }
  .sticker-flight { display: none; }
}
.canvas-wrap.is-comparing #artCanvas, .canvas-wrap.is-comparing #interactionCanvas, .canvas-wrap.is-comparing .canvas-hint { visibility: hidden; }

/* Press feedback is reserved for deliberate actions, never drag surfaces or tabs. */
.primary-button, .next-button, .queue-button { transition: transform 120ms var(--ease-out), background-color 120ms ease, border-color 120ms ease; }
:root:not(.keyboard-input) :is(.primary-button, .next-button, .queue-button, .box-folder-entry):active:not(:disabled) { transform: scale(.98); }
.keyboard-input :is(.primary-button, .next-button, .queue-button, .box-folder-entry) { transition: none; }
@media (prefers-reduced-motion: reduce) {
  :root:not(.keyboard-input) :is(.primary-button, .next-button, .queue-button, .box-folder-entry):active:not(:disabled) { transform: none; }
}

/* The image owns the heading space once effect editing begins. */
.workspace.style-mode .editor-heading, .workspace.light-mode .editor-heading { display: none; }
.effect-folder { position: relative; margin-top: 0; padding: 5px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--sheet); }
.effect-folder::before { content: ""; position: absolute; top: -5px; left: var(--folder-anchor, 50%); width: 9px; height: 9px; border-top: 1px solid var(--line-strong); border-left: 1px solid var(--line-strong); background: var(--sheet); transform: translateX(-50%) rotate(45deg); }
.filter-card .category-rail, .light-card .category-rail { margin-bottom: 5px; border-bottom: 0; }
.filter-card .category-pill.active, .light-card .category-pill.active { background: var(--accent-soft); border-radius: 7px 7px 0 0; }
.effect-folder .filter-grid, .effect-folder .light-grid { margin: 0; gap: 0 6px; }
.effect-folder :is(.filter-option,.light-option) { min-height: 54px; padding: 7px 5px; gap: 7px; }

/* Collage: fixed preview, one compact material panel, one export row. */
.shelf-view[data-view="collage"] { overflow: hidden; padding: 16px; }
.shelf-view[data-view="collage"] .shelf-heading { margin-bottom: 10px; }
.shelf-view[data-view="collage"] .shelf-heading h1 { font-size: 21px; }
.shelf-view[data-view="collage"] .shelf-heading p { display: none; }
#collageWorkspace { margin: 0; padding: 0; }
.collage-controls { grid-template-rows: minmax(0, 1fr) auto; gap: 6px; }
.collage-configuration { min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; padding-right: 3px; }
.collage-section { padding: 8px 0; border-bottom: 1px solid var(--line); }
.collage-section h2 { margin: 0 0 7px; color: var(--ink); font-size: 13px; font-weight: 500; }
.collage-ratios { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
.collage-ratios button { min-width: 0; min-height: 40px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: var(--sheet); font-size: 13px; }
.collage-ratios small { margin-left: 4px; font-size: 11px; }
.collage-ratios button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.container-choices { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 6px; }
.background-choices { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 3px; }
.material-choice { min-width: 0; min-height: 66px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 5px; padding: 3px 0; border: 0; border-radius: 7px; background: transparent; color: var(--muted); }
.material-circle { position: relative; flex: none; width: 44px; height: 44px; display: grid; place-items: center; overflow: hidden; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--canvas); color: var(--accent); font-size: 19px; }
.material-circle img { display: block; width: 100%; height: 100%; object-fit: cover; }
.container-choices .material-circle { width: 52px; height: 52px; }
.material-name { color: inherit; font-size: 12px; line-height: 1.3; white-space: nowrap; }
.material-choice.active { color: var(--accent); background: var(--accent-soft); }
.material-choice.active .material-circle { outline: 2px solid var(--accent); outline-offset: 1px; }
.material-choice:disabled { opacity: .55; cursor: default; }
.material-choice:disabled .material-circle { font-size: 10px; }
.material-choice[data-background="none"] .material-circle { background-image: var(--checkboard); background-size: 12px 12px; }
.color-choice .material-circle { background: var(--custom-background, #f6f3ee); }
.color-choice input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.container-note { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.basket-colors { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.basket-colors > span { margin-right: auto; font-size: 11px; color: var(--muted); }
.basket-colors button { position: relative; width: 44px; height: 44px; padding: 9px; border: 0; border-radius: 6px; background: transparent; }
.basket-colors button::after { content: ""; display: block; width: 26px; height: 26px; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--basket-swatch); }
.basket-colors button[aria-pressed="true"] { background: var(--accent-soft); }
.basket-colors button[aria-pressed="true"]::after { outline: 1px solid var(--accent); outline-offset: 2px; }
.basket-custom-color { position: relative; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 6px; color: var(--accent); background: var(--canvas); }
.basket-custom-color input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; }
.collage-sticker-tools { padding: 5px 0; }
.collage-sticker-tools > summary { display: flex; align-items: center; justify-content: space-between; min-height: 40px; color: var(--ink); font-size: 13px; cursor: pointer; list-style: none; }
.collage-sticker-tools > summary::-webkit-details-marker { display: none; }
.collage-sticker-tools[open] > summary span { transform: rotate(45deg); }
.collage-sticker-content { display: grid; gap: 8px; }
.collage-sticker-content .collage-control-actions { margin: 0; }
.collage-sticker-content .collage-control-actions button { flex: 1; }
.collage-controls .collage-export-actions { margin: 0; padding-top: 5px; }
.collage-preview-wrap { position: relative; }
.collage-preview-wrap #collageSelectionCanvas { position: absolute; z-index: 1; pointer-events: none; max-width: none; max-height: none; border: 0; border-radius: 0; background: none; }
.collage-status { position: absolute; z-index: 2; left: 12px; top: 10px; padding: 5px 8px; border-radius: 6px; background: var(--sheet); color: var(--muted); font-size: 12px; }
.collage-assets { flex-basis: 70px; margin-top: 8px; }
.collage-asset { min-height: 62px; }
#collageAssets { max-height: 78px; margin-top: 2px; padding: 0; }
@media (min-width: 761px) and (max-width: 900px) {
  .collage-layout { grid-template-columns: minmax(0,1fr) 310px; }
  .collage-preview-wrap { grid-column: 1; grid-row: 1; }
  .collage-controls { grid-column: 2; grid-row: 1; }
}
@media (max-width: 760px) {
  .workspace.style-mode, .workspace.light-mode { grid-template-rows: minmax(0,1fr) minmax(0,clamp(260px,42dvh,360px)); }
  .effect-folder :is(.filter-option,.light-option) { min-height: 50px; padding-block: 5px; }
  .shelf-view[data-view="collage"] { padding: 8px; }
  .shelf-view[data-view="collage"] .shelf-heading { margin-bottom: 5px; }
  .shelf-view[data-view="collage"] .shelf-heading h1 { font-size: 17px; }
  .shelf-view[data-view="collage"] .collage-layout { grid-template-rows: minmax(150px,1fr) minmax(0,auto); gap: 6px; }
  .collage-controls { max-height: min(46dvh,350px); grid-column: 1; grid-row: 2; gap: 3px; }
  .collage-section { padding: 5px 0; }
  .collage-section:first-child { position: sticky; top: 0; z-index: 3; background: var(--sheet); }
  .collage-section:first-child h2 { display: none; }
  .collage-section h2 { margin-bottom: 3px; font-size: 12px; }
  .collage-ratios button { min-height: 36px; }
  .material-choice { min-height: 62px; gap: 3px; }
  .container-choices .material-circle { width: 44px; height: 44px; }
  .container-note { font-size: 10px; margin-top: 2px; }
  .collage-sticker-tools { padding: 0; }
  .collage-sticker-tools > summary { min-height: 36px; }
  .collage-controls .collage-export-actions button { min-height: 40px; }
  .collage-assets { flex-basis: 58px; margin-top: 4px; }
  .collage-asset { flex-basis: 64px; height: 54px; min-height: 54px; }
  .collage-asset img { height: 33px; }
}
@media (max-width: 760px) and (max-height: 700px) {
  .effect-folder :is(.filter-option,.light-option) { min-height: 44px; padding-block: 3px; }
  .container-note { display: none; }
  .material-choice { min-height: 60px; padding: 0; }
  .material-circle, .container-choices .material-circle { width: 40px; height: 40px; }
}

/* Mobile canvas and compact collage controls — October 24. */
.crop-heading-actions { display:flex; align-items:center; gap:8px; margin-left:auto; }
.crop-heading-actions .reset-link { min-height:44px; }
.parameter-hint { color:var(--muted); font-size:11px; margin-left:auto; }
.stage.preview-dark { background-color:#302e2c; }
.stage.preview-dark.checker { background-color:#302e2c; background-image:conic-gradient(#3c3936 25%,#302e2c 0 50%,#3c3936 0 75%,#302e2c 0); background-size:24px 24px; }
.stage.preview-dark.solid-bg { background:#302e2c; }
.collage-module > summary { display:flex; align-items:center; gap:8px; min-height:44px; cursor:pointer; list-style:none; font-size:13px; color:var(--ink); }
.collage-module > summary::-webkit-details-marker { display:none; }
.collage-module > summary small { margin-left:auto; color:var(--muted); font-size:12px; font-weight:400; }
.collage-module > summary > span { font-size:18px; width:24px; text-align:center; }
.collage-module[open] > summary > span { transform:rotate(45deg); }
.collage-module-body { padding:3px 0 6px; }
.basket-colors button.original-color { font-size:12px; color:var(--muted); padding:0; }
.basket-colors button.original-color::after { display:none; }
.collage-history { position:absolute; top:10px; left:10px; display:flex; gap:5px; z-index:4; }
.collage-history button { width:44px; height:44px; background:var(--sheet); border:1px solid var(--line); }
.collage-history ~ .collage-status { left:auto; right:10px; }
@media(max-width:760px) {
 .workspace .editor-heading { display:none; }
 .shelf-view[data-view="collage"] .shelf-heading { display:none; }
 .shape-button > span { display:none; }
 .shape-grid .shape-button { min-height:44px; padding:5px; }
 .stage-toolbar .stage-label { flex:1 1 auto; }
 .stage-toolbar .toolbar-actions { flex:0 0 auto; gap:2px; }
 .stage-toolbar :is(.text-button,.reset-link) { font-size:11px; padding-inline:6px; min-height:36px; }
 .stage-footer #canvasActionsHome { display:none; }
 .stage-footer { --canvas-meta-font-size:11px; min-height:26px; gap:8px; }
 #imageMeta { white-space:nowrap; font-size:var(--canvas-meta-font-size,11px); }
 .parameter-hint { font-size:10px; white-space:nowrap; }
 .control-panel:is(#controlPanel-style,#controlPanel-light) .section-title { display:none; }
}

/* Text-only canvas actions: suppress native tap flashes and filled states. */
:is(#previewBackground, #restoreOriginal, #expandCropCanvas, #collapseCropCanvas, #centerExpandedSelection, #expandCollageCanvas, #collapseCollageCanvas, #expandedMoveContainer),
:is(#previewBackground, #restoreOriginal, #expandCropCanvas, #collapseCropCanvas, #centerExpandedSelection, #expandCollageCanvas, #collapseCollageCanvas, #expandedMoveContainer):is(:hover, :active, :focus, :focus-visible, [aria-pressed="true"]) {
  background: transparent;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}

/* Collection hierarchy: one introduction, followed by capacity and actions. */
.shelf-view[data-view="box"] .shelf-heading { margin-bottom: 10px; }
.shelf-view[data-view="box"] .shelf-heading h1 { font-size: 24px; }
.shelf-view[data-view="box"] .shelf-heading p {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.5;
  white-space: normal;
}
.box-toolbar { align-items: center; gap: 8px 12px; padding: 0; margin-bottom: 12px; }
.box-toolbar #boxLimit { font-size: 12px; white-space: nowrap; }
.box-toolbar-actions { margin-left: auto; width: auto; flex-wrap: nowrap; gap: 6px; }
.box-toolbar-actions button { padding-inline: 10px; white-space: nowrap; }
.shelf-view[data-view="box"] #boxFolders { flex: none; min-height: 0; }
.box-folder-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.box-folder-wrap { position: relative; min-width: 0; }
.box-folder-wrap > .box-folder-entry { width: 100%; height: 100%; }
.box-folder-wrap.can-delete > .box-folder-entry { min-height: 112px; padding-bottom: 38px; }
.box-folder-remove { position: absolute; right: 9px; bottom: 5px; min-height: 32px; padding: 4px 8px; border: 0; background: transparent; color: var(--folder-secondary); font-size: 12px; }
.sticker-box-dialog { height: min(88dvh, 820px); }
.box-dialog-shell { height: 100%; min-height: 0; overflow: hidden; }
.box-dialog-header { flex: none; }
.box-dialog-list, .box-dialog-detail { flex: 1; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; -webkit-overflow-scrolling: touch; }
.box-dialog-detail { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
.box-dialog-detail img { max-height: min(40dvh, 340px); }
.box-detail-actions { position: sticky; bottom: -1px; z-index: 1; padding: 10px 0; background: var(--dialog-solid); }
.box-detail-actions button { min-height: 44px; }
.box-select-actions { display: flex; justify-content: flex-end; gap: 8px; margin: 0 0 12px; }
.box-select-actions button { min-height: 40px; padding: 5px 10px; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 7px; }
.box-dialog-item { position: relative; }
.box-item-check { position: absolute; right: 12px; top: 12px; display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--sheet); background: var(--sheet); pointer-events: none; }
.box-dialog-item.selected .box-item-check { background: var(--accent); border-color: var(--accent); }
.box-selection-bar { flex-wrap: wrap; }
.box-selection-bar > div { justify-content: flex-start; }
.collage-preview-wrap #collageCanvas.moving-container { cursor: move; touch-action: none; }
.crop-expanded-only { display: none; }
#expandCropCanvas { display: inline-flex; }
.crop-floating-toolbar { display: none; position: absolute; z-index: 20; left: 50%; bottom: 12px; width: min(620px, calc(100% - 24px)); padding: 8px; transform: translateX(-50%); border: 1px solid var(--line-strong); border-radius: 14px; background: color-mix(in srgb, var(--sheet) 94%, transparent); box-shadow: 0 8px 28px rgba(44, 36, 29, .16); backdrop-filter: blur(14px); }
.crop-floating-toolbar.visible { display: block; }
.crop-tool-buttons { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 5px; }
.crop-floating-toolbar button { min-width: 44px; min-height: 44px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--sheet); color: var(--ink); font: inherit; font-size: 13px; touch-action: manipulation; }
.crop-floating-toolbar button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.crop-floating-toolbar button:disabled { opacity: .42; }
.eraser-size-options { display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: 6px; }
.eraser-size-options > span { margin-right: 2px; color: var(--muted); font-size: 12px; }
.eraser-size-options button { min-height: 36px; min-width: 42px; padding: 4px 10px; }
.eraser-size-options button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.smart-cutout .eraser-size-options { justify-content: flex-start; margin: 8px 0; }
body:is(.crop-canvas-expanded,.preview-canvas-expanded) .app-shell > :is(.topbar, .bottom-nav),
body:is(.crop-canvas-expanded,.preview-canvas-expanded) :is(.control-column, .editor-heading, .privacy-note) { display: none; }
body:is(.crop-canvas-expanded,.preview-canvas-expanded) #workspace { display: block; position: fixed; inset: 0; width: 100%; height: 100dvh; padding: 0; z-index: 90; background: var(--sheet); }
body:is(.crop-canvas-expanded,.preview-canvas-expanded) .editor-column { height: 100%; padding: 0; }
body:is(.crop-canvas-expanded,.preview-canvas-expanded) .stage-card { height: 100%; border: 0; border-radius: 0; }
body:is(.crop-canvas-expanded,.preview-canvas-expanded) .stage-toolbar { flex: none; padding-top: env(safe-area-inset-top); min-height: calc(48px + env(safe-area-inset-top)); }
body:is(.crop-canvas-expanded,.preview-canvas-expanded) #collapseCropCanvas { min-height: 44px; }
body:is(.crop-canvas-expanded,.preview-canvas-expanded) .stage-toolbar > :is(.stage-label, .toolbar-actions),
body:is(.crop-canvas-expanded,.preview-canvas-expanded) .stage-footer { display: none; }
body:is(.crop-canvas-expanded,.preview-canvas-expanded) .crop-expanded-only { display: flex; }
body:is(.crop-canvas-expanded,.preview-canvas-expanded) .stage { flex: 1; min-height: 0; }
.crop-expanded-footer { display: none; flex: none; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: var(--sheet); border-top: 1px solid var(--line); }
.crop-expanded-footer button { width: 100%; min-height: 48px; justify-content: center; }
body.crop-canvas-expanded .crop-expanded-footer { display: block; }
body.preview-canvas-expanded .crop-expanded-footer, body.preview-canvas-expanded .crop-floating-toolbar { display:none !important; }
.shape-expanded-tools { display:flex; align-items:center; justify-content:center; gap:10px; padding:3px 4px; }
.shape-expanded-tools label { color:var(--muted); font-size:12px; white-space:nowrap; }
.shape-expanded-tools input { width:min(280px,48vw); min-width:120px; accent-color:var(--accent); }
.shape-expanded-tools output { min-width:44px; color:var(--ink); font-size:12px; text-align:center; }
#mobileReplaceAction { display: none; }
@media (max-width: 760px) {
  #mobileReplaceAction { display: flex; flex: none; margin-left: auto; justify-content: flex-end; }
  #mobileReplaceAction .text-button { min-height: 44px; padding: 0; font-size: var(--canvas-meta-font-size,11px); }
  .box-selection-bar { position: static; }
  .box-selection-bar > div { display: grid; width: 100%; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .box-selection-bar button { min-height: 44px; }
  .box-dialog-detail .box-detail-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.crop-canvas-expanded .crop-floating-toolbar { bottom: 12px; width: calc(100% - 16px); max-width: 520px; padding: 6px; }
  body.crop-canvas-expanded .crop-tool-buttons { gap: 4px; }
  body.crop-canvas-expanded .crop-floating-toolbar button { min-height: 44px; padding-inline: 7px; }
  .shape-expanded-tools { gap:7px; }
  .shape-expanded-tools input { min-width:100px; }
}
@media (max-width: 760px) {
  .shelf-view[data-view="box"] .shelf-heading h1 { font-size: 23px; }
  .box-folder-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .box-folder-entry {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    min-height: 88px;
    gap: 10px;
    padding: 14px;
    align-items: center;
    align-content: center;
    justify-items: stretch;
    border-radius: 12px;
  }
  .box-folder-entry::before { display: none; }
  .box-folder-entry .folder-icon { width: 36px; height: 36px; }
  .box-folder-entry .folder-icon svg { display: block; width: 26px; height: 26px; aspect-ratio: 1; }
  .box-folder-entry .box-folder-count { position: static; align-self: start; height: 25px; }
  .box-folder-copy strong { font-size: 15px; overflow-wrap: anywhere; }
  .box-folder-copy small { font-size: 12px; line-height: 1.4; }
  .box-folder-add { grid-template-columns: 36px minmax(0, 1fr); text-align: left; }
  .box-folder-add .box-folder-copy { align-items: flex-start; }
  .box-folder-plus { width: 36px; height: 36px; }
  .shelf-view[data-view="box"] #boxEmpty { display: none; }
}


/* Two-column lists: no separator beneath the final row, including odd counts. */
:is(.filter-grid, .light-grid) > :is(.filter-option, .light-option):nth-child(odd):nth-last-child(-n + 2),
:is(.filter-grid, .light-grid) > :is(.filter-option, .light-option):nth-child(odd):nth-last-child(-n + 2) ~ :is(.filter-option, .light-option) {
  border-bottom-color: transparent;
}

/* Mobile collage targets retain their size on short screens; the settings pane scrolls. */
@media (max-width: 760px) {
  .collage-controls :is(button, summary, select) { min-height: 44px; min-width: 44px; }
  .collage-controls :is(button, summary, select, label, output, .material-name, .material-choice, .collage-asset, .tiny-help, .basket-colors > span) { font-size: 12px; }
  .collage-controls :is(button, summary) { font-size: 13px; }
  .collage-controls :is(.collage-ratios small, .collage-module > summary small) { font-size: 12px; }
  .collage-controls .background-choices { grid-template-columns: repeat(6, minmax(44px, 1fr)); gap: 4px; }
  .collage-controls .container-choices { grid-template-columns: repeat(5, minmax(44px, 1fr)); gap: 6px; }
  .collage-controls .material-choice { min-height: 68px; padding: 2px 0; gap: 4px; }
  .collage-controls .material-circle { width: 44px; height: 44px; }
  .collage-controls .basket-colors { flex-wrap: wrap; gap: 4px; }
  .collage-controls .basket-colors > span { flex: 1 0 56px; }
  .collage-controls .basket-colors button, .collage-controls .basket-custom-color { flex: 0 0 44px; width: 44px; height: 44px; }
  .collage-controls .basket-custom-color input { min-height: 44px; height: 44px; }
  .collage-controls .color-choice input { min-height: 44px; height: 44px; }
  .collage-controls input[type="range"] { min-height: 44px; height: 44px; margin-block: 0; }
  .collage-controls .slider-row { min-height: 48px; }
  .collage-controls .collage-section:first-child { position: static; }
  .collage-controls .collage-control-actions { gap: 8px; }
  .collage-controls .collage-control-actions button { flex: 1 0 72px; }
  .collage-controls .collage-export-actions button { min-height: 44px; }
  .collage-controls .collage-asset { height: 68px; min-height: 68px; flex: 0 0 72px; }
  .collage-controls #collageAssets { min-height: 78px; }
  .collage-configuration { scroll-padding-block: 8px 52px; padding-bottom: 8px; }
  body.crop-canvas-expanded #centerExpandedSelection { min-height: 44px; margin-left: auto; }
}

/* Collage expansion reuses the live canvas and gesture surface. */
.container-move-choice .material-circle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.collage-view-actions { position: absolute; z-index: 5; top: 10px; right: 10px; display: flex; align-items: center; gap: 6px; }
.collage-view-actions .text-button { min-height: 44px; padding-inline: 8px; font-size: 12px; }
.collage-expanded-only { display: none; }
.collage-preview-wrap .collage-status { top: 62px; right: 10px; }
body.collage-canvas-expanded .app-shell > :is(.topbar, .bottom-nav),
body.collage-canvas-expanded .shelf-heading { display: none; }
body.collage-canvas-expanded #collageWorkspace { position: fixed; inset: 0; z-index: 90; width: 100%; height: 100dvh; min-height: 0; padding: 0; background: var(--sheet); }
body.collage-canvas-expanded #collageWorkspace .collage-layout { display: block; height: 100%; }
body.collage-canvas-expanded .collage-controls { display: none; }
body.collage-canvas-expanded .collage-preview-wrap { height: 100%; width: 100%; padding: calc(62px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom)); border: 0; border-radius: 0; max-height: none; }
body.collage-canvas-expanded .collage-view-actions,
body.collage-canvas-expanded .collage-history { top: calc(8px + env(safe-area-inset-top)); }
body.collage-canvas-expanded .collage-expanded-only { display: inline-flex; }
body.collage-canvas-expanded #expandCollageCanvas { display: none; }
body.collage-canvas-expanded .collage-preview-wrap .collage-status { top: calc(64px + env(safe-area-inset-top)); }
