/*
  The image studio.

  The page is the canvas. It fills the view edge to edge rather than scrolling
  inside it, with the tools in a column on the left, the layers on the right
  and generative fill floating over the bottom of the picture — where the eye
  already is when the selection has just been drawn.
*/

.ist {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--bg);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.ist input,
.ist textarea {
  user-select: text;
  -webkit-user-select: text;
}

/* Icon-only buttons stay square here. The app's small-button padding would
   otherwise squeeze the glyph to a sliver inside a 30px button. */
.ist .btn.icon-only {
  flex: none;
  padding: 0;
}

.ist .btn.sm.icon-only {
  width: 30px;
}

/* ------------------------------------------------------------- top bar */

.ist-top {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--s1);
}

.ist-menus {
  display: flex;
  gap: 2px;
  flex: none;
}

.ist-menu {
  font-weight: 550;
}

.ist-top-acts {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
  margin-left: auto;
}

.ist-redo .icon {
  transform: scaleX(-1);
}

.ist-zoom {
  min-width: 56px;
}

.ist-side-toggle {
  display: none;
}

.ist-tabs {
  display: flex;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.ist-tabs::-webkit-scrollbar {
  display: none;
}

.ist-tab {
  display: flex;
  align-items: center;
  flex: none;
  max-width: 220px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--fg-2);
}

.ist-tab:hover {
  background: var(--s3);
}

.ist-tab.on {
  background: var(--s3);
  border-color: var(--border);
  color: var(--fg);
}

.ist-tab-name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 5px 4px 5px 10px;
  background: none;
  border: 0;
  color: inherit;
  font-size: 12.5px;
  cursor: pointer;
}

.ist-tab-close,
.ist-tab-new {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-right: 3px;
  background: none;
  border: 0;
  border-radius: 6px;
  color: var(--fg-3);
  cursor: pointer;
}

.ist-tab-close .icon,
.ist-tab-new .icon {
  width: 14px;
  height: 14px;
}

.ist-tab-close:hover,
.ist-tab-new:hover {
  background: var(--s4);
  color: var(--fg);
}

.ist-dot {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--warn);
}

.ist-rename {
  width: 160px;
  height: 28px;
  padding: 3px 8px !important;
  font-size: 12.5px;
}

/* ---------------------------------------------------------------- body */

.ist-body {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 300px;
  min-height: 0;
}

.ist-tools {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0;
  border-right: 1px solid var(--border);
  background: var(--s1);
  overflow-y: auto;
}

.ist-tool {
  display: grid;
  place-items: center;
  width: 38px;
  height: 36px;
  flex: none;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--fg-2);
  cursor: pointer;
}

.ist-tool:hover {
  background: var(--s3);
  color: var(--fg);
}

.ist-tool.on {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent-2);
}

.ist-tool-sep {
  width: 28px;
  height: 1px;
  margin: 6px 0;
  background: var(--border);
}

.ist-swatches {
  position: relative;
  width: 40px;
  height: 40px;
  flex: none;
}

.ist-swatch {
  position: absolute;
  width: 24px;
  height: 24px;
  border: 2px solid var(--s1);
  border-radius: 5px;
  box-shadow: 0 0 0 1px var(--border-2);
  cursor: pointer;
}

.ist-swatch.fg {
  top: 0;
  left: 0;
  z-index: 1;
}

.ist-swatch.bg {
  right: 0;
  bottom: 0;
}

.ist-swatch-acts {
  display: flex;
  gap: 2px;
  margin-top: 4px;
}

.ist-mini {
  width: 18px;
  height: 18px;
  padding: 0;
  background: none;
  border: 0;
  color: var(--fg-3);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.ist-mini:hover {
  color: var(--fg);
}

.ist-color-input {
  position: fixed;
  left: -100px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* --------------------------------------------------------------- stage */

.ist-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background:
    radial-gradient(circle at 50% 40%, rgba(124, 92, 255, .05), transparent 60%),
    #0b0c11;
}

.ist-options {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 42px;
  padding: 5px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--s1);
  overflow-x: auto;
  scrollbar-width: thin;
}

.ist-options > * {
  flex: none;
}

.ist-opt-name {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--fg);
}

.ist-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ist-opt input[type=range] {
  width: 110px;
  accent-color: var(--accent);
}

.ist-opt select {
  width: auto;
  padding: 4px 8px;
  font-size: 12.5px;
}

.ist-opt .ist-extend-wf {
  max-width: 200px;
  text-overflow: ellipsis;
}

.ist-heal-prompt {
  width: 210px !important;
  padding: 4px 8px !important;
  font-size: 12.5px;
}

.ist-dim {
  width: 82px !important;
  padding: 4px 7px !important;
  font-size: 12.5px;
}

.ist-val {
  min-width: 38px;
  color: var(--fg-2);
}

.ist-options .seg-btn,
.ist-panel .seg-btn,
.ist-gen .seg-btn {
  padding: 4px 10px;
  font-size: 12px;
}

.ist-surface {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  touch-action: none;
}

.ist-canvas {
  position: absolute;
  inset: 0;
  display: block;
}

.ist-over {
  pointer-events: none;
}

.ist-surface[data-tool=brush],
.ist-surface[data-tool=eraser] {
  cursor: none;
}

.ist-surface[data-tool=marquee],
.ist-surface[data-tool=ellipse],
.ist-surface[data-tool=lasso],
.ist-surface[data-tool=gradient],
.ist-surface[data-tool=dropper] {
  cursor: crosshair;
}

.ist-surface[data-tool=text] {
  cursor: text;
}

.ist-surface[data-tool=hand] {
  cursor: grab;
}

.ist-surface[data-tool=zoom] {
  cursor: zoom-in;
}

.ist-surface.grab {
  cursor: grab !important;
}

.ist-surface.panning {
  cursor: grabbing !important;
}

.ist.dropping .ist-surface::after {
  content: 'Drop to add as a layer';
  position: absolute;
  inset: 12px;
  display: grid;
  place-items: center;
  border: 2px dashed var(--accent-line);
  border-radius: var(--r-lg);
  background: rgba(124, 92, 255, .08);
  color: var(--accent-2);
  font-weight: 650;
  pointer-events: none;
}

.ist-busy {
  position: absolute;
  top: 12px;
  left: 50%;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 24px);
  padding: 7px 12px;
  transform: translateX(-50%);
  background: rgba(20, 23, 31, .94);
  border: 1px solid var(--border-2);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-2);
  font-size: 12.5px;
}

.ist-busy[hidden] {
  display: none;
}

.ist-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: var(--sp-4);
}

.ist-empty-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  max-width: 460px;
  text-align: center;
}

.ist-empty-card .icon.lg {
  width: 44px;
  height: 44px;
  color: var(--accent-2);
}

/* ------------------------------------------------------ saved pictures */

.ist-empty {
  overflow-y: auto;
}

.ist-empty-card {
  margin: auto;
}

.ist-empty-saved {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  width: min(760px, 92vw);
  margin-top: var(--sp-4);
}

.ist-saved-sheet {
  width: min(860px, 94vw);
  max-width: none;
}

.ist-saved {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  width: 100%;
  max-height: 60vh;
  overflow-y: auto;
  text-align: left;
}

.ist-saved-card {
  position: relative;
  min-width: 0;
}

.ist-saved-open {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0;
  overflow: hidden;
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.ist-saved-open:hover {
  border-color: var(--accent-line);
}

.ist-saved-pic {
  aspect-ratio: 4 / 3;
  background:
    repeating-conic-gradient(#2a2f3c 0 25%, #222632 0 50%) 0 0 / 14px 14px;
}

.ist-saved-pic img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ist-saved-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 6px 8px 8px;
}

.ist-saved-meta .badge {
  align-self: flex-start;
}

.ist-saved-del {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: rgba(14, 16, 22, .8);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--fg-2);
  opacity: 0;
  cursor: pointer;
  transition: opacity var(--t-fast);
}

.ist-saved-card:hover .ist-saved-del,
.ist-saved-del:focus-visible {
  opacity: 1;
}

.ist-saved-del:hover {
  color: var(--danger);
}

@media (hover: none) {
  .ist-saved-del {
    opacity: 1;
  }
}

/* ---------------------------------------------------------- generative */

.ist-gen {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(860px, calc(100% - 24px));
  max-height: calc(100% - 28px);
  padding: 8px;
  transform: translateX(-50%);
  background: rgba(20, 23, 31, .94);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  backdrop-filter: blur(10px);
}

/* The prompt gets a line of its own, the width of the bar: it is what the
   bar is for, and squeezed between the controls it showed two words. */
.ist-gen-ask {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding: 2px;
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.ist-gen-ask:hover {
  border-color: var(--border-2);
}

.ist-gen-ask:focus-within {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.ist-gen-ask .btn {
  flex: none;
}

.ist-gen-prompt-in {
  flex: 1;
  min-width: 0;
  height: 32px;
  min-height: 32px !important;
  padding: 6px 8px !important;
  background: none !important;
  border: 0 !important;
  box-shadow: none !important;
  resize: none !important;
  line-height: 1.4 !important;
  font-size: 13.5px;
}

/* Under it, the controls at one height: what kind of fill, who, which
   workflow, then settings, count and Generate held together at the end. */
.ist-gen-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ist-gen-mode {
  flex: none;
  padding: 2px;
}

.ist-gen .seg-btn {
  height: 26px;
}

.ist-gen-row select {
  height: 32px;
  padding: 0 8px !important;
  font-size: 12.5px;
  text-overflow: ellipsis;
}

.ist-gen-char {
  flex: 0 1 160px;
  min-width: 0;
}

.ist-gen-wf {
  flex: 1 1 200px;
  min-width: 0;
  max-width: 340px;
}

.ist-gen-end {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  margin-left: auto;
}

.ist-gen-end .btn.sm.icon-only {
  height: 32px;
}

.ist-gen-row .ist-gen-count {
  width: auto;
  padding: 0 4px 0 8px !important;
}

.ist-gen-go {
  height: 32px;
}

.ist-gen .btn.on {
  background: var(--accent-soft);
  color: var(--accent-2);
}

.ist-gen-hint {
  padding: 0 4px;
  line-height: 1.4;
}

.ist-gen-settings {
  min-height: 0;
  max-height: 46vh;
  padding: 2px 4px 8px;
  border-bottom: 1px solid var(--border);
  overflow-y: auto;
  user-select: text;
}

.ist-gen-settings-in {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ist-gen-settings-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.ist-gen-params {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px 14px;
}

.ist-gen-params .param {
  min-width: 0;
}

/* ---------------------------------------------------------------- side */

.ist-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: 1px solid var(--border);
  background: var(--s1);
}

.ist-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-bottom: 1px solid var(--border);
}

.ist-panel:first-child {
  max-height: 48%;
}

.ist-panel.grow {
  flex: 1;
}

.ist-panel-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 9px 12px 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.ist-panel-title .icon {
  width: 14px;
  height: 14px;
}

.ist-props {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 2px 12px 12px;
  overflow-y: auto;
  user-select: text;
}

.ist-prop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 8px;
}

.ist-num {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ist-num > span:first-child {
  width: 34px;
  flex: none;
}

.ist-num input,
.ist-num select {
  min-width: 0;
  padding: 4px 6px !important;
  font-size: 12.5px;
}

.ist-prop-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.ist-prop-block .field > span {
  font-size: 11.5px;
}

.ist-prop-block input[type=text] {
  padding: 5px 8px;
  font-size: 12.5px;
}

.ist-prop-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 650;
}

.ist-prop-head .icon {
  width: 15px;
  height: 15px;
  color: var(--accent-2);
}

.ist-text-area {
  min-height: 64px !important;
  padding: 7px 9px !important;
  font-size: 13px;
}

.ist-color-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ist-color-row input[type=color] {
  width: 40px;
  height: 24px;
  padding: 0;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

.ist-props .ist-opt {
  justify-content: space-between;
}

.ist-props .ist-opt input[type=range] {
  flex: 1;
  width: auto;
  min-width: 0;
}

.ist-gen-prompt {
  max-height: 90px;
  margin: 0;
  overflow-y: auto;
  color: var(--fg-2);
  white-space: pre-wrap;
}

.ist-variants {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.ist-variant {
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  background: var(--s3);
  border: 2px solid transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
}

.ist-variant.on {
  border-color: var(--accent);
}

.ist-variant img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* -------------------------------------------------------------- layers */

.ist-layers {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.ist-layer-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 8px;
}

.ist-blend {
  flex: 1;
  min-width: 0;
  padding: 4px 6px !important;
  font-size: 12.5px;
}

.ist-opacity {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.ist-opacity input {
  flex: 1;
  min-width: 0;
  accent-color: var(--accent);
}

.ist-layer-list {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 0 6px;
  overflow-y: auto;
}

.ist-layer {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 50px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
}

.ist-layer:hover {
  background: var(--s2);
}

.ist-layer.on {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.ist-layer.hidden .ist-thumb,
.ist-layer.hidden .ist-layer-name {
  opacity: .45;
}

.ist-layer.dragging {
  opacity: .5;
}

.ist-layer.pending {
  cursor: default;
  border-style: dashed;
  border-color: var(--border-2);
}

.ist-layer-name {
  font-size: 12.5px;
  font-weight: 550;
}

.ist-eye {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 6px;
  color: var(--fg-2);
  cursor: pointer;
}

.ist-eye .icon {
  width: 16px;
  height: 16px;
}

.ist-eye:hover {
  background: var(--s4);
  color: var(--fg);
}

.ist-thumb {
  position: relative;
  width: 40px;
  height: 40px;
  flex: none;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 5px;
  background:
    repeating-conic-gradient(#bfbfbf 0 25%, #eee 0 50%) 0 0 / 10px 10px;
  overflow: hidden;
  cursor: pointer;
}

.ist-thumb.mask {
  background: #000;
}

.ist-thumb.target {
  border-color: #fff;
}

.ist-thumb.mask.off::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top right, transparent 46%, var(--danger) 47% 53%, transparent 54%);
}

.ist-thumb-c {
  display: block;
  width: 36px;
  height: 36px;
}

.ist-kind {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--fg-3);
}

.ist-drop-line {
  position: absolute;
  left: 6px;
  right: 6px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  pointer-events: none;
}

.ist-layer-foot {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border-top: 1px solid var(--border);
}

.spinner.sm {
  width: 14px;
  height: 14px;
  border-width: 2px;
  flex: none;
}

.ist-size-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ------------------------------------------------------------- narrow */

@media (max-width: 1100px) {
  .ist-body {
    grid-template-columns: 48px minmax(0, 1fr) 260px;
  }
}

@media (max-width: 820px) {
  /* Two rows on a phone: the menus and the few actions that matter, then the
     open pictures on a strip of their own — one row of all three ran off the
     side of the screen and took Save with it. */
  .ist-top {
    flex-wrap: wrap;
    row-gap: 4px;
    padding: 4px 6px;
  }

  .ist-menus {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .ist-tabs {
    order: 3;
    flex-basis: 100%;
  }

  .ist-zoom {
    display: none;
  }

  .ist-body {
    position: relative;
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .ist-side {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    width: min(320px, 88vw);
    transform: translateX(100%);
    transition: transform var(--t-med);
    box-shadow: var(--shadow-3);
  }

  .ist.side-open .ist-side {
    transform: none;
  }

  .ist-side-toggle {
    display: inline-flex;
  }

  .ist-hide-narrow {
    display: none !important;
  }

  .ist-menus .ist-menu {
    padding: 0 7px;
  }

  .ist-gen {
    bottom: 8px;
  }

  /* On a phone the controls wrap: the pickers share what is left, and the
     Generate end keeps to the right of whichever line it lands on. */
  .ist-gen-row {
    flex-wrap: wrap;
  }

  .ist-gen-char,
  .ist-gen-wf {
    flex: 1 1 120px;
    max-width: none;
  }

  .ist-gen-settings {
    max-height: 38vh;
  }

  .ist-tool {
    width: 36px;
    height: 34px;
  }
}

/* ------------------------------------------------- layers / history tabs */

.ist-side-tabs {
  display: flex;
  gap: 2px;
  padding: 6px 8px 4px;
}

.ist-side-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--fg-3);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
}

.ist-side-tab .icon {
  width: 14px;
  height: 14px;
}

.ist-side-tab:hover {
  color: var(--fg);
}

.ist-side-tab.on {
  background: var(--s3);
  border-color: var(--border);
  color: var(--fg);
}

.ist-layers[hidden],
.ist-history[hidden] {
  display: none;
}

.ist-history {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.ist-step-list {
  flex: 1;
  min-height: 0;
  padding: 0 6px;
  overflow-y: auto;
}

.ist-step {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--fg-2);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}

.ist-step:hover {
  background: var(--s2);
}

.ist-step.on {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--fg);
}

.ist-step.ahead {
  opacity: .45;
}

.ist-step-n {
  width: 22px;
  color: var(--fg-3);
  text-align: right;
}

.ist-step-note {
  padding: 6px 12px 10px;
  margin: 0;
}

/* --------------------------------------------------- groups and picking */

.ist-layer.member {
  margin-left: 16px;
}

.ist-layer.picked {
  background: rgba(124, 92, 255, .08);
  border-color: rgba(124, 92, 255, .25);
}

.ist-layer.group .ist-layer-name {
  font-weight: 650;
}

.ist-fold {
  display: grid;
  place-items: center;
  width: 18px;
  height: 24px;
  flex: none;
  padding: 0;
  background: none;
  border: 0;
  color: var(--fg-3);
  font-size: 12px;
  cursor: pointer;
}

.ist-fold:hover {
  color: var(--fg);
}

.ist-thumb.adjust {
  display: grid;
  place-items: center;
  background: var(--s3);
  color: var(--fg-2);
  cursor: default;
}

@media (pointer: coarse) {
  .ist-layer {
    min-height: 56px;
  }

  .ist-eye {
    width: 32px;
    height: 32px;
  }
}

/* --------------------------------------------------- frame from a video */

.ist-vf {
  width: min(960px, 96vw);
  max-width: none;
}

.ist-vf-stage {
  display: grid;
  place-items: center;
  margin-top: 10px;
  background: #000;
  border-radius: var(--r-md);
  overflow: hidden;
}

.ist-vf-video {
  display: block;
  max-width: 100%;
  max-height: 58vh;
}

.ist-vf-video[hidden] {
  display: none;
}

.ist-vf-scrub {
  width: 100%;
  margin-top: 10px;
  accent-color: var(--accent);
}

.ist-vf-row {
  gap: 4px;
  align-items: center;
}

.ist-vf-clock {
  color: var(--fg-2);
}

.ist-blend-btn {
  align-self: flex-start;
}

/* The font browser: each name in its own face. */
.ist-font-pop {
  position: fixed;
  z-index: 130;
  width: 280px;
  max-height: min(440px, 70vh);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  background: var(--s2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-3);
}
.ist-font-find { width: 100%; }
.ist-font-list { overflow-y: auto; display: flex; flex-direction: column; }
.ist-font-opt {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.ist-font-opt:hover, .ist-font-opt.on { background: var(--s3); }
.ist-font-name { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ist-sub { margin-top: 6px; text-transform: uppercase; letter-spacing: .06em; }
