/* =========================================================================
   Image editor shell (image-editor.html). Builds on marker.css tokens.

   Desktop: top bar, tool rail left, canvas middle, properties right,
   handoff bar under the canvas. Phones (760 px and below) and portrait
   touch tablets up to 900 px wide: top bar, canvas, a bottom sheet for
   properties, and a scrolling tool bar. image-shell.js msShell.isPhone()
   matches the same query.
   ========================================================================= */

html, body.editor { height: 100%; }
body.editor {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  background: var(--surface);
}

/* ---- Top bar ---------------------------------------------------------- */
.ed-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  min-height: 60px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex-shrink: 0;
}
.ed-top-left { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1 1 0; }
.ed-top .brand { font-size: 21px; line-height: 1; }
.ed-sep { width: 1px; height: 24px; background: var(--line); flex-shrink: 0; }
.ed-back { display: none; }
.ed-file { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.ed-name {
  font: 600 14px/20px var(--font-body);
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 4px;
  margin-left: -5px;
  min-width: 60px;
  max-width: 320px;
  text-overflow: ellipsis;
}
.ed-name:hover { border-color: var(--control-border); }
.ed-name:focus { border-color: var(--field-border); outline: 2px solid var(--selection); outline-offset: 1px; }
.ed-status { font-size: 12px; line-height: 16px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-history { display: flex; align-items: center; gap: 4px; }
.ed-history .btn { width: 40px; height: 40px; }
.ed-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--s2); flex: 1 1 0; }
.ed-actions .btn { height: 40px; }
.ed-share { display: none; }

/* ---- Body ------------------------------------------------------------- */
.ed-body { flex: 1; display: flex; min-height: 0; }

.ed-rail {
  flex: 0 0 64px;
  border-right: 1px solid var(--line);
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  overflow-y: auto;
  background: var(--surface);
}
.ed-tool {
  width: 44px; height: 44px;
  border: 0;
  border-radius: var(--r-control);
  background: transparent;
  color: var(--ink-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  flex-shrink: 0;
}
.ed-tool:hover { background: var(--raised); color: var(--ink); }
.ed-tool[aria-pressed="true"] { background: var(--marker-tint); color: var(--marker); }
.ed-tool-label { display: none; }
.ed-rail-sep { width: 28px; height: 1px; background: var(--line); margin: 6px 0; flex-shrink: 0; }
.ed-rail-more { display: none; }
/* Mark Up's grouped rail: Shapes and More open a menu beside the rail, and
   every rail tool shows its name and key on hover or keyboard focus. */
.ed-rail-menu {
  position: fixed;
  z-index: 60;
  min-width: 200px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-popover);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ed-rail-menu[hidden] { display: none; }
.ed-rail-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: 500 14px/20px var(--font-body);
  text-align: left;
  cursor: pointer;
}
.ed-rail-item .icon { color: var(--ink-2); flex-shrink: 0; }
.ed-rail-item:hover { background: var(--raised); }
.ed-rail-item[aria-checked="true"] { background: var(--marker-tint); font-weight: 600; }
.ed-rail-item[aria-checked="true"] .icon { color: var(--marker); }
.ed-rail-item-name { flex: 1; }
.ed-rail-item kbd, .ed-tip kbd {
  font: 500 12px/18px var(--font-body);
  color: var(--muted);
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.ed-tip {
  position: fixed;
  z-index: 61;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--toast-bg, #141414);
  color: var(--toast-ink, #FFFFFF);
  border-radius: 8px;
  font: 600 13px/18px var(--font-body);
  white-space: nowrap;
  pointer-events: none;
}
.ed-tip[hidden] { display: none; }
.ed-tip kbd { color: inherit; border-color: currentColor; opacity: .75; }

.ed-main { flex: 999 1 0; min-width: 0; display: flex; flex-direction: column; background: var(--canvas); }
.ed-stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  touch-action: none;
  outline: none;
}
/* Mark Up keeps the canvas as a tab stop (arrows move the selected mark),
   so it shows the focus ring, inside its edge. */
.ed-stage:focus-visible { outline: 2px solid var(--selection); outline-offset: -4px; }
/* After a finger or pen moved focus to the canvas, the ring stays off
   until a key is pressed (image-core.js sets data-input). */
html[data-input="touch"] .ed-stage:focus-visible, html[data-input="touch"] .st-shot canvas:focus-visible { outline: none; }
.ed-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.ed-stage.is-drop::after {
  content: "Drop to Open";
  position: absolute;
  inset: 16px;
  border: 2px dashed var(--marker);
  border-radius: var(--r-card);
  background: color-mix(in srgb, var(--marker-tint) 80%, transparent);
  color: var(--marker-text);
  font: 700 20px/26px var(--font-head);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ed-float-history { display: none; }

.ed-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--paper);
  flex-shrink: 0;
}
.ed-handoffs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.ed-handoffs[hidden], .ed-bar-end .btn[hidden] { display: none; }
.ed-handoffs-label { font-size: 13px; color: var(--muted); margin-right: 4px; }
.ed-bar-end { display: flex; align-items: center; gap: var(--s2); margin-left: auto; }
/* When the chips do not fit beside the status, they take a row of their
   own under it; in a narrow bar that row scrolls sideways. */
.ed-bar { container: edbar / inline-size; }
@container edbar (max-width: 1100px) {
  .ed-next { order: 3; flex-basis: 100%; }
}
@container edbar (max-width: 560px) {
  .ed-next { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
  .ed-next::-webkit-scrollbar { display: none; }
  .ed-next .chip, .ed-next .ed-handoffs-label { flex-shrink: 0; white-space: nowrap; }
}
/* Touch-first tablets rarely have a keyboard attached. */
@media (pointer: coarse) { .ed-keys-btn { display: none; } }
.ed-brand-btn { gap: 6px; padding: 0 10px; }
.ed-keys-btn { color: var(--ink-2); }
.ed-zoom {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--control-border);
  border-radius: var(--r-control);
  padding: 2px;
  margin-left: auto;
}
.ed-zoom button {
  width: 32px; height: 32px;
  border: 0; border-radius: 8px;
  background: transparent;
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.ed-zoom button:hover { background: var(--raised); }
.ed-zoom button[aria-pressed="true"] { background: var(--raised); }
.ed-zoom-value {
  font: 600 13px/18px var(--font-body);
  min-width: 52px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--ink);
  border-radius: 8px;
  cursor: pointer;
}

/* ---- Properties ------------------------------------------------------- */
.ed-props {
  flex: 0 0 320px;
  /* After the canvas on screen, though first in the page (tab order). */
  order: 1;
  border-left: 1px solid var(--line);
  background: var(--surface);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.ed-sheet-handle { display: none; }
.ed-props-body { padding: 18px; display: flex; flex-direction: column; gap: 22px; }
.ed-props-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); min-height: 36px; }
.ed-props-head h2 { font-size: 18px; line-height: 24px; letter-spacing: -.02em; }
.ed-props-hint { font-size: 13px; line-height: 18px; color: var(--muted); margin-top: -12px; }
.ed-group { display: flex; flex-direction: column; gap: 8px; }
.ed-group-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s2); }
.ed-label { font-size: 13px; line-height: 18px; color: var(--muted); }
.ed-value { font-size: 13px; line-height: 18px; font-weight: 600; }
.ed-swatches { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ed-props .segmented button { padding: 0 6px; white-space: nowrap; }
.ed-swatches .swatch { width: 32px; height: 32px; }
.ed-custom-color {
  position: relative;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px dashed var(--field-border);
  background: var(--surface);
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  cursor: pointer;
}
.ed-custom-color input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0; }
.ed-custom-color.is-on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); border-style: solid; }
.ed-toggle { display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: 500; min-height: 44px; cursor: pointer; }
.ed-props .textarea { min-height: 72px; font-size: 14px; }
.ed-meta { font-size: 13px; color: var(--muted); }
.ed-row-buttons { display: flex; flex-wrap: wrap; gap: var(--s2); }

.ed-layers { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--line); padding-top: 16px; }
.ed-layers .ed-label { padding-bottom: 6px; }
.ed-layer {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: 400 14px/20px var(--font-body);
  text-align: left;
  cursor: pointer;
  width: 100%;
}
.ed-layer span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-layer .icon { color: var(--muted); }
.ed-layer:hover { background: var(--raised); }
.ed-layer-list { display: flex; flex-direction: column; gap: 2px; }
.ed-layer-row { display: flex; align-items: center; gap: 2px; border-radius: 8px; position: relative; }
.ed-layer-row .ed-layer { flex: 1; min-width: 0; }
.ed-layer-grip {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 40px; flex-shrink: 0;
  color: var(--muted);
  border-radius: 8px;
  cursor: grab;
  touch-action: none;
}
.ed-layer-grip:hover { background: var(--raised); color: var(--ink); }
.ed-layer-row.is-dragging { opacity: .55; }
.ed-layer-row.is-drop-before::before, .ed-layer-row.is-drop-after::after {
  content: "";
  position: absolute;
  left: 6px; right: 6px;
  height: 2px;
  border-radius: 2px;
  background: var(--selection);
}
.ed-layer-row.is-drop-before::before { top: -2px; }
.ed-layer-row.is-drop-after::after { bottom: -2px; }
/* Mark Up layers: each row's color, and Hide and Lock. A hidden mark's
   row fades; the pressed toggles show in ink. */
.ed-layer-dot { flex: none; width: 10px; height: 10px; margin-left: auto; border-radius: 50%; border: 1px solid var(--field-border); }
.ed-layer.is-hidden .ed-layer-name { color: var(--muted); }
.ed-layer.is-hidden .icon, .ed-layer.is-hidden .ed-layer-dot { opacity: .5; }
.ed-layer-tog {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 40px; flex-shrink: 0; padding: 0;
  border: 0; border-radius: 8px; background: transparent;
  color: var(--muted); cursor: pointer;
}
.ed-layer-tog:hover { background: var(--raised); color: var(--ink); }
.ed-layer-tog[aria-pressed="true"] { color: var(--ink); }
.ed-layer-tog:focus-visible { outline: 2px solid var(--selection); outline-offset: 2px; }
.ed-head-actions { display: flex; align-items: center; gap: 2px; margin-right: -6px; }
.ed-props-head .ed-group-row { align-items: center; }
.ed-layer[aria-current="true"] { background: var(--marker-tint); font-weight: 600; }

/* Smart Redact: Find Private Text, its progress, and the found list. */
.ed-smart { border-top: 1px solid var(--line); padding-top: 16px; }
.ed-smart progress {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border: 0;
  border-radius: 99px;
  background: var(--raised);
  color: var(--ink);
  overflow: hidden;
}
.ed-smart progress::-webkit-progress-bar { background: var(--raised); border-radius: 99px; }
.ed-smart progress::-webkit-progress-value { background: var(--ink); border-radius: 99px; }
.ed-smart progress::-moz-progress-bar { background: var(--ink); border-radius: 99px; }
.ed-smart-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 280px; overflow-y: auto; }
.ed-smart-row { display: flex; align-items: center; gap: var(--s1, 4px); padding: 4px 4px 4px 10px; border-radius: 8px; }
.ed-smart-row:hover, .ed-smart-row:focus-within { background: var(--raised); }
.ed-smart-what { display: flex; flex-direction: column; min-width: 0; flex: 1; cursor: zoom-in; }
.ed-smart-head { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.ed-smart-kind { font-size: 13px; line-height: 18px; color: var(--muted); }
/* Check This One and Partly Covered: a small ink-on-raised chip. */
.ed-smart-tag { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ink); background: var(--surface); border: 1px solid var(--control-border); border-radius: var(--r-chip, 6px); padding: 0 6px; }
.ed-smart-acts { display: flex; gap: 2px; flex-shrink: 0; }
.ed-smart-acts .btn-ghost { padding: 0 8px; }
.ed-smart-fit[hidden] { display: none; }
.ed-smart-text { font-size: 14px; line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-smart-error { color: var(--danger); }
@media (max-width: 760px), (max-width: 900px) and (orientation: portrait) and (pointer: coarse) { .ed-smart-list { max-height: none; overflow: visible; } }

/* App Icon Sizes: the iOS 18 dark and tinted looks. */
.cp-looks { border-top: 1px solid var(--line); padding-top: 16px; }
.cp-look-row { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); min-height: 44px; }
.cp-look-name { display: flex; flex-direction: column; font-size: 14px; line-height: 20px; font-weight: 500; }
.ed-layer[aria-current="true"] .icon { color: var(--marker); }

/* ---- Menus ------------------------------------------------------------ */
.ed-menu {
  position: absolute;
  z-index: 60;
  min-width: 220px;
  padding: 6px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-popover);
  display: flex;
  flex-direction: column;
}
.ed-menu[hidden] { display: none; }
.ed-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: 500 14px/20px var(--font-body);
  text-align: left;
  cursor: pointer;
}
.ed-menu button:hover, .ed-menu button:focus-visible { background: var(--raised); }
.ed-menu .ed-menu-sub { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 400; }

/* ---- Phones ----------------------------------------------------------- */
@media (max-width: 760px), (max-width: 900px) and (orientation: portrait) and (pointer: coarse) {
  .ed-top { min-height: 0; padding: 10px 12px; gap: 8px; }
  .ed-top .brand, .ed-sep, .ed-history { display: none; }
  .ed-back { display: inline-flex; width: 44px; height: 44px; margin-left: -6px; }
  .ed-top-left { gap: 4px; }
  .ed-name { font-size: 15px; max-width: 100%; }
  .ed-copy { display: none; }
  .ed-share { display: inline-flex; }
  .ed-actions .btn { height: 44px; }

  .ed-body { flex-direction: column; position: relative; }
  .ed-main { order: 1; flex: 1 1 auto; min-height: 0; position: relative; }
  .ed-bar { display: none; }
  /* Above the sheet's rounded top, which overlaps the canvas by 16 px. */
  .ed-float-history {
    display: flex;
    position: absolute;
    left: 12px; bottom: 28px;
    gap: 2px;
    background: var(--surface);
    border-radius: 12px;
    padding: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
    z-index: 5;
  }
  .ed-float-history .btn { width: 44px; height: 44px; }

  .ed-props {
    order: 2;
    flex: 0 0 auto;
    /* image-shell.js sets --sheet-h when the handle is dragged. */
    max-height: var(--sheet-h, 40dvh);
    border-left: 0;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -6px 20px rgba(0, 0, 0, .08);
    margin-top: -16px;
    position: relative;
    z-index: 6;
  }
  /* Sticky, so it stays at the top of the sheet while the panel scrolls. */
  .ed-sheet-handle {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 44px;
    border: 0;
    border-radius: 20px 20px 0 0;
    background: var(--surface);
    cursor: grab;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 3;
    touch-action: none;
  }
  .ed-props.is-dragging .ed-sheet-handle { cursor: grabbing; }
  .ed-sheet-handle::before { content: ""; width: 40px; height: 5px; border-radius: 99px; background: var(--control-border); }
  .ed-props-body { padding: 0 16px 14px; gap: 14px; }
  .ed-props.is-collapsed .ed-props-body > :not(.ed-props-head) { display: none; }
  .ed-props.is-collapsed .ed-props-body { padding-bottom: 6px; }
  /* Mark Up and Redact: the sheet keeps its height whatever the tool, so
     the picture never jumps or rezooms when a tool is picked. */
  .is-markup .ed-props:not(.is-collapsed) { height: var(--sheet-h, 40dvh); }
  .ed-props-hint { margin-top: -6px; }
  .ed-head-actions .btn, .ed-props .btn-sm { min-width: 44px; height: 44px; }
  .ed-layer-grip { width: 44px; height: 44px; }
  .ed-layer { min-height: 44px; }

  .ed-rail {
    order: 3;
    flex: 0 0 auto;
    flex-direction: row;
    border-right: 0;
    border-top: 1px solid var(--line);
    padding: 6px 8px 10px;
    gap: 2px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    position: relative;
    z-index: 7;
  }
  /* Each tool is as wide as its label (64 px at least); at 390 px the
     sixth shows in part, and the arrows below say there is more. */
  .ed-tool { flex: 0 0 auto; width: auto; min-width: 64px; padding: 0 6px; height: 56px; border-radius: 12px; font: 500 12px/16px var(--font-body); }
  .ed-tool[aria-pressed="true"] { font-weight: 600; color: var(--ink); }
  .ed-tool[aria-pressed="true"] .icon { color: var(--marker); }
  .ed-tool .icon { width: 22px; height: 22px; }
  .ed-tool-label { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ed-rail-sep { width: 1px; height: 32px; margin: 0 6px; align-self: center; }
  .ed-rail-more:not([hidden]) {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    bottom: 0;
    z-index: 8;
    width: 44px;
    height: 72px;
    padding: 0;
    border: 0;
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
  }
  .ed-rail-more.is-prev { left: 0; border-right: 1px solid var(--line); }
  .ed-rail-more.is-next { right: 0; border-left: 1px solid var(--line); }
}

/* ---- Touch: phones and tablets ---------------------------------------- */
/* Every control people tap is at least 44 px, below about 1024 px (where
   tablets sit) and on any touch screen. */
@media (max-width: 1023px), (any-pointer: coarse) {
  .ed-history .btn, .ed-float-history .btn { width: 44px; height: 44px; }
  .ed-props .segmented button, dialog .segmented button { min-height: 44px; }
  .ed-swatches .swatch, .ed-custom-color { width: 44px; height: 44px; }
  .ed-props .btn-sm, .ed-head-actions .btn { min-width: 44px; height: 44px; }
  .ed-zoom button { width: 44px; height: 44px; }
  .ed-zoom-value { height: 44px; }
  .ed-bar .chip { min-height: 44px; }
  .ed-bar-end .btn-sm { height: 44px; }
  .ed-bar-end .btn-icon.btn-sm { width: 44px; }
  .ed-layer, .ed-menu button { min-height: 44px; }
  .ed-layer-grip { width: 44px; height: 44px; }
  .ed-layer-tog { width: 44px; height: 44px; }
  dialog .dialog-head .btn-icon.btn-sm { width: 44px; height: 44px; }
  .ed-actions .btn { height: 44px; }
  .ed-back { flex-shrink: 0; }
  /* The project name takes a 44 px tap. Its margins keep the bar as it
     was, and the save line under it lets the taps through. */
  .ed-name { height: 44px; margin-top: -11px; margin-bottom: -11px; position: relative; }
  .ed-status { position: relative; pointer-events: none; }
}

/* ---- Small windows and tablets: more room for the picture (t2) -------- */
/* Between the phone layout and 900 px the panel narrows, so a wide
   screenshot shows larger while covers are placed. */
@media (min-width: 761px) and (max-width: 900px) and (orientation: landscape), (min-width: 761px) and (max-width: 900px) and (pointer: fine), (min-width: 761px) and (max-width: 900px) and (pointer: none) {
  .ed-props { flex-basis: 272px; }
  .ed-props-body { padding: 14px; gap: 18px; }
  .ed-props .segmented button { padding: 0 4px; font-size: 13px; }
}

/* ---- Touch tablets: tool names under the rail icons ------------------- */
/* Tooltips never show on touch, so the rail carries its labels. */
@media (min-width: 901px) and (any-pointer: coarse), (min-width: 761px) and (orientation: landscape) and (any-pointer: coarse), (min-width: 761px) and (pointer: fine) and (any-pointer: coarse) {
  .ed-rail { flex-basis: 84px; padding: 8px 4px; gap: 2px; }
  .ed-tool { width: 76px; height: auto; min-height: 56px; padding: 6px 2px; border-radius: 12px; font: 500 12px/14px var(--font-body); gap: 4px; }
  .ed-tool[aria-pressed="true"] { font-weight: 600; color: var(--ink); }
  .ed-tool[aria-pressed="true"] .icon { color: var(--marker); }
  .ed-tool-label { display: block; max-width: 100%; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ed-rail-sep { width: 40px; }
  .ed-top .brand { display: inline-flex; align-items: center; min-height: 44px; }
}

/* =========================================================================
   App Store Screenshots (store-editor.js): a strip of screens in the stage.
   ========================================================================= */
.is-store .ed-stage { overflow-x: auto; overflow-y: hidden; touch-action: pan-x; }
.st-strip {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 24px 32px 16px;
  width: max-content;
  min-width: 100%;
  min-height: 100%;
  box-sizing: border-box;
  justify-content: center;
}
.st-item { display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }
.st-strip > .st-add { margin-bottom: 44px; }
/* Centered, so a label row wider than a small screen leaves the ring on
   the screen itself. */
.st-shot { align-self: center; border-radius: 4px; line-height: 0; box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(20, 20, 20, .08); }
.is-store .ed-stage .st-shot canvas { position: static; display: block; border-radius: 4px; cursor: pointer; }
.st-shot canvas:focus-visible { outline: 2px solid var(--selection); outline-offset: 2px; }
.st-shot.is-current { box-shadow: 0 0 0 2px var(--canvas), 0 0 0 4px var(--selection); }
.st-shot.is-drop { box-shadow: 0 0 0 2px var(--canvas), 0 0 0 4px var(--marker); }
/* A panorama: the screens touch, square cornered, so the joins show. The
   current screen's ring sits over its neighbors' edges. */
.st-strip.is-joined .st-shot, .is-store .ed-stage .st-strip.is-joined .st-shot canvas { border-radius: 0; }
.st-strip.is-joined .st-shot { box-shadow: none; position: relative; }
.st-strip.is-joined .st-shot.is-current { z-index: 1; box-shadow: 0 0 0 2px var(--selection); }
.st-strip.is-joined .st-shot.is-drop { z-index: 1; box-shadow: 0 0 0 2px var(--marker); }
.st-label { display: flex; align-items: center; justify-content: space-between; min-height: 36px; font-size: 13px; font-weight: 600; color: var(--ink-2); padding-left: 2px; }
.st-label .btn { width: 36px; height: 36px; color: var(--muted); }
.st-add {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px dashed var(--field-border);
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font: 600 14px/20px var(--font-body);
  cursor: pointer;
}
.st-add:hover { border-color: var(--ink); color: var(--ink); background: color-mix(in srgb, var(--surface) 50%, transparent); }
.st-add:disabled { opacity: .5; cursor: default; }
.is-store .ed-stage.is-drop-add .st-add { border-color: var(--marker); color: var(--marker-text); }

/* The actions take their natural width, so the size picker shows whole
   names; only the picker shrinks when the bar runs out of room. */
.is-store .ed-actions { flex: 0 1 auto; min-width: 0; }
.is-store .ed-actions > .btn { flex-shrink: 0; }
.st-preview { min-width: 0; flex: 0 1 auto; display: flex; }
.st-preview[hidden] { display: none; }
.st-preview .select { height: 40px; width: auto; min-width: 150px; max-width: 320px; font-size: 14px; }
.st-check { gap: 8px; }
.st-check-short { display: none; }
@media (min-width: 901px), (min-width: 761px) and (orientation: landscape), (min-width: 761px) and (pointer: fine), (min-width: 761px) and (pointer: none) {
  .is-store .ed-top-left { min-width: 180px; }
}
.is-store .ed-actions .btn-primary .icon { margin-left: 2px; }

.st-note { display: flex; gap: 8px; margin: 0; font-size: 13px; line-height: 18px; color: var(--ink-2); }
.st-note .icon { flex-shrink: 0; margin-top: 1px; }
.st-note.is-warn .icon { color: var(--warning); }
.st-status { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.st-status.is-ok .icon { color: var(--success); }
.st-status.is-warn .icon { color: var(--warning); }

.st-row { display: grid; grid-template-columns: 1.5fr 1fr; gap: 12px; }
.st-row .field, .st-row .ed-group { min-width: 0; }
.st-sub { font-size: 16px; line-height: 22px; letter-spacing: -.01em; margin-bottom: -10px; }
.st-link { font-size: 14px; }
.st-noframe {
  background: var(--surface);
  border: 1px dashed var(--field-border);
  position: relative;
}
.st-noframe::after {
  content: "";
  position: absolute;
  left: 50%; top: 4px; bottom: 4px;
  width: 1.5px;
  background: var(--muted);
  transform: rotate(45deg);
}
.st-phone-only { display: none; }

.st-layouts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.st-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: var(--raised);
  color: var(--ink);
  font: 500 13px/18px var(--font-body);
  cursor: pointer;
}
.st-layout canvas { border-radius: 3px; box-shadow: 0 1px 2px rgba(20, 20, 20, .1); }
.st-layout:hover { border-color: var(--control-border); }
.st-layout[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 600; }

/* Templates: three per row, each the set's first three screens. */
.st-tpl-tabs { margin-bottom: 2px; }
.st-tpl-help { margin: 0; }
.st-tpls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.st-tpl {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 500 13px/18px var(--font-body);
  text-align: left;
  cursor: pointer;
}
.st-tpl canvas {
  display: block;
  box-sizing: content-box;
  max-width: calc(100% - 12px);
  height: auto !important;
  margin: 0;
  padding: 6px;
  border-radius: 10px;
  background: var(--raised);
}
.st-tpl:hover canvas { box-shadow: 0 0 0 1px var(--control-border); }
.st-tpl[aria-pressed="true"] { font-weight: 700; }
.st-tpl[aria-pressed="true"] canvas { box-shadow: 0 0 0 2px var(--ink); }

.st-sizes { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.st-sizes legend { padding: 0 0 6px; }
.st-size {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  cursor: pointer;
}
.st-size input { width: 18px; height: 18px; accent-color: var(--ink); flex-shrink: 0; }
.st-size-name { display: flex; flex-direction: column; flex: 1; font-size: 14px; font-weight: 600; line-height: 20px; }
.st-size-name .ed-meta { font-weight: 400; }
.st-size .tag { white-space: nowrap; }

dialog.st-rules { width: min(520px, calc(100vw - 32px)); }
dialog.st-rules[open] { display: flex; flex-direction: column; gap: 12px; }
.st-rule-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 60vh; overflow-y: auto; }
.st-rule { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.st-rule:first-child { border-top: 0; }
.st-rule .icon { flex-shrink: 0; margin-top: 1px; }
.st-rule.is-ok .icon { color: var(--success); }
.st-rule.is-warn .icon { color: var(--warning); }
.st-rule div { display: flex; flex-direction: column; gap: 2px; font-size: 14px; line-height: 20px; min-width: 0; }
.st-rule span { color: var(--muted); font-size: 13px; line-height: 18px; }

/* Rules keeps a word beside its icon down to 901 px; below that the
   checklist icon stands alone, as Copy's icon does. */
@media (max-width: 1100px) {
  .st-check-label { display: none; }
  .st-check { min-width: 44px; padding: 0; flex-shrink: 0; }
  .st-check:has(.st-check-short) { padding: 0 14px; }
  .st-check-short { display: inline; }
}
@media (max-width: 900px) {
  .st-check:has(.st-check-short) { padding: 0; }
  .st-check-short { display: none; }
  .is-store .ed-top .brand, .is-store .ed-sep { display: none; }
  .is-store .ed-back { display: inline-flex; width: 44px; height: 44px; margin-left: -6px; }
  .is-store .ed-top-left { gap: 4px; min-width: 110px; }
  .st-preview .select { padding-left: 10px; padding-right: 30px; background-position: right 8px center; }
}
/* Touch: the screen menu, Rules, Copy, and the size picker reach 44 px. */
@media (max-width: 1023px), (any-pointer: coarse) {
  .st-label { min-height: 44px; }
  .st-label .btn { width: 44px; height: 44px; }
  .is-store .ed-actions .st-check { height: 44px; min-width: 44px; flex-shrink: 0; }
  .st-preview .select { height: 44px; }
  .st-sizes-head .btn { height: 44px; }
}
@media (max-width: 760px), (max-width: 900px) and (orientation: portrait) and (pointer: coarse) {
  .st-preview { display: none; }
  .st-phone-only { display: flex; }
  .st-check { width: 44px; height: 44px; }
  /* Room under the screens for the floating Undo and Redo. */
  .st-strip { gap: 16px; padding: 16px 16px 86px; justify-content: flex-start; }
}
/* Phones: the size list gives up height so the rules notes, Download, and
   the folders line under it stay in view without scrolling the dialog. */
@media (max-width: 760px), (max-width: 900px) and (orientation: portrait) and (pointer: coarse) {
  .is-store .st-size-scroll { max-height: max(160px, calc(100dvh - 440px)); }
  .is-store dialog#edExport { max-height: calc(100dvh - 24px); }
  .is-store dialog#edExport .st-row { grid-template-columns: 1fr 1fr; }
}
.st-row-font { grid-template-columns: minmax(0, 1fr) 100px; }
.ed-props .st-row-font .select { padding-left: 12px; padding-right: 30px; background-position: right 10px center; font-size: 14px; }
.st-row .segmented button { white-space: nowrap; padding: 0 8px; }
.st-size-scroll { display: flex; flex-direction: column; gap: 16px; max-height: min(52vh, 460px); overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.st-sizes-head { display: flex; justify-content: space-between; align-items: center; }
.st-sizes-head legend { float: left; padding: 0; }
.st-sizes-head .btn { height: 32px; }
.st-size .ed-meta { font-size: 12px; line-height: 16px; }
.is-store dialog#edExport { width: min(580px, calc(100vw - 32px)); }
/* The export button stays in view at the foot of a tall dialog. */
.is-store dialog#edExport #edDownload { position: sticky; bottom: 0; z-index: 1; box-shadow: 0 0 0 8px var(--surface), 0 -16px 16px var(--surface); }
/* On iPhone and iPad, Save to Photos leads, so it is the one that stays in view. */
.is-store dialog#edExport #stShare.btn-primary { position: sticky; bottom: 0; z-index: 1; box-shadow: 0 0 0 8px var(--surface), 0 -16px 16px var(--surface); }
.is-store dialog#edExport #edDownload.btn-outline { position: static; box-shadow: none; }

/* =========================================================================
   Shared text, background, and logo controls (image-text.js, image-core.js).
   ========================================================================= */
/* The font picker from font-picker.js, restyled to Marker. Its panel is
   appended to the body, so these rules are not scoped to the panel. */
.msfp { flex: 1; min-width: 0; }
.msfp-trigger {
  width: 100%;
  min-height: 40px;
  padding: 0 32px 0 12px;
  border-radius: var(--r-control);
  border: 1px solid var(--field-border);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%235E5E5A'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E") no-repeat right 10px center / 16px 16px;
  color: var(--ink);
  font-size: 15px;
  line-height: 20px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.msfp-trigger:focus-visible { outline: 2px solid var(--selection); outline-offset: 2px; }
.msfp-panel {
  position: fixed;
  z-index: 9999;
  display: none;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-popover);
  overflow: hidden;
}
.msfp-panel.show { display: flex; }
.msfp-search {
  flex: 0 0 auto;
  margin: 8px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--r-control);
  border: 1px solid var(--field-border);
  background: var(--surface);
  color: var(--ink);
  font: 400 14px/20px var(--font-body);
}
.msfp-search:focus-visible { outline: 2px solid var(--selection); outline-offset: 1px; }
.msfp-list { flex: 1; overflow-y: auto; padding: 0 6px 6px; }
.msfp-group { padding: 10px 8px 4px; font: 600 12px/16px var(--font-body); color: var(--muted); }
.msfp-row {
  display: block;
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink);
  font-size: 16px;
  line-height: 22px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  opacity: .55;
  transition: opacity .18s ease;
}
.msfp-row.loaded { opacity: 1; }
.msfp-row:hover, .msfp-row.active { background: var(--raised); }
.msfp-row.on { background: var(--marker-tint); font-weight: 600; }
.msfp-empty { padding: 14px 10px; text-align: center; color: var(--muted); font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .msfp-row { transition: none; } }
@media (max-width: 760px), (max-width: 900px) and (orientation: portrait) and (pointer: coarse) { .msfp-trigger, .msfp-row { min-height: 44px; } }

.tx-brand-font { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-brand-font[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.bg-stop { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
/* From and To are the same width (the App Store rows are 1.5 to 1). */
.st-row.bg-stops { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.bg-stop input[type="color"] { width: 100%; height: 40px; padding: 2px; border: 1px solid var(--field-border); border-radius: var(--r-control); background: var(--surface); cursor: pointer; }
/* Six kinds of fill sit in two rows of three. */
.ed-props .segmented.bg-kinds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* The five cover styles (Blur to Replace Text) sit in rows of three. */
.ed-props .segmented.ed-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ed-props .segmented.ed-modes button { min-width: 0; white-space: normal; line-height: 1.2; padding: 4px; }
/* A mesh's base and three colors, side by side. */
.bg-wells { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.bg-wells input[type="color"] { width: 100%; height: 40px; padding: 2px; border: 1px solid var(--field-border); border-radius: var(--r-control); background: var(--surface); cursor: pointer; }
/* The eyedropper sits at the end of a swatch row. */
.ed-eyedrop { display: inline-flex; align-items: center; justify-content: center; background: var(--surface); color: var(--ink); border-style: dashed; border-color: var(--field-border); }
.ed-eyedrop[aria-pressed="true"] { border-style: solid; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--selection); }
.st-own { display: flex; flex-direction: column; gap: 6px; margin-top: -10px; }
.st-lang-row { display: flex; align-items: center; gap: 2px; }
.st-lang-row .ed-layer { flex: 1; min-width: 0; }
.st-lang .select { max-width: 180px; }
/* Compose designs switcher: the design shown has an ink outline. */
.cp-designs .ed-row-buttons { flex-wrap: wrap; }
.cp-design { min-width: 36px; justify-content: center; }
.cp-design[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 700; }
/* Device Mockups' Layout: the device the panel changes. */
.cp-arrange { display: flex; flex-direction: column; gap: 22px; }
.cp-slot[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 700; }
@media (max-width: 760px), (max-width: 900px) and (orientation: portrait) and (pointer: coarse) { .cp-slot { min-height: 44px; } }
@media (max-width: 760px), (max-width: 900px) and (orientation: portrait) and (pointer: coarse) { .cp-design { min-width: 44px; min-height: 44px; } }
/* Beautify presets: a swatch of each look, and the save and rename fields. */
.cp-preset-save { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.cp-preset-save .input, .cp-preset-input { min-width: 0; font-size: 14px; }
.cp-preset-input { flex: 1; height: 40px; }
.cp-preset-swatch {
  flex-shrink: 0;
  width: 32px; height: 24px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background-color: var(--surface);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.cp-preset-swatch.is-clear { border: 1px dashed var(--field-border); }
.cp-preset-swatch > span { width: 66%; height: 58%; background: #FFFFFF; }
/* Beautify on its sample: Use Your Own Screenshot tops the panel, and a
   quiet chip on the canvas says paste and drop work. Touch screens rarely
   paste or drop, so the chip stays off there. */
.cp-own { width: 100%; justify-content: center; }
.cp-paste-hint {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  margin: 0; padding: 4px 12px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  font-size: 13px; line-height: 18px; white-space: nowrap; pointer-events: none;
}
.cp-paste-hint[hidden] { display: none; }
@media (pointer: coarse) { .cp-paste-hint { display: none; } }
/* Device Mockups' position sliders name their two ends under them. */
.cp-ends { display: flex; justify-content: space-between; margin-top: -4px; font-size: 13px; line-height: 18px; color: var(--muted); }
/* While the canvas eyedropper is on: its chip and a crosshair. */
.cp-pick-hint {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  margin: 0; padding: 4px 12px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 13px; line-height: 18px; white-space: nowrap; pointer-events: none;
}
.cp-pick-hint[hidden] { display: none; }
.ed-stage.is-picking, .ed-stage.is-picking canvas { cursor: crosshair; }
/* Beautify's Style panel: its parts split by hairlines, and the starter
   looks drawn with the person's screenshot, four to a row. */
.cp-part { display: flex; flex-direction: column; gap: 18px; padding-top: 20px; border-top: 1px solid var(--line); }
.ed-props-head + .cp-part, .cp-designs + .cp-part { padding-top: 0; border-top: 0; }
.cp-sec { font-size: 15px; line-height: 20px; font-weight: 700; letter-spacing: -.01em; margin: 0; }
.cp-looks-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.cp-look {
  display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-width: 0;
  padding: 0; border: 0; background: none; color: var(--ink-2);
  font: 400 13px/18px var(--font-body); text-align: center; cursor: pointer;
}
.cp-look-pic {
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 4 / 3; border-radius: 6px; border: 1px solid var(--line);
  background: var(--raised); overflow: hidden;
}
.cp-look-pic img { display: block; max-width: 100%; max-height: 100%; }
.cp-look-pic img[hidden] { display: none; }
.cp-look-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-look:hover .cp-look-pic { border-color: var(--control-border); }
.cp-look[aria-current="true"] .cp-look-pic { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.cp-look[aria-current="true"] .cp-look-name { color: var(--ink); font-weight: 600; }
/* Styles (Social Images, YouTube): the style the design wears. */
.cp-look[aria-pressed="true"] .cp-look-pic { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.cp-look[aria-pressed="true"] .cp-look-name { color: var(--ink); font-weight: 600; }
/* Device Mockups: Find a Device and its matches. */
.cp-find-list {
  display: flex; flex-direction: column; margin-top: 4px; padding: 4px;
  border: 1px solid var(--control-border); border-radius: 6px; background: var(--surface);
}
.cp-find-list[hidden] { display: none; }
.cp-find-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px;
  padding: 0 10px; border: 0; border-radius: 4px; background: none; color: var(--ink);
  font: 500 14px/20px var(--font-body); text-align: left; cursor: pointer;
}
.cp-find-item:hover, .cp-find-item:focus-visible { background: var(--raised); }
.cp-find-meta { flex: none; color: var(--muted); font-weight: 400; font-size: 13px; }
/* Phones: Replace Screenshot sits right under the panel title, so it is
   in reach without scrolling the sheet. */
@media (max-width: 760px), (max-width: 900px) and (orientation: portrait) and (pointer: coarse) {
  .ed-props-body > .cp-own, .ed-props-body > .cp-designs { order: -3; }
  .ed-props-body > .ed-props-head { order: -2; }
  .ed-props-body > .cp-replace { order: -1; }
  .ed-props-body > .cp-arrange { order: -1; }
}
/* The default preset's star is pressed: a marker icon on a raised chip. */
.cp-preset-default[aria-pressed="true"] { background: var(--raised); color: var(--marker); }
@media (max-width: 760px), (max-width: 900px) and (orientation: portrait) and (pointer: coarse) { .cp-preset-row .btn-icon.btn-sm { width: 44px; height: 44px; } }
/* App Store Screenshots: the captions spreadsheet import. */
dialog.st-csv { width: min(560px, calc(100vw - 32px)); }
dialog.st-csv[open] { display: flex; flex-direction: column; gap: 14px; }
.st-csv-text { min-height: 160px; max-height: 40vh; font-size: 14px; white-space: pre; overflow-wrap: normal; overflow-x: auto; }
.st-csv-report { display: flex; flex-direction: column; gap: 6px; }
.st-csv-report:empty { display: none; }
.st-note.is-ok .icon { color: var(--success); }
.st-csv-tools { border-top: 1px solid var(--line); padding-top: 16px; }

/* =========================================================================
   Keyboard shortcuts sheet (image-shell.js, the ? key).
   ========================================================================= */
dialog.ed-keys { width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); }
dialog.ed-keys[open] { display: flex; flex-direction: column; gap: 12px; }
.ed-keys-body { overflow-y: auto; display: flex; flex-direction: column; gap: 18px; margin: 0 -4px; padding: 0 4px 4px; }
.ed-keys-sec h3 { font: 600 13px/18px var(--font-body); color: var(--muted); margin: 0 0 4px; }
.ed-keys-list { list-style: none; margin: 0; padding: 0; }
.ed-keys-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 36px; border-top: 1px solid var(--line); font-size: 14px; line-height: 20px; }
.ed-keys-list li:first-child { border-top: 0; }
.ed-keys-keys { display: flex; align-items: center; gap: 4px; flex-shrink: 0; color: var(--muted); font-size: 13px; }
.ed-keys kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 24px;
  padding: 0 6px;
  border: 1px solid var(--control-border);
  border-radius: 6px;
  background: var(--raised);
  color: var(--ink);
  font: 600 12px/16px var(--font-body);
}

/* =========================================================================
   Brand Kit dialog (brand-kit-panel.js), opened from the editor. The same
   rules Your Projects carries in projects.html.
   ========================================================================= */
dialog.bk-dialog { width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 20px 20px 16px; }
dialog.bk-dialog[open] { display: flex; flex-direction: column; gap: 18px; }
.bk-preview { border: 1px solid var(--line); border-radius: var(--r-card); padding: 18px; background: #FFFFFF; color: #141414; display: flex; flex-direction: column; gap: 8px; }
.bk-preview.is-empty { background: var(--raised); border-style: dashed; border-color: var(--control-border); color: var(--ink-2); }
.bk-preview.is-empty p { font-size: 14px; line-height: 21px; }
.bk-prev-logo { max-height: 32px; max-width: 160px; object-fit: contain; align-self: flex-start; }
.bk-prev-head { font-size: 24px; line-height: 28px; font-weight: 700; letter-spacing: -.01em; }
.bk-prev-body { font-size: 15px; line-height: 22px; color: #3D3D3A; }
.bk-prev-swatches { display: flex; gap: 6px; margin-top: 2px; }
.bk-prev-swatches span { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(20,20,20,.15); }
.bk-sec { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.bk-sec-head { display: flex; justify-content: space-between; align-items: baseline; }
.bk-sec h3 { font: 700 16px/22px var(--font-head); letter-spacing: -.01em; }
.bk-count { font-size: 13px; color: var(--muted); }
.bk-colors { display: flex; flex-direction: column; gap: 8px; }
.bk-colors:empty { display: none; }
.bk-color { display: grid; grid-template-columns: 40px 1fr 44px; gap: 8px; align-items: center; }
.bk-well-wrap { position: relative; width: 40px; height: 40px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--ink) 20%, transparent); overflow: hidden; cursor: pointer; }
.bk-well-wrap:focus-within { outline: 2px solid var(--selection); outline-offset: 2px; }
.bk-well { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.bk-hex { height: 40px; font-size: 14px; text-transform: uppercase; }
.bk-err { display: none; grid-column: 2 / 4; }
.bk-color.is-error .bk-err { display: block; }
.bk-color.is-error .bk-hex { border-color: var(--danger); }
.bk-add { align-self: flex-start; gap: 6px; }
.bk-font { display: flex; flex-direction: column; gap: 6px; }
.bk-font-label { font-size: 13px; line-height: 18px; color: var(--muted); }
.bk-font + .bk-font { margin-top: 6px; }
.bk-font-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bk-font-pick { flex: 1 1 200px; min-width: 0; display: flex; }
.bk-font-file { flex: 1 1 200px; min-height: 40px; display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--field-border); border-radius: var(--r-control); background: var(--surface); font-size: 15px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bk-logo { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.bk-logo .helper { font-size: 13px; color: var(--muted); }
.bk-logo .btn { gap: 6px; }
.bk-logo-img { display: flex; align-items: center; justify-content: center; width: 120px; height: 56px; padding: 8px; border-radius: var(--r-control); border: 1px solid var(--line); background: #FFFFFF; }
.bk-logo-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.bk-logo-buttons { display: flex; gap: 8px; }
.bk-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-top: 1px solid var(--line); padding-top: 14px; }
.bk-saved { font-size: 13px; color: var(--muted); }
/* font-picker.js, restyled in Marker inside the dialog */
.bk-dialog .msfp { flex: 1; min-width: 0; display: flex; }
.bk-dialog .msfp-trigger { width: 100%; min-height: 40px; padding: 0 34px 0 12px; text-align: left; cursor: pointer; border: 1px solid var(--field-border); border-radius: var(--r-control); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%238A8A84' d='M0 0h10L5 6z'/%3E%3C/svg%3E") no-repeat right 12px center; color: var(--ink); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-dialog .msfp-trigger.is-empty { color: var(--muted); font-family: var(--font-body); }
.bk-dialog .msfp-trigger:focus-visible { outline: 2px solid var(--selection); outline-offset: 2px; }
.bk-dialog .msfp-panel { position: fixed; z-index: 10; display: none; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-popover); overflow: hidden; }
.bk-dialog .msfp-panel.show { display: flex; }
.bk-dialog .msfp-search { margin: 8px; padding: 0 12px; height: 40px; border: 1px solid var(--field-border); border-radius: var(--r-control); background: var(--surface); color: var(--ink); font: 400 14px var(--font-body); }
.bk-dialog .msfp-search:focus-visible { outline: 2px solid var(--selection); outline-offset: 2px; }
.bk-dialog .msfp-list { flex: 1; overflow-y: auto; padding: 0 6px 6px; }
.bk-dialog .msfp-group { padding: 10px 8px 4px; font: 600 12px/16px var(--font-body); letter-spacing: 0; text-transform: none; color: var(--muted); }
.bk-dialog .msfp-row { display: block; width: 100%; min-height: 40px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); font-size: 16px; text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .55; }
.bk-dialog .msfp-row.loaded { opacity: 1; }
.bk-dialog .msfp-row:hover, .bk-dialog .msfp-row.active { background: var(--raised); }
.bk-dialog .msfp-row.on { background: color-mix(in srgb, var(--selection) 10%, var(--surface)); }
.bk-dialog .msfp-empty { padding: 14px 10px; text-align: center; color: var(--muted); font-size: 13px; }
@media (prefers-reduced-motion: no-preference) { .bk-dialog .msfp-row { transition: opacity .18s ease; } }
@media (max-width: 720px) { dialog.bk-dialog { padding: 16px; } }

/* =========================================================================
   App Store Screenshots: export presets, the file preview, Save to
   Photos, the exact size offer in Store Rules, and the phone Brand Kit.
   ========================================================================= */
.st-presets { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.st-presets legend { padding: 0 0 6px; }
.st-preset {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  cursor: pointer;
}
.st-preset input { width: 18px; height: 18px; accent-color: var(--ink); flex-shrink: 0; margin: 0; }
.st-preset:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.st-preset .ed-meta { font-size: 12px; line-height: 16px; }
.st-files { border: 1px solid var(--line); border-radius: var(--r-control); }
.st-files > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.st-files > summary::-webkit-details-marker { display: none; }
.st-files > summary::after {
  content: "";
  width: 8px; height: 8px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  margin: -4px 4px 0 0;
  flex-shrink: 0;
}
.st-files[open] > summary::after { transform: rotate(225deg); margin-top: 4px; }
.st-files > summary .ed-meta { margin-left: auto; font-weight: 400; }
.st-files > summary:focus-visible { outline: 2px solid var(--selection); outline-offset: 2px; border-radius: var(--r-control); }
.st-tree { max-height: 220px; overflow: auto; padding: 4px 12px 10px; border-top: 1px solid var(--line); font-size: 13px; line-height: 20px; }
.st-tree ul { list-style: none; margin: 0; padding: 0 0 0 18px; }
.st-tree > ul { padding-left: 0; }
.st-tree-dir { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.st-tree-dir .icon { color: var(--muted); flex-shrink: 0; }
.st-tree-dir .ed-meta { font-weight: 400; margin-left: 6px; }
.st-tree-file { color: var(--ink-2); white-space: nowrap; }
.st-tree-more { color: var(--muted); }
#stShare { gap: 8px; }
.st-rule.st-fix { align-items: center; }
.st-rule.st-fix .icon { color: var(--ink-2); }
.st-rule.st-fix .btn { flex-shrink: 0; margin-left: auto; }
.st-rail-brand { display: none; }
@media (max-width: 760px), (max-width: 900px) and (orientation: portrait) and (pointer: coarse) {
  .ed-tool.st-rail-brand { display: flex; }
  .ed-rail-sep.st-rail-brand { display: block; }
  .st-preset { min-height: 52px; }
  .st-files > summary { min-height: 44px; }
}

/* ---- App Store Screenshots: reorder, All Captions, Replace the Sample -- */
.st-strip { position: relative; }
.is-store .ed-stage .st-shot canvas { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.st-item.is-dragging { opacity: .55; }
.ed-stage.is-reordering, .ed-stage.is-reordering canvas { cursor: grabbing; }
.st-drop-bar { position: absolute; width: 4px; border-radius: 2px; background: var(--selection); pointer-events: none; z-index: 2; }
.st-drop-bar[hidden] { display: none; }
.st-drag-ghost { position: fixed; z-index: 120; pointer-events: none; border-radius: 4px; box-shadow: var(--shadow-popover); opacity: .92; }
.st-caps { display: flex; flex-direction: column; gap: 12px; }
.st-cap { display: flex; flex-direction: column; gap: 6px; padding: 10px; margin: 0 -10px; border-radius: var(--r-control); }
.st-cap[aria-current="true"] { background: var(--raised); }
.st-cap-name { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink-2); }
.st-cap .textarea { min-height: 0; }
.st-cap .st-cap-sub { font-size: 14px; }
dialog.st-ask { width: min(420px, calc(100vw - 32px)); }
.st-ask-text { margin: 12px 0 20px; font-size: 14px; line-height: 20px; color: var(--ink-2); }
.st-ask-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.st-ask-actions .btn { flex: 1 1 auto; }
.st-listing-btn { gap: 6px; padding: 0 10px; }
.st-rail-phone { display: none; }
@media (max-width: 760px), (max-width: 900px) and (orientation: portrait) and (pointer: coarse) {
  .ed-tool.st-rail-phone { display: flex; }
  .ed-rail-sep.st-rail-phone { display: block; }
  .st-ask-actions .btn { height: 44px; flex-basis: 100%; }
}

/* ---- Preview Listing (store-preview.js) --------------------------------
   A generic store page drawn with Marker type and colors. The mock keeps
   its own light or dark colors (the Marker light and dark values), picked
   in the dialog, whatever the page theme is. */
dialog.sp-dlg { width: min(1080px, calc(100vw - 32px)); height: min(860px, calc(100dvh - 32px)); max-height: calc(100dvh - 32px); padding: 20px; display: none; }
dialog.sp-dlg[open] { display: flex; flex-direction: column; gap: 16px; }
.sp-body { display: grid; grid-template-columns: 300px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "side stage" "fields stage"; column-gap: 24px; row-gap: 16px; min-height: 0; flex: 1 1 auto; }
.sp-side, .sp-fields { display: flex; flex-direction: column; gap: 16px; padding: 2px; }
.sp-side { grid-area: side; }
.sp-fields { grid-area: fields; overflow-y: auto; min-height: 0; }
.sp-stage { grid-area: stage; }
.sp-side .select { font-size: 14px; }
.sp-side .segmented { width: 100%; }
.sp-side .segmented button { flex: 1 1 0; white-space: nowrap; padding: 0 8px; }
.sp-stage { background: var(--canvas); border-radius: var(--r-stage); padding: 24px 16px; overflow-y: auto; min-height: 0; display: flex; justify-content: center; align-items: flex-start; }
.sp-mock {
  --sp-bg: #FFFFFF; --sp-raised: #F0F0EC; --sp-line: #E3E3DE; --sp-ink: #141414; --sp-ink-2: #3D3D3A; --sp-muted: #5E5E5A; --sp-ph: #E3E3DE;
  width: 100%; max-width: 390px; box-sizing: border-box;
  background: var(--sp-bg); color: var(--sp-ink);
  border-radius: var(--r-stage); box-shadow: var(--shadow-raised);
  padding: 16px; display: flex; flex-direction: column; gap: 16px;
  font-family: var(--font-body);
}
.sp-mock.is-wide { max-width: 720px; }
.sp-mock[data-mode="dark"] { --sp-bg: #111111; --sp-raised: #232322; --sp-line: #2C2C2A; --sp-ink: #F3F3EF; --sp-ink-2: #C9C9C3; --sp-muted: #A3A39D; --sp-ph: #2C2C2A; }
.sp-searchbar { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: var(--r-control); background: var(--sp-raised); color: var(--sp-ink); font-size: 15px; }
.sp-searchbar .icon { color: var(--sp-muted); flex-shrink: 0; }
.sp-searchbar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-result { display: flex; flex-direction: column; gap: 12px; }
.sp-result.is-ghost { padding-top: 16px; border-top: 1px solid var(--sp-line); }
.sp-result.is-ghost .sp-bars { flex: 1 1 auto; }
.sp-app, .sp-page-head, .sp-play-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sp-page-head { align-items: flex-start; gap: 16px; }
.sp-app-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.sp-name { font: 600 16px/21px var(--font-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-page-head .sp-name { font: 700 20px/26px var(--font-head); letter-spacing: -.015em; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sp-name.is-play { font: 700 20px/26px var(--font-head); letter-spacing: -.015em; white-space: normal; }
.sp-sub, .sp-dev { font-size: 13px; line-height: 18px; color: var(--sp-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-dev { color: var(--sp-ink-2); font-weight: 600; }
.sp-sub.is-about { white-space: normal; color: var(--sp-ink-2); font-size: 14px; line-height: 20px; }
.sp-sub[hidden], .sp-dev[hidden], .sp-name[hidden] { display: none; }
.sp-rating { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.sp-stars { display: inline-flex; gap: 1px; color: var(--sp-muted); }
.sp-stars .icon { width: 12px; height: 12px; }
.sp-ph { display: inline-block; width: 36px; height: 8px; border-radius: 4px; background: var(--sp-ph); }
.sp-get { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; min-width: 72px; height: 30px; padding: 0 16px; border-radius: var(--r-pill); background: var(--sp-raised); color: var(--sp-ink); font: 700 14px/1 var(--font-body); }
.sp-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; color: var(--sp-ink-2); }
.sp-install { display: flex; align-items: center; justify-content: center; height: 40px; border-radius: var(--r-pill); background: var(--sp-ink); color: var(--sp-bg); font: 600 14px/1 var(--font-body); }
.sp-icon { flex-shrink: 0; display: block; object-fit: cover; background: var(--sp-raised); box-shadow: inset 0 0 0 1px var(--sp-line); }
.sp-icon-blank { display: flex; align-items: center; justify-content: center; color: var(--sp-muted); font: 800 26px/1 var(--font-head); }
.sp-icon-64 { width: 64px; height: 64px; border-radius: 14px; }
.sp-icon-72 { width: 72px; height: 72px; border-radius: 16px; font-size: 30px; }
.sp-icon-108 { width: 108px; height: 108px; border-radius: 24px; font-size: 44px; }
.sp-icon-blank.sp-icon-64 { font-size: 26px; }
.sp-facts { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--sp-line); border-bottom: 1px solid var(--sp-line); }
.sp-facts.is-play { border: 0; padding: 0; justify-content: flex-start; gap: 24px; }
.sp-shots { display: flex; gap: 8px; }
.sp-shots canvas { display: block; flex-shrink: 0; border-radius: 10px; box-shadow: 0 0 0 1px var(--sp-line); }
.sp-shots.is-carousel, .sp-shots.is-row { overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 16px; margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: thin; }
.sp-shots.is-carousel canvas, .sp-shots.is-row canvas { scroll-snap-align: start; }
.sp-shots.is-row canvas { border-radius: 8px; }
.sp-about { margin: 0; font: 700 16px/22px var(--font-head); }
.sp-bars { display: flex; flex-direction: column; gap: 8px; }
.sp-bars span { display: block; height: 8px; border-radius: 4px; background: var(--sp-ph); }
@media (max-width: 760px), (max-width: 900px) and (orientation: portrait) and (pointer: coarse) {
  dialog.sp-dlg { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; padding: 12px 16px 16px; }
  dialog.sp-dlg[open] { gap: 12px; }
  .sp-body { display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
  .sp-side, .sp-fields { overflow: visible; flex-shrink: 0; }
  .sp-stage { overflow: visible; padding: 16px 12px; margin: 0 -4px; flex-shrink: 0; }
  .sp-side .segmented button { min-height: 44px; }
}

/* ---- Beautify: custom canvas size and crop fields ----------------------- */
.cp-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cp-pair .field { min-width: 0; }
.ed-props .cp-pair .input { font-size: 14px; }

/* ---- Beautify: Position, a 9 point anchor --------------------------------- */
/* A raised track like the segmented controls; the anchor in use is the
   white segment with a raised shadow. */
.cp-anchor { display: grid; grid-template-columns: repeat(3, 44px); grid-auto-rows: 32px; gap: 2px; padding: 2px; width: max-content; background: var(--raised); border-radius: 10px; }
.cp-anchor-pt { display: flex; align-items: center; justify-content: center; border: 0; padding: 0; background: transparent; border-radius: 8px; cursor: pointer; color: var(--muted); }
.cp-anchor-pt span { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.cp-anchor-pt:hover { color: var(--ink); }
.cp-anchor-pt[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 2px rgba(20, 20, 20, 0.08); color: var(--ink); }
.cp-anchor-pt[aria-pressed="true"] span { width: 10px; height: 10px; }
@media (max-width: 760px), (max-width: 900px) and (orientation: portrait) and (pointer: coarse) { .cp-anchor { grid-auto-rows: 44px; } }
@media (pointer: coarse) { .cp-anchor { grid-auto-rows: 44px; } }

/* ---- Pasted or dropped image over marks (image-editor.js askImage) ----- */
#edAskImage[open] { display: flex; flex-direction: column; gap: var(--s4); }
#edAskImage .ed-ask-text { margin: 0; font-size: 14px; line-height: 20px; color: var(--ink-2); }

/* Typing on the image (Mark Up f1): a field laid over the words being
   typed. Its letters are clear, so the canvas's own drawing shows through;
   it gives the caret and the selection. image-editor.js sets its place,
   font, and scale each frame. */
.ed-inline {
  position: absolute;
  z-index: 2;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: none;
  background: transparent;
  color: transparent;
  -webkit-text-fill-color: transparent;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  transform-origin: 0 0;
  box-shadow: none;
  min-height: 0;
  -webkit-appearance: none;
  appearance: none;
}
.ed-inline::selection { background: rgba(47, 111, 237, 0.32); color: transparent; -webkit-text-fill-color: transparent; }

/* ---- Mark Up wave 2: stamps, What to Find, Copy Text, room, export ---- */
/* Stamp picker: seven icon buttons in one segmented row. */
.ed-props .segmented.ed-stamps { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.ed-props .segmented.ed-stamps button { padding: 0; display: flex; align-items: center; justify-content: center; }
/* A disclosure row in the properties panel (What to Find). */
.ed-disclosure { border: 1px solid var(--line); border-radius: var(--r-control); }
.ed-disclosure > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.ed-disclosure > summary::-webkit-details-marker { display: none; }
.ed-disclosure > summary::after {
  content: "";
  width: 8px; height: 8px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  margin: -4px 4px 0 0;
  flex-shrink: 0;
}
.ed-disclosure[open] > summary::after { transform: rotate(225deg); margin-top: 4px; }
.ed-disclosure > summary .ed-meta { margin-left: auto; font-weight: 400; }
.ed-disclosure > summary:focus-visible { outline: 2px solid var(--selection); outline-offset: 2px; border-radius: var(--r-control); }
.ed-kinds-list { display: flex; flex-direction: column; padding: 0 12px 4px; }
.ed-smart .ed-kinds { margin-top: 4px; }
.ed-smart-same { display: flex; align-items: center; gap: var(--s2); padding: 8px 4px 8px 10px; border-radius: 8px; background: var(--raised); }
.ed-grab-text { min-height: 120px; font-size: 14px; line-height: 20px; }
/* Find Text: the field and its Find button on one row, and the words kept
   in this browser, each with Forget. */
.ed-find-text { gap: 6px; }
.ed-find-row { display: flex; gap: var(--s2); }
.ed-find-row .input { flex: 1 1 auto; min-width: 0; }
.ed-words { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ed-words li { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding-left: 10px; border-radius: 8px; }
.ed-words li:hover, .ed-words li:focus-within { background: var(--raised); }
.ed-word { font-size: 14px; line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Redact's Export dialog: Check Before Export, and hidden covers. */
#edExport .ed-check { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s2); padding-bottom: 16px; border-bottom: 1px solid var(--line); }
#edExport .ed-check .helper { margin: 0; }
#edExport .ed-check[hidden], #edExport .ed-hidden-note[hidden] { display: none; }
#edExport .ed-hidden-note { display: flex; align-items: center; gap: var(--s3, 12px); padding: 10px 12px; border: 1px solid var(--control-border); border-left: 3px solid var(--warning); border-radius: var(--r-control); background: var(--surface); }
#edExport .ed-hidden-note p { margin: 0; flex: 1; font-size: 14px; line-height: 20px; color: var(--ink); }
#edHiddenAsk[open] { display: flex; flex-direction: column; gap: var(--s4); }
#edHiddenAsk .ed-ask-text { margin: 0; font-size: 14px; line-height: 20px; color: var(--ink-2); }
/* Check Covers: the cover in hand, and what to do about it. */
.ed-review-name { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s2); font-size: 16px; line-height: 24px; font-weight: 600; margin: -10px 0 0; }
.ed-review-flag { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s2); padding: 12px; border: 1px solid var(--control-border); border-left: 3px solid var(--warning); border-radius: var(--r-control); }
.ed-review-flag p { margin: 0; font-size: 14px; line-height: 20px; color: var(--ink-2); }
/* Export: Download and Copy Image side by side, stacked on a phone. */
.ed-export-buttons { display: flex; gap: var(--s2); }
.ed-export-buttons #edDownload { flex: 1 1 auto; }
/* With Share (or Save to Photos), the primary button takes the first row
   and the other two share the second. On iPhone and iPad the primary is
   Save to Photos. */
#edExport .ed-export-buttons.has-share { flex-wrap: wrap; }
#edExport .ed-export-buttons.has-share > .btn { flex: 1 1 0; }
#edExport .ed-export-buttons.has-share > .btn-primary { flex: 1 1 100%; }
#edExport .segmented button[hidden] { display: none; }
@media (max-width: 480px) { .ed-export-buttons { flex-direction: column; } #edExport .ed-export-buttons.has-share > .btn { flex: none; } }

/* Redact a set (w7): the strip of screenshots over the bar, one thumbnail
   each, the one on screen ringed in selection blue. A number in the corner
   names each one as the match list does, and a count shows matches still
   to check. On phones the strip sits under the top bar. */
.ed-set { display: flex; align-items: center; gap: var(--s2); padding: 8px 16px; border-top: 1px solid var(--line); background: var(--paper); flex-shrink: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.ed-set[hidden] { display: none; }
.ed-set-list { display: flex; align-items: center; gap: var(--s2); }
.ed-set-item { flex-shrink: 0; }
.ed-set-thumb { position: relative; display: flex; align-items: center; justify-content: center; min-width: 44px; height: 60px; padding: 4px; border: 2px solid transparent; border-radius: 10px; background: transparent; cursor: pointer; }
.ed-set-thumb:hover { background: var(--raised); }
.ed-set-thumb[aria-current="true"] { border-color: var(--selection); background: var(--surface); }
.ed-set-thumb:focus-visible { outline: 2px solid var(--selection); outline-offset: 2px; }
.ed-set-thumb:disabled { cursor: default; opacity: .6; }
.ed-set-thumb img, .ed-set-blank { display: block; height: 48px; width: auto; max-width: 112px; border-radius: 4px; box-shadow: 0 1px 2px rgba(20, 20, 20, .08); background: var(--surface); }
.ed-set-blank { background: var(--raised); }
.ed-set-n { position: absolute; left: 0; bottom: 0; min-width: 20px; padding: 0 5px; border-radius: 6px; background: var(--surface); color: var(--ink); border: 1px solid var(--control-border); font: 600 13px/18px var(--font-body); text-align: center; }
.ed-set-badge { position: absolute; right: -2px; top: -2px; min-width: 20px; padding: 0 5px; border-radius: 99px; background: var(--ink); color: var(--surface); font: 600 13px/18px var(--font-body); text-align: center; }
.ed-set-add { flex-shrink: 0; display: flex; align-items: center; justify-content: center; width: 48px; height: 52px; border: 2px dashed var(--field-border); border-radius: 10px; background: transparent; color: var(--ink-2); cursor: pointer; }
.ed-set-add:hover { border-color: var(--ink); color: var(--ink); }
.ed-set-add:disabled { opacity: .5; cursor: default; }
.ed-set-add:focus-visible { outline: 2px solid var(--selection); outline-offset: 2px; }
/* Find in All: the matches by screenshot, in one scrolling list. */
.ed-smart-groups { display: flex; flex-direction: column; gap: 10px; max-height: 360px; overflow-y: auto; }
.ed-smart-groups .ed-smart-list { max-height: none; overflow: visible; }
.ed-smart-shot { display: flex; flex-direction: column; gap: 2px; padding-left: 8px; border-left: 2px solid var(--line); }
.ed-smart-shot.is-current { border-left-color: var(--selection); }
.ed-smart-shot-head { display: flex; align-items: center; gap: var(--s2); min-height: 32px; }
.ed-smart-shot-head .ed-meta { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The Export dialog in a set: Download All across the top. */
.is-set .ed-export-buttons { flex-wrap: wrap; }
.is-set .ed-export-buttons #edDownloadAll { flex: 1 1 100%; }
#edExport .btn[hidden], #edSetNote[hidden] { display: none; }
@media (max-width: 760px), (max-width: 900px) and (orientation: portrait) and (pointer: coarse) {
  .ed-set { order: -1; padding: 6px 12px; border-top: 0; border-bottom: 1px solid var(--line); }
  .ed-smart-groups { max-height: none; overflow: visible; }
  .ed-smart-shot-head .btn-sm { min-width: 44px; height: 44px; }
}
@media (max-width: 480px) { .is-set .ed-export-buttons #edDownloadAll { flex: 0 0 auto; } }

/* ---- Longer languages (A-17) ------------------------------------------
   image-shell.js puts ms-i18n on the root only when the page is in
   another language (or ?pseudo), so English keeps every rule above as
   it is. Words in German, Finnish, or Russian run a third longer or
   more: labels and buttons in the panel, dialogs, and the bar wrap onto
   a second line, and long words break, where English stays on one. */
:root.ms-i18n .ed-props-body,
:root.ms-i18n .dialog { overflow-wrap: break-word; hyphens: auto; }
:root.ms-i18n .ed-props .segmented { flex-wrap: wrap; }
:root.ms-i18n .ed-props .segmented button,
:root.ms-i18n dialog .segmented button { white-space: normal; padding: 4px 6px; min-width: 0; overflow-wrap: anywhere; }
:root.ms-i18n .ed-props .btn,
:root.ms-i18n dialog .btn,
:root.ms-i18n .ed-bar .chip { height: auto; min-height: 44px; white-space: normal; text-align: center; line-height: 18px; padding-top: 6px; padding-bottom: 6px; }
:root.ms-i18n .ed-props .btn-sm { min-height: 36px; padding-top: 4px; padding-bottom: 4px; }
:root.ms-i18n .ed-props .btn-icon,
:root.ms-i18n dialog .btn-icon,
:root.ms-i18n .ed-head-actions .btn { height: 36px; min-height: 0; padding-top: 0; padding-bottom: 0; }
:root.ms-i18n .ed-props-head { align-items: flex-start; }
:root.ms-i18n .ed-props-head h2 { min-width: 0; overflow-wrap: break-word; }
:root.ms-i18n .ed-toggle { gap: var(--s2); }
:root.ms-i18n .ed-group-row { flex-wrap: wrap; row-gap: 2px; }
:root.ms-i18n .ed-smart-head { flex-wrap: wrap; }
:root.ms-i18n .ed-export-buttons { flex-wrap: wrap; }
:root.ms-i18n .ed-export-buttons .btn { flex: 1 1 auto; }
@media (max-width: 760px), (max-width: 900px) and (orientation: portrait) and (pointer: coarse) {
  :root.ms-i18n .ed-props .btn-sm,
  :root.ms-i18n .ed-props .btn-icon,
  :root.ms-i18n .ed-head-actions .btn { min-height: 44px; height: auto; }
}
