/* ===== FONTS ===== */
    @import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

    /* ===== CSS VARIABLES ===== */
    :root {
      --vto-font: 'DM Sans', system-ui, sans-serif;
      --vto-bg: #FAFAFA;
      --vto-surface: #FFFFFF;
      --vto-surface-hover: #F5F5F5;
      --vto-border: #E8E8E8;
      --vto-border-active: #C0C0C0;
      --vto-text-primary: #1A1A1A;
      --vto-text-secondary: #6B6B6B;
      --vto-text-muted: #9E9E9E;
      --vto-accent: #2D2D2D;
      --vto-accent-hover: #444444;
      --vto-accent-text: #FFFFFF;
      --vto-error: #D4483B;
      --vto-error-bg: #FEF2F1;
      --vto-success: #2E8B57;
      --vto-success-bg: #F0FAF4;
      --vto-radius-sm: 8px;
      --vto-radius-md: 12px;
      --vto-radius-lg: 16px;
      --vto-shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
      --vto-shadow-md: 0 4px 16px rgba(0,0,0,0.08);
      --vto-shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
      --vto-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* ===== RESET & BASE ===== */
    *, *::before, *::after {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    body {
      font-family: var(--vto-font);
      background: #F0F0F0;
      _display: flex;
      align-items: center;
      justify-content: center;
      min-height: 100vh;
      padding: 16px;
    }

    /* ===== WIDGET CONTAINER ===== */
    .vto {
      width: 100%;
      max-width: 480px;
      min-width: 320px;
      background: var(--vto-bg);
      border-radius: var(--vto-radius-lg);
      box-shadow: var(--vto-shadow-lg);
      overflow: hidden;
      position: relative;
    }

    /* ===== HEADER ===== */
    .vto__header {
      padding: 20px 24px 16px;
      border-bottom: 1px solid var(--vto-border);
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .vto__title {
      font-size: 17px;
      font-weight: 600;
      color: var(--vto-text-primary);
      letter-spacing: -0.01em;
    }

    .vto__subtitle {
      font-size: 13px;
      color: var(--vto-text-secondary);
      margin-top: 2px;
    }

    .vto__close {
      width: 32px;
      height: 32px;
      border: none;
      background: transparent;
      border-radius: var(--vto-radius-sm);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--vto-text-secondary);
      transition: background var(--vto-transition);
      flex-shrink: 0;
    }

    .vto__close:hover {
      background: var(--vto-surface-hover);
    }

    .vto__close svg {
      width: 18px;
      height: 18px;
    }

    /* ===== BODY ===== */
    .vto__body {
      padding: 20px 24px 24px;
    }

    /* ===== STEP INDICATOR ===== */
    .vto__steps {
      display: flex;
      gap: 6px;
      margin-bottom: 20px;
    }

    .vto__step-dot {
      height: 3px;
      flex: 1;
      border-radius: 2px;
      background: var(--vto-border);
      transition: background var(--vto-transition);
    }

    .vto__step-dot--active {
      background: var(--vto-accent);
    }

    .vto__step-dot--done {
      background: var(--vto-success);
    }

    /* ===== SECTION LABEL ===== */
    .vto__label {
      font-size: 13px;
      font-weight: 500;
      color: var(--vto-text-secondary);
      text-transform: uppercase;
      letter-spacing: 0.05em;
      margin-bottom: 10px;
    }

    /* ===== UPLOAD ZONE ===== */
    .vto__upload {
      border: 2px dashed var(--vto-border);
      border-radius: var(--vto-radius-md);
      padding: 28px 20px;
      text-align: center;
      cursor: pointer;
      transition: border-color var(--vto-transition), background var(--vto-transition);
      position: relative;
      overflow: hidden;
    }

    .vto__upload:hover,
    .vto__upload--dragover {
      border-color: var(--vto-border-active);
      background: var(--vto-surface);
    }

    .vto__upload--has-image {
      padding: 0;
      border-style: solid;
      border-color: var(--vto-border);
    }

    .vto__upload-icon {
      width: 40px;
      height: 40px;
      margin: 0 auto 10px;
      color: var(--vto-text-muted);
    }

    .vto__upload-text {
      font-size: 14px;
      color: var(--vto-text-secondary);
      line-height: 1.5;
    }

    .vto__upload-hint {
      font-size: 12px;
      color: var(--vto-text-muted);
      margin-top: 4px;
    }

    .vto__upload input[type="file"] {
      display: none;
    }

    /* Preview inside upload zone */
    .vto__preview {
	  width: 100%;
	  aspect-ratio: 3 / 5;
	  object-fit: contain;
	  display: block;
	  border-radius: calc(var(--vto-radius-md) - 2px);
	  background: var(--vto-surface-hover);  /* #F5F5F5 — нейтральный фон для letterbox */
	}

    .vto__preview-overlay {
      position: absolute;
      inset: 0;
      background: rgba(0,0,0,0.4);
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      transition: opacity var(--vto-transition);
      border-radius: calc(var(--vto-radius-md) - 2px);
    }

    .vto__upload--has-image:hover .vto__preview-overlay {
      opacity: 1;
    }

    .vto__preview-change {
      font-size: 13px;
      font-weight: 500;
      color: #fff;
      background: rgba(0,0,0,0.5);
      padding: 8px 16px;
      border-radius: var(--vto-radius-sm);
      backdrop-filter: blur(4px);
    }

    /* ===== PHOTO GRID (two photos side by side) ===== */
    .vto__photos {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px;
      margin-bottom: 16px;
    }

    .vto__photos .vto__upload {
	  padding: 16px 12px;
	  display: flex;
	  flex-direction: column;
	  align-items: center;
	  justify-content: center;
	}

    .vto__photos .vto__upload-icon {
      width: 32px;
      height: 32px;
      margin-bottom: 8px;
    }

    .vto__photos .vto__upload-text {
      font-size: 13px;
    }

    /* ===== CATEGORY SELECTOR ===== */
    .vto__categories {
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      gap: 6px;
      margin-bottom: 20px;
    }

    .vto__category {
      border: 1.5px solid var(--vto-border);
      border-radius: var(--vto-radius-md);
      background: var(--vto-surface);
      padding: 10px 2px 8px;
      text-align: center;
      cursor: pointer;
      transition: all var(--vto-transition);
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
    }

    .vto__category:hover {
      border-color: var(--vto-border-active);
      background: var(--vto-surface-hover);
    }

    .vto__category--active {
      border-color: var(--vto-accent);
      background: var(--vto-accent);
      color: var(--vto-accent-text);
    }

    .vto__category--active .vto__category-label {
      color: var(--vto-accent-text);
    }

    .vto__category-icon {
      width: 24px;
      height: 24px;
      flex-shrink: 0;
    }

    .vto__category-label {
      font-size: 11px;
      font-weight: 500;
      color: var(--vto-text-secondary);
      transition: color var(--vto-transition);
    }

    /* ===== PRIMARY BUTTON ===== */
    .vto__btn {
      width: 100%;
      padding: 14px 24px;
      border: none;
      border-radius: var(--vto-radius-md);
      font-family: var(--vto-font);
      font-size: 15px;
      font-weight: 600;
      cursor: pointer;
      transition: all var(--vto-transition);
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
    }

    .vto__btn--primary {
      background: var(--vto-accent);
      color: var(--vto-accent-text);
    }

    .vto__btn--primary:hover:not(:disabled) {
      background: var(--vto-accent-hover);
      transform: translateY(-1px);
      box-shadow: var(--vto-shadow-md);
    }

    .vto__btn--primary:disabled {
      opacity: 0.4;
      cursor: not-allowed;
    }

    .vto__btn--secondary {
      background: var(--vto-surface);
      color: var(--vto-text-primary);
      border: 1.5px solid var(--vto-border);
    }

    .vto__btn--secondary:hover {
      border-color: var(--vto-border-active);
      background: var(--vto-surface-hover);
    }

    .vto__btn--small {
      padding: 10px 16px;
      font-size: 13px;
    }

    /* ===== PROCESSING STATE ===== */
    .vto__processing {
	  text-align: center;
	  padding: 20px 20px 24px;
	}

    .vto__spinner {
      width: 48px;
      height: 48px;
      margin: 0 auto 20px;
      border: 3px solid var(--vto-border);
      border-top-color: var(--vto-accent);
      border-radius: 50%;
      animation: vto-spin 0.8s linear infinite;
    }

    @keyframes vto-spin {
      to { transform: rotate(360deg); }
    }

    .vto__processing-text {
      font-size: 15px;
      font-weight: 500;
      color: var(--vto-text-primary);
      margin-bottom: 4px;
    }

    .vto__processing-hint {
      font-size: 13px;
      color: var(--vto-text-muted);
    }

    /* Shimmer effect on processing photos */
    .vto__processing-photos {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px;grid-template-columns
      margin-bottom: 24px;
    }

	.vto__processing-thumb {
	  aspect-ratio: 3 / 5;
	  border-radius: var(--vto-radius-md);
	  object-fit: contain;
	  width: 100%;
	  position: relative;
	  overflow: hidden;
	  background: var(--vto-surface-hover);
	}

    .vto__processing-thumb::after {
      content: '';
      position: absolute;
      inset: 0;
      background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
      animation: vto-shimmer 1.5s ease-in-out infinite;
    }

    @keyframes vto-shimmer {
      0% { transform: translateX(-100%); }
      100% { transform: translateX(100%); }
    }

    /* ===== RESULT STATE ===== */
    .vto__result {
      text-align: center;
    }

    .vto__result-image {
	  width: 100%;
	  max-height: 55vh;            /* не занимает больше 55% высоты экрана */
	  object-fit: contain;         /* не кропает, показывает целиком */
	  border-radius: var(--vto-radius-md);
	  box-shadow: var(--vto-shadow-sm);
	  margin-bottom: 12px;
	  background: var(--vto-surface-hover); /* нейтральный фон для contain */
	  display: block;
	}

    .vto__result-actions {
      display: flex;
      gap: 8px;
    }

    .vto__result-actions .vto__btn {
      flex: 1;
    }

    /* ===== ERROR STATE ===== */
    .vto__error {
      text-align: center;
      padding: 24px 20px;
    }

    .vto__error-icon {
      width: 48px;
      height: 48px;
      margin: 0 auto 16px;
      color: var(--vto-error);
      background: var(--vto-error-bg);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .vto__error-icon svg {
      width: 24px;
      height: 24px;
    }

    .vto__error-title {
      font-size: 15px;
      font-weight: 600;
      color: var(--vto-text-primary);
      margin-bottom: 4px;
    }

    .vto__error-message {
      font-size: 13px;
      color: var(--vto-text-secondary);
      margin-bottom: 20px;
      line-height: 1.5;
    }

    /* ===== STATE VISIBILITY ===== */
    .vto__state {
      display: none;
    }

    .vto__state--visible {
      display: block;
      animation: vto-fade-in 0.3s ease;
    }

    @keyframes vto-fade-in {
      from { opacity: 0; transform: translateY(8px); }
      to { opacity: 1; transform: translateY(0); }
    }

    /* ===== FILE SIZE WARNING ===== */
    .vto__warning {
      font-size: 12px;
      color: var(--vto-error);
      margin-top: 6px;
      display: none;
    }

    .vto__warning--visible {
      display: block;
    }

    /* ===== RESPONSIVE ===== */
    @media (max-width: 380px) {
      .vto__body {
        padding: 16px;
      }

      .vto__categories {
        grid-template-columns: repeat(3, 1fr);
      }

      .vto__header {
        padding: 16px;
      }
    }
    
    
    
    
    
    
    /* ── Ссылка-триггер ─────────────────────────────── */
.vto-open-btn {
    padding: 16px 20px;
    box-shadow: inset 0 0 0 1px #a9a9a9;
    font-family: open_sans;
    font-weight: 300;
    font-size: 14px;
    line-height: 1;
    color: #a9a9a9;
    display: block;
    text-transform: uppercase;
    text-decoration: none;
}
.vto-open-btn:hover {
  background: #222;
  color: #fff;
}

/* ── Оверлей ────────────────────────────────────── */
.vto-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 9998;
  justify-content: center;
  align-items: center;
  padding: 16px;
  overflow-y: auto;
}
.vto-overlay--open {
  display: flex;
}

/* ── Попап ──────────────────────────────────────── */
.vto-popup {
  position: relative;
  z-index: 9999;
  background: #fff;
  border-radius: 12px;
  max-height: 90vh;
  overflow-y: auto;
  width: fit-content;
}

/* ── Крестик закрытия ───────────────────────────── */
.vto-popup__close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: rgba(0,0,0,.08);
  border-radius: 50%;
  font-size: 14px;
  color: #222;
  text-decoration: none;
  z-index: 10000;
  transition: background .15s;
}
.vto-popup__close:hover {
  background: rgba(0,0,0,.18);
}

#btnShare {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  text-decoration: none;
  color: #fff;
  background: #2AABEE;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  width: 100%;
  transition: background .15s;
}
#btnShare:hover { background: #1a96d4; }


    
    #vto-modal-close {
	    flex: 1;
	    padding: 8px;
	    border-radius: 6px;
	    font-family: sans-serif;
	    font-size: 13px;
	    cursor: pointer;
	    border: 1.5px solid #ddd;
	    margin-top: 20px;
	    background: none;
	    color: #555;
	    transition: all .15s;    
	    text-align: center;
    }
    
/* ===== СКРЫТИЕ БЛОКА КАТЕГОРИЙ ===== */
#categoryLabel,
#categories {
  display: none;
}

/* ===== TIPS BLOCK ===== */
.vto__tips {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #EFF6FF;
  border-radius: var(--vto-radius-md);
  padding: 14px 16px;
  margin-bottom: 20px;
}

.vto__tips-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: #d64b40;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin-top: 1px;
}

.vto__tips-icon svg {
  width: 16px;
  height: 16px;
}

.vto__tips-title {
  font-size: 13px;
  font-weight: 600 !important;
  color: var(--vto-text-primary);
  margin-bottom: 8px;
}

.vto__tips-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 16px;
}

.vto__tips-item {
  font-size: 12px;
  color: var(--vto-text-secondary);
  line-height: 1.4;
  display: flex;
  gap: 5px;
}

.vto__tips-item::before {
  content: '✓';
  color: #d64b40;
  font-weight: 700;
  flex-shrink: 0;
}

@media (max-width: 380px) {
  .vto__tips-grid {
    grid-template-columns: 1fr;
  }
}

.vto__tips-note {
    font-size: 12px;
    color: var(--vto-text-secondary);
    line-height: 1.4;
    margin-top:10px;
}

.vto__tips-note b {
    font-weight: 600 !important;
    color: #d64b40;
}