/* EzuEditor — спокойная тёмная тема */
:root {
  --bg: #0d1117;
  --bg-2: #10161e;
  --surface: #151c26;
  --surface-2: #1b2431;
  --border: rgba(148, 163, 184, 0.13);
  --border-strong: rgba(148, 163, 184, 0.24);
  --text: #e6ebf2;
  --muted: #93a1b4;
  --faint: #6b7a8f;
  --accent: #6ee7c9;
  --accent-dim: rgba(110, 231, 201, 0.12);
  --accent-2: #8ab4ff;
  --accent-2-dim: rgba(138, 180, 255, 0.12);
  --danger: #f58c8c;
  --danger-dim: rgba(245, 140, 140, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --font: "Segoe UI", "SF Pro Display", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: dark; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 15% -5%, rgba(110, 231, 201, 0.07), transparent 60%),
    radial-gradient(900px 500px at 85% 0%, rgba(138, 180, 255, 0.06), transparent 60%),
    radial-gradient(1200px 700px at 50% 110%, rgba(110, 231, 201, 0.04), transparent 60%);
  pointer-events: none;
}

/* Фоновое изображение: растянуто на весь экран, 10% видимости */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url("../fons.png") no-repeat center / cover;
  opacity: 0.1;
  pointer-events: none;
}

::selection { background: rgba(110, 231, 201, 0.25); }

.hidden { display: none !important; }

a { color: var(--accent); text-decoration: none; }

h1, h2, h3 { font-weight: 650; letter-spacing: -0.01em; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.2s ease;
  user-select: none;
}
.btn:hover { background: #222d3d; border-color: rgba(148, 163, 184, 0.4); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, #4fd6b4, #6ee7c9);
  border-color: transparent;
  color: #08231c;
  box-shadow: 0 6px 24px rgba(110, 231, 201, 0.22);
}
.btn-primary:hover { background: linear-gradient(135deg, #5ce0c0, #7df0d4); border-color: transparent; }
.btn-primary:disabled { box-shadow: none; }

.btn-ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-block { width: 100%; }
.btn-big { padding: 14px 20px; font-size: 15px; }

/* ---------- Тосты ---------- */
#toasts {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(92vw, 380px);
}
.toast {
  background: #1c2734;
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  box-shadow: var(--shadow);
  animation: toast-in 0.25s ease;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast-err { border-left-color: var(--danger); }
.toast-out { opacity: 0; transform: translateY(-8px); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Общие блоки ---------- */
.view { max-width: 1280px; margin: 0 auto; padding: 24px 24px 60px; }

.view-head {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 8px 0 26px;
  flex-wrap: wrap;
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  transition: all 0.15s ease;
}
.back-btn svg { width: 16px; height: 16px; }
.back-btn:hover { color: var(--text); background: var(--surface-2); border-color: var(--border-strong); }
.view-title h1 { font-size: 26px; }
.view-title p { color: var(--muted); font-size: 14px; margin-top: 2px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.panel h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
  margin-bottom: 14px;
  font-weight: 700;
}

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 7px;
  font-weight: 600;
}
.field-label span { color: var(--accent); font-variant-numeric: tabular-nums; }

select, input[type="number"], input[type="text"] {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease;
}
select:focus, input:focus { border-color: var(--accent); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2393a1b4' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
input[type="number"] { appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }
input[type="color"] {
  width: 100%;
  height: 42px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 4px;
  cursor: pointer;
}

/* Range */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(110, 231, 201, 0.5), rgba(110, 231, 201, 0.15));
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #eafff8;
  border: 2px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: transform 0.12s ease;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #eafff8;
  border: 2px solid var(--accent);
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.check input {
  width: 17px; height: 17px;
  accent-color: var(--accent);
  cursor: pointer;
}

.hint { font-size: 12.5px; color: var(--faint); margin-top: 7px; line-height: 1.45; }

.err {
  background: var(--danger-dim);
  border: 1px solid rgba(245, 140, 140, 0.3);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 13.5px;
  margin-top: 12px;
  line-height: 1.5;
}

.progress { margin-top: 14px; }
.progress-track {
  height: 8px;
  border-radius: 4px;
  background: var(--surface-2);
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  background: linear-gradient(90deg, #4fd6b4, #8ab4ff);
  transition: width 0.25s ease;
}
.progress-text { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* ---------- Главное меню ---------- */
.home { max-width: 960px; margin: 0 auto; padding: 40px 24px 80px; text-align: center; }

.home-hero { margin: 12px 0 40px; }

/* ---------- Бренд-логотип «EzuEditor — работа с фото» ---------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
  flex: none;
}
.brand-mark {
  width: 44px; height: 44px;
  border-radius: 12px;
  object-fit: contain;
  display: block;
  flex: none;
}
.brand-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}
.brand-name { font-size: 21px; font-weight: 800; letter-spacing: -0.01em; }
.brand-tag { font-size: 11px; color: var(--muted); margin-top: 1px; letter-spacing: 0.02em; }
.brand:hover .brand-name { color: var(--accent); }

/* Крупная версия для главной — только название */
.brand-large { flex-direction: column; gap: 0; }
.brand-large .brand-text { align-items: center; }
.brand-large .brand-name { font-size: 42px; letter-spacing: -0.02em; }
.brand-large .brand-tag { font-size: 14px; margin-top: 3px; }

.home-sub { color: var(--muted); font-size: 16px; margin-top: 14px; max-width: 560px; margin-left: auto; margin-right: auto; }

.home-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  text-align: left;
}
.tool-card {
  position: relative;
  display: flex;
  gap: 18px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 26px 24px;
  color: var(--text);
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.25s ease;
}
.tool-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.tool-card:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.tool-card:hover::before { opacity: 1; }
.tool-cutout::before { background: radial-gradient(420px 180px at 0% 0%, var(--accent-dim), transparent 70%); }
.tool-convert::before { background: radial-gradient(420px 180px at 0% 0%, var(--accent-2-dim), transparent 70%); }

.tool-icon {
  flex: 0 0 52px;
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tool-icon svg { width: 26px; height: 26px; }
.tool-cutout .tool-icon { background: var(--accent-dim); color: var(--accent); }
.tool-convert .tool-icon { background: var(--accent-2-dim); color: var(--accent-2); }

.tool-body h2 { font-size: 20px; margin-bottom: 8px; }
.tool-body p { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.tool-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tool-tags span {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
}
.tool-arrow {
  position: absolute;
  right: 20px; bottom: 18px;
  color: var(--faint);
  transition: color 0.2s ease, transform 0.2s ease;
}
.tool-arrow svg { width: 20px; height: 20px; }
.tool-card:hover .tool-arrow { color: var(--accent); transform: translateX(4px); }

.home-note { color: var(--faint); font-size: 13px; margin-top: 42px; }

/* ---------- SEO-описание на главной ---------- */
.seo {
  margin-top: 56px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}
.seo h2 { font-size: 22px; margin-bottom: 12px; }
.seo > p { color: var(--muted); font-size: 15px; max-width: 720px; line-height: 1.6; }
.seo-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 24px;
}
.seo-col h3 { font-size: 16px; margin-bottom: 8px; color: var(--accent); }
.seo-col p { color: var(--muted); font-size: 14px; line-height: 1.6; }
@media (max-width: 640px) {
  .seo-cols { grid-template-columns: 1fr; }
  .seo { padding: 22px; }
}

/* ---------- Обрезка ---------- */
.cutout-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  align-items: start;
}
.cutout-stage { position: relative; }

.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  min-height: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  text-align: center;
  padding: 40px 24px;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}
.dropzone:hover, .dropzone.dragging { border-color: var(--accent); background: var(--surface-2); }
.dropzone.dragging { transform: scale(1.005); }
.dz-icon {
  width: 64px; height: 64px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: var(--accent-dim);
  margin-bottom: 6px;
}
.dz-icon svg { width: 30px; height: 30px; }
.dz-title { font-size: 17px; font-weight: 650; }
.dz-sub { color: var(--muted); font-size: 13.5px; }

.img-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.img-box {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
}
.img-box canvas {
  display: block;
  max-width: 100%;
  border-radius: 12px;
}
.checker {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background:
    repeating-conic-gradient(#1a222d 0% 25%, #141b25 0% 50%) 0 0 / 20px 20px;
}
.result-block {
  margin-top: 20px;
}
.result-block-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
  font-weight: 700;
  margin-bottom: 10px;
}
.stage-caption {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--faint);
  text-align: center;
}

/* ---------- Сравнение «до/после» с зумом ---------- */
.compare {
  position: relative;
  height: min(60vh, 520px);
  min-height: 320px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background:
    repeating-conic-gradient(#1a222d 0% 25%, #141b25 0% 50%) 0 0 / 24px 24px;
  touch-action: none;
  cursor: ew-resize;
  user-select: none;
}
.cmp-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: transparent;
}
#cmp-before { will-change: clip-path; }
.cmp-handle {
  position: absolute;
  top: 0; bottom: 0;
  width: 26px;
  transform: translateX(-50%);
  cursor: ew-resize;
  z-index: 5;
  touch-action: none;
}
.cmp-handle::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 0; bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 0 14px rgba(0, 0, 0, 0.6);
}
.cmp-grip {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #eafff8;
  border: 2px solid var(--accent);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.cmp-grip::before, .cmp-grip::after {
  content: "";
  width: 6px; height: 6px;
  border-top: 2px solid #0c3b30;
  border-left: 2px solid #0c3b30;
  position: absolute;
  top: 13px;
}
.cmp-grip::before { left: 9px; transform: rotate(-45deg); }
.cmp-grip::after { right: 9px; transform: rotate(135deg); }
.cmp-label {
  position: absolute;
  top: 12px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(10, 15, 22, 0.72);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border);
  z-index: 4;
  pointer-events: none;
}
.cmp-label-before { left: 12px; color: var(--muted); }
.cmp-label-after { right: 12px; color: var(--accent); }

.cmp-zoom {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(10, 15, 22, 0.78);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 5px 8px;
  z-index: 6;
}
.z-btn {
  width: 27px; height: 27px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.12s ease;
}
.z-btn:hover { background: #263144; transform: scale(1.08); }
.z-btn:active { transform: scale(0.94); }
.z-label {
  min-width: 46px;
  text-align: center;
  font-size: 12px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.cutout-panel { display: flex; flex-direction: column; gap: 16px; }
.cutout-panel .panel { margin-bottom: 0; }

.btn-row { display: flex; gap: 10px; margin-bottom: 12px; }
.btn-row .btn { flex: 1; }

/* ---------- Конвертор ---------- */
.conv-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 22px;
  align-items: start;
}
.conv-source { position: relative; }
.conv-source .dropzone { min-height: 300px; }
.conv-source #from-cutout { margin-bottom: 16px; }

.src-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.src-meta > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13.5px;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 7px;
}
.src-meta span { color: var(--faint); }
.src-meta b { font-weight: 600; word-break: break-all; text-align: right; }
.src-thumb {
  max-width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: block;
  background: repeating-conic-gradient(#1a222d 0% 25%, #141b25 0% 50%) 0 0 / 16px 16px;
}

.resize-row { display: flex; gap: 12px; }
.resize-row .field { flex: 1; }

.flip-row { display: flex; gap: 18px; flex-wrap: wrap; }

.conv-result { grid-column: 1 / -1; }
.result-card {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.result-preview {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-conic-gradient(#1a222d 0% 25%, #141b25 0% 50%) 0 0 / 20px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 16px;
  min-height: 240px;
}
.result-preview img { max-width: 100%; max-height: 420px; border-radius: 6px; }
.result-info { flex: 0 0 280px; display: flex; flex-direction: column; gap: 14px; }
.result-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.result-meta > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13.5px;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 7px;
}
.result-meta span { color: var(--faint); }
.result-meta b { font-weight: 600; text-align: right; }

/* ---------- Адаптивность ---------- */
@media (max-width: 1024px) {
  .cutout-layout, .conv-layout { grid-template-columns: 1fr; }
  .cutout-panel { flex-direction: row; flex-wrap: wrap; }
  .cutout-panel .panel { flex: 1 1 300px; }
  .home-cards { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .view { padding: 16px 14px 48px; }
  .brand-large .brand-name { font-size: 32px; }
  .compare { height: 360px; }
  .result-card { flex-direction: column; }
  .result-info { flex: none; width: 100%; }
}

/* ---------- Подвал ---------- */
.site-footer {
  max-width: 960px;
  margin: 0 auto;
  padding: 18px 24px 34px;
  text-align: center;
  font-size: 13px;
  color: var(--faint);
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}
.footer-tg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: all 0.15s ease;
}
.footer-tg svg { width: 14px; height: 14px; }
.footer-tg:hover { border-color: var(--border-strong); background: var(--surface-2); }
.footer-link { color: var(--faint); padding: 6px 4px; }
.footer-link:hover { color: var(--accent); }

/* ---------- Рекламные слоты (скрыты, пока пустые) ---------- */
.ad-slot { display: none; }
.ad-slot:not(:empty) {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 16px;
  min-height: 50px;
  max-width: 100%;
  overflow: hidden;
}
.ad-top { margin-bottom: 6px; }
.ad-bottom { margin-top: 6px; }

/* Заглушка «здесь будет реклама» (тестовая, убирается через AD_PLACEHOLDER) */
.ad-ph {
  flex-direction: column;
  gap: 4px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--faint);
  font-size: 13px;
}
.ad-ph-tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
  opacity: 0.7;
}
.ad-ph-text { font-size: 13px; }
