/* The desktop shell (desktop-shell.js). Every rule is under html[data-shell="desktop"]
   or the shell's own classes, so nothing changes unless the shell is switched on.
   Tokens are docs/web-design-tokens.md. Geist and Geist Mono are bundled under fonts/
   (SIL Open Font License, fonts/GEIST-LICENSE.txt); neither has Chinese or Japanese
   glyphs, so those fall back to the system's. */

@font-face { font-family: "Geist"; src: url("./fonts/Geist-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("./fonts/GeistMono-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

/* The site's look: paper and ink, square corners, no accent colour, and as few lines as the layout can do with. */
html[data-shell="desktop"][data-theme="light"], html.is-studio-booting[data-boot-theme="light"] {
  --ds-bg: #F4F3EE; --ds-surface: #FBFAF6; --ds-stage: #E9E8E1; --ds-ink: #111110; --ds-on-ink: #FBFAF6;
  --ds-text: #111110; --ds-text-2: #4F4E48; --ds-mute: #5F5E57; --ds-rule: #DAD8CF; --ds-rule-2: #EEEDE7; --ds-rule-strong: #8A887F;
  --ds-accent: #111110; --ds-on-accent: #FBFAF6; --ds-selected: #EEEDE7; --ds-hover: #EEEDE7; --ds-pressed: #E3E1D8;
  --ds-disabled-fg: #9C9A91; --ds-disabled-bg: #EEEDE7; --ds-logo: none; color-scheme: light;
}
html[data-shell="desktop"][data-theme="dark"], html.is-studio-booting[data-boot-theme="dark"] {
  --ds-bg: #111110; --ds-surface: #191917; --ds-stage: #0C0C0B; --ds-ink: #F4F3EE; --ds-on-ink: #111110;
  --ds-text: #F4F3EE; --ds-text-2: #BAB8AE; --ds-mute: #9B998F; --ds-rule: #31302C; --ds-rule-2: #262623; --ds-rule-strong: #76746B;
  --ds-accent: #F4F3EE; --ds-on-accent: #111110; --ds-selected: #262623; --ds-hover: #262623; --ds-pressed: #31302C;
  --ds-disabled-fg: #5F5E57; --ds-disabled-bg: #21211F; --ds-logo: invert(1); color-scheme: dark;
}

/* The page behind the shell takes its ground too: Safari colours its status and tool bars from it. */
html[data-shell="desktop"][data-theme], html[data-shell="desktop"][data-theme] body,
html.is-studio-booting[data-boot-theme], html.is-studio-booting[data-boot-theme] body { background: var(--ds-bg); }

/* Square corners everywhere but the round marker a person drags on a picture. The page's own controls, hosted in the
   shell or laid over the canvas, are written round in the shared sheet, hence !important. */
html[data-shell="desktop"] :is(.ds-root, .ds-dialog, .ds-toast, .ds-export-hint, .ios-app-promotion) *:not(.ds-picker-marker),
html[data-shell="desktop"] :is(.ds-dialog, .ds-toast, .ds-export-hint, .ios-app-promotion, .studio-upload-prompt) { border-radius: 0 !important; }

/* The column's width; folded, it takes none. */
html[data-shell="desktop"], html.is-web-free { --ds-side: 248px; }
@media (min-width: 1100px) {
  html[data-shell="desktop"].ds-collapsed, html.is-web-free.ds-collapsed { --ds-side: 0px; }
}

/* Take over the editor's layout, leaving the canvas stage where it is. */
html[data-shell="desktop"] #editorView {
  display: grid !important;
  grid-template-columns: var(--ds-side) minmax(0, 1fr) 340px !important;
  grid-template-rows: 48px minmax(0, 1fr) !important;
  background: var(--ds-bg) !important;
  color: var(--ds-ink);
}
/* The grid above must not outrank the page hiding the editor (.is-hidden), or "Projects" opens underneath it. A rule of
   its own: adding :not() to the selector above would raise it over the narrow-window column rules. */
html[data-shell="desktop"] #editorView.is-hidden { display: none !important; }
html[data-shell="desktop"] #editorView > .editor-topbar,
html[data-shell="desktop"] #editorView > .editor-tool-rail,
html[data-shell="desktop"] #editorView > .editor-bottom { display: none !important; }
html[data-shell="desktop"] #editorView > .editor-stage {
  grid-column: 2 !important; grid-row: 2 !important; min-width: 0; min-height: 0;
  background: var(--ds-stage) !important; border-left: 1px solid var(--ds-rule); border-right: 1px solid var(--ds-rule);
}

.ds-root { display: contents; font: 13px/1.45 "Geist", system-ui, -apple-system, "PingFang SC", "Hiragino Sans", sans-serif; color: var(--ds-ink); }
/* Zero specificity, so a component rule below always wins over this reset. */
:where(.ds-root) :is(button, input, select) { font: inherit; color: inherit; }
.ds-root :focus-visible { outline: 2px solid var(--ds-accent); outline-offset: 2px; }

/* top bar */
.ds-top { grid-column: 2 / -1; grid-row: 1; display: flex; align-items: center; gap: 10px; padding: 0 14px; background: var(--ds-surface); border-bottom: 1px solid var(--ds-rule); min-width: 0; }
.ds-brand img { height: 17px; width: auto; display: block; filter: var(--ds-logo); }
.ds-title { font: inherit; font-weight: 500; color: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; border: 0; border-bottom: 1px solid transparent; background: transparent; padding: 0; cursor: text; }
.ds-title:hover:not(:disabled) { border-bottom-color: var(--ds-rule-strong); }
.ds-title:disabled { cursor: default; }
.ds-spacer { flex: 1; }
.ds-link { background: none; border: 0; padding: 0; color: var(--ds-mute); text-decoration: underline; cursor: pointer; }
.ds-btn, .ds-icon, .ds-export, .ds-export-more { height: 30px; border: 1px solid transparent; background: transparent; cursor: pointer; padding: 0 12px; }
.ds-btn { background: var(--ds-rule-2); }
.ds-icon { display: inline-flex; align-items: center; justify-content: center; width: 30px; padding: 0; }
.ds-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ds-small { width: 24px; height: 24px; font-size: 13px; }
.ds-btn:hover, .ds-btn:active { background: var(--ds-pressed); }
.ds-icon:hover { background: var(--ds-hover); }
.ds-icon:active { background: var(--ds-pressed); }
.ds-btn-primary, .ds-btn[aria-pressed="true"] { background: var(--ds-ink); color: var(--ds-on-ink); border-color: var(--ds-ink); }
.ds-btn:disabled, .ds-icon:disabled, .ds-export:disabled { color: var(--ds-disabled-fg); background: transparent; cursor: default; }
.ds-btn:disabled { background: var(--ds-disabled-bg); }
.ds-export { position: relative; overflow: hidden; background: var(--ds-ink); color: var(--ds-on-ink); border-color: var(--ds-ink); font-weight: 600; min-width: 96px; }
.ds-export:disabled { background: var(--ds-disabled-bg); border-color: var(--ds-disabled-bg); }
.ds-export-group { display: inline-flex; flex: none; align-items: center; }
.ds-export-more { display: inline-flex; width: 30px; align-items: center; justify-content: center; padding: 0; border-color: var(--ds-ink); border-left-color: var(--ds-text-2); background: var(--ds-ink); color: var(--ds-on-ink); }
.ds-export-more:disabled { border-color: var(--ds-disabled-bg); background: var(--ds-disabled-bg); color: var(--ds-disabled-fg); cursor: default; }
.ds-export-more[hidden] { display: none; }
.ds-export-more svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* The progress of an export has to show on the solid button. */
.ds-export-bar { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--ds-on-ink); opacity: 0.28; transition: width 120ms linear; }
.ds-export-label { position: relative; }

.ds-save { display: inline-flex; align-items: center; gap: 8px; font: 11px "Geist Mono", ui-monospace, monospace; color: var(--ds-mute); white-space: nowrap; }
.ds-save[data-state="failed"] { color: #B3261E; }
html[data-theme="dark"] .ds-save[data-state="failed"] { color: #FF9A8F; }
.ds-save[hidden], .ds-save [hidden] { display: none; }

/* tools */
/* The column. It is fixed to the window, not part of the editor's grid (whose first track it covers), so the project
   list can stand beside the very same one. Its head and entries match the site's sidebar. */
.ds-index { position: fixed; z-index: 30; top: 0; bottom: 0; left: 0; display: flex; width: var(--ds-side); flex-direction: column; background: var(--ds-surface); border-right: 1px solid var(--ds-rule); }
.ds-side-top { display: flex; flex: none; align-items: center; justify-content: space-between; min-height: 64px; padding: env(safe-area-inset-top) 12px 0 22px; }
.ds-side-top .ds-brand { display: inline-flex; min-height: 44px; align-items: center; }
.ds-side-top .ds-brand img { height: 22px; }
.ds-side-collapse { width: 40px; height: 40px; }
.ds-side-close { display: none; min-width: 40px; min-height: 40px; padding: 0 8px; }
.ds-root .ds-side-close { color: var(--ds-ink); font-size: 14px; font-weight: 500; text-decoration: none; }
.ds-nav { flex: none; padding: 0 12px; }
.ds-nav-item { display: flex; min-height: 40px; align-items: center; gap: 12px; padding: 0 10px; color: var(--ds-ink); font-size: 14px; font-weight: 500; text-decoration: none; }
.ds-nav-item svg { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ds-nav-item:hover { background: var(--ds-hover); }
.ds-nav-item[aria-current="page"] { background: var(--ds-ink); color: var(--ds-on-ink); }
.ds-index .ds-section-head { flex: none; margin: 10px 12px 0; padding: 14px 10px 4px; border-top: 1px solid var(--ds-rule); font-size: 13px; line-height: 18px; }
/* The site sidebar's card: ink on the page's other ground. */
.ds-side-foot { flex: none; margin-top: auto; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
.ds-side-foot[hidden] { display: none; }
.ds-card { padding: 14px; background: var(--ds-ink); color: var(--ds-on-ink); }
.ds-card p { margin: 0 0 12px; font-size: 13px; line-height: 1.5; }
.ds-card strong { display: block; margin-bottom: 4px; font-size: 14px; font-weight: 600; }
.ds-card-link { display: flex; min-height: 40px; align-items: center; justify-content: center; background: var(--ds-surface); color: var(--ds-ink); font-size: 13px; font-weight: 600; text-decoration: none; }
.ds-card { position: relative; }
.ds-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.ds-card .ds-card-head strong { margin: 0; line-height: 1.5; }
.ds-root .ds-qr-toggle, .ds-qr-mark { display: inline-flex; flex: none; width: 32px; height: 32px; margin: -6px -6px -6px 0; align-items: center; justify-content: center; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; }
.ds-root .ds-qr-toggle[hidden], .ds-qr-mark[hidden] { display: none; }
.ds-qr-toggle svg, .ds-qr-mark svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
/* The code opens over the list, as one piece with the card, so nothing moves to make room for it. */
.ds-qr { position: absolute; z-index: 2; right: 0; bottom: 100%; left: 0; display: none; padding: 16px 14px 12px; border-bottom: 1px solid color-mix(in srgb, var(--ds-on-ink) 22%, transparent); background: var(--ds-ink); color: var(--ds-on-ink); }
.ds-card.is-qr-open .ds-qr:not([hidden]), .ds-card:not(.is-qr-dismissed):has(.ds-qr-toggle:focus-visible) .ds-qr:not([hidden]) { display: block; }
@media (hover: hover) { .ds-card:not(.is-qr-dismissed):hover .ds-qr:not([hidden]) { display: block; } }
.ds-qr img { display: block; width: 160px; height: 160px; margin: 0 auto; }
.ds-qr small { display: block; margin-top: 10px; font-size: 12px; text-align: center; }
@media (pointer: coarse) { .ds-root .ds-qr-toggle, .ds-qr-mark { width: 44px; height: 44px; margin: -12px -12px -12px 0; } }
/* Folded, the column is gone: the head of it stays in the bar's left end, with the way to open it again and the
   wordmark home, and the bar starts after them. */
@media (min-width: 1100px) {
  .ds-collapsed .ds-index { bottom: auto; width: 140px; height: 48px; border-right: 0; border-bottom: 1px solid var(--ds-rule); overflow: hidden; }
  .ds-collapsed .ds-index > :not(.ds-side-top) { display: none; }
  .ds-collapsed .ds-side-top { justify-content: flex-start; gap: 8px; min-height: 47px; padding: 0 0 0 8px; }
  .ds-collapsed .ds-side-collapse { order: -1; }
  html[data-shell="desktop"].ds-collapsed .ds-top { padding-left: 140px; }
}
/* On a short window the whole column scrolls, so the list is never squeezed to nothing. */
@media (max-height: 600px) {
  .ds-index { overflow-y: auto; }
  .ds-index .ds-scroll { flex: none; overflow: visible; }
  .ds-side-foot { margin-top: 0; }
}
.ds-section-head { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 14px 8px; }
.ds-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.ds-tool-list { padding: 0 12px 12px; }
.ds-all { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--ds-rule); }
.ds-start-over .ds-note { margin-bottom: 8px; }
.ds-start-over { margin-top: 18px; padding-top: 4px; border-top: 1px solid var(--ds-rule); }
.ds-group { padding: 10px 10px 4px; font-size: 12px; color: var(--ds-mute); }
.ds-tool { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; font-size: 14px; font-weight: 500; background: transparent; text-align: left; cursor: pointer; }
.ds-tool:hover { background: var(--ds-hover); }
/* The chosen tool is a solid block, as in the site's sidebar. */
.ds-tool[aria-current="true"] { background: var(--ds-ink); color: var(--ds-on-ink); }
.ds-tool[aria-current="true"] .ds-pro { color: var(--ds-on-ink); }
.ds-tool-name { flex: 1; min-width: 0; }
.ds-pro { font-size: 12px; color: var(--ds-accent); }

/* inspector */
.ds-inspector { grid-column: 3; grid-row: 2; display: flex; flex-direction: column; min-height: 0; background: var(--ds-surface); border-left: 1px solid var(--ds-rule); }
.ds-tabbar { display: flex; align-items: flex-start; border-bottom: 1px solid var(--ds-rule); }
/* Tabs that do not fit take a second row; none is scrolled out of sight. */
.ds-tabs { flex: 1; display: flex; flex-wrap: wrap; min-width: 0; padding: 0 6px; }
.ds-sheet-toggle { display: none; }
.ds-tab { flex: 0 0 auto; height: 36px; padding: 0 7px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--ds-mute); cursor: pointer; }
.ds-tab[aria-selected="true"] { color: var(--ds-ink); border-bottom-color: var(--ds-accent); font-weight: 600; }
.ds-panel { flex: 1; min-height: 0; overflow: auto; padding: 6px 14px 14px; }
.ds-group-title { margin: 14px 0 6px; font-size: 12px; color: var(--ds-mute); font-weight: 400; }
.ds-fields { display: flex; flex-direction: column; }
.ds-field { display: flex; flex-direction: column; gap: 8px; padding: 9px 0; }
.ds-field-row { flex-direction: row; justify-content: space-between; align-items: center; }
.ds-field-head { display: flex; justify-content: space-between; }
.ds-value { font: 12px "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace; color: var(--ds-mute); }
.ds-field input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 18px; margin: 0; background: transparent; cursor: pointer; --fill: 0%; }
.ds-field input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: linear-gradient(to right, var(--ds-ink) var(--fill), var(--ds-rule-strong) var(--fill)); }
.ds-field input[type="range"]::-moz-range-track { height: 2px; background: var(--ds-rule-strong); }
.ds-field input[type="range"]::-moz-range-progress { height: 2px; background: var(--ds-ink); }
.ds-field input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 10px; height: 14px; margin-top: -6px; border: 0; background: var(--ds-ink); }
.ds-field input[type="range"]::-moz-range-thumb { width: 10px; height: 14px; border: 0; background: var(--ds-ink); }
.ds-field input[type="range"]:hover::-webkit-slider-thumb { background: var(--ds-accent); }
.ds-field input[type="range"]:hover::-moz-range-thumb { background: var(--ds-accent); }
.ds-field input[type="range"]:active::-webkit-slider-thumb { background: var(--ds-accent); }
.ds-field input[type="range"]:focus-visible { outline-offset: 4px; }
.ds-field select, .ds-field input[type="text"] { height: 30px; border: 1px solid transparent; background: var(--ds-rule-2); padding: 0 8px; }
.ds-field input[type="color"] { width: 36px; height: 26px; padding: 0; border: 1px solid var(--ds-rule-strong); background: none; }
.ds-segmented { display: flex; background: var(--ds-rule-2); overflow: hidden; }
.ds-seg { flex: 1; min-height: 28px; padding: 5px 6px; line-height: 1.25; border: 0; background: transparent; cursor: pointer; }
.ds-seg[aria-pressed="true"] { background: var(--ds-ink); color: var(--ds-on-ink); }
.ds-readonly .ds-value { color: var(--ds-text-2); }
.ds-note { color: var(--ds-text-2); margin: 12px 0 0; }
.ds-media { display: flex; gap: 12px; align-items: center; margin: 10px 0; }
.ds-media-thumb { width: 72px; height: 72px; object-fit: cover; background: var(--ds-rule-2); flex: none; }
.ds-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.ds-preset { display: flex; align-items: center; }
.ds-preset[aria-current="true"] { background: var(--ds-selected); }
.ds-preset-name { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; text-align: left; border: 0; background: transparent; padding: 7px 4px 7px 10px; cursor: pointer; }
.ds-preset-thumb { width: 56px; height: 42px; flex: none; object-fit: cover; background: var(--ds-rule-2); opacity: 0; transition: opacity 120ms ease; }
.ds-preset-thumb.is-ready { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .ds-preset-thumb { transition: none; } }
.ds-step { display: flex; gap: 10px; width: 100%; padding: 7px 8px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.ds-step[aria-current="true"] { background: var(--ds-selected); font-weight: 600; }
.ds-step[data-future="true"] { color: var(--ds-mute); }
.ds-step-no { font: 11px "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace; color: var(--ds-mute); width: 20px; }
/* The two drop-downs under the bar: what an export will be, and the history. They lie over the controls, so the
   picture stays in sight. The script sets how far down they start. */
.ds-pop { position: fixed; z-index: 45; right: 0; width: 340px; overflow: auto; background: var(--ds-surface); border-left: 1px solid var(--ds-rule); border-bottom: 1px solid var(--ds-rule); box-shadow: 0 16px 32px rgba(0, 0, 0, 0.18); }
.ds-pop[hidden] { display: none; }
.ds-pop:focus { outline: none; }
.ds-output { padding: 0 14px 12px; }
.ds-history-list { padding: 0 14px 12px; }
/* The foot of the controls: the way to the tool's page, and the theme. */
.ds-about { display: flex; flex: none; align-items: center; gap: 10px; min-height: 48px; margin-top: auto; border-top: 1px solid var(--ds-rule); padding: 0 8px 0 14px; padding-bottom: env(safe-area-inset-bottom); }
.ds-about .ds-theme { display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center; margin-left: auto; }
.ds-toolpage[hidden] { display: none; }
.ds-toolpage { display: inline-flex; min-height: 44px; align-items: center; color: var(--ds-text-2); text-decoration: underline; text-underline-offset: 0.3em; }
.ds-toolpage:hover { color: var(--ds-text); }
.ds-output .ds-section-head { padding-left: 0; }
.ds-pop-history .ds-section-head { padding: 12px 14px 8px; }
.ds-toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); padding: 8px 14px; background: var(--ds-ink); color: var(--ds-on-ink); opacity: 0; pointer-events: none; transition: opacity 120ms; z-index: 50; }
.ds-toast.is-on { opacity: 1; }
.ds-export-hint { position: fixed; left: 50%; bottom: 64px; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); padding: 8px 14px; background: var(--ds-ink); color: var(--ds-on-ink); text-align: center; pointer-events: none; z-index: 50; }
.ds-export-hint[hidden] { display: none; }

/* The two controls over the canvas: sentence case, and a ground of their own so they read on any picture. */
html[data-shell="desktop"] .studio-upload-prompt:not([hidden]) { border-color: var(--ds-ink); background: var(--ds-ink); box-shadow: none; color: var(--ds-on-ink); font-size: 14px; font-weight: 600; letter-spacing: 0; text-transform: none; }
html[data-shell="desktop"] .studio-upload-prompt:is(:hover, :focus-visible) { border-color: var(--ds-text-2); background: var(--ds-text-2); }
/* No edge line on the canvas. The shared sheet gives it a faint 1px border and a dark checkerboard behind see-through
   pixels, which showed through the border, and at an edge that falls between pixels, as a dashed line. The squares
   here are two near-equal tones of the theme: see-through areas still read as such, and an edge shows nothing. */
html[data-shell="desktop"] #editorView > .editor-stage :is(#previewCanvas, .editor-comparison-canvas) { border: 0; background: repeating-conic-gradient(var(--ds-rule-2) 0 25%, var(--ds-surface) 0 50%) 0 0 / 16px 16px; }
/* "Try your own photo" has room of its own under the canvas, so it never lies over the picture. There is no compare
   button here; holding B still shows the original. */
html[data-shell="desktop"] #editorView > .editor-stage { padding: 24px clamp(8px, 2.2vw, 44px) 76px !important; }
html[data-shell="desktop"] #editorView .studio-upload-prompt:not([hidden]) { bottom: 16px; }
html[data-shell="desktop"] #editorView .editor-canvas-tools { display: none; }

/* controls the core describes as data, drawn in the shell's own style */
.ds-note-tight { margin: 6px 0; }
.ds-control-action { height: 28px; padding: 0 10px; }
.ds-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.ds-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px solid transparent; background: var(--ds-rule-2); cursor: pointer; }
.ds-chip img { width: 18px; height: 18px; object-fit: cover; }
.ds-chip:hover { background: var(--ds-pressed); }
.ds-chip[aria-pressed="true"] { background: var(--ds-ink); color: var(--ds-on-ink); border-color: var(--ds-ink); }

.ds-subtitle { margin: 12px 0 2px; font-weight: 600; font-size: 12px; }
.ds-picker-wrap { margin: 8px 0; }
.ds-picker { position: relative; display: inline-block; max-width: 100%; line-height: 0; cursor: crosshair; touch-action: none; border: 1px solid var(--ds-rule-strong); user-select: none; }
.ds-picker img { display: block; max-width: 100%; max-height: 220px; pointer-events: none; }
.ds-picker-marker { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1.5px #d85b31, 0 0 0 1px rgba(0,0,0,.35) inset; pointer-events: none; }
.ds-picker-hint { display: block; margin-top: 4px; font: 11px "Geist Mono", ui-monospace, monospace; color: var(--ds-mute); }

/* Controls the core hosts are drawn by the page's own code, written for a dark phone UI. Inside
   their container the page's colour tokens are pointed at the shell's, so both themes read, and
   the few surfaces the page hard-codes dark are set here. The shape and layout stay the page's. */
.ds-mount { margin: 4px 0 12px; }
.ds-mount-host { min-width: 0; color: var(--ds-ink); }
html[data-shell="desktop"] .ds-mount-host,
html[data-shell="desktop"] #editorView > .editor-stage {
  --text: var(--ds-ink); --text-dark: var(--ds-ink); --text-muted: var(--ds-mute);
  --muted: var(--ds-mute); --muted-dark: var(--ds-mute);
  --line: var(--ds-rule); --line-dark: var(--ds-rule); --line-strong: var(--ds-rule-strong);
}
html[data-shell="desktop"] .ds-mount-host {
  --accent: var(--ds-ink); --accent-strong: var(--ds-ink); --accent-ink: var(--ds-on-ink);
  --control-bg: var(--ds-bg); --editor-panel: var(--ds-surface); --editor-panel-soft: var(--ds-bg); --danger: #B3261E;
}
html[data-shell="desktop"] .ds-mount-host :is(.button, button, textarea, input[type="text"], select):not(.is-active):not([aria-pressed="true"]) {
  background-color: var(--ds-surface); color: var(--ds-ink); border-color: var(--ds-rule-strong);
}
html[data-shell="desktop"] .ds-mount-host :is(button:disabled, .button:disabled) { color: var(--ds-disabled-fg); background-color: var(--ds-disabled-bg); }
html[data-shell="desktop"] .ds-mount-host :is(.is-active, [aria-pressed="true"]) { background-color: var(--ds-ink); color: var(--ds-on-ink); }
html[data-shell="desktop"] .ds-mount-host .rebus-photo-thumb { background-color: var(--ds-rule-2); }
/* The page marks the open block with a near-white border, which a light theme cannot show. */
html[data-shell="desktop"] .ds-mount-host .rebus-content-item { border-color: var(--ds-rule-strong); }
html[data-shell="desktop"] .ds-mount-host .rebus-content-item.is-selected { border-color: var(--ds-accent); box-shadow: inset 0 0 0 1px var(--ds-accent); }

/* Rebus's block list is a horizontal strip made for a phone. In a wide inspector it wraps into two
   columns, so every block is in view without scrolling sideways. */
html[data-shell="desktop"] .ds-mount-host .rebus-order-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; padding: 4px 0; }
html[data-shell="desktop"] .ds-mount-host .rebus-order-strip .rebus-content-item { flex: none; min-width: 0; height: 52px; }

/* The page's "start" gate on the empty stage hard-codes light text for a dark stage. */
html[data-shell="desktop"] #editorView > .editor-stage .empty-start-title { color: var(--ds-ink); }
html[data-shell="desktop"] #editorView > .editor-stage .empty-start-description { color: var(--ds-text-2); }
html[data-shell="desktop"] #editorView > .editor-stage .media-action-button { color: var(--ds-text-2); border-color: var(--ds-rule-strong); }
html[data-shell="desktop"] #editorView > .editor-stage .media-action-button.is-primary { background: var(--ds-ink); color: var(--ds-on-ink); border-color: var(--ds-ink); }

/* dialog */
.ds-dialog { border: 1px solid var(--ds-rule-strong); padding: 0; background: var(--ds-surface); color: var(--ds-ink); width: min(360px, calc(100vw - 32px)); }
.ds-dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.ds-dialog-body { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.ds-dialog-title { margin: 0; font-weight: 600; }
.ds-dialog input[type="text"] { height: 32px; border: 1px solid var(--ds-rule-strong); background: var(--ds-bg); padding: 0 8px; }
.ds-dialog .ds-actions { justify-content: flex-end; margin: 0; }
.ds-danger { background: #B3261E; border-color: #B3261E; color: #fff; }

/* The page's "keep creating on your iPhone" card. Wherever the controls have a column of their own (820 px and up) the card sits in it, above the row that holds
 * "About this tool" and the theme: the canvas fills the stage's full height, so a card there always covers part of the
 * exported result. It shows only while the tool column's own iPhone card is out of sight (runtime.js), since it cannot
 * sit over that column. It stacks: copy, code, link. */
@media (min-width: 820px) {
  html[data-shell="desktop"] .ios-app-promotion,
  html[data-shell="desktop"] .ios-app-promotion.has-qr {
    top: auto;
    left: auto;
    right: 12px;
    bottom: calc(61px + env(safe-area-inset-bottom));
    width: 316px;
    grid-template-columns: minmax(0, 1fr) 28px;
    grid-template-areas:
      "copy dismiss"
      "qr qr"
      "link link";
    gap: 12px;
  }
  html[data-shell="desktop"] .ios-app-promotion.has-qr .ios-app-promotion-qr { justify-self: start; }
  html[data-shell="desktop"] .ios-app-promotion.has-qr .ios-app-promotion-link { justify-self: stretch; justify-content: space-between; }
}
/* The controls' column is 300 px here. */
@media (min-width: 820px) and (max-width: 1099px) {
  html[data-shell="desktop"] .ios-app-promotion,
  html[data-shell="desktop"] .ios-app-promotion.has-qr { width: 276px; }
}

/* A phone has no column to move the card to. The canvas fills the stage, so the card becomes one slim row in the free
 * band between the top bar and the canvas: the line, the App Store link, the close button. The code and the bullet
 * points are left out; the link works on the phone, and the card is for the next export, not a second ad. */
@media (max-width: 819px) {
  html[data-shell="desktop"] .ios-app-promotion,
  html[data-shell="desktop"] .ios-app-promotion.has-qr {
    top: 100px;
    right: 12px;
    bottom: auto;
    left: 12px;
    width: auto;
    min-height: 0;
    padding: 6px 4px 6px 12px;
    grid-template-columns: minmax(0, 1fr) auto 28px;
    grid-template-areas: "copy link dismiss";
    align-items: center;
    gap: 10px;
  }
  html[data-shell="desktop"] .ios-app-promotion .ios-app-promotion-copy span,
  html[data-shell="desktop"] .ios-app-promotion .ios-app-promotion-points,
  html[data-shell="desktop"] .ios-app-promotion .ios-app-promotion-scan,
  html[data-shell="desktop"] .ios-app-promotion .ios-app-promotion-qr { display: none; }
  html[data-shell="desktop"] .ios-app-promotion .ios-app-promotion-copy strong {
    overflow: visible;
    font-size: 13px;
    text-overflow: clip;
    white-space: normal;
  }
  html[data-shell="desktop"] .ios-app-promotion .ios-app-promotion-link { min-height: 32px; justify-self: end; }
  html[data-shell="desktop"] .ios-app-promotion .ios-app-promotion-dismiss { height: 32px; }
}

/* Narrower than 1100 px the tool list leaves its column and becomes a drawer over the stage (the Tools button in the
 * bar opens it); the inspector keeps its column, a little narrower. */
.ds-tools-toggle { display: none; }
@media (min-width: 1100px) {
  .ds-top > .ds-brand { display: none; }
}
@media (max-width: 1099px) {
  html[data-shell="desktop"] #editorView { grid-template-columns: minmax(0, 1fr) 300px !important; }
  html[data-shell="desktop"] #editorView > .editor-stage { grid-column: 1 !important; border-left: 0; }
  .ds-inspector { grid-column: 2; }
  .ds-pop { width: 300px; }
  .ds-top { grid-column: 1 / -1; }
  .ds-menu-bar { display: inline-block; }
  /* Over the project list the button stands where that page's own wordmark was (studio-web.css leaves it room). */
  html[data-ds-view="picker"] .ds-menu-picker { position: fixed; z-index: 25; top: calc(env(safe-area-inset-top) + 8.5px); left: 73.6px; display: inline-block; }
  .ds-nav-item, .ds-tool { min-height: 44px; }
  .ds-index { width: min(320px, 86vw); box-shadow: 8px 0 24px rgba(0, 0, 0, 0.35); transition: transform 180ms ease-out; }
  .ds-side-close { display: inline-block; }
  .ds-side-collapse { display: none; }
  .ds-root[data-tools="closed"] .ds-index { transform: translateX(-100%); visibility: hidden; transition: transform 180ms ease-out, visibility 0s 180ms; }
}
@media (prefers-reduced-motion: reduce) { .ds-index, .ds-root[data-tools="closed"] .ds-index { transition: none; } }

/* A phone (under 820 px): one column. The bar has two rows (the essentials, then a strip that scrolls sideways), the
 * canvas takes the rest, and the controls are a sheet under it: just the tabs while closed, half the screen open. The
 * tool list is the same drawer as on a narrow window, over everything. */
@media (max-width: 819px) {
  html[data-ds-view="picker"] .ds-menu-picker { top: calc(env(safe-area-inset-top) + 9px); left: 67.6px; }
  html[data-shell="desktop"] #editorView { grid-template-columns: minmax(0, 1fr) !important; grid-template-rows: auto minmax(0, 1fr) auto !important; }
  html[data-shell="desktop"] #editorView > .editor-stage { grid-column: 1 !important; grid-row: 2 !important; border: 0; padding: 8px 0 !important; }
  /* The prompt's room is kept only while it shows: with the sheet open there is little to spare. The page sizes the
     picture by the whole stage's height (--stage-preview-height), so the padding comes out of that here. */
  html[data-shell="desktop"] #editorView > .editor-stage :is(#previewCanvas, .editor-comparison-canvas) { max-height: calc(var(--stage-preview-height) - 16px); }
  html[data-shell="desktop"] #editorView > .editor-stage:has(.studio-upload-prompt:not([hidden])) { padding-bottom: 64px !important; }
  html[data-shell="desktop"] #editorView > .editor-stage:has(.studio-upload-prompt:not([hidden])) :is(#previewCanvas, .editor-comparison-canvas) { max-height: calc(var(--stage-preview-height) - 72px); }
  html[data-shell="desktop"] #editorView .studio-upload-prompt:not([hidden]) { bottom: 10px; }
  .ds-top { flex-wrap: wrap; row-gap: 0; padding: 0 10px; }
  .ds-top > * { order: 1; }
  .ds-top::after { content: ""; order: 1; flex-basis: 100%; height: 0; }
  .ds-top > .ds-title, .ds-top > .ds-save, .ds-top > .ds-random, .ds-top > .ds-live, .ds-top > .ds-history { order: 2; }
  .ds-top > .ds-brand, .ds-top > .ds-tools-toggle, .ds-top > .ds-spacer, .ds-top > .ds-undo, .ds-top > .ds-redo, .ds-top > .ds-export-group { height: 48px; display: inline-flex; align-items: center; }
  .ds-top > .ds-undo, .ds-top > .ds-redo { justify-content: center; }
  .ds-top > .ds-tools-toggle { height: 30px; margin-block: 9px; }
  .ds-top .ds-export { min-width: 0; height: 32px; padding: 0 12px; }
  .ds-top .ds-export-more { height: 32px; }
  .ds-pop { left: 0; width: auto; border-left: 0; }
  .ds-top > .ds-title, .ds-top > .ds-save, .ds-top > .ds-random, .ds-top > .ds-live, .ds-top > .ds-history { height: 36px; display: inline-flex; align-items: center; flex: none; }
  .ds-top > .ds-save[hidden] { display: none; }
  /* Not a flex box, so a long name ends in an ellipsis instead of being cut mid-letter. */
  .ds-top > .ds-title { display: block; max-width: 24vw; line-height: 35px; }
  .ds-top > .ds-live { height: 30px; min-height: 0; padding: 0 10px; }
  .ds-top > .ds-random { width: 32px; height: 32px; justify-content: center; padding: 0; }
  .ds-top > .ds-history { width: 32px; height: 32px; justify-content: center; }
  .ds-top { column-gap: 8px; }
  .ds-inspector { grid-column: 1; grid-row: 3; border-left: 0; border-top: 1px solid var(--ds-rule); max-height: 52vh; }
  .ds-tab { flex: none; }
  .ds-sheet-toggle { display: inline-flex; width: 44px; height: 36px; flex: none; }
  .ds-sheet-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
  .ds-root[data-sheet="closed"] .ds-panel, .ds-root[data-sheet="closed"] .ds-about { display: none; }
  .ds-root[data-sheet="open"] .ds-inspector { height: 52vh; }
}

/* A finger needs more than a mouse does. */
@media (pointer: coarse) {
  .ds-btn, .ds-export, .ds-export-more { min-height: 40px; }
  .ds-export-more { width: 40px; }
  .ds-icon { width: 40px; height: 40px; }
  .ds-small { width: 32px; height: 32px; }
  .ds-tab { height: 44px; padding: 0 10px; }
  .ds-tool { padding-block: 12px; }
  .ds-seg { min-height: 40px; }
  .ds-field input[type="range"] { height: 32px; }
  .ds-field input[type="range"]::-webkit-slider-thumb { width: 18px; height: 22px; margin-top: -10px; }
  .ds-field select, .ds-field input[type="text"] { height: 40px; font-size: 16px; }
}
/* A narrow phone: the bar's first row has to hold the wordmark, Menu, undo, redo and Export with its arrow, down to
   320px, with finger-sized buttons too. Export says only that, and the gaps close up; Menu stays where it was, on the
   spot the loading screen draws it. */
@media (max-width: 429px) {
  .ds-top { column-gap: 4px; }
  .ds-top > .ds-tools-toggle { margin-left: 4px; }
  .ds-top > .ds-undo, .ds-top > .ds-redo { width: 32px; padding: 0; }
  .ds-top .ds-export { max-width: 104px; padding: 0 10px; }
  .ds-top .ds-export-more { width: 32px; }
  .ds-export-kind { display: none; }
  .ds-export-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
/* The finger-sized buttons are 40px tall, so they need less room above and below to stay on the 48px bar's line. */
@media (pointer: coarse) and (max-width: 1099px) {
  html[data-shell="desktop"][data-ds-view="picker"] .ds-menu-picker { top: calc(env(safe-area-inset-top) + 3.5px); }
}
@media (pointer: coarse) and (max-width: 819px) {
  .ds-top > .ds-tools-toggle { margin-block: 4px; }
  .ds-top .ds-export, .ds-top .ds-export-more { min-height: 40px; height: 40px; }
}
