/* Картинки Я.Игр — студия экспорта */

.tool-stage--yg-images {
  width: min(1480px, 100%);
}

.yg-images-tool-root .tool-stage--yg-images {
  padding-bottom: 0.75rem;
}

/* —— Шапка сайдбара —— */
.yg-img-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.15rem;
}

.yg-img-header__text {
  min-width: 0;
}

.yg-img-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.yg-img-tagline {
  margin: 0.2rem 0 0;
  font-size: 0.7rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.yg-img-badge {
  flex-shrink: 0;
  padding: 0.2rem 0.5rem;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-hover);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 0;
}

.yg-img-about summary {
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  list-style-position: outside;
}

.yg-img-about summary:hover {
  color: var(--text);
}

.yg-img-disclaimer {
  margin: 0.35rem 0 0.5rem;
  padding: 0.5rem 0.65rem;
  border-radius: 0;
  border: 1px solid rgba(108, 182, 255, 0.28);
  background: linear-gradient(
    135deg,
    rgba(108, 182, 255, 0.08) 0%,
    rgba(108, 182, 255, 0.02) 100%
  );
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.yg-img-doc-link {
  margin: 0;
  font-size: 0.75rem;
}

.yg-img-doc-link a {
  color: var(--accent-hover);
  text-decoration: none;
}

.yg-img-doc-link a:hover {
  text-decoration: underline;
}

/* —— Секции панели —— */
.yg-img-panel-section {
  padding-top: 0.55rem;
  margin-top: 0.55rem;
  border-top: 1px solid var(--border);
}

.yg-img-panel-section:first-of-type {
  margin-top: 0.25rem;
}

.yg-img-panel-section--actions {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(108, 182, 255, 0.03) 100%
  );
  border-radius: 0;
}

/* —— Две колонки —— */
.yg-img-layout {
  display: flex;
  flex-wrap: nowrap;
  gap: 1.1rem;
  align-items: flex-start;
}

.yg-img-col--pick {
  flex: 0 0 min(312px, 34vw);
  width: min(312px, 34vw);
  position: sticky;
  top: 0.5rem;
  max-height: calc(100dvh - 5rem);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.yg-img-col--pick .card {
  margin: 0;
  box-shadow: none;
}

.yg-img-col--studio {
  flex: 1 1 auto;
  min-width: 0;
  position: sticky;
  top: 0.5rem;
  align-self: flex-start;
}

.yg-img-col--studio > .card {
  margin: 0;
  width: 100%;
  background: linear-gradient(
    165deg,
    var(--bg-elevated) 0%,
    rgba(5, 5, 5, 0.15) 100%
  );
}

.yg-img-studio {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
}

/* —— Превью-студия —— */
.yg-img-preview-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0 0;
  width: 100%;
}

.yg-img-preview-canvas-wrap {
  --yg-checker: rgba(128, 128, 128, 0.04);
  --yg-checker2: rgba(128, 128, 128, 0.07);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: clamp(280px, calc(100dvh - 15rem), 680px);
  overflow: hidden;
  border-radius: 0;
  border: 1px solid var(--border);
  background-color: rgba(5, 5, 5, 0.35);
  background-image:
    linear-gradient(45deg, var(--yg-checker) 25%, transparent 25%),
    linear-gradient(-45deg, var(--yg-checker) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--yg-checker) 75%),
    linear-gradient(-45deg, transparent 75%, var(--yg-checker) 75%),
    linear-gradient(135deg, var(--yg-checker2) 0%, transparent 50%);
  background-size: 16px 16px, 16px 16px, 16px 16px, 16px 16px, 100% 100%;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0, 0 0;
  box-shadow: none;
}

.yg-img-preview-canvas-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 0;
  box-shadow: none;
}

.yg-img-preview-canvas-wrap.yg-img-preview-empty::after {
  content: "Добавьте изображение слева";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: 85%;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
  pointer-events: none;
  opacity: 0.85;
}

.yg-img-preview-canvas-wrap.is-maskable {
  box-shadow: none;
}

.yg-img-preview-hint {
  margin: 0;
  flex-shrink: 0;
  max-width: 36rem;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--text-muted);
  text-align: center;
}

.yg-img-maskable-legend {
  margin: 0;
  padding: 0.35rem 0.65rem;
  font-size: 0.68rem;
  line-height: 1.35;
  color: var(--accent-hover);
  text-align: center;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 0;
}

.yg-img-maskable-legend[hidden] {
  display: none !important;
}

.yg-img-preview-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.5rem;
  margin: 0;
  min-height: 1.5rem;
}

.yg-img-meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-muted);
  background: rgba(240, 240, 240, 0.05);
  border: 1px solid var(--border);
  border-radius: 0;
}

.yg-img-meta-pill--accent {
  color: var(--accent-hover);
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.yg-img-meta-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
}

.yg-img-preview-canvas {
  position: relative;
  z-index: 1;
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 0;
  border: 1px solid rgba(128, 128, 128, 0.12);
  cursor: grab;
  touch-action: none;
  box-shadow: none;
  transition: box-shadow var(--dur-fast);
}

.yg-img-preview-canvas:hover {
  box-shadow: none;
}

.yg-img-preview-canvas:active {
  cursor: grabbing;
}

/* —— Док —— */
.yg-img-dock-wrap {
  flex: 0 0 auto;
  padding: 0.65rem 0 0.15rem;
  border-top: 1px solid var(--border);
}

.yg-img-dock-wrap[hidden] {
  display: none !important;
}

.yg-img-dock-title {
  margin: 0 0 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.yg-img-dock-grid {
  display: flex;
  flex-direction: row;
  gap: 0.55rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.15rem 0.5rem 0.45rem;
  margin: 0 -0.35rem;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-border) transparent;
  mask-image: linear-gradient(
    90deg,
    transparent 0,
    #000 12px,
    #000 calc(100% - 12px),
    transparent 100%
  );
}

.yg-img-dock-card {
  flex: 0 0 108px;
  width: 108px;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.45rem 0.5rem 0.5rem;
  border-radius: 0;
  border: 2px solid var(--border);
  background: var(--bg-elevated);
  cursor: pointer;
  text-align: left;
  scroll-snap-align: center;
  transition:
    border-color var(--dur-fast),
    background var(--dur-fast),
    transform var(--dur-fast),
    box-shadow var(--dur-fast);
}

.yg-img-dock-card:hover {
  border-color: var(--accent-border);
  transform: translateY(-2px);
}

.yg-img-dock-card.is-active {
  border-color: var(--accent-hover);
  background: var(--accent-soft);
  box-shadow: none;
}

.yg-img-dock-card__thumb-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0.15rem;
  border-radius: 0;
  background: rgba(5, 5, 5, 0.35);
  border: 1px solid var(--border);
}

.yg-img-dock-card.is-active .yg-img-dock-card__thumb-wrap {
  border-color: var(--accent-border);
}

.yg-img-dock-card__head {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-height: 0;
}

.yg-img-dock-card__label {
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.yg-img-dock-card__group {
  align-self: flex-start;
  padding: 0.05rem 0.35rem;
  font-size: 0.58rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  background: rgba(240, 240, 240, 0.05);
  border-radius: 0;
}

.yg-img-dock-card__size {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--accent-hover);
  font-variant-numeric: tabular-nums;
}

.yg-img-dock-card__thumb {
  width: 100%;
  height: auto;
  border-radius: 0;
  border: none;
  background: transparent;
  pointer-events: none;
}

/* —— Настройки кадра —— */
.yg-img-controls-sidebar {
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.yg-img-controls-heading {
  margin: 0 0 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.yg-img-controls {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.yg-img-controls-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 0.65rem;
  align-items: end;
}

.yg-img-controls-field--wide {
  width: 100%;
}

.yg-img-controls .field {
  margin: 0;
  min-width: 0;
}

.yg-img-controls .field__label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.7rem;
}

.yg-img-controls .input,
.yg-img-controls select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.yg-img-controls input[type="range"] {
  display: block;
  width: 100%;
  margin: 0.15rem 0 0;
  accent-color: var(--accent-hover);
}

.yg-img-controls-reset .btn {
  width: 100%;
}

.yg-img-scale-xy-row[hidden] {
  display: none !important;
}

.yg-img-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.yg-img-file-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.yg-img-file-label {
  flex: 1 1 100%;
  font-size: 0.72rem;
  color: var(--text-muted);
  word-break: break-all;
  padding: 0.35rem 0.5rem;
  border-radius: 0;
  background: rgba(5, 5, 5, 0.2);
  border: 1px dashed var(--border);
  min-height: 1.75rem;
  line-height: 1.4;
}

.yg-img-save-hint {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.yg-img-clear-draft {
  align-self: flex-start;
}

.yg-img-presets-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8125rem;
  padding: 0.15rem 0;
}

.yg-img-presets-details[open] summary {
  margin-bottom: 0.35rem;
}

.yg-img-preset-group {
  margin-top: 0.65rem;
  padding: 0.5rem 0.55rem;
  border-radius: 0;
  background: rgba(5, 5, 5, 0.15);
  border: 1px solid var(--border);
}

.yg-img-preset-group:first-child {
  margin-top: 0.35rem;
}

.yg-img-preset-group__title {
  margin: 0 0 0.2rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.yg-img-preset-group__hint {
  margin: 0 0 0.4rem;
  font-size: 0.65rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.yg-img-preset-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.yg-img-preset-group__list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.15rem;
}

.yg-img-preset-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.5rem;
  border-radius: 0;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.75rem;
  transition:
    background var(--dur-fast),
    border-color var(--dur-fast);
}

.yg-img-preset-row:hover {
  background: rgba(240, 240, 240, 0.04);
}

.yg-img-preset-row.is-active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  box-shadow: none;
}

.yg-img-preset-row input[type="checkbox"] {
  flex-shrink: 0;
  accent-color: var(--accent-hover);
}

.yg-img-preset-row__main {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}

.yg-img-preset-row__main strong {
  font-weight: 600;
  line-height: 1.25;
}

.yg-img-preset-row__size {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}

.yg-img-custom-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.35rem;
}

.yg-img-custom-wrap {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.yg-img-custom-row.is-active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.yg-img-custom-del {
  flex-shrink: 0;
  width: 1.6rem;
  height: 1.6rem;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition:
    color var(--dur-fast),
    background var(--dur-fast);
}

.yg-img-custom-del:hover {
  color: var(--danger);
  background: rgba(108, 182, 255, 0.1);
}

.yg-img-range-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  min-width: 0;
}

.yg-img-range-row input[type="range"] {
  flex: 1 1 auto;
  min-width: 0;
  width: 0;
}

.yg-img-range-val {
  flex: 0 0 auto;
  font-size: 0.68rem;
  color: var(--text-muted);
  min-width: 2.75rem;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.yg-img-check {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.yg-img-check input {
  accent-color: var(--accent-hover);
}

.yg-img-color {
  width: 100%;
  height: 2.25rem;
  padding: 0.15rem;
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--bg-elevated);
  cursor: pointer;
}

.yg-img-download-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.yg-img-download-row .btn--primary {
  flex: 1 1 auto;
  min-width: 8rem;
}

.yg-img-status {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--text-muted);
  min-height: 1.1rem;
}

.yg-img-status:not(:empty):not(.yg-img-status--err) {
  color: var(--accent-hover);
}

.yg-img-status--err {
  color: var(--danger);
}

.input--compact {
  max-width: 100%;
}

.workspace__body.has-tool-backdrop:has(.yg-images-tool-root) .yg-images-tool-root {
  width: 100%;
  max-width: none;
}

@media (max-width: 900px) {
  .yg-img-layout {
    flex-direction: column;
  }

  .yg-img-col--pick {
    flex: 1 1 auto;
    width: 100%;
    max-height: none;
    position: static;
  }

  .yg-img-col--studio {
    width: 100%;
    position: static;
  }

  .yg-img-preview-canvas-wrap {
    height: clamp(220px, 48dvh, 420px);
  }

  .yg-img-header {
    flex-wrap: wrap;
  }

  .yg-img-dock-grid {
    mask-image: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .yg-img-dock-card:hover {
    transform: none;
  }
}
