/* Screenshots Maker module — scoped styles (sm- prefix). */

.sm-banner-designer-backdrop { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; box-sizing: border-box; width: 100%; padding: 24px; overflow: hidden; background: rgba(4, 6, 12, 0.82); backdrop-filter: blur(2px); }
.sm-banner-designer { width: min(1100px, 100%); min-width: 0; max-height: calc(100vh - 48px); overflow-x: hidden; overflow-y: auto; border: 1px solid var(--border); border-radius: 16px; background: var(--panel); box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5); }
.sm-banner-designer > header, .sm-banner-designer > footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.sm-banner-designer > header h3, .sm-banner-designer > header p { margin: 0; }
.sm-banner-designer > header p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.sm-banner-designer > footer { position: sticky; bottom: 0; justify-content: flex-end; border-top: 1px solid var(--border); border-bottom: 0; background: var(--panel); }
/* Source picker spans the full popup width, above the preview/controls row. */
.sm-banner-source { margin: 20px 20px 0; }
.sm-banner-source-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; min-width: 0; }
.sm-banner-source-grid > div { min-width: 0; }

.sm-banner-designer-body { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.72fr); gap: 20px; min-width: 0; padding: 20px; }

/* Preview stage — hugs the banner and sticks while the field column scrolls. */
.sm-banner-preview { position: sticky; top: 20px; align-self: start; display: grid; place-items: center; min-width: 0; min-height: 160px; padding: 14px; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: repeating-conic-gradient(var(--panel-2) 0 25%, var(--panel) 0 50%) 0 / 20px 20px; }
.sm-banner-preview canvas { display: block; width: auto; height: auto; max-width: 100%; max-height: 62vh; border-radius: 4px; object-fit: contain; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4); }
.sm-banner-preview-meta { position: absolute; right: 10px; bottom: 10px; padding: 3px 9px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; background: color-mix(in srgb, var(--panel) 82%, transparent); border: 1px solid var(--border); border-radius: 999px; }

/* Field column, grouped */
.sm-banner-fields { display: flex; flex-direction: column; min-width: 0; gap: 12px; }
.sm-banner-fields .input { box-sizing: border-box; width: 100%; min-width: 0; }
.sm-banner-group { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2); }
.sm-banner-group-title { margin: 0; color: var(--text); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.sm-banner-group-sub { margin-top: 2px; color: var(--muted); font-size: 11px; }
.sm-banner-group > label, .sm-banner-four-col label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; }
.sm-banner-field-hint { color: var(--muted); font-size: 10px; text-transform: none; }
/* Custom checkbox row, matched to the designer's card/tile language: bordered
   pill, accent tint + drawn tick when checked. */
.sm-banner-group > label.sm-banner-check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.sm-banner-check:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.sm-banner-check input {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-2);
  cursor: pointer;
  position: relative;
  transition: border-color 0.12s, background 0.12s;
}
.sm-banner-check input:checked {
  border-color: var(--accent);
  background: var(--accent);
}
.sm-banner-check input:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.sm-banner-check input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.sm-banner-check:has(input:checked) {
  border-color: var(--accent);
  background: rgba(108, 140, 255, 0.12);
}
.sm-banner-group > label.is-disabled { opacity: 0.45; }
.sm-banner-group > label.is-disabled input { cursor: not-allowed; }
.sm-banner-fields textarea { resize: vertical; white-space: pre-wrap; }
.sm-banner-four-col { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.sm-banner-four-col label { align-items: center; gap: 4px; text-transform: uppercase; }

/* Horizontal thumbnail pickers (banner + text style) */
.sm-asset-strip { display: flex; gap: 8px; margin: 0 -2px; padding: 2px; overflow-x: auto; scrollbar-width: thin; scroll-snap-type: x proximity; }
.sm-asset-strip::-webkit-scrollbar { height: 6px; }
.sm-asset-strip::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
.sm-asset-tile { display: flex; flex-direction: column; gap: 5px; flex: 0 0 auto; width: 96px; padding: 6px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; scroll-snap-align: start; transition: border-color 0.12s, background 0.12s; }
.sm-asset-tile:hover { border-color: var(--accent-2); }
.sm-asset-tile.is-active { border-color: var(--accent); background: rgba(108, 140, 255, 0.12); }
.sm-asset-thumb { display: grid; place-items: center; width: 100%; height: 46px; overflow: hidden; border-radius: 6px; background: repeating-conic-gradient(var(--panel-2) 0 25%, var(--panel) 0 50%) 0 / 12px 12px; }
.sm-asset-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.sm-style-thumb { background: linear-gradient(135deg, var(--border), var(--panel)); }
/* Fixed preview size; px effects pre-scaled to this in styleThumbCss so they
   stay proportional. Overflow clipped by the thumb; long text ellipsizes. */
.sm-style-glyph { display: block; max-width: 100%; padding: 0 4px; overflow: hidden; color: var(--text); font-size: 30px; line-height: 1.05; white-space: nowrap; text-overflow: ellipsis; }
.sm-asset-name { overflow: hidden; color: var(--text); font-size: 11px; line-height: 1.2; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.sm-asset-tile.is-active .sm-asset-name { color: var(--accent); }

/* Slider + number twin */
.sm-banner-slider { display: grid; grid-template-columns: 1fr 68px; align-items: center; gap: 10px; }
.sm-banner-slider input[type="range"] { width: 100%; height: 4px; margin: 0; padding: 0; accent-color: var(--accent); background: var(--border); border-radius: 999px; appearance: none; cursor: pointer; }
.sm-banner-slider input[type="range"]::-webkit-slider-thumb { appearance: none; width: 16px; height: 16px; background: var(--accent); border: 2px solid var(--panel); border-radius: 50%; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); cursor: pointer; }
.sm-banner-slider input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; background: var(--accent); border: 2px solid var(--panel); border-radius: 50%; cursor: pointer; }
.sm-banner-slider-num { text-align: center; font-variant-numeric: tabular-nums; }

/* Layout: alignment segment beside the 3x3 position grid to save height. */
.sm-banner-layout-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.sm-banner-layout-grid > div { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sm-banner-layout-grid .sm-banner-segment { grid-template-columns: repeat(2, 1fr); }

/* Segmented horizontal-alignment control */
.sm-banner-segment { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
.sm-banner-segment-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 2px; color: var(--muted); font-size: 10px; background: transparent; border: 0; border-radius: 7px; cursor: pointer; transition: background 0.12s, color 0.12s; }
.sm-banner-segment-btn span { font-size: 15px; line-height: 1; }
.sm-banner-segment-btn:hover { color: var(--text); background: var(--panel-2); }
.sm-banner-segment-btn.is-active { color: #fff; background: linear-gradient(135deg, var(--accent-solid), var(--accent-solid-2)); }

/* 3x3 position grid */
.sm-banner-align-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; width: max-content; }
.sm-banner-align-cell { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; transition: border-color 0.12s, background 0.12s; }
.sm-banner-align-cell span { width: 12px; height: 3px; background: var(--muted); border-radius: 2px; transition: background 0.12s; }
.sm-banner-align-cell:hover { border-color: var(--accent-2); }
.sm-banner-align-cell.is-active { background: var(--panel-2); border-color: var(--accent); }
.sm-banner-align-cell.is-active span { background: var(--accent); }

@media (max-width: 760px) { .sm-banner-designer-backdrop { padding: 10px; } .sm-banner-designer { max-height: calc(100vh - 20px); } .sm-banner-source { margin: 14px 14px 0; } .sm-banner-source-grid { grid-template-columns: 1fr; gap: 12px; } .sm-banner-designer-body { grid-template-columns: minmax(0, 1fr); padding: 14px; } .sm-banner-preview { min-height: 220px; } }
@media (max-width: 420px) { .sm-banner-four-col { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Workspace: node sidebar left, editor right. The editor column sizes to the
   portrait phone preview's natural width (min-content) so it no longer leaves
   wide empty gutters — the freed width goes to the sidebar (1fr), which fits
   many more compact screenshot rows. */
.sm-layout {
  position: relative; /* anchors the bulk-intake drop overlay */
  display: grid;
  grid-template-columns: minmax(360px, 1fr) min-content;
  gap: 22px;
  align-items: start;
  margin-bottom: 22px;
}
@media (max-width: 900px) {
  .sm-layout { grid-template-columns: 1fr; }
  /* Stacked single column: widen the vw cap so the preview isn't tiny; the
     inline height term still bounds a tall shot. */
  .sm-canvas { --sm-canvas-cap: 90vw; }
}

/* Language picker — scopes which listing's artwork the page below shows */
.sm-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
.sm-toolbar > #sm-tabs {
  flex: 1 1 auto;
  min-width: 0;
}
.sm-toolbar > #sm-languages { flex: 0 0 auto; }
.sm-language-bar {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  margin-bottom: 22px;
}
.sm-language-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}
.sm-language-picker select {
  min-width: 260px;
}
.sm-language-status {
  max-width: 360px;
  font-size: 12px;
  text-align: right;
}

@media (max-width: 900px) {
  .sm-toolbar { flex-direction: column; gap: 0; }
  .sm-toolbar > #sm-tabs,
  .sm-toolbar > #sm-languages { width: 100%; }
  .sm-language-bar { align-items: flex-start; margin-top: -10px; }
  .sm-language-status { max-width: none; text-align: left; }
}

@media (max-width: 520px) {
  .sm-language-picker { width: 100%; align-items: flex-start; flex-direction: column; }
  .sm-language-picker select { width: 100%; min-width: 0; }
}

/* Resolution tabs */
.sm-res-tabs { flex-wrap: wrap; }
.sm-res-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 14px;
}
.sm-res-name { font-weight: 700; }
.sm-res-counts { font-size: 11px; color: var(--muted); font-weight: 400; }

/* Node sidebar */
.sm-library,
.sm-editor {
  min-height: 0;
}
.sm-library {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sm-sidebar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.sm-sidebar-head .sm-lib-title { margin: 0; }
.sm-lib-title { margin: 0 0 10px; font-size: 15px; }
/* Responsive grid of thumbnail cards. Auto-fill packs as many columns as the
   sidebar width allows; the extra width from the shrunk editor gives room for
   two columns of comfortably large thumbnails on a normal screen. */
.sm-asset-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  align-content: start;
  flex: 1;
  min-height: 0;
  gap: 14px;
  margin-bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
}
/* Card: phone thumbnail on top, control bar below. */
.sm-node {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--panel-2);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: 8px;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.sm-node:hover { border-color: rgba(255, 255, 255, 0.16); }
.sm-node.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(108, 140, 255, 0.45);
}
.sm-node.selected {
  background:
    linear-gradient(180deg, rgba(70, 209, 158, 0.1), rgba(70, 209, 158, 0.03)),
    var(--panel-2);
}
.sm-node.dragging { opacity: 0.4; }
/* Grid flows left-to-right, so drop insertion is marked on the side edges. */
.sm-node.drag-over-before { box-shadow: inset 3px 0 0 var(--accent); }
.sm-node.drag-over-after { box-shadow: inset -3px 0 0 var(--accent); }
.sm-node-grip {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.45);
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  line-height: 1;
  letter-spacing: -1px;
  cursor: grab;
  user-select: none;
  opacity: 0;
  transition: opacity 0.14s ease;
}
.sm-node:hover .sm-node-grip { opacity: 1; }
.sm-node:active .sm-node-grip { cursor: grabbing; }
.sm-node-thumb {
  position: relative;
  width: 100%;
  /* Ratio set per active device tab (nodeSidebar sets --sm-thumb-ar on the
     list); falls back to 9:16 if unset. */
  aspect-ratio: var(--sm-thumb-ar, 9 / 16);
}
.sm-node-thumb img,
.sm-node-empty {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at top, rgba(108, 140, 255, 0.18), transparent 55%),
    var(--bg);
  pointer-events: none;
}
/* cover, not contain: the card's aspect-ratio is set from the device tab dims
   so it already matches the shot — cover then fills the frame edge-to-edge with
   no crop and no letterbox gap. (contain would letterbox on any sub-pixel ratio
   mismatch, showing the frame background as a top/bottom band.) */
.sm-node-thumb img { object-fit: cover; }
.sm-node-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  border-style: dashed;
}
.sm-node-empty-icon {
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
}
.sm-node-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sm-node-info {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}
.sm-node-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}
/* Which listing this thumbnail's artwork belongs to. Only rendered on a
   translated listing, where the answer is not obvious. */
.sm-inline-badge.localized,
.sm-inline-badge.inherited {
  min-height: 22px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.sm-inline-badge.localized {
  border-color: rgba(87, 196, 128, 0.4);
  background: rgba(87, 196, 128, 0.14);
}
.sm-inline-badge.inherited {
  border-color: rgba(245, 197, 66, 0.35);
  background: rgba(245, 197, 66, 0.12);
  color: var(--muted);
}
/* Borrowed from en-US: dimmed, so a glance down the sidebar shows which
   screenshots this language still has to localize. */
.sm-thumb-inherited { opacity: 0.45; }
.sm-node-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}
/* Compact rows use tighter action buttons than the 32px default elsewhere. */
.sm-node-actions .sm-icon-btn {
  width: 28px;
  height: 28px;
  font-size: 13px;
}
.sm-icon-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
.sm-icon-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
}
.sm-icon-btn:active:not(:disabled) {
  transform: translateY(1px);
}
.sm-icon-btn.is-on {
  color: #06130e;
  background: rgba(70, 209, 158, 0.95);
  border-color: rgba(70, 209, 158, 0.7);
}
.sm-icon-btn.danger {
  color: var(--danger);
  background: rgba(255, 107, 107, 0.08);
  border-color: rgba(255, 107, 107, 0.16);
}
.sm-icon-btn:disabled {
  opacity: 0.34;
  cursor: default;
}
.sm-add-card-btn {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  border-style: dashed;
}

/* Editor */
.sm-editor-shell {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sm-editor-toolbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.sm-editor-toolbar.compact {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  align-items: center;
  flex-wrap: wrap;
}
.sm-editor-controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.sm-padding-inline {
  display: flex;
  align-items: center;
  gap: 6px;
}
.sm-pad-field.compact {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  letter-spacing: 0;
  color: var(--muted);
  font-weight: 600;
  text-transform: none;
}
.sm-pad-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.sm-pad-field input {
  width: 100%;
  padding: 7px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(9, 12, 22, 0.7);
  color: var(--text);
}
.sm-pad-field.compact input {
  width: 54px;
  text-align: center;
}
.sm-pad-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
}
.sm-pad-reset:hover:not(:disabled) { color: var(--text); border-color: var(--text); }
.sm-pad-reset:disabled { opacity: 0.4; cursor: default; }

.sm-editor-toolbar.compact .btn.small {
  padding: 5px 9px;
  font-size: 12px;
  border-radius: 8px;
}

@media (max-width: 700px) {
  .sm-pad-field.compact input { width: 48px; }
}

.sm-canvas-wrap { display: flex; justify-content: center; }
.sm-canvas-frame {
  display: flex;
  justify-content: center;
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(5, 7, 14, 0.92), rgba(18, 23, 40, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.sm-canvas-frame.compact {
  width: 100%;
  padding: 10px;
  border-radius: 18px;
}
/* Size (width + aspect-ratio) is set inline per device tab so the box keeps
   the exact tab proportions — height is always derived, never clamped. */
.sm-canvas {
  position: relative;
  background:
    repeating-conic-gradient(var(--panel-2) 0% 25%, var(--bg) 0% 50%) 0 0 / 24px 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.28),
    0 0 0 6px rgba(255, 255, 255, 0.03);
}
.sm-canvas-hint {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
  padding: 20px;
  gap: 8px;
}
.sm-canvas-hint strong {
  color: var(--text);
  font-size: 16px;
}

/* Layers: screenshot bottom (fills), banner raw size, centered on X
   (width/height set inline as % of the real tab resolution) */
.sm-layer-screenshot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  z-index: 1;
}
.sm-layer-screenshot-wrap {
  position: absolute;
  inset: 0;
  z-index: 1;
}
/* Hover-only clear button on a composed layer. Screenshot clear pins to the
   canvas corner; banner clear pins to its own (smaller) box corner. */
.sm-layer-clear {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  line-height: 0;
  cursor: pointer;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.9);
  transition: opacity 0.14s ease, transform 0.14s ease, background 0.14s ease;
}
.sm-layer-screenshot-wrap:hover .sm-layer-clear,
.sm-layer-clear:focus-visible,
.sm-layer-banner-wrap:hover .sm-layer-clear {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.sm-layer-clear:hover {
  background: var(--danger);
}
.sm-layer-banner-wrap {
  position: absolute;
  left: 50%;
  transform: translateX(calc(-50% + var(--sm-banner-offset-x, 0%)));
  z-index: 2;
}
.sm-layer-banner {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}
.sm-banner-top { top: var(--sm-banner-offset-y, 0%); }
.sm-banner-bottom { bottom: calc(0% - var(--sm-banner-offset-y, 0%)); }

/* Custom (spec-backed) banners are tap-to-edit; uploaded ones are not. */
.sm-layer-banner-wrap.is-editable { cursor: pointer; }
.sm-layer-banner-wrap.is-editable::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px dashed transparent;
  border-radius: 4px;
  pointer-events: none;
  transition: border-color 0.12s, background 0.12s;
}
.sm-layer-banner-wrap.is-editable:hover::after,
.sm-layer-banner-wrap.is-editable:focus-visible::after {
  border-color: var(--accent);
  background: rgba(108, 140, 255, 0.12);
}
.sm-layer-banner-wrap.is-editable:focus-visible { outline: none; }
.sm-banner-edit-badge {
  position: absolute;
  top: 6px;
  left: 6px; /* clear button owns the top-right corner */
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--accent-solid), var(--accent-solid-2));
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.12s, transform 0.12s;
  pointer-events: none;
}
.sm-layer-banner-wrap.is-editable:hover .sm-banner-edit-badge,
.sm-layer-banner-wrap.is-editable:focus-visible .sm-banner-edit-badge {
  opacity: 1;
  transform: translateY(0);
}

/* Drop-zone overlay */
.sm-drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
}
.sm-drop-zone {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--accent-2);
  background: rgba(108, 140, 255, 0.12);
  color: var(--text);
  font-weight: 700;
  transition: background 0.1s ease;
}
.sm-drop-zone.sm-drop-active {
  background: rgba(108, 140, 255, 0.35);
  border-color: var(--accent);
}
.sm-drop-strip { flex: 0 0 25%; }

/* Editor extras */
.sm-editor-placeholder {
  position: static;
  min-height: 240px;
}
.sm-saved-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  margin: 0 auto;
  width: fit-content;
  max-width: calc(100% - 28px);
  z-index: 2;
  text-align: center;
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  background: rgba(0, 0, 0, 0.5);
}
/* Showing the en-US image because this language has none of its own. */
.sm-saved-hint.inherited {
  border-color: rgba(245, 197, 66, 0.45);
  background: rgba(70, 52, 10, 0.85);
}

/* Bulk intake — whole-workspace drop target, progress toast and skipped-file report */
.sm-bulk-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 16px;
  border: 2px dashed var(--accent);
  border-radius: 16px;
  background: rgba(108, 140, 255, 0.18);
  backdrop-filter: blur(1px);
  pointer-events: none; /* never swallow the drag events the workspace listens for */
}
.sm-bulk-overlay.hidden { display: none; }
.sm-bulk-overlay-inner {
  display: grid;
  gap: 6px;
  padding: 18px 26px;
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  text-align: center;
}
.sm-bulk-overlay-inner strong { font-size: 15px; }

.sm-bulk-progress {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  transform: translateX(-50%);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  font-size: 13px;
}
.sm-bulk-progress.hidden { display: none; }

.sm-bulk-report {
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  overflow: hidden auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}
.sm-bulk-report > header,
.sm-bulk-report > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.sm-bulk-report > footer { justify-content: flex-end; border-top: 1px solid var(--border); border-bottom: 0; }
.sm-bulk-report > header h3, .sm-bulk-report > header p { margin: 0; }
.sm-bulk-report > header p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.sm-bulk-report-list { margin: 0; padding: 8px 20px; list-style: none; }
.sm-bulk-report-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.sm-bulk-report-list li:last-child { border-bottom: 0; }
.sm-bulk-report-name { overflow-wrap: anywhere; font-weight: 600; }
.sm-bulk-report-reason { flex: 0 0 auto; color: var(--muted); font-size: 12px; }

/* Banner preset + bulk banners */
.sm-toolbar-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.sm-banner-actions { display: flex; align-items: center; gap: 8px; }

.sm-preset-dialog, .sm-bulk-dialog { width: min(880px, 100%); }
.sm-preset-body, .sm-bulk-body { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.sm-preset-dialog > footer, .sm-bulk-dialog > footer { position: sticky; bottom: 0; gap: 12px; background: var(--panel); }
.sm-preset-status { margin-right: auto; color: var(--muted); font-size: 12px; }
.sm-preset-missing { margin: 4px 0 0; color: var(--muted); font-size: 12px; font-style: italic; }


.sm-bulk-banner-count { margin-right: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.sm-bulk-tab { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.sm-bulk-tab:last-child { border-bottom: 0; }
.sm-bulk-tab-head { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.sm-bulk-tab-head strong { margin-right: auto; }
.sm-bulk-pick-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px; scrollbar-width: thin; }
.sm-bulk-pick {
  position: relative;
  flex: 0 0 auto;
  width: 62px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.sm-bulk-pick:hover { border-color: var(--accent-2); }
.sm-bulk-pick.is-active { border-color: var(--accent); background: rgba(108, 140, 255, 0.16); }
.sm-bulk-pick-thumb { display: grid; place-items: center; width: 100%; aspect-ratio: var(--sm-thumb-ar, 9 / 16); overflow: hidden; border-radius: 6px; background: var(--panel-2); }
.sm-bulk-pick-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sm-bulk-pick-blank { color: var(--muted); font-size: 14px; }
.sm-bulk-pick-index { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; text-align: center; }
.sm-bulk-pick.is-active .sm-bulk-pick-index { color: var(--accent); }

.sm-bulk-previews { display: flex; gap: 12px; flex-wrap: wrap; }
.sm-bulk-preview { flex: 1 1 200px; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.sm-bulk-preview canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  background: repeating-conic-gradient(var(--panel-2) 0 25%, var(--panel) 0 50%) 0 / 12px 12px;
}
.sm-bulk-preview figcaption { color: var(--muted); font-size: 11px; text-align: center; }

/* Preset: per-device typography row under each device's banner strip */


/* ── Banner preset dialog ───────────────────────────────────────────────────
   Two labelled groups (per-device, shared) instead of five flat sections.
   Each device is a card whose typography block stays recessed until artwork
   is picked, so the eye lands on the one decision that gates the rest. */
.sm-preset-body { gap: 22px; }

.sm-preset-section { display: flex; flex-direction: column; gap: 10px; }
.sm-preset-section-head h4 {
  margin: 0;
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sm-preset-section-head p { margin: 3px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.45; }

/* Device card */
.sm-preset-device {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
  transition: border-color 0.15s ease, background 0.15s ease;
}
/* A set device gets an accent spine — scannable without reading labels. */
.sm-preset-device.is-set { border-left-color: var(--accent); }

.sm-preset-device-head { display: flex; align-items: baseline; gap: 8px; }
.sm-preset-device-name { color: var(--text); font-size: 13px; font-weight: 600; }
.sm-preset-device-dim { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.sm-preset-device-state {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(108, 140, 255, 0.16);
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sm-preset-device-state.is-muted { background: var(--panel); color: var(--muted); font-weight: 500; }

/* Typography block: recessed and non-interactive until artwork exists. */
.sm-preset-type {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
  align-items: end;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  transition: opacity 0.15s ease;
}
.sm-preset-type.is-inert { opacity: 0.4; }
.sm-preset-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.sm-preset-field.is-disabled { opacity: 0.45; }
.sm-preset-field-label { color: var(--muted); font-size: 10.5px; letter-spacing: 0.02em; }
.sm-preset-field .input { width: 100%; font-variant-numeric: tabular-nums; }

/* Auto-size toggle: pill matching the designer's checkbox language. */
.sm-preset-field-toggle {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  align-self: end;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.sm-preset-field-toggle:hover:not(.is-disabled) { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.sm-preset-field-toggle:has(input:checked) { border-color: var(--accent); background: rgba(108, 140, 255, 0.12); }
.sm-preset-field-toggle input {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--panel-2);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.sm-preset-field-toggle input:checked { border-color: var(--accent); background: var(--accent); }
.sm-preset-field-toggle input:checked::after {
  content: '';
  position: absolute;
  left: 4.5px;
  top: 1px;
  width: 4px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.sm-preset-field-toggle input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sm-preset-field-toggle input:disabled { cursor: not-allowed; }

/* Shared block */
.sm-preset-shared {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
}
.sm-preset-shared-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sm-preset-shared-wide { grid-column: 1 / -1; }
.sm-preset-align-pair { display: flex; flex-wrap: wrap; gap: 8px; }
.sm-preset-align-pair .sm-banner-segment { flex: 1 1 auto; }

@media (max-width: 720px) {
  .sm-preset-type { grid-template-columns: 1fr; align-items: stretch; }
  .sm-preset-field-toggle { align-self: stretch; justify-content: flex-start; }
  .sm-preset-shared { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .sm-preset-device, .sm-preset-type, .sm-preset-field-toggle { transition: none; }
}
