:root {
  --bg: #f4f2ee;
  --card: #ffffff;
  --ink: #1c1a17;
  --muted: #7a756c;
  --accent: #e05c2b;
  --accent-dark: #c24b1f;
  --border: #e3ded5;
  --radius: 18px;
  --shadow: 0 8px 30px rgba(40, 32, 20, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

.header { text-align: center; margin-bottom: 28px; }
.header h1 { font-size: 34px; margin: 0 0 8px; font-weight: 800; letter-spacing: -0.5px; }
.header .accent { color: var(--accent); }
.sub { color: var(--muted); font-size: 17px; margin: 0; }

/* Зона загрузки */
.dropzone {
  background: var(--card);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 46px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 20px;
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--accent);
  background: #fdf6f1;
}
.dz-icon { font-size: 52px; line-height: 1; margin-bottom: 10px; }
.dz-text { font-size: 20px; font-weight: 700; }
.dz-hint { color: var(--muted); margin-top: 6px; font-size: 15px; }
.dz-buttons { display: flex; gap: 10px; margin-top: 18px; justify-content: center; flex-wrap: wrap; }
.dz-btn {
  padding: 13px 22px; border-radius: 12px; border: none; font-size: 16px; font-weight: 700;
  cursor: pointer; background: var(--border); color: var(--ink);
}
.dz-btn.camera { background: var(--accent); color: #fff; }

/* Превью выбранных фото */
.preview-strip { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0 18px; }
.preview-strip[hidden] { display: none; }
.thumb { position: relative; width: 76px; height: 76px; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-rm, .thumb-rot {
  position: absolute; width: 24px; height: 24px; border-radius: 50%;
  background: rgba(0,0,0,.62); color: #fff; border: none; font-size: 13px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.thumb-rm { top: 4px; right: 4px; }
.thumb-rot { bottom: 4px; right: 4px; }

/* Кнопка */
.big-btn {
  display: block;
  width: 100%;
  padding: 22px;
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: 0 6px 0 var(--accent-dark), 0 12px 24px rgba(224, 92, 43, 0.28);
  transition: transform 0.05s, box-shadow 0.05s, opacity 0.15s;
}
.big-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--accent-dark); }
.big-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

/* Тумблер ИИ */
.ai-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 6px;
  cursor: pointer;
  user-select: none;
}
.ai-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.ai-toggle-box {
  width: 52px; height: 30px; flex: 0 0 auto;
  background: var(--border); border-radius: 999px; position: relative;
  transition: background 0.15s;
}
.ai-toggle-box::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; background: #fff; border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: left 0.15s;
}
.ai-toggle input:checked + .ai-toggle-box { background: var(--accent); }
.ai-toggle input:checked + .ai-toggle-box::after { left: 25px; }
.ai-toggle-label { font-weight: 700; font-size: 16px; }
.ai-toggle-label small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }

/* Прогресс */
.progress { margin: 22px 0; }
.progress-text { text-align: center; font-weight: 700; margin-bottom: 10px; font-size: 17px; }
.progress-bar { height: 12px; background: var(--border); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width 0.2s; }

/* Результаты */
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; margin-top: 10px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card .compare { position: relative; aspect-ratio: 4 / 3; overflow: hidden; user-select: none; touch-action: pan-y; cursor: ew-resize; }
.card .compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.card .compare .after { clip-path: inset(0 0 0 50%); }
.card .divider {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 3px; background: #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.15); cursor: ew-resize; transform: translateX(-50%);
}
.card .divider::after {
  content: "⇔"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: #fff; color: #333; width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.card .labels { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; pointer-events: none; }
.card .labels span { background: rgba(0,0,0,0.55); color: #fff; font-size: 12px; padding: 3px 9px; border-radius: 999px; }
.card .actions { display: flex; padding: 12px; gap: 10px; }
.card .actions a,
.card .actions button {
  flex: 1; text-align: center; text-decoration: none; padding: 12px; border-radius: 12px;
  font-weight: 700; font-size: 16px; border: none; cursor: pointer;
}
.card .dl { background: var(--accent); color: #fff; }
.card .redo { background: var(--border); color: var(--ink); }
.card .del { background: #fbe9e5; color: #b3402a; }

.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 0 20px 40px; }
.footer-contacts { margin-bottom: 6px; }
.footer-contacts a { color: var(--muted); }
.footer-link { color: var(--accent); text-decoration: none; font-weight: 600; }

/* Тарифы */
.tariffs { max-width: 860px; margin: 8px auto 0; padding: 0 20px; }
.tariffs h2 { font-size: 22px; margin: 0 0 14px; text-align: center; }
.tariffs-grid { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.tariff { background: var(--card); border-radius: 14px; padding: 18px 20px; text-align: center; box-shadow: var(--shadow); flex: 1; min-width: 130px; max-width: 210px; }
.tariff-name { font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.tariff-price { font-size: 26px; font-weight: 800; color: var(--accent); }
.tariff-unit { color: var(--muted); font-size: 13px; margin-top: 4px; }
.tariff-note { text-align: center; color: var(--muted); font-size: 13px; margin: 12px 0 28px; }

/* Тост */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: #1c1a17; color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 15px;
  font-weight: 600; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
  z-index: 99; max-width: 90%; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Камера */
.camera-modal { position: fixed; inset: 0; background: #000; z-index: 200; display: flex; flex-direction: column; }
.camera-modal[hidden] { display: none; }
.camera-modal video { flex: 1; width: 100%; height: 100%; object-fit: cover; }
.camera-hint { position: absolute; top: 22px; left: 0; right: 0; text-align: center; color: #fff; font-size: 15px; opacity: 0.85; pointer-events: none; }
.camera-controls { position: absolute; bottom: 32px; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 44px; }
.cam-cancel { width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,0.16); color: #fff; border: none; font-size: 20px; cursor: pointer; }
.cam-shoot { width: 76px; height: 76px; border-radius: 50%; background: #fff; border: 4px solid #fff; box-shadow: 0 0 0 3px rgba(255,255,255,0.4); cursor: pointer; }
.cam-spacer { width: 50px; }

@media (max-width: 480px) {
  .header h1 { font-size: 26px; }
  .big-btn { font-size: 20px; padding: 18px; }
}
